From c7262ac9c1ac9f844f79b9193734c96644e3a165 Mon Sep 17 00:00:00 2001 From: yyb <995253665@qq.com> Date: 星期二, 22 七月 2025 15:45:53 +0800 Subject: [PATCH] 报工增加按人员或按组报工 --- pages/product/report/index.vue | 352 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 297 insertions(+), 55 deletions(-) diff --git a/pages/product/report/index.vue b/pages/product/report/index.vue index fdcf7b3..6b92297 100644 --- a/pages/product/report/index.vue +++ b/pages/product/report/index.vue @@ -43,8 +43,8 @@ <u-form-item label="闆朵欢鎻忚堪" :border-bottom="false" prop="partName"> <u-input v-model="form.partName" placeholder="" disabled /> </u-form-item> - <u-form-item label="鎵归噺澶у皬" :border-bottom="false" prop="qtyrequired"> - <u-input v-model="form.qtyrequired" placeholder="" disabled /> + <u-form-item label="鎵归噺澶у皬" :border-bottom="false" prop="qtyRequired"> + <u-input v-model="form.qtyRequired" placeholder="" disabled /> </u-form-item> <u-form-item label="鍓╀綑鏁伴噺" @@ -68,26 +68,28 @@ <u-radio name="part">鏇夸唬闆朵欢</u-radio> </u-radio-group> </u-form-item> - <u-form-item label="鐗╂枡" prop="materialcost"> - <u-radio-group v-model="form.materialcost" :disabled="true"> + <u-form-item label="鐗╂枡" prop="materialCost"> + <u-radio-group v-model="form.materialCost" :disabled="true"> <u-radio name="鍊掑啿">鍊掑啿</u-radio> <u-radio name="鎶曟枡">鎶曟枡</u-radio> </u-radio-group> </u-form-item> - <u-form-item label="宸ュ簭"> - <u-checkbox-group> - <u-checkbox - :name="item.name" - v-for="(item, index) in checkboxList" - :key="index" - v-model="item.value" - @change="changeCheckbox" - :disabled="subdisabled || item.disabled" - > - {{ item.name }} - </u-checkbox> - </u-checkbox-group> + <u-form-item label="绠�鍖栫墿鏂欐鏌�" prop="simplifyMaterials"> + <u-radio-group v-model="form.simplifyMaterials" :disabled="subdisabled || simplifyDisabled" @change="radioChange"> + <u-radio name="true">鏄�</u-radio> + <u-radio name="false">鍚�</u-radio> + </u-radio-group> + </u-form-item> + <u-form-item label="鎶ュ伐鏂瑰紡" prop="status"> + <u-radio-group v-model="form.status" :disabled="subdisabled" @change="handleReportTypeChange"> + <u-radio name="false">鎸夌彮缁勬姤宸�</u-radio> + <u-radio name="true">鎸変汉鍛樻姤宸�</u-radio> + </u-radio-group> </u-form-item> + <u-form-item label="浜哄憳鍚嶇О" :border-bottom="false" prop="Persons"> + <u-input v-model="form.Persons" type="select" placeholder="璇烽�夋嫨" + @click="openselectedPersons" :disabled="!canSelectPerson || subdisabled"/> + </u-form-item> <u-form-item label="浜у嚭鍒楄〃" :border-bottom="false"></u-form-item> </u-form> <view class="wrap"> @@ -101,6 +103,7 @@ v-for="(item, index) in InventoryReceiptList" :key="index" :index="index" + @click="cancelReport(item)" > <view class="content-header"> <view class="content-header-title">{{ index + 1 }}</view> @@ -111,7 +114,7 @@ <view class="_label-name">鎵瑰彿锛�</view> </view> <view class="_content"> - {{ item.productNo }} + {{ item.outBatchNo }} </view> </view> <view class="row-list"> @@ -150,6 +153,67 @@ :operationTaskList="this.form" @update="handleUpdate" /> + <u-modal + width="720rpx" + v-model="showModal" + title="" + :show-cancel-button="true" + :show-confirm-button="true" + @confirm="confirmModle" + @cancel="cancelModle" + > + <view class="popup-content"> + <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">{{ detailedList.outBatchNo }}</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">{{ detailedList.partNo }}</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"> + <span class="item-one">{{ detailedList.partName }}</span> + </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"> + <span class="item-one">{{ detailedList.netWeight }}</span> + </view> + </view> + </view> + </view> + </view> + </u-modal> + <u-modal v-model="personShowModal" title="" :show-cancel-button="true" :show-confirm-button="true" + @confirm="confirmSelection" @cancel="cancelSelection"> + <view class="popup-content"> + <view class="popup-header"> + <checkbox-group @change="checkboxChange"> + <label class="checkbox-item" v-for="(item, index) in selectedPersons" :key="index"> + <checkbox :value="item.staffId" :checked="item.checked" /> + <text class="label">{{ item.staffName }}</text> + </label> + </checkbox-group> + </view> + </view> + </u-modal> <scan></scan> </div> </template> @@ -166,19 +230,21 @@ }, data() { return { - checkboxList: [ - { - name: "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�", - value: false, - disabled: false, - }, - { - name: "绠�鍖栫墿鏂欐鏌�", - value: false, - disabled: false, - }, - ], + simplifyDisabled:false, + // checkboxList: [ + // { + // name: "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�", + // value: false, + // disabled: false, + // }, + // { + // name: "绠�鍖栫墿鏂欐鏌�", + // value: false, + // disabled: false, + // }, + // ], InventoryReceiptList: [], + selectedPersons: [], form: { workstationId: "", work: "", @@ -187,15 +253,21 @@ moOn: "", partNo: "", partName: "", - qtyrequired: "", + qtyRequired: "", Jianqtyfinished: "", proposedLocation: "", productType: "dep", receive: "mo", - materialcost: "", - autoReport: false, - simplifyMaterials: false, + materialCost: "", + // autoReport: false, + simplifyMaterials: 'false', + status: 'false', + Persons: '', + productStaffIds: [], + productStaffs:[] }, + personList: [], + canSelectPerson: false, rules: { work: [ { @@ -239,11 +311,29 @@ trigger: ["change"], }, ], + status: [ + { + required: true, + message: "璇烽�夋嫨鎶ュ伐鏂瑰紡", + trigger: ["change"], + }, + ], + Persons: [ + { + required: true, + message: "璇烽�夋嫨浜哄憳", + trigger: ["change"], + }, + ], }, showSave: false, operationTaskId: "", subdisabled: false, codeInfoId: "", + detailedList: {}, + showModal: false, + personShowModal: false, + checkboxList: [], }; }, // 鐐瑰嚮鎻愪氦鎸夐挳鐨勪簨浠跺鐞嗗嚱鏁� @@ -260,6 +350,7 @@ id: this.form.id, }) .then((res) => { + res.data.name = this.form.name; this.$refs.saveForm.open(res); uni.hideLoading(); }); @@ -279,11 +370,15 @@ //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲� if (data.code) { let codeInfo = JSON.parse(data.code); - that.codeInfoId = codeInfo.id; if (codeInfo.moOn) { + that.codeInfoId = codeInfo.id; // 鎵弿鎶ュ伐鍗曚簩缁寸爜 that.saveForm(codeInfo); that.getHandelList(); + } + if (codeInfo.BN) { + // 鎵弿鎶ュ伐鍗曚簩缁寸爜 + that.CopperReportingWork(codeInfo); } } }); @@ -291,11 +386,154 @@ watch: { "form.taskNo": function (newVal, oldVal) { this.subdisabled = false; - this.checkboxList[1].value = false; - this.checkboxList[0].value = false; }, + 'form.status'(newVal) { + this.selectedPersons = this.selectedPersons.map(item => ({ + ...item, + checked: newVal === 'false' + })); + } }, methods: { + // 澶勭悊鎶ュ伐鏂瑰紡鍙樻洿 + handleReportTypeChange() { + // 鍒囨崲鎶ュ伐鏂瑰紡鏃舵竻绌轰汉鍛樺悕绉� + this.form.Persons = ''; + this.form.productStaffs = []; + this.form.productStaffIds = []; + }, + // 浜哄憳鍚嶇О + openselectedPersons() { + this.personShowModal = true; + }, + // 澶嶉�夋鍙樺寲浜嬩欢 + checkboxChange(e) { + console.log('e',e) + const values = e.target.value || []; + if (this.form.status === 'true') { + // 鍗曢�夋ā寮忥紝鍙厑璁搁�夋嫨涓�涓汉 + const previouslySelected = this.selectedPersons.find(item => item.checked); + const newlySelected = values.length > 0 ? values[values.length - 1] : null; + if (previouslySelected && newlySelected && previouslySelected.staffId !== newlySelected) { + // 宸叉湁閫変腑椤逛笖閫夋嫨浜嗘柊鐨勯」锛屾彁绀哄彧鑳介�夋嫨涓�涓汉 + this.$u.toast('鎸変汉鍛樻姤宸ユ椂鍙兘閫夋嫨涓�浣嶄汉鍛�'); + // 淇濇寔鍘熼�夋嫨 + this.selectedPersons = this.selectedPersons.map(item => ({ + ...item, + checked: item.staffId === previouslySelected.staffId + })); + + } else { + // 棣栨閫夋嫨鎴栧彇娑堥�夋嫨 + this.selectedPersons = this.selectedPersons.map(item => ({ + ...item, + checked: newlySelected ? item.staffId === newlySelected : false + })); + + } + } else { + // 澶氶�夋ā寮� + this.selectedPersons = this.selectedPersons.map(item => ({ + ...item, + checked: values.includes(item.staffId) + })); + } + }, + // 纭閫夋嫨 + confirmSelection() { + const selected = this.selectedPersons.filter(item => item.checked); + // 鏍规嵁鎶ュ伐鏂瑰紡璁剧疆浜哄憳鍚嶇О + if (this.form.status === 'true' && selected.length > 0) { + this.form.Persons = selected[0].staffName; + } else { + this.form.Persons = selected.map(item => item.staffName).join(','); + } + this.form.productStaffs = selected.map(item => item.staffNo); + this.form.productStaffIds = selected.map(item => item.staffId); + }, + cancelSelection(){}, + // 閾滄潌鎶ュ伐 + CopperReportingWork(val) { + const copperList = {}; + copperList.outBatchNo = val.BN + copperList.partNo = val.PN + copperList.weighingClerk = val.WC + copperList.executiveStandard = val.ES + copperList.netWeight = val.NW + copperList.specificationType = val.ST + copperList.grossWeight = val.TR + copperList.operationTaskId = this.form.id + copperList.status = this.form.status; + copperList.Persons = this.form.Persons; + copperList.productStaffIds = this.form.productStaffIds; + copperList.productStaffs = this.form.productStaffs; + this.form.productOutputList = []; + this.form.operationTaskId = this.form.id; + this.form.productOutputList.push(copperList); + console.log('this.form',this.form) + this.$u.api.workReporting.submitPDA(this.form).then((res) => { + this.subdisabled = true; + this.getHandelList(); + this.$u.toast("鎶ュ伐鎴愬姛"); + }); + }, + // 鐐瑰嚮纭鍚庤幏鍙栧彇娑堟姤宸ヨ褰� + radioChange() { + // 澶勭悊鍗曢�夋鍙樺寲浜嬩欢 + }, + // 鑾峰彇浜哄憳鍒楄〃 + getPersonList(dutyId) { + console.log('111111') + try { + this.$u.api.workReporting.getPersonByDutyRecordId({ id: dutyId }).then((res) => { + this.selectedPersons = res.data.map(item => ({ + ...item, + checked: this.form.status === 'false' + })); + }) + .catch(err => { + console.log(err) + }) + } catch (err) { + console.log(err) + + } + + }, + + confirmModle() { + console.log("鐐瑰嚮纭鍚庤幏鍙栧彇娑堟姤宸ヨ褰�"); + // 澶勭悊纭閫昏緫 + this.$u.api.cancelReporting + .cancelDTAOfWorkApplication({ + outBatchNo: this.detailedList.outBatchNo, + }) + .then((res) => { + console.log("res", res); + this.showModal = false; + this.getHandelList(); + this.$u.toast("鍙栨秷鎶ュ伐鎴愬姛"); + }); + }, + cancelModle() { + this.showModal = false; // 鍏抽棴寮圭獥 + }, + // 鍙栨秷鎶ュ伐 + cancelReport(item) { + let that = this; + uni.showModal({ + title: "鎻愮ず", + content: "鏄惁纭鍙栨秷鎵规" + item.outBatchNo + "鐨勬姤宸�", + success: function (res) { + if (res.confirm) { + that.detailedList = item; + that.showModal = true; + } else if (res.cancel) { + return; + } + }, + }); + }, getHandelList() { this.$u.api.workReporting .getProductMainV1({ @@ -308,14 +546,14 @@ }); }, // 澶氶�夊鐞� - changeCheckbox(val) { - if (val.name === "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�") { - this.form.autoReport = val.value; - } - if (val.name === "绠�鍖栫墿鏂欐鏌�") { - this.form.simplifyMaterials = val.value; - } - }, + // changeCheckbox(val) { + // if (val.name === "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�") { + // this.form.autoReport = val.value; + // } + // if (val.name === "绠�鍖栫墿鏂欐鏌�") { + // this.form.simplifyMaterials = val.value; + // } + // }, handleUpdate() { this.subdisabled = true; this.getHandelList(); @@ -354,19 +592,23 @@ moOn: val.moOn, partNo: val.partNo, partName: val.partName, - qtyrequired: val.qtyrequired, - Jianqtyfinished: val.qtyrequired - val.qtyfinished, + qtyRequired: val.qtyRequired, + Jianqtyfinished: val.qtyRequired - val.qtyFinished, proposedLocation: val.proposedLocation, productType: "dep", - receive: "mo", // 澶嶉�夋缁勭殑鍊� - materialcost: val.materialcost, - autoReport: false, - simplifyMaterials: false, + receive: "mo", + materialCost: val.materialCost, + // autoReport: false, + simplifyMaterials: 'false', + status: 'false', + Persons:'', }; - this.checkboxList[1].value = false; - this.checkboxList[0].value = false; - if (this.form.materialcost == "鍊掑啿") { - this.checkboxList[1].disabled = true; + if (this.form.materialCost == "鍊掑啿") { + this.simplifyDisabled = true; + } + // 濡傛灉鏈塪utyNo锛岃幏鍙栦汉鍛樺垪琛� + if (val.dutyId) { + this.getPersonList(val.dutyId); } }, }, -- Gitblit v1.9.3