From ae7248eb618da8235068bc6a3ea2abbad44f4f07 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期四, 03 八月 2023 18:10:44 +0800 Subject: [PATCH] 主题库模板属性 流程 阶段样式优化 --- Source/UBCS-WEB/src/components/template/Stage.vue | 123 ++++++++++++++++++++--------------------- 1 files changed, 60 insertions(+), 63 deletions(-) diff --git a/Source/UBCS-WEB/src/components/template/Stage.vue b/Source/UBCS-WEB/src/components/template/Stage.vue index 0d92984..cce53f2 100644 --- a/Source/UBCS-WEB/src/components/template/Stage.vue +++ b/Source/UBCS-WEB/src/components/template/Stage.vue @@ -1,5 +1,5 @@ <template> - <el-dialog title="妯℃澘闃舵" width="90%" append-to-body="true" :visible.sync="dialogVisible"> + <div> <avue-crud ref="crud" :table-loading="loading" :data="data" :option="option" :page.sync="page" @on-load="getDataList" @size-change="handleSizePage" @current-change="handleCurrentPage" @row-click="handleRowClick"> @@ -8,7 +8,7 @@ @click="handleMaintenance(row, index)">缁存姢</el-button> </template> </avue-crud> - <el-dialog title="妯℃澘闃舵" width="50%" append-to-body="true" :visible.sync="dialogNode"> + <el-dialog title="妯℃澘闃舵" width="50%" append-to-body="true" :visible.sync="dialogNode"> <avue-crud ref="crud" :table-loading="loading" :data="stageData" :option="stageOption" @on-load="getStagelist" @row-click="handleRowStageClick"> <template slot-scope="{type,size,row,index}" slot="menu"> @@ -17,9 +17,9 @@ </template> </avue-crud> </el-dialog> - <table-transfer :visible.sync="dialogTransfer" v-model="listVal" :dataList="tableData" :columns="columns" - keyName="oid" @save="handleSave"></table-transfer> - </el-dialog> + <table-transfer v-if="flag" :visible.sync="dialogTransfer" v-model="attributeValue" :dataList="attributeData" + :columns="columns" keyName="oid" @save="handleSave" @close="handelClose"></table-transfer> + </div> </template> <script> @@ -31,11 +31,6 @@ TableTransfer }, props: { - // 鏄惁鎵撳紑 - visible: { - typeof: Boolean, - default: false - }, code: { typeof: String, required: true, @@ -43,25 +38,11 @@ } }, watch: { - visible(n) { - this.dialogVisible = n; - }, - dialogVisible(n) { - this.$emit('update:visible', n) - }, - }, - computed: { - tableData() { - return this.setTable() - }, - listVal() { - let data = this.setTable() - let newdata = data.map(item => { - return item.checked ? item.oid : undefined - }) - console.log(newdata.filter(item => item)) - return newdata.filter(item => item) + code: { + handler(newval, oldval) { + this.getDataList() } + } }, data() { const options = { @@ -81,9 +62,9 @@ editBtn: false, } return { - list: [], - listRight: [], - dialogVisible: this.visible, + attributeData: [], + attributeValue: [], + flag: false, dialogTransfer: false, dialogNode: false, visibleTable: false, @@ -121,6 +102,7 @@ ], option: { ...options, + height: 383, column: [ { label: '妯℃澘缂栧彿', prop: 'modelKey' }, { label: '妯℃澘鍚嶇О', prop: 'modelName' }, @@ -129,6 +111,7 @@ }, stageOption: { ...options, + height:620, column: [ { label: '闃舵缂栧彿', prop: 'taskId' }, { label: '闃舵鍚嶇О', prop: 'taskName' }, @@ -136,14 +119,11 @@ }, } }, - mounted() { - this.getAttributeList() - }, methods: { - setTable() { - return this.list.map(item => { - if (this.listRight.length !== 0) { - this.listRight.forEach(element => { + setTable(data, list) { + return data.map(item => { + if (list.length !== 0) { + list.forEach(element => { if (item.id === element.attrId) item.checked = true }); } @@ -152,17 +132,19 @@ }, // 鑾峰彇鍒楄〃 async getDataList() { - this.loading = false - const { pageSize, currentPage } = this.page - let param = { size: pageSize, current: currentPage } - const response = await getFlowpathList({ ...param, ...{ templateId: this.code } }) + this.loading = false + if (this.code) { + const {pageSize, currentPage} = this.page + let param = {size: pageSize, current: currentPage} + const response = await getFlowpathList({...param, ...{templateId: this.code}}) if (response.status === 200) { - console.log(response) - this.loading = false - const data = response.data.data - this.data = data.records - this.page.total = data.total + console.log(response) + this.loading = false + const data = response.data.data + this.data = data.records + this.page.total = data.total } else this.loading = false + } }, // 鑾峰彇闃舵鍒楄〃 async getStagelist() { @@ -178,12 +160,23 @@ // 鑾峰彇鍏ㄩ儴灞炴�� async getAttributeList() { const response = await attributeList({ 'conditionMap[classifyTemplateOid]': this.code }) - if (response.status === 200) { - const data = response.data.data - this.list = data.records.map(item => { + const responseRight = await attributeListRight({ templateId: this.code, modelKey: this.modelKey, taskId: this.saveParam.taskId }) + if (response.status === 200 && responseRight.status === 200) { + let datas = response.data.data.records + let dataRight = responseRight.data.data + datas = datas.map(item => { const { oid, id, name, attributeGroup } = item - return { oid, id, name, attributeGroup, ...{ checked: false } } + item = { oid, id, name, attributeGroup, ...{ checked: false } } + if (dataRight.length !== 0) { + dataRight.forEach(element => { if (item.id === element.attrId) item.checked = true }); + } + return item }) + console.log(datas) + let dataValue = datas.map(item => item.checked ? item.oid : undefined) + this.attributeValue = dataValue.filter(item => item) + this.attributeData = datas + this.flag = true } }, // 鑾峰彇宸蹭繚瀛樺睘鎬� @@ -202,20 +195,18 @@ handleMaintenance(row) { console.log(row) this.dialogNode = true + this.modelKey = row.modelKey this.saveParam.modelKey = row.modelKey + this.getStagelist() }, + // 缁存姢 handleMaintenanceTransfer(row) { - console.log(row) - this.dialogTransfer = true this.saveParam.taskId = row.taskId this.saveParam.taskName = row.taskName - this.getAttributeListRight() - }, - handleSizePage(event) { - this.page.pageSize = event - }, - handleCurrentPage(event) { - this.page.currentPage = event + this.getAttributeList() + this.$nextTick(() => { + this.dialogTransfer = true + }) }, handleRowClick(row) { console.log(row) @@ -224,10 +215,12 @@ this.dialogNode = true }, handleRowStageClick(row) { - this.dialogTransfer = true this.saveParam.taskId = row.taskId this.saveParam.taskName = row.taskName - this.getAttributeListRight() + this.getAttributeList() + this.$nextTick(() => { + this.dialogTransfer = true + }) }, async handleSave(event) { console.log(event) @@ -250,10 +243,14 @@ type: 'success', message: '鏂板鏁版嵁鎴愬姛锛�' }) + this.flag = false // done() // this.getDataList() } + }, + handelClose() { + this.flag = false } } } -</script> \ No newline at end of file +</script> -- Gitblit v1.9.3