From 1ae0722c4a8022961c48c34588823fdd23698e44 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期三, 20 九月 2023 19:17:26 +0800 Subject: [PATCH] 仓库管理 仓库+业务类型 接口列表 添加编辑 删除 联调 业务类型缺少字段 --- src/views/productManage/productCategory/AddProductCategoryDialog.vue | 217 +++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 167 insertions(+), 50 deletions(-) diff --git a/src/views/productManage/productCategory/AddProductCategoryDialog.vue b/src/views/productManage/productCategory/AddProductCategoryDialog.vue index 32c5b96..a73afb8 100644 --- a/src/views/productManage/productCategory/AddProductCategoryDialog.vue +++ b/src/views/productManage/productCategory/AddProductCategoryDialog.vue @@ -15,10 +15,22 @@ <span>鎵撳嵃</span> </span> --> <span class="btn" style="margin-left: 15px"> - <i class="el-icon-s-tools"></i> - <span>鍔ㄤ綔</span> + <el-button + plain + size="mini" + style="margin-left: 15px" + @click="deleteClick" + >鍒犻櫎</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> <!-- 鍐呭 --> @@ -37,9 +49,9 @@ <el-row> <el-col :span="24"> <div style="margin-left: 20px">绫诲埆</div> - <el-form-item label="" prop="client_name" label-width="20px"> + <el-form-item label="" prop="name" label-width="20px"> <el-input - v-model="editConfig.infomation.client_name" + v-model="editConfig.infomation.name" placeholder="" :disabled="!showFooter" style="width: 85%" @@ -47,15 +59,24 @@ </el-form-item> </el-col> <el-col :span="24"> - <el-form-item label="涓婄骇鍝佺被" prop="client_name" style="margin-left: 20px"> + <el-form-item + label="涓婄骇鍝佺被" + prop="parentId" + style="margin-left: 20px" + > <el-select - v-model="editConfig.infomation.memberId" + v-model="editConfig.infomation.parentId" placeholder="璇烽�夋嫨" size="mini" style="width: 45%" :disabled="!showFooter" > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :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> @@ -66,7 +87,7 @@ <div class="purchase-view"> <div class="left"> <div class="second-label">鐗╂祦</div> - <el-form-item label="璺嚎" prop="client_name" style="margin-left: 20px"> + <!-- <el-form-item label="璺嚎" prop="client_name" style="margin-left: 20px"> <el-select v-model="editConfig.infomation.memberId" multiple @@ -78,46 +99,70 @@ <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> </el-option> </el-select> - </el-form-item> - <el-form-item label="寮哄埗涓嬫灦绛栫暐" prop="client_name" style="margin-left: 20px"> + </el-form-item> --> + <el-form-item + label="寮哄埗涓嬫灦绛栫暐" + prop="forceRemovalStrategy" + style="margin-left: 20px" + > <el-select - v-model="editConfig.infomation.memberId" - multiple + v-model="editConfig.infomation.forceRemovalStrategy" placeholder="璇烽�夋嫨" size="mini" style="width: 63%" :disabled="!showFooter" > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + <el-option + v-for="item in forceRemovalStrategyList" + :key="item.id" + :label="item.name" + :value="item.id" + > </el-option> </el-select> </el-form-item> </div> <div class="right"> <div class="second-label">搴撳瓨璁′环</div> - <el-form-item label="鎴愭湰鏂规硶" prop="client_name" style="margin-left: 20px"> + <el-form-item + label="鎴愭湰鏂规硶" + prop="costingMethod" + style="margin-left: 20px" + > <el-select - v-model="editConfig.infomation.memberId" - multiple + v-model="editConfig.infomation.costingMethod" placeholder="璇烽�夋嫨" size="mini" style="width: 63%" :disabled="!showFooter" > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :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="client_name" style="margin-left: 20px"> + <el-form-item + label="搴撳瓨璁′环" + prop="inventoryValuation" + style="margin-left: 20px" + > <el-select - v-model="editConfig.infomation.memberId" - multiple + v-model="editConfig.infomation.inventoryValuation" placeholder="璇烽�夋嫨" size="mini" style="width: 63%" :disabled="!showFooter" > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + <el-option + v-for="item in inventoryValuationList" + :key="item.id" + :label="item.name" + :value="item.id" + > </el-option> </el-select> </el-form-item> @@ -129,14 +174,24 @@ <!-- 灏� --> <div v-if="showFooter" 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')" + >淇濆瓨</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 { getDataByType } from "@/api/data"; export default { name: "AddProductCategoryDialog", props: { @@ -146,10 +201,16 @@ return { visible: false, title: "鏂板缓", - infomation: { type: [] } - } - } - } + infomation: { type: [] }, + }; + }, + }, + productCategoryList: { + type: Array, + default: () => { + return []; + }, + }, }, components: {}, computed: {}, @@ -158,55 +219,111 @@ dialogWidth: "50%", editConfig: this.editCommonConfig, rules: { - client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }], - number: [{ required: true, message: "璇疯緭鍏ラ��娆惧崟缂栧彿", trigger: "blur" }], - refundDate: [{ required: true, message: "璇烽�夋嫨閫�娆炬棩鏈�", trigger: "change" }], - memberId: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }], - sale_return_nunber: [{ required: true, message: "璇烽�夋嫨閿�鍞��璐у崟", trigger: "change" }] + name: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }], }, + forceRemovalStrategyList: getDataByType("forceRemovalStrategy"), + // 鎴愭湰鏂规硶 + costingMethodList: getDataByType("costingMethod"), + // 搴撳瓨璁′环 + inventoryValuationList: getDataByType("inventoryValuation"), memberOptions: [], paymentTypeListOptions: [], showButton: true, showEdit: false, // 鏄惁鏄剧ず缂栬緫鎸夐挳 isDelClick: false, // 鍒犻櫎鎸夐挳鏄惁鍙偣鍑� - showFooter: false // 鏄惁鏄剧ず鍙栨秷淇濆瓨 - } + showFooter: false, // 鏄惁鏄剧ず鍙栨秷淇濆瓨 + }; }, created() { - this.setBottonView() + this.setBottonView(); }, methods: { // 璁剧疆鍒犻櫎/鎵撳嵃/缂栬緫鏄惁鏄剧ず 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)); + deleteProductCategory({ id: data.id }).then((res) => { + if (res.code === 200) { + this.editConfig.visible = false; + this.$message.success("鍒櫎鎴愬姛"); + this.$emit("refresh"); + } + }); }, // 缂栬緫 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)); + + let params = { + costingMethod: data.costingMethod, + forceRemovalStrategy: data.forceRemovalStrategy, + inventoryValuation: data.inventoryValuation, + name: data.name, + parentId: data.parentId, + }; + if (data.id) { + params.id = data.id; + } + return params; }, // 淇濆瓨 - saveClick() {}, + saveClick(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + 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"); + } + }); + } else { + updateProductCategory(params).then((res) => { + if (res.code === 200) { + this.editConfig.visible = false; + this.$message.success("缂栬緫鎴愬姛"); + this.$emit("refresh"); + } + }); + } + } else { + console.log("error submit"); + return false; + } + }); + }, // 鍒犻櫎 delClick() {}, // 浜у搧 productClick() { - this.$router.push({ path: "/productManage/productList", query: { name: "浜у搧" } }) - } - } -} + this.$router.push({ + path: "/productManage/productList", + query: { name: "浜у搧" }, + }); + }, + }, +}; </script> <!-- Add "scoped" attribute to limit CSS to this component only --> -- Gitblit v1.8.0