From 025dafb9892a8ff8f8a855343660f837a0f231d3 Mon Sep 17 00:00:00 2001 From: haoyahui <2032914783@qq.com> Date: 星期一, 20 十一月 2023 16:31:11 +0800 Subject: [PATCH] 库存管理前端 --- admin-web/src/views/stock/procure/purchaseOrder/edit.vue | 42 ++++++++++++++++++++++++++++++------------ 1 files changed, 30 insertions(+), 12 deletions(-) diff --git a/admin-web/src/views/stock/procure/purchaseOrder/edit.vue b/admin-web/src/views/stock/procure/purchaseOrder/edit.vue index 9ed3d61..6b4a2a1 100644 --- a/admin-web/src/views/stock/procure/purchaseOrder/edit.vue +++ b/admin-web/src/views/stock/procure/purchaseOrder/edit.vue @@ -1,5 +1,5 @@ <template> - <win-md class="stock-edit" :title="`${setting.title}閲囪喘鍏ュ簱`" @close="close" :width="'800px'"> + <win-md class="stock-edit" :title="`${setting.title}閲囪喘鍏ュ簱`" @close="close" :width="'800px'" :loading="loading"> <el-form class="form" ref="ruleForm" :model="formData" :rules="rules" label-width="120px"> <div class="main-w"> <el-row :gutter="24" class="headerHeight"> @@ -68,7 +68,7 @@ :rules="rules.baseGoodsTemplateId" > <el-select - v-model="goodsItem.baseGoodsTemplateId" + v-model="goodsItem.baseGoodsTemplateId" placeholder="璇峰厛鎷╃墿鍝佸垎绫�" filterable :disabled="!goodsItem.baseCategoryId" @@ -131,15 +131,19 @@ {{ scope.row.unit }} </template> </el-table-column> - <el-table-column prop="price" label="鍗曚环锛堝厓锛�" align="center"> + <el-table-column prop="priceYuan" label="鍗曚环锛堝厓锛�" align="center"> <template slot-scope="scope"> <el-form-item label-width="0" style="margin-bottom: 0" - :prop="`procureGoods[${goodsIndex}].models[${scope.$index}].price`" - :rules="rules.price" + :prop="`procureGoods[${goodsIndex}].models[${scope.$index}].priceYuan`" + :rules="rules.priceYuan" > - <el-input type="number" v-model.number="scope.row.price"></el-input> + <el-input + type="number" + v-model.number="scope.row.priceYuan" + @change="priceChange($event, goodsIndex, scope.$index)" + ></el-input> </el-form-item> </template> </el-table-column> @@ -218,13 +222,14 @@ return callback(new Error('璇烽�夋嫨')); } let temp = this.formData.procureGoods.filter((v) => v.baseGoodsTemplateId == value); - if (!temp || temp.length!=1) { + if (!temp || temp.length != 1) { return callback(new Error('宸查�夎繃姝ょ墿鍝�')); } callback(); }; // 閲戦鏍¢獙 var checkPrice = (rule, value, callback) => { + console.log(value); if (!value) { return callback(new Error('璇疯緭鍏�')); } @@ -236,7 +241,7 @@ }; // 鏁伴噺鏍¢獙 var checkCounts = (rule, value, callback) => { - console.log(value) + console.log(value); if (!value) { return callback(new Error('璇疯緭鍏�')); } @@ -251,7 +256,7 @@ callback(); }; return { - loading: false, + loading: true, buyTypeOptions: [ { label: '闆嗛噰', @@ -287,7 +292,8 @@ }, modelsItem: { baseGoodsModelsId: '', // 瑙勬牸鍨嬪彿缂栧彿 - price: null, // 鍗曚环(閲囪喘闇�瑕侊紝璋冩嫧涓嶉渶瑕�) + priceYuan: null, // 鍗曚环(鍏�) + price: null, // 鍗曚环(鍒� 閲囪喘闇�瑕侊紝璋冩嫧涓嶉渶瑕�) counts: null, // 鎿嶄綔鏁伴噺 unit: null, //鍗曚綅 }, @@ -300,7 +306,7 @@ baseCategoryIds: [{ required: true, message: '璇烽�夋嫨', trigger: 'change' }], baseGoodsTemplateId: [{ validator: checkGoodsTemplateId, trigger: ['blur', 'change'] }], modelsIds: [{ required: true, message: '璇烽�夋嫨', trigger: 'change' }], - price: [{ validator: checkPrice, trigger: 'blur' }], + priceYuan: [{ validator: checkPrice, trigger: 'blur' }], counts: [{ validator: checkCounts, trigger: 'blur' }], }, @@ -349,9 +355,13 @@ ); this.getgoodsTemplate(item.baseCategoryId, index); this.getgoodsModel(item.baseGoodsTemplateId, index); + item.models.forEach((child, childIndex) => { + this.$set(this.formData.procureGoods[index].models[childIndex], 'priceYuan', child.price / 100); + }); return item; }); } + this.loading = false; }, // 鑾峰彇鍏ュ簱浠撳簱鍒楄〃 @@ -468,6 +478,11 @@ this.formData.procureGoods[index].models.splice(delIndex, 1); }, + // 浠锋牸input鐩戝惉 杞负鍒� + priceChange(e, goodsIndex, index) { + this.formData.procureGoods[goodsIndex].models[index].price = e * 100; + }, + // 涓婁紶 uploadChange() { let arr = this.$refs.uploadRef.fileList; @@ -488,7 +503,8 @@ handleSubmit() { this.$refs['ruleForm'].validate((valid) => { if (valid) { - console.log('this.formData', this.formData); + this.loading = true; + console.log('formData', this.formData); if (!this.setting.id) { procureAdd(this.formData) .then((res) => { @@ -498,6 +514,7 @@ }) .catch((err) => { console.log('create err', err); + this.loading = false; this.$message.error('淇濆瓨澶辫触'); }); } else { @@ -509,6 +526,7 @@ }) .catch((err) => { console.log('edit err', err); + this.loading = false; this.$message.error('淇濆瓨澶辫触'); }); } -- Gitblit v1.9.1