From 14112fc388266e62ff6028d0a6329a61fdebf77c Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 21 一月 2025 03:47:55 +0800
Subject: [PATCH] 工程建设项目全生命周期推荐流程

---
 src/views/projectProcess/components/RunProcess.vue |  135 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 106 insertions(+), 29 deletions(-)

diff --git a/src/views/projectProcess/components/RunProcess.vue b/src/views/projectProcess/components/RunProcess.vue
index 6bfaa28..4331c69 100644
--- a/src/views/projectProcess/components/RunProcess.vue
+++ b/src/views/projectProcess/components/RunProcess.vue
@@ -1,14 +1,16 @@
 <template>
   <div>
     <el-dialog
-      title="娴佺▼鍚姩"
+      :title="`娴佺▼鍚姩锛歚 + projectInfo.projectName"
       :visible.sync="show"
-      width="750px"
+      width="950px"
+      :destroy-on-close="true"
+      :close-on-click-modal="false"
       :before-close="handleClose">
       <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}}<span v-if="nowProcessInsId" style="color: red">锛堣繍琛屼腑锛�</span></div>
           <div v-else>鏈粦瀹氭祦绋�</div>
         </div>
       </div>
@@ -29,83 +31,158 @@
           >
           </el-table-column>
           <el-table-column
+            prop="version"
+            label="娴佺▼鐗堟湰"
+          >
+          </el-table-column>
+          <el-table-column
             prop="category"
             label="娴佺▼绫诲瀷"
           >
           </el-table-column>
+          <el-table-column label="椤圭洰绫诲瀷" >
+            <template slot-scope="scope">
+              <dict-tag
+                :options="dict.type.sys_project_type"
+                :value="scope.row.projectType"
+              >
+              </dict-tag>
+            </template>
+          </el-table-column>
+          <el-table-column label="璧勯噾绫诲瀷" >
+            <template slot-scope="scope">
+              <dict-tag
+                :options="dict.type.sys_funding_type"
+                :value="scope.row.fundType"
+              >
+              </dict-tag>
+            </template>
+          </el-table-column>
+          <el-table-column label="鎶曡祫绫诲埆" >
+            <template slot-scope="scope">
+              <dict-tag
+                :options="dict.type.sys_investment_type"
+                :value="scope.row.investType"
+              >
+              </dict-tag>
+            </template>
+          </el-table-column>
+          <el-table-column label="閲嶇偣鍒嗙被" >
+            <template slot-scope="scope">
+              <dict-tag
+                :options="dict.type.sys_key_categories"
+                :value="scope.row.importanceType"
+              >
+              </dict-tag>
+            </template>
+          </el-table-column>
         </el-table>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="startProcess">鍚姩</el-button>
-        <el-button type="primary" @click="changeProcess">鍙樻洿</el-button>
+        <el-button type="danger" @click="startProcess" :disabled="(nowProcessInsId !== '') || (selectProcessDefId === '')">鍚姩娴佺▼</el-button>
+        <el-button type="primary" @click="changeProcess" :disabled="((nowProcessDefId === selectProcessDefId) && nowProcessInsId !== '') || selectProcessDefId === '' || nowProcessInsId === ''">娴佺▼鍙樻洿</el-button>
       </span>
     </el-dialog>
   </div>
 </template>
 
 <script>
+import {projectSetProcess, startProcess} from "@/api/projectProcess/projectProcess";
+
 export default {
+  dicts: ['sys_project_type', 'sys_funding_type', 'sys_investment_type', 'sys_key_categories'],
   name: "RunProcess",
   props: {
     show: {
-      require: true,
+      required: true,
       type: Boolean
     },
-    projectId: {
-      require: true,  // 椤圭洰id
-      type: Number
+    projectInfo: {
+      required: true,  // 椤圭洰id銆佸悕绉�
+      type: Object
     },
     processList: {  // 娴佺▼鍒楄〃
-      require: true,
+      required: true,
       type: Array
     },
-    nowProcessId: {  // 褰撳墠椤圭洰缁戝畾鐨勬祦绋媔d
-      require: true,
+    nowProcessDefId: {  // 褰撳墠椤圭洰缁戝畾鐨勫畾涔塱d
+      required: true,
       type: String
     },
-    nowProcessName: {
-      require: true,
+    nowProcessInsId: {  // 褰撳墠椤圭洰缁戝畾鐨勫疄渚媔d
+      required: true,
       type: String
-    }
+    },
   },
   watch: {
     // 鐩戝惉鍥炴樉鍊�
-    nowProcessId(newVal, oldVal) {
+    projectInfo: {
+      handler(newVal, oldVal) {
+        console.log("浼犲叆鍊硷細", newVal, this.processList)
+        this.setSelect(this.nowProcessDefId)
+      },
+      deep: true
+    }
+  },
+  data() {
+    return {
+      selectProcessDefId: '',  // 缁勪欢鍐呴儴閫変腑鐨勬祦绋媔d
+      selectProcessName: '',  // 缁勪欢鍐呴儴閫変腑鐨勬祦绋媔d
+    }
+  },
+  created() {
+    console.log(this.nowProcessInsId, typeof this.nowProcessInsId, "wwwww")
+  },
+  methods: {
+    setSelect(value) {
+      console.log("璋冪敤鍊硷細", value)
       this.processList.forEach((item,index) => {
-        if(item.id == 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);
+        this.handleClose()
+      })
     },
     // 鍙樻洿娴佺▼
     changeProcess() {
-
+      if (!this.selectProcessDefId) {
+        this.$message.error("閫夊垯涓�涓祦绋嬪悗鎵嶈兘鍙樻洿")
+        return
+      }
+      const data = {
+        projectId: this.projectInfo.projectId,
+        processDefId: this.selectProcessDefId
+      }
+      projectSetProcess(data).then(res => {
+        this.$message.success("鍙樻洿鎴愬姛")
+        this.handleClose()
+      })
     },
     handleClose() {
+      this.selectProcessDefId = ""
+      this.selectProcessName = ""
       this.$emit("close")
     }
   }

--
Gitblit v1.8.0