From 8d14fec97344df49d58db115852c03b466482bc6 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期三, 12 四月 2023 14:47:21 +0800
Subject: [PATCH] 设备、场所、部门接口

---
 src/views/analyse/plan/index.vue |   81 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 71 insertions(+), 10 deletions(-)

diff --git a/src/views/analyse/plan/index.vue b/src/views/analyse/plan/index.vue
index c71f044..2417088 100644
--- a/src/views/analyse/plan/index.vue
+++ b/src/views/analyse/plan/index.vue
@@ -30,18 +30,19 @@
                         <el-table-column prop="assessPlanName" label="评估计划名称"/>
                         <el-table-column prop="riskUnitName" label="风险单元名称" />
                         <el-table-column prop="planUserName" label="计划制定人" />
-                        <el-table-column prop="identificationMethod" label="辨识方法" show-overflow-tooltip>
-                            <template #default="scope">
-                                <span>{{`${planState.identificationMethodList.find(item =>item.id === scope.row.identificationMethod)?.name}`}}</span>
-                            </template>
+                        <el-table-column prop="assessStartTime" label="评估开始时间">
+                          <template #default="scope">
+                            <span>{{scope.row.assessStartTime?scope.row.assessStartTime.substring(0,16):'--'}}</span>
+                          </template>
                         </el-table-column>
-                        <el-table-column prop="identificationUser" label="计划负责人" />
-                        <el-table-column prop="evaluateMethod" label="推荐评价方法" show-overflow-tooltip>
-                            <template #default="scope">
-                                <span>{{`${planState.evaluateMethodList.find(item =>item.id === scope.row.evaluateMethod)?.name}`}}</span>
-                            </template>
+                        <el-table-column prop="assessEndTime" label="评估结束时间">
+                          <template #default="scope">
+                            <span>{{scope.row.assessEndTime?scope.row.assessEndTime.substring(0,16):'--'}}</span>
+                          </template>
                         </el-table-column>
+                        <el-table-column prop="identificationUser" label="辨识专家" />
                         <el-table-column prop="evaluateUser" label="评价专家" />
+                        <el-table-column prop="sceneUser" label="现场专家" />
                         <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip></el-table-column>
                         <el-table-column prop="createByUserName" label="创建人" show-overflow-tooltip></el-table-column>
                         <el-table-column prop="updateTime" label="最后修改时间" show-overflow-tooltip></el-table-column>
@@ -64,9 +65,12 @@
                         </el-table-column>
                         <el-table-column label="操作" width="250">
                             <template #default="scope">
-                                <el-button size="small" text type="primary" @click="accessPlan(scope.row)">派发</el-button>
+                                <el-button size="small" text type="primary" v-if="scope.row.planSellStatus === 1" @click="accessPlan(scope.row)">派发</el-button>
                                 <el-button size="small" text type="primary" :icon="View" @click="openPlanDialog('查看', scope.row)">查看</el-button>
                                 <el-button v-if="scope.row.planSellStatus === 1" size="small" text type="primary" :icon="Edit" @click="openPlanDialog('修改', scope.row)">编辑</el-button>
+                                <el-button v-if="scope.row.identificationUserId == planState.user" size="small" text type="primary" :icon="Edit" @click="refuseIdentify(scope.row)">拒绝辨识</el-button>
+                                <el-button v-if="scope.row.evaluateUserId == planState.user" size="small" text type="primary" :icon="Edit" @click="refuseEvaluate(scope.row)">拒绝评价</el-button>
+                                <el-button v-if="scope.row.sceneUserId == planState.user" size="small" text type="primary" :icon="Edit" @click="refuseScene(scope.row)">拒绝现场</el-button>
                                 <el-button v-if="scope.row.planSellStatus === 1" size="small" text type="danger" :icon="Delete" @click="onDelPlan(scope.row)">删除</el-button>
                             </template>
                         </el-table-column>
@@ -89,14 +93,19 @@
 import {riskUnitApi} from "/@/api/analyse/riskUnit";
 import {personApi} from "/@/api/basic/person";
 import {useUserInfo} from "/@/stores/userInfo";
+import { storeToRefs } from 'pinia';
 import {userApi} from "/@/api/systemManage/user";
+
 
 const PlanDialog = defineAsyncComponent(() => import('./components/planDialog.vue'));
 
 const planDialogRef = ref();
+const userInfo = useUserInfo();
+const { userInfos } = storeToRefs(userInfo);
 
 const planState = reactive<PlanStateType>({
     planData: [],
+    user: null,
     searchQuery: {
         pageIndex: 1,
         pageSize: 10,
@@ -173,6 +182,57 @@
     planDialogRef.value.showPlanDialog(title, value, planState.riskUnitList, planState.personList);
 };
 
+const refuseIdentify = async(val: PlanType)=>{
+  let res = await planApi().refuseIdentify({ id: val.id });
+  if (res.data.code === 100) {
+    ElMessage({
+      type: 'success',
+      duration: 2000,
+      message: '拒绝成功'
+    });
+    await getPlanData();
+  } else {
+    ElMessage({
+      type: 'warning',
+      message: res.data.msg
+    });
+  }
+}
+
+const refuseEvaluate = async(val: PlanType)=>{
+  let res = await planApi().refuseEvaluate({ id: val.id });
+  if (res.data.code === 100) {
+    ElMessage({
+      type: 'success',
+      duration: 2000,
+      message: '拒绝成功'
+    });
+    await getPlanData();
+  } else {
+    ElMessage({
+      type: 'warning',
+      message: res.data.msg
+    });
+  }
+}
+
+const refuseScene = async(val: PlanType)=>{
+  let res = await planApi().refuseScene({ id: val.id });
+  if (res.data.code === 100) {
+    ElMessage({
+      type: 'success',
+      duration: 2000,
+      message: '拒绝成功'
+    });
+    await getPlanData();
+  } else {
+    ElMessage({
+      type: 'warning',
+      message: res.data.msg
+    });
+  }
+}
+
 const onDelPlan = (val: PlanType) => {
     ElMessageBox.confirm(`此操作将永久删除该计划:“${val.assessPlanName}”,是否继续?`, '提示', {
         confirmButtonText: '确认',
@@ -248,6 +308,7 @@
     getPlanData();
     getAllRiskUnitList();
     getPersonList();
+    planState.user = userInfos.value.uid
 })
 
 </script>

--
Gitblit v1.9.2