From 8c9f4f20341274df1c2326a1ce7fbc59770afc65 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期日, 02 三月 2025 23:45:41 +0800
Subject: [PATCH] Merge branch 'dev'

---
 src/views/engineering/index.vue |  208 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 168 insertions(+), 40 deletions(-)

diff --git a/src/views/engineering/index.vue b/src/views/engineering/index.vue
index 3dfc4a5..de2f87c 100644
--- a/src/views/engineering/index.vue
+++ b/src/views/engineering/index.vue
@@ -58,45 +58,54 @@
           v-hasPermi="['code:engineering:add']"
         >鏂板</el-button>
       </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['code:engineering:edit']"
-        >淇敼</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="deleteByIds"
-          v-hasPermi="['code:engineering:remove']"
-        >鍒犻櫎</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['code:engineering:export']"
-        >瀵煎嚭</el-button>
-      </el-col>
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="success"-->
+<!--          plain-->
+<!--          icon="el-icon-edit"-->
+<!--          size="mini"-->
+<!--          :disabled="single"-->
+<!--          @click="handleUpdate"-->
+<!--          v-hasPermi="['code:engineering:edit']"-->
+<!--        >淇敼</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="danger"-->
+<!--          plain-->
+<!--          icon="el-icon-delete"-->
+<!--          size="mini"-->
+<!--          :disabled="multiple"-->
+<!--          @click="deleteByIds"-->
+<!--          v-hasPermi="['code:engineering:remove']"-->
+<!--        >鍒犻櫎</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          plain-->
+<!--          icon="el-icon-download"-->
+<!--          size="mini"-->
+<!--          @click="handleExport"-->
+<!--          v-hasPermi="['code:engineering:export']"-->
+<!--        >瀵煎嚭</el-button>-->
+<!--      </el-col>-->
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="engineeringList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="宸ョ▼鍚嶇О" align="center" prop="projectName" />
-      <el-table-column label="涓婚」鐩悕绉�" align="center" prop="projectInfoName" />
+    <el-table
+      ref="elTable"
+      v-loading="loading"
+      style="margin-top: 20px"
+      :data="engineeringList"
+      height="100%"
+      sortable="custom"
+      row-key="id"
+      border
+      default-expand-all
+      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+      :show-overflow-tooltip="true">
+      <el-table-column label="椤圭洰鍚嶇О" align="center" prop="projectName" />
       <el-table-column label="椤圭洰鎺ㄨ繘绫诲瀷" align="center" prop="projectType">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.sys_project_type" :value="scope.row.projectType"/>
@@ -108,21 +117,35 @@
           <dict-tag :options="dict.type.sys_project_status" :value="scope.row.status"/>
         </template>
       </el-table-column>
+      <el-table-column label="涓荤閮ㄩ棬" align="center" prop="departmentName">
+
+      </el-table-column>
+      <el-table-column label="涓氫富鍗曚綅" align="center" prop="unitName">
+      </el-table-column>
+      <el-table-column label="骞翠唤" align="center" prop="year">
+        <template slot-scope="scope">
+          {{ scope.row.year ? scope.row.year.split('-')[0] + '骞�' : '' }}
+        </template>
+      </el-table-column>
       <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
             size="mini"
             type="text"
+            icon="el-icon-plus"
+            @click="handleadd(scope.row)"
+          >娣诲姞瀛愬伐绋�</el-button>
+          <el-button
+            size="mini"
+            type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['code:engineering:edit']"
           >淇敼</el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="deleteById(scope.row)"
-            v-hasPermi="['code:engineering:remove']"
           >鍒犻櫎</el-button>
         </template>
       </el-table-column>
@@ -183,6 +206,20 @@
             ></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="涓荤閮ㄩ棬" prop="department">
+          <treeselect v-model="form.department"  @input="getCompetentDepartmentInfo" noChildrenText="鏃犲尮閰嶆暟鎹�" :options="approvalList"  :normalizer="normalizer"  placeholder="璇烽�夋嫨涓荤閮ㄩ棬">
+          </treeselect>
+        </el-form-item>
+        <el-form-item label="涓氫富鍗曚綅" prop="unit">
+          <treeselect v-model="form.unit"  @input="getProjectOwnerUnit" noChildrenText="鏃犲尮閰嶆暟鎹�" :options="selectOptions" :normalizer="normalizer" placeholder="閫夋嫨鍗曚綅" />
+        </el-form-item>
+        <el-form-item label="骞翠唤" prop="year">
+          <el-date-picker v-model="form.year "
+                          placeholder="閫夋嫨鏃堕棿"
+                          style="width: 100%"
+                          type="date"
+                          value-format="yyyy-MM-dd HH:mm:ss"/>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
@@ -195,9 +232,15 @@
 <script>
 import { getProjectEngineerings, getProjectEngineeringById, deleteProjectEngineeringByIds, deleteProjectEngineeringById, editProjectEngineering, addProjectEngineering } from "@/api/projectEngineering/projectEngineering";
 import {list} from "@/api/projectEngineering/projectInfo";
+import Treeselect from '@riophae/vue-treeselect'
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+
+import {approvalList,listDept} from "@/api/system/dept";
+
 
 export default {
   name: "Engineering",
+  components: { Treeselect },
   dicts: ['sys_project_type', 'sys_project_status'],
   data() {
     return {
@@ -220,6 +263,10 @@
       title: "",
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
+      //涓荤閮ㄩ棬
+      approvalList: [],
+      //涓氫富鍗曚綅
+      selectOptions: [],
       // 鏌ヨ鍙傛暟
       queryParams: {
         currentPage: 1,
@@ -229,6 +276,7 @@
         projectType: null,
         status: null,
       },
+      addId:null,
       // 琛ㄥ崟鍙傛暟
       form: {},
       // 琛ㄥ崟鏍¢獙
@@ -238,6 +286,10 @@
         investmentAmount: [{required: true, message: '璇疯緭鍏ユ姇璧勯', trigger: 'change'}],
         projectType: [{required: true, message: '璇烽�夋嫨娴佺▼鎺ㄨ繘绫诲瀷', trigger: 'change'}],
         status: [{required: true, message: '璇烽�夋嫨寮�宸ョ姸鎬�', trigger: 'change'}],
+        department: [{required: true, message: '璇烽�夋嫨涓荤閮ㄩ棬', trigger: 'change'}],
+        unit: [{required: true, message: '璇烽�夋嫨椤圭洰涓氫富鍗曚綅', trigger: 'change'}],
+        year: [{required: true, message: '璇烽�夋嫨璁″垝寮�宸ユ椂闂�', trigger: 'change'}],
+        parent: [{required: false, message: '璇烽�夋嫨鐖跺伐绋�', trigger: 'change'}],
       }
     };
   },
@@ -245,7 +297,60 @@
     this.getList();
     this.getProjectList();
   },
+  mounted() {
+    //鍒濆鍖栦富绠¢儴闂ㄤ笅鎷夋
+    this.getApprovalList();
+    //鍗曚綅
+    this.getDeptList();
+  },
   methods: {
+    getProjectOwnerUnit(unitId) {
+      console.log(unitId)
+      // if (deptId) {
+      //   this.projectForm.unit = deptId
+      // } else {
+      //   this.projectForm.unit = ''
+      // }
+    },
+    getCompetentDepartmentInfo(deptId) {
+      console.log(deptId)
+      // if (deptId) {
+      //   if (this.projectForm.department != deptId) {
+      //     this.projectForm.competentDepartmentPerson = ""
+      //     this.projectForm.competentDepartmentPhone = ""
+      //   }
+      //   this.projectForm.department = deptId
+      //   this.getCompetentDepartmentPeople(deptId)
+      // } else {
+      //   this.projectForm.department = ''
+      //   this.deptPersonList = [];
+      // }
+    },
+    getDeptList(){
+      listDept().then(response => {
+        console.log(response.data)
+        this.selectOptions = this.handleTree(response.data, "deptId");
+        this.selectOptions.push({deptId: '', deptName: '鏃�', children: []})
+      });
+    },
+    getApprovalList() {
+      approvalList().then(res => {
+        this.approvalList = this.handleTree(res.data, "deptId");
+        this.approvalList.push({deptId: '', deptName: '鏃�', children: []})
+        console.log(this.approvalList)
+      });
+    },
+    /** 杞崲閮ㄩ棬鏁版嵁缁撴瀯 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.deptId,
+        label: node.deptName,
+        children: node.children
+      };
+    },
     getProjectList() {
       list().then(res => {
         this.projectList = res.data
@@ -256,6 +361,7 @@
       this.loading = true;
       getProjectEngineerings(this.queryParams).then(res => {
         this.engineeringList = res.data;
+        console.log(this.engineeringList)
         this.total = res.total;
         this.loading = false;
       });
@@ -276,10 +382,16 @@
         status: null,
         gmtCreate: null,
         gmtUpdate: null,
-        deleted: null
+        deleted: null,
+        department:null,
+        unit:null,
+        year:null,
+        parent:null,
       };
+      this.addId = null;
       this.resetForm("form");
     },
+
     /** 鎼滅储鎸夐挳鎿嶄綔 */
     handleQuery() {
       this.queryParams.pageNum = 1;
@@ -295,6 +407,12 @@
       this.ids = selection.map(item => item.id)
       this.single = selection.length!==1
       this.multiple = !selection.length
+    },
+    handleadd(row){
+      this.reset();
+      this.open = true;
+      this.title = "娣诲姞宸ョ▼";
+      this.addId = row.id;
     },
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
@@ -316,13 +434,23 @@
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          if (this.addId != null){
+            this.form.parent = this.addId;
+            addProjectEngineering(this.form).then(response => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+            return;
+          }
+          //淇敼
           if (this.form.id != null) {
             editProjectEngineering(this.form).then(response => {
               this.$modal.msgSuccess("淇敼鎴愬姛");
               this.open = false;
               this.getList();
             });
-          } else {
+          } else {//涓嶅瓨鍦╝ddId鐖跺伐绋嬫柊澧�
             addProjectEngineering(this.form).then(response => {
               this.$modal.msgSuccess("鏂板鎴愬姛");
               this.open = false;

--
Gitblit v1.8.0