From cf6a4b874aed82592eea78294715c7c688f9b248 Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期五, 03 十一月 2023 14:50:31 +0800 Subject: [PATCH] Merge branch 'dev' into songshankun/add-token --- src/views/productManage/product/AddProductDialog.vue | 62 ++++++++++++++++++++++++++++--- 1 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue index fe22e0f..5c63af6 100644 --- a/src/views/productManage/product/AddProductDialog.vue +++ b/src/views/productManage/product/AddProductDialog.vue @@ -43,6 +43,8 @@ :show-procure="showProcure" :countObject="statisticsMap" :show-sale="showSale" + @listingRulesClick="listingRulesClick" + @reorderRulesClick="reorderRulesClick" /> <div class="bottom"> <el-tabs v-model="activeName" type="card"> @@ -165,7 +167,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 +484,6 @@ }, components: {}, computed: { - productCategoryListWithDefault() { - return [{ id: 0, name: "璇烽�夋嫨" }, ...(this.productCategoryOptions ?? [])] - }, modalTitle() { if (this.editConfig.title === "缂栬緫" && this.editConfig.autoEdit) { return "缂栬緫" @@ -508,7 +507,6 @@ memberOptions: [{ name: "绠$悊鍛�", id: 1 }], productCategoryOptions: [], // 浜у搧绫诲埆 productTypeOptions: [ - { name: "璇烽�夋嫨", id: 0 }, { name: "鑳芥秷鑰�", id: 1 }, { name: "鏈嶅姟", id: 2 }, { name: "鍙簱瀛樹骇鍝�", id: 3 } @@ -556,8 +554,31 @@ if (this.editConfig.autoEdit) { this.editClick() } + this.setOptionalFieldsToEmpty() }, methods: { + /** + * 闈炲繀濉」鍚庣杩斿洖鐨勬槸鏁板瓧 0,琛ㄥ崟闇�瑕佺┖涓叉墠鑳借涓烘湭閫夋嫨鍥炴樉 + */ + setOptionalFieldsToEmpty() { + let arr = ["productType", "categoryId"] + arr + .filter((filed) => this.editConfig.infomation[filed] === 0) + .forEach((filed) => { + this.editConfig.infomation[filed] = "" + }) + }, + /** + * 鍚庣鍙帴鍙楁暟瀛楀舰寮�, 淇濆瓨鏃惰繕寰楀啀杞洖鍘� + */ + unsetFieldsToNumber() { + let arr = ["productType", "categoryId"] + arr + .filter((filed) => this.editConfig.infomation[filed] === "") + .forEach((filed) => { + this.editConfig.infomation[filed] = 0 + }) + }, // 鑾峰彇浜у搧绫诲埆 async getProductCategoryList() { await getProductCategoryList({ @@ -618,6 +639,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 +649,7 @@ this.$message.success("娣诲姞鎴愬姛") this.$parent.getData() } - }) + }, console.error) } }) }, @@ -761,6 +783,34 @@ }) } }, + // 涓婃灦瑙勫垯 + listingRulesClick() { + this.$refs.form.validate((valid) => { + if (valid) { + this.$router.push({ + path: "/warehouseManage/listingRules", + query: { + productName: this.editConfig.infomation.name, + productId: this.editConfig.title === "鏂板缓" ? "" : this.editConfig.infomation.id + } + }) + } + }) + }, + // 閲嶈璐鍒� + reorderRulesClick() { + this.$refs.form.validate((valid) => { + if (valid) { + this.$router.push({ + path: "/productManage/reorderRules", + query: { + productName: this.editConfig.infomation.name, + productId: this.editConfig.title === "鏂板缓" ? "" : this.editConfig.infomation.id + } + }) + } + }) + }, // 鍙攢鍞�/鍙噰璐� checkboxChange(val, param) { if (val === "閲囪喘") { -- Gitblit v1.8.0