Преглед на файлове

前端基地维修及故障流程等

lipenghui преди 1 седмица
родител
ревизия
329adb2f6a

+ 3 - 0
src/api/pms/device/index.ts

@@ -46,6 +46,9 @@ export interface IotDeviceVO {
 
 // 设备台账 API
 export const IotDeviceApi = {
+  getCompany: async (params:any) => {
+    return await request.get({ url: `/rq/iot-device/company?id=`+params})
+  },
   getMaxCode: async (params:any) => {
     return await request.get({ url: `/rq/iot-device/max?yfCode=`+params})
   },

+ 8 - 1
src/api/pms/maintain/index.ts

@@ -21,17 +21,24 @@ export interface IotMaintainVO {
   processInstanceId: string // 流程实例id
   auditStatus: number // 审核状态
   deptId: number // 部门id
+  yfDeviceCode: string
+  type: string
 }
 
 // 维修工单 API
 export const IotMaintainApi = {
+  //更新维修方式
+  maintainMethod: async (data: any) => {
+    debugger
+    return await request.post({ url: `/rq/iot-maintain/method`, data })
+  },
   // 查询维修工单分页
   getIotMaintainPage: async (params: any) => {
     return await request.get({ url: `/rq/iot-maintain/page`, params })
   },
 
   // 查询维修工单详情
-  getIotMaintain: async (id: number) => {
+  getIotMaintain: async (id: any) => {
     return await request.get({ url: `/rq/iot-maintain/get?id=` + id })
   },
 

+ 53 - 0
src/api/pms/maintain/record/index.ts

@@ -0,0 +1,53 @@
+import request from '@/config/axios'
+
+// 基地维修记录 VO
+export interface IotJdRecordVO {
+  id: number // 主键id
+  deviceId: number // 设备id
+  repairTime: Date // 维修日期时间
+  repairContent: string // 维修内容
+  pic: string // 图片
+  solution: string // 解决办法
+  remark: string // 备注
+  deviceName: string // 设备名称
+  repairPersonName: string
+  repairPerson: string
+}
+
+// 基地维修记录 API
+export const IotJdRecordApi = {
+  getIotJdRecordByRepairId: async (id: any) => {
+    return await request.get({ url: `/rq/iot-jd-record/repair?repairId=` + id })
+  },
+  // 查询基地维修记录分页
+  getIotJdRecordPage: async (params: any) => {
+    return await request.get({ url: `/rq/iot-jd-record/page`, params })
+  },
+
+  // 查询基地维修记录详情
+  getIotJdRecord: async (id: number) => {
+    return await request.get({ url: `/rq/iot-jd-record/get?id=` + id })
+  },
+  getIotJdRecordAssist: async (id: number) => {
+    return await request.get({ url: `/rq/iot-jd-record/assist/`+id})
+  },
+  // 新增基地维修记录
+  createIotJdRecord: async (data: IotJdRecordVO) => {
+    return await request.post({ url: `/rq/iot-jd-record/create`, data })
+  },
+
+  // 修改基地维修记录
+  updateIotJdRecord: async (data: IotJdRecordVO) => {
+    return await request.put({ url: `/rq/iot-jd-record/update`, data })
+  },
+
+  // 删除基地维修记录
+  deleteIotJdRecord: async (id: number) => {
+    return await request.delete({ url: `/rq/iot-jd-record/delete?id=` + id })
+  },
+
+  // 导出基地维修记录 Excel
+  exportIotJdRecord: async (params) => {
+    return await request.download({ url: `/rq/iot-jd-record/export-excel`, params })
+  },
+}

+ 7 - 0
src/locales/en.ts

@@ -802,6 +802,7 @@ export default {
 
   },
   faultForm:{
+    failureType:'FailureType',
     device:'Device',
     solve:'Solve',
     assist:'Assist',
@@ -858,6 +859,11 @@ export default {
     view:'View',
     fill:'Fill',
     dept:'Dept',
+    maintainWay:'MaintenanceMethod',
+    methodDescription:'MethodDescription',
+    record:'Record',
+    phRepair:'assit repair personnel',
+    phRepairHolder:'please select assist repair personnel '
   },
   iotMaintain:{
     showAllMaterials: 'Show all',
@@ -1202,6 +1208,7 @@ export default {
     CollectionFormDetails:'CollectionFormDetails',
     MaintainCalendar:'MaintainCalendar',
     RepairOrderAdd:'RepairOrderAdd',
+    MaintainRecord:'RepairRecord',
     RepairOrderEdit:'RepairOrderEdit',
     RepairOrderDetail:'RepairOrderDetail',
     InspectionRouteAdd:'InspectionRouteAdd',

+ 9 - 1
src/locales/zh-CN.ts

@@ -799,6 +799,8 @@ export default {
     del:'删除'
   },
   faultForm:{
+    failureType:'故障类型',
+    failureTypeHolder:'请选择故障类型',
     device:'设备',
     solve:'是否解决',
     assist:'是否协助',
@@ -854,7 +856,12 @@ export default {
     operation:'操作',
     view:'查看',
     fill:'填写',
-    dept:'所属部门'
+    dept:'所属部门',
+    maintainWay:'维修方式',
+    methodDescription:'维修方式说明',
+    record:'维修记录',
+    phRepair:'配合维修人员',
+    phRepairHolder:'请选择配合维修人员'
   },
   iotMaintain:{
     device:'设备',
@@ -1198,6 +1205,7 @@ export default {
     CollectionFormDetails:'领用单详情',
     MaintainCalendar:'保养台历',
     RepairOrderAdd:'维修工单添加',
+    MaintainRecord:'维修记录',
     RepairOrderEdit:'维修工单编辑',
     RepairOrderDetail:'维修工单详情',
     InspectionRouteAdd:'巡检路线添加',

+ 13 - 0
src/router/modules/remaining.ts

@@ -980,6 +980,19 @@ const remainingRouter: AppRouteRecordRaw[] = [
           activeMenu: '/maintain/add'
         }
       },
+      {
+        path: 'maintain/record/:id?(\\d+)',
+        component: () => import('@/views/pms/maintain/IotMaintainRecord.vue'),
+        name: 'MaintainRecord',
+        meta: {
+          noCache: false,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:add',
+          title: t('rem.MaintainRecord'),
+          activeMenu: '/maintain/record'
+        }
+      },
       {
         path: 'maintain/edit/:id(\\d+)',
         component: () => import('@/views/pms/maintain/IotMaintainAddEdit.vue'),

+ 2 - 0
src/utils/dict.ts

@@ -107,6 +107,7 @@ export const getDictLabel = (dictType: string, value: any): string => {
 }
 
 export enum DICT_TYPE {
+  PMS_MAINTAIN_METHOD = 'maintain_method',
   IOT_DEVICE_STATUS = 'iot_device_status', // IOT 设备状态
   PMS_INSPECT_ORDER_STATUS = "pms_inspect_order_status",
   OPERATION_FILL_ORDER_STATUS = "operation_fill_order_status",
@@ -120,6 +121,7 @@ export enum DICT_TYPE {
   PMS_FAILURE_STATUS = 'pms_failure_status',
   PMS_FILE_TYPE = 'pms_file_type',
   PMS_DEVICE_STATUS = 'pms_device_status',
+  FAILURE_TYPE = 'failure_type',
   PMS_ASSET_PROPERTY = 'pms_asset_property',
   USER_TYPE = 'user_type',
   COMMON_STATUS = 'common_status',

+ 101 - 28
src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue

@@ -22,7 +22,9 @@
           class="mb-auto"
           ref="approveFormRef"
           :model="approveReasonForm"
-          :rules="processInstance.name==='故障上报流程'?transferFormRuleType:approveReasonRule"
+          :rules="
+            processInstance.name === '故障上报流程' ? transferFormRuleType : approveReasonRule
+          "
           label-width="100px"
         >
           <el-card v-if="runningTask?.formId > 0" class="mb-15px !-mt-10px">
@@ -37,8 +39,13 @@
             />
           </el-card>
 
-          <el-form-item label="是否转工单" prop="ifTrans">
-            <el-select v-model="approveReasonForm.ifTrans" placeholder="请选择是否转工单" clearable @change="ifShowApproval">
+          <el-form-item label="是否转工单" prop="ifTrans" v-if="company!='rh'">
+            <el-select
+              v-model="approveReasonForm.ifTrans"
+              placeholder="请选择是否转工单"
+              clearable
+              @change="ifShowApproval"
+            >
               <el-option
                 v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
                 :key="dict.label"
@@ -48,8 +55,33 @@
             </el-select>
           </el-form-item>
 
-          <el-form-item label="负责人" prop="assigneeUserId" v-if="processInstance.name==='故障上报流程'&&approveReasonForm.ifTrans">
-            <el-select v-model="approveReasonForm.assigneeUserId" filterable clearable style="width: 100%">
+<!--          <el-form-item label="是否维修" prop="ifTrans" v-if="company=='rh'&&!ifRhGzShow&&processInstance.name==='瑞恒故障上报'">-->
+<!--            <el-select-->
+<!--              v-model="approveReasonForm.ifTrans"-->
+<!--              placeholder="请选择是否维修"-->
+<!--              clearable-->
+<!--              @change="ifShowApproval"-->
+<!--            >-->
+<!--              <el-option-->
+<!--                v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"-->
+<!--                :key="dict.label"-->
+<!--                :label="dict.label"-->
+<!--                :value="dict.value"-->
+<!--              />-->
+<!--            </el-select>-->
+<!--          </el-form-item>-->
+
+          <el-form-item
+            label="负责人"
+            prop="assigneeUserId"
+            v-if="processInstance.name === '故障上报流程' && approveReasonForm.ifTrans"
+          >
+            <el-select
+              v-model="approveReasonForm.assigneeUserId"
+              filterable
+              clearable
+              style="width: 100%"
+            >
               <el-option
                 v-for="item in deptUsers"
                 :key="item.id"
@@ -59,7 +91,11 @@
             </el-select>
           </el-form-item>
 
-          <el-form-item label="维修类型" v-if="processInstance.name==='故障上报流程'&&approveReasonForm.ifTrans" prop="type">
+          <el-form-item
+            label="维修类型"
+            v-if="processInstance.name === '故障上报流程' && approveReasonForm.ifTrans"
+            prop="type"
+          >
             <el-select v-model="approveReasonForm.type">
               <el-option
                 v-for="dict in getStrDictOptions(DICT_TYPE.PMS_MAIN_TYPE)"
@@ -77,11 +113,16 @@
               :rows="4"
             />
           </el-form-item>
-          <el-form-item
-            label="下一个节点的审批人"
-            prop="nextAssignees"
-            v-if="ifShow"
-          >
+          <el-form-item label="下一个节点的审批人" prop="nextAssignees" v-if="ifShow">
+            <div class="ml-10px -mt-15px -mb-35px">
+              <ProcessInstanceTimeline
+                :activity-nodes="nextAssigneesActivityNode"
+                :show-status-icon="false"
+                @select-user-confirm="selectNextAssigneesConfirm"
+              />
+            </div>
+          </el-form-item>
+          <el-form-item label="维修人员任务接收" prop="nextAssignees" v-if="company=='rh'&&ifRhGzShow&&processInstance.name==='瑞恒故障上报'">
             <div class="ml-10px -mt-15px -mb-35px">
               <ProcessInstanceTimeline
                 :activity-nodes="nextAssigneesActivityNode"
@@ -108,7 +149,11 @@
             <el-button
               :disabled="formLoading"
               type="success"
-              @click="processInstance.name==='故障上报流程'?handleTransferType(approveFormRef):handleAudit(true, approveFormRef)"
+              @click="
+                processInstance.name === '故障上报流程'||processInstance.name ==='瑞恒故障上报'
+                  ? handleTransferType(approveFormRef)
+                  : handleAudit(true, approveFormRef)
+              "
             >
               {{ getButtonDisplayName(OperationButtonType.APPROVE) }}
             </el-button>
@@ -244,9 +289,14 @@
           :rules="transferFormRule"
           label-width="100px"
         >
-<!--          <el-form-item label="新审批人" prop="assigneeUserId">-->
+          <!--          <el-form-item label="新审批人" prop="assigneeUserId">-->
           <el-form-item label="新审批人" prop="assigneeUserId">
-            <el-select v-model="transferForm.assigneeUserId" filterable clearable style="width: 100%">
+            <el-select
+              v-model="transferForm.assigneeUserId"
+              filterable
+              clearable
+              style="width: 100%"
+            >
               <el-option
                 v-for="item in userOptions"
                 :key="item.id"
@@ -546,25 +596,24 @@
   <SignDialog ref="signRef" @success="handleSignFinish" />
 </template>
 <script lang="ts" setup>
-import { useUserStoreWithOut } from '@/store/modules/user'
+import { useUserStoreWithOut, useUserStore } from '@/store/modules/user'
 import { setConfAndFields2 } from '@/utils/formCreate'
 import * as TaskApi from '@/api/bpm/task'
 import * as ProcessInstanceApi from '@/api/bpm/processInstance'
 import * as UserApi from '@/api/system/user'
 import {
+  CandidateStrategy,
   NodeType,
   OPERATION_BUTTON_NAME,
-  OperationButtonType,
-  CandidateStrategy
+  OperationButtonType
 } from '@/components/SimpleProcessDesignerV2/src/consts'
 import { BpmModelFormType, BpmProcessInstanceStatus } from '@/utils/constants'
 import type { FormInstance, FormRules } from 'element-plus'
 import SignDialog from './SignDialog.vue'
 import ProcessInstanceTimeline from '../detail/ProcessInstanceTimeline.vue'
 import { isEmpty } from '@/utils/is'
-import {DICT_TYPE, getBoolDictOptions, getStrDictOptions} from "@/utils/dict";
-import {IotMaintainApi} from "@/api/pms/maintain";
-import {IotFailureReportApi} from "@/api/pms/failure";
+import { DICT_TYPE, getBoolDictOptions, getStrDictOptions } from '@/utils/dict'
+import { IotFailureReportApi } from '@/api/pms/failure'
 
 defineOptions({ name: 'ProcessInstanceBtnContainer' })
 
@@ -579,6 +628,7 @@ const props = defineProps<{
   processDefinition: any // 流程定义信息
   userOptions: UserApi.UserVO[]
   deptUsers: UserApi.UserVO[]
+  company: any
   normalForm: any // 流程表单 formCreate
   normalFormApi: any // 流程表单 formCreate Api
   writableFields: string[] // 流程表单可以编辑的字段
@@ -614,9 +664,9 @@ const approveReasonForm = reactive({
   reason: '',
   signPicUrl: '',
   nextAssignees: {},
-  type:undefined,
+  type: undefined,
   assigneeUserId: undefined,
-  ifTrans: undefined,
+  ifTrans: undefined
 })
 const approveReasonRule = computed(() => {
   return {
@@ -628,12 +678,22 @@ const approveReasonRule = computed(() => {
   }
 })
 const ifShow = ref(false)
-const ifShowApproval = ()=>{
+const ifShowApproval = () => {
+  // if (props.processInstance.name==='故障上报流程') {
+  //   debugger
+  //   ifShow.value = !approveReasonForm.ifTrans
+  // } else {
+  ifShow.value = nextAssigneesActivityNode.value.length > 0 && !approveReasonForm.ifTrans
+  // }
+}
+const ifRhGzShow = ref(false)
+const ifRhGzShowApproval = async () => {
   // if (props.processInstance.name==='故障上报流程') {
   //   debugger
   //   ifShow.value = !approveReasonForm.ifTrans
   // } else {
-    ifShow.value = nextAssigneesActivityNode.value.length > 0&&!approveReasonForm.ifTrans
+  ifRhGzShow.value = nextAssigneesActivityNode.value.length > 0
+  debugger
   // }
 }
 // 拒绝表单
@@ -662,7 +722,7 @@ const transferFormRef = ref<FormInstance>()
 const transferForm = reactive({
   assigneeUserId: undefined,
   reason: '',
-  type:''
+  type: ''
 })
 const transferFormRule = reactive<FormRules<typeof transferForm>>({
   assigneeUserId: [{ required: true, message: '新审批人不能为空', trigger: 'change' }],
@@ -746,13 +806,15 @@ watch(
 /** 弹出气泡卡 */
 const openPopover = async (type: string) => {
   if (type === 'approve') {
+    debugger
     // 校验流程表单
     const valid = await validateNormalForm()
     if (!valid) {
       message.warning('表单校验不通过,请先完善表单!!')
       return
     }
-    initNextAssigneesFormField()
+    await initNextAssigneesFormField()
+    await ifRhGzShowApproval();
   }
   if (type === 'return') {
     // 获取退回节点
@@ -788,6 +850,7 @@ const initNextAssigneesFormField = async () => {
     processVariablesStr: JSON.stringify(variables)
   })
   if (data && data.length > 0) {
+    debugger
     data.forEach((node: any) => {
       if (
         // 情况一:当前节点没有审批人,并且是发起人自选
@@ -837,7 +900,7 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
     }
 
     if (pass) {
-      if (props.processInstance.name==='故障上报流程'&&!approveReasonForm.ifTrans) {
+      if (props.processInstance.name === '故障上报流程' && !approveReasonForm.ifTrans) {
         const nextAssigneesValid = validateNextAssignees()
         if (!nextAssigneesValid) return
       }
@@ -938,7 +1001,17 @@ const handleTransferType = async (formRef: FormInstance | undefined) => {
     await approveFormRef.value.validate()
     // 1.2 提交转交
     debugger
-    await IotFailureReportApi.updateIotMaintainProcess(props.processInstance.id, props.processInstance.businessKey, approveReasonForm.type, approveReasonForm.assigneeUserId,approveReasonForm.ifTrans);
+    //如果是瑞恒的故障上报的话,责任人为当前工单领取人
+    if (props.company==='rh') {
+      approveReasonForm.assigneeUserId = useUserStore().getUser.id
+    }
+    await IotFailureReportApi.updateIotMaintainProcess(
+      props.processInstance.id,
+      props.processInstance.businessKey,
+      approveReasonForm.type,
+      approveReasonForm.assigneeUserId,
+      approveReasonForm.ifTrans
+    )
     await handleAudit(true, formRef)
     // await TaskApi.transferTask(data)
     // transferFormRef.value.resetFields()

+ 5 - 1
src/views/bpm/processInstance/detail/index.vue

@@ -117,6 +117,7 @@
             :process-definition="processDefinition"
             :userOptions="userOptions"
             :deptUsers = "deptUsers"
+            :company = "company"
             :normal-form="detailForm"
             :normal-form-api="fApi"
             :writable-fields="writableFields"
@@ -148,6 +149,7 @@ import approveSvg from '@/assets/svgs/bpm/approve.svg'
 import rejectSvg from '@/assets/svgs/bpm/reject.svg'
 import cancelSvg from '@/assets/svgs/bpm/cancel.svg'
 import { useUserStore } from '@/store/modules/user'
+import {IotDeviceApi} from "@/api/pms/device";
 
 defineOptions({ name: 'BpmProcessInstanceDetail' })
 const props = defineProps<{
@@ -213,7 +215,8 @@ const getApprovalDetail = async () => {
     userOptions.value = await UserApi.getSimpleUserList()
     const userId = useUserStore().getUser.id
     deptUsers.value = await UserApi.getMaintainUsers(userId, processInstance.value.businessKey);
-
+    company.value = await IotDeviceApi.getCompany(processInstance.value.businessKey)
+    debugger
     // 设置表单信息
     if (processDefinition.value.formType === BpmModelFormType.NORMAL) {
       // 获取表单字段权限
@@ -308,6 +311,7 @@ const activeTab = ref('form')
 /** 初始化 */
 const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
 const deptUsers = ref<UserApi.UserVO[]>([]) // 用户列表
+const company = ref('')
 onMounted(async () => {
   getDetail()
 })

+ 15 - 1
src/views/pms/failure/IotFailureReportForm.vue

@@ -8,6 +8,18 @@
       v-loading="formLoading"
     >
       <el-row >
+        <el-col :span="12">
+          <el-form-item :label="t('faultForm.failureType')" prop="failureType">
+            <el-select v-model="formData.failureType" :placeholder="t('faultForm.failureTypeHolder')" :disabled="disabled" clearable>
+              <el-option
+                v-for="dict in getStrDictOptions(DICT_TYPE.FAILURE_TYPE)"
+                :key="dict.label"
+                :label="dict.label"
+                :value="dict.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
       <el-col :span="12">
       <el-form-item :label="t('faultForm.device')" prop="deviceName">
         <el-select
@@ -142,7 +154,7 @@
 </template>
 <script setup lang="ts">
 import { IotFailureReportApi, IotFailureReportVO } from '@/api/pms/failure'
-import {DICT_TYPE, getBoolDictOptions} from "@/utils/dict";
+import {DICT_TYPE, getBoolDictOptions, getStrDictOptions} from "@/utils/dict";
 import DeviceList from "@/views/pms/failure/DeviceList.vue";
 import dayjs from "dayjs";
 
@@ -159,6 +171,7 @@ const formType = ref('') // 表单的类型:create - 新增;update - 修改
 const deviceLabel = ref('') // 表单的类型:create - 新增;update - 修改
 const approver = ref([])
 const formData = ref({
+  failureType: undefined,
   approvalId:undefined,
   id: undefined,
   failureCode: undefined,
@@ -222,6 +235,7 @@ const openForm = () => {
   deviceFormRef.value.open()
 }
 const formRules = ref({
+  failureType: [{ required: true, message: '故障类型不能为空', trigger: 'blur' }],
   deviceName: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
   ifDeal: [{ required: true, message: '是否解决不能为空', trigger: 'blur' }],
   needHelp: [{ required: true, message: '是否协助不能为空', trigger: 'blur' }],

+ 5 - 0
src/views/pms/failure/index.vue

@@ -157,6 +157,11 @@
               <dict-tag :type="DICT_TYPE.PMS_FAILURE_STATUS" :value="scope.row.status" />
             </template>
           </el-table-column>
+          <el-table-column :label="t('faultForm.failureType')" align="center" prop="failureType" min-width="110">
+            <template #default="scope">
+              <dict-tag :type="DICT_TYPE.FAILURE_TYPE" :value="scope.row.failureType" />
+            </template>
+          </el-table-column>
           <el-table-column :label="t('fault.approvalStatus')"  align="center" prop="auditStatus" min-width="130">
             <template #default="scope">
               <dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />

+ 19 - 0
src/views/pms/maintain/IotMaintainDetail.vue

@@ -125,6 +125,23 @@
               <UploadImgs v-model="formData.pics" :disabled="true" height="55px" />
             </el-form-item>
           </el-col>
+          <el-col :span="8">
+            <el-form-item :label="t('maintain.maintainWay')" prop="maintainMethod">
+              <el-select v-model="formData.maintainMethod" clearable disabled>
+                <el-option
+                  v-for="dict in getStrDictOptions(DICT_TYPE.PMS_MAINTAIN_METHOD)"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item :label="t('maintain.methodDescription')" prop="methodDescription">
+              <el-input v-model="formData.methodDescription" type="textarea"  disabled />
+            </el-form-item>
+          </el-col>
           <el-col :span="8" v-if="formData.type === 'out'">
             <el-form-item :label="t('iotMaintain.applyPerson')" prop="applyPersonId" :rules="formData.type==='out'?classifyRules:[]">
               <el-select v-model="formData.applyPersonId" :placeholder="t('iotMaintain.applyPersonHolder')" disabled clearable>
@@ -330,6 +347,8 @@ const materialList = ref<any[]>([]) // 保养工单bom关联物料列表
 const { wsCache } = useCache()
 const currentBomNodeId = ref<string>()
 const formData = ref({
+  methodDescription: undefined,
+  maintainMethod: undefined,
   kmHour:undefined,
   maintainItem:undefined,
   enableDate: undefined,

+ 479 - 0
src/views/pms/maintain/IotMaintainRecord.vue

@@ -0,0 +1,479 @@
+<template>
+  <ContentWrap v-loading="formLoading">
+    <!-- 第一部分:日报标题 -->
+    <div class="daily-report-title">
+      <h2>{{ pageTitle }}</h2>
+    </div>
+
+    <!-- 第二部分:项目/任务信息 -->
+    <ContentWrap>
+      <div class="info-table" style="margin-top: 0.5em">
+        <!-- 表格行 -->
+        <div class="table-row">
+          <div class="table-cell">
+            <div class="cell-content">
+              <span class="cell-label">油服编码:</span>
+              <!-- 甲方字段:添加 single-line-ellipsis 类 + title 绑定完整内容 -->
+              <span
+                class="cell-value single-line-ellipsis"
+                :title="repairInfo.yfDeviceCode || repairInfo.deviceCode || '-'"
+              >
+                {{ repairInfo.yfDeviceCode || repairInfo.deviceCode || '-' }}
+              </span>
+            </div>
+          </div>
+          <div class="table-cell">
+            <div class="cell-content">
+              <span class="cell-label">设备名称:</span>
+              <span class="cell-value">{{ repairInfo.deviceName || '-' }}</span>
+            </div>
+          </div>
+          <div class="table-cell">
+            <div class="cell-content">
+              <span class="cell-label">维修类型:</span>
+              <span class="cell-value">{{
+                getDictLabel(DICT_TYPE.PMS_MAIN_TYPE, repairInfo.type)
+              }}</span>
+            </div>
+          </div>
+        </div>
+
+        <div class="table-row">
+          <div class="table-cell">
+            <div class="cell-content">
+              <span class="cell-label">维修开始时间:</span>
+              <span class="cell-value">{{ formatDate(repairInfo.maintainStartTime) || '-' }}</span>
+            </div>
+          </div>
+          <div class="table-cell">
+            <div class="cell-content">
+              <span class="cell-label">维修结束日期:</span>
+              <span class="cell-value">{{ formatDate(repairInfo.maintainEndTime) || '-' }}</span>
+            </div>
+          </div>
+          <div class="table-cell">
+            <div class="cell-content">
+              <span class="cell-label">故障时间:</span>
+              <span class="cell-value">{{ formatDate(repairInfo.failureTime) || '-' }}</span>
+            </div>
+          </div>
+        </div>
+        <div class="table-row">
+          <div class="table-cell">
+            <div class="cell-content">
+              <span class="cell-label">维修人员:</span>
+              <span class="cell-value">{{ repairInfo.maintainPersonName || '-' }}</span>
+            </div>
+          </div>
+          <div class="table-cell">
+            <div class="cell-content">
+              <span class="cell-label">故障系统:</span>
+              <span class="cell-value">{{ repairInfo.failureSystem || '-' }}</span>
+            </div>
+          </div>
+          <div class="table-cell">
+            <div class="cell-content">
+              <!--              <span class="cell-label">故障时间:</span>-->
+              <!--              <span class="cell-value">{{ formatDate(repairInfo.failureTime) || '-' }}</span>-->
+            </div>
+          </div>
+        </div>
+      </div>
+    </ContentWrap>
+    <ContentWrap>
+      <el-form :inline="true" ref="queryFormRef" :model="queryParams">
+        <el-form-item>
+          <el-form-item label="维修时间" prop="createTime">
+            <el-date-picker
+              v-model="queryParams.repairTime"
+              value-format="YYYY-MM-DD HH:mm:ss"
+              type="daterange"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+              class="!w-220px"
+            />
+          </el-form-item>
+        </el-form-item>
+        <el-form-item>
+          <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
+          <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
+          <el-button type="primary" @click="openForm('create')">
+            <Icon icon="ep:plus" /> 新增
+          </el-button>
+          <el-button type="warning" @click="viewTimeline">
+            <Icon icon="ep:timer" /> 时间线
+          </el-button>
+        </el-form-item>
+      </el-form>
+    </ContentWrap>
+    <ContentWrap>
+      <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
+        <el-table-column
+          label="维修时间"
+          align="center"
+          prop="repairTime"
+          :formatter="dateFormatter"
+          width="150px"
+        />
+        <el-table-column label="维修项" align="center" min-width="90" prop="repairItem" />
+        <el-table-column label="维修内容" align="center" min-width="150" prop="repairContent" />
+        <el-table-column label="解决办法" align="center" prop="solution" min-width="150" />
+        <el-table-column label="图片" align="center"  prop="pic" />
+        <el-table-column label="创建人" align="center" prop="createName" />
+        <el-table-column label="配合维修人员" align="center" prop="repairPersonName" />
+        <el-table-column label="备注" align="center" prop="remark" />
+        <el-table-column
+          label="创建时间"
+          align="center"
+          prop="createTime"
+          :formatter="dateFormatter"
+          width="180px"
+        />
+        <el-table-column label="操作" align="center" min-width="90px">
+          <template #default="scope">
+            <el-button link type="primary" v-if="userid.toString()===scope.row.creator" @click="openForm('update', scope.row.id)">
+              编辑
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <!-- 分页 -->
+      <Pagination
+        :total="total"
+        v-model:page="queryParams.pageNo"
+        v-model:limit="queryParams.pageSize"
+        @pagination="getList"
+      />
+    </ContentWrap>
+    <IotJdRecordForm ref="formRef" @success="getList" />
+    <MaintainRecordDrawer
+      ref="showDrawer"
+      :model-value="drawerVisible"
+      @update:model-value="(val) => (drawerVisible = val)"
+    />
+  </ContentWrap>
+</template>
+
+<script setup lang="ts">
+import { computed, onMounted, ref } from 'vue'
+import { useI18n } from '@/hooks/web/useI18n'
+import { useMessage } from '@/hooks/web/useMessage'
+import { useTagsViewStore } from '@/store/modules/tagsView'
+import { useRoute, useRouter } from 'vue-router'
+import { useUserStore } from '@/store/modules/user'
+import { IotMaintainApi, IotMaintainVO } from '@/api/pms/maintain'
+import { DICT_TYPE, getDictLabel } from '@/utils/dict'
+import dayjs from 'dayjs'
+import { dateFormatter } from '@/utils/formatTime'
+import { IotJdRecordApi, IotJdRecordVO } from '@/api/pms/maintain/record'
+import IotJdRecordForm from '@/views/pms/maintain/record/IotJdRecordForm.vue'
+import MaintainRecordDrawer from '@/views/pms/maintain/MaintainRecordDrawer.vue'
+
+const { t } = useI18n()
+const message = useMessage()
+const { delView } = useTagsViewStore()
+const { push, currentRoute } = useRouter()
+const { params } = useRoute()
+const userStore = useUserStore()
+const total = ref(0) // 列表的总页数
+const list = ref<IotJdRecordVO>([])
+const loading = ref(true) // 列表的加载中
+const drawerVisible = ref<boolean>(false)
+const showDrawer = ref()
+const queryFormRef = ref() // 搜索的表单
+/** 填报日报 表单 */
+defineOptions({ name: 'MaintainRecord' })
+
+/**打开时间线*/
+const viewTimeline = () => {
+  drawerVisible.value = true
+  showDrawer.value.openDrawer(id)
+}
+
+/** 添加/修改操作 */
+const formRef = ref()
+const openForm = (type: string, recordId: any) => {
+  formRef.value.open(type, id, recordId)
+}
+/** 搜索按钮操作 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+/** 查询列表 */
+const getList = async () => {
+  loading.value = true
+  try {
+    queryParams.repairId = id
+    const data = await IotJdRecordApi.getIotJdRecordPage(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  deviceId: undefined,
+  repairId: undefined,
+  repairTime: [],
+  repairContent: undefined,
+  pic: undefined,
+  solution: undefined,
+  remark: undefined,
+  createTime: [],
+  deviceName: undefined
+})
+
+const formLoading = ref(false)
+// 页面标题计算
+const pageTitle = computed(() => {
+  return (
+    repairInfo.value.yfDeviceCode ||
+    repairInfo.value.deviceCode + repairInfo.value.deviceName + '维修记录'
+  )
+})
+
+const close = () => {
+  delView(unref(currentRoute))
+  push({ name: 'FillDailyReport', params: {} })
+}
+
+const formatDate = (timestamp: number) => {
+  if (!timestamp) return ''
+  return dayjs(timestamp).format('YYYY-MM-DD')
+}
+
+const repairInfo = ref<IotMaintainVO>({})
+const id = params.id //维修工单主键id
+const userid = ref('')
+onMounted(async () => {
+  userid.value = useUserStore().getUser.id
+  debugger
+  formLoading.value = true
+  try {
+    repairInfo.value = await IotMaintainApi.getIotMaintain(id)
+    await getList()
+  } catch (error) {
+    console.error('初始化数据失败:', error)
+    message.error('数据加载失败')
+  } finally {
+    formLoading.value = false
+  }
+})
+</script>
+
+<style scoped>
+.info-table {
+  border: 1px solid #e0e0e0;
+  border-radius: 4px;
+  overflow: hidden;
+}
+
+.table-row {
+  display: flex;
+  border-bottom: 1px solid #e0e0e0;
+}
+
+.table-row:last-child {
+  border-bottom: none;
+}
+
+.table-cell {
+  flex: 1;
+  border-right: 1px solid #e0e0e0;
+  padding: 12px 8px;
+  min-height: 44px;
+  display: flex;
+  align-items: center;
+}
+
+.table-cell:last-child {
+  border-right: none;
+}
+
+.table-cell.full-width {
+  flex: 1;
+  border-right: none;
+}
+
+.cell-content {
+  display: flex;
+  align-items: center;
+  width: 100%;
+}
+
+.cell-label {
+  font-weight: 500;
+  /* 统一字体大小为 14px(Element 表单默认) */
+  font-size: 14px;
+  color: #606266;
+  min-width: 80px;
+  margin-right: 8px;
+  flex-shrink: 0;
+}
+
+.cell-value {
+  /* 统一字体大小为 14px(Element 输入框默认) */
+  font-size: 14px;
+  color: #303133;
+  /* 统一行高为 1.5(Element 组件默认行高) */
+  line-height: 1.5;
+  flex: 1;
+  word-break: break-all;
+}
+
+/* 响应式设计 */
+@media (max-width: 768px) {
+  .table-row {
+    flex-direction: column;
+  }
+
+  .table-cell {
+    border-right: none;
+    border-bottom: 1px solid #e0e0e0;
+  }
+
+  .table-cell:last-child {
+    border-bottom: none;
+  }
+}
+
+.daily-report-title {
+  text-align: center;
+  margin: 5px 0;
+  padding: 5px;
+  border-bottom: 2px solid #409eff;
+}
+
+.daily-report-title h2 {
+  margin: 0;
+  color: #303133;
+  font-size: 16px;
+  font-weight: bold;
+}
+
+/* 为第二、三部分增加左右留白 */
+.section-padding {
+  padding-left: 0px;
+  padding-right: 40px;
+}
+:deep(.el-textarea .el-textarea__inner) {
+  min-height: 80px;
+}
+
+/* 确保表单label不换行 */
+:deep(.el-form-item__label) {
+  white-space: nowrap;
+  text-overflow: ellipsis;
+  overflow: hidden;
+}
+
+/* 甲方字段:单行显示+超出省略 */
+.single-line-ellipsis {
+  /* 强制文本单行显示 */
+  white-space: nowrap;
+  /* 超出容器部分隐藏 */
+  overflow: hidden;
+  /* 超出部分显示省略号 */
+  text-overflow: ellipsis;
+  /* 避免文本被截断(可选,根据需求调整) */
+  word-break: normal;
+}
+
+/* 设备配置字段:换行缩进(与首行对齐) */
+.indent-multiline {
+  /* 首行及换行后缩进 2em(与 label 宽度匹配,可根据需求调整) */
+  text-indent: 0em;
+  /* 允许长文本换行(覆盖原有 cell-value 的 break-all,确保中文换行正常) */
+  word-break: break-word;
+  /* 保证换行后文本正常显示(可选,清除可能的 nowrap 影响) */
+  white-space: normal;
+}
+
+/* 审批模式下表单字段的只读样式 */
+:deep(.el-form-item.is-disabled .el-input__inner),
+:deep(.el-form-item.is-disabled .el-textarea__inner) {
+  background-color: #f5f7fa;
+  border-color: #e4e7ed;
+  color: #c0c4cc;
+  cursor: not-allowed;
+}
+
+:deep(.el-form-item.is-disabled .el-select .el-input__inner) {
+  background-color: #f5f7fa;
+  border-color: #e4e7ed;
+  color: #c0c4cc;
+  cursor: not-allowed;
+}
+
+:deep(.el-form-item.is-disabled .el-date-editor .el-input__inner) {
+  background-color: #f5f7fa;
+  border-color: #e4e7ed;
+  color: #c0c4cc;
+  cursor: not-allowed;
+}
+
+/* 只读模式下表单字段的样式 */
+:deep(.el-form-item.is-disabled .el-input__inner),
+:deep(.el-form-item.is-disabled .el-textarea__inner),
+:deep(.el-form-item.is-disabled .el-select .el-input__inner),
+:deep(.el-form-item.is-disabled .el-date-editor .el-input__inner) {
+  background-color: #f5f7fa;
+  border-color: #e4e7ed;
+  color: #606266; /* 保持文字可读性 */
+  cursor: not-allowed;
+}
+
+/* 详情模式下的特殊样式 */
+.detail-mode .cell-value {
+  color: #303133;
+  font-weight: normal;
+}
+
+/* 审批意见文本域样式 */
+:deep(.approval-opinion .el-textarea__inner) {
+  min-height: 100px;
+  resize: vertical;
+}
+
+/* 审批意见标签样式 */
+:deep(.approval-opinion .el-form-item__label) {
+  font-weight: bold;
+  color: #606266;
+}
+
+:deep(.el-transfer-panel) {
+  width: 40% !important;
+}
+
+:deep(.el-transfer-panel__item) {
+  display: flex !important;
+  align-items: center !important;
+  height: 32px !important;
+  line-height: 32px !important;
+  padding: 0 8px !important;
+  margin: 0 !important;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
+:deep(.el-transfer-panel__list) {
+  width: 100% !important;
+}
+
+/* 只读模式下的设备显示样式 */
+:deep(.is-disabled) .device-display-container {
+  background-color: #f5f7fa;
+  color: #606266;
+  cursor: not-allowed;
+}
+</style>

+ 137 - 0
src/views/pms/maintain/MaintainRecordDrawer.vue

@@ -0,0 +1,137 @@
+<template>
+  <el-drawer
+    :title="t('maintain.record')"
+    :append-to-body="true"
+    :model-value="modelValue"
+    @update:model-value="$emit('update:modelValue', $event)"
+    :show-close="false"
+    direction="rtl"
+    :size="computedSize"
+    :before-close="handleClose"
+  >
+    <ContentWrap>
+      <div class="block">
+        <el-timeline>
+          <!-- 循环渲染时间线项 -->
+          <el-timeline-item
+            v-for="(item, index) in timelineData"
+            :key="index"
+            :size="'large'"
+            :timestamp="dayjs(item.repairTime).format('YYYY-MM-DD')"
+            color="#0bbd87"
+            placement="top"
+          >
+            <el-card>
+              <h4>{{ item.repairItem }}</h4>
+              <p
+                >{{ item.createName }} 提交于
+                {{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') }}</p
+              >
+            </el-card>
+          </el-timeline-item>
+        </el-timeline>
+      </div>
+    </ContentWrap>
+  </el-drawer>
+</template>
+<script setup lang="ts">
+import { defineEmits, defineOptions, ref } from 'vue'
+import dayjs from 'dayjs'
+import { IotJdRecordApi } from '@/api/pms/maintain/record'
+
+const { t } = useI18n() // 国际化
+const drawerVisible = ref<boolean>(false)
+const emit = defineEmits(['update:modelValue', 'add'])
+const items = ref([])
+defineOptions({
+  name: 'RouteInspectItemDrawer'
+})
+const windowWidth = ref(window.innerWidth)
+// 动态计算百分比
+const computedSize = computed(() => {
+  return windowWidth.value > 800 ? '30%' : '40%'
+})
+
+const timelineData = ref([])
+// 打开抽屉
+const openDrawer = async (id) => {
+  drawerVisible.value = true
+  timelineData.value = await IotJdRecordApi.getIotJdRecordByRepairId(id)
+}
+
+// 关闭抽屉
+const closeDrawer = () => {
+  drawerVisible.value = false
+}
+
+// 关闭抽屉
+const handleClose = () => {
+  emit('update:modelValue', false)
+}
+defineExpose({ openDrawer, closeDrawer }) // 暴露方法给父组件
+</script>
+
+<style lang="scss" scoped>
+.sortable-container {
+  display: flex;
+  flex-direction: column;
+  gap: 12px;
+  //max-height: 80vh;
+  overflow-y: auto;
+  padding: 8px;
+}
+
+.sortable-item {
+  display: flex;
+  align-items: center;
+  padding: 16px;
+  background: #fff;
+  border: 1px solid #ebeef5;
+  border-radius: 8px;
+  transition:
+    transform 0.3s,
+    box-shadow 0.3s;
+  user-select: none;
+}
+
+.sortable-item:hover {
+  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
+}
+
+.order-number {
+  width: 32px;
+  height: 32px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background: #409eff;
+  color: white;
+  border-radius: 50%;
+  margin-right: 12px;
+  font-weight: bold;
+}
+
+.drag-handle {
+  padding: 0 12px;
+  opacity: 0.4;
+  transition: opacity 0.3s;
+}
+
+.drag-handle:hover {
+  opacity: 1;
+}
+
+.component-content {
+  flex: 1;
+  min-width: 0;
+}
+
+/* 优化滚动条 */
+.sortable-container::-webkit-scrollbar {
+  width: 8px;
+}
+.sortable-container::-webkit-scrollbar-thumb {
+  background: #c0c4cc;
+  border-radius: 4px;
+}
+</style>

+ 213 - 40
src/views/pms/maintain/index.vue

@@ -15,7 +15,11 @@
           :inline="true"
           label-width="68px"
         >
-          <el-form-item :label="t('maintain.faultCode')" prop="failureCode" style="margin-left: 25px">
+          <el-form-item
+            :label="t('maintain.faultCode')"
+            prop="failureCode"
+            style="margin-left: 25px"
+          >
             <el-input
               v-model="queryParams.failureCode"
               :placeholder="t('maintain.codeHolder')"
@@ -63,7 +67,12 @@
               />
             </el-select>
           </el-form-item>
-          <el-form-item :label="t('maintain.failureTime')" v-show="ifShow" prop="failureTime" style="margin-left: 25px">
+          <el-form-item
+            :label="t('maintain.failureTime')"
+            v-show="ifShow"
+            prop="failureTime"
+            style="margin-left: 25px"
+          >
             <el-date-picker
               v-model="queryParams.failureTime"
               value-format="YYYY-MM-DD HH:mm:ss"
@@ -105,25 +114,27 @@
             </el-select>
           </el-form-item>
           <el-form-item>
-            <el-button v-if="!ifShow" @click="moreQuery(true)" type="warning"><Icon icon="ep:search" class="mr-5px"/>
-              {{ t('maintain.moreSearch') }}</el-button>
-            <el-button v-if="ifShow" @click="moreQuery(false)" type="danger"><Icon icon="ep:search" class="mr-5px"/>  {{ t('maintain.closeSearch') }}</el-button>
-            <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> {{ t('maintain.search') }}</el-button>
-            <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> {{ t('maintain.reset') }}</el-button>
+            <el-button v-if="!ifShow" @click="moreQuery(true)" type="warning"
+              ><Icon icon="ep:search" class="mr-5px" /> {{ t('maintain.moreSearch') }}</el-button
+            >
+            <el-button v-if="ifShow" @click="moreQuery(false)" type="danger"
+              ><Icon icon="ep:search" class="mr-5px" /> {{ t('maintain.closeSearch') }}</el-button
+            >
+            <el-button @click="handleQuery"
+              ><Icon icon="ep:search" class="mr-5px" /> {{ t('maintain.search') }}</el-button
+            >
+            <el-button @click="resetQuery"
+              ><Icon icon="ep:refresh" class="mr-5px" /> {{ t('maintain.reset') }}</el-button
+            >
             <el-button
               type="primary"
               plain
               @click="openForm('create')"
               v-hasPermi="['rq:iot-maintain:create']"
-              >
-              <Icon icon="ep:plus" class="mr-5px" />  {{ t('maintain.added') }}
-            </el-button>
-            <el-button
-              type="success"
-              plain
-              @click="handleExport"
-              :loading="exportLoading"
             >
+              <Icon icon="ep:plus" class="mr-5px" /> {{ t('maintain.added') }}
+            </el-button>
+            <el-button type="success" plain @click="handleExport" :loading="exportLoading">
               <Icon icon="ep:download" class="mr-5px" /> 导出
             </el-button>
           </el-form-item>
@@ -138,20 +149,50 @@
               {{ scope.$index + 1 }}
             </template>
           </el-table-column>
-          <el-table-column :label="t('iotDevice.code')" align="center" prop="deviceCode" min-width="180" />
-          <el-table-column :label="t('maintain.deviceName')" align="center" prop="deviceName" min-width="280" />
-          <el-table-column :label="t('maintain.status')" align="center" prop="status" min-width="95" >
+          <el-table-column
+            :label="t('iotDevice.code')"
+            align="center"
+            prop="deviceCode"
+            min-width="180"
+          />
+          <el-table-column
+            :label="t('maintain.deviceName')"
+            align="center"
+            prop="deviceName"
+            min-width="280"
+          />
+          <el-table-column
+            :label="t('maintain.status')"
+            align="center"
+            prop="status"
+            min-width="95"
+          >
             <template #default="scope">
               <dict-tag :type="DICT_TYPE.PMS_MAIN_STATUS" :value="scope.row.status" />
             </template>
           </el-table-column>
-          <el-table-column :label="t('maintain.source')" align="center" prop="maintainType" min-width="135"/>
-          <el-table-column :label="t('iotMaintain.repairType')" align="center" prop="type" min-width="135">
+          <el-table-column
+            :label="t('maintain.source')"
+            align="center"
+            prop="maintainType"
+            min-width="135"
+          />
+          <el-table-column
+            :label="t('iotMaintain.repairType')"
+            align="center"
+            prop="type"
+            min-width="135"
+          >
             <template #default="scope">
               <dict-tag :type="DICT_TYPE.PMS_MAIN_TYPE" :value="scope.row.type" />
             </template>
           </el-table-column>
-          <el-table-column :label="t('maintain.shutDown')" align="center" prop="ifStop"  min-width="135">
+          <el-table-column
+            :label="t('maintain.shutDown')"
+            align="center"
+            prop="ifStop"
+            min-width="135"
+          >
             <template #default="scope">
               <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.ifStop" />
             </template>
@@ -163,9 +204,24 @@
             :formatter="dateFormatter"
             min-width="180px"
           />
-          <el-table-column :label="t('iotMaintain.oaFlowNo')" align="center" prop="oaFlowNo" min-width="250" />
-          <el-table-column :label="t('maintain.dept')" align="center" prop="deptName" min-width="135"/>
-          <el-table-column :label="t('inspect.createName')" align="center" prop="createName" min-width="130"/>
+          <el-table-column
+            :label="t('iotMaintain.oaFlowNo')"
+            align="center"
+            prop="oaFlowNo"
+            min-width="250"
+          />
+          <el-table-column
+            :label="t('maintain.dept')"
+            align="center"
+            prop="deptName"
+            min-width="135"
+          />
+          <el-table-column
+            :label="t('inspect.createName')"
+            align="center"
+            prop="createName"
+            min-width="130"
+          />
           <el-table-column
             label="创建时间"
             align="center"
@@ -173,26 +229,82 @@
             :formatter="dateFormatter"
             width="180px"
           />
-          <el-table-column :label="t('maintain.operation')" align="center" min-width="170" fixed="right">
+          <el-table-column
+            :label="t('maintain.operation')"
+            align="center"
+            min-width="170"
+            fixed="right"
+          >
             <template #default="scope">
+              <el-button link type="primary" @click="detail(scope.row.id)">
+                {{ t('maintain.view') }}
+              </el-button>
               <el-button
                 link
-                type="primary"
-                @click="detail(scope.row.id)"
+                v-if="
+                  scope.row.status === 'tx' &&
+                  (scope.row.auditStatus === 20 || scope.row.auditStatus === null)
+                "
+                type="danger"
+                @click="
+                  openForm('update', scope.row.id, scope.row.maintainPerson, scope.row.company)
+                "
               >
-                {{ t('maintain.view') }}
+                {{ t('maintain.fill') }}
               </el-button>
               <el-button
                 link
-                v-if="scope.row.status==='tx'&&(scope.row.auditStatus===20||scope.row.auditStatus===null)"
+                v-if="scope.row.status === 'personnel' && userid === scope.row.maintainPerson"
                 type="danger"
-                @click="openForm('update',scope.row.id)"
+                @click="openDialog(scope.row.id)"
               >
-                {{ t('maintain.fill') }}
+                {{ t('maintain.maintainWay') }}
+              </el-button>
+              <el-button
+                v-if="scope.row.status!=='personnel'"
+                link
+                type="warning"
+                @click="openRecord(scope.row.id)"
+              >
+                {{ t('maintain.record') }}
               </el-button>
             </template>
           </el-table-column>
         </el-table>
+        <el-dialog
+          v-model="dialogVisible"
+          title="维修方式"
+          :width="600"
+          :before-close="handleClose"
+          append-to-body
+          :close-on-click-modal="false"
+        >
+          <el-form ref="methodFormRef" :model="form" :rules="rules" label-width="70px">
+            <el-form-item label="维修方式" prop="maintainMethod">
+              <el-select v-model="form.maintainMethod" placeholder="请选择维修方式">
+                <el-option
+                  v-for="dict in getStrDictOptions(DICT_TYPE.PMS_MAINTAIN_METHOD)"
+                  :key="dict.label"
+                  :label="dict.label"
+                  :value="dict.value"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="备注说明" prop="methodDescription">
+              <el-input
+                type="textarea"
+                v-model="form.methodDescription"
+                placeholder="请输入备注说明"
+                :rows="4"
+                resize="none"
+              />
+            </el-form-item>
+          </el-form>
+          <template #footer>
+            <el-button @click="handleCancel">取消</el-button>
+            <el-button type="primary" @click="handleConfirm">确定</el-button>
+          </template>
+        </el-dialog>
         <!-- 分页 -->
         <Pagination
           :total="total"
@@ -202,7 +314,7 @@
         />
       </ContentWrap>
     </el-col>
-    </el-row>
+  </el-row>
   <!-- 表单弹窗:添加/修改 -->
 </template>
 
@@ -210,9 +322,9 @@
 import { dateFormatter } from '@/utils/formatTime'
 import download from '@/utils/download'
 import { IotMaintainApi, IotMaintainVO } from '@/api/pms/maintain'
-import IotMaintainForm from './IotMaintainForm.vue'
-import DeptTree from "@/views/system/user/DeptTree.vue";
-import {DICT_TYPE, getStrDictOptions,getBoolDictOptions} from "@/utils/dict";
+import DeptTree from '@/views/system/user/DeptTree.vue'
+import { DICT_TYPE, getBoolDictOptions, getStrDictOptions } from '@/utils/dict'
+import { useUserStore } from '@/store/modules/user'
 
 /** 维修工单 列表 */
 defineOptions({ name: 'IotMaintain' })
@@ -224,6 +336,7 @@ const ifShow = ref(false)
 const loading = ref(true) // 列表的加载中
 const list = ref<IotMaintainVO[]>([]) // 列表的数据
 const total = ref(0) // 列表的总页数
+const dialogVisible = ref(false)
 const queryParams = reactive({
   pageNo: 1,
   pageSize: 10,
@@ -245,24 +358,82 @@ const queryParams = reactive({
   deviceName: undefined,
   processInstanceId: undefined,
   auditStatus: undefined,
-  deptId: undefined,
+  deptId: undefined
 })
 const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中
 const moreQuery = (show) => {
   ifShow.value = show
 }
-const openForm = (type: string, id?: number) => {
+// 表单验证规则
+const rules = {
+  methodDescription: [{ required: true, message: '请输入备注说明', trigger: 'blur' }],
+  maintainMethod: [{ required: true, message: '请选择维修方式', trigger: 'blur' }]
+}
+
+// 确定按钮处理
+const handleConfirm = async () => {
+  // 表单验证
+  try {
+    debugger
+    await methodFormRef.value.validate()
+    // 验证通过,调用接口
+    await IotMaintainApi.maintainMethod(form)
+    ElMessage.success('操作成功')
+    dialogVisible.value = false
+    resetForm()
+  } catch (error) {
+    return
+  }
+}
+
+// 取消按钮处理
+const handleCancel = () => {
+  dialogVisible.value = false
+  resetForm()
+}
+
+const methodFormRef = ref(null)
+const form = reactive({
+  id: undefined,
+  maintainMethod: '',
+  methodDescription: ''
+})
+// 关闭对话框前的回调
+const handleClose = () => {
+  resetForm()
+}
+// 重置表单
+const resetForm = () => {
+  methodFormRef.value?.resetFields()
+}
+// 打开对话框
+const openDialog = (id: number) => {
+  dialogVisible.value = true
+  form.id = id
+  form.maintainMethod = ''
+  form.methodDescription = ''
+}
+
+const openRecord = async (id?: number) => {
+  await push({ name: 'MaintainRecord', params: {id} })
+}
+
+const openForm = async (type: string, id?: number, person: any, company) => {
+  if (company === 'rh' && person === userid.value) {
+    message.error('维修人员无法填写工单')
+    return
+  }
   //修改
   if (typeof id === 'number') {
-    push({ name: 'MaintainAdd', params: {id } })
+    await push({ name: 'MaintainAdd', params: { id } })
     return
   }
   // 新增
-  push({ name: 'MaintainAdd', params:{} })
+  await push({ name: 'MaintainAdd', params: {} })
 }
 const detail = (id?: number) => {
-  push({ name: 'MaintainDetail', params:{id} })
+  push({ name: 'MaintainDetail', params: { id } })
 }
 /** 查询列表 */
 const getList = async () => {
@@ -320,8 +491,10 @@ const handleExport = async () => {
   }
 }
 
+const userid = ref()
 /** 初始化 **/
 onMounted(() => {
   getList()
+  userid.value = useUserStore().getUser.id
 })
 </script>

+ 176 - 0
src/views/pms/maintain/record/IotJdRecordForm.vue

@@ -0,0 +1,176 @@
+<template>
+  <Dialog :title="dialogTitle" v-model="dialogVisible">
+    <el-form
+      ref="formRef"
+      :model="formData"
+      :rules="formRules"
+      label-width="100px"
+      v-loading="formLoading"
+    >
+      <el-row>
+      <el-col :span="12">
+      <el-form-item label="维修时间" prop="repairTime">
+        <el-date-picker
+          v-model="formData.repairTime"
+          type="datetime"
+          value-format="x"
+          placeholder="选择维修时间"
+        />
+      </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="维修项" prop="repairItem">
+            <el-input v-model="formData.repairItem" />
+          </el-form-item>
+        </el-col>
+      <el-col :span="12">
+      <el-form-item label="图片" prop="pic">
+        <UploadImg v-model="formData.pic" height="50px" />
+      </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item :label="t('maintain.phRepair')" prop="repairPerson">
+            <el-select multiple v-model="formData.repairPerson" :placeholder="t('maintain.phRepairHolder')" filterable clearable>
+              <el-option
+                v-for="ap in repairPeople"
+                :key="ap.id"
+                :label="ap.nickname"
+                :value="ap.id"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+      <el-form-item label="维修内容" prop="repairContent">
+        <el-input type="textarea" v-model="formData.repairContent" />
+      </el-form-item>
+        </el-col>
+        <el-col :span="24">
+      <el-form-item label="解决办法" prop="solution">
+        <el-input type="textarea" v-model="formData.solution" placeholder="请输入解决办法" />
+      </el-form-item>
+        </el-col>
+        <el-col :span="24">
+      <el-form-item label="备注" prop="remark">
+        <el-input type="textarea" v-model="formData.remark" placeholder="请输入备注" />
+      </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <template #footer>
+      <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
+      <el-button @click="dialogVisible = false">取 消</el-button>
+    </template>
+  </Dialog>
+</template>
+<script setup lang="ts">
+import { IotJdRecordApi, IotJdRecordVO } from '@/api/pms/maintain/record'
+import {ModelVO} from "@/api/ai/model/model";
+
+/** 基地维修记录 表单 */
+defineOptions({ name: 'IotJdRecordForm' })
+
+const { t } = useI18n() // 国际化
+const message = useMessage() // 消息弹窗
+
+const dialogVisible = ref(false) // 弹窗的是否展示
+const repairPeople = ref([])
+const dialogTitle = ref('') // 弹窗的标题
+const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
+const formType = ref('') // 表单的类型:create - 新增;update - 修改
+const formData = ref({
+  repairPerson:undefined,
+  repairPersonName:undefined,
+  repairItem: undefined,
+  id: undefined,
+  deviceId: undefined,
+  repairTime: undefined,
+  repairContent: undefined,
+  pic: undefined,
+  solution: undefined,
+  remark: undefined,
+  deviceName: undefined,
+  repairId: undefined,
+})
+const formRules = reactive({
+  repairPerson: [{ required: true, message: '设备id不能为空', trigger: 'blur' }],
+  deviceId: [{ required: true, message: '设备id不能为空', trigger: 'blur' }],
+  repairTime: [{ required: true, message: '维修日期时间不能为空', trigger: 'blur' }],
+  repairContent: [{ required: true, message: '维修内容不能为空', trigger: 'blur' }],
+  solution: [{ required: true, message: '解决办法不能为空', trigger: 'blur' }],
+  repairItem: [{ required: true, message: '维修项不能为空', trigger: 'blur' }],
+})
+const formRef = ref() // 表单 Ref
+
+/** 打开弹窗 */
+const open = async (type: string, id?: number, recordId:any) => {
+  dialogVisible.value = true
+  dialogTitle.value = t('action.' + type)
+  formType.value = type
+  resetForm()
+  formData.value.repairId = id
+  // 修改时,设置数据
+  if (recordId) {
+    formLoading.value = true
+    try {
+      const data = await IotJdRecordApi.getIotJdRecord(recordId)
+      formData.value = data
+    } finally {
+      formLoading.value = false
+    }
+  }
+  const assist = await IotJdRecordApi.getIotJdRecordAssist(id)
+  repairPeople.value = assist
+}
+defineExpose({ open }) // 提供 open 方法,用于打开弹窗
+
+/** 提交表单 */
+const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
+const submitForm = async () => {
+  // 校验表单
+  await formRef.value.validate()
+  // 提交请求
+  formLoading.value = true
+  try {
+    let personName = []
+    console.log(JSON.stringify(formData.value.repairPerson))
+    formData.value.repairPerson.map((repairPersonKey)=>{
+      const person = repairPeople.value.filter((item) => item.id ===repairPersonKey)
+      if (person.length>0){
+        personName.push(person[0].nickname)
+      }
+    })
+    debugger
+    formData.value.repairPerson = formData.value.repairPerson.join(',')
+    formData.value.repairPersonName = personName.join(',')
+    const data = formData.value as unknown as IotJdRecordVO
+    if (formType.value === 'create') {
+      await IotJdRecordApi.createIotJdRecord(data)
+      message.success(t('common.createSuccess'))
+    } else {
+      await IotJdRecordApi.updateIotJdRecord(data)
+      message.success(t('common.updateSuccess'))
+    }
+    dialogVisible.value = false
+    // 发送操作成功的事件
+    emit('success')
+  } finally {
+    formLoading.value = false
+  }
+}
+
+/** 重置表单 */
+const resetForm = () => {
+  formData.value = {
+    id: undefined,
+    deviceId: undefined,
+    repairTime: undefined,
+    repairContent: undefined,
+    pic: undefined,
+    solution: undefined,
+    remark: undefined,
+    deviceName: undefined,
+  }
+  formRef.value?.resetFields()
+}
+</script>

+ 252 - 0
src/views/pms/maintain/record/index.vue

@@ -0,0 +1,252 @@
+<template>
+  <ContentWrap>
+    <!-- 搜索工作栏 -->
+    <el-form
+      class="-mb-15px"
+      :model="queryParams"
+      ref="queryFormRef"
+      :inline="true"
+      label-width="68px"
+    >
+      <el-form-item label="设备id" prop="deviceId">
+        <el-input
+          v-model="queryParams.deviceId"
+          placeholder="请输入设备id"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item label="维修日期时间" prop="repairTime">
+        <el-date-picker
+          v-model="queryParams.repairTime"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          type="daterange"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+          class="!w-220px"
+        />
+      </el-form-item>
+      <el-form-item label="图片" prop="pic">
+        <el-input
+          v-model="queryParams.pic"
+          placeholder="请输入图片"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item label="解决办法" prop="solution">
+        <el-input
+          v-model="queryParams.solution"
+          placeholder="请输入解决办法"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item label="备注" prop="remark">
+        <el-input
+          v-model="queryParams.remark"
+          placeholder="请输入备注"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item label="创建时间" prop="createTime">
+        <el-date-picker
+          v-model="queryParams.createTime"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          type="daterange"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+          class="!w-220px"
+        />
+      </el-form-item>
+      <el-form-item label="设备名称" prop="deviceName">
+        <el-input
+          v-model="queryParams.deviceName"
+          placeholder="请输入设备名称"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
+        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
+        <el-button
+          type="primary"
+          plain
+          @click="openForm('create')"
+          v-hasPermi="['rq:iot-jd-record:create']"
+        >
+          <Icon icon="ep:plus" class="mr-5px" /> 新增
+        </el-button>
+        <el-button
+          type="success"
+          plain
+          @click="handleExport"
+          :loading="exportLoading"
+          v-hasPermi="['rq:iot-jd-record:export']"
+        >
+          <Icon icon="ep:download" class="mr-5px" /> 导出
+        </el-button>
+      </el-form-item>
+    </el-form>
+  </ContentWrap>
+
+  <!-- 列表 -->
+  <ContentWrap>
+    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
+      <el-table-column label="主键id" align="center" prop="id" />
+      <el-table-column label="设备id" align="center" prop="deviceId" />
+      <el-table-column
+        label="维修日期时间"
+        align="center"
+        prop="repairTime"
+        :formatter="dateFormatter"
+        width="180px"
+      />
+      <el-table-column label="维修内容" align="center" prop="repairContent" />
+      <el-table-column label="图片" align="center" prop="pic" />
+      <el-table-column label="解决办法" align="center" prop="solution" />
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column
+        label="创建时间"
+        align="center"
+        prop="createTime"
+        :formatter="dateFormatter"
+        width="180px"
+      />
+      <el-table-column label="设备名称" align="center" prop="deviceName" />
+      <el-table-column label="操作" align="center" min-width="120px">
+        <template #default="scope">
+          <el-button
+            link
+            type="primary"
+            @click="openForm('update', scope.row.id)"
+            v-hasPermi="['rq:iot-jd-record:update']"
+          >
+            编辑
+          </el-button>
+          <el-button
+            link
+            type="danger"
+            @click="handleDelete(scope.row.id)"
+            v-hasPermi="['rq:iot-jd-record:delete']"
+          >
+            删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 分页 -->
+    <Pagination
+      :total="total"
+      v-model:page="queryParams.pageNo"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </ContentWrap>
+
+  <!-- 表单弹窗:添加/修改 -->
+  <IotJdRecordForm ref="formRef" @success="getList" />
+</template>
+
+<script setup lang="ts">
+import { dateFormatter } from '@/utils/formatTime'
+import download from '@/utils/download'
+import { IotJdRecordApi, IotJdRecordVO } from '@/api/pms/maintain/record'
+import IotJdRecordForm from './IotJdRecordForm.vue'
+
+/** 基地维修记录 列表 */
+defineOptions({ name: 'IotJdRecord' })
+
+const message = useMessage() // 消息弹窗
+const { t } = useI18n() // 国际化
+
+const loading = ref(true) // 列表的加载中
+const list = ref<IotJdRecordVO[]>([]) // 列表的数据
+const total = ref(0) // 列表的总页数
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  deviceId: undefined,
+  repairTime: [],
+  repairContent: undefined,
+  pic: undefined,
+  solution: undefined,
+  remark: undefined,
+  createTime: [],
+  deviceName: undefined,
+})
+const queryFormRef = ref() // 搜索的表单
+const exportLoading = ref(false) // 导出的加载中
+
+/** 查询列表 */
+const getList = async () => {
+  loading.value = true
+  try {
+    const data = await IotJdRecordApi.getIotJdRecordPage(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 搜索按钮操作 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+
+/** 重置按钮操作 */
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+
+/** 添加/修改操作 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+  formRef.value.open(type, id)
+}
+
+/** 删除按钮操作 */
+const handleDelete = async (id: number) => {
+  try {
+    // 删除的二次确认
+    await message.delConfirm()
+    // 发起删除
+    await IotJdRecordApi.deleteIotJdRecord(id)
+    message.success(t('common.delSuccess'))
+    // 刷新列表
+    await getList()
+  } catch {}
+}
+
+/** 导出按钮操作 */
+const handleExport = async () => {
+  try {
+    // 导出的二次确认
+    await message.exportConfirm()
+    // 发起导出
+    exportLoading.value = true
+    const data = await IotJdRecordApi.exportIotJdRecord(queryParams)
+    download.excel(data, '基地维修记录.xls')
+  } catch {
+  } finally {
+    exportLoading.value = false
+  }
+}
+
+/** 初始化 **/
+onMounted(() => {
+  getList()
+})
+</script>