From 33ad9bff8eb0e6be50efbaab76ae71c76b6e218b Mon Sep 17 00:00:00 2001 From: yyb <995253665@qq.com> Date: 星期四, 21 八月 2025 14:17:33 +0800 Subject: [PATCH] PDA报工页面投料产量和汇报产量放到主页面,调整逻辑,接口联调,取消报工页面逻辑梳理,接口联调 --- pages/product/report/index.vue | 1025 ++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 665 insertions(+), 360 deletions(-) diff --git a/pages/product/report/index.vue b/pages/product/report/index.vue index d66fafe..ac3a2e4 100644 --- a/pages/product/report/index.vue +++ b/pages/product/report/index.vue @@ -1,368 +1,673 @@ <template> - <!-- 鎶ュ伐 --> - <div class="page"> - <u-form - :model="form" - ref="uForm" - :label-width="200" - :rules="rules" - :error-type="['toast']" - > - <u-form-item label="杞﹂棿" :border-bottom="false" prop="work"> - <u-radio-group v-model="form.work" :disabled="subdisabled"> - <u-radio name="dt">瀵间綋</u-radio> - <u-radio name="tg">閾滄潌</u-radio> - </u-radio-group> - </u-form-item> - <u-form-item label="鎶ュ伐鍗曞彿" :border-bottom="false" prop="taskNo"> - <u-input - v-model="form.taskNo" - type="select" - placeholder="璇锋壂鎻忔姤宸ュ崟鍙�" - @click="open" - /> - </u-form-item> - <u-form-item label="宸ュ簭" :border-bottom="false" prop="name"> - <u-input - v-model="form.name" - type="select" - placeholder="璇锋壂鎻忔姤宸ュ崟鍙�" - /> - </u-form-item> - <u-form-item label="璁㈠崟鍙�" :border-bottom="false" prop="moOn"> - <u-input - v-model="form.moOn" - type="select" - placeholder="鐐瑰嚮閫夋嫨" - @click="openList" - /> - </u-form-item> - <u-form-item label="闆朵欢鍙�" :border-bottom="false" prop="partNo"> - <u-input v-model="form.partNo" placeholder="" disabled /> - </u-form-item> - <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> - <u-form-item - label="鍓╀綑鏁伴噺" - :border-bottom="false" - prop="Jianqtyfinished" - > - <u-input v-model="form.Jianqtyfinished" placeholder="" disabled /> - </u-form-item> - <u-form-item label="搴撲綅" :border-bottom="false" prop="proposedLocation"> - <u-input v-model="form.proposedLocation" placeholder="" disabled /> - </u-form-item> - <u-form-item label="鎶ュ伐绫诲瀷" prop="productType"> - <u-radio-group v-model="form.productType" :disabled="subdisabled"> - <u-radio name="dep">涓嬫満鎶ュ伐</u-radio> - <u-radio name="ndep">鏈笅鏈烘姤宸�</u-radio> - </u-radio-group> - </u-form-item> - <u-form-item label="鎺ユ敹闆朵欢" prop="receive"> - <u-radio-group v-model="form.receive" :disabled="subdisabled"> - <u-radio name="mo">杞﹂棿璁㈠崟</u-radio> - <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-radio name="鍊掑啿">鍊掑啿</u-radio> - <u-radio name="鎶曟枡">鎶曟枡</u-radio> - </u-radio-group> - </u-form-item> - <u-form-item label="宸ュ簭" prop="value1"> - <u-checkbox-group> - <u-checkbox - :name="item.name" - v-for="(item, index) in checkboxList" - :key="index" - v-model="item.value1" - @change="changeCheckbox" - :disabled="subdisabled || item.disabled" - > - {{ item.name }} - </u-checkbox> - </u-checkbox-group> - </u-form-item> - <u-form-item label="浜у嚭鍒楄〃" :border-bottom="false"></u-form-item> - </u-form> - <view class="wrap"> - <scroll-view class="packing-registration-scroll-list" scroll-y="true"> - <u-cell-group - class="packing-registration-scroll-list-group" - :border="false" - > - <view - class="content" - v-for="(item, index) in InventoryReceiptList" - :key="index" - :index="index" - > - <view class="content-header"> - <view class="content-header-title">{{ index + 1 }}</view> - </view> - <view class="content-body"> - <view class="row-list"> - <view class="_label"> - <view class="_label-name">鎵瑰彿锛�</view> - </view> - <view class="_content"> - {{ item.productNo }} - </view> - </view> - <view class="row-list"> - <view class="_label"> - <view class="_label-name">鏁伴噺锛�</view> - </view> - <view class="_content"> - {{ item.netWeight }} - </view> - </view> - <view class="row-list"> - <view class="_label"> - <view class="_label-name">搴撲綅锛�</view> - </view> - <view class="_content"> - {{ item.proposedLocation }} - </view> - </view> - </view> - </view> - </u-cell-group> - </scroll-view> - </view> - <!-- 濉啓鎶ュ伐鍗� --> - <modalBg ref="modalBg" :confirm="confirm"> - <u-field - v-model="form.taskNo" - label="鎶ュ伐鍗曞彿" - placeholder="璇疯緭鍏�" - :border-bottom="false" - > - </u-field> - </modalBg> - <saveForm - ref="saveForm" - :operationTaskList="this.form" - @update="handleUpdate" - /> - <scan></scan> - </div> + <!-- 鎶ュ伐 --> + <div class="page"> + <u-form :model="form" ref="uForm" :label-width="200" :rules="rules" :error-type="['toast']"> + <u-form-item label="杞﹂棿" :border-bottom="false" prop="work" style="font-size:small"> + <u-radio-group v-model="form.work" :disabled="subdisabled"> + <u-radio name="dt"><span style="font-size:small">瀵间綋</span></u-radio> + <u-radio name="tg"><span style="fongt-size:small">閾滄潌</span></u-radio> + </u-radio-group> + </u-form-item> + <u-form-item label="鎶ュ伐鍗曞彿" :border-bottom="false" prop="taskNo" style="font-size:small"> + <u-input v-model="form.taskNo" type="select" placeholder="璇锋壂鎻忔姤宸ュ崟鍙�" @click="open" /> + </u-form-item> + <u-form-item label="宸ュ簭" :border-bottom="false" prop="name" style="font-size:small"> + <u-input v-model="form.name" type="select" placeholder="璇锋壂鎻忔姤宸ュ崟鍙�" /> + </u-form-item> + <u-form-item label="璁㈠崟鍙�" :border-bottom="false" prop="moOn" style="font-size:small"> + <u-input v-model="form.moOn" type="select" placeholder="鐐瑰嚮閫夋嫨" @click="openList" /> + </u-form-item> + <u-form-item label="闆朵欢鍙�" :border-bottom="false" prop="partNo" style="font-size:small"> + <u-input v-model="form.partNo" placeholder="" disabled /> + </u-form-item> + <u-form-item label="闆朵欢鎻忚堪" :border-bottom="false" prop="partName" style="font-size:small"> + <u-input v-model="form.partName" placeholder="" disabled /> + </u-form-item> + <!-- <u-form-item label="鎵归噺澶у皬" :border-bottom="false" prop="qtyRequired" style="font-size:small"> + <u-input v-model="form.qtyRequired" placeholder="" disabled /> + </u-form-item> + <u-form-item label="鍓╀綑鏁伴噺" :border-bottom="false" prop="Jianqtyfinished" style="font-size:small"> + <u-input v-model="form.Jianqtyfinished" placeholder="" disabled /> + </u-form-item> --> + <u-form-item label="鎶曟枡浜ч噺" :border-bottom="false" prop="FeedInputProductionVolume" style="font-size:small"> + <u-input v-model="form.FeedInputProductionVolume" type="select" placeholder="璇峰~鍐欐姇鏂欎骇閲�" + @click="FeedInputProductionVolumeCLick" /> + </u-form-item> + <u-form-item label="姹囨姤浜ч噺" :border-bottom="false" prop="reportProductionVolume" style="font-size:small"> + <u-input v-model="form.reportProductionVolume" type="select" placeholder="璇峰~鍐欐眹鎶ヤ骇閲�" + @click="reportProductionVolumeCLick" /> + </u-form-item> + <u-form-item label="搴撲綅" :border-bottom="false" prop="proposedLocation" style="font-size:small"> + <u-input v-model="form.proposedLocation" placeholder="" disabled /> + </u-form-item> + <!-- <u-form-item label="鎶ュ伐绫诲瀷" label-width="90px" prop="productType" style="font-size:small"> + <u-radio-group v-model="form.productType" :disabled="subdisabled"> + <u-radio name="dep"><span style="font-size:small">涓嬫満鎶ュ伐</span></u-radio> + <u-radio name="ndep"><span style="font-size:small">鏈笅鏈烘姤宸�</span></u-radio> + </u-radio-group> + </u-form-item> --> + <!-- <u-form-item label="鎺ユ敹闆朵欢" label-width="90px" prop="receive" style="font-size:small"> + <u-radio-group v-model="form.receive" :disabled="subdisabled"> + <u-radio name="mo"><span style="font-size:small">杞﹂棿璁㈠崟</span></u-radio> + <u-radio name="part"><span style="font-size:small">鏇夸唬闆朵欢</span></u-radio> + </u-radio-group> + </u-form-item> --> + <u-form-item label="鐗╂枡" label-width="90px" prop="materialCost" style="font-size:small"> + <u-radio-group v-model="form.materialCost" :disabled="true"> + <u-radio name="鍊掑啿"><span style="font-size:small">鍊掑啿</span></u-radio> + <u-radio name="鎶曟枡"><span style="font-size:small">鎶曟枡</span></u-radio> + </u-radio-group> + </u-form-item> + <!-- <u-form-item label="绠�鍖栫墿鏂欐鏌�" label-width="90px" prop="simplifyMaterials" style="font-size:small"> + <u-radio-group v-model="form.simplifyMaterials" :disabled="subdisabled || simplifyDisabled" + @change="radioChange"> + <u-radio name="true"><span style="font-size:small">鏄�</span></u-radio> + <u-radio name="false"><span style="font-size:small">鍚�</span></u-radio> + </u-radio-group> + </u-form-item> --> + <u-form-item label="鎶ュ伐鏂瑰紡" label-width="90px" prop="status" style="font-size:small"> + <u-radio-group v-model="form.status" :disabled="subdisabled" @change="handleReportTypeChange"> + <u-radio name="false"><span style="font-size:small">鎸夌彮缁勬姤宸�</span></u-radio> + <u-radio name="true"><span style="font-size:small">鎸変汉鍛樻姤宸�</span></u-radio> + </u-radio-group> + </u-form-item> + <u-form-item label="浜哄憳鍚嶇О" label-width="90px" :border-bottom="false" prop="Persons" style="font-size:small"> + <u-input v-model="form.Persons" type="select" placeholder="璇烽�夋嫨" @click="openselectedPersons" + :disabled="!canSelectPerson || subdisabled" /> + </u-form-item> + <u-form-item label="浜у嚭鍒楄〃" :border-bottom="false" style="font-size:small"></u-form-item> + </u-form> + <view class="wrap"> + <scroll-view class="packing-registration-scroll-list" scroll-y="true"> + <u-cell-group class="packing-registration-scroll-list-group" :border="false"> + <view class="content" v-for="(item, index) in InventoryReceiptList" :key="index" :index="index" + @click="cancelReport(item,index)"> + <view class="content-header"> + <view class="content-header-title" style="font-size:small">{{ index + 1 }}</view> + </view> + <view class="content-body"> + <view class="row-list"> + <view class="_label"> + <view class="_label-name">鎵瑰彿锛�</view> + </view> + <view class="_content"> + {{ item.outBatchNo }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + <view class="_label-name">鏁伴噺锛�</view> + </view> + <view class="_content"> + {{ item.netWeight }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + <view class="_label-name">搴撲綅锛�</view> + </view> + <view class="_content"> + {{ item.proposedLocation }} + </view> + </view> + </view> + </view> + </u-cell-group> + </scroll-view> + </view> + <!-- 濉啓鎶ュ伐鍗� --> + <modalBg ref="modalBg" :confirm="confirm"> + <u-field v-model="form.taskNo" label="鎶ュ伐鍗曞彿" placeholder="璇疯緭鍏�" :border-bottom="false" + style="font-size:small"> + </u-field> + </modalBg> + <saveForm ref="saveForm" :operationTaskList="this.form" :dutyId="dutyId" @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"> + <scroll-view scroll-y="true" + style="height: 100%; transform: translateZ(0); -webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;"> + <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> + </scroll-view> + </view> + </u-modal> + <scan></scan> + </div> </template> <script> -import modalBg from "@/components/modal/modal-bg.vue"; -import saveForm from "./components/saveForm.vue"; -import scan from "@/components/scan/scan.vue"; -export default { - components: { - modalBg, - saveForm, - scan, - }, - data() { - return { - checkboxList: [ - { - name: "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�", - value: false, - disabled: false, - }, - { - name: "绠�鍖栫墿鏂欐鏌�", - value: false, - disabled: false, - }, - ], - InventoryReceiptList: [], - form: { - workstationId: "", - work: "", - taskNo: "", - name: "", - moOn: "", - partNo: "", - partName: "", - qtyrequired: "", - Jianqtyfinished: "", - proposedLocation: "", - productType: "dep", - receive: "mo", - materialcost: "", - autoReport: false, - simplifyMaterials: false, - }, - rules: { - work: [ - { - required: true, - message: "璇烽�夋嫨杞﹂棿", - trigger: ["change"], - }, - ], - taskNo: [ - { - required: true, - message: "璇烽�夋嫨鎶ュ伐鍗曞彿", - trigger: ["change", "blur"], - }, - ], - name: [ - { - required: true, - message: "璇烽�夋嫨宸ュ簭", - trigger: ["change", "blur"], - }, - ], - moOn: [ - { - required: true, - message: "璇烽�夋嫨璁㈠崟鍙�", - trigger: ["change", "blur"], - }, - ], - productType: [ - { - required: true, - message: "璇烽�夋嫨鎶ュ伐绫诲瀷", - trigger: ["change"], - }, - ], - receive: [ - { - required: true, - message: "璇烽�夋嫨鎺ユ敹闆朵欢绫诲瀷", - trigger: ["change"], - }, - ], - }, - showSave: false, - operationTaskId: "", - subdisabled: false, - }; - }, - // 鐐瑰嚮鎻愪氦鎸夐挳鐨勪簨浠跺鐞嗗嚱鏁� - onNavigationBarButtonTap() { - this.$refs.uForm.validate((valid) => { - if (valid) { - uni.showLoading({ - mask: true, - title: "鍔犺浇涓�", - }); - // 澶勭悊鎻愪氦閫昏緫 - this.$u.api.workReporting - .operationTask({ - id: this.form.id, - }) - .then((res) => { - this.$refs.saveForm.open(res); - uni.hideLoading(); - }); - } else { - // 鍙互鑾峰彇鍏蜂綋鐨勯敊璇俊鎭� - const errors = this.$refs.uForm.getError(); - } - }); - }, - onReady() { - this.$refs.uForm.setRules(this.rules); - }, - onShow() { - let that = this; - uni.$off("scan"); // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒 - uni.$on("scan", function (data) { - //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲� - if (data.code) { - let codeInfo = JSON.parse(data.code); - if (codeInfo.moOn) { - // 鎵弿鎶ュ伐鍗曚簩缁寸爜 - that.saveForm(codeInfo); - that.$u.api.workReporting - .getProductMainV1({ - current: 1, - size: -1, - id: codeInfo.id, - }) - .then((res) => { - that.InventoryReceiptList = res.data.productOutputList; - }); - } - } - }); - }, - watch: { - "form.taskNo": function (newVal, oldVal) { - this.subdisabled = false; - }, - }, - methods: { - // 澶氶�夊鐞� - changeCheckbox(val) { - if (val.name === "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�") { - this.form.autoReport = val.value; - } - if (val.name === "绠�鍖栫墿鏂欐鏌�") { - this.form.simplifyMaterials = val.value; - } - }, - handleUpdate() { - this.subdisabled = true; - }, - // 鎵撳紑寮规--鍚庨潰杩橀渶瑕佺洃鍚壂鐮佹灙鎵爜缁撴灉锛岃祴鍊肩粰鎶ュ伐鍗曞彿瀛楁锛岀劧鍚庢墦寮�寮规閫夋嫨璁㈠崟鍙风瓑鎿嶄綔 - open() { - this.$refs.modalBg.open(); - }, - // 寮规淇濆瓨 - confirm() {}, - // 閫夋嫨璁㈠崟鍙� - openList() { - if (this.form.taskNo === "") { - uni.showToast({ - title: "璇峰厛鎵弿鎴栬緭鍏ユ姤宸ュ崟鍙�", - icon: "none", - }); - return; - } - uni.navigateTo({ - url: "/pages/product/report/orderList", - }); - }, - // 瀛樿鍗曞彿 - setNo(val) { - this.form.moOn = val.moNo; - }, - // 鍥炴樉鎵爜鐨勪俊鎭�-鎶ュ伐鍗� - saveForm(val) { - this.form = { - id: val.id, - workstationId: val.workstationId, - work: val.work, - taskNo: val.taskNo, - name: val.name, - moOn: val.moOn, - partNo: val.partNo, - partName: val.partName, - qtyrequired: val.qtyrequired, - Jianqtyfinished: val.qtyrequired - val.qtyfinished, - proposedLocation: val.proposedLocation, - productType: "dep", - receive: "mo", // 澶嶉�夋缁勭殑鍊� - materialcost: val.materialcost, - autoReport: false, - simplifyMaterials: false, - }; - if (this.form.materialcost == "鍊掑啿") { - this.checkboxList[1].disabled = true; - } - }, - }, -}; + import modalBg from "@/components/modal/modal-bg.vue"; + import saveForm from "./components/saveForm.vue"; + import scan from "@/components/scan/scan.vue"; + export default { + components: { + modalBg, + saveForm, + scan, + }, + data() { + return { + simplifyDisabled: false, + // checkboxList: [ + // { + // name: "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�", + // value: false, + // disabled: false, + // }, + // { + // name: "绠�鍖栫墿鏂欐鏌�", + // value: false, + // disabled: false, + // }, + // ], + InventoryReceiptList: [], + selectedPersons: [], + form: { + workstationId: "", + work: "", + taskNo: "", + name: "", + moOn: "", + partNo: "", + partName: "", + // qtyRequired: "", + // Jianqtyfinished: "", + FeedInputProductionVolume: null, //鎶曟枡浜ч噺 + reportProductionVolume: null, //姹囨姤浜ч噺 + proposedLocation: "", + productType: "dep", + receive: "mo", + materialCost: "", + // autoReport: false, + simplifyMaterials: 'false', + status: 'false', + Persons: '', + productStaffIds: [], + productStaffs: [] + + }, + reportProductionVolumelist: {}, + FeedInputProductionVolumeList: {}, //鎶曟枡浜ч噺 + personList: [], + canSelectPerson: false, + rules: { + work: [{ + required: true, + message: "璇烽�夋嫨杞﹂棿", + trigger: ["change"], + }, ], + taskNo: [{ + required: true, + message: "璇烽�夋嫨鎶ュ伐鍗曞彿", + trigger: ["change", "blur"], + }, ], + name: [{ + required: true, + message: "璇烽�夋嫨宸ュ簭", + trigger: ["change", "blur"], + }, ], + moOn: [{ + required: true, + message: "璇烽�夋嫨璁㈠崟鍙�", + trigger: ["change", "blur"], + }, ], + productType: [{ + required: true, + message: "璇烽�夋嫨鎶ュ伐绫诲瀷", + trigger: ["change"], + }, ], + receive: [{ + required: true, + message: "璇烽�夋嫨鎺ユ敹闆朵欢绫诲瀷", + trigger: ["change"], + }, ], + status: [{ + required: true, + message: "璇烽�夋嫨鎶ュ伐鏂瑰紡", + trigger: ["change"], + }, ], + Persons: [{ + required: true, + message: "璇烽�夋嫨浜哄憳", + trigger: ["change"], + }, ], + reportProductionVolume: [{ + required: true, + message: "璇疯緭鍏ユ眹鎶ヤ骇閲�", + trigger: ["change"], + }, ], + // FeedInputProductionVolume: [{ + // required: true, + // message: "璇疯緭鍏ユ姇鏂欎骇閲�", + // trigger: ["change"], + // }, ], + + }, + showSave: false, + operationTaskId: "", + subdisabled: false, + codeInfoId: "", + detailedList: {}, + showModal: false, + personShowModal: false, + checkboxList: [], + index: 0, + }; + }, + // 鐐瑰嚮鎻愪氦鎸夐挳鐨勪簨浠跺鐞嗗嚱鏁� + onNavigationBarButtonTap() { + this.$refs.uForm.validate((valid) => { + if (valid) { + uni.showLoading({ + mask: true, + title: "鍔犺浇涓�", + }); + this.form.operationTaskId = this.form.id; + this.reportProductionVolumelist.operationTaskId = this.form.id; + this.reportProductionVolumelist.status = this.form.status; + this.reportProductionVolumelist.Persons = this.form.Persons; + this.reportProductionVolumelist.productStaffIds = this.form.productStaffIds; + this.reportProductionVolumelist.productStaffs = this.form.productStaffs; + this.reportProductionVolumelist.productInputList = Object.keys(this.FeedInputProductionVolumeList).length === 0 ? null : this.FeedInputProductionVolumeList; + this.reportProductionVolumelist.dutyRecordId = this.dutyId; + this.form.productOutputList = []; // 鍒涘缓涓�涓┖鏁扮粍 + this.form.productOutputList.push(this.reportProductionVolumelist); // 鍚戞暟缁勪腑娣诲姞鍏冪礌 + console.log("this.form", this.form); + this.$u.api.workReporting + .submitPDA(this.form) + .then((res) => { + this.subdisabled = true; + this.$u.toast("鎻愪氦鎴愬姛"); + this.InventoryReceiptList.unshift(this.form.productOutputList[0]); + this.reportProductionVolumelist = {}, + this.FeedInputProductionVolumeList = {}, //鎶曟枡浜ч噺 + this.form.FeedInputProductionVolume = null, //鎶曟枡浜ч噺 + this.form.reportProductionVolume = null, //姹囨姤浜ч噺 + console.log("this.InventoryReceiptList", this.InventoryReceiptList); + }) + .finally(() => { + }); + } else { + // 鍙互鑾峰彇鍏蜂綋鐨勯敊璇俊鎭� + const errors = this.$refs.uForm.getError(); + } + }); + }, + onReady() { + this.$refs.uForm.setRules(this.rules); + }, + onShow() { + let that = this; + uni.$off("scan"); // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒 + uni.$on("scan", function(data) { + //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲� + if (data.code) { + let codeInfo = JSON.parse(data.code); + if (codeInfo.moOn) { + that.codeInfoId = codeInfo.id; + // 鎵弿鎶ュ伐鍗曚簩缁寸爜 + that.saveForm(codeInfo); + // that.getHandelList(); + } + if (codeInfo.ES) { + // 鎵弿鎶ュ伐鍗曚簩缁寸爜 + that.CopperReportingWork(codeInfo); + } + // if (codeInfo.BN) { + // // 鎵弿鎶ュ伐鍗曚簩缁寸爜 + // that.$refs.saveForm.saveForm(codeInfo); + // } + } + }); + }, + watch: { + "form.taskNo": function(newVal, oldVal) { + this.subdisabled = false; + }, + 'form.status'(newVal) { + this.selectedPersons = this.selectedPersons.map(item => ({ + ...item, + checked: newVal === 'false' + })); + } + }, + methods: { + // 鎶曟枡浜ч噺 + FeedInputProductionVolumeCLick() { + if (this.form.taskNo === "") { + uni.showToast({ + title: "璇峰厛鎵爜", + icon: "none", + }); + return; + } + if (this.simplifyDisabled) { + uni.showToast({ + title: "鍊掑啿鏃犻渶鎶曟枡", + icon: "none", + }); + return; + } + uni.navigateTo({ + url: "/pages/product/report/seachPersonnelNo?moOn=" + this.form.moOn, + + }); + }, + // 姹囨姤浜ч噺 + reportProductionVolumeCLick() { + if (this.form.taskNo === "") { + uni.showToast({ + title: "璇峰厛鎵爜", + icon: "none", + }); + return; + } + // 澶勭悊鎻愪氦閫昏緫 + this.$u.api.workReporting + .operationTask({ + id: this.form.id, + }) + .then((res) => { + res.data.name = this.form.name; + this.$refs.saveForm.open(res); + uni.hideLoading(); + }); + }, + // 澶勭悊鎶ュ伐鏂瑰紡鍙樻洿 + 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) { + this.$refs.uForm.validate((valid) => { + if (valid) { + 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.dutyRecordId = this.dutyId; + this.form.productOutputList.push(copperList); + console.log('this.form', this.form) + this.$u.api.workReporting.submitPDA(this.form).then((res) => { + this.subdisabled = true; + this.InventoryReceiptList.unshift(this.form); + // this.getHandelList(); + this.$u.toast("鎶ュ伐鎴愬姛"); + }); + } else { + // 鍙互鑾峰彇鍏蜂綋鐨勯敊璇俊鎭� + const errors = this.$refs.uForm.getError(); + } + }); + }, + // 鐐瑰嚮纭鍚庤幏鍙栧彇娑堟姤宸ヨ褰� + radioChange() { + // 澶勭悊鍗曢�夋鍙樺寲浜嬩欢 + }, + // 鑾峰彇浜哄憳鍒楄〃 + getPersonList(dutyId) { + console.log('111111', dutyId) + 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.detailedList); + // 澶勭悊纭閫昏緫 + this.$u.api.cancelReporting + .cancelDTAOfWorkApplication({ + outBatchNo: this.detailedList.outBatchNo, + outputId: this.detailedList.id + }) + .then((res) => { + console.log("res", res); + this.InventoryReceiptList.splice(this.index, 1) + this.showModal = false; + // this.getHandelList(); + this.$u.toast("鍙栨秷鎶ュ伐鎴愬姛"); + }); + }, + cancelModle() { + this.showModal = false; // 鍏抽棴寮圭獥 + }, + // 鍙栨秷鎶ュ伐 + cancelReport(item, index) { + let that = this; + that.index = index; + 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({ + // current: 1, + // size: -1, + // id: this.codeInfoId, + // }) + // .then((res) => { + // this.InventoryReceiptList = res.data.productOutputList; + // }); + // }, + // 澶氶�夊鐞� + // changeCheckbox(val) { + // if (val.name === "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�") { + // this.form.autoReport = val.value; + // } + // if (val.name === "绠�鍖栫墿鏂欐鏌�") { + // this.form.simplifyMaterials = val.value; + // } + // }, + handleUpdate(val) { + this.reportProductionVolumelist = val + this.form.reportProductionVolume = val.outBatchNo; + // this.subdisabled = true; + // this.getHandelList(); + // this.InventoryReceiptList.unshift(val); + }, + // 鎵撳紑寮规--鍚庨潰杩橀渶瑕佺洃鍚壂鐮佹灙鎵爜缁撴灉锛岃祴鍊肩粰鎶ュ伐鍗曞彿瀛楁锛岀劧鍚庢墦寮�寮规閫夋嫨璁㈠崟鍙风瓑鎿嶄綔 + open() { + this.$refs.modalBg.open(); + }, + // 寮规淇濆瓨 + confirm() {}, + // 閫夋嫨璁㈠崟鍙� + openList() { + if (this.form.taskNo === "") { + uni.showToast({ + title: "璇峰厛鎵弿鎴栬緭鍏ユ姤宸ュ崟鍙�", + icon: "none", + }); + return; + } + uni.navigateTo({ + url: "/pages/product/report/orderList", + }); + }, + // 瀛樿鍗曞彿 + setNo(val) { + this.form.moOn = val.moNo; + }, + setFeedInputProductionVolume(val) { + console.log('val', val) + this.FeedInputProductionVolumeList = val; + const values = this.FeedInputProductionVolumeList.map((item) => item.ifsBatchNo) + console.log('values', values) + + this.form.FeedInputProductionVolume = values.join('锛�') + }, + // 鍥炴樉鎵爜鐨勪俊鎭�-鎶ュ伐鍗� + saveForm(val) { + this.form = { + id: val.id, + workstationId: val.workstationId, + work: val.work, + taskNo: val.taskNo, + name: val.name, + moOn: val.moOn, + partNo: val.partNo, + partName: val.partName, + // qtyRequired: val.qtyRequired, + // Jianqtyfinished: val.qtyRequired - val.qtyFinished, + proposedLocation: val.proposedLocation, + productType: "dep", + receive: "mo", + materialCost: val.materialCost, + // autoReport: false, + simplifyMaterials: 'false', + status: 'false', + Persons: '', + }; + if (this.form.materialCost == "鍊掑啿") { + this.simplifyDisabled = true; + } + // 濡傛灉鏈塪utyNo锛岃幏鍙栦汉鍛樺垪琛� + if (val.dutyId) { + this.dutyId = val.dutyId; + this.getPersonList(val.dutyId); + } + }, + }, + }; </script> <style lang="scss"> -@import "index.scss"; + @import "index.scss"; </style> \ No newline at end of file -- Gitblit v1.9.3