Browse Source

Merge remote-tracking branch 'origin/master'

zhangcl 3 tuần trước cách đây
mục cha
commit
16d4bb5a86

+ 4 - 0
src/api/pms/iotdeviceperson/index.ts

@@ -12,6 +12,10 @@ export interface IotDevicePersonVO {
 
 // 设备负责人分配 API
 export const IotDevicePersonApi = {
+  // 查询设备负责人分配分页
+  ifDuty: async (params: any) => {
+    return await request.get({ url: `/pms/iot-device-person/if/duty/`+params })
+  },
   // 查询设备负责人分配分页
   getIotDevicePersonPage: async (params: any) => {
     return await request.get({ url: `/pms/iot-device-person/page`, params })

+ 9 - 6
src/api/pms/stat/index.ts

@@ -6,7 +6,7 @@ export const IotStatApi = {
     return await request.get({ url: `/rq/stat/main/day` })
   },
   getOrderSeven: async (params: any) => {
-    return await request.get({ url: `/rq/stat/rh/order` })
+    return await request.get({ url: `/rq/stat/rh/order/`+params })
   },
   getMainWeek: async (params: any) => {
     return await request.get({ url: `/rq/stat/main/week` })
@@ -35,6 +35,9 @@ export const IotStatApi = {
   getInspectStatus: async (params: any) => {
     return await request.get({ url: `/rq/stat/inspect/status`, params })
   },
+  getInspectStatuss: async (params: any, dept:any) => {
+    return await request.get({ url: `/rq/stat/inspect/statuss/`+dept, params })
+  },
   getInspectTodayStatus: async (params: any) => {
     return await request.get({ url: `/rq/stat/inspect/today/status` })
   },
@@ -57,7 +60,7 @@ export const IotStatApi = {
     return await request.get({ url: `/rq/stat/maintenance/total` })
   },
   getMaintenanceStatus: async (params: any) => {
-    return await request.get({ url: `/rq/stat/maintenance/status` })
+    return await request.get({ url: `/rq/stat/maintenance/status/`+params })
   },
   getMaintenanceTodayStatus: async (params: any) => {
     return await request.get({ url: `/rq/stat/maintenance/today/status` })
@@ -71,10 +74,10 @@ export const IotStatApi = {
 
 
   getDeviceCount: async (params: any) => {
-    return await request.get({ url: `/rq/stat/home/device/count` })
+    return await request.get({ url: `/rq/stat/home/device/count/`+params })
   },
   getMaintainCount: async (params: any) => {
-    return await request.get({ url: `/rq/stat/home/maintain/count` })
+    return await request.get({ url: `/rq/stat/home/maintain/count/`+params })
   },
   getMainWorkCount: async (params: any) => {
     return await request.get({ url: `/rq/stat/home/work/count` })
@@ -83,11 +86,11 @@ export const IotStatApi = {
     return await request.get({ url: `/rq/stat/home/inspect/count` })
   },
   getDeviceStatusCount: async (params: any) => {
-    return await request.get({ url: `/rq/stat/home/device/status` })
+    return await request.get({ url: `/rq/stat/home/device/status/`+params })
   },
 
   getDeviceTypeCount: async (params: any) => {
-    return await request.get({ url: `/rq/stat/home/device/type` })
+    return await request.get({ url: `/rq/stat/home/device/type/`+params })
   },
   getDeptCount: async (params: any) => {
     return await request.get({ url: `/rq/stat/home/dept` })

+ 17 - 3
src/router/modules/remaining.ts

@@ -306,25 +306,38 @@ const remainingRouter: AppRouteRecordRaw[] = [
     ]
   },
   {
-    path: '/fillOrderInfo',
+    path: '/FillOrderInfo',
     component: Layout,
     name: 'FillOrderInfo',
     meta: {
-      hidden: true
+      hidden: true,
+      keepAlive: true
     },
     children: [
       {
         path: 'template/detail/:id',
-        component: () => import('@/views/pms/iotopeationfill/index1.vue'),
+        component: () => import('@/views/pms/iotopeationfill/index1.vue'+''),
         name: 'FillOrderInfo',
         meta: {
           title: t('rem.FillInInformation'),
           noCache: false,
           hidden: true,
           canTo: true,
+          keepAlive: true,
           activeMenu: '/template/info'
         }
       },
+    ]
+  },
+  {
+    path: '/FillOrderInfoS',
+    component: Layout,
+    name: 'FillOrderInfoS',
+    meta: {
+      hidden: true,
+      keepAlive: true
+    },
+    children: [
       {
         path: 'template/detail/:deptId/:orderStatus/:createTime*',
         component: () => import('@/views/pms/iotopeationfill/index.vue'),
@@ -334,6 +347,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
           noCache: false,
           hidden: true,
           canTo: true,
+          keepAlive: true,
           activeMenu: '/template/info'
         }
       },

+ 7 - 3
src/views/pms/inspect/plan/InspectRouteList.vue

@@ -75,11 +75,11 @@
         v-loading="loading"
         :data="list"
         :stripe="true"
+        :row-key="rowKey"
         :show-overflow-tooltip="true"
+        table-layout="auto"
         @row-click="handleRowClick"
-        row-key="id"
-        @selection-change="handleSelectionChange"
-      >
+        class="full-width-table" >
         <el-table-column width="80" :label="t('workOrderMaterial.select')">
           <template #default="{ row }">
             <el-checkbox
@@ -152,6 +152,10 @@ const queryParams = reactive({
   deviceCode: undefined,
   routeName: undefined,
 })
+// 生成行唯一标识
+const rowKey = (row: any) => {
+  return `${row.id}`; // 确保行更新时重新渲染
+};
 // 处理单选逻辑
 const selectRow = (row) => {
   const index = selectedRows.value.findIndex(item => item.id === row.id&&item.deviceCode===row.deviceCode);

+ 14 - 14
src/views/pms/stat/inspect.vue

@@ -189,20 +189,20 @@
       <el-card class="chart-card" shadow="never">
         <template #header>
           <div class="flex items-center">
-            <span class="text-base font-medium text-gray-600">设备状态统计</span>
+            <span class="text-base font-medium text-gray-600">工单状态统计</span>
           </div>
         </template>
         <el-row class="h-[220px]">
           <el-col :span="12" class="flex flex-col items-center">
-            <div ref="writeTodayChartRef" class="h-[160px] w-full"></div>
-            <div class="text-center mt-2" >
-              <span class="text-sm text-gray-600" style="text-decoration: underline;color: orangered;cursor: pointer" @click="clickStatus('设备待执行')">未填写</span>
+            <div ref="finishedChartRef" class="h-[160px] w-full"></div>
+            <div class="text-center mt-2">
+              <span class="text-sm text-gray-600" style="text-decoration: underline;color: dodgerblue;cursor: pointer" @click="clickStatus('工单已执行')">已执行</span>
             </div>
           </el-col>
           <el-col :span="12" class="flex flex-col items-center">
-            <div ref="finishedTodayChartRef" class="h-[160px] w-full"></div>
+            <div ref="writeChartRef" class="h-[160px] w-full"></div>
             <div class="text-center mt-2">
-              <span class="text-sm text-gray-600" style="text-decoration: underline;color: dodgerblue;cursor: pointer" @click="clickStatus('设备已执行')">已填写</span>
+              <span class="text-sm text-gray-600" style="text-decoration: underline;color: orangered;cursor: pointer" @click="clickStatus('工单待执行')">待执行</span>
             </div>
           </el-col>
         </el-row>
@@ -212,20 +212,20 @@
       <el-card class="chart-card" shadow="never">
         <template #header>
           <div class="flex items-center">
-            <span class="text-base font-medium text-gray-600">工单状态统计</span>
+            <span class="text-base font-medium text-gray-600">设备状态统计</span>
           </div>
         </template>
         <el-row class="h-[220px]">
           <el-col :span="12" class="flex flex-col items-center">
-            <div ref="writeChartRef" class="h-[160px] w-full"></div>
+            <div ref="finishedTodayChartRef" class="h-[160px] w-full"></div>
             <div class="text-center mt-2">
-              <span class="text-sm text-gray-600" style="text-decoration: underline;color: orangered;cursor: pointer" @click="clickStatus('工单待执行')">待执行</span>
+              <span class="text-sm text-gray-600" style="text-decoration: underline;color: dodgerblue;cursor: pointer" @click="clickStatus('设备已执行')">已填写</span>
             </div>
           </el-col>
           <el-col :span="12" class="flex flex-col items-center">
-            <div ref="finishedChartRef" class="h-[160px] w-full"></div>
-            <div class="text-center mt-2">
-              <span class="text-sm text-gray-600" style="text-decoration: underline;color: dodgerblue;cursor: pointer" @click="clickStatus('工单已执行')">已执行</span>
+            <div ref="writeTodayChartRef" class="h-[160px] w-full"></div>
+            <div class="text-center mt-2" >
+              <span class="text-sm text-gray-600" style="text-decoration: underline;color: orangered;cursor: pointer" @click="clickStatus('设备待执行')">未填写</span>
             </div>
           </el-col>
         </el-row>
@@ -597,14 +597,14 @@ const initGaugeChart = (el: any, value: number, color: string, type: string) =>
         max: value, // 使用设备总数作为最大值
         progress: {
           show: true,
-          width: 25,
+          width: 15,
           itemStyle: {
             color: color
           }
         },
         axisLine: {
           lineStyle: {
-            width: 25,
+            width: 15,
             color: [[1, '#E5E7EB']]
           }
         },

+ 10 - 10
src/views/pms/stat/rdkb.vue

@@ -151,17 +151,17 @@
                   <div class="flex flex-col items-center">
                     <Icon icon="fa-solid:list" size="30" color="blue" />
                     <p style="font-size: 20px; margin-top: 5px">总工单数</p>
-                    <span style="font-size: 20px">{{ by.finished + by.todo }}</span>
+                    <span style="font-size: 20px">{{ (by.finished?by.finished:0) + (by.todo?by.todo:0) }}</span>
                   </div>
                   <div class="flex flex-col items-center">
                     <Icon icon="fa-solid:check-circle" size="30" color="green" />
                     <p style="font-size: 20px; margin-top: 5px">已执行工单数</p>
-                    <span style="font-size: 20px">{{ by.finished }}</span>
+                    <span style="font-size: 20px">{{ by.finished?by.finished:0 }}</span>
                   </div>
                   <div class="flex flex-col items-center">
                     <Icon icon="fa-solid:hourglass-half" size="30" color="orange" />
                     <p style="font-size: 20px; margin-top: 5px">待执行工单数 </p>
-                    <span style="font-size: 20px">{{ by.todo }}</span>
+                    <span style="font-size: 20px">{{ by.todo?by.todo:0 }}</span>
                   </div>
                 </div>
               </div>
@@ -314,21 +314,21 @@ const totalMaterialCost = computed(() => {
 })
 
 const getStats = () => {
-  IotStatApi.getDeviceStatusCount().then((res) => {
+  IotStatApi.getDeviceStatusCount('rd').then((res) => {
     typeData.value = res
     initDeviceStatusCharts()
   })
-  IotStatApi.getOrderSeven().then((res) => {
+  IotStatApi.getOrderSeven('rd').then((res) => {
     orderSevenData.value = res
     initQxChart()
   })
-  IotStatApi.getDeviceCount().then((res) => {
+  IotStatApi.getDeviceCount("rd").then((res) => {
     device.value = res
   })
-  IotStatApi.getMaintainCount().then((res) => {
+  IotStatApi.getMaintainCount("rd").then((res) => {
     maintain.value = res
   })
-  IotStatApi.getMaintenanceStatus().then((res) => {
+  IotStatApi.getMaintenanceStatus("rd").then((res) => {
     by.value = res
     initMaintenanceChart()
   })
@@ -339,11 +339,11 @@ const getStats = () => {
     deptId: null, // 选中的部门ID
     status: null // 填写状态
   })
-  IotStatApi.getInspectStatus(fillQueryParams).then((res) => {
+  IotStatApi.getInspectStatuss(fillQueryParams,'rd').then((res) => {
     inspect.value = res
     initInspectChart()
   })
-  fillQueryParams.deptId = useUserStore().getUser.deptId
+  fillQueryParams.deptId = '163'
   IotStatApi.getDeptStatistics(fillQueryParams).then((res) => {
     fill.value = res.totalList[0] || []
   })

+ 9 - 9
src/views/pms/stat/rhkb.vue

@@ -251,10 +251,10 @@ const safe = ref()
 const getStats =  () => {
   initYwcbChart()
   // 获取基础统计数据
-  IotStatApi.getDeviceCount().then((res) => {
+  IotStatApi.getDeviceCount("rh").then((res) => {
     device.value = res
   })
-  IotStatApi.getMaintainCount().then((res) => {
+  IotStatApi.getMaintainCount("rh").then((res) => {
     maintain.value = res
   })
   IotStatApi.getMainWorkCount().then((res) => {
@@ -272,7 +272,7 @@ const getStats =  () => {
     initTopChart()
   })
 
-  IotStatApi.getDeviceStatusCount().then((res) => {
+  IotStatApi.getDeviceStatusCount('rh').then((res) => {
     typeData.value = res
     initDeviceStatusCharts()
   })
@@ -284,13 +284,13 @@ const getStats =  () => {
     initMaterials()
   })
 
-  IotStatApi.getOrderSeven().then((res) => {
+  IotStatApi.getOrderSeven('rh').then((res) => {
     orderSevenData.value = res
     initQxChart();
   })
-  IotStatApi.getMaintenanceStatus().then((res) => {
+  IotStatApi.getMaintenanceStatus("rh").then((res) => {
     by.value = res
-    initMaintenanceChart()
+
   })
   const fillQueryParams = reactive({
     startTime: Date.now() - 7 * 24 * 60 * 60 * 1000, // 设置默认开始时间为 7 天前
@@ -299,10 +299,10 @@ const getStats =  () => {
     deptId: null, // 选中的部门ID
     status: null // 填写状态
   })
-  IotStatApi.getInspectStatus(fillQueryParams).then((res) => {
+  IotStatApi.getInspectStatuss(fillQueryParams,'rh').then((res) => {
     inspectt.value = res
   })
-  fillQueryParams.deptId = useUserStore().getUser.deptId
+  fillQueryParams.deptId = '157'
   IotStatApi.getDeptStatistics(fillQueryParams).then((res) => {
     fill.value = res.totalList[0] || []
   })
@@ -579,7 +579,7 @@ const getTopOption = () => {
 
 // 初始化图表
 const initTopChart = async () => {
-  await IotStatApi.getDeviceTypeCount().then((res) => {
+  await IotStatApi.getDeviceTypeCount('rh').then((res) => {
     backendData.value = res
   })
   if (!topContainer.value) return

+ 9 - 9
src/views/pms/stat/rykb.vue

@@ -313,10 +313,10 @@ const drillingWellChartRef = ref()
 const getStats =  () => {
   initYwcbChart()
   // 获取基础统计数据
-  IotStatApi.getDeviceCount().then((res) => {
+  IotStatApi.getDeviceCount("ry").then((res) => {
     device.value = res
   })
-  IotStatApi.getMaintainCount().then((res) => {
+  IotStatApi.getMaintainCount("ry").then((res) => {
     maintain.value = res
   })
   IotStatApi.getMainWorkCount().then((res) => {
@@ -325,7 +325,7 @@ const getStats =  () => {
   IotStatApi.getInspectCount().then((res) => {
     inspect.value = res
   })
-  IotStatApi.getMaintenanceStatus().then((res) => {
+  IotStatApi.getMaintenanceStatus("ry").then((res) => {
     status.value = res
     // initCharts()
   })
@@ -334,7 +334,7 @@ const getStats =  () => {
     initTopChart()
   })
 
-  IotStatApi.getDeviceStatusCount().then((res) => {
+  IotStatApi.getDeviceStatusCount('ry').then((res) => {
     typeData.value = res
     initDeviceStatusCharts()
   })
@@ -346,14 +346,14 @@ const getStats =  () => {
     initMaterials()
   })
 
-  IotStatApi.getOrderSeven().then((res) => {
+  IotStatApi.getOrderSeven('ry').then((res) => {
     orderSevenData.value = res
     initQxChart();
   })
 
   IotStatApi.getMaintenanceStatus().then((res) => {
     by.value = res
-    initMaintenanceChart()
+
   })
   const fillQueryParams = reactive({
     startTime: Date.now() - 7 * 24 * 60 * 60 * 1000, // 设置默认开始时间为 7 天前
@@ -362,10 +362,10 @@ const getStats =  () => {
     deptId: null, // 选中的部门ID
     status: null // 填写状态
   })
-  IotStatApi.getInspectStatus(fillQueryParams).then((res) => {
+  IotStatApi.getInspectStatuss(fillQueryParams,'ry').then((res) => {
     inspectt.value = res
   })
-  fillQueryParams.deptId = useUserStore().getUser.deptId
+  fillQueryParams.deptId = '158'
   IotStatApi.getDeptStatistics(fillQueryParams).then((res) => {
     fill.value = res.totalList[0] || []
   })
@@ -714,7 +714,7 @@ const getTopOption = () => {
 
 // 初始化图表
 const initTopChart = async () => {
-  await IotStatApi.getDeviceTypeCount().then((res) => {
+  await IotStatApi.getDeviceTypeCount('ry').then((res) => {
     backendData.value = res
   })
   if (!topContainer.value) return

+ 17 - 6
src/views/system/user/UserForm.vue

@@ -105,6 +105,7 @@ import * as DeptApi from '@/api/system/dept'
 import * as UserApi from '@/api/system/user'
 import { FormRules } from 'element-plus'
 import { useTreeStore } from '@/store/modules/usersTreeStore'
+import {IotDevicePersonApi} from "@/api/pms/iotdeviceperson";
 
 defineOptions({ name: 'SystemUserForm' })
 
@@ -155,7 +156,7 @@ const formRules = reactive<FormRules>({
 const formRef = ref() // 表单 Ref
 const deptList = ref<Tree[]>([]) // 树形结构
 const postList = ref([] as PostApi.PostVO[]) // 岗位列表
-
+const userInfo = ref()
 /** 打开弹窗 */
 const open = async (type: string, id?: number) => {
   dialogVisible.value = true
@@ -168,6 +169,7 @@ const open = async (type: string, id?: number) => {
     formLoading.value = true
     try {
       formData.value = await UserApi.getUser(id)
+      userInfo.value = await UserApi.getUser(id)
     } finally {
       formLoading.value = false
     }
@@ -194,12 +196,21 @@ const submitForm = async () => {
       await UserApi.createUser(data)
       message.success(t('common.createSuccess'))
     } else {
-      await UserApi.updateUser(data)
-      message.success(t('common.updateSuccess'))
+
+      await IotDevicePersonApi.ifDuty(formData.value.id).then((res) => {
+        debugger
+          if (res>0&&userInfo.value.deptId!==formData.value.deptId) {
+            message.error('该用户已分配责任人,无法编辑部门')
+            return;
+          } else {
+            UserApi.updateUser(data)
+            message.success(t('common.updateSuccess'))
+            dialogVisible.value = false
+            // 发送操作成功的事件
+            emit('success')
+          }
+      })
     }
-    dialogVisible.value = false
-    // 发送操作成功的事件
-    emit('success')
   } finally {
     formLoading.value = false
   }