From 79b0a1a4f81ec7750e6deeb02bc9865785b6fee9 Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期四, 17 八月 2023 19:52:46 +0800 Subject: [PATCH] bug修复 --- src/components/makepager/CommonFormTableView.vue | 105 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 72 insertions(+), 33 deletions(-) diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue index c8ce837..128caa4 100644 --- a/src/components/makepager/CommonFormTableView.vue +++ b/src/components/makepager/CommonFormTableView.vue @@ -15,7 +15,7 @@ :label="item.label" :width="item.width" :min-width="item.min" - align="right" + align="center" > <!-- 琛ㄥご鏍峰紡 --> <template slot="header"> @@ -24,40 +24,52 @@ </template> <!-- column鏍峰紡 --> <template slot-scope="scope"> - <el-form-item - v-if="item.input" - label=" " - :prop="'tableData.' + scope.$index + '.' + item.prop" - :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" - > - <el-input v-model.trim="scope.row[item.prop]" maxlength="50" size="mini"></el-input> - </el-form-item> - <el-form-item - v-else-if="item.date" - label=" " - :prop="'tableData.' + scope.$index + '.' + item.prop" - :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" - > - <!-- <el-input v-model.trim="scope.row[item.prop]" maxlength="50" size="mini"></el-input> --> - <el-date-picker v-model="scope.row[item.prop]" type="date" size="mini" style="width: 110px"> - </el-date-picker> - </el-form-item> + <template v-if="!detailEnter"> + <el-form-item + v-if="item.input" + label=" " + :prop="'tableData.' + scope.$index + '.' + item.prop" + :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" + > + <el-input + v-model.trim="scope.row[item.prop]" + maxlength="50" + size="mini" + @change=" + (val) => { + commonInputChange(val, item.prop, scope.row) + } + " + ></el-input> + </el-form-item> + <el-form-item + v-else-if="item.date" + label=" " + :prop="'tableData.' + scope.$index + '.' + item.prop" + :rules="[{ required: item.isRequird ? true : false, message: '杈撳叆涓嶈兘涓虹┖' }]" + > + <!-- <el-input v-model.trim="scope.row[item.prop]" maxlength="50" size="mini"></el-input> --> + <el-date-picker v-model="scope.row[item.prop]" type="date" size="mini" style="width: 110px"> + </el-date-picker> + </el-form-item> + <span v-else>{{ scope.row[item.prop] }}</span> + </template> <span v-else>{{ scope.row[item.prop] }}</span> </template> </el-table-column> </el-table> </el-form> - <div style="margin: 10px"> - <el-button size="small" type="primary">鏂板</el-button> - <el-button size="small" type="primary">瀵煎叆鏄庣粏</el-button> - <el-button size="small" type="primary">娓呯┖</el-button> - <el-button size="small" type="primary">閲嶇畻</el-button> + <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">閲嶇畻</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">0.00</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> @@ -72,6 +84,10 @@ export default { name: "CommmonFormTableView", props: { + detailEnter: { + type: Boolean, + default: false + }, productTableList: { type: Object, default: () => { @@ -98,16 +114,11 @@ } }, data() { - return {} - }, - computed: { - maxHeight() { - if (this.productTableList.height) { - return `calc(100vh - ${this.productTableList.height})` - } - return undefined + return { + total: 0 } }, + computed: {}, methods: { handleReserve(row) { return row._id ? row._id : row.id @@ -151,6 +162,9 @@ return this.number_format(prev, 2, ".", ",") } }, 0) + if (column.property === "total") { + this.total = sums[index] + } sums[index] } }) @@ -184,6 +198,31 @@ s[1] = s[1].substring(0, prec) //灏忔暟鐐逛綅鏁拌秴鍑洪暱搴︽椂鎴彇鍓嶉潰鐨勪綅鏁� } return s.join(dec) + }, + // 鏂板 + add() { + this.$emit("addProductClick") + }, + commonInputChange(val, prop, row) { + console.log(val, prop) + console.log(row) + this.$emit("inputContent", val, prop, row) + }, + // 娓呯┖ + empty() { + this.$emit("emptyProductClick") + }, + // 閲嶇畻 + recalculate() { + this.$confirm("纭畾瑕侀噸绠楁槑缁嗘墍鏈夎?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + this.$emit("recalculateProductClick") + }) + .catch(() => {}) } } } -- Gitblit v1.8.0