From 58ac82fceff96784dd9e16872d1e2316fa2cfdec Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期五, 24 十一月 2023 14:36:12 +0800 Subject: [PATCH] 入库明细报表修改状态进度展示 --- src/views/productManage/productCategory/AddProductCategoryDialog.vue | 325 ++++++++++++++++++++++++++++++++--------------------- 1 files changed, 197 insertions(+), 128 deletions(-) diff --git a/src/views/productManage/productCategory/AddProductCategoryDialog.vue b/src/views/productManage/productCategory/AddProductCategoryDialog.vue index ef39125..b4330aa 100644 --- a/src/views/productManage/productCategory/AddProductCategoryDialog.vue +++ b/src/views/productManage/productCategory/AddProductCategoryDialog.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> @@ -25,14 +25,7 @@ >鍒犻櫎</el-button > --> </span> - <el-button - v-if="showEdit" - plain - size="mini" - style="margin-left: 15px" - @click="editClick" - >缂栬緫</el-button - > + <el-button v-if="showEdit" plain size="mini" style="margin-left: 15px" @click="editClick">缂栬緫</el-button> </div> </div> <!-- 鍐呭 --> @@ -40,16 +33,20 @@ ref="form" :model="editConfig.infomation" :rules="rules" - label-position="left" + label-position="right" label-width="110px" size="mini" - style="height: 60vh; overflow-x: hidden" > <div class="basic-info"> - <FormBtnsView :showProduct="true" @productClick="productClick" /> + <FormBtnsView + :showProduct="true" + :countObject="statisticsMap" + @productClick="productClick" + @listingRulesClick="listingRulesClick" + /> <div class="basic-info-view"> - <el-row> - <el-col :span="24"> + <!-- <el-row> --> + <!-- <el-col :span="24"> <div style="margin-left: 20px"><span class="color_F56C6C">*</span>绫诲埆</div> <el-form-item label="" prop="name" label-width="20px"> <el-input @@ -59,13 +56,9 @@ style="width: 85%" ></el-input> </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item - label="涓婄骇鍝佺被" - prop="parentId" - style="margin-left: 20px" - > + </el-col> --> + <!-- <el-col :span="24"> + <el-form-item label="涓婄骇鍝佺被" prop="parentId" style="margin-left: 20px"> <el-select v-model="editConfig.infomation.parentId" placeholder="璇烽�夋嫨" @@ -73,22 +66,37 @@ style="width: 45%" :disabled="!showFooter" > - <el-option - v-for="item in productCategoryList" - :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> </el-col> - </el-row> + </el-row> --> </div> <div class="bottom"> <div class="purchase-view"> <div class="left"> - <div class="second-label">鐗╂祦</div> + <!-- <div class="second-label">鐗╂祦</div> --> + <el-form-item label="绫诲埆" prop="name"> + <el-input + v-model="editConfig.infomation.name" + placeholder="" + :disabled="!showFooter" + style="width: 85%" + ></el-input> + </el-form-item> + <el-form-item label="涓婄骇鍝佺被" prop="parentId"> + <el-select + v-model="editConfig.infomation.parentId" + placeholder="璇烽�夋嫨" + size="mini" + style="width: 85%" + :disabled="!showFooter" + > + <el-option v-for="item in productCategoryList" :key="item.id" :label="item.name" :value="item.id"> + </el-option> + </el-select> + </el-form-item> <!-- <el-form-item label="璺嚎" prop="client_name" style="margin-left: 20px"> <el-select v-model="editConfig.infomation.memberId" @@ -102,16 +110,12 @@ </el-option> </el-select> </el-form-item> --> - <el-form-item - label="寮哄埗涓嬫灦绛栫暐" - prop="forceRemovalStrategy" - style="margin-left: 20px" - > + <el-form-item label="寮哄埗涓嬫灦绛栫暐" prop="forceRemovalStrategy"> <el-select v-model="editConfig.infomation.forceRemovalStrategy" placeholder="璇烽�夋嫨" size="mini" - style="width: 63%" + style="width: 85%" :disabled="!showFooter" > <el-option @@ -125,38 +129,25 @@ </el-form-item> </div> <div class="right"> - <div class="second-label">搴撳瓨璁′环</div> - <el-form-item - label="鎴愭湰鏂规硶" - prop="costingMethod" - style="margin-left: 20px" - > + <!-- <div class="second-label">搴撳瓨璁′环</div> --> + <el-form-item label="鎴愭湰鏂规硶" prop="costingMethod"> <el-select v-model="editConfig.infomation.costingMethod" placeholder="璇烽�夋嫨" size="mini" - style="width: 63%" + style="width: 85%" :disabled="!showFooter" > - <el-option - v-for="item in costingMethodList" - :key="item.id" - :label="item.name" - :value="item.id" - > + <el-option v-for="item in costingMethodList" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> </el-form-item> - <el-form-item - label="搴撳瓨璁′环" - prop="inventoryValuation" - style="margin-left: 20px" - > + <el-form-item label="搴撳瓨璁′环" prop="inventoryValuation"> <el-select v-model="editConfig.infomation.inventoryValuation" placeholder="璇烽�夋嫨" size="mini" - style="width: 63%" + style="width: 85%" :disabled="!showFooter" > <el-option @@ -174,27 +165,20 @@ </div> </el-form> <!-- 灏� --> - <div v-if="showFooter" slot="footer" class="dialog-footer"> + <div slot="footer" class="dialog-footer"> <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> --> - <el-button type="primary" size="small" @click="saveClick('form')" - >淇濆瓨</el-button - > - <el-button size="small" @click="editConfig.visible = false" - >鍙栨秷</el-button - > + <el-button type="primary" size="small" @click="saveClick('form')" :disabled="!showFooter">淇濆瓨</el-button> + <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button> </div> </el-dialog> </div> </template> <script> -import { - addProductCategory, - updateProductCategory, - deleteProductCategory, -} from "@/api/product/productCategory"; +import { addProductCategory, updateProductCategory, deleteProductCategory } from "@/api/product/productCategory" -import { getDataByType } from "@/api/data"; +import { getDataByType } from "@/api/data" +import { getProductList } from "@/api/product/product" export default { name: "AddProductCategoryDialog", props: { @@ -205,24 +189,35 @@ visible: false, title: "鏂板缓", infomation: { type: [] }, - }; - }, + autoEdit: false + } + } }, productCategoryList: { type: Array, default: () => { - return []; - }, - }, + return [] + } + } }, 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%", editConfig: this.editCommonConfig, rules: { - name: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }], + name: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }] }, forceRemovalStrategyList: getDataByType("forceRemovalStrategy"), // 鎴愭湰鏂规硶 @@ -234,93 +229,146 @@ showButton: true, showEdit: false, // 鏄惁鏄剧ず缂栬緫鎸夐挳 isDelClick: false, // 鍒犻櫎鎸夐挳鏄惁鍙偣鍑� - showFooter: false, // 鏄惁鏄剧ず鍙栨秷淇濆瓨 - }; + showFooter: false, // 鏄惁鏄剧ず鍙栨秷淇濆瓨, + statisticsMap: { + product: 0 // 浜у搧鏁伴噺 + } + } }, created() { - this.setBottonView(); + this.setBottonView() + this.getProductCount() + if (this.editConfig.autoEdit) { + this.editClick() + } + this.setOptionalFieldsToEmpty() }, methods: { + /** + * 闈炲繀濉」鍚庣杩斿洖鐨勬槸鏁板瓧 0,琛ㄥ崟闇�瑕佺┖涓叉墠鑳借涓烘湭閫夋嫨鍥炴樉 + */ + setOptionalFieldsToEmpty() { + let arr = ["parentId", "costingMethod", "inventoryValuation", "forceRemovalStrategy"] + arr + .filter((filed) => this.editConfig.infomation[filed] === 0) + .forEach((filed) => { + this.editConfig.infomation[filed] = "" + }) + }, + /** + * 鍚庣鍙帴鍙楁暟瀛楀舰寮�, 淇濆瓨鏃惰繕寰楀啀杞洖鍘� + */ + unsetFieldsToNumber() { + let arr = ["parentId", "costingMethod", "inventoryValuation", "forceRemovalStrategy"] + arr + .filter((filed) => this.editConfig.infomation[filed] === "") + .forEach((filed) => { + this.editConfig.infomation[filed] = 0 + }) + }, + // 鑾峰彇浜у搧鏁伴噺 + getProductCount() { + if (this.editConfig.title !== "鏂板缓") { + getProductList({ + keyWord: "", + categoryId: this.editConfig.title === "鏂板缓" ? null : this.editConfig.infomation.id, + page: 1, + pageSize: 1 + }) + .then((res) => { + if (res.code === 200) { + this.statisticsMap.product = res?.total ?? 0 + } else { + this.statisticsMap.product = 0 + } + }) + .catch((err) => { + console.error(err) + this.statisticsMap.product = 0 + }) + } + }, // 璁剧疆鍒犻櫎/鎵撳嵃/缂栬緫鏄惁鏄剧ず setBottonView() { if (this.editConfig.title === "鏂板缓") { - this.showButton = false; - this.showEdit = false; - this.showFooter = true; + this.showButton = false + this.showEdit = false + this.showFooter = true } else { - this.showEdit = true; - this.showFooter = false; + this.showEdit = true + this.showFooter = false } }, // 鍏抽棴 handleClose() { - this.editConfig.visible = false; + this.editConfig.visible = false }, // 鍒櫎 deleteClick() { - let data = JSON.parse(JSON.stringify(this.editConfig.infomation)); + let data = JSON.parse(JSON.stringify(this.editConfig.infomation)) deleteProductCategory({ id: data.id }).then((res) => { if (res.code === 200) { - this.editConfig.visible = false; - this.$message.success("鍒櫎鎴愬姛!"); - this.$emit("refresh"); + this.editConfig.visible = false + this.$message.success("鍒櫎鎴愬姛!") + this.$emit("refresh") } else { - this.$message.warning(res.msg?res.msg:"鍒犻櫎澶辫触!") - } - }); + this.$message.warning(res.msg ? res.msg : "鍒犻櫎澶辫触!") + } + }) }, // 缂栬緫 editClick() { - this.showEdit = false; - this.showButton = false; - this.showFooter = true; + this.showEdit = false + this.showButton = false + this.showFooter = true }, saveParams() { - let data = JSON.parse(JSON.stringify(this.editConfig.infomation)); + this.unsetFieldsToNumber() + let data = JSON.parse(JSON.stringify(this.editConfig.infomation)) let params = { costingMethod: data.costingMethod, forceRemovalStrategy: data.forceRemovalStrategy, inventoryValuation: data.inventoryValuation, name: data.name, - parentId: data.parentId, - }; - if (data.id) { - params.id = data.id; + parentId: data.parentId } - return params; + if (data.id) { + params.id = data.id + } + return params }, // 淇濆瓨 saveClick(formName) { this.$refs[formName].validate((valid) => { if (valid) { - const params = this.saveParams(); + const params = this.saveParams() if (this.editConfig.title === "鏂板缓") { addProductCategory(params).then((res) => { if (res.code === 200) { - this.editConfig.visible = false; - this.$message.success("娣诲姞鎴愬姛!"); - this.$emit("refresh"); + this.editConfig.visible = false + this.$message.success("娣诲姞鎴愬姛!") + this.$emit("refresh") } else { - this.$message.warning(res.msg?res.msg:"娣诲姞澶辫触!") - } - }); + this.$message.warning(res.msg ? res.msg : "娣诲姞澶辫触!") + } + }) } else { updateProductCategory(params).then((res) => { if (res.code === 200) { - this.editConfig.visible = false; - this.$message.success("缂栬緫鎴愬姛!"); - this.$emit("refresh"); + this.editConfig.visible = false + this.$message.success("缂栬緫鎴愬姛!") + this.$emit("refresh") } else { - this.$message.warning(res.msg?res.msg:"缂栬緫澶辫触!") - } - }); + this.$message.warning(res.msg ? res.msg : "缂栬緫澶辫触!") + } + }) } } else { - console.log("error submit"); - return false; + console.log("error submit") + return false } - }); + }) }, // 鍒犻櫎 delClick() {}, @@ -330,14 +378,30 @@ if (valid) { this.$router.push({ path: "/productManage/product", - query: { categoryName:this.editConfig.infomation.name, id: this.editConfig.title === "鏂板缓"?'':this.editConfig.infomation.id}, - }); + query: { + categoryName: this.editConfig.infomation.name, + id: this.editConfig.title === "鏂板缓" ? "" : this.editConfig.infomation.id + } + }) } }) - }, - }, -}; + // 涓婃灦瑙勫垯 + listingRulesClick() { + this.$refs.form.validate((valid) => { + if (valid) { + this.$router.push({ + path: "/warehouseManage/listingRules", + query: { + categoryName: this.editConfig.infomation.name, + id: this.editConfig.title === "鏂板缓" ? "" : this.editConfig.infomation.id + } + }) + } + }) + } + } +} </script> <!-- Add "scoped" attribute to limit CSS to this component only --> @@ -365,15 +429,15 @@ height: calc(100% - 80px); overflow: auto; margin: 20px; - border: 1px solid #dcdfe6; - box-shadow: inset 0 0 2px #dee2e6; - -moz-box-shadow: inset 0 0 2px #dee2e6; - -webkit-box-shadow: inset 0 0 2px #dee2e6; + // border: 1px solid #dcdfe6; + // box-shadow: inset 0 0 2px #dee2e6; + // -moz-box-shadow: inset 0 0 2px #dee2e6; + // -webkit-box-shadow: inset 0 0 2px #dee2e6; .content-number { display: flex; justify-content: right; height: 44px; - border-bottom: 1px solid #e9e9e9; + // border-bottom: 1px solid #e9e9e9; font-size: 13px; .sub-number { width: 12.5%; @@ -468,13 +532,18 @@ color: #333; } } - .el-tabs--card > .el-tabs__header .el-tabs__nav { - margin-left: 20px; + .el-tabs--card > .el-tabs__header { + border-bottom: none; + } + .el-tabs__item.is-active { + color: #fff; + background: #2a78fb; } .el-tabs__item { height: 30px; line-height: 30px; font-size: 13px; + background: #f3f3f3; } } </style> -- Gitblit v1.8.0