From d4e5744f3df7c90b44a900d1f61f5850b199b47d Mon Sep 17 00:00:00 2001
From: zhuguifei <zhuguifei@zhuguifeideiMac.local>
Date: 星期二, 04 三月 2025 10:20:59 +0800
Subject: [PATCH] 完成维修工单评价功能

---
 eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue |   77 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 73 insertions(+), 4 deletions(-)

diff --git a/eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue b/eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue
index 3b24afa..5a7d45b 100644
--- a/eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue
+++ b/eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue
@@ -1,8 +1,9 @@
 <script setup lang="ts">
 import type { Recordable } from '@vben/types';
 
-import { onMounted, ref } from 'vue';
+import { computed, onMounted, ref } from 'vue';
 
+import { useAccess } from '@vben/access';
 import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
 import { $t } from '@vben/locales';
 import { useUserStore } from '@vben/stores';
@@ -13,11 +14,15 @@
 import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table';
 import { delRepairRes, listRepairRes, repairResExport } from '#/api/eims/repair-res';
 import { getDeptTree, userList } from '#/api/system/user';
+import { REPAIR_RES_STATUS } from '#/constants/dict';
 import { commonDownloadExcel } from '#/utils/file/download';
 
 import RepairRecord from '../repair-record/index.vue';
 import { columns, querySchema } from './data';
 import repairResDrawer from './repair-res-drawer.vue';
+
+import repairFbDrawer from '../repair-fb/repair-fb-drawer.vue'
+import fbPreviewDrawer from '../repair-fb/fb-preview-drawer.vue'
 
 const userStore = useUserStore();
 const userId = userStore.userInfo?.userId;
@@ -92,6 +97,25 @@
   connectedComponent: repairResDrawer
 });
 
+const [RepairFbDrawer, repairFbDrawerApi] = useVbenDrawer({
+  connectedComponent: repairFbDrawer
+});
+
+const [FbPreviewDrawer, fbPreviewDrawerApi] = useVbenDrawer({
+  connectedComponent: fbPreviewDrawer
+});
+
+function handleAddFb(record: Recordable<any>) {
+  repairFbDrawerApi.setData({ resId: record.id, resCode: record.resCode, fbUser: userId, fbDept: deptId});
+  repairFbDrawerApi.open();
+}
+
+function handleDetailFb(record: Recordable<any>) {
+  fbPreviewDrawerApi.setData({ id: record.fbId });
+  fbPreviewDrawerApi.open();
+}
+
+
 function handleAdd() {
   repairResDrawerApi.setData({ resUser: userId, resDept: deptId });
   repairResDrawerApi.open();
@@ -100,6 +124,31 @@
 async function handleEdit(record: Recordable<any>) {
   repairResDrawerApi.setData({ id: record.id });
   repairResDrawerApi.open();
+}
+
+async function handleEditStatus(record: Recordable<any>, status: string) {
+  repairResDrawerApi.setData({ id: record.id, action: status, status });
+  repairResDrawerApi.open();
+}
+
+const { hasAccessByRoles } = useAccess();
+const isSuperAdmin = computed(() => hasAccessByRoles(['superadmin']));
+
+
+function pingjiaAdd(row: any) {
+  return (isSuperAdmin.value || row.reqUser === userId) && row.status === REPAIR_RES_STATUS.WANCHENG && !row.fbId;
+}
+
+function pingjiaDetail(row: any) {
+  return (isSuperAdmin.value || row.reqUser === userId) && row.status === REPAIR_RES_STATUS.WANCHENG && row.fbId;
+}
+
+function weixiu(row: any) {
+  return (isSuperAdmin.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.YIJIEDAN;
+}
+
+function wancheng(row: any) {
+  return (isSuperAdmin.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.WEIXIU;
 }
 
 async function handleDelete(row: Recordable<any>) {
@@ -217,14 +266,32 @@
             >
               {{ $t('pages.common.delete') }}
             </a-button>
-            <a-button type="primary" v-access:code="['eims:repairRes:add']" @click="handleAdd">
-              {{ $t('pages.common.add') }}
-            </a-button>
+            <a-button type="primary" v-access:code="['eims:repairRes:add']" @click="handleAdd"> 鎺ュ崟</a-button>
           </Space>
         </template>
 
         <template #action="{ row }">
           <Space>
+            <ghost-button v-if="pingjiaAdd(row)" class="btn-success" v-access:code="['eims:repairRes:edit']" @click.stop="handleAddFb(row)"> 璇勪环 </ghost-button>
+            <ghost-button v-if="pingjiaDetail(row)" class="btn-success" v-access:code="['eims:repairRes:edit']" @click.stop="handleDetailFb(row)"> 闃呰瘎 </ghost-button>
+            <ghost-button
+              v-if="weixiu(row)"
+              class="btn-success"
+              v-access:code="['eims:repairRes:edit']"
+              @click.stop="handleEditStatus(row, REPAIR_RES_STATUS.WEIXIU)"
+            >
+              缁翠慨
+            </ghost-button>
+
+            <ghost-button
+              v-if="wancheng(row)"
+              class="btn-success"
+              v-access:code="['eims:repairRes:edit']"
+              @click.stop="handleEditStatus(row, REPAIR_RES_STATUS.WANCHENG)"
+            >
+              瀹屾垚
+            </ghost-button>
+
             <ghost-button v-access:code="['eims:repairRes:edit']" @click.stop="handleEdit(row)">
               {{ $t('pages.common.edit') }}
             </ghost-button>
@@ -239,5 +306,7 @@
       <RepairRecord :res-id="resId" class="h-1/3" table-title="缁翠慨璁板綍" />
     </div>
     <RepairResDrawer @reload="tableApi.query()" />
+    <RepairFbDrawer @reload="tableApi.query()" />
+    <FbPreviewDrawer />
   </Page>
 </template>

--
Gitblit v1.9.3