<template>
  <div>
    <el-button type="primary" icon="el-icon-plus" plain @click="handleAdd" class="myButton">新增</el-button>
    <!--上报对象表格-->
    <el-table
      :data="tableData"
      :header-cell-style="{background:'#ECF1FE'}"
      v-loading="tableLoading" border style="width: 100%">
      <el-table-column type="expand">
        <template slot-scope="props">
          <table style="width: 100%;text-align: left">
            <tr>
              <td>温度瞬时公式：{{ props.row.tInst }}</td>
              <td>湿度瞬时公式：{{ props.row.rhInst }}</td>
              <td>气压瞬时公式：{{ props.row.paInst }}</td>
            </tr>
            <tr>
            <tr>
              <td>10米风速瞬时公式：{{ props.row.wsInst10 }}</td>
              <td>10米风向瞬时公式：{{ props.row.wdInst10 }}</td>
              <td>30米风速瞬时公式：{{ props.row.wsInst30 }}</td>
            </tr>
            <tr>
              <td>30米风向瞬时公式：{{ props.row.wdInst30 }}</td>
              <td>50米风速瞬时公式：{{ props.row.wsInst50 }}</td>
              <td>50米风向瞬时公式：{{ props.row.wdInst50 }}</td>
            </tr>
            <tr>
              <td>60米风速瞬时公式：{{ props.row.wsInst60 }}</td>
              <td>60米风向瞬时公式：{{ props.row.wdInst60 }}</td>
              <td>70米风速瞬时公式：{{ props.row.wsInst70 }}</td>
            </tr>
            <tr>
              <td>70米风向瞬时公式：{{ props.row.wdInst70 }}</td>
              <td>80米风速瞬时公式：{{ props.row.wsInst80 }}</td>
              <td>80米风向瞬时公式：{{ props.row.wdInst80 }}</td>
            </tr>
            <tr>
              <td>90米风速瞬时公式：{{ props.row.wsInst90 }}</td>
              <td>90米风向瞬时公式：{{ props.row.wdInst90 }}</td>
              <td>100米风速瞬时公式：{{ props.row.wsInst100 }}</td>
            </tr>
            <tr>
              <td>100米风向瞬时公式：{{ props.row.wdInst100 }}</td>
              <td>110米风速瞬时公式：{{ props.row.wsInst110 }}</td>
              <td>110米风向瞬时公式：{{ props.row.wdInst110 }}</td>
            </tr>
            <tr>
              <td>120米风速瞬时公式：{{ props.row.wsInst120 }}</td>
              <td>120米风向瞬时公式：{{ props.row.wdInst120 }}</td>
              <td>轮毂风速瞬时公式：{{ props.row.wsInstHubHeight }}</td>
            </tr>
            <tr>
              <td>轮毂风向瞬时公式：{{ props.row.wdInstHubHeight }}</td>
            </tr>
          </table>
        </template>
      </el-table-column>
      <el-table-column prop="fileName" align="center" label="文件名关键字" width="200px"></el-table-column>
      <el-table-column prop="dataType" align="center" label="数据类型" width="100px" :formatter="formatDataType"></el-table-column>
      <el-table-column prop="time" align="center" label="预测时间公式"  width="300px"></el-table-column>
      <el-table-column prop="stationCode" align="center" label="场站编号"></el-table-column>
      <el-table-column label="操作" align="center" width="150px">
        <template slot-scope="scope">
          <el-button type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
          <el-button type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="block">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page=this.page.currentPage
        :page-sizes="[10, 15, 30, 50]"
        :page-size=this.page.pageSize
        layout="total, sizes, prev, pager, next, jumper"
        :total=this.page.total>
      </el-pagination>
    </div>
    <!--编辑框-->
    <el-dialog :title="saveFlag==1?'新增':'编辑'" :visible.sync="visible" width="100%" :fullscreen="true">

      <el-row :gutter="20">
        <el-col :span="17">
          <div>
                    <span style="color: red">
            <font size="4px">灰色文本框需要点击后，在右侧进行编辑录入！</font>
                    </span>
          </div>
          &nbsp;
          <div class="grid-content bg-purple">
            <el-form v-model="form" ref="form" :key="timer">
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="fileName" label-width="150px">
                    <span slot="label">
                      <font color="red">*</font>文件名关键字
                    </span>
                    <el-input v-model="form.fileName" @focus="clearformula"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="dataType" label-width="150px">
                    <span slot="label">
                      <font color="red">*</font>数据类型
                    </span>
                    <el-select v-model="form.dataType" clearable @focus="clearformula">
                      <el-option
                        v-for="item in this.dataType"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"/>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item prop="stationCode" label-width="150px">
                    <span slot="label">
                      <font color="red">*</font>场站编号
                    </span>
                    <el-select v-model="form.stationCode" multiple clearable @focus="clearformula" style="width: 100%">
                      <el-option
                        v-for="item in this.stationCodeList"
                        :key="item.stationCode"
                        :label="item.stationCode"
                        :value="item.stationCode"/>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="time" label-width="150px" class="formulaColor">
                    <span slot="label">
                     <font color="red">*</font>预测时间公式
                    </span>
                    <el-input v-model="form.time" readonly
                              @click.native="ftck(form.time,'form.time','(预测时间)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="tInst" label-width="150px" class="formulaColor">
                    <span slot="label">
                      温度瞬时公式
                    </span>
                    <el-input v-model="form.tInst" readonly
                              @click.native="ftck(form.tInst,'form.tInst','(温度瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="rhInst" label-width="150px" class="formulaColor">
                    <span slot="label">
                      湿度瞬时公式
                    </span>
                    <el-input v-model="form.rhInst" readonly
                              @click.native="ftck(form.rhInst,'form.rhInst','(湿度瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="paInst" label-width="150px" class="formulaColor">
                    <span slot="label">
                     气压瞬时公式
                    </span>
                    <el-input v-model="form.paInst" readonly
                              @click.native="ftck(form.paInst,'form.paInst','(气压瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wsInst10" label-width="150px" class="formulaColor">
                    <span slot="label">
                      10米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst10" readonly
                              @click.native="ftck(form.wsInst10,'form.wsInst10','(10米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wdInst10" label-width="150px" class="formulaColor">
                    <span slot="label">
                      10米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst10" readonly
                              @click.native="ftck(form.wdInst10,'form.wdInst10','(10米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="wsInst30" label-width="150px" class="formulaColor">
                    <span slot="label">
                     30米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst30" readonly
                              @click.native="ftck(form.wsInst30,'form.wsInst30','(30米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wdInst30" label-width="150px" class="formulaColor">
                    <span slot="label">
                      30米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst30" readonly
                              @click.native="ftck(form.wdInst30,'form.wdInst30','(30米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wsInst50" label-width="150px" class="formulaColor">
                    <span slot="label">
                      50米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst50" readonly
                              @click.native="ftck(form.wsInst50,'form.wsInst50','(50米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="wdInst50" label-width="150px" class="formulaColor">
                    <span slot="label">
                      50米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst50" readonly
                              @click.native="ftck(form.wdInst50,'form.wdInst50','(50米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wsInst60" label-width="150px" class="formulaColor">
                    <span slot="label">
                      60米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst60" readonly
                              @click.native="ftck(form.wsInst60,'form.wsInst60','(60米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wdInst60" label-width="150px" class="formulaColor">
                    <span slot="label">
                      60米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst60" readonly
                              @click.native="ftck(form.wdInst60,'form.wdInst60','(60米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="wsInst70" label-width="150px" class="formulaColor">
                    <span slot="label">
                      70米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst70" readonly
                              @click.native="ftck(form.wsInst70,'form.wsInst70','(70米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wdInst70" label-width="150px" class="formulaColor">
                    <span slot="label">
                      70米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst70" readonly
                              @click.native="ftck(form.wdInst70,'form.wdInst70','(70米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wsInst80" label-width="150px" class="formulaColor">
                    <span slot="label">
                      80米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst80" readonly
                              @click.native="ftck(form.wsInst80,'form.wsInst80','(80米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="wdInst80" label-width="150px" class="formulaColor">
                    <span slot="label">
                      80米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst80" readonly
                              @click.native="ftck(form.wdInst80,'form.wdInst80','(80米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wsInst90" label-width="150px" class="formulaColor">
                    <span slot="label">
                      90米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst90" readonly
                              @click.native="ftck(form.wsInst90,'form.wsInst90','(90米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wdInst90" label-width="150px" class="formulaColor">
                    <span slot="label">
                      90米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst90" readonly
                              @click.native="ftck(form.wdInst90,'form.wdInst90','(90米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="wsInst100" label-width="150px" class="formulaColor">
                    <span slot="label">
                      100米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst100" readonly
                              @click.native="ftck(form.wsInst100,'form.wsInst100','(100米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wdInst100" label-width="150px" class="formulaColor">
                    <span slot="label">
                      100米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst100" readonly
                              @click.native="ftck(form.wdInst100,'form.wdInst100','(100米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wsInst110" label-width="150px" class="formulaColor">
                    <span slot="label">
                      110米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst110" readonly
                              @click.native="ftck(form.wsInst110,'form.wsInst110','(110米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="wdInst110" label-width="150px" class="formulaColor">
                    <span slot="label">
                      110米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst110" readonly
                              @click.native="ftck(form.wdInst110,'form.wdInst110','(110米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wsInst120" label-width="150px" class="formulaColor">
                    <span slot="label">
                      120米风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInst120" readonly
                              @click.native="ftck(form.wsInst120,'form.wsInst120','(120米风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wdInst120" label-width="150px" class="formulaColor">
                    <span slot="label">
                      120米风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInst120" readonly
                              @click.native="ftck(form.wdInst120,'form.wdInst120','(120米风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="8">
                  <el-form-item prop="wsInstHubHeight" label-width="150px" class="formulaColor">
                    <span slot="label">
                      轮毂风速瞬时公式
                    </span>
                    <el-input v-model="form.wsInstHubHeight" readonly
                              @click.native="ftck(form.wsInstHubHeight,'form.wsInstHubHeight','(轮毂风速瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="wdInstHubHeight" label-width="150px" class="formulaColor">
                    <span slot="label">
                      轮毂风向瞬时公式
                    </span>
                    <el-input v-model="form.wdInstHubHeight" readonly
                              @click.native="ftck(form.wdInstHubHeight,'form.wdInstHubHeight','(轮毂风向瞬时)')"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
              <el-button type="primary" @click="handleSave('form')">
                <span v-if="saveFlag == 1">保 存</span>
                <span v-else>修 改</span>
              </el-button>
              <el-button @click="visible = false">取 消</el-button>
            </div>
          </div>
        </el-col>
        <el-col :span="1">
          <el-divider direction="vertical" style="height: 200px"></el-divider>
        </el-col>
        <el-col :span="5">
          <h2>公式编辑区{{ this.editinfo }}</h2>
          <el-form>
            <el-row>
              <el-col>
                <el-form-item prop="rownumber" label-width="150px">
                  <span slot="label">
                      <font color="red">*</font>解析行
                  </span>
                  <el-input v-model="pfform.rownumber"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item prop="columnumber" label-width="150px">
                  <span slot="label">
                      <font color="red">*</font>解析列
                  </span>
                  <el-input v-model="pfform.columnumber"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="标签名" prop="signname" label-width="150px">
                  <el-input v-model="pfform.signname"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col>
                <el-form-item label="时间格式" prop="timeformat" label-width="150px">
                  <el-select v-model="pfform.timeformat" clearable>
                    <el-option
                      v-for="item in this.timeFormat"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"/>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-button type="primary" @click="genformula">
                <span>生成公式</span>
              </el-button>
              <el-button type="primary" @click="destoryformula">
                <span>清除录入</span>
              </el-button>
            </el-row>
          </el-form>
        </el-col>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>

export default {
  name: "index",
  data() {
    return {
      stationCodeList: [],
      dataType: [
        {value: 's', label: '时间单行'},
        {value: 'm', label: '时间多行'}
      ],
      timeFormat: [
        {value: 'yyyy-MM-dd HH:mm:ss', label: 'yyyy-MM-dd HH:mm:ss'},
        {value: 'yyyy-MM-dd', label: 'yyyy-MM-dd'},
        {value: 'yyyy-MM-dd_HH:mm', label: 'yyyy-MM-dd_HH:mm'},
        {value: 'yyyy-MM-dd_HH:mm:ss', label: 'yyyy-MM-dd_HH:mm:ss'}
      ],
      editinfo: '',
      timer: new Date().getTime(),
      props: {multiple: true},
      staionList: [],//场站集合
      tableLoading: false,
      tableData: [],
      page: {
        total: 0, // 总页数
        currentPage: 1, // 当前页数
        pageSize: 10 // 每页显示多少条
      },
      info: '',
      visible: false,

      form: {
        fileName: '',
        time: '',
        dataType: '',
        stationCode: '',
        tInst: '',
        rhInst: '',
        paInst: '',
        wsInst10: '',
        wdInst10: '',
        wsInst30: '',
        wdInst30: '',
        wsInst50: '',
        wdInst50: '',
        wsInst60: '',
        wdInst60: '',
        wsInst70: '',
        wdInst70: '',
        wsInst80: '',
        wdInst80: '',
        wsInst90: '',
        wdInst90: '',
        wsInst100: '',
        wdInst100: '',
        wsInst110: '',
        wdInst110: '',
        wsInst120: '',
        wdInst120: '',
        wsInstHubHeight: '',
        wdInstHubHeight: ''
      },
      pfform: {
        rownumber: '',
        columnumber: '',
        signname: '',
        timeformat: ''
      },
      tempformulasign: '',
      saveFlag: 1
    };
  },
  mounted() {
    this.getElectricFieldList()
    this.getTableList()
  },
  methods: {
    formatDataType(row, column) {
      let belongTo = '未知类型'
      for (let i = 0; i < this.dataType.length; i++) {
        if (row.dataType === this.dataType[i].value) {
          belongTo = this.dataType[i].label
        }
      }
      return belongTo
    },
    getTableList() {
      this.tableLoading = true
      // 获取列表
      this.$axios.get("/parsingCft/page",Object.assign({
        current: this.page.currentPage,
        size: this.page.pageSize
      })).then(response => {
        this.tableData = response.data.data.records
        this.page.total = response.data.data.total
        this.tableLoading = false
      }).catch((e) => {
        this.tableLoading = false
      })
    },
    getElectricFieldList() {
      // 获取所有场站
      this.$axios("/parsingInfo/getElectricField").then(response => {
        this.stationCodeList = response.data.data
        this.tableLoading = false
      }).catch((e) => {
        this.tableLoading = false
      })
    },
    destoryformula() {
      // 清空公式区字段
      if (this.tempformulasign == 'form.time') {
        this.form.time = ''
      }
      else if (this.tempformulasign == 'form.tInst') {
        this.form.tInst = ''
      }
      else if (this.tempformulasign == 'form.rhInst') {
        this.form.rhInst = ''
      }
      else if (this.tempformulasign == 'form.paInst') {
        this.form.paInst = ''
      }
      else if (this.tempformulasign == 'form.wsInst10') {
        this.form.wsInst10 = ''
      }
      else if (this.tempformulasign == 'form.wdInst10') {
        this.form.wdInst10 = ''
      }
      else if (this.tempformulasign == 'form.wsInst30') {
        this.form.wsInst30 = ''
      }
      else if (this.tempformulasign == 'form.wdInst30') {
        this.form.wdInst30 = ''
      }
      else if (this.tempformulasign == 'form.wsInst50') {
        this.form.wsInst50 = ''
      }
      else if (this.tempformulasign == 'form.wdInst50') {
        this.form.wdInst50 = ''
      }
      else if (this.tempformulasign == 'form.wsInst60') {
        this.form.wsInst60 = ''
      }
      else if (this.tempformulasign == 'form.wdInst60') {
        this.form.wdInst60 = ''
      }
      else if (this.tempformulasign == 'form.wsInst70') {
        this.form.wsInst70 = ''
      }
      else if (this.tempformulasign == 'form.wdInst70') {
        this.form.wdInst70 = ''
      }
      else if (this.tempformulasign == 'form.wsInst80') {
        this.form.wsInst80 = ''
      }
      else if (this.tempformulasign == 'form.wdInst80') {
        this.form.wdInst80 = ''
      }
      else if (this.tempformulasign == 'form.wsInst90') {
        this.form.wsInst90 = ''
      }
      else if (this.tempformulasign == 'form.wdInst90') {
        this.form.wdInst90 = ''
      }
      else if (this.tempformulasign == 'form.wsInst100') {
        this.form.wsInst100 = ''
      }
      else if (this.tempformulasign == 'form.wdInst100') {
        this.form.wdInst100 = ''
      }
      else if (this.tempformulasign == 'form.wsInst110') {
        this.form.wsInst110 = ''
      }
      else if (this.tempformulasign == 'form.wdInst110') {
        this.form.wdInst110 = ''
      }
      else if (this.tempformulasign == 'form.wsInst120') {
        this.form.wsInst120 = ''
      }
      else if (this.tempformulasign == 'form.wdInst120') {
        this.form.wdInst120 = ''
      }
      else if (this.tempformulasign == 'form.wsInstHubHeight') {
        this.form.wsInstHubHeight = ''
      }
      else if (this.tempformulasign == 'form.wdInstHubHeight') {
        this.form.wdInstHubHeight = ''
      }
      this.clearformula()
    },
    clearformula() {
      // 清空公式区字段
      this.pfform.rownumber = ''
      this.pfform.columnumber = ''
      this.pfform.signname = ''
      this.pfform.timeformat = ''
      this.editinfo = ''
      this.tempformulasign = ''
    },
    ftck(obj, sign, editname) {
      this.clearformula()
      if (obj != undefined && obj != null) {
        var objs = obj.split('<=>')
        for (let i = 0; i < objs.length; i++) {
          if (objs[i] != "") {
            if (i == 0) {
              this.pfform.rownumber = objs[i]
            } else if (i == 1) {
              this.pfform.columnumber = objs[i]
            } else if (i == 2) {
              this.pfform.signname = objs[i]
            } else if (i == 3) {
              this.pfform.timeformat = objs[i]
            }
          }
        }
      }
      this.tempformulasign = sign;
      this.editinfo = editname
    },
    genformula() {
      if (this.tempformulasign==''){
        this.$message.warning('请先选定左侧公式项')
        return
      }
      if (!this.pfform.rownumber || !this.pfform.columnumber) {
        this.$message.warning('填写必填项')
        return
      }
      if ((this.pfform.signname && !this.pfform.timeformat) || (!this.pfform.signname && this.pfform.timeformat)) {
        this.$message.warning('标签名称和时间格式要同时填写')
        return
      }
      // 拼装公式
      var resultStr = ''
      if (this.pfform.rownumber) {
        resultStr = this.pfform.rownumber
      }
      if (this.pfform.columnumber) {
        resultStr = resultStr + '<=>' + this.pfform.columnumber
      }
      if (this.pfform.signname) {
        resultStr = resultStr + '<=>' + this.pfform.signname
      }
      if (this.pfform.timeformat) {
        resultStr = resultStr + '<=>' + this.pfform.timeformat
      }
      // 将生成的公式赋值到左侧表格中
      if (this.tempformulasign == 'form.time') {
        this.form.time = resultStr
      }
      else if (this.tempformulasign == 'form.tInst') {
        this.form.tInst = resultStr
      }
      else if (this.tempformulasign == 'form.rhInst') {
        this.form.rhInst = resultStr
      }
      else if (this.tempformulasign == 'form.paInst') {
        this.form.paInst = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst10') {
        this.form.wsInst10 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst10') {
        this.form.wdInst10 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst30') {
        this.form.wsInst30 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst30') {
        this.form.wdInst30 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst50') {
        this.form.wsInst50 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst50') {
        this.form.wdInst50 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst60') {
        this.form.wsInst60 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst60') {
        this.form.wdInst60 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst70') {
        this.form.wsInst70 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst70') {
        this.form.wdInst70 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst80') {
        this.form.wsInst80 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst80') {
        this.form.wdInst80 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst90') {
        this.form.wsInst90 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst90') {
        this.form.wdInst90 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst100') {
        this.form.wsInst100 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst100') {
        this.form.wdInst100 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst110') {
        this.form.wsInst110 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst110') {
        this.form.wdInst110 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInst120') {
        this.form.wsInst120 = resultStr
      }
      else if (this.tempformulasign == 'form.wdInst120') {
        this.form.wdInst120 = resultStr
      }
      else if (this.tempformulasign == 'form.wsInstHubHeight') {
        this.form.wsInstHubHeight = resultStr
      }
      else if (this.tempformulasign == 'form.wdInstHubHeight') {
        this.form.wdInstHubHeight = resultStr
      }
      this.timer = new Date().getTime()
      this.clearformula()
    },
    /*保存*/
    handleSave(formName) {
      if (!this.form.fileName || !this.form.time || !this.form.dataType || this.form.stationCode=="") {
        this.$message.warning('填写必填项');
        return false;
      } else {
        const data = this.form.stationCode
        let data1 = "";
        for (let n = 0; n < data.length; n++) {
          for (let j = 0; j < this.stationCodeList.length; j++) {
            if (data[n] == this.stationCodeList[j]["stationCode"]) {
              data1 = data1 + this.stationCodeList[j]["stationCode"] + ","
            }
          }
        }
        data1 = data1.substr(0, data1.length - 1)
        this.form.stationCode = data1
        if (this.saveFlag === 1) {
          this.$axios.post("/parsingCft",this.form).then(response => {
            this.dialogVisible = false
            this.getTableList()
            this.tableLoading = false
            this.$message.success(response.data.data)
          }).catch(() => {
            this.tableLoading = false
          })
        } else {
          this.$axios.put("/parsingCft", this.form).then(response => {
            this.dialogVisible = false
            this.getTableList()
            this.tableLoading = false
            this.$message.success(response.data.data)
          }).catch(() => {
            this.tableLoading = false
          })
        }
        this.visible = false
      }
    },
    /*上报对象*/
    handleAdd() {
      this.saveFlag = 1
      this.info = ''
      this.form = {}
      this.clearformula()
      this.visible = true
    },
    /*上报对象编辑*/
    handleEdit(row) {
      this.saveFlag = 2
      let newRow = Object.assign({},row)
      let tempStationCode = newRow.stationCode.split(',')
      this.form = newRow
      this.form.stationCode = tempStationCode
      this.clearformula()
      this.visible = true
    },
    /*上报对象删除*/
    handleDelete(row) {
      this.$confirm('是否确认删除此条配置?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete("/parsingCft/"+row.id).then(response => {
          this.getTableList()
          this.$message.success(response.data.data)
        })
      })
    },
    /*上报对象pageSize改变*/
    handleSizeChange(val) {
      this.page.pageSize = val
      this.page.currentPage = 1
      this.getTableList()

    },
    /*上报对象currentPage改变*/
    handleCurrentChange(val) {
      this.page.currentPage = val
      this.getTableList()
    }
  }
}
</script>

<style scoped>
.block {
  float: right;
}

.myButton {
  margin-bottom: .5%;
}

.uploadno {
  background: #2d8cf0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  text-align: center;
  display: inline-block;
  color: #fff;
}

.el-divider--vertical {
  display: inline-block;
  width: 1px;
  height: 35em;
  margin: 0 8px;
  vertical-align: middle;
  position: relative;
}

/deep/ .formulaColor .el-input--small .el-input__inner {
  height: 32px;
  line-height: 32px;
  background-color: #cccccc;
}

</style>
