潘志宝
2024-10-31 13c97d76348b5451381320aa54efa0706f38ecb6
src/views/data/point/DaPointForm.vue
@@ -1,5 +1,5 @@
<template>
  <Dialog v-model="dialogVisible" :title="dialogTitle" width="50%">
  <Dialog v-model="dialogVisible" :title="dialogTitle" width="60%">
    <el-form
      ref="formRef"
      v-loading="formLoading"
@@ -137,14 +137,14 @@
      </el-row>
      <el-row v-if="formData.pointType === 'MEASURE'">
        <el-col :span="12">
          <el-form-item label="值类型" prop="valueType">
          <el-form-item label="测量值类型" prop="measurePoint.valueType">
            <el-select
              v-model="formData.measurePoint.valueType"
              clearable
              placeholder="请选择值类型"
            >
              <el-option
                v-for="dict in getDictOptions(DICT_TYPE.VALUETYPE)"
                v-for="dict in getDictOptions(DICT_TYPE.MEASURE_VALUE_TYPE)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
@@ -153,8 +153,10 @@
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="平滑尺度" prop="dimension">
            <el-input-number v-model="formData.measurePoint.dimension" style="width: 100%" :controls="false"/>
          <el-form-item label="平滑尺度(min)" prop="measurePoint.dimension">
            <el-input-number v-model="formData.measurePoint.dimension" style="width: 100%"
                             :min="0" :max="100"
                             :controls="false"/>
          </el-form-item>
        </el-col>
      </el-row>
@@ -166,11 +168,11 @@
              :data="expressionList"
              border
              style="width: 100%">
<!--              <el-table-column
              <el-table-column
                type="index"
                align="center"
                width="50"
                label="序号"/>-->
                width="60"
                label="序号"/>
              <el-table-column
                prop=""
                label="左括号"
@@ -194,6 +196,7 @@
              <el-table-column
                prop=""
                label="测点"
                min-width="160"
                align="center">
                <template #default="scope">
                  <el-select
@@ -211,6 +214,7 @@
              <el-table-column
                prop=""
                label="运算值"
                min-width="120"
                align="center">
                <template #default="scope">
                  <el-input
@@ -243,7 +247,7 @@
              <el-table-column
                prop=""
                label="运算符"
                width="120"
                width="100"
                align="center">
                <template #default="scope">
                  <el-select v-model="scope.row.operator" clearable>
@@ -258,19 +262,19 @@
              <el-table-column
                prop=""
                label="操作"
                width="140"
                width="120"
                align="center">
                <template #default="scope">
                  <el-button
                    @click="addExpressionRow(scope.$index, expressionList)"
                    type="text"
                    size="small">
                    size="mini">
                    添加
                  </el-button>
                  <el-button
                    @click="deleteExpressionRow(scope.$index, expressionList)"
                    type="text"
                    size="small">
                    size="mini">
                    删除
                  </el-button>
                </template>
@@ -306,7 +310,7 @@
  pointNo: ''
}])
const queryParams = reactive({
  pointType: "MEASURE"
  pointTypes: "MEASURE,CONSTANT",
})
const operatorList = ref(['+', '-', '*', '/', '&', '|', '!', '>', '<'])
const formData = ref({
@@ -345,6 +349,9 @@
  pointName: [{required: true, message: '测点名称不能为空', trigger: 'blur'}],
  pointType: [{required: true, message: '测点类型不能为空', trigger: 'blur'}],
  dataType: [{required: true, message: '数据类型不能为空', trigger: 'blur'}],
  minfreqid: [{required: true, message: '采集频率不能为空', trigger: 'blur'}],
  "measurePoint.valueType": [{required: true, message: '采集频率不能为空', trigger: 'blur'}],
  "measurePoint.dimension": [{required: true, message: '采集频率不能为空', trigger: 'blur'}],
})
const formRef = ref() // 表单 Ref
@@ -438,15 +445,27 @@
    storeType: undefined,
    unit: undefined,
    unittransfactor: 1,
    defaultValue: 10,
    maxValue: 10000000,
    defaultValue: 0,
    maxValue: 100000000,
    minValue: 0,
    minfreqid: undefined,
    remark: undefined,
    isEnable: 1,
    sourceOption: [],
    mathPoint: {},
    measurePoint: {},
    mathPoint: {
      id: '',
      pointId: '',
      expression: ''
    },
    measurePoint: {
      id: '',
      pointId: '',
      sourceType: '',
      sourceId: '',
      tagNo: '',
      dimension: '1',
      valueType: 'SIMULATE',
    }
  }
  formRef.value?.resetFields()
}