Browse Source

Merge remote-tracking branch 'origin/master'

lipenghui 2 weeks ago
parent
commit
721c1e1c4a

+ 1 - 0
src/locales/en.ts

@@ -622,6 +622,7 @@ export default {
   devicePerson:{
     deviceName:'DeviceName',
     nameHolder:'Please enter DeviceName',
+    nicknameHolder:'Username or Nickname',
     deviceCode:'DeviceCode',
     codeHolder:'Please enter DeviceCode',
     responsiblePerson:'ResponsiblePerson',

+ 1 - 0
src/locales/ru.ts

@@ -608,6 +608,7 @@ export default {
   devicePerson:{
     deviceName:'设备名称',
     nameHolder:'请输入设备名称',
+    nicknameHolder:'用户昵称或账号',
     deviceCode:'设备编码',
     codeHolder:'请输入设备编码',
     responsiblePerson:'是否设置责任人',

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

@@ -618,6 +618,7 @@ export default {
   devicePerson:{
     deviceName:'设备名称',
     nameHolder:'请输入设备名称',
+    nicknameHolder:'用户昵称或账号',
     deviceCode:'设备编码',
     codeHolder:'请输入设备编码',
     responsiblePerson:'是否设置责任人',

+ 7 - 45
src/views/pms/device/personlog/DevicePerson.vue

@@ -16,7 +16,7 @@
           :inline="true"
           label-width="68px"
         >
-          <el-form-item :label="t('devicePerson.deviceCode')" prop="deviceCode" style="margin-left: 25px">
+          <el-form-item :label="t('devicePerson.deviceCode')" prop="deviceCode" style="margin-left: 20px">
             <el-input
               v-model="queryParams.deviceCode"
               :placeholder="t('devicePerson.codeHolder')"
@@ -40,7 +40,7 @@
               v-model="queryParams.setFlag"
               :placeholder="t('devicePerson.choose')"
               clearable
-              class="!w-240px"
+              class="!w-150px"
             >
               <el-option
                 v-for="dict in resultOptions"
@@ -50,42 +50,10 @@
               />
             </el-select>
           </el-form-item>
-          <el-form-item v-show="ifShow" :label="t('devicePerson.status')" label-width="85px" prop="deviceStatus">
-            <el-select
-              v-model="queryParams.deviceStatus"
-              :placeholder="t('devicePerson.status')"
-              clearable
-              class="!w-240px"
-            >
-              <el-option
-                v-for="dict in getStrDictOptions(DICT_TYPE.PMS_DEVICE_STATUS)"
-                :key="dict.value"
-                :label="dict.label"
-                :value="dict.value"
-              />
-            </el-select>
-          </el-form-item>
-
-          <el-form-item v-show="ifShow" :label="t('devicePerson.assets')" prop="assetProperty">
-            <el-select
-              v-model="queryParams.assetProperty"
-              :placeholder="t('devicePerson.assets')"
-              clearable
-              class="!w-240px"
-            >
-              <el-option
-                v-for="dict in getStrDictOptions(DICT_TYPE.PMS_ASSET_PROPERTY)"
-                :key="dict.value"
-                :label="dict.label"
-                :value="dict.value"
-              />
-            </el-select>
-          </el-form-item>
-
-          <el-form-item v-show="ifShow" :label="t('devicePerson.brand')" prop="brand">
+          <el-form-item :label="t('devicePerson.rp')" prop="nickname">
             <el-input
-              v-model="queryParams.brand"
-              :placeholder="t('devicePerson.brandHolder')"
+              v-model="queryParams.nickname"
+              :placeholder="t('devicePerson.nicknameHolder')"
               clearable
               @keyup.enter="handleQuery"
               class="!w-200px"
@@ -93,13 +61,6 @@
           </el-form-item>
 
           <el-form-item>
-            <el-button v-if="!ifShow" @click="moreQuery(true)" type="warning"
-              ><Icon icon="ep:search" class="mr-5px" />
-              {{ t('devicePerson.moreSearch') }}</el-button
-            >
-            <el-button v-if="ifShow" @click="moreQuery(false)" type="danger"
-              ><Icon icon="ep:search" class="mr-5px" /> {{ t('devicePerson.closeSearch') }}</el-button
-            >
             <el-button @click="handleQuery"
               ><Icon icon="ep:search" class="mr-5px" /> {{ t('devicePerson.search') }}</el-button
             >
@@ -226,7 +187,8 @@ const queryParams = reactive({
   infoUrl: undefined,
   templateJson: undefined,
   creator: undefined,
-  setFlag: ''
+  setFlag: '',
+  nickname: ''
 })
 const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中

+ 79 - 13
src/views/pms/maintenance/IotMaintenancePlan.vue

@@ -48,7 +48,7 @@
 
     <!-- 列表 -->
     <ContentWrap>
-      <el-table v-loading="loading" :data="pagedList" :stripe="true" :show-overflow-tooltip="true">
+      <el-table v-loading="loading" :data="pagedList" :stripe="true" :show-overflow-tooltip="true" :cell-class-name="cellClassName">
         <!-- 添加序号列 -->
         <el-table-column
           type="index"
@@ -477,6 +477,59 @@ const configDialog = reactive({
   }
 })
 
+// 单元格类名回调方法
+const cellClassName = ({ row, column }) => {
+  // 只对序号列进行处理
+  if (column.type === 'index') {
+    // 检查该行所有启用的规则是否都已配置完整
+    if (checkRowFilled(row)) {
+      return 'all-filled'; // 返回自定义类名
+    }
+  }
+  return '';
+};
+
+// 检查行数据是否完整填写
+const checkRowFilled = (row: IotMaintenanceBomVO) => {
+  // 检查是否启用了至少一个规则
+  const hasRuleEnabled =
+    row.mileageRule === 0 ||
+    row.runningTimeRule === 0 ||
+    row.naturalDateRule === 0;
+
+  if (!hasRuleEnabled) {
+    return false; // 没有任何规则启用,不显示背景色
+  }
+  // 检查里程规则
+  const mileageFilled = row.mileageRule !== 0
+    ? true // 规则未启用,视为已"填写"
+    : (row.lastRunningKilometers > 0 &&
+      row.nextRunningKilometers > 0 &&
+      row.kiloCycleLead > 0 &&
+    // 检查累计里程参数是否已选择(当条件满足时)
+    (!(row.mileageAccumulatedAttrs?.length && !row.totalMileage) ||
+      (row.mileageAccumulatedAttrs?.length && !row.totalMileage && row.type)));
+
+  // 检查运行时间规则
+  const runningTimeFilled = row.runningTimeRule !== 0
+    ? true
+    : (row.lastRunningTime > 0 &&
+      row.nextRunningTime > 0 &&
+      row.timePeriodLead > 0  &&
+      // 检查累计时间参数是否已选择(当条件满足时)
+      (!(row.timeAccumulatedAttrs?.length && !row.totalRunTime) ||
+        (row.timeAccumulatedAttrs?.length && !row.totalRunTime && row.code)));
+
+  // 检查自然日期规则
+  const naturalDateFilled = row.naturalDateRule !== 0
+    ? true
+    : (row.lastNaturalDate &&
+      row.nextNaturalDate > 0 &&
+      row.naturalDatePeriodLead > 0);
+
+  return mileageFilled && runningTimeFilled && naturalDateFilled;
+};
+
 // 打开配置对话框
 const openConfigDialog = (row: IotMaintenanceBomVO) => {
   // 新增规则校验:至少一个规则开启
@@ -640,11 +693,7 @@ const saveConfig = () => {
 
     // 更新当前行的数据
     Object.assign(configDialog.current, updateData);
-    /* Object.assign(configDialog.current, {
-      ...configDialog.form,
-      // Date对象 -> 时间戳
-      lastNaturalDate: finalDate,
-    }) */
+
     configDialog.visible = false
   })
 }
@@ -786,13 +835,6 @@ const deviceChoose = async(selectedDevices) => {
     }
   })
 
-  // 数据加载完成后设置初始化标志为 false
-  /* setTimeout(() => {
-    isInitializing.value = false;
-  }, 500); */
-
-  // 新增数据后自动跳转到第一页
-  // currentPage.value = 1
 }
 
 const deviceFormRef = ref<InstanceType<typeof MainPlanDeviceList>>()
@@ -907,6 +949,24 @@ const validateTableData = (): boolean => {
     if (shouldBreak) return;
     const rowNumber = index + 1 // 用户可见的行号从1开始
     const deviceIdentifier = `${row.deviceCode}-${row.name}` // 设备标识
+
+    // 累计参数校验逻辑
+    if (row.mileageRule === 0 &&
+      row.mileageAccumulatedAttrs?.length &&
+      !row.totalMileage &&
+      !row.type) {
+      errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行公里数参数`)
+      isValid = false
+    }
+
+    if (row.runningTimeRule === 0 &&
+      row.timeAccumulatedAttrs?.length &&
+      !row.totalRunTime &&
+      !row.code) {
+      errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行时长参数`)
+      isValid = false
+    }
+
     // 校验逻辑
     const checkConfig = (ruleName: string, ruleValue: number, configField: keyof typeof row) => {
       if (ruleValue === 0) { // 规则开启
@@ -1142,4 +1202,10 @@ const handleDelete = async (str: string) => {
   justify-content: flex-end;
   margin-top: 20px;
 }
+
+/* 已完整填写行的背景色 */
+:deep(.el-table .all-filled) {
+  background-color: #f0fff3 !important; /* 淡绿色背景 */
+  transition: background-color 0.3s ease; /* 平滑过渡效果 */
+}
 </style>

+ 78 - 1
src/views/pms/maintenance/IotMaintenancePlanEdit.vue

@@ -50,7 +50,7 @@
     <ContentWrap>
       <el-table ref="tableRef" @header-dragend="handleHeaderDragEnd" v-loading="loading"
                 :data="pagedList" :stripe="true" :show-overflow-tooltip="true"
-                style="table-layout: fixed" border :header-cell-style="tableHeaderStyle">
+                style="table-layout: fixed" border :header-cell-style="tableHeaderStyle"  :cell-class-name="cellClassName">
         <!-- 添加序号列 -->
         <el-table-column
           type="index"
@@ -1040,6 +1040,59 @@ const calculateRemainDay = (row: IotMaintenanceBomVO) => {
 
 };
 
+// 单元格类名回调方法
+const cellClassName = ({ row, column }) => {
+  // 只对序号列进行处理
+  if (column.type === 'index') {
+    // 检查该行所有启用的规则是否都已配置完整
+    if (checkRowFilled(row)) {
+      return 'all-filled'; // 返回自定义类名
+    }
+  }
+  return '';
+};
+
+// 检查行数据是否完整填写
+const checkRowFilled = (row: IotMaintenanceBomVO) => {
+  // 检查是否启用了至少一个规则
+  const hasRuleEnabled =
+    row.mileageRule === 0 ||
+    row.runningTimeRule === 0 ||
+    row.naturalDateRule === 0;
+
+  if (!hasRuleEnabled) {
+    return false; // 没有任何规则启用,不显示背景色
+  }
+  // 检查里程规则
+  const mileageFilled = row.mileageRule !== 0
+    ? true // 规则未启用,视为已"填写"
+    : (row.lastRunningKilometers > 0 &&
+      row.nextRunningKilometers > 0 &&
+      row.kiloCycleLead > 0 &&
+      // 检查累计里程参数是否已选择(当条件满足时)
+      (!(row.mileageAccumulatedAttrs?.length && !row.totalMileage) ||
+        (row.mileageAccumulatedAttrs?.length && !row.totalMileage && row.type)));
+
+  // 检查运行时间规则
+  const runningTimeFilled = row.runningTimeRule !== 0
+    ? true
+    : (row.lastRunningTime > 0 &&
+      row.nextRunningTime > 0 &&
+      row.timePeriodLead > 0  &&
+      // 检查累计时间参数是否已选择(当条件满足时)
+      (!(row.timeAccumulatedAttrs?.length && !row.totalRunTime) ||
+        (row.timeAccumulatedAttrs?.length && !row.totalRunTime && row.code)));
+
+  // 检查自然日期规则
+  const naturalDateFilled = row.naturalDateRule !== 0
+    ? true
+    : (row.lastNaturalDate &&
+      row.nextNaturalDate > 0 &&
+      row.naturalDatePeriodLead > 0);
+
+  return mileageFilled && runningTimeFilled && naturalDateFilled;
+};
+
 // 统一计算所有列宽
 const calculateAllColumnsWidth = () => {
   const MIN_WIDTH = 80; // 最小列宽
@@ -1294,6 +1347,24 @@ const validateTableData = (): boolean => {
     if (shouldBreak) return;
     const rowNumber = index + 1 // 用户可见的行号从1开始
     const deviceIdentifier = `${row.deviceCode}-${row.name}` // 设备标识
+
+    // 累计参数校验逻辑
+    if (row.mileageRule === 0 &&
+      row.mileageAccumulatedAttrs?.length &&
+      !row.totalMileage &&
+      !row.type) {
+      errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行公里数参数`)
+      isValid = false
+    }
+
+    if (row.runningTimeRule === 0 &&
+      row.timeAccumulatedAttrs?.length &&
+      !row.totalRunTime &&
+      !row.code) {
+      errorMessages.push(`第 ${rowNumber} 行(${deviceIdentifier}):请选择累计运行时长参数`)
+      isValid = false
+    }
+
     // 校验逻辑
     const checkConfig = (ruleName: string, ruleValue: number, configField: keyof typeof row) => {
       if (ruleValue === 0) { // 规则开启
@@ -1662,4 +1733,10 @@ el-table {
     padding: 0 30px 0 11px !important; /* 日历图标空间 */
   }
 }
+
+/* 已完整填写行的背景色 */
+:deep(.el-table .all-filled) {
+  background-color: #f0fff3 !important; /* 淡绿色背景 */
+  transition: background-color 0.3s ease; /* 平滑过渡效果 */
+}
 </style>