From da8dcef599d67dcc66742e53a872b45ead53b1ea Mon Sep 17 00:00:00 2001 From: 叶松 <2217086471@qq.com> Date: 星期二, 10 十月 2023 16:36:56 +0800 Subject: [PATCH] Merge branch 'master' of http://111.30.93.211:10101/r/supipe --- web/src/views/ProjectManage/SectionManage.vue | 61 ++++++++++++++++-------------- 1 files changed, 33 insertions(+), 28 deletions(-) diff --git a/web/src/views/ProjectManage/SectionManage.vue b/web/src/views/ProjectManage/SectionManage.vue index f29dffd..09e277f 100644 --- a/web/src/views/ProjectManage/SectionManage.vue +++ b/web/src/views/ProjectManage/SectionManage.vue @@ -14,24 +14,17 @@ </el-select> </div> <div class="header_item"> - <el-button icon="el-icon-search" v-if="showButton('search')" @click="queryReset">查询</el-button> - <el-button class="search_btn" icon="el-icon-plus" v-if="showButton('insert')" @click="addRow">新增</el-button> + <el-button icon="el-icon-search" v-permission="'search'" @click="queryReset">查询</el-button> + <el-button class="search_btn" icon="el-icon-plus" v-permission="'insert'" @click="addRow">新增</el-button> </div> </div> <div class="main_content"> - <cpnTable :table-index="true" :table-data="dataList" :table-columns-config="tableColumns" :page-total="total" + <cpnTable :table-index="true" :table-data="dataList" :table-columns="tableColumns" :page-total="total" :page-num.sync="queryInfo.pageNum" :page-size.sync="queryInfo.pageSize" :page-change="pageChange"> - <el-table-column slot="finished" label="已完成(块)" align="center"> - <template #default="{ row }"> - <div style="cursor: pointer;" @click="showDetail(row)">{{ row.completedQuantity }}</div> - </template> - </el-table-column> - <el-table-column slot="action" label="操作" width="140" align="center"> - <template #default="{ row }"> - <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="updateRow(row)">修改</el-button> - <el-button class="delete_btn" size="mini" v-if="showButton('delete')" @click="deleteRow(row)">删除</el-button> - </template> - </el-table-column> + + <template #finished="{ row }"> + <div style="cursor: pointer;" @click="showDetail(row)">{{ row.completedQuantity }}</div> + </template> </cpnTable> </div> <!-- dialog --> @@ -105,7 +98,7 @@ </template> </div> </el-card> - <cpnTable :table-index="true" :table-data="detail.tableData" :table-columns-config="detail.tableColumns" + <cpnTable :table-index="true" :table-data="detail.tableData" :table-columns="detail.tableColumns" :page-total="detail.total" :page-num.sync="detail.pageNum" :page-size.sync="detail.pageSize" :page-change="detailPageChange"> </cpnTable> @@ -114,9 +107,8 @@ </template> <script> -import {buttonPinia} from '../../pinia/index'; import {throttle} from '../../plugins/public'; // 导入节流、动态切换组件尺寸方法 -import cpnTable from '@/components/table/Table' +import cpnTable from '@/components/element/Table' export default { data() { return { @@ -206,11 +198,11 @@ cpnTable }, computed: { - dialogTitle() { - return this.submitMode === 'update' ? '修改新增单位工程' : '新增单位工程' - }, isUpdate() { return this.submitMode === 'update' + }, + dialogTitle() { + return this.isUpdate ? '修改新增单位工程' : '新增单位工程' }, }, created() { @@ -222,6 +214,7 @@ // this.getAllBlocks() // 暂时没用,先屏蔽 }, methods: { + // 获取table列表数据 getLists() { this.loading = true let params = this.queryInfo @@ -282,6 +275,7 @@ } }) }, + // 已完成 table信息 getDetailLists() { let detailData = this.detail this.$api.DuctpiecePLM.searchDuctpiecePLMList({ @@ -295,6 +289,7 @@ } }) }, + // 已完成 title信息 getDetailInfos(id) { this.$api.Engineer.detailsProjects({proId: id}).then(res => { if (res.success) { @@ -302,6 +297,7 @@ } }) }, + // 初始化 ruleform setFormProps(options = {}) { let _form = { proId: '', // 项目名称id @@ -317,10 +313,11 @@ } this.ruleForm = Object.keys(options).length ? options : _form }, + // 初始化 table 配置 setTableColumn() { this.tableColumns = [ {index: true}, - {slot: "finished"}, + {slot: "finished", name: "已完成(块)"}, {name: "项目名称", key: "proName", width: 160}, {name: "起讫里程", key: "mileage"}, {name: "单位工程名称", key: "unitProjectName"}, @@ -330,11 +327,15 @@ {name: "工期", key: "duration"}, {name: "站点", key: "station"}, {name: "负责人", key: "realName"}, - {slot: 'action'}, + { + operation: true, name: "操作", width: 140, value: [ + {name: "修改", class: "table_btn", permission: "update", handleRow: this.updateRow}, + {name: "删除", class: "delete_btn", permission: "delete", handleRow: this.deleteRow}, + ] + }, ] this.detail.tableColumns = [ {index: true}, - {slot: "name"}, {name: "环号", key: "ringNum"}, {name: "管片编号", key: "pipeNum", width: 140}, {name: "转向", key: "turnName", width: 106}, @@ -350,13 +351,16 @@ {name: "质量标注", key: "checkResultStr"}, ] }, + // 重置表单 resetForm(formName) { this.$refs[formName].resetFields() }, + // 显示表单 showForm() { !this.isRender && (this.isRender = true) this.asyncVisible = true }, + // 隐藏表单 closeForm() { this.asyncVisible = false this.resetForm('ruleForm') @@ -368,10 +372,12 @@ this.queryInfo.pageSize = 10 this.getLists() }, + // 添加数据 addRow() { this.submitMode = 'add' this.showForm() }, + // 更新数据 async updateRow(row) { this.submitMode = 'update' this.showForm() @@ -384,6 +390,7 @@ this.ruleForm.segmentId = row.segmentId this.ruleForm.segmentList = segmentList }, + // 删除数据 deleteRow(row) { this.$confirm("该操作将删除该信息,是否继续删除?", "提示", { confirmButtonText: "确定", @@ -433,6 +440,7 @@ } }) }, + // 提交表单 onSubmit: throttle(function () { this.$refs.ruleForm.validate(valid => { if (!valid) return @@ -462,11 +470,6 @@ } }) }, 1000), - // 判断按钮权限信息 - showButton(str) { - const pinia = buttonPinia(); - return pinia.$state.buttonInfo.includes(str); - }, showDetail(row) { let detailData = this.detail !detailData.isRenderDetail && (detailData.isRenderDetail = true) @@ -478,9 +481,11 @@ this.getDetailInfos(row.proId) this.getDetailLists() }, + // 分页改变 pageChange() { this.getLists(); }, + // 已完成の分页改变 detailPageChange() { this.getDetailLists(); }, -- Gitblit v1.9.3