From 47aaf4c8e4bea6ce9e03b88ce10760a29ae5e1f0 Mon Sep 17 00:00:00 2001 From: yyb <995253665@qq.com> Date: 星期五, 11 七月 2025 14:25:23 +0800 Subject: [PATCH] 报工提交弹窗样式公用,防止代码冗余 --- pages/product/report/components/saveForm.vue | 284 +++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 175 insertions(+), 109 deletions(-) diff --git a/pages/product/report/components/saveForm.vue b/pages/product/report/components/saveForm.vue index b99e88b..22841b1 100644 --- a/pages/product/report/components/saveForm.vue +++ b/pages/product/report/components/saveForm.vue @@ -1,132 +1,197 @@ <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> + <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%"> + <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.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" /> + </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> </template> <script> export default { + props: { + operationTaskList: { + type: Object, + required: true, + default: () => ({}), + }, + }, data() { return { 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'] } - ] - }, - } - }, - watch: { - show(val) { - if (val) { - this.$nextTick(() => { - this.$refs.uFormSave.setRules(this.rules); - }); - } - }, + form: {}, + loading: false + }; }, 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; + } + this.operationTaskList.operationTaskId = this.operationTaskList.id; + this.form.operationTaskId = this.operationTaskList.id; + 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.$refs.uModal.cancel(); - } else { - console.log('楠岃瘉澶辫触'); - // 鏄剧ず閿欒淇℃伅 - this.$refs.uModal.clearLoading(); // 娓呴櫎鍔犺浇鐘舵�� - } - }); + }) + .finally(() => { + this.loading = false; + this.$refs.uModal.clearLoading(); + }); }, cancel() { this.show = false; + this.form = {}; }, - open() { + open(val) { this.show = true; - } + this.form = val.data; + }, }, -} +}; </script> <style lang="scss" scoped> @@ -137,4 +202,5 @@ ::v-deep .u-input__input { text-align: right !important; } +@import "../index.scss"; </style> \ No newline at end of file -- Gitblit v1.9.3