فهرست منبع

[Feat 0000]测风装置规程值设置功能

bobo04052021@163.com 4 روز پیش
والد
کامیت
b94d515fde

+ 1 - 1
.env.development

@@ -9,7 +9,7 @@ VITE_PUBLIC_PATH = /
 VITE_PROXY = [["/sw","http://182.92.126.35:6008"],["/jeecgsystem","http://182.92.126.35:9999"],["/upload","http://182.92.126.35:9999/upload"],["/documents", "http://182.92.126.35:9050"],["/modelreq", "http://182.92.126.35:9999"],["/webRtc", "http://182.92.126.35:8051"], ["/python", "http://127.0.0.1:8008"], ["/tun2D", "http://127.0.0.1:8088/micro-vent-2dModal/tun2D"]]
 # VITE_PROXY = [["/jeecgsystem","http://192.168.183.88:9999"],["/upload","http://192.168.183.88:9999/upload"],["/documents", "http://192.168.183.88:9050"],["/modelreq", "http://192.168.183.88:9999"],["/webRtc", "http://192.168.183.88:8051"]]
 # VITE_PROXY = [["/jeecgsystem","http://10.10.150.72:9999"],["/upload","http://localhost:3300/upload"],["/documents", "http://10.10.150.72:9050"],["/modelreq", "http://10.10.150.72:9999"],["/webRtc", "http://192.168.183.216:8051"]]
-#VITE_PROXY = [["/jeecgsystem","http://192.168.1.8:9999"],["/upload","http://localhost:3300/upload"]]
+# VITE_PROXY = [["/jeecgsystem","http://192.168.1.8:9999"],["/upload","http://localhost:3300/upload"]]
 
 # 控制台不输出  
 VITE_DROP_CONSOLE = false

+ 21 - 3
src/views/vent/deviceManager/comment/warningTabel/warning.data.ts

@@ -48,11 +48,29 @@ export const levelColumns: BasicColumn[] = [
   },
   {
     title: '报警类型',
-    width: 180,
-    editRow: true,
+    // width: 180,
+    // editRow: true,
+    // dataIndex: 'alarm_type',
+    // editRule: true,
+    // editComponent: 'ApiSelect',
+    // editComponentProps: { api: initDictOptions.bind(null, 'alarm_type'), labelField: 'label', valueField: 'value' },
     dataIndex: 'alarm_type',
+    editRow: true,
+    editRule: true,
+    width: 100,
     editComponent: 'ApiSelect',
-    editComponentProps: { api: initDictOptions.bind(null, 'alarm_type') },
+    editComponentProps: {
+      api: initDictOptions.bind(null, 'alarm_type'),
+      labelField: 'label',
+      valueField: 'value',
+    },
+  },
+  {
+    title: '关联字段',
+    width: 180,
+    editRow: true,
+    dataIndex: 'relatedCode',
+    editComponent: 'Input',
   },
   {
     title: '是否语音播报',

+ 3 - 0
src/views/vent/deviceManager/substationTabel/substation.api.ts

@@ -11,6 +11,7 @@ enum Api {
   exportXls = '/sys/user/exportXls',
   addDevice = '/safety/ventanalySubStation/addDeviceBystation',
   getHistory = '/safety/ventanalyAlarmLog/list',
+  getRegulation = '/monitor/getDeviceRegulation',
 }
 /**
  * 导出api
@@ -36,6 +37,8 @@ export const deleteById = (params, handleSuccess) => {
     handleSuccess();
   });
 };
+export const getRegulation = () => defHttp.post({ url: Api.getRegulation });
+
 /**
  * 批量删除用户
  * @param params

+ 309 - 297
src/views/vent/monitorManager/comment/components/DeviceBaseInfo.vue

@@ -11,322 +11,334 @@
   </BasicModal>
 </template>
 <script lang="ts" setup>
-  import { onMounted, ref, defineEmits, onUnmounted, watch, computed } from 'vue';
-  import { BasicModal, useModalInner } from '/@/components/Modal';
-  import { BasicForm, useForm } from '/@/components/Form/index';
-  import { FormSchema } from '/@/components/Form';
-  import { getFormSchemaColumns } from '/@/hooks/web/useWebColumns';
-  import { list as substationList } from '/@/views/vent/deviceManager/substationTabel/substation.api';
-  import { list, updateDeviceInfo, updateReportInfo } from '../comment.api';
-  import { getAutoScrollContainer } from '/@/utils/common/compUtils';
+import { onMounted, ref, defineEmits, onUnmounted, watch, computed } from 'vue';
+import { BasicModal, useModalInner } from '/@/components/Modal';
+import { BasicForm, useForm } from '/@/components/Form/index';
+import { FormSchema } from '/@/components/Form';
+import { getFormSchemaColumns } from '/@/hooks/web/useWebColumns';
+import { list as substationList } from '/@/views/vent/deviceManager/substationTabel/substation.api';
+import { getRegulation as getRegulationList } from '/@/views/vent/deviceManager/substationTabel/substation.api';
+import { list, updateDeviceInfo, updateReportInfo } from '../comment.api';
+import { getAutoScrollContainer } from '/@/utils/common/compUtils';
 
-  const emit = defineEmits(['close', 'register']);
-  const props = defineProps({
-    // formSchema: {
-    //   type: Array as PropType<FormSchema[]>,
-    //   default: () => [],
-    // },
-    deviceType: {
-      type: String,
-      default: '',
-    },
-  });
-  const FormRef = ref();
-  const tabType = ref('deviceInfo');
-  const formSchema = ref<Array<FormSchema>>([]);
-  const formData = ref({});
-  // const props.deviceType ref('');
-  const deviceType = computed(() => props.deviceType);
+const emit = defineEmits(['close', 'register']);
+const props = defineProps({
+  // formSchema: {
+  //   type: Array as PropType<FormSchema[]>,
+  //   default: () => [],
+  // },
+  deviceType: {
+    type: String,
+    default: '',
+  },
+});
+const FormRef = ref();
+const tabType = ref('deviceInfo');
+const formSchema = ref<Array<FormSchema>>([]);
+const formData = ref({});
+// const props.deviceType ref('');
+const deviceType = computed(() => props.deviceType);
 
-  // const arrToFormColumns = (tableHeaderColumns = [], devicetype) => {
-  //   const columnList: any[] = [];
-  //   tableHeaderColumns.forEach((item: any) => {
-  //     let columnsItem;
-  //     if (item.type == 1 || item.type == 10) {
-  //       columnsItem = {
-  //         label: item.des, //_dictText
-  //         field: item.monitorcode,
-  //         component: item.type == 1 ? 'Input' : item.type == 10 ? 'InputTextArea' : '',
-  //       };
-  //     } else {
-  //       if (item.type == 2 && item['monitorcode'] == 'nsubstationid') {
-  //         columnsItem = {
-  //           label: item.des, //_dictText
-  //           field: item.monitorcode,
-  //           component: 'ApiSelect',
-  //           componentProps: {
-  //             api: substationList,
-  //             labelField: 'strname',
-  //             valueField: 'id',
-  //           },
-  //         };
-  //       }
-  //       if (item.type == 3) {
-  //         columnsItem = {
-  //           label: item.des, //_dictText
-  //           field: item.monitorcode,
-  //           component: 'RadioGroup',
-  //           defaultValue: 1,
-  //           componentProps: () => {
-  //             return {
-  //               options: [
-  //                 { label: '是', value: 1, key: '1' },
-  //                 { label: '否', value: 0, key: '2' },
-  //               ],
-  //               stringToNumber: true,
-  //             };
-  //           },
-  //         };
-  //       }
-  //       if (item.type == 4) {
-  //         columnsItem = {
-  //           label: item.des, //_dictText
-  //           field: item.monitorcode,
-  //           component: 'JDictSelectTag',
-  //           componentProps: {
-  //             dictCode: item.dict,
-  //             placeholder: '请选择',
-  //             stringToNumber: true,
-  //           },
-  //         };
-  //       }
-  //     }
-  //     columnList.push(columnsItem);
-  //   });
-  //   formSchema.value = columnList
-  //   if(tabType.value === 'deviceInfo'){
-  //     formSchema.value.unshift(
-  //       {
-  //         label: '设备id', //_dictText
-  //         field: 'id',
-  //         component: 'Input',
-  //         componentProps: {
-  //           disabled: true,
-  //           show: false
-  //         },
-  //       },
-  //       {
-  //         label: '点表',
-  //         field: 'strtype',
-  //         component: 'JDictSelectTag',
-  //         componentProps: {
-  //           dictCode: `${devicetype.split('_')[0]}kind`,
-  //           placeholder: '请选择点表',
-  //         },
-  //       })
-  //       formSchema.value.push(
-  //       {
-  //         label: '备用分站',
-  //         field: 'stationids',
-  //         component: 'ApiSelect',
-  //         componentProps: {
-  //           api: substationList,
-  //           labelField: 'strname',
-  //           valueField: 'id',
-  //         },
-  //       },
-  //     )
-  //   }else{
-  //     formSchema.value.unshift(
-  //       {
-  //         label: '设备id', //_dictText
-  //         field: 'id',
-  //         component: 'Input',
-  //         componentProps: {
-  //           disabled: true,
-  //           show: false
-  //         },
-  //       })
-  //   }
-  // };
+// const arrToFormColumns = (tableHeaderColumns = [], devicetype) => {
+//   const columnList: any[] = [];
+//   tableHeaderColumns.forEach((item: any) => {
+//     let columnsItem;
+//     if (item.type == 1 || item.type == 10) {
+//       columnsItem = {
+//         label: item.des, //_dictText
+//         field: item.monitorcode,
+//         component: item.type == 1 ? 'Input' : item.type == 10 ? 'InputTextArea' : '',
+//       };
+//     } else {
+//       if (item.type == 2 && item['monitorcode'] == 'nsubstationid') {
+//         columnsItem = {
+//           label: item.des, //_dictText
+//           field: item.monitorcode,
+//           component: 'ApiSelect',
+//           componentProps: {
+//             api: substationList,
+//             labelField: 'strname',
+//             valueField: 'id',
+//           },
+//         };
+//       }
+//       if (item.type == 3) {
+//         columnsItem = {
+//           label: item.des, //_dictText
+//           field: item.monitorcode,
+//           component: 'RadioGroup',
+//           defaultValue: 1,
+//           componentProps: () => {
+//             return {
+//               options: [
+//                 { label: '是', value: 1, key: '1' },
+//                 { label: '否', value: 0, key: '2' },
+//               ],
+//               stringToNumber: true,
+//             };
+//           },
+//         };
+//       }
+//       if (item.type == 4) {
+//         columnsItem = {
+//           label: item.des, //_dictText
+//           field: item.monitorcode,
+//           component: 'JDictSelectTag',
+//           componentProps: {
+//             dictCode: item.dict,
+//             placeholder: '请选择',
+//             stringToNumber: true,
+//           },
+//         };
+//       }
+//     }
+//     columnList.push(columnsItem);
+//   });
+//   formSchema.value = columnList
+//   if(tabType.value === 'deviceInfo'){
+//     formSchema.value.unshift(
+//       {
+//         label: '设备id', //_dictText
+//         field: 'id',
+//         component: 'Input',
+//         componentProps: {
+//           disabled: true,
+//           show: false
+//         },
+//       },
+//       {
+//         label: '点表',
+//         field: 'strtype',
+//         component: 'JDictSelectTag',
+//         componentProps: {
+//           dictCode: `${devicetype.split('_')[0]}kind`,
+//           placeholder: '请选择点表',
+//         },
+//       })
+//       formSchema.value.push(
+//       {
+//         label: '备用分站',
+//         field: 'stationids',
+//         component: 'ApiSelect',
+//         componentProps: {
+//           api: substationList,
+//           labelField: 'strname',
+//           valueField: 'id',
+//         },
+//       },
+//     )
+//   }else{
+//     formSchema.value.unshift(
+//       {
+//         label: '设备id', //_dictText
+//         field: 'id',
+//         component: 'Input',
+//         componentProps: {
+//           disabled: true,
+//           show: false
+//         },
+//       })
+//   }
+// };
 
-  const arrToFormColumns = (tableHeaderColumns = []) => {
-    const columnList: any[] = [];
-    tableHeaderColumns.forEach((item: any) => {
-      let columnsItem;
-      if (item.type == 1 || item.type == 10) {
+const arrToFormColumns = (tableHeaderColumns = []) => {
+  const columnList: any[] = [];
+  console.log(tableHeaderColumns, 'tableHeaderColumns');
+  tableHeaderColumns.forEach((item: any) => {
+    let columnsItem;
+    if (item.type == 1 || item.type == 10) {
+      columnsItem = {
+        label: item.des, //_dictText
+        field: item.monitorcode,
+        component: item.type == 1 ? 'Input' : item.type == 10 ? 'InputTextArea' : '',
+      };
+    } else {
+      if (item.type == 2 && item['monitorcode'] == 'nsubstationid') {
         columnsItem = {
           label: item.des, //_dictText
           field: item.monitorcode,
-          component: item.type == 1 ? 'Input' : item.type == 10 ? 'InputTextArea' : '',
+          component: 'ApiSelect',
+          componentProps: {
+            api: substationList,
+            labelField: 'strname',
+            valueField: 'id',
+          },
         };
-      } else {
-        if (item.type == 2 && item['monitorcode'] == 'nsubstationid') {
-          columnsItem = {
-            label: item.des, //_dictText
-            field: item.monitorcode,
-            component: 'ApiSelect',
-            componentProps: {
-              api: substationList,
-              labelField: 'strname',
-              valueField: 'id',
-            },
-          };
-        }
-        if (item.type == 3) {
-          columnsItem = {
-            label: item.des, //_dictText
-            field: item.monitorcode,
-            component: 'RadioGroup',
-            defaultValue: 1,
-            componentProps: () => {
-              return {
-                options: [
-                  { label: '是', value: 1, key: '1' },
-                  { label: '否', value: 0, key: '2' },
-                ],
-                stringToNumber: true,
-              };
-            },
-          };
-        }
-        if (item.type == 4) {
-          columnsItem = {
-            label: item.des, //_dictText
-            field: item.monitorcode,
-            component: 'JDictSelectTag',
-            componentProps: {
-              dictCode: item.dict,
-              placeholder: '请选择',
-              // stringToNumber: true,
-            },
-          };
-        }
-        // date日期
-        if (item.type == 8) {
-          columnsItem = {
-            label: item.des, //_dictText
-            field: item.monitorcode,
-            component: 'DatePicker',
-            componentProps: {
-              showTime: false,
-              valueFormat: 'YYYY-MM-DD',
-              getPopupContainer: getAutoScrollContainer,
-            },
-          };
-        }
-        // 日期+时间
-        if (item.type == 9) {
-          columnsItem = {
-            label: item.des, //_dictText
-            field: item.monitorcode,
-            component: 'DatePicker',
-            componentProps: {
-              showTime: true,
-              valueFormat: 'YYYY-MM-DD HH:mm:ss',
-              getPopupContainer: getAutoScrollContainer,
-            },
-          };
-        }
       }
-      columnList.push(columnsItem);
-    });
-    formSchema.value = columnList;
-    formSchema.value.unshift(
-      {
-        label: '设备id', //_dictText
-        field: 'id',
-        component: 'Input',
-        componentProps: {
-          disabled: true,
-        },
-      },
-      {
-        label: '点表',
-        field: 'strtype',
-        component: 'JDictSelectTag',
-        componentProps: {
-          dictCode: `${deviceType.value.split('_')[0]}kind`, //${deviceType.value}kind
-          placeholder: '请选择点表',
-          // stringToNumber: true,
-        },
+      if (item.type == 3) {
+        columnsItem = {
+          label: item.des, //_dictText
+          field: item.monitorcode,
+          component: 'RadioGroup',
+          defaultValue: 1,
+          componentProps: () => {
+            return {
+              options: [
+                { label: '是', value: 1, key: '1' },
+                { label: '否', value: 0, key: '2' },
+              ],
+              stringToNumber: true,
+            };
+          },
+        };
       }
-    );
-    formSchema.value.push(
-      {
-        label: '备用分站',
-        field: 'stationids',
-        component: 'ApiSelect',
-        componentProps: {
-          api: substationList,
-          labelField: 'strname',
-          valueField: 'id',
-        },
-      },
-      {
-        label: '是否显示',
-        field: 'linkId',
-        component: 'RadioGroup',
-        defaultValue: 1,
-        componentProps: () => {
-          return {
-            options: [
-              { label: '是', value: 1, key: '1' },
-              { label: '否', value: 0, key: '2' },
-            ],
-            stringToNumber: true,
-          };
-        },
+      if (item.type == 4) {
+        columnsItem = {
+          label: item.des, //_dictText
+          field: item.monitorcode,
+          component: 'JDictSelectTag',
+          componentProps: {
+            dictCode: item.dict,
+            placeholder: '请选择',
+            // stringToNumber: true,
+          },
+        };
+      }
+      // date日期
+      if (item.type == 8) {
+        columnsItem = {
+          label: item.des, //_dictText
+          field: item.monitorcode,
+          component: 'DatePicker',
+          componentProps: {
+            showTime: false,
+            valueFormat: 'YYYY-MM-DD',
+            getPopupContainer: getAutoScrollContainer,
+          },
+        };
+      }
+      // 日期+时间
+      if (item.type == 9) {
+        columnsItem = {
+          label: item.des, //_dictText
+          field: item.monitorcode,
+          component: 'DatePicker',
+          componentProps: {
+            showTime: true,
+            valueFormat: 'YYYY-MM-DD HH:mm:ss',
+            getPopupContainer: getAutoScrollContainer,
+          },
+        };
       }
-    );
-  };
-  // 注册 modal
-  const [register, { closeModal, setModalProps }] = useModalInner(async (data) => {
-    tabType.value = data.type;
-    const deviceId = data.deviceId;
-    if (FormRef.value) {
-      setModalProps({ confirmLoading: false });
-      getColumns();
-      resetSchema(formSchema.value);
-      resetFields();
-      const result = await list({ id: deviceId });
-      formData.value = result['records'][0];
-      await setFieldsValue({
-        ...formData.value,
-      });
     }
+    columnList.push(columnsItem);
   });
-
-  const [registerForm, { resetSchema, getFieldsValue, setFieldsValue, resetFields }] = useForm({
-    schemas: formSchema.value,
-    showActionButtonGroup: false,
-  });
-
-  function getColumns() {
-    let formSchemaArr = getFormSchemaColumns(tabType.value === 'deviceInfo' ? `${props.deviceType}_edit` : `${props.deviceType}_input`) || [];
-    if (formSchemaArr && formSchemaArr.length < 1) {
-      const arr = props.deviceType.split('_');
-      formSchemaArr = getFormSchemaColumns(tabType.value === 'deviceInfo' ? arr[0] + '_edit' : arr[0] + '_input') || [];
+  formSchema.value = columnList;
+  formSchema.value.unshift(
+    {
+      label: '设备id', //_dictText
+      field: 'id',
+      component: 'Input',
+      componentProps: {
+        disabled: true,
+      },
+    },
+    {
+      label: '点表',
+      field: 'strtype',
+      component: 'JDictSelectTag',
+      componentProps: {
+        dictCode: `${deviceType.value.split('_')[0]}kind`, //${deviceType.value}kind
+        placeholder: '请选择点表',
+        // stringToNumber: true,
+      },
+    },
+    {
+      label: '规程值',
+      field: 'regulation',
+      component: 'ApiSelect',
+      componentProps: {
+        api: getRegulationList,
+        labelField: 'name',
+        valueField: 'id',
+      },
     }
-    arrToFormColumns(formSchemaArr);
-  }
-
-  watch(
-    () => props.deviceType,
-    () => {
-      getColumns();
-      if (FormRef.value) resetSchema(formSchema.value);
+  );
+  formSchema.value.push(
+    {
+      label: '备用分站',
+      field: 'stationids',
+      component: 'ApiSelect',
+      componentProps: {
+        api: substationList,
+        labelField: 'strname',
+        valueField: 'id',
+      },
+    },
+    {
+      label: '是否显示',
+      field: 'linkId',
+      component: 'RadioGroup',
+      defaultValue: 1,
+      componentProps: () => {
+        return {
+          options: [
+            { label: '是', value: 1, key: '1' },
+            { label: '否', value: 0, key: '2' },
+          ],
+          stringToNumber: true,
+        };
+      },
     }
   );
+};
+// 注册 modal
+const [register, { closeModal, setModalProps }] = useModalInner(async (data) => {
+  tabType.value = data.type;
+  const deviceId = data.deviceId;
+  if (FormRef.value) {
+    setModalProps({ confirmLoading: false });
+    getColumns();
+    resetSchema(formSchema.value);
+    resetFields();
+    const result = await list({ id: deviceId });
+    formData.value = result['records'][0];
+    await setFieldsValue({
+      ...formData.value,
+    });
+  }
+});
 
-  async function onSubmit() {
-    let formValue = getFieldsValue();
-    setModalProps({ confirmLoading: true });
-    if (tabType.value === 'deviceInfo') {
-      await updateDeviceInfo(formValue);
-    } else {
-      await updateReportInfo(formValue);
-    }
+const [registerForm, { resetSchema, getFieldsValue, setFieldsValue, resetFields }] = useForm({
+  schemas: formSchema.value,
+  showActionButtonGroup: false,
+});
 
-    setModalProps({ confirmLoading: false });
-    emit('close');
-    closeModal();
+function getColumns() {
+  let formSchemaArr = getFormSchemaColumns(tabType.value === 'deviceInfo' ? `${props.deviceType}_edit` : `${props.deviceType}_input`) || [];
+  if (formSchemaArr && formSchemaArr.length < 1) {
+    const arr = props.deviceType.split('_');
+    formSchemaArr = getFormSchemaColumns(tabType.value === 'deviceInfo' ? arr[0] + '_edit' : arr[0] + '_input') || [];
+  }
+  arrToFormColumns(formSchemaArr);
+}
+
+watch(
+  () => props.deviceType,
+  () => {
+    getColumns();
+    if (FormRef.value) resetSchema(formSchema.value);
   }
+);
+
+async function onSubmit() {
+  let formValue = getFieldsValue();
+  setModalProps({ confirmLoading: true });
+  if (tabType.value === 'deviceInfo') {
+    await updateDeviceInfo(formValue);
+  } else {
+    await updateReportInfo(formValue);
+  }
+
+  setModalProps({ confirmLoading: false });
+  emit('close');
+  closeModal();
+}
 
-  onMounted(async () => {});
-  onUnmounted(() => {});
+onMounted(async () => {});
+onUnmounted(() => {});
 </script>
 <style scoped lang="less">
-  @import '/@/design/theme.less';
-  @import '/@/design/vent/modal.less';
+@import '/@/design/theme.less';
+@import '/@/design/vent/modal.less';
 </style>

+ 4 - 17
src/views/vent/monitorManager/windrectMonitor/index.vue

@@ -254,23 +254,10 @@ function getMonitor(flag?) {
             // dataSource.value = res.msgTxt[0].datalist || [];
             const getData = res.msgTxt[0].datalist || [];
             getData.forEach((data) => {
-              if (data.limits) {
-                const limitsKeys = Object.keys(data.limits);
-                limitsKeys.forEach((limitKey) => {
-                  const limit = data.limits[limitKey];
-                  if (limit && Array.isArray(limit.limitlevels)) {
-                    // 确保 data.readData 已初始化
-                    data.readData = data.readData || {};
-                    limit.limitlevels.forEach((item) => {
-                      if (item && item.alarmType) {
-                        // 拼接字段名并存入readData
-                        data.readData[`${item.alarmType}_fmin`] = item.fmin;
-                        data.readData[`${item.alarmType}_fmax`] = item.fmax;
-                      }
-                    });
-                  }
-                });
-                return data;
+              if (data.regulation) {
+                const testRegulation = JSON.parse(data.regulation);
+                data.fmin = testRegulation.fmin;
+                data.fmax = testRegulation.fmax;
               }
             });
             dataSource.value = getData;