Jelajahi Sumber

运行记录模块优化

yuanchao 2 minggu lalu
induk
melakukan
897c77d136

+ 2 - 0
src/api/pms/modelattrtemplate/index.ts

@@ -18,6 +18,8 @@ export interface DeviceAttrModelData {
   selectOptions: ModelTemplateAttrs // 设备属性
   isCollection?:number,
   modelAttr?:string,
+  threshold?:number,
+  sumId?:number,
 }
 
 /**

+ 2 - 1
src/locales/en.ts

@@ -501,7 +501,8 @@ export default {
     view:'View',
     fill:'Fill',
     all:'All',
-    clear:'Clear'
+    clear:'Clear',
+    orderDevice:'OrderDevice',
   },
   operationFillForm:{
     team:'Team',

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

@@ -497,7 +497,8 @@ export default {
     view:'查看',
     fill:'填写',
     all:'全部',
-    clear:'清空'
+    clear:'清空',
+    orderDevice:'工单设备',
   },
   operationFillForm:{
     team:'所属队伍',

+ 27 - 3
src/views/pms/iotopeationfill/index.vue

@@ -76,15 +76,15 @@
 
     <!-- 列表 -->
     <ContentWrap>
-      <el-table v-loading="loading" :data="list" :stripe="true"  >
+      <el-table v-loading="loading" :data="list" :stripe="true"  :show-overflow-tooltip="true">
         <el-table-column label="序号" width="60" align="center">
           <template #default="scope">
             {{ scope.$index + 1 }}
           </template>
         </el-table-column>
-        <el-table-column :label="t('operationFill.name')" align="center" prop="orderName" width="300"/>
+        <el-table-column :label="t('bomList.name')" align="center" prop="orderName" width="320"/>
         <el-table-column :label="t('operationFill.duty')" align="center" prop="userName" />
-<!--        <el-table-column label="工单类型" align="center" prop="orderType" />-->
+        <el-table-column :label="t('operationFill.orderDevice')" align="center" prop="fillList" />
         <el-table-column :label="t('operationFill.status')" align="center" prop="orderStatus" >
           <template #default="scope">
             <dict-tag :type="DICT_TYPE.OPERATION_FILL_ORDER_STATUS" :value="scope.row.orderStatus" />
@@ -198,6 +198,30 @@ const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中
 
 
+// 新增变量用于控制悬浮提示
+const hoverRowId = ref<number | null>(null)
+
+// 鼠标进入表格单元格时
+const handleMouseEnter = (row: IotOpeationFillVO) => {
+  hoverRowId.value = row.id
+}
+
+// 鼠标离开表格单元格时
+const handleMouseLeave = () => {
+  hoverRowId.value = null
+}
+
+// 定义要显示的悬浮内容
+const getTooltipContent = (row: IotOpeationFillVO) => {
+  // 根据实际需求自定义显示内容
+  return `
+    ${t('operationFill.name')}: ${row.orderName || '-'}\n
+    ${t('operationFill.duty')}: ${row.userName || '-'}\n
+    ${t('dict.createTime')}: ${row.createTime ? dateFormatter(row.createTime) : '-'}
+  `
+}
+
+
  // 判断两个日期是否为同一天
 const isSameDay = (dateString) => {
   if (!dateString) return false

+ 52 - 9
src/views/pms/modeltemplate/detail/attrsModel/AttrTemplateModelForm.vue

@@ -14,6 +14,9 @@
             <el-input v-model="formData.name" placeholder="请输入属性名称" />
           </el-form-item>
         </el-col>
+
+      </el-row>
+      <el-row>
         <el-col :span="12">
           <el-form-item label="是否数采:" prop="isCollection">
             <el-radio-group v-model="formData.isCollection">
@@ -28,8 +31,6 @@
             </el-radio-group>
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row>
         <el-col :span="12">
           <el-form-item label="是否累计:" prop="isSum">
             <el-radio-group v-model="formData.isSum">
@@ -44,6 +45,9 @@
             </el-radio-group>
           </el-form-item>
         </el-col>
+
+      </el-row>
+      <el-row>
         <el-col :span="12">
           <el-form-item label="标识符" prop="code" v-show="formData.isSum === 1">
             <el-radio-group v-model="formData.code">
@@ -74,8 +78,20 @@
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item label="默认值" prop="defaultValue">
-            <el-input v-model="formData.defaultValue" placeholder="请输入默认值" />
+          <el-form-item label="累加值" prop="defaultValue" v-if="formData.isSum === 1">
+<!--            <el-input v-model="formData.defaultValue" placeholder="请选择累加值" />-->
+            <el-select v-model="formData.defaultValue" placeholder="请选择累加值">
+              <el-option
+                v-for="dict in nonSumList"
+                :key="dict.name"
+                :label="dict.name"
+                :value="dict.id"
+                :track-by="dict.id"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="填写阈值" prop="threshold" v-else>
+            <el-input v-model="formData.threshold" placeholder="请输入阈值" type="number"/>
           </el-form-item>
         </el-col>
       </el-row>
@@ -123,13 +139,14 @@ const dialogVisible = ref(false) // 弹窗的是否展示
 const dialogTitle = ref('') // 弹窗的标题
 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
 const formType = ref('') // 表单的类型:create - 新增;update - 修改
+const nonSumList = ref<DeviceAttrModelData[]>([]) // 列表的数据
 const formData = ref<DeviceAttrModelData>({
   deviceCategoryId: -1,
   dataType: DataSpecsDataType.DOUBLE,
   type: DataSpecsDataType.DOUBLE,
   requiredFlag: 0,
   description: '',
-  defaultValue: '',
+  defaultValue:0,
   selectOptions: {
     type: DataSpecsDataType.DOUBLE,
     defaultValue: '',
@@ -171,10 +188,30 @@ const props = defineProps({
 })
 
 const formRef = ref() // 表单 Ref
-
+// 添加计算属性用于去重
+const uniqueNonSumList = computed(() => {
+  // 根据id去重
+  const uniqueMap = new Map();
+  nonSumList.value.forEach(item => {
+    if (!uniqueMap.has(item.id)) {
+      uniqueMap.set(item.id, item);
+    }
+  });
+  return Array.from(uniqueMap.values());
+});
 /** 打开弹窗 */
-const open = async (type: string, id?: number,name?:string) => {
-
+const open = async (type: string, id?: number,name?:string,list?:[]) => {
+  nonSumList.value = [];
+  if(list.value.length>0){
+    // 处理传入的列表,确保不重复
+    const tempMap = new Map();
+    list.value.forEach((item: any) => {
+      if (!tempMap.has(item.id)) {
+        tempMap.set(item.id, item);
+      }
+    });
+    nonSumList.value = Array.from(tempMap.values());
+  }
   deviceCategoryName = name;
   if(type=='update'){
     await getAttrList();
@@ -186,7 +223,12 @@ const open = async (type: string, id?: number,name?:string) => {
   if (id) {
     formLoading.value = true
     try {
-      formData.value = await DeviceAttrModelApi.getDeviceAttrModel(id)
+      const result = await DeviceAttrModelApi.getDeviceAttrModel(id);
+      formData.value = {
+        ...result,
+        // 确保defaultValue是数值类型的id,以便正确匹配
+        defaultValue: result.defaultValue ? Number(result.defaultValue) : ''
+      };
       // 情况一:属性初始化
       if (isEmpty(formData.value.selectOptions)) {
         formData.value.type = DataSpecsDataType.DOUBLE
@@ -201,6 +243,7 @@ const open = async (type: string, id?: number,name?:string) => {
       formLoading.value = false
     }
   }
+
 }
 defineExpose({ open, close: () => (dialogVisible.value = false) })
 

+ 8 - 3
src/views/pms/modeltemplate/detail/attrsModel/index.vue

@@ -126,6 +126,11 @@ const getList = async () => {
     queryParams.deviceCategoryId = deviceCategoryId
     const data = await DeviceAttrModelApi.getDeviceAttrModelPage(queryParams)
     list.value = data.list
+    list.value.forEach(function (item,index){
+      if(item.isSum!=1){
+        list1.value.push(item)
+      }
+    })
     total.value = data.total
   } finally {
     loading.value = false
@@ -147,10 +152,10 @@ const resetQuery = () => {
 
 /** 添加/修改操作 */
 const formRef = ref()
-const openForm = (type: string, id?: number,name?:string) => {
+const openForm = (type: string, id?: number,name?:string,list?:[]) => {
   name = categoryName;
-
-    formRef.value.open(type,id,name)
+  list = list1;
+    formRef.value.open(type,id,name,list)
 }
 
 /** 删除按钮操作 */