From 22f9e1efd4c77a2c665d2e3e2c84c25e6ae775d4 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期四, 21 十二月 2023 17:07:01 +0800 Subject: [PATCH] 销售明细单 销售机会,销售报价单根据接口获取的配置判断是否必填的功能+按钮禁止点击的样式修改 --- src/components/makepager/CommonFormTableView.vue | 95 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 89 insertions(+), 6 deletions(-) diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue index fbdc6fe..70fbd58 100644 --- a/src/components/makepager/CommonFormTableView.vue +++ b/src/components/makepager/CommonFormTableView.vue @@ -2,12 +2,17 @@ <div class="page-view"> <el-form ref="form" :model="tableList" :show-message="false" label-position="right"> <el-table + ref="fromTable" :data="tableList.tableData" :show-summary="showSummary.show" :summary-method="getSummaries" :span-method="arraySpanMethod" style="width: 100%" + @selection-change="handleSelectionChange" + :row-key="(row) => row.productId" > + <el-table-column v-if="selectBox" type="selection" :reserve-selection="true" width="40" align="center"> + </el-table-column> <el-table-column v-if="tableList.isReturn" type="index" label="#" width="50" align="center"></el-table-column> <el-table-column v-for="(item, i) in tableList.tableColumn" @@ -123,11 +128,51 @@ " ></el-input-number> </el-form-item> - <span v-else>{{ scope.row[item.prop] }}</span> + <span v-else> + <template v-if="pageName=='quotation'&&item.prop=='profit'"> + {{ (scope.row.price&&scope.row.cost)?Number(scope.row.price)-Number(scope.row.cost)+'':'' }} + </template> + <template v-if="pageName=='quotation'&&item.prop=='margin'"> + {{ (scope.row.price&&scope.row.cost)?((Number(scope.row.price)-Number(scope.row.cost))*100/Number(scope.row.cost)).toFixed(2)+'%':'' }} + </template> + <template v-else> + {{ scope.row[item.prop] }} + </template> + </span> </template> + <el-form-item + v-else-if="item.inputNumber && selectBox" + label=" " + :prop="'tableData.' + scope.$index + '.' + item.prop" + :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" + > + <el-input-number + v-model="scope.row[item.prop]" + placeholder="" + :min="0" + :controls="false" + size="mini" + style="width: 100%; margin-right: 5px" + @change=" + (val) => { + commonInputChange(val, item.prop, scope.row) + } + " + ></el-input-number> + </el-form-item> <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span> </template> </el-table-column> + <el-table-column label="鎿嶄綔" width="40" align="center"> + <template slot-scope="scope"> + <el-button + type="text" + size="small" + @click="deleteClick(scope)" + >鍒犻櫎</el-button> + </template> + </el-table-column> + <slot name="tableButton" /> </el-table> </el-form> <div v-if="!detailEnter" style="margin: 10px"> @@ -138,7 +183,7 @@ >閲嶇畻</el-button > </div> - <div v-if="false && (showSummary.total || showSummary.refundable)" style="height: 42px; line-height: 42px" > + <div v-if="false && (showSummary.total || showSummary.refundable)" style="height: 42px; line-height: 42px"> <el-row :gutter="10"> <el-col v-if="showSummary.total" :span="3" :offset="21"> <span style="font-weight: bold">鍚堣</span> @@ -169,6 +214,15 @@ detailEnter: { type: Boolean, default: false + }, + selectBox: { + type: Boolean, + default: false + }, + // 閭d釜椤甸潰 鐢ㄦ潵鍒ゆ柇璁$畻鏂瑰紡 + pageName:{ + type:String, + default:'' }, productTableList: { type: Object, @@ -211,7 +265,9 @@ } }, created() { - this.getProductList() + if (!this.selectBox) { + this.getProductList() + } this.tableList = this.productTableList if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") { this.isRecalculate = false @@ -227,9 +283,9 @@ productName: "", productNumber: "", page: 1, - pageSize: 5 + pageSize: 100 }).then((res) => { - console.log(res,"浜у搧鍚嶇О") + console.log(res, "浜у搧鍚嶇О") if (res.code === 200) { if (res.data.data && res.data.data.length > 0) { this.productList = res.data.data @@ -240,6 +296,7 @@ handleReserve(row) { return row._id ? row._id : row.id }, + // 澶氶�� handleSelectionChange(val) { this.$emit("getSelectArray", val) }, @@ -269,9 +326,13 @@ sums[index] = "灏忚:" return } - const title = ["#", "浜у搧鍚嶇О"] + const title = ["#", "浜у搧鍚嶇О",'浜у搧缂栧彿','鍗曚綅','閿�鍞崟浠�','鎴愭湰鍗曚环'] // 鍘婚櫎鏌愪簺涓嶉渶瑕佽绠楃殑鏁版嵁 if (title.includes(column.label)) { + sums[index] = "" + return + } + if(this.pageName=='quotation'&&column.label=='姣涘埄'){ sums[index] = "" return } @@ -346,6 +407,13 @@ this.isRecalculate = false this.$emit("emptyProductClick") }, + // 鍒犻櫎 + deleteClick(scope){ + this.tableList.tableData.splice(scope.$index,1) + this.$forceUpdate(); + this.$message.success('鍒犻櫎闄ゆ垚鍔燂紒') + this.$emit("deleteClick",scope) + }, // 閲嶇畻 recalculate() { this.$confirm("纭畾瑕侀噸绠楁槑缁嗘墍鏈夎?", "鎻愮ず", { @@ -382,6 +450,7 @@ ite.number = item.number ite.price = item.price ite.total = item.amount ? item.amount * item.price : 1 * item.price + ite.unit = item.unit } }) }, @@ -403,6 +472,7 @@ ite.number = item.number ite.price = item.price ite.total = item.amount ? item.amount * item.price : 1 * item.price + ite.unit = item.unit } }) }, @@ -416,10 +486,22 @@ ite.number = "" ite.price = 0 ite.total = 0 + ite.unit = "" } }) this.$emit("clearupProduct", this.tableList.tableData) } + // 澶氶�夎缃凡閫変腑 + // toggleSelection(rows) { + // console.log("88888888888888888888888888888888888888888") + // console.log(rows) + // if (rows) { + // rows.forEach((row) => { + // this.$refs.fromTable.toggleRowSelection(row, true) + // console.log(row) + // }) + // } + // } } } </script> @@ -427,6 +509,7 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> .page-view { + .el-form-item { margin-bottom: 0; .custom-name { -- Gitblit v1.8.0