From 4c873da777ea0c6ce0d342ce793fabae89b3f66d Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期四, 24 八月 2023 19:29:00 +0800 Subject: [PATCH] 供应商和产品管理 --- src/components/makepager/CommonFormTableView.vue | 100 +++---------------------------------------------- 1 files changed, 7 insertions(+), 93 deletions(-) diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue index 55fee16..aa3b08e 100644 --- a/src/components/makepager/CommonFormTableView.vue +++ b/src/components/makepager/CommonFormTableView.vue @@ -1,13 +1,8 @@ <template> <div class="page-view"> <el-form ref="form" :model="tableList" :show-message="false" label-position="right"> - <el-table - :data="tableList.tableData" - :show-summary="showSummary.show" - :summary-method="getSummaries" - :span-method="arraySpanMethod" - style="width: 100%" - > + <el-table :data="tableList.tableData" style="width: 100%"> + <el-table-column type="index" label="缂栧彿" width="50" align="center"></el-table-column> <el-table-column v-for="(item, i) in tableList.tableColumn" :key="i" @@ -127,25 +122,9 @@ </el-form> <div v-if="!detailEnter" style="margin: 10px"> <el-button size="small" type="primary" @click="add">鏂板</el-button> - <!-- <el-button size="small" type="primary" disabled>瀵煎叆鏄庣粏</el-button> --> <el-button size="small" type="primary" @click="empty">娓呯┖</el-button> - <el-button size="small" type="primary" @click="recalculate" :disabled="isRecalculate ? false : true" - >閲嶇畻</el-button - > </div> - <div v-if="showSummary.total || showSummary.refundable" style="height: 42px; line-height: 42px"> - <el-row :gutter="10"> - <el-col v-if="showSummary.total" :span="2" :offset="22"> - <span style="font-weight: bold">鍚堣</span> - <span style="margin-left: 10px">{{ total }}</span> - </el-col> - <el-col v-if="showSummary.refundable" :span="2" :offset="22"> - <span style="font-weight: bold">搴旈��娆�</span> - <span style="margin-left: 10px">0.00</span> - </el-col> - </el-row> - </div> - <!-- 鍚堝悓璁㈠崟 --> + <!-- 浜у搧鍚嶇О --> <SelectCommonDialog v-if="editSelCommonConfig.editVisible" :edit-common-config="editSelCommonConfig" @@ -237,60 +216,6 @@ handleSelectionChange(val) { this.$emit("getSelectArray", val) }, - // 琛屽悎骞� - arraySpanMethod() { - if (this.showSummary.show) { - this.$nextTick(() => { - if (this.$refs.table) { - var current = this.$refs.table.querySelector(".el-table__footer-wrapper").querySelector(".el-table__footer") - var cell = current.rows[0].cells - for (let i = 0; i < this.showSummary.mergeNumber; i++) { - cell[i].style.display = "none" - } - cell[this.showSummary.mergeNumber].classList.remove("is-left") - cell[this.showSummary.mergeNumber].colSpan = this.showSummary.mergeNumber.toString() - } - }) - } - }, - // 鍚堣 - getSummaries(param) { - const { columns, data } = param - const sums = [] - columns.forEach((column, index) => { - // // 鏇存敼琛屽悕绉� - if (index === this.showSummary.mergeNumber) { - sums[index] = "灏忚:" - return - } - const title = ["#", "浜у搧鍚嶇О"] - // 鍘婚櫎鏌愪簺涓嶉渶瑕佽绠楃殑鏁版嵁 - if (title.includes(column.label)) { - sums[index] = "" - return - } - // 鎶婂綋鍓嶈〃鏍兼暟鎹腑鍚屼釜鍒嗙被鐨勬暟鎹敹闆嗚捣鏉� - const values = data.map((item) => Number(item[column.property])) - // 杩囨护鎺� - if (!values.every((value) => Number.isNaN(value))) { - sums[index] = ` ${values.reduce((prev, curr) => { - const value = Number(curr) - if (!Number.isNaN(value)) { - const num = prev + curr - return Number(num.toFixed(2)) - } else { - return Number(prev.toFixed(2)) - } - }, 0)}` - } else { - sums[index] = "" - } - if (column.property === "total") { - this.total = sums[index] - } - }) - return sums - }, // 鏁板瓧鎹㈣涓洪噾棰濇樉绀烘牸寮� number_format(number, decimals, dec_point, thousands_sep) { decimals = 2 //杩欓噷榛樿璁剧疆淇濈暀涓や綅灏忔暟锛屼篃鍙互娉ㄩ噴杩欏彞閲囩敤浼犲叆鐨勫弬鏁� @@ -332,21 +257,6 @@ empty() { this.isRecalculate = false this.$emit("emptyProductClick") - }, - // 閲嶇畻 - recalculate() { - this.$confirm("纭畾瑕侀噸绠楁槑缁嗘墍鏈夎?", "鎻愮ず", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }) - .then(() => { - this.$emit("recalculateProductClick") - this.tableList.tableData.map((ite) => { - ite.total = ite.amount ? ite.amount * ite.price : 1 * ite.price - }) - }) - .catch(() => {}) }, // 閫夋嫨浜у搧鍚嶇О鐩稿叧鏂规硶 querySearchAsync(queryString, cb) { @@ -406,6 +316,10 @@ } }) this.$emit("clearupProduct", this.tableList.tableData) + }, + // 鍒犻櫎 + deleteClient(row) { + this.$emit("deleteProduct", row) } } } -- Gitblit v1.8.0