From 101ae06a200c513fcf3be01d047b310af7660b6c Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期四, 28 九月 2023 16:28:53 +0800 Subject: [PATCH] 出入库明细路由传值刷新实现问题 --- src/views/overview/AddOverviewDialog.vue | 15 src/views/reportForm/inventoryReport/index.vue | 64 +--- src/views/reportForm/inboundOutboundDetail/index.vue | 192 ++++++------- src/views/reportForm/locationReport/index.vue | 60 +--- src/router/index.js | 4 src/views/productManage/product/AddProductDialog.vue | 389 +++++++++-------------------- 6 files changed, 270 insertions(+), 454 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 8dc1323..b4932a3 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -109,13 +109,13 @@ const router = createRouter() router.afterEach((to, from, next) => { - console.log(to,"to") + console.log(to, "to") if ((to.path === "/overview/overviewList" || to.path === "/productManage/productList") && to.params.name) { console.log(from, next) to.meta.title = to.params.name document.title = to.meta.title } else if (to.name === "inboundOutboundDetail") { - to.meta.title = to.params.name + "/鍑哄叆搴撴槑缁�" + to.meta.title = "鍑哄叆搴撴槑缁�" document.title = to.meta.title } }) diff --git a/src/views/overview/AddOverviewDialog.vue b/src/views/overview/AddOverviewDialog.vue index 2dcf44e..6f9807e 100644 --- a/src/views/overview/AddOverviewDialog.vue +++ b/src/views/overview/AddOverviewDialog.vue @@ -414,7 +414,16 @@ this.showEdit = false this.showFooter = true this.isValidateClick = false - } else if (this.editConfig.infomation.status === 4||this.editConfig.infomation.status === "瀹屾垚") { + } else if ( + this.editConfig.title === "鏌ョ湅" && + (this.editConfig.infomation.status !== 4 || this.editConfig.infomation.status !== "瀹屾垚") + ) { + this.showButton = true + this.showEdit = false + this.isDelClick = true + this.showFooter = false + this.isValidateClick = true + } else if (this.editConfig.infomation.status === 4 || this.editConfig.infomation.status === "瀹屾垚") { this.showButton = true this.showEdit = false this.isDelClick = true @@ -436,8 +445,8 @@ this.list[0].status = "active" } else { this.list.map((item) => { - console.log(item,this.editConfig.infomation.status,"鎵撳嵃淇℃伅") - if (item.value === this.editConfig.infomation.status||item.label===this.editConfig.infomation.status) { + console.log(item, this.editConfig.infomation.status, "鎵撳嵃淇℃伅") + if (item.value === this.editConfig.infomation.status || item.label === this.editConfig.infomation.status) { item.status = "active" } else { item.status = "todo" diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue index d92daeb..99d483a 100644 --- a/src/views/productManage/product/AddProductDialog.vue +++ b/src/views/productManage/product/AddProductDialog.vue @@ -18,14 +18,7 @@ <i class="el-icon-s-tools"></i> <span>鍔ㄤ綔</span> </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> <!-- 鍐呭 --> @@ -53,15 +46,9 @@ <div class="basic-info-view"> <el-row> <el-col :span="23"> - <div style="margin-left: 20px"> - <span style="color: #f56c6c">*</span>浜у搧鍚嶇О - </div> + <div style="margin-left: 20px"><span style="color: #f56c6c">*</span>浜у搧鍚嶇О</div> <el-form-item label="" prop="name" label-width="20px"> - <el-input - v-model="editConfig.infomation.name" - placeholder="" - :disabled="!showFooter" - ></el-input> + <el-input v-model="editConfig.infomation.name" placeholder="" :disabled="!showFooter"></el-input> </el-form-item> </el-col> <!-- <el-col :span="4"> @@ -94,11 +81,7 @@ <div v-if="activeName === 'first'"> <div class="purchase-view"> <div class="left"> - <el-form-item - label="浜у搧绫诲瀷" - prop="productType" - style="margin-left: 20px" - > + <el-form-item label="浜у搧绫诲瀷" prop="productType" style="margin-left: 20px"> <el-select v-model="editConfig.infomation.productType" placeholder="璇烽�夋嫨" @@ -106,20 +89,11 @@ style="width: 85%" :disabled="!showFooter" > - <el-option - v-for="item in productTypeOptions" - :key="item.id" - :label="item.name" - :value="item.id" - > + <el-option v-for="item in productTypeOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> </el-form-item> - <el-form-item - label="寮�绁ㄧ瓥鐣�" - prop="invoicingStrategy" - style="margin-left: 20px" - > + <el-form-item label="寮�绁ㄧ瓥鐣�" prop="invoicingStrategy" style="margin-left: 20px"> <el-select v-model="editConfig.infomation.invoicingStrategy" placeholder="璇烽�夋嫨" @@ -127,26 +101,13 @@ style="width: 85%" :disabled="!showFooter" > - <el-option - v-for="item in strategyOptions" - :key="item.id" - :label="item.name" - :value="item.id" - > + <el-option v-for="item in strategyOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> - <div class="font_size_13" style="color: gray"> - 鍙偍瀛樼殑浜у搧鏄偍绠$悊搴撳瓨姘村钩鐨勫疄鐗╅」鐩�� - </div> - <div class="font_size_13" style="color: gray"> - 鎮ㄥ彲浠ュ湪鍙戣揣鍓嶄负鍏跺紑鍏风粨绠楀崟銆� - </div> + <div class="font_size_13" style="color: gray">鍙偍瀛樼殑浜у搧鏄偍绠$悊搴撳瓨姘村钩鐨勫疄鐗╅」鐩��</div> + <div class="font_size_13" style="color: gray">鎮ㄥ彲浠ュ湪鍙戣揣鍓嶄负鍏跺紑鍏风粨绠楀崟銆�</div> </el-form-item> - <el-form-item - label="鐗╂枡绫诲瀷" - prop="model" - style="margin-left: 20px" - > + <el-form-item label="鐗╂枡绫诲瀷" prop="model" style="margin-left: 20px"> <el-select v-model="editConfig.infomation.model" placeholder="璇烽�夋嫨" @@ -156,20 +117,11 @@ :popper-append-to-body="false" :disabled="!showFooter" > - <el-option - v-for="item in materialTypeList" - :key="item.id" - :label="item.name" - :value="item.id" - > + <el-option v-for="item in materialTypeList" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> </el-form-item> - <el-form-item - label="鍗曚綅" - prop="unit" - style="margin-left: 20px" - > + <el-form-item label="鍗曚綅" prop="unit" style="margin-left: 20px"> <el-input v-model="editConfig.infomation.unit" placeholder="璇疯緭鍏�" @@ -177,11 +129,7 @@ :disabled="!showFooter" ></el-input> </el-form-item> - <el-form-item - label="浜у搧鏍囩" - prop="productTagName" - style="margin-left: 20px" - > + <el-form-item label="浜у搧鏍囩" prop="productTagName" style="margin-left: 20px"> <el-input v-model="editConfig.infomation.productTagName" placeholder="璇疯緭鍏�" @@ -191,11 +139,7 @@ </el-form-item> </div> <div class="right"> - <el-form-item - label="閿�鍞环鏍�" - prop="salePrice" - style="margin-left: 20px" - > + <el-form-item label="閿�鍞环鏍�" prop="salePrice" style="margin-left: 20px"> <span>锟�</span> <el-input-number v-model.trim="editConfig.infomation.salePrice" @@ -207,11 +151,7 @@ :disabled="!showFooter" ></el-input-number> </el-form-item> - <el-form-item - label="閿�椤圭◣" - prop="customerTaxes" - style="margin-left: 20px" - > + <el-form-item label="閿�椤圭◣" prop="customerTaxes" style="margin-left: 20px"> <el-input-number v-model="editConfig.infomation.customerTaxes" placeholder="璇疯緭鍏�" @@ -221,11 +161,7 @@ :disabled="!showFooter" ></el-input-number> </el-form-item> - <el-form-item - label="鎴愭湰" - prop="cost" - style="margin-left: 20px" - > + <el-form-item label="鎴愭湰" prop="cost" style="margin-left: 20px"> <span>锟�</span> <el-input-number v-model.trim="editConfig.infomation.cost" @@ -237,11 +173,7 @@ :disabled="!showFooter" ></el-input-number> </el-form-item> - <el-form-item - label="浜у搧绫诲埆" - prop="categoryId" - style="margin-left: 20px" - > + <el-form-item label="浜у搧绫诲埆" prop="categoryId" style="margin-left: 20px"> <el-select v-model="editConfig.infomation.categoryId" placeholder="璇烽�夋嫨" @@ -258,11 +190,7 @@ </el-option> </el-select> </el-form-item> - <el-form-item - label="鍐呴儴鍙傝��" - prop="internalReference" - style="margin-left: 20px" - > + <el-form-item label="鍐呴儴鍙傝��" prop="internalReference" style="margin-left: 20px"> <el-input v-model.trim="editConfig.infomation.internalReference" placeholder="璇疯緭鍏�" @@ -271,11 +199,7 @@ :disabled="!showFooter" ></el-input> </el-form-item> - <el-form-item - label="鏉$爜" - prop="barcode" - style="margin-left: 20px" - > + <el-form-item label="鏉$爜" prop="barcode" style="margin-left: 20px"> <el-input v-model.trim="editConfig.infomation.barcode" placeholder="璇疯緭鍏�" @@ -288,12 +212,7 @@ </div> <div class="all"> <div class="second-label">鍐呴儴璇存槑</div> - <el-form-item - label="" - prop="internalNotes" - style="margin-left: 20px" - label-width="0px" - > + <el-form-item label="" prop="internalNotes" style="margin-left: 20px" label-width="0px"> <el-input v-model.trim="editConfig.infomation.internalNotes" placeholder="璇疯緭鍏�" @@ -325,12 +244,7 @@ </el-form-item> </div> --> <div class="left"> - <el-form-item - label="璐熻矗浜�" - prop="principal" - style="margin-left: 20px" - label-width="80px" - > + <el-form-item label="璐熻矗浜�" prop="principal" style="margin-left: 20px" label-width="80px"> <el-select v-model="editConfig.infomation.principal" placeholder="璇烽�夋嫨" @@ -338,21 +252,11 @@ style="width: 85%" :disabled="!showFooter" > - <el-option - v-for="item in memberOptions" - :key="item.id" - :label="item.name" - :value="item.name" - > + <el-option v-for="item in memberOptions" :key="item.id" :label="item.name" :value="item.name"> </el-option> </el-select> </el-form-item> - <el-form-item - label="閲嶉噺" - prop="weight" - style="margin-left: 20px" - label-width="80px" - > + <el-form-item label="閲嶉噺" prop="weight" style="margin-left: 20px" label-width="80px"> <el-input-number v-model="editConfig.infomation.weight" placeholder="璇疯緭鍏�" @@ -364,12 +268,7 @@ ></el-input-number> <span> kg</span> </el-form-item> - <el-form-item - label="浣撶Н" - prop="volume" - style="margin-left: 20px" - label-width="80px" - > + <el-form-item label="浣撶Н" prop="volume" style="margin-left: 20px" label-width="80px"> <el-input-number v-model="editConfig.infomation.volume" placeholder="璇疯緭鍏�" @@ -439,12 +338,7 @@ <div class="purchase-view"> <div class="left"> <div class="second-label">鏀惰揣璇存槑</div> - <el-form-item - label="" - prop="inStorageExplain" - style="margin-left: 20px" - label-width="0px" - > + <el-form-item label="" prop="inStorageExplain" style="margin-left: 20px" label-width="0px"> <el-input v-model.trim="editConfig.infomation.inStorageExplain" placeholder="姝よ鏄庢坊鍔犲埌鏀惰揣璁㈠崟涓�(渚嬪锛屼骇鍝佸湪浠撳簱鐨勫瓨鍌ㄤ綅缃�)" @@ -458,12 +352,7 @@ </div> <div class="right"> <div class="second-label">鍑哄簱鍗曡鏄�</div> - <el-form-item - label="" - prop="outStorageExplain" - style="margin-left: 20px" - label-width="0px" - > + <el-form-item label="" prop="outStorageExplain" style="margin-left: 20px" label-width="0px"> <el-input v-model.trim="editConfig.infomation.outStorageExplain" placeholder="姝ら�氱煡宸叉坊鍔犲埌閫佽揣鍗曚腑" @@ -479,16 +368,9 @@ <div class="purchase-view"> <div class="left"> <div class="second-label">鍐呴儴璋冩嫧璇存槑</div> - <el-form-item - label="" - prop="internalTransferExplain" - style="margin-left: 20px" - label-width="0px" - > + <el-form-item label="" prop="internalTransferExplain" style="margin-left: 20px" label-width="0px"> <el-input - v-model.trim=" - editConfig.infomation.internalTransferExplain - " + v-model.trim="editConfig.infomation.internalTransferExplain" placeholder="姝よ鏄庢坊鍔犲埌鍐呴儴璋冩嫧璁㈠崟涓�(渚嬪锛屽湪浠撳簱涓綍澶勬彁鍙栦骇鍝�)" size="mini" type="textarea" @@ -602,12 +484,8 @@ </el-form> <!-- 灏� --> <div v-if="showFooter" slot="footer" class="dialog-footer"> - <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> @@ -615,14 +493,10 @@ <script> // import CommonFormTableView from "@/components/makepager/CommonFormTableView" -import { getProductCategoryList } from "@/api/product/productCategory"; -import { - getProductList, - addProduct, - updateProduct, -} from "@/api/product/product"; +import { getProductCategoryList } from "@/api/product/productCategory" +import { getProductList, addProduct, updateProduct } from "@/api/product/product" -let inputElement = null; +let inputElement = null export default { name: "AddProductDialog", props: { @@ -632,10 +506,10 @@ return { visible: false, title: "鏂板缓", - infomation: {}, - }; - }, - }, + infomation: {} + } + } + } }, components: {}, computed: {}, @@ -645,24 +519,20 @@ editConfig: this.editCommonConfig, rules: { name: [{ required: true, message: "璇疯緭鍏ヤ骇鍝佸悕绉�", trigger: "blur" }], - model: [ - { required: true, message: "璇烽�夋嫨鐗╂枡绫诲瀷", trigger: "change" }, - ], - salePrice: [ - { required: true, message: "璇疯緭鍏ラ攢鍞环鏍�", trigger: "blur" }, - ], - unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }], + model: [{ required: true, message: "璇烽�夋嫨鐗╂枡绫诲瀷", trigger: "change" }], + salePrice: [{ required: true, message: "璇疯緭鍏ラ攢鍞环鏍�", trigger: "blur" }], + unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }] }, memberOptions: [{ name: "绠$悊鍛�", id: 1 }], productCategoryOptions: [], // 浜у搧绫诲埆 productTypeOptions: [ { name: "鑳芥秷鑰�", id: 1 }, { name: "鏈嶅姟", id: 2 }, - { name: "鍙簱瀛樹骇鍝�", id: 3 }, + { name: "鍙簱瀛樹骇鍝�", id: 3 } ], // 浜у搧绫诲瀷 strategyOptions: [ { name: "璁㈣喘鏁伴噺", id: 1 }, - { name: "浜や粯鏁伴噺", id: 2 }, + { name: "浜や粯鏁伴噺", id: 2 } ], // 寮�绁ㄧ瓥鐣� selectProductOptions: [], // 鍙�変骇鍝� showButton: true, @@ -687,15 +557,15 @@ { name: "鎴愬搧", id: "鎴愬搧" }, { name: "杈呮枡", id: "杈呮枡" }, { name: "鑰楁潗", id: "鑰楁潗" }, - { name: "鍏朵粬", id: "鍏朵粬" }, - ], - }; + { name: "鍏朵粬", id: "鍏朵粬" } + ] + } }, created() { - this.getProductCategoryList(); - this.getProductList(); - this.setTableForm(); - this.setBottonView(); + this.getProductCategoryList() + this.getProductList() + this.setTableForm() + this.setBottonView() }, methods: { // 鑾峰彇浜у搧绫诲埆 @@ -703,74 +573,73 @@ await getProductCategoryList({ keyWord: "", page: 0, - pageSize: 0, + pageSize: 0 }).then((res) => { if (res.code === 200) { - this.productCategoryOptions = res.data; + this.productCategoryOptions = res.data } - }); + }) }, // 鑾峰彇鍙�変骇鍝� async getProductList() { await getProductList({ keyWord: "", page: 1, - pageSize: 20, + pageSize: 20 }).then((res) => { if (res.code === 200) { const list = res.data.map((item) => { return { id: item.id, - name: item.name, - }; - }); - this.selectProductOptions = list || []; + name: item.name + } + }) + this.selectProductOptions = list || [] } - }); + }) }, // 璁剧疆鍒犻櫎/鎵撳嵃/缂栬緫鏄惁鏄剧ず setBottonView() { if (this.editConfig.title === "鏂板缓") { - this.showButton = false; - this.showEdit = false; - this.showFooter = true; - this.addProduct = true; + this.showButton = false + this.showEdit = false + this.showFooter = true + this.addProduct = true } else { - this.showEdit = true; - this.showFooter = false; - this.addProduct = false; + this.showEdit = true + this.showFooter = false + this.addProduct = false } }, // 鍏抽棴 handleClose() { - this.editConfig.visible = false; + this.editConfig.visible = false }, // 缂栬緫 editClick() { - this.showEdit = false; - this.showButton = false; - this.showFooter = true; - this.setTableForm(); + this.showEdit = false + this.showButton = false + this.showFooter = true + this.setTableForm() }, // 淇濆瓨 saveClick(formName) { - console.log(this.editConfig.infomation); + console.log(this.editConfig.infomation) this.$refs[formName].validate((valid) => { if (valid) { - let requestUrl = - this.editConfig.title === "鏂板缓" ? addProduct : updateProduct; + let requestUrl = this.editConfig.title === "鏂板缓" ? addProduct : updateProduct requestUrl({ - ...this.editConfig.infomation, + ...this.editConfig.infomation }).then((res) => { - console.log(res); - this.editConfig.visible = false; + console.log(res) + this.editConfig.visible = false if (res.code === 200) { - this.$message.success("娣诲姞鎴愬姛"); - this.$parent.getData(); + this.$message.success("娣诲姞鎴愬姛") + this.$parent.getData() } - }); + }) } - }); + }) }, // 鍒犻櫎 delClick() {}, @@ -786,33 +655,33 @@ { label: "鍏徃", prop: "total", select: true }, { label: "鏁伴噺", prop: "total", inputFloat: true }, { label: "浠锋牸", prop: "price", inputFloat: true }, - { label: "甯佺", prop: "total", select: true }, + { label: "甯佺", prop: "total", select: true } // { label: "浜よ揣鎻愬墠鏃堕棿", prop: "total", inputNumber: true } - ], - }; + ] + } }, // 浜у搧鍒楄〃杈撳叆 inputContent(val, prop, row) { - this.productId = row.productId; + this.productId = row.productId this.tableData.map((item) => { if (item.productId === row.productId) { - item[prop] = val; + item[prop] = val } - }); + }) }, // 浜у搧鏂板 addProductClick() { - console.log(this.tableData); + console.log(this.tableData) for (let i = 0; i < this.tableData.length; i++) { if (this.tableData[i].name.length === 0) { - this.isNoProduct = true; - break; + this.isNoProduct = true + break } else { - this.isNoProduct = false; + this.isNoProduct = false } } if (!this.isNoProduct) { - this.productId++; + this.productId++ this.tableData.push({ productId: this.productId, id: 0, @@ -821,96 +690,84 @@ name: "", number: "", price: 0, - total: 0, - }); + total: 0 + }) } }, // 浜у搧鍒犻櫎 handleDelClick(scope) { - console.log(scope); - this.tableData.splice(scope.$index, 1); + console.log(scope) + this.tableData.splice(scope.$index, 1) }, // 涓婁紶鍥剧墖 toGetImg() { if (this.showFooter) { if (inputElement === null) { // 鐢熸垚鏂囦欢涓婁紶鐨勬帶浠� - inputElement = document.createElement("input"); - inputElement.setAttribute("type", "file"); - inputElement.style.display = "none"; + inputElement = document.createElement("input") + inputElement.setAttribute("type", "file") + inputElement.style.display = "none" if (window.addEventListener) { - inputElement.addEventListener("change", this.uploadFile, false); + inputElement.addEventListener("change", this.uploadFile, false) } else { - inputElement.attachEvent("onchange", this.uploadFile); + inputElement.attachEvent("onchange", this.uploadFile) } - document.body.appendChild(inputElement); + document.body.appendChild(inputElement) } - inputElement.click(); + inputElement.click() } }, uploadFile(el) { if (el && el.target && el.target.files && el.target.files.length > 0) { - console.log(el); - const files = el.target.files[0]; - const isLt2M = files.size / 1024 / 1024 < 2; - const size = files.size / 1024 / 1024; - console.log(size); + console.log(el) + const files = el.target.files[0] + const isLt2M = files.size / 1024 / 1024 < 2 + const size = files.size / 1024 / 1024 + console.log(size) // 鍒ゆ柇涓婁紶鏂囦欢鐨勫ぇ灏� if (!isLt2M) { - this.$message.error("涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!"); + this.$message.error("涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!") } else if (files.type.indexOf("image") === -1) { //濡傛灉涓嶆槸鍥剧墖鏍煎紡 - this.$message.error("璇烽�夋嫨鍥剧墖鏂囦欢"); + this.$message.error("璇烽�夋嫨鍥剧墖鏂囦欢") } else { - const that = this; - const reader = new FileReader(); // 鍒涘缓璇诲彇鏂囦欢瀵硅薄 - reader.readAsDataURL(el.target.files[0]); // 鍙戣捣寮傛璇锋眰锛岃鍙栨枃浠� + const that = this + const reader = new FileReader() // 鍒涘缓璇诲彇鏂囦欢瀵硅薄 + reader.readAsDataURL(el.target.files[0]) // 鍙戣捣寮傛璇锋眰锛岃鍙栨枃浠� reader.onload = function () { // 璇诲彇瀹屾垚鍚庯紝灏嗙粨鏋滆祴鍊肩粰img鐨剆rc - that.imageSrc = this.result; - console.log(this.result); + that.imageSrc = this.result + console.log(this.result) // 鏁版嵁浼犲埌鍚庡彴 //const formData = new FormData() //formData.append('file', files); // 鍙互浼犲埌鍚庡彴鐨勬暟鎹� - }; + } } } }, // 杩涘嚭鐐瑰嚮 inOutBoundClick() { if (this.editConfig.title !== "鏂板缓") { - console.log(this.editConfig.infomation); + console.log(this.editConfig.infomation) this.$router.push({ name: "inboundOutboundDetail", params: { name: this.editConfig.infomation.name, - id: this.editConfig.infomation.id, - pageName:"浜у搧", - paramsKey: { - amount: "amount", //鏁伴噺 - productName:"productName", //浜у搧鍚嶇О - status: "status", // 鐘舵�� - contactedName: "admin", //瀹屾垚鑰� - date: "operationDate", // 鏃ユ湡 - fromLocation: "from", // 浠� - number: "number", //鍗曞彿 - toLocation: "to", //鑷� - unit: "unit", //鍗曚綅 - }, - }, - }); + id: this.editConfig.infomation.id + } + }) } }, // 鍙攢鍞�/鍙噰璐� checkboxChange(val, param) { if (val === "閲囪喘") { - this.showProcure = param; + this.showProcure = param } else if (val === "閿�鍞�") { - this.showSale = param; + this.showSale = param } - }, - }, -}; + } + } +} </script> <!-- Add "scoped" attribute to limit CSS to this component only --> diff --git a/src/views/reportForm/inboundOutboundDetail/index.vue b/src/views/reportForm/inboundOutboundDetail/index.vue index 0531503..46a21b5 100644 --- a/src/views/reportForm/inboundOutboundDetail/index.vue +++ b/src/views/reportForm/inboundOutboundDetail/index.vue @@ -11,35 +11,29 @@ /> </div> <div class="list-view"> - <TableCommonView - ref="tableListRef" - :table-list="tableList" - @selTableCol="selTableCol" - @tableRowClick="tableRowClick" - ></TableCommonView> + <div class="table"> + <TableCommonView + ref="tableListRef" + :table-list="tableList" + @selTableCol="selTableCol" + @tableRowClick="tableRowClick" + ></TableCommonView> + </div> <div class="btn-pager"> - <PagerView - class="page" - :pager-options="pagerOptions" - v-on="pagerEvents" - /> + <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> </div> </div> <!-- 缂栬緫 --> - <AddOverviewDialog - v-if="editConfig.visible" - :edit-common-config="editConfig" - :add-name="this.$route.params.name" - /> + <AddOverviewDialog v-if="editConfig.visible" :edit-common-config="editConfig" :add-name="this.$route.params.name" /> </div> </template> <script> -import pageMixin from "@/components/makepager/pager/mixin/pageMixin"; -import { getHistory } from "@/api/reportForm/inventoryRwport"; -import { getProductOperatonList } from "@/api/product/product"; +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" +import { getHistory } from "@/api/reportForm/inventoryRwport" +import { getProductOperatonList } from "@/api/product/product" -import AddOverviewDialog from "@/views/overview/AddOverviewDialog"; +import AddOverviewDialog from "@/views/overview/AddOverviewDialog" export default { name: "InboundOutboundDetail", @@ -55,23 +49,22 @@ commonDetail: { visible: false, title: "鏂板缓", - infomation: {}, + infomation: {} }, editConfig: { visible: false, title: "鏂板缓", - infomation: {}, + infomation: {} }, - productId: this.$route.params.id, - productName: this.$route.params.name, - }; + params: {} + } }, created() { this.setTable() console.log(this.$route.params) - var paramsData = sessionStorage.getItem("paramsList") + var paramsList = sessionStorage.getItem("paramsList") let params = {} - if (paramsData) { + if (paramsList) { params = JSON.parse(sessionStorage.getItem("paramsList")) } else { params = this.$route.params @@ -81,6 +74,10 @@ console.log(this.params) this.getData() }, + // 椤甸潰閿�姣佷箣鍓� + beforeDestroy() { + sessionStorage.removeItem("paramsList") + }, methods: { setTable() { this.tableList = { @@ -88,155 +85,144 @@ selectBox: true, showcol: this.showcol, allcol: [], - tableColumn: this.setTableColumn(this.showcol), - }; - let allcol = []; + tableColumn: this.setTableColumn(this.showcol) + } + let allcol = [] for (let i = 0; i < this.tableList.tableColumn.length; i++) { if (!this.tableList.tableColumn[i].default) { - const label = this.tableList.tableColumn[i].label; - allcol.push(label); + const label = this.tableList.tableColumn[i].label + allcol.push(label) } } - this.tableList.allcol = allcol; + this.tableList.allcol = allcol }, setTableColumn(showcol) { let tableColumn = [ { label: "鏃ユ湡", - prop: this.$route.params.paramsKey.date, + prop: "date", isShowColumn: true, default: true, - date: true, + date: true }, { label: "鍗曞彿", - prop: this.$route.params.paramsKey.number, + prop: "number", isShowColumn: true, - default: true, + default: true }, { label: "浜у搧", - prop: this.$route.params.paramsKey.productName, + prop: "productName", isShowColumn: true, - default: true, + default: true }, { label: "浠�", - prop: this.$route.params.paramsKey.fromLocation, + prop: "fromLocation", isShowColumn: true, - default: true, + default: true }, { label: "鑷�", - prop: this.$route.params.paramsKey.toLocation, + prop: "toLocation", isShowColumn: true, - default: true, + default: true }, { label: "鏁伴噺", - prop: this.$route.params.paramsKey.amount, + prop: "amount", isShowColumn: true, - default: true, + default: true }, { label: "鍗曚綅", - prop: this.$route.params.paramsKey.unit, + prop: "unit", isShowColumn: true, - default: true, + default: true }, { label: "鐘舵��", - prop: this.$route.params.paramsKey.status, + prop: "status", width: 120, isShowColumn: showcol.includes("鐘舵��"), default: false, status: true, isCallMethod: true, - getCallMethod: this.getStatus, + getCallMethod: this.getStatus }, { label: "瀹屾垚鑰�", - prop: this.$route.params.paramsKey.contactedName, + prop: "contactedName", isShowColumn: showcol.includes("瀹屾垚鑰�"), - default: false, - }, - ]; - return tableColumn; + default: false + } + ] + return tableColumn }, selTableCol(val) { - this.showcol = val; - this.tableList.tableColumn = this.setTableColumn(val); + this.showcol = val + this.tableList.tableColumn = this.setTableColumn(val) }, // 搴撳瓨鎶ヨ〃璺宠浆璇锋眰鏁版嵁 async getData() { - if (this.$route.params.pageName == "浜у搧") { - await getProductOperatonList({ - productId: this.productId, + if (this.params.name === "鎶ヨ〃") { + await getHistory({ + productId: this.params.id, page: this.pagerOptions.currPage, - pageSize: this.pagerOptions.pageSize, + pageSize: this.pagerOptions.pageSize + }).then((res) => { + if (res.code === 200) { + this.tableList.tableInfomation = res.data + this.pagerOptions.totalCount = res.total + } + }) + } else { + await getProductOperatonList({ + productId: this.params.id, + page: this.pagerOptions.currPage, + pageSize: this.pagerOptions.pageSize }).then((res) => { if (res.code === 200) { const list = res.data.map((item) => { return { ...item, - from: item.fromLocation.name, - to: item.toLocation.name, - productName: this.productName, - }; - }); - this.tableList.tableInfomation = list || []; - this.pagerOptions.totalCount = res.total; + fromLocation: item.fromLocation.name, + toLocation: item.toLocation.name, + productName: this.params.name, + amount: item.details[0].product.amount, + unit: item.details[0].product.unit + } + }) + this.tableList.tableInfomation = list || [] + this.pagerOptions.totalCount = res.total } - }); - } else if (this.$route.params.pageName == "鎶ヨ〃") { - await getHistory(this.$route.params.product).then((res) => { - if (res.code === 200) { - this.tableList.tableInfomation = res.data; - } - }); + }) } }, - //浜у搧璺宠浆璇锋眰鏁版嵁 - // 鎼滅储 getList(val) { - console.log(val); + console.log(val) }, // 琛岀偣鍑� tableRowClick(row) { - console.log(row,"琛宺ow") - this.editConfig.visible = true; - this.editConfig.title = "鏌ョ湅"; - this.editConfig.infomation = { ...row }; + console.log(row, "琛宺ow") + this.editConfig.visible = true + this.editConfig.title = "鏌ョ湅" + this.editConfig.infomation = { ...row } }, // 鏂板缓 addBtnClick() { // this.editConfig.visible = true - this.editConfig.title = "鏂板缓"; + this.editConfig.title = "鏂板缓" }, // 鐘舵�� getStatus(val) { - console.log(val,"val鐘舵��") - return val === 1 ? "鑽夌" : val === 3 ? "灏辩华" : "瀹屾垚"; - }, - }, -}; + return val === 1 ? "鑽夌" : val === 3 ? "灏辩华" : "瀹屾垚" + } + } +} </script> <!-- Add "scoped" attribute to limit CSS to this component only --> -<style lang="scss" scoped> -// .rightContent { -// height: 100%; -// background: #e6ecf2; -// padding: 10px; -// .top { -// margin-bottom: 20px; -// height: 60px; -// background: #fff; -// border-radius: 8px; -// } -// .list-view { -// height: calc(100% - 120px); -// } -// } -</style> +<style lang="scss" scoped></style> diff --git a/src/views/reportForm/inventoryReport/index.vue b/src/views/reportForm/inventoryReport/index.vue index 7738753..bdba386 100644 --- a/src/views/reportForm/inventoryReport/index.vue +++ b/src/views/reportForm/inventoryReport/index.vue @@ -144,8 +144,8 @@ stashRadio: "1", pageSizes: [15, 30], oldRadioBtn: "", - metaTitle: this.$route.meta.title, - }; + metaTitle: this.$route.meta.title + } }, created() { this.setTable() @@ -158,17 +158,17 @@ }, methods: { checkListHandler(e) { - this.categoryListId = e; - this.getData(); + this.categoryListId = e + this.getData() }, radioHandleChange(e) { - this.warehouseListName = e; - this.getData(); + this.warehouseListName = e + this.getData() }, setTable() { if (this.isIconIndex === "1") { - this.pageSizes = [30, 60]; - this.pagerOptions.pageSize = 30; + this.pageSizes = [30, 60] + this.pagerOptions.pageSize = 30 } this.tableList = { tableInfomation: [], @@ -290,33 +290,15 @@ this.$router.push({ name: "inboundOutboundDetail", params: { - name: this.metaTitle, - product: { - page: this.pagerOptions.currPage, - pageSize: this.pagerOptions.pageSize, - produceId: row.produceId, - productName: row.productName, - unit: row.unit, - }, - pageName:"鎶ヨ〃", - paramsKey: { - amount: "amount", - status: "status", //鐘舵�� - productName:"productName", //浜у搧鍚嶇О - contactedName: "contactedName", - date: "date", - fromLocation: "fromLocation", - number: "number", - toLocation: "toLocation", - unit: "unit", - }, - }, - }); + id: row.produceId, + name: "鎶ヨ〃" + } + }) }, // 琛ヨ揣 handleAddGoods(row) { - console.log(row); + console.log(row) }, // 浣嶇疆 handleLocation() { @@ -337,10 +319,10 @@ inStorage: item.inStorage, // 鍏ュ簱 toStore: item.toStore, // 鍑哄簱 forecast: item.forecast, //棰勬祴 - unit: item.unit, //鍗曚綅 - }; - this.testArr.push(obj); - }); + unit: item.unit //鍗曚綅 + } + this.testArr.push(obj) + }) }, //鎺ュ彛璇锋眰----------------------------------------------------------------------------------------------- @@ -354,9 +336,9 @@ } await getInventoryData(params).then((res) => { if (res.code === 200) { - const list = res.data; - this.tableList.tableInfomation = list || []; - this.pagerOptions.totalCount = res.total; + const list = res.data + this.tableList.tableInfomation = list || [] + this.pagerOptions.totalCount = res.total } }) }, @@ -365,7 +347,7 @@ await getProductCategoryList({ keyWord: "", page: this.pagerOptions.currPage, - pageSize: this.pagerOptions.pageSize, + pageSize: this.pagerOptions.pageSize }).then((res) => { if (res.code === 200) { this.categoryList = res.data @@ -377,10 +359,10 @@ await getWarehouseList({ keyword: "", page: this.pagerOptions.currPage, - pageSize: this.pagerOptions.pageSize, + pageSize: this.pagerOptions.pageSize }).then((res) => { if (res.data.code === 200) { - this.warehouseList = res.data.data; + this.warehouseList = res.data.data } }) } diff --git a/src/views/reportForm/locationReport/index.vue b/src/views/reportForm/locationReport/index.vue index e652ded..9a2d882 100644 --- a/src/views/reportForm/locationReport/index.vue +++ b/src/views/reportForm/locationReport/index.vue @@ -48,9 +48,9 @@ </template> <script> -import pageMixin from "@/components/makepager/pager/mixin/pageMixin"; -import { getLocationData } from "@/api/locationApi/locationApi"; -import AddOverviewDialog from "@/views/overview/AddOverviewDialog"; +import pageMixin from "@/components/makepager/pager/mixin/pageMixin" +import { getLocationData } from "@/api/locationApi/locationApi" +import AddOverviewDialog from "@/views/overview/AddOverviewDialog" export default { name: "InventoryReport", @@ -107,8 +107,8 @@ }, productId: this.$route.params.id, productName: this.$route.params.name, - metaTitle: this.$route.meta.title, - }; + metaTitle: this.$route.meta.title + } }, created() { this.setTable() @@ -165,14 +165,14 @@ prop: "amount", isShowColumn: true, default: true, - unit: "", + unit: "" }, { label: "棰勭暀鏁伴噺", prop: "availableStore", isShowColumn: true, default: true, - unit: "", + unit: "" }, { label: "鍗曚綅", @@ -187,10 +187,10 @@ width: 120, default: false, isShowColumn: showcol.includes("浠峰��"), - unit: "锟�", - }, - ]; - return tableColumn; + unit: "锟�" + } + ] + return tableColumn }, selTableCol(val) { this.showcol = val @@ -203,9 +203,9 @@ pageSize: this.pagerOptions.pageSize }).then((res) => { if (res.code === 200) { - const list = res.data; - this.tableList.tableInfomation = list || []; - this.pagerOptions.totalCount = res.total; + const list = res.data + this.tableList.tableInfomation = list || [] + this.pagerOptions.totalCount = res.total } }) }, @@ -223,9 +223,9 @@ }, // 鏂板缓 addBtnClick() { - this.editConfig.visible = true; - this.editConfig.title = "鏂板缓"; - this.getData(); + this.editConfig.visible = true + this.editConfig.title = "鏂板缓" + this.getData() }, // 鐘舵�� getStatus(val) { @@ -236,28 +236,10 @@ this.$router.push({ name: "inboundOutboundDetail", params: { - name: this.metaTitle, - pageName:"鎶ヨ〃", - product: { - page: this.pagerOptions.currPage, - pageSize: this.pagerOptions.pageSize, - produceId: row.produceId, - productName: row.productName, - unit: row.unit, - }, - paramsKey: { - amount: "amount", - productName:"productName", - status: "status", - contactedName: "contactedName", - date: "date", - fromLocation: "fromLocation", - number: "number", - toLocation: "toLocation", - unit: "unit", - }, - }, - }); + id: row.produceId, + name: "鎶ヨ〃" + } + }) }, // 琛ヨ揣 handleAddGoods() {} -- Gitblit v1.8.0