Ver código fonte

看板调增,用户编辑调整

lipenghui 3 semanas atrás
pai
commit
950086ad95

+ 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 })

+ 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']]
           }
         },

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

@@ -343,7 +343,7 @@ const getStats = () => {
     inspect.value = res
     initInspectChart()
   })
-  fillQueryParams.deptId = useUserStore().getUser.deptId
+  fillQueryParams.deptId = '163'
   IotStatApi.getDeptStatistics(fillQueryParams).then((res) => {
     fill.value = res.totalList[0] || []
   })

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

@@ -302,7 +302,7 @@ const getStats =  () => {
   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] || []
   })

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

@@ -365,7 +365,7 @@ const getStats =  () => {
   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] || []
   })

+ 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
   }