gaoluyang
2024-07-31 38e6f27a8082e1173e3c02a33da5da39b6c6872c
src/components/do/b6-device-management/b6-data-acquisition-config.vue
@@ -19,12 +19,13 @@
        <el-table-column prop="fileType" align="center" label="文件后缀"></el-table-column>
        <el-table-column prop="collectUrl" align="center" min-width="100" show-overflow-tooltip label="采集地址"></el-table-column>
        <el-table-column prop="storageUrl" align="center" min-width="100" show-overflow-tooltip label="存储地址"></el-table-column>
        <el-table-column prop="ip" align="center" label="IP地址"></el-table-column>
        <el-table-column prop="ip" align="center" label="IP地址" min-width="100"></el-table-column>
        <el-table-column prop="sample" align="center" label="检验对象" show-overflow-tooltip min-width="150"></el-table-column>
        <el-table-column prop="inspectionItem" align="center" label="检验项" min-width="100"></el-table-column>
        <el-table-column prop="inspectionItemSubclass" align="center" label="检验项子项" min-width="100"></el-table-column>
        <el-table-column prop="referx" align="center" label="参照X"></el-table-column>
        <el-table-column prop="referx" align="center" label="参照X" min-width="100"></el-table-column>
        <el-table-column prop="x" align="center" label="X"></el-table-column>
        <el-table-column prop="refery" align="center" label="参照Y"></el-table-column>
        <el-table-column prop="refery" align="center" label="参照Y" min-width="100"></el-table-column>
        <el-table-column prop="y" align="center" label="Y"></el-table-column>
        <el-table-column prop="formula" align="center" label="公式"></el-table-column>
        <el-table-column prop="section" label="操作" width="120">
@@ -82,9 +83,29 @@
          </el-form-item>
        </div>
        <div class="fomItem2">
          <el-form-item class="fomItemInput1" label="公式:">
            <!-- <formula :returnFormula="evalResult"/> -->
            <el-input type="textarea" autosi:autosize="{ minRows: 2, maxRows: 4}"ze placeholder="请输入内容" v-model="configForm.formula" @change="evalResult"> </el-input>
          <el-form-item class="fomItemInput1">
            <template v-slot="label">
              公式:
              <el-tooltip class="itemFomItem" effect="dark" content="求参数最大值,参数个数最少两个,如:MAX(1,2)" placement="top">
                <label>MAX()</label>
              </el-tooltip>
              <el-tooltip class="itemFomItem" effect="dark" content="求参数最小值,参数个数最少两个,如:MIN(1,2)" placement="top">
                <label>MIN()</label>
              </el-tooltip>
              <el-tooltip class="itemFomItem" effect="dark" content="求和,参数个数最少两个,如:SUM(1,2)" placement="top">
                <label>SUM()</label>
              </el-tooltip>
              <el-tooltip class="itemFomItem" effect="dark" content="求绝对值,参数个数最少一个,如:ABS(1)" placement="top">
                <label>ABS()</label>
              </el-tooltip>
              <el-tooltip class="itemFomItem" effect="dark" content="求平均值,参数个数最少两个个,如:AVERAGE(1,2)" placement="top">
                <label>AVERAGE()</label>
              </el-tooltip>
              <el-tooltip class="itemFomItem" effect="dark" content="求中值,参数个数最少两个个,如:MEDIAN(1,2)" placement="top">
                <label>MEDIAN()</label>
              </el-tooltip>
              <el-input type="textarea" autosi:autosize="{ minRows: 2, maxRows: 4}"ze placeholder="请输入内容" v-model="configForm.formula" @change="evalResult"> </el-input>
            </template>
          </el-form-item>
        </div>
      </el-form>
@@ -122,6 +143,16 @@
          </el-option>
        </el-select>
         </div>
      <div v-if="configForm.fileType == '.mdb'" class="search_thing" style="margin-bottom: 14px;">
            <div class="search_label">委托字段:</div>
            <el-input size="small" placeholder="请输入" clearable
                  v-model="configForm.mdbEntrustCode"></el-input>
         </div>
      <div v-if="configForm.fileType == '.mdb'" class="search_thing" style="margin-bottom: 14px;">
            <div class="search_label">样品字段:</div>
            <el-input size="small" placeholder="请输入" clearable
                  v-model="configForm.mdbSampleCode"></el-input>
         </div>
      <span slot="footer" class="dialog-footer">
            <el-row>
               <el-button @click="dialogVisible4=false">取 消</el-button>
@@ -133,12 +164,11 @@
</template>
<script>
import formula from '../../tool/formula.vue'
export default {
  name: "dataAcquisitionConfig",
  // import 引入的组件需要注入到对象中才能使用
  components: {
    formula
  },
  props: {
    deviceId: {
@@ -216,12 +246,12 @@
                index:7
              },
              {
                name:'inspectionItemSubclass',
                index:12
                name:'formula',
                index:13
              },
              {
                name:'inspectionItemSubclass',
                index:13
                index:14
              }
            ]
            }
@@ -300,14 +330,20 @@
        }
    },
    init() {
      this.tableList = []
      // this.tableList = []
      this.$axios.get(this.$api.deviceScope.queryDataAcquisitionConfiguration + "?deviceId=" + this.deviceId + "&isDevice=" + false).then(res => {
        this.tableList = res.data
        this.tableList.forEach(i => {
          // replace(/=/g, ' ')
          i.sample = i.sample.replace(/"/g, '').replace(/],/g, ';').replace(/\[/g, '').replace(/]/g, '')
        })
        if(this.tableList[0]) {
          this.$set(this.configForm, 'fileType', this.tableList[0].fileType)
          this.$set(this.configForm, 'collectUrl', this.tableList[0].collectUrl)
          this.$set(this.configForm, 'storageUrl', this.tableList[0].storageUrl)
          this.$set(this.configForm, 'ip', this.tableList[0].ip)
          this.$set(this.configForm, 'mdbEntrustCode', this.tableList[0].mdbEntrustCode)
          this.$set(this.configForm, 'mdbSampleCode', this.tableList[0].mdbSampleCode)
        }
        // 一般的合并行
        if (this.spanConfig != undefined && this.spanConfig.rows && this.spanConfig.rows.length >
@@ -343,17 +379,21 @@
        collectUrl: this.configForm.collectUrl,
        storageUrl: this.configForm.storageUrl,
        ip: this.configForm.ip,
        isDevice: true
        isDevice: true,
        mdbEntrustCode: this.configForm.mdbEntrustCode,
        mdbSampleCode: this.configForm.mdbSampleCode
      })
      this.upLoad4 = true
      this.$axios.post(this.$api.deviceScope.saveDataAcquisitionConfiguration + "?deviceId=" + this.deviceId, obj, {headers: {
            'Content-Type': 'application/json'
          }}).then(res => {
        this.tableList = res.data
        this.dialogVisible4 = false
        this.upLoad4 = false
        this.init()
        this.$message.success('操作成功')
            if(res.code == 200) {
              this.tableList = res.data
              this.dialogVisible4 = false
              this.init()
              this.$message.success('操作成功')
            }
            this.upLoad4 = false
      }).catch(err => {
        this.upLoad4 = false
      })
@@ -362,7 +402,8 @@
      this.configForm = {
        deviceId: row.deviceId,
        inspectionItem: row.inspectionItem.trim(),
        inspectionItemSubclass: row.inspectionItemSubclass
        inspectionItemSubclass: row.inspectionItemSubclass,
        structureItemParameterId: row.structureItemParameterId
      }
      this.dialogVisible3 = true
      this.$axios.get(this.$api.deviceScope.queryDataAcquisitionConfiguration + "?deviceId=" + this.deviceId +
@@ -405,6 +446,7 @@
            i.deviceId = this.deviceId
            i.inspectionItem = this.configForm.inspectionItem
            i.inspectionItemSubclass = this.configForm.inspectionItemSubclass
            i.structureItemParameterId = this.configForm.structureItemParameterId
          })
          this.$axios.post(this.$api.deviceScope.saveDataAcquisitionConfiguration + "?deviceId=" + this.deviceId, {dataConfigList: this.domains, isDevice: false},{headers: {
            'Content-Type': 'application/json'
@@ -485,6 +527,10 @@
</script>
<style scoped>
.itemFomItem {
  margin-left: 20px;
}
.search_thing {
      width: 350px;
      display: flex;