Ver Fonte

feat(检测录入、任务确认): 检测录入、任务确认、列表及查询增加检验部门。另:记录录入列表样式调整

liyuhui_ex há 5 dias atrás
pai
commit
1231d92cd0
1 ficheiros alterados com 92 adições e 65 exclusões
  1. 92 65
      yudao-ui-admin-vue3/src/views/pressure2/pipechecker/task.vue

+ 92 - 65
yudao-ui-admin-vue3/src/views/pressure2/pipechecker/task.vue

@@ -33,9 +33,22 @@
           clearable
           class="!w-240px"
         >
-          <el-option v-for="(item, key) in PressurePipeCheckTypeMap" :key="key" :label="item" :value="key" />
+          <el-option
+            v-for="(item, key) in PressurePipeCheckTypeMap"
+            :key="key"
+            :label="item"
+            :value="key"
+          />
         </el-select>
       </el-form-item>
+      <el-form-item label="检验部门" prop="deptId">
+        <DeptSelect
+          v-model="queryParams.deptId"
+          placeholder="请选择部门"
+          clearable
+          class="!w-240px"
+        />
+      </el-form-item>
       <el-form-item label="检验时间" prop="checkDate">
         <el-date-picker
           v-model="queryParams.checkDate"
@@ -83,7 +96,12 @@
           class="!w-240px"
         >
           <el-option label="全部" value="all" />
-          <el-option v-for="(item, key) in filteredTaskStatusMap" :key="key" :label="item" :value="key"/>
+          <el-option
+            v-for="(item, key) in filteredTaskStatusMap"
+            :key="key"
+            :label="item"
+            :value="key"
+          />
         </el-select>
       </el-form-item>
       <el-form-item label="受理单提交人" prop="submitIds">
@@ -125,38 +143,54 @@
 
   <!-- 列表 -->
   <ContentWrap>
-    <el-button type="primary" @click="handleBatchConfirmationFn" :disabled="selectedRows.length === 0">批量办结确认</el-button>
-    <el-table ref="tableRef" v-loading="loading" :data="list" :stripe="true" @selection-change="handleSelectionChange" border>
+    <el-button
+      type="primary"
+      @click="handleBatchConfirmationFn"
+      :disabled="selectedRows.length === 0"
+      >批量办结确认</el-button
+    >
+    <el-table
+      ref="tableRef"
+      v-loading="loading"
+      :data="list"
+      :stripe="true"
+      @selection-change="handleSelectionChange"
+      border
+    >
       <el-table-column type="selection" width="40" />
       <el-table-column label="任务单号" align="center" prop="orderNo" min-width="150px" />
       <el-table-column label="使用单位" align="center" prop="unitName" min-width="150px" />
       <el-table-column label="检验性质" align="center" prop="checkType" min-width="120px">
         <template #default="scope">
-          {{ typeOptions.find(type => type.value == inspectionNatureTypeList.find(item => item.nature == scope.row.checkType).type)?.label || '-' }}
+          {{
+            typeOptions.find(
+              (type) =>
+                type.value ==
+                inspectionNatureTypeList.find((item) => item.nature == scope.row.checkType).type
+            )?.label || '-'
+          }}
         </template>
       </el-table-column>
+      <el-table-column label="检验部门" align="center" prop="deptName" min-width="120px" />
       <el-table-column label="检验项目" align="center" prop="checkType" min-width="120px">
         <template #default="scope">
           {{ PressurePipeCheckTypeMap[scope.row.checkType] }}
         </template>
       </el-table-column>
-      <el-table-column label="设备数量" align="center" prop="equipNum" min-width="150px"/>
+      <el-table-column label="设备数量" align="center" prop="equipNum" min-width="150px" />
       <el-table-column label="任务单状态" align="center" prop="taskStatus" min-width="150px">
         <template #default="scope">
-          <el-tag :type="getTypeColor(scope.row.taskStatus)">{{ PressureTaskOrderTaskStatusMap[scope.row.taskStatus] }}</el-tag>
+          <el-tag :type="getTypeColor(scope.row.taskStatus)">{{
+            PressureTaskOrderTaskStatusMap[scope.row.taskStatus]
+          }}</el-tag>
         </template>
       </el-table-column>
-      <el-table-column 
-        label="检验时间" 
-        align="center" 
-        prop="checkDate" 
-        min-width="120px" 
-      >
+      <el-table-column label="检验时间" align="center" prop="checkDate" min-width="120px">
         <template #default="scope">
           {{ formatArrayDate(scope.row.checkDate) }}
         </template>
       </el-table-column>
-      <el-table-column label="主检员" align="center" prop="manager" min-width="120px" >
+      <el-table-column label="主检员" align="center" prop="manager" min-width="120px">
         <template #default="scope">
           {{ scope.row.manager ? scope.row.manager.nickname : '-' }}
         </template>
@@ -184,7 +218,9 @@
       <el-table-column label="变更记录" align="center" prop="changeLogCount" min-width="100px">
         <template #default="scope">
           <div v-if="scope.row.changeLogCount > 0">
-            <el-link type="primary" @click="showChangeLog(scope.row)">{{ scope.row.changeLogCount }}</el-link>
+            <el-link type="primary" @click="showChangeLog(scope.row)">{{
+              scope.row.changeLogCount
+            }}</el-link>
           </div>
           <div v-else>-</div>
         </template>
@@ -196,7 +232,7 @@
             v-if="scope.row.taskStatus === PressureTaskOrderTaskStatus.WAIT_CONFIRM"
             link
             type="primary"
-            @click="handleConfirm(scope.row.id,formatArrayDate(scope.row.checkDate))"
+            @click="handleConfirm(scope.row.id, formatArrayDate(scope.row.checkDate))"
           >
             认领
           </el-button>
@@ -222,13 +258,7 @@
             办结确认
           </el-button>
 
-          <el-button
-            link
-            type="primary"
-            @click="handleEdit(scope.row.id)"
-          >
-            编辑
-          </el-button>
+          <el-button link type="primary" @click="handleEdit(scope.row.id)"> 编辑 </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -310,7 +340,6 @@
       </div>
     </template>
   </el-dialog>
-
 </template>
 
 <script setup lang="ts">
@@ -323,14 +352,15 @@ import {
   PressureTaskOrderTaskStatus,
   PressurePipeCheckTypeMap
 } from '@/utils/constants'
-import {ElMessageBox, ElMessage, ElTable,  dayjs} from 'element-plus'
+import { ElMessageBox, ElMessage, ElTable, dayjs } from 'element-plus'
 import { useRouter } from 'vue-router'
 // 在script部分
 import { getUserPage } from '@/api/system/user'
-import SmartTable from "@/components/SmartTable/SmartTable";
+import SmartTable from '@/components/SmartTable/SmartTable'
 import { getUserList } from '@/api/common/user'
-import {useUserStore} from "@/store/modules/user";
-import {InspectionNatureTypeApi} from "@/api/pressure2/inspectionnaturetype";
+import { useUserStore } from '@/store/modules/user'
+import { InspectionNatureTypeApi } from '@/api/pressure2/inspectionnaturetype'
+import DeptSelect from '@/views/pressure2/pipescheduling/components/DeptSelect.vue'
 // 定义用户搜索相关的响应式变量
 const userOptions = ref([])
 const userSearchLoading = ref(false)
@@ -344,6 +374,7 @@ const pipeOrderItemList = ref([])
 const selectedOrderItemId = ref('')
 const selectedOrderId = ref('')
 const inspectionNatureTypeList = ref([])
+const userStore = useUserStore()
 const typeOptions = [
   {
     value: 1,
@@ -363,16 +394,18 @@ const remoteSearchUsers = (query) => {
       pageNo: 1,
       pageSize: 10,
       nickName: query
-    }).then(response => {
-      const users = response.list || []
-      userOptions.value = users.map(user => ({
-        value: user.id,         // 值是用户ID
-        label: user.nickname,   // 显示的是用户昵称
-        key: user.id            // 用于v-for的key
-      }))
-    }).finally(() => {
-      userSearchLoading.value = false
     })
+      .then((response) => {
+        const users = response.list || []
+        userOptions.value = users.map((user) => ({
+          value: user.id, // 值是用户ID
+          label: user.nickname, // 显示的是用户昵称
+          key: user.id // 用于v-for的key
+        }))
+      })
+      .finally(() => {
+        userSearchLoading.value = false
+      })
   } else {
     userOptions.value = []
   }
@@ -380,26 +413,26 @@ const remoteSearchUsers = (query) => {
 
 // 剔除查询模块中不需要的选项
 const filteredTaskStatusMap = computed(() => {
-  const result = {};
+  const result = {}
 
   // 需要剔除的状态
   const excludeStatus = [
-    PressureTaskOrderTaskStatus.RECORD_INPUT,   // 记录录入 500
-    PressureTaskOrderTaskStatus.RECORD_CHECK,   // 记录校核 510
-    PressureTaskOrderTaskStatus.REPORT_INPUT,   // 报告编制 520
-    PressureTaskOrderTaskStatus.REPORT_AUDIT,   // 报告审核 600
-    PressureTaskOrderTaskStatus.REPORT_APPROVE  // 报告审批 700
-  ];
+    PressureTaskOrderTaskStatus.RECORD_INPUT, // 记录录入 500
+    PressureTaskOrderTaskStatus.RECORD_CHECK, // 记录校核 510
+    PressureTaskOrderTaskStatus.REPORT_INPUT, // 报告编制 520
+    PressureTaskOrderTaskStatus.REPORT_AUDIT, // 报告审核 600
+    PressureTaskOrderTaskStatus.REPORT_APPROVE // 报告审批 700
+  ]
 
   // 只保留不在排除列表中的状态
   Object.entries(PressureTaskOrderTaskStatusMap).forEach(([key, value]) => {
     if (!excludeStatus.includes(Number(key))) {
-      result[key] = value;
+      result[key] = value
     }
-  });
+  })
 
-  return result;
-});
+  return result
+})
 
 const getTypeColor = (status: string | number) => {
   const statusMap = {
@@ -415,8 +448,8 @@ const getTypeColor = (status: string | number) => {
     [PressureTaskOrderTaskStatus.REPORT_AUDIT]: 'warning',
     [PressureTaskOrderTaskStatus.REPORT_APPROVE]: 'warning',
     [PressureTaskOrderTaskStatus.REPORT_END]: 'success'
-  };
-  return statusMap[status] || 'info';
+  }
+  return statusMap[status] || 'info'
 }
 
 /** 承压任务单 列表 */
@@ -431,9 +464,10 @@ const queryParams = reactive({
   orderNo: undefined,
   unitName: undefined,
   checkType: undefined,
+  deptId: userStore.user.deptId,
   checkDate: [],
   checkUserIds: [],
-  submitIds:[],
+  submitIds: [],
   contractNo: undefined,
   taskStatus: 'all',
   submitTime: []
@@ -443,10 +477,9 @@ const queryFormRef = ref()
 const getList = async () => {
   loading.value = true
   try {
-
     await InspectionNatureTypeApi.getInspectionNatureTypePage({
-      equip:"300"
-    }).then(res=>{
+      equip: '300'
+    }).then((res) => {
       inspectionNatureTypeList.value = res.list
     })
 
@@ -492,8 +525,7 @@ const showChangeLog = (row: PipeTaskOrderVO) => {
 }
 
 // 认领
-const handleConfirm = async (id: string,checkDate: string) => {
-
+const handleConfirm = async (id: string, checkDate: string) => {
   // 检查检验日期是否在三天内
   // if (checkDate) {
 
@@ -516,7 +548,7 @@ const handleConfirm = async (id: string,checkDate: string) => {
       cancelButtonText: '取消',
       type: 'warning'
     })
-    await PipeTaskOrderApi.confirmTaskOrder({ id, "confirm": true })
+    await PipeTaskOrderApi.confirmTaskOrder({ id, confirm: true })
     ElMessage.success('认领成功')
     getList()
   } catch (error) {
@@ -535,7 +567,6 @@ const handleConfirm = async (id: string,checkDate: string) => {
   // const response = await PipeTaskOrderApi.getPipeByOrderId(params)
   // pipeOrderItemList.value = response || []
   // setPipeConfirmDialogVisible.value = true
-
 }
 
 // 取消认领
@@ -546,7 +577,7 @@ const handleCancelConfirm = async (id: string) => {
       cancelButtonText: '取消',
       type: 'warning'
     })
-    await PipeTaskOrderApi.confirmTaskOrder({ id, "confirm": false })
+    await PipeTaskOrderApi.confirmTaskOrder({ id, confirm: false })
     ElMessage.success('取消认领成功')
     getList()
   } catch (error) {
@@ -619,7 +650,6 @@ const handleConfirmationFn = async (id: string) => {
 
 // 人员选择弹窗 start
 const userTableRef = ref()
-const userStore = useUserStore()
 const userInfo = computed(() => userStore.user)
 const fieldKey = ref('')
 const customUserDialogVisible = ref(false)
@@ -715,7 +745,6 @@ const handleCancelSetPipeInfo = () => {
 }
 
 const handleConfirmSetPipeInfo = async () => {
-
   if (!selectedOrderItemId.value) {
     ElMessage.warning('请选择主检管道')
     return
@@ -723,7 +752,7 @@ const handleConfirmSetPipeInfo = async () => {
 
   try {
     const params = {
-      id : selectedOrderId.value,
+      id: selectedOrderId.value,
       confirm: true,
       orderItemId: selectedOrderItemId.value
     }
@@ -752,6 +781,4 @@ onMounted(() => {
 })
 </script>
 
-<style lang="scss" scoped>
-
-</style>
+<style lang="scss" scoped></style>