From 4e4339857a02878fef71b62cf17f39e1b6aa14ab Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期五, 29 十一月 2024 17:43:27 +0800 Subject: [PATCH] 加loading --- src/views/projectProcess/components/RunProcess.vue | 62 +++++++++++++++++------------- 1 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/views/projectProcess/components/RunProcess.vue b/src/views/projectProcess/components/RunProcess.vue index 24e17a8..7dbee95 100644 --- a/src/views/projectProcess/components/RunProcess.vue +++ b/src/views/projectProcess/components/RunProcess.vue @@ -10,7 +10,7 @@ <div> <div style="display: flex; flex-direction: row; justify-content: center; align-items: center;font-size: 24px"> <div>褰撳墠娴佺▼锛�</div> - <div v-if="nowProcessId">{{nowProcessName}}</div> + <div v-if="nowProcessDefId">{{selectProcessName}}</div> <div v-else>鏈粦瀹氭祦绋�</div> </div> </div> @@ -74,7 +74,7 @@ </el-table> </div> <span slot="footer" class="dialog-footer"> - <el-button type="danger" @click="startProcess">鍚姩</el-button> + <el-button type="danger" @click="startProcess" :disable="!this.selectProcessDefId">鍚姩娴佺▼</el-button> <el-button type="primary" @click="changeProcess">鍙樻洿</el-button> </span> </el-dialog> @@ -82,7 +82,7 @@ </template> <script> -import {projectSetProcess} from "@/api/projectProcess/projectProcess"; +import {projectSetProcess, startProcess} from "@/api/projectProcess/projectProcess"; export default { dicts: ['sys_project_type', 'sys_funding_type', 'sys_investment_type', 'sys_key_categories'], @@ -100,61 +100,67 @@ required: true, type: Array }, - nowProcessId: { // 褰撳墠椤圭洰缁戝畾鐨勬祦绋媔d - required: true, - type: String - }, - nowProcessName: { + nowProcessDefId: { // 褰撳墠椤圭洰缁戝畾鐨勬祦绋媔d required: true, type: String } }, watch: { // 鐩戝惉鍥炴樉鍊� - nowProcessId(newVal, oldVal) { - console.log("浼犲叆鍊硷細", newVal, this.processList) + projectInfo: { + handler(newVal, oldVal) { + console.log("浼犲叆鍊硷細", newVal, this.processList) + this.setSelect(this.nowProcessDefId) + }, + deep: true + } + }, + data() { + return { + selectProcessDefId: '', // 缁勪欢鍐呴儴閫変腑鐨勬祦绋媔d + selectProcessName: '', // 缁勪欢鍐呴儴閫変腑鐨勬祦绋媔d + } + }, + methods: { + setSelect(value) { + console.log("璋冪敤鍊硷細", value) this.processList.forEach((item,index) => { - console.log(item.id, newVal, item.id === newVal) - if(item.id === newVal){ - console.log("wwwwwww") - this.selectProcessId = newVal + console.log(item.id, value, item.id === value) + if(item.id === value){ + this.selectProcessName = item.name this.$nextTick(() => { this.$refs.myTable.toggleRowSelection(item); }) } }) - } - }, - data() { - return { - selectProcessId: '', // 缁勪欢鍐呴儴閫変腑鐨勬祦绋媔d - } - }, - methods: { + }, // 瀹炵幇el-table鍗曢�� handleSelectionChange(val) { console.log(val, "閫変腑") if (val.length > 1) { this.$refs.myTable.clearSelection(); - this.$refs.myTable.toggleRowSelection(val.pop()); + this.$refs.myTable.toggleRowSelection(val[val.length - 1]); } if(val.length != 0){ - this.selectProcessId = val[val.length - 1].id; + this.selectProcessDefId = val[val.length - 1].id; + console.log("閫変腑id锛�", this.selectProcessDefId) } }, // 鍚姩娴佺▼ startProcess() { - + startProcess(this.projectInfo.projectId, this.selectProcessDefId).then(res => { + this.$message.success(res.msg); + }) }, // 鍙樻洿娴佺▼ changeProcess() { - if (!this.selectProcessId) { + if (!this.selectProcessDefId) { this.$message.error("閫夊垯涓�涓祦绋嬪悗鎵嶈兘鍙樻洿") return } const data = { projectId: this.projectInfo.projectId, - flowableProcessId: this.selectProcessId + processDefId: this.selectProcessDefId } projectSetProcess(data).then(res => { this.$message.success("鍙樻洿鎴愬姛") @@ -162,6 +168,8 @@ }) }, handleClose() { + this.selectProcessDefId = "" + this.selectProcessName = "" this.$emit("close") } } -- Gitblit v1.8.0