From d4c1742fc81de272e026211d751597c8ed5253e1 Mon Sep 17 00:00:00 2001
From: yaozc <unbelievers@yeah.net>
Date: Wed, 22 Mar 2023 05:07:46 +0000
Subject: [PATCH] Merge branch 'zhaoss' of http://192.168.1.110:5678/r/pms-upgrade into master

---
 eladmin-web-master/src/views/project/project/index.vue |  100 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 92 insertions(+), 8 deletions(-)

diff --git a/eladmin-web-master/src/views/project/project/index.vue b/eladmin-web-master/src/views/project/project/index.vue
index 8f22602..ffd0219 100644
--- a/eladmin-web-master/src/views/project/project/index.vue
+++ b/eladmin-web-master/src/views/project/project/index.vue
@@ -55,10 +55,21 @@
           class="filter-item"
           size="mini"
           type="primary"
-          icon="el-icon-share"
+          icon="el-icon-check"
           :disabled="crud.selections.length === 0"
           @click="projectAdmit(crud.selections)"
         >承认</el-button>
+        <el-button
+          slot="right"
+          v-permission="permission.admit"
+          class="filter-item"
+          size="mini"
+          type="primary"
+          icon="el-icon-close"
+          :disabled="crud.selections.length === 0"
+          style="margin-left: 4px !important;"
+          @click="projectDisavow(crud.selections)"
+        >未承认</el-button>
         <el-button
           slot="right"
           v-permission="permission.seeTask"
@@ -169,7 +180,7 @@
             <el-date-picker v-model="form.planEndDate" type="date" :picker-options="pickerOptionsEnd" placeholder="选择日期" style="width: 200px;" />
           </el-form-item>
           <el-form-item label="责任人">
-            <el-select v-model="form.liableUserId" clearable filterable placeholder="请选择" style="width: 200px;">
+            <el-select v-model="form.liableUserIdList" clearable filterable multiple placeholder="请选择" style="width: 200px;">
               <el-option
                 v-for="item in userList"
                 :key="item.id"
@@ -324,7 +335,7 @@
         </el-table-column>
         <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" width="140" />
         <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" width="140" />
-        <el-table-column v-if="checkPer(['admin','project:edit','project:del'])" label="操作" width="180px" align="center" fixed="right">
+        <el-table-column v-if="checkPer(['admin','project:edit','project:del'])" label="操作" width="210px" align="center" fixed="right">
           <template slot-scope="scope">
             <udOperation
               :data="scope.row"
@@ -332,7 +343,7 @@
             >
               <el-popover
                 slot="left"
-                :ref="`popover_${scope.row.id}`"
+                :ref="`admit_${scope.row.id}`"
                 v-permission="permission.admit"
                 width="160"
                 placement="top"
@@ -342,7 +353,21 @@
                   <el-button size="mini" type="text" @click="canel(scope.row)">取消</el-button>
                   <el-button type="primary" size="mini" @click="projectAdmit(scope.row)">确定</el-button>
                 </div>
-                <el-button slot="reference" type="primary" icon="el-icon-share" size="mini" />
+                <el-button slot="reference" type="primary" icon="el-icon-check" size="mini" />
+              </el-popover>
+              <el-popover
+                slot="left"
+                :ref="`disavow_${scope.row.id}`"
+                v-permission="permission.admit"
+                width="170"
+                placement="top"
+              >
+                <p>确定未承认此项目吗?</p>
+                <div style="text-align: right; margin: 0">
+                  <el-button size="mini" type="text" @click="canel(scope.row)">取消</el-button>
+                  <el-button type="primary" size="mini" @click="projectDisavow(scope.row)">确定</el-button>
+                </div>
+                <el-button slot="reference" type="primary" icon="el-icon-close" size="mini" style="margin-left: 3px;" />
               </el-popover>
             </udOperation>
           </template>
@@ -367,7 +392,7 @@
 import moneyInput from '@/views/assembly/moneyInput/index.vue'
 import constant from '@/utils/constant'
 
-const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, liableUserId: null, planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
+const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, liableUserId: null, liableUserIdList: [], planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
 export default {
   name: 'Project',
   components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
@@ -557,7 +582,8 @@
     },
     // 取消
     canel(data) {
-      this.$refs[`popover_${data.id}`].showPopper = false
+      this.$refs[`admit_${data.id}`].showPopper = false
+      this.$refs[`disavow_${data.id}`].showPopper = false
     },
     // 项目承认
     projectAdmit(row) {
@@ -565,7 +591,7 @@
       this.ids = []
       // 判断是多个项目承认还是单个项目承认
       if (row.id !== undefined) {
-        this.$refs[`popover_${row.id}`].showPopper = false
+        this.$refs[`admit_${row.id}`].showPopper = false
         // 选中的id
         this.ids.push(row.id)
         // 项目承认
@@ -607,6 +633,54 @@
         })
       }
     },
+    // 项目未承认
+    projectDisavow(row) {
+      // 选中的id
+      this.ids = []
+      // 判断是多个项目未承认还是单个项目未承认
+      if (row.id !== undefined) {
+        this.$refs[`disavow_${row.id}`].showPopper = false
+        // 选中的id
+        this.ids.push(row.id)
+        // 项目未承认
+        crudProject.editDisavow(this.ids).then(res => {
+          // 刷新数据
+          this.crud.refresh()
+        })
+      } else {
+        // 确认框
+        this.$confirm('此操作将未承认' + row.length + '个项目, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'success'
+        }).then(() => {
+          // 循环选中数据
+          for (let i = 0; i < row.length; i++) {
+            // 选中的id
+            this.ids.push(row[i].id)
+            // 判断循环是否结束
+            if (i === row.length - 1) {
+              // 项目承认
+              crudProject.editDisavow(this.ids).then(res => {
+                // 消息提示
+                this.$message({
+                  type: 'success',
+                  message: '项目未承认!'
+                })
+                // 刷新数据
+                this.crud.refresh()
+              })
+            }
+          }
+        }).catch(() => {
+          // 消息提示
+          this.$message({
+            type: 'info',
+            message: '已取消项目未承认'
+          })
+        })
+      }
+    },
     // 查看任务
     toSeeTask(data) {
       // 跳转页面
@@ -636,6 +710,16 @@
           projectId: data.id
         }
       })
+    },
+    // 钩子:提交 - 之前
+    [CRUD.HOOK.beforeSubmit]() {
+      // 责任人ID
+      this.form.liableUserId = null
+      // 循环责任人ID列表
+      for (let i = 0; i < this.form.liableUserIdList.length; i++) {
+        // 责任人ID
+        this.form.liableUserId = this.form.liableUserId === null ? '-' + this.form.liableUserIdList[i] + '-' : this.form.liableUserId + ',' + '-' + this.form.liableUserIdList[i] + '-'
+      }
     }
   }
 }

--
Gitblit v1.9.3