From ef48e4b7a4d34e63ffd2cb23c406f4da6eb72ed7 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期二, 14 五月 2024 13:42:26 +0800 Subject: [PATCH] 优化消息管理,标准库管理 --- src/components/view/b2-standard.vue | 94 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 81 insertions(+), 13 deletions(-) diff --git a/src/components/view/b2-standard.vue b/src/components/view/b2-standard.vue index 755a9c9..76219ef 100644 --- a/src/components/view/b2-standard.vue +++ b/src/components/view/b2-standard.vue @@ -58,7 +58,7 @@ } .product_table .el-table { - height: 100%; + height: calc(100% - 35px) !important; } .sort { @@ -161,8 +161,9 @@ </el-table> </el-row> <el-row class="product_table" v-loading="tableLoad2"> - <el-table :data="productList" ref="productTable" style="width: 100%;" height="100%" tooltip-effect="dark" stripe - :fit="true" border @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" + <el-table :data="pagedData" ref="productTable" style="width: 100%;" height="100%" tooltip-effect="dark" stripe + :fit="true" border + @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" @select="upProductSelect" @select-all="handleAll"> <el-table-column type="selection" width="65"> </el-table-column> @@ -216,6 +217,14 @@ </template> </el-table-column> <el-table-column prop="manHourGroup" label="宸ユ椂鍒嗙粍" width="100" show-overflow-tooltip></el-table-column> + <el-table-column prop="templateId" label="妯℃澘" width="200"> + <template slot-scope="scope"> + <el-select v-model="scope.row.templateId" size="small" filterable + @change="(value)=>upStandardProductListOfTemplate(value,scope.row.id)"> + <el-option v-for="(a, ai) in templateList" :key="ai" :label="a.name" :value="a.id"></el-option> + </el-select> + </template> + </el-table-column> <el-table-column prop="section" label="鍖洪棿" width="120" show-overflow-tooltip></el-table-column> <el-table-column prop="section" label="鎿嶄綔" width="120"> <template slot-scope="scope"> @@ -223,6 +232,14 @@ </template> </el-table-column> </el-table> + <el-pagination + style="position: absolute;right: 16px;bottom: 1px;" + @current-change="handleCurrentChange" + :current-page="currentPage" + :page-size="pageSize" + layout="total, prev, pager, next, jumper" + :total="total"> + </el-pagination> </el-row> </div> <el-dialog title="鍒嗙被娣诲姞" :visible.sync="addDia" width="400px"> @@ -419,7 +436,30 @@ sectionUpDia: false, sectionLoad: false, sectionRow: null, - sectionList: [] + sectionList: [], + templateList: [], + total:0, + pageSize:100, + currentPage:1, + } + }, + computed: { + pagedData() { + const start = (this.currentPage - 1) * this.pageSize; + const end = start + this.pageSize; + return this.productList.slice(start, end); + }, + }, + watch:{ + pagedData:{ + deep:true, + handler(val){ + setTimeout(() => { + val.forEach(a => { + if (a.state == 1) this.toggleSelection(a) + }) + }, 300) + } } }, mounted() { @@ -436,6 +476,7 @@ this.selectEnumByCategoryForSpecial() this.selectEnumByCategoryForInspectionValueType() this.selectEnumByCategoryForSonLaboratory() + this.getStandardTemplate() }, methods: { filterNode(value, data) { @@ -810,6 +851,22 @@ // this.$message.success('宸蹭繚瀛�') }) }, + upStandardProductListOfTemplate(value, index) { + this.$axios.post(this.$api.standardTree.upStandardProductList, { + id: index, + templateId: value + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code == 201) { + this.$message.error('鏈繚瀛�') + return + } + // this.$message.success('宸蹭繚瀛�') + }) + }, delStandardMethodByFLSSM(id) { this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", { confirmButtonText: "纭畾", @@ -886,11 +943,12 @@ tree: this.selectTree }).then(res => { this.productList = res.data - setTimeout(() => { - this.productList.forEach(a => { - if (a.state == 1) this.toggleSelection(a) - }) - }, 300) + this.total = this.productList.length; + // setTimeout(() => { + // this.productList.forEach(a => { + // if (a.state == 1) this.toggleSelection(a) + // }) + // }, 300) this.tableLoad2 = false }) }, @@ -907,7 +965,7 @@ return ''; }, upProductSelect(selection, row) { - row.state = row.state == 1 ? 0 : 1 + row.state = (row.state == 1 ? 0 : 1) this.$axios.post(this.$api.standardTree.upStandardProductList, { id: row.id, state: row.state @@ -929,12 +987,14 @@ }, handleAll(e) { if (e.length > 0) { - this.productList.map(m => { + this.productList = this.productList.map(m => { + m.state = 0 this.upProductSelect(null, m) return m }) } else { - this.productList.map(m => { + this.productList = this.productList.map(m => { + m.state = 1 this.upProductSelect(null, m) return m }) @@ -1005,7 +1065,15 @@ this.$message.success('宸蹭繚瀛�') this.sectionUpDia = false }) - } + }, + getStandardTemplate() { + this.$axios.get(this.$api.StandardTemplate.getStandardTemplate).then(res => { + this.templateList = res.data + }) + }, + handleCurrentChange(val) { + this.currentPage = val; + }, } } </script> -- Gitblit v1.9.3