From 8e2f1c51203a5b0965da0d29642f13c6a1906127 Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期五, 20 十月 2023 12:13:10 +0800 Subject: [PATCH] Merge branch 'dev' of http://192.168.5.5:10010/r/web/WMS into dev --- src/views/productManage/product/index.vue | 4 +- src/views/productManage/productCategory/AddProductCategoryDialog.vue | 27 +++++++++++-- src/api/data.js | 12 ------ src/components/makepager/CommonFormTableView.vue | 4 + src/views/productManage/product/AddProductDialog.vue | 30 ++++++++++++--- 5 files changed, 52 insertions(+), 25 deletions(-) diff --git a/src/api/data.js b/src/api/data.js index ccf6bac..afa04cb 100644 --- a/src/api/data.js +++ b/src/api/data.js @@ -100,10 +100,6 @@ // 寮哄埗涓嬫灦绛栫暐 const forceRemovalStrategy = [ { - name: "璇烽�夋嫨", - id: 0 - }, - { name: "鍏堣繘鍏堝嚭", id: 1 }, @@ -119,10 +115,6 @@ //鎴愭湰鏂规硶 const costingMethod = [ { - name: "璇烽�夋嫨", - id: 0 - }, - { name: "鏍囧噯浠锋牸", id: 1 }, @@ -137,10 +129,6 @@ ] // 搴撳瓨璁′环 const inventoryValuation = [ - { - name: "璇烽�夋嫨", - id: 0 - }, { name: "鎵嬪姩", id: 1 diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue index 5bd8931..7c82937 100644 --- a/src/components/makepager/CommonFormTableView.vue +++ b/src/components/makepager/CommonFormTableView.vue @@ -148,7 +148,9 @@ <!-- 浣嶇疆 --> <el-form-item v-else-if="item.location" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop"> <div class="custom-name"> - <span v-if="scope.row.isEdit || scope.row.editable">{{ scope.row[item.prop].label }}</span> + <span v-if="scope.row.isEdit || scope.row.editable">{{ + scope.row[item.prop]?.label ?? scope.row[item.prop] + }}</span> <el-select v-else v-model="scope.row[item.prop]" diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue index fe22e0f..e24ecd2 100644 --- a/src/views/productManage/product/AddProductDialog.vue +++ b/src/views/productManage/product/AddProductDialog.vue @@ -165,7 +165,7 @@ :disabled="!showFooter" > <el-option - v-for="item in productCategoryListWithDefault" + v-for="item in productCategoryOptions" :key="item.id" :label="item.name" :value="item.id" @@ -482,9 +482,6 @@ }, components: {}, computed: { - productCategoryListWithDefault() { - return [{ id: 0, name: "璇烽�夋嫨" }, ...(this.productCategoryOptions ?? [])] - }, modalTitle() { if (this.editConfig.title === "缂栬緫" && this.editConfig.autoEdit) { return "缂栬緫" @@ -508,7 +505,6 @@ memberOptions: [{ name: "绠$悊鍛�", id: 1 }], productCategoryOptions: [], // 浜у搧绫诲埆 productTypeOptions: [ - { name: "璇烽�夋嫨", id: 0 }, { name: "鑳芥秷鑰�", id: 1 }, { name: "鏈嶅姟", id: 2 }, { name: "鍙簱瀛樹骇鍝�", id: 3 } @@ -556,8 +552,29 @@ if (this.editConfig.autoEdit) { this.editClick() } + this.setOptionalFieldsToEmpty() }, methods: { + /** + * 闈炲繀濉」鍚庣杩斿洖鐨勬槸鏁板瓧 0,琛ㄥ崟闇�瑕佺┖涓叉墠鑳借涓烘湭閫夋嫨鍥炴樉 + */ + setOptionalFieldsToEmpty(){ + ['productType','categoryId'] + .filter(filed => this.editConfig.infomation[filed] === 0) + .forEach(filed => { + this.editConfig.infomation[filed] = '' + }) + }, + /** + * 鍚庣鍙帴鍙楁暟瀛楀舰寮�, 淇濆瓨鏃惰繕寰楀啀杞洖鍘� + */ + unsetFieldsToNumber(){ + ['productType','categoryId'] + .filter(filed => this.editConfig.infomation[filed] === '') + .forEach(filed => { + this.editConfig.infomation[filed] = 0 + }) + }, // 鑾峰彇浜у搧绫诲埆 async getProductCategoryList() { await getProductCategoryList({ @@ -618,6 +635,7 @@ this.$refs[formName].validate((valid) => { if (valid) { let requestUrl = this.editConfig.title === "鏂板缓" ? addProduct : updateProduct + this.unsetFieldsToNumber() requestUrl({ ...this.editConfig.infomation }).then((res) => { @@ -627,7 +645,7 @@ this.$message.success("娣诲姞鎴愬姛") this.$parent.getData() } - }) + },console.error) } }) }, diff --git a/src/views/productManage/product/index.vue b/src/views/productManage/product/index.vue index 0c79ece..0b32e39 100644 --- a/src/views/productManage/product/index.vue +++ b/src/views/productManage/product/index.vue @@ -259,17 +259,17 @@ }, // 鏂板缓 addBtnClick() { - this.editConfig.visible = true this.editConfig.title = "鏂板缓" this.editConfig.infomation = {} + this.editConfig.visible = true }, // 璇︽儏 showDetail(row) { console.log(row) - this.editConfig.visible = true this.editConfig.autoEdit = false this.editConfig.title = "缂栬緫" this.editConfig.infomation = { ...row } + this.editConfig.visible = true }, // 缂栬緫 editRow(row){ diff --git a/src/views/productManage/productCategory/AddProductCategoryDialog.vue b/src/views/productManage/productCategory/AddProductCategoryDialog.vue index 2f86a71..b8453ee 100644 --- a/src/views/productManage/productCategory/AddProductCategoryDialog.vue +++ b/src/views/productManage/productCategory/AddProductCategoryDialog.vue @@ -88,7 +88,7 @@ style="width: 85%" :disabled="!showFooter" > - <el-option v-for="item in productCategoryListWithDefault" :key="item.id" :label="item.name" :value="item.id"> + <el-option v-for="item in productCategoryList" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> </el-form-item> @@ -197,9 +197,6 @@ }, components: {}, computed: { - productCategoryListWithDefault(){ - return [{id:0,name:'璇烽�夋嫨'},...(this.productCategoryList?? [])] - }, modalTitle(){ if (this.editConfig.title === '缂栬緫' && this.editConfig.autoEdit){ return '缂栬緫' @@ -239,8 +236,29 @@ if (this.editConfig.autoEdit){ this.editClick() } + this.setOptionalFieldsToEmpty() }, methods: { + /** + * 闈炲繀濉」鍚庣杩斿洖鐨勬槸鏁板瓧 0,琛ㄥ崟闇�瑕佺┖涓叉墠鑳借涓烘湭閫夋嫨鍥炴樉 + */ + setOptionalFieldsToEmpty(){ + ['parentId','costingMethod','inventoryValuation','forceRemovalStrategy'] + .filter(filed => this.editConfig.infomation[filed] === 0) + .forEach(filed => { + this.editConfig.infomation[filed] = '' + }) + }, + /** + * 鍚庣鍙帴鍙楁暟瀛楀舰寮�, 淇濆瓨鏃惰繕寰楀啀杞洖鍘� + */ + unsetFieldsToNumber(){ + ['parentId','costingMethod','inventoryValuation','forceRemovalStrategy'] + .filter(filed => this.editConfig.infomation[filed] === '') + .forEach(filed => { + this.editConfig.infomation[filed] = 0 + }) + }, // 鑾峰彇浜у搧鏁伴噺 getProductCount(){ getProductList({ @@ -294,6 +312,7 @@ this.showFooter = true }, saveParams() { + this.unsetFieldsToNumber() let data = JSON.parse(JSON.stringify(this.editConfig.infomation)) let params = { -- Gitblit v1.8.0