Crunchy
2024-07-22 6896e8f3aa1e2b5a20eb430792e0e74112c5a44c
设备数采配置 调整
已修改2个文件
130 ■■■■ 文件已修改
src/components/do/b6-device-management/b6-data-acquisition-config.vue 126 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/a6-device-management.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/do/b6-device-management/b6-data-acquisition-config.vue
@@ -4,6 +4,7 @@
      <el-row class="title">
        <el-col :span="6" style="padding-left: 20px;text-align: left;">数采配置</el-col>
        <el-col :span="18" style="text-align: right;">
          <el-button size="medium" type="primary" @click="fileConfiguration">文件配置</el-button>
          <el-button size="medium" @click="$parent.closeDataVue()">
            <span style="color: #3A7BFA;">返回</span>
          </el-button>
@@ -14,9 +15,18 @@
      <el-table :data="tableList.slice((page.current - 1) * page.size, page.current * page.size)"
                border tooltip-effect="dark" style="width: 100%;" height="100%">
        <el-table-column type="index" label="序号" align="center" width="65"></el-table-column>
        <el-table-column prop="inspectionItemSubclass" align="center" label="检验项"></el-table-column>
        <el-table-column prop="insProductItem" align="center" label="检验项子项">
        </el-table-column>
        <el-table-column prop="deviceName" align="center" min-width="100" label="设备名称"></el-table-column>
        <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="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="x" align="center" label="X"></el-table-column>
        <el-table-column prop="refery" align="center" label="参照Y"></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">
          <template slot-scope="scope">
            <el-button type="text" @click="dataConfig(scope.row)">数采配置</el-button>
@@ -84,6 +94,40 @@
                </el-row>
            </span>
    </el-dialog>
    <el-dialog title="数采配置" :visible.sync="dialogVisible4" width="400px">
      <div class="search_thing" style="margin-bottom: 14px;">
                <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>IP:</div>
                <el-input size="small" placeholder="请输入" clearable
                        v-model="configForm.ip"></el-input>
            </div>
      <div class="search_thing" style="margin-bottom: 14px;">
                <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>采集地址:</div>
                <el-input size="small" placeholder="请输入" clearable
                        v-model="configForm.collectUrl"></el-input>
            </div>
      <div class="search_thing" style="margin-bottom: 14px;">
                <div class="search_label">储存地址:</div>
                <el-input size="small" placeholder="请输入" clearable
                        v-model="configForm.storageUrl"></el-input>
            </div>
      <div class="search_thing" style="margin-bottom: 14px;">
                <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>文件后缀:</div>
        <el-select v-model="configForm.fileType" size="small" placeholder="请选择" style="width: 100%;">
          <el-option
            v-for="item in fileTypeOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
            </div>
      <span slot="footer" class="dialog-footer">
                <el-row>
                    <el-button @click="dialogVisible4=false">取 消</el-button>
                    <el-button type="primary" @click="submitForm4" :loading="upLoad4">确 定</el-button>
                </el-row>
            </span>
    </el-dialog>
  </div>
</template>
@@ -93,21 +137,19 @@
  // import 引入的组件需要注入到对象中才能使用
  components: {},
  props: {
    tableList: {
      type: Array,
    deviceId: {
      type: Number,
      default: () => []
    }
  },
  mounted() {
    this.tableList.forEach(i => {
      let data = i.insProductItem.split(',')
      i.insProductItem = data[data.length - 1]
      i.inspectionItemSubclass = data[data.length - 2]
    })
    this.init()
  },
  data() {
    // 这里存放数据
    return {
      dialogVisible4: false,
      tableList: [],
      page: {
        current: 1,
        size: 20,
@@ -125,6 +167,7 @@
        }
      ],
      upLoad3:false,
      upLoad4:false,
      fileTypeOptions: [
        {label: 'csv', value: '.csv'},
        {label: 'db', value: '.db'},
@@ -138,13 +181,56 @@
  },
  // 方法集合
  methods: {
    fileConfiguration() {
      this.dialogVisible4 = true
      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)
        }
    },
    init() {
      this.tableList = []
      this.$axios.get(this.$api.deviceScope.queryDataAcquisitionConfiguration + "?deviceId=" + this.deviceId + "&isDevice=" + false).then(res => {
        this.tableList = res.data
        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)
        }
      })
    },
    submitForm4() {
      const obj = Object.assign({
        deviceId: this.deviceId,
        fileType: this.configForm.fileType,
        collectUrl: this.configForm.collectUrl,
        storageUrl: this.configForm.storageUrl,
        ip: this.configForm.ip,
        isDevice: true
      })
      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('操作成功')
      }).catch(err => {
        this.upLoad4 = false
      })
    },
    dataConfig (row) {
      this.configForm = {
        deviceId: row.deviceId,
        insProductItem: row.insProductItem.trim()
        insProductItem: row.inspectionItemSubClass.trim()
      }
      this.dialogVisible3 = true
      this.$axios.get(this.$api.deviceScope.queryDataAcquisitionConfiguration + "?deviceId=" + row.deviceId + "&insProductItem=" + row.insProductItem.trim()).then(res => {
      this.$axios.get(this.$api.deviceScope.queryDataAcquisitionConfiguration + "?deviceId=" + this.deviceId + "&insProductItem=" + row.inspectionItemSubClass.trim()  + "&isDevice=" + true).then(res => {
        const data = res.data
        if(data[0]) {
          this.domains.splice(0, 1)
@@ -178,10 +264,10 @@
              i.y = null
            }
            i.formula = this.configForm.formula
            i.deviceId = this.configForm.deviceId
            i.deviceId = this.deviceId
            i.insProductItem = this.configForm.insProductItem
          })
          this.$axios.post(this.$api.deviceScope.saveDataAcquisitionConfiguration, {dataConfigList: this.domains},{headers: {
          this.$axios.post(this.$api.deviceScope.saveDataAcquisitionConfiguration + "?deviceId=" + this.deviceId, {dataConfigList: this.domains, isDevice: false},{headers: {
            'Content-Type': 'application/json'
          }}).then(res => {
            this.dialogVisible3 = false
@@ -194,6 +280,7 @@
                id: ''
              }
            ]
            this.init()
            this.$message.success('添加成功')
          })
        } else {
@@ -253,6 +340,17 @@
</script>
<style scoped>
.search_thing {
        width: 350px;
        display: flex;
        align-items: center;
    }
  .search_label {
        width: 110px;
        font-size: 14px;
        text-align: right;
    }
.data-acquisition-config {
  width: 100%;
  height: 100%;
src/components/view/a6-device-management.vue
@@ -449,7 +449,7 @@
                </el-row>
            </span>
    </el-dialog>
    <dataAcquisitionConfig v-if="showData" :tableList="tableList"/>
    <dataAcquisitionConfig v-if="showData" :deviceId="deviceId"/>
    </div>
</template>
@@ -463,6 +463,7 @@
        },
        data() {
            return {
                deviceId: '',
                fileTypeOptions: [
                    {label: 'csv', value: '.csv'},
                    {label: 'db', value: '.db'},
@@ -914,6 +915,7 @@
          list2.push(obj)
        })
        this.tableList = list2
        this.deviceId = row.id
      },
      closeDataVue () {
        this.showData = false