| | |
| | | <template> |
| | | <u-modal v-model="show" ref="uModal" title="" :show-cancel-button="true" @confirm="confirm" @cancel="cancel" |
| | | :async-close="true"> |
| | | <view style="padding: 20rpx;"> |
| | | <u-form :model="form" ref="uFormSave" :label-width="280" :rules="rules" :error-type="['toast']"> |
| | | <u-form-item label="批号" :border-bottom="false" prop="value0"> |
| | | <u-input v-model="form.value0" disabled /> |
| | | </u-form-item> |
| | | <u-form-item label="长度" :border-bottom="false" prop="value1"> |
| | | <u-input v-model="form.value1" /> |
| | | </u-form-item> |
| | | <u-form-item label="库位" :border-bottom="false" prop="value2"> |
| | | <u-input v-model="form.value2" disabled /> |
| | | </u-form-item> |
| | | <u-form-item label="盘号" :border-bottom="false" prop="value3"> |
| | | <u-input v-model="form.value3" /> |
| | | </u-form-item> |
| | | <u-form-item label="毛重" :border-bottom="false" prop="value4"> |
| | | <u-input v-model="form.value4" /> |
| | | </u-form-item> |
| | | <u-form-item label="净重" :border-bottom="false" prop="value5"> |
| | | <u-input v-model="form.value5" /> |
| | | </u-form-item> |
| | | <u-form-item label="工序" :border-bottom="false" prop="value6"> |
| | | <u-input v-model="form.value6" disabled /> |
| | | </u-form-item> |
| | | <u-form-item label="成品外径测量值" :border-bottom="false" prop="value7"> |
| | | <u-input v-model="form.value7" /> |
| | | </u-form-item> |
| | | <u-form-item label="退火电压" :border-bottom="false" prop="value8"> |
| | | <u-input v-model="form.value8" /> |
| | | </u-form-item> |
| | | <u-form-item label="转速" prop="value9" :border-bottom="false"> |
| | | <u-input v-model="form.value9" /> |
| | | </u-form-item> |
| | | <u-form-item label="外部气压" prop="value10" :border-bottom="false"> |
| | | <u-input v-model="form.value10" /> |
| | | </u-form-item> |
| | | <u-form-item label="生产速度" prop="value11" :border-bottom="false"> |
| | | <u-input v-model="form.value11" /> |
| | | </u-form-item> |
| | | </u-form> |
| | | </view> |
| | | |
| | | </u-modal> |
| | | <view> |
| | | <u-modal |
| | | v-model="show" |
| | | ref="uModal" |
| | | title="" |
| | | :show-cancel-button="true" |
| | | @confirm="confirm" |
| | | @cancel="cancel" |
| | | :async-close="true" |
| | | :loading="loading" |
| | | > |
| | | <view class="packing-registration-param"> |
| | | <scroll-view |
| | | scroll-y="true" |
| | | style=" |
| | | height: 100%; |
| | | transform: translateZ(0); |
| | | -webkit-font-smoothing: antialiased; |
| | | " |
| | | > |
| | | <view class="packing-registration-param-view"> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">批号</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input class="item-one item-two" v-model="form.outBatchNo" /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">投料批次</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input |
| | | class="item-one item-two" |
| | | v-model="form.ifsBatchNoArr" |
| | | disabled |
| | | /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">长度</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input |
| | | class="item-one item-two" |
| | | v-model="form.overallLength" |
| | | /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">库位</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input |
| | | class="item-one item-two" |
| | | v-model="form.proposedLocation" |
| | | disabled |
| | | /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">盘号</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input class="item-one item-two" v-model="form.reelNumber" /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">盘重</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input class="item-one item-two" v-model="form.reelWeight" /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">毛重</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input class="item-one item-two" v-model="form.grossWeight" /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">净重</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input |
| | | class="item-one item-two" |
| | | v-model="form.netWeight" |
| | | disabled |
| | | /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">废料</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input class="item-one item-two" v-model="form.waste" /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">工序</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input |
| | | class="item-one item-two" |
| | | v-model="form.name" |
| | | disabled |
| | | /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">成品外径测量值</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input |
| | | class="item-one item-two" |
| | | v-model="form.outerDiameter" |
| | | /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">退火电压</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input class="item-one item-two" v-model="form.voltage" /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">转速</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input class="item-one item-two" v-model="form.speed" /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">外部气压</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input class="item-one item-two" v-model="form.pressure" /> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one item-two">生产速度</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input |
| | | class="item-one item-two" |
| | | v-model="form.productionSpeed" |
| | | /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | </u-modal> |
| | | <u-modal |
| | | v-model="showModal" |
| | | title="" |
| | | :show-cancel-button="true" |
| | | :show-confirm-button="true" |
| | | @confirm="confirmTl" |
| | | @cancel="cancelTl" |
| | | > |
| | | <view class="packing-registration-param"> |
| | | <view class="packing-registration-param-view"> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">批号</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <text class="item-one item-two">{{ |
| | | detailedList.ifsBatchNo |
| | | }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">零件描述</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <text class="item-one item-two">{{ detailedList.partName }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | | <view class="packing-registration-param-item-left"> |
| | | <text class="item-one">数量</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <u-input |
| | | class="item-one item-two" |
| | | v-model="detailedList.suppliedQuantity" |
| | | /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </u-modal> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | props: { |
| | | operationTaskList: { |
| | | type: Object, |
| | | required: true, |
| | | default: () => ({}), |
| | | }, |
| | | dutyId: { |
| | | type: Number, |
| | | required: true, |
| | | default: "", |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | showModal: false, |
| | | detailedList: {}, |
| | | show: false, |
| | | form: { |
| | | value0: null, |
| | | value1: null, |
| | | value2: null, |
| | | value3: null, |
| | | value4: null, |
| | | value5: null, |
| | | value6: null, |
| | | value7: null, |
| | | value8: null, |
| | | value9: null, |
| | | value10: null, |
| | | value11: null |
| | | }, |
| | | rules: { |
| | | value1: [ |
| | | { required: true, message: '请输入长度', trigger: ['blur', 'change'] }, |
| | | ], |
| | | value3: [ |
| | | { required: true, message: '请输入盘号', trigger: ['blur', 'change'] }, |
| | | ], |
| | | value4: [ |
| | | { required: true, message: '请输入毛重', trigger: ['blur', 'change'] }, |
| | | ], |
| | | value5: [ |
| | | { required: true, message: '请输入净重', trigger: ['blur', 'change'] }, |
| | | ], |
| | | value7: [ |
| | | { required: true, message: '请输入成品外径测量值', trigger: ['blur', 'change'] }, |
| | | ], |
| | | value8: [ |
| | | { required: true, message: '请输入退火电压', trigger: ['blur', 'change'] }, |
| | | ], |
| | | value9: [ |
| | | { required: true, message: '请输入转速', trigger: ['blur', 'change'] }, |
| | | ], |
| | | value10: [ |
| | | { required: true, message: '请输入外部气压', trigger: ['blur', 'change'] } |
| | | ], |
| | | value11: [ |
| | | { required: true, message: '请输入生产速度', trigger: ['blur', 'change'] } |
| | | ] |
| | | }, |
| | | } |
| | | form: {}, |
| | | ifsBatchNo: [], |
| | | productInputList: [], |
| | | loading: false, |
| | | }; |
| | | }, |
| | | watch: { |
| | | show(val) { |
| | | if (val) { |
| | | this.$nextTick(() => { |
| | | this.$refs.uFormSave.setRules(this.rules); |
| | | }); |
| | | "form.grossWeight"(val) { |
| | | if (val === "") { |
| | | this.form.netWeight = ""; |
| | | } else if (this.form.reelWeight) { |
| | | this.form.netWeight = |
| | | parseFloat(val) - parseFloat(this.form.reelWeight); |
| | | } |
| | | }, |
| | | "form.reelWeight"(val) { |
| | | if (this.form.grossWeight && val) { |
| | | this.form.netWeight = |
| | | parseFloat(this.form.grossWeight) - parseFloat(val); |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | confirm() { |
| | | this.$refs.uFormSave.validate((valid) => { |
| | | if (valid) { |
| | | console.log('验证通过'); |
| | | // 执行提交逻辑(如API请求) |
| | | // 提交成功后关闭模态框 |
| | | if (this.loading) return; |
| | | // if (!this.form.outerDiameter) { |
| | | // this.$u.toast("请输入成品外径测量值"); |
| | | // this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | // return; |
| | | // } |
| | | // if (!this.form.voltage) { |
| | | // this.$u.toast("请输入退火电压"); |
| | | // this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | // return; |
| | | // } |
| | | // if (!this.form.speed) { |
| | | // this.$u.toast("请输入转速"); |
| | | // this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | // return; |
| | | // } |
| | | // if (!this.form.pressure) { |
| | | // this.$u.toast("请输入外部气压"); |
| | | // this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | // return; |
| | | // } |
| | | // if (!this.form.productionSpeed) { |
| | | // this.$u.toast("请输入生产速度"); |
| | | // this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | // return; |
| | | // } |
| | | if (!this.form.outBatchNo) { |
| | | this.$u.toast("请输入批号"); |
| | | this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | return; |
| | | } |
| | | if (Number(this.form.netWeight) == 0) { |
| | | this.$u.toast("净重不为0"); |
| | | this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | return; |
| | | } |
| | | if (!this.form.waste) { |
| | | this.$u.toast("请输入废料"); |
| | | this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | return; |
| | | } |
| | | if (this.form.productInputList.length == 0) { |
| | | this.$u.toast("投料批次不能为空,请扫码投料"); |
| | | this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | return; |
| | | } |
| | | this.operationTaskList.operationTaskId = this.operationTaskList.id; |
| | | this.form.operationTaskId = this.operationTaskList.id; |
| | | this.form.status = this.operationTaskList.status; |
| | | this.form.Persons = this.operationTaskList.Persons; |
| | | this.form.productStaffIds = this.operationTaskList.productStaffIds; |
| | | this.form.productStaffs = this.operationTaskList.productStaffs; |
| | | this.form.dutyRecordId = this.dutyId; |
| | | this.operationTaskList.productOutputList = []; // 创建一个空数组 |
| | | this.operationTaskList.productOutputList.push(this.form); // 向数组中添加元素 |
| | | console.log("this.operationTaskList", this.operationTaskList); |
| | | this.loading = true; |
| | | this.$u.api.workReporting |
| | | .submitPDA(this.operationTaskList) |
| | | .then((res) => { |
| | | this.$emit("update",this.operationTaskList); |
| | | this.$refs.uModal.cancel(); |
| | | } else { |
| | | console.log('验证失败'); |
| | | // 显示错误信息 |
| | | this.$refs.uModal.clearLoading(); // 清除加载状态 |
| | | } |
| | | }); |
| | | }) |
| | | .finally(() => { |
| | | this.loading = false; |
| | | this.$refs.uModal.clearLoading(); |
| | | }); |
| | | }, |
| | | cancel() { |
| | | this.show = false; |
| | | this.form = {}; |
| | | this.ifsBatchNo = []; |
| | | this.productInputList = []; |
| | | }, |
| | | open() { |
| | | this.show = true; |
| | | cancelTl() { |
| | | this.showModal = false; |
| | | this.detailedList = {}; |
| | | }, |
| | | updateArray(arr, newObj) { |
| | | // 查找数组中是否有相同的 id |
| | | let index = arr.findIndex(item => item.ifsBatchNo === newObj.ifsBatchNo); |
| | | |
| | | if (index !== -1) { |
| | | // 如果找到相同 id 的对象,替换原有对象 |
| | | arr[index] = newObj; |
| | | } else { |
| | | // 如果没有找到相同 id 的对象,直接推入新对象 |
| | | arr.push(newObj); |
| | | } |
| | | return arr; |
| | | }, |
| | | confirmTl() { |
| | | let ifsBatchNoArr = []; |
| | | let updatedArrayList = this.updateArray(this.productInputList, this.detailedList); |
| | | console.log("updatedArrayList", updatedArrayList); |
| | | // this.productInputList.push(updatedArrayList); |
| | | this.$set(this.form, "productInputList", this.productInputList); |
| | | |
| | | this.productInputList.forEach((item) => { |
| | | ifsBatchNoArr.push(item.ifsBatchNo) |
| | | }) |
| | | console.log("ifsBatchNoArr", ifsBatchNoArr); |
| | | // this.ifsBatchNo.push(ifsBatchNoArr); |
| | | this.$set(this.form, "ifsBatchNoArr", ifsBatchNoArr); |
| | | console.log("this.form", this.form); |
| | | this.showModal = false; |
| | | this.detailedList = {}; |
| | | }, |
| | | open(val) { |
| | | this.show = true; |
| | | this.form = val.data; |
| | | }, |
| | | // 回显扫码的信息-报工单 |
| | | saveForm(val) { |
| | | this.$u.api.cancelReporting |
| | | .selInputPartInfoPDA({ |
| | | outBatchNo: val.BN, |
| | | partNo: val.PN, |
| | | moOn: this.operationTaskList.moOn, |
| | | }) |
| | | .then((res) => { |
| | | const list = { |
| | | suppliedQuantity: res.data.suppliedQuantity, |
| | | ifsBatchNo: res.data.ifsBatchNo, |
| | | partNo: res.data.partNo, |
| | | partName: res.data.partName, |
| | | locationNo: res.data.locationNo, |
| | | ifsLineItemNo: res.data.ifsLineItemNo, |
| | | serialNo: res.data.serialNo, |
| | | engChgLevel: res.data.engChgLevel, |
| | | ifsWdr: res.data.waivDevRejNo, |
| | | activitySeq: res.data.activitySeq, |
| | | }; |
| | | this.detailedList = list; |
| | | this.showModal = true; |
| | | }); |
| | | }, |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | ::v-deep .u-input__input { |
| | | text-align: right !important; |
| | | } |
| | | @import "../index.scss"; |
| | | </style> |