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 | 101 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 94 insertions(+), 7 deletions(-) diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue index 8bb5ebb..5c63af6 100644 --- a/src/views/productManage/product/AddProductDialog.vue +++ b/src/views/productManage/product/AddProductDialog.vue @@ -1,14 +1,14 @@ <template> <div class="add-common"> <el-dialog - :title="editCommonConfig.title + '浜у搧'" + :title="modalTitle + '浜у搧'" :visible.sync="editConfig.visible" :width="dialogWidth" :before-close="handleClose" > <!-- 澶� --> <div slot="title" class="dialog-header"> - <span>{{ editCommonConfig.title + "浜у搧" }}</span> + <span>{{ modalTitle + "浜у搧" }}</span> <div class="header_btns"> <span class="btn"> <i class="el-icon-printer"></i> @@ -39,8 +39,12 @@ <FormBtnsView :add-product="addProduct" @inOutBoundClick="inOutBoundClick" + @inLibraryClick="inLibraryClick" :show-procure="showProcure" + :countObject="statisticsMap" :show-sale="showSale" + @listingRulesClick="listingRulesClick" + @reorderRulesClick="reorderRulesClick" /> <div class="bottom"> <el-tabs v-model="activeName" type="card"> @@ -472,13 +476,24 @@ return { visible: false, title: "鏂板缓", - infomation: {} + infomation: {}, + autoEdit: false } } } }, components: {}, - computed: {}, + computed: { + modalTitle() { + if (this.editConfig.title === "缂栬緫" && this.editConfig.autoEdit) { + return "缂栬緫" + } else if (this.editConfig.title === "缂栬緫") { + return !this.showEdit ? "缂栬緫" : "鏌ョ湅" + } else { + return "鏂板缓" + } + } + }, data() { return { dialogWidth: "50%", @@ -486,7 +501,7 @@ rules: { name: [{ required: true, message: "璇疯緭鍏ヤ骇鍝佸悕绉�", trigger: "blur" }], model: [{ required: true, message: "璇烽�夋嫨鐗╂枡绫诲瀷", trigger: "change" }], - salePrice: [{ required: true, message: "璇疯緭鍏ラ攢鍞环鏍�", trigger: "blur" }], + // salePrice: [{ required: true, message: "璇疯緭鍏ラ攢鍞环鏍�", trigger: "blur" }], unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }] }, memberOptions: [{ name: "绠$悊鍛�", id: 1 }], @@ -524,7 +539,10 @@ { name: "杈呮枡", id: "杈呮枡" }, { name: "鑰楁潗", id: "鑰楁潗" }, { name: "鍏朵粬", id: "鍏朵粬" } - ] + ], + statisticsMap: { + inLibrary: 0 // 鍦ㄥ簱 + } } }, created() { @@ -532,8 +550,35 @@ this.getProductList() this.setTableForm() this.setBottonView() + this.statisticsMap.inLibrary = this.editConfig?.infomation?.amount ?? 0 + 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({ @@ -594,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) => { @@ -603,7 +649,7 @@ this.$message.success("娣诲姞鎴愬姛") this.$parent.getData() } - }) + }, console.error) } }) }, @@ -724,6 +770,47 @@ }) } }, + // 鍦ㄥ簱鐐瑰嚮 + inLibraryClick() { + if (this.editConfig.title !== "鏂板缓") { + console.log(this.editConfig.infomation) + this.$router.push({ + name: "inventoryReport", + params: { + name: this.editConfig.infomation.name, + id: this.editConfig.infomation.id + } + }) + } + }, + // 涓婃灦瑙勫垯 + 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