<template>
|
<view>
|
<view class="form">
|
<view class="form-item">
|
<view class="title">单据号:</view>
|
<view class="righton">
|
<input name="HBillNo" v-model="hform.HBillNo" disabled placeholder="请输入单据号" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">日期:</view>
|
<view class="righton">
|
<input name="HDate" disabled v-model="hform.HDate" placeholder="请选择日期" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">内部单据号:</view>
|
<view class="right">
|
<input name="HInnerBillNo" v-model="hform.HInnerBillNo" placeholder="请输入内部单据号" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">模具编码:</view>
|
<view class="righton">
|
<input name="HMouldNumber" disabled v-model="hform.HMouldNumber" placeholder="请输入模具编码" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>模具:</view>
|
<view class="right" style="width: 380rpx;">
|
<input name="HMouldName" v-model="hform.HMouldName" @blur="getHBarCodeData(hform.HMouldName)"
|
placeholder="请扫描模具条码" />
|
</view>
|
<uni-icons type="scan"
|
style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;font-weight: 500;"
|
size="20" @click="toScanCode"></uni-icons>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>班次:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHShifts" placeholder="请选择班次" v-model="hform.HShiftsName"
|
@input="HShiftsChange"></uni-combox>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title">点检开始:</view>
|
<view class="right">
|
<picker mode="date" v-model="hform.HBeginDate" @change="HBeginDateChange">
|
<view class="picker-overlay"></view>
|
<input name="HBeginDate" disabled v-model="hform.HBeginDate" placeholder="请选择点检开始日期" />
|
</picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">点检结束:</view>
|
<view class="right">
|
<picker mode="date" v-model="hform.HEndDate" @change="HEndDateChange">
|
<view class="picker-overlay"></view>
|
<input name="HEndDate" disabled v-model="hform.HEndDate" placeholder="请选择点检结束日期" />
|
</picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">点检计划编号:</view>
|
<view class="right" style="width: 380rpx;" @tap="showPlan=true">
|
<input name="HPlanName" disabled v-model="hform.HPlanName" placeholder="请选择点检计划编号" />
|
</view>
|
<uni-icons type="list"
|
style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;font-weight: 500;"
|
size="20" @click="showPlan=true"></uni-icons>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>模具点检规程:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHMouldMaintainRuleInterNo" placeholder="请选择模具点检规程"
|
v-model="hform.HMouldDotCheckRuleNo" @input="HMouldMaintainRuleInterNoChange"></uni-combox>
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="title"><text>*</text>结果判定:</view>
|
<view class="right" style="display: flex; align-items: center; padding: 0 20rpx; border: none;">
|
<view style="display: flex; align-items: center;">
|
<checkbox-group @change="onLastResultChange">
|
<checkbox :value="'true'" :checked="hform.HLastResult"></checkbox>
|
</checkbox-group>
|
<text style="margin-left: 10rpx;">合格</text>
|
|
</view>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item" style="align-items: flex-start;">
|
<view class="title">异常情况记录:</view>
|
<view class="right" style="min-height: 100rpx;">
|
<textarea name="HErrNote" v-model="hform.HErrNote" auto-height maxlength="-1"
|
placeholder="请输入异常情况记录"></textarea>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item" style="align-items: flex-start;">
|
<view class="title">重大安全隐患记录:</view>
|
<view class="right" style="min-height: 100rpx;">
|
<textarea name="HBigSafeNote" v-model="hform.HBigSafeNote" auto-height maxlength="-1"
|
placeholder="请输入重大安全隐患记录"></textarea>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item" style="align-items: flex-start;">
|
<view class="title">摘要:</view>
|
<view class="right" style="min-height: 100rpx;">
|
<textarea name="HExplanation" v-model="hform.HExplanation" auto-height maxlength="-1"
|
placeholder="请输入摘要"></textarea>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item" style="align-items: flex-start;">
|
<view class="title">备注:</view>
|
<view class="right" style="min-height: 100rpx;">
|
<textarea name="HRemark" v-model="hform.HRemark" auto-height maxlength="-1"
|
placeholder="请输入备注"></textarea>
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view v-if="showmore">
|
<view class="form-item">
|
<view class="title">制单人:</view>
|
<view class="righton">
|
<input v-model="hform.HMaker" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">制单日期:</view>
|
<view class="righton">
|
<input v-if="hform.HMakeDate" v-model="hform.HMakeDate.substr(0,10)" disabled />
|
<input v-else v-model="hform.HMakeDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">修改人:</view>
|
<view class="righton">
|
<input v-model="hform.HUpDater" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">修改日期:</view>
|
<view class="righton">
|
<input v-if="hform.HUpDateDate" v-model="hform.HUpDateDate.substr(0,10)" disabled />
|
<input v-else v-model="hform.HUpDateDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">审核人:</view>
|
<view class="righton">
|
<input v-model="hform.HChecker" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">审核日期:</view>
|
<view class="righton">
|
<input v-if="hform.HCheckDate" v-model="hform.HCheckDate.substr(0,10)" disabled />
|
<input v-else v-model="hform.HCheckDate" disabled />
|
</view>
|
</view>
|
</view>
|
<view class="other">
|
<view v-if="!showmore" @tap="showmore = true">
|
展开其他信息<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons>
|
</view>
|
<view v-if="showmore" @tap="showmore = false">
|
折叠其他信息<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="top"></uni-icons>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="tip"><text>*</text>注: 请点击下方绿色新增按钮添加点检项信息(必填)</view>
|
</view>
|
|
<view class="bottom-btn">
|
<button class="btn-a" size="mini" @tap="submit">提交</button>
|
<button class="btn-b" size="mini" @tap="showMask = true">新增</button>
|
<button class="btn-c" size="mini" @tap="goBack">退出</button>
|
</view>
|
</view>
|
|
<plan @planData="getPlanData" @close="closeMask" v-if="showPlan"></plan>
|
<formDetail :form1List='form1List' @hformList='hformList' v-if="showMask"></formDetail>
|
</view>
|
</template>
|
<script>
|
import getDateTime from '@/utils/getdateTime.js';
|
import plan from './plan.vue';
|
import formDetail from './formDetail.vue';
|
import {
|
getUserInfo
|
} from '../../../utils/auth'
|
export default {
|
components: {
|
plan,
|
formDetail
|
},
|
data() {
|
return {
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
arrayHMouldName: [],
|
showPlan: false,
|
showmore: false,
|
arrayHMouldMaintainRuleInterNo: [], //规程
|
HMouldMaintainRuleInterNoList: [],
|
arrayHShifts: [], //班次
|
HShiftsList: [],
|
hform: {
|
HInterID: 0,
|
HBillNo: '',
|
HDate: getDateTime.dateTimeStr('y-m-d'),
|
HInnerBillNo: '',
|
HMouldID: '',
|
HMouldName: '',
|
HMouldNumber: '',
|
HShiftsID: '0',
|
HShiftsName: '',
|
|
HLastResult: 'true',
|
HPlanNo: '',
|
HPlanInterID: '0',
|
HMainSourceInterID: '0',
|
HMainSourceEntryID: '0',
|
HMainSourceBillNo: '',
|
HBeginDate: '',
|
HEndDate: '',
|
HMouldDotCheckRuleID: '0',
|
HMouldDotCheckRuleNo: '',
|
HBigSafeNote:'',
|
HErrNote:'',
|
HExplanation: '',
|
HRemark: '',
|
|
HMaker: getUserInfo().Czymc,
|
HMakeDate: '',
|
HUpDater: '',
|
HUpDateDate: '',
|
HChecker: '',
|
HCheckDate: '',
|
HCloseMan: '',
|
HCloseDate: '',
|
HDeleteMan: '',
|
HDeleteDate: '',
|
},
|
|
showMask: false,
|
form1List: [],
|
}
|
},
|
onLoad(e) {
|
this.getHShiftsList()
|
this.getHMouldMaintainRuleInterList()
|
if (e.hmainid) {
|
this.getEditData(e.hmainid)
|
} else {
|
this.getNewData()
|
}
|
|
},
|
methods: {
|
//监听复选框
|
onLastResultChange(e) {
|
// 通过 value 判断状态
|
this.hform.HLastResult = e.detail.value.includes('true');
|
},
|
//扫码
|
toScanCode() {
|
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
mpaasScanModule.mpaasScan({
|
'hideAlbum': true,
|
'timeoutInterval': '10', //超时时间
|
'timeoutText': '未识别到二维码' //超时提醒
|
}, (ret) => {
|
console.log(ret.resp_result)
|
this.hform.HMouldName = ret.resp_result
|
this.getHBarCodeData(ret.resp_result)
|
})
|
},
|
getHBarCodeData(HBarCode) {
|
uni.request({
|
url: this.serverUrl + '/QJ_PDA_MouldDotCheckBill/txtHBarCode_KeyDown',
|
data: {
|
HBarCode: this.hform.HMouldName
|
},
|
success: (res) => {
|
console.log(res.data);
|
if (res.data.count == 1) {
|
var data = res.data.data[0]
|
this.hform.HMouldID = data.HInterID
|
this.hform.HMouldName = data.HName
|
this.hform.HMouldNumber = data.HMouldNo
|
}
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//点检开始选择
|
HBeginDateChange(e) {
|
console.log(e.detail.value)
|
this.hform.HBeginDate = e.detail.value
|
},
|
//点检结束选择
|
HEndDateChange(e) {
|
console.log(e.detail.value)
|
this.hform.HEndDate = e.detail.value
|
},
|
//班次
|
getHShiftsList() {
|
uni.request({
|
url: this.serverUrl + '/Web/GetGy_ShiftsList_Json',
|
data: {
|
Shifts: ''
|
},
|
success: (res) => {
|
if (res.data.count == 1) {
|
this.HShiftsList = res.data.data
|
for (var i = 0; i < res.data.data.length; i++) {
|
this.arrayHShifts[i] = res.data.data[i].班次名称
|
}
|
this.$forceUpdate();
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//选择班次
|
HShiftsChange(e) {
|
for (var i = 0; i < this.HShiftsList.length; i++) {
|
if (this.HShiftsList[i].班次名称 == e) {
|
this.hform.HShiftsID = this.HShiftsList[i].HItemID
|
}
|
}
|
},
|
//选择点检计划编号
|
getPlanData(e) {
|
console.log(e)
|
this.hform.HPlanNo = e.HPlanName
|
this.hform.HPlanName = e.HPlanName
|
this.hform.HPlanInterID = e.HInterID
|
this.hform.HMainSourceInterID = e.HInterID
|
this.hform.HMainSourceBillNo = e.HPlanName
|
this.showPlan = false
|
|
},
|
closeMask(e) {
|
this.showPlan = false
|
},
|
//获取模具点检规程列表数据
|
getHMouldMaintainRuleInterList() {
|
uni.request({
|
url: this.serverUrl + '/Sc_MouldDotCheckRuleBill/Sc_MouldDotCheckRuleList',
|
data: {
|
sWhere: '',
|
user: uni.getStorageSync('HUserName')
|
},
|
success: (res) => {
|
if (res.data.count == 1) {
|
this.HMouldMaintainRuleInterNoList = res.data.data
|
for (var i = 0; i < res.data.data.length; i++) {
|
this.arrayHMouldMaintainRuleInterNo[i] = res.data.data[i].单据号
|
}
|
this.$forceUpdate();
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//选择模具点检规程
|
HMouldMaintainRuleInterNoChange(e) {
|
for (var i = 0; i < this.HMouldMaintainRuleInterNoList.length; i++) {
|
if (this.HMouldMaintainRuleInterNoList[i].单据号 == e) {
|
this.hform.HMouldDotCheckRuleID = this.HMouldMaintainRuleInterNoList[i].hmainid
|
this.hform.HMouldDotCheckRuleNo = this.HMouldMaintainRuleInterNoList[i].单据号
|
//子表
|
uni.request({
|
url: this.serverUrl +
|
'/Sc_MouldMaintainRuleBill/GetMouldRuleSubList-Detail',
|
data: {
|
HInterID: this.hform.HMouldDotCheckRuleID,
|
HBillType: '3821'
|
},
|
success: (res) => {
|
if (res.data.count == 1) {
|
this.form1List = res.data.list[0];
|
console.log(2, res.data.list[0]);
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
}
|
}
|
},
|
|
hformList(e) {
|
console.log(e)
|
this.form1List = e
|
this.showMask = false
|
},
|
|
//编辑
|
getEditData(hmainid) {
|
//主表
|
uni.request({
|
url: this.serverUrl + '/Sc_MouldDotCheckBill/Sc_MouldDotCheckBillListCheckDetai',
|
data: {
|
HID: hmainid
|
},
|
success: (res) => {
|
console.log(1, res.data.data.h_v_Sc_MouldDotCheckBillMain_Edit);
|
if (res.data.code == 1) {
|
var data = res.data.data.h_v_Sc_MouldDotCheckBillMain_Edit[0]
|
this.hform = {
|
HInterID: hmainid,
|
HBillNo: data.单据号,
|
HDate: data.日期.substr(0, 10),
|
HInnerBillNo: data.内部单据号,
|
HMouldID: data.HMouldID,
|
HMouldNumber: data.产品模具代码,
|
HMouldName: data.产品模具,
|
HPlanNo: data.点检计划编号,
|
HPlanName: data.点检计划编号,
|
HPlanInterID: data.HPlanInterID,
|
HBeginDate: data.点检开始日期.substr(0, 10),
|
HEndDate: data.点检结束日期.substr(0, 10),
|
HShiftsID: data.HShiftsID ,
|
HShiftsName: data.班次名称,
|
HLastResult: data.最终结论 === '合格',
|
HMouldDotCheckRuleID: data.HMouldDotCheckRuleID,
|
HMouldDotCheckRuleNo: data.器具点检规程单据号,
|
HErrNote: data.异常情况记录,
|
HBigSafeNote: data.重大安全隐患记录,
|
HExplanation: data.摘要,
|
HRemark: data.备注,
|
|
HMaker: data.制单人,
|
HMakeDate: data.制单日期,
|
HUpDater: data.修改人,
|
HUpDateDate: data.修改日期,
|
HChecker: data.审核人,
|
HCheckDate: data.审核日期,
|
HDeleteMan: data.作废人,
|
HDeleteDate: data.作废日期,
|
}
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
//子表
|
uni.request({
|
url: this.serverUrl + '/Sc_MouldDotCheckBill/Sc_MouldDotCheckBillListProjectDetai',
|
data: {
|
sqlWhere: 'and HInterID=' + hmainid
|
},
|
success: (res) => {
|
if (res.data.count == 1) {
|
this.form1List = res.data.list[0];
|
console.log(2, res.data.list[0]);
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//新增
|
getNewData() {
|
uni.request({
|
url: this.serverUrl + '/Web/GetMAXNum',
|
data: {
|
HBillType: '3821'
|
},
|
success: (res) => {
|
console.log(res.data)
|
if (res.data.count == 1) {
|
this.hform.HInterID = 0
|
this.hform.HBillNo = res.data.data[0].HBillNo
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
|
submit() {
|
if (!this.hform.HDate) {
|
uni.showToast({
|
title: '请选择日期',
|
icon: 'none'
|
})
|
} else if (!this.hform.HMouldID) {
|
uni.showToast({
|
title: '请选择模具',
|
icon: 'none'
|
})
|
} else if (!this.hform.HBeginDate) {
|
uni.showToast({
|
title: '请选择点检开始日期',
|
icon: 'none'
|
})
|
} else if (!this.hform.HEndDate) {
|
uni.showToast({
|
title: '请选择点检结束日期',
|
icon: 'none'
|
})
|
} else if (!this.hform.HMouldDotCheckRuleID) {
|
uni.showToast({
|
title: '请选择模具点检规程',
|
icon: 'none'
|
})
|
} else if (this.form1List.length == 0) {
|
uni.showToast({
|
title: '请新增点检项信息,点检项不可为空',
|
icon: 'none'
|
})
|
} else {
|
uni.showLoading({
|
title: '请稍候'
|
})
|
var sMainStr = JSON.stringify(this.hform);
|
var sSubStr = JSON.stringify(this.form1List);
|
var sMainSub = sMainStr + ';' + sSubStr + ";" + uni.getStorageSync('HUserName');
|
console.log(sMainSub);
|
uni.request({
|
url: this.serverUrl + '/Sc_MouldDotCheckBill/SaveGetMouldDotCheckBillList',
|
method: 'POST',
|
dataType: "json",
|
data: {
|
msg: sMainSub
|
},
|
success: (res) => {
|
console.log(1, res);
|
uni.hideLoading()
|
if (res.data.count == 1) {
|
|
}
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
}
|
},
|
goBack() {
|
uni.navigateBack()
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.form {
|
width: 668rpx;
|
margin: 20rpx auto;
|
padding-bottom: 240rpx;
|
}
|
|
.tab_area {
|
width: 100%;
|
height: 50rpx;
|
}
|
|
.form-item {
|
display: flex;
|
align-items: center;
|
font-size: 30rpx;
|
padding: 6rpx 0;
|
|
.title {
|
width: 208rpx;
|
}
|
|
.right {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
}
|
|
.righton {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #e4e4e4;
|
background-color: #e4e4e4;
|
}
|
|
text {
|
color: red;
|
font-weight: bold;
|
}
|
|
input {
|
width: 100%;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
|
textarea {
|
width: 98%;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
|
.tip {
|
color: #da9100;
|
margin-top: 20rpx;
|
}
|
}
|
|
.other {
|
margin-top: 8rpx;
|
text-align: center;
|
font-size: 28rpx;
|
padding: 4rpx 18rpx;
|
color: #1890FF;
|
}
|
|
.bottom-btn {
|
width: 100%;
|
// height: 120rpx;
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
background-color: #fff;
|
box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
|
padding: 30rpx 40rpx 40rpx 40rpx;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
|
.btn-a {
|
background-color: #3A78FF;
|
color: #fff;
|
}
|
|
.btn-b {
|
background-color: #41a863;
|
color: #fff;
|
margin-left: 30rpx;
|
}
|
|
.btn-c {
|
background-color: #acacac;
|
color: #fff;
|
position: absolute;
|
right: 120rpx;
|
}
|
}
|
</style>
|