index.vue 4.43 KB
<!-- 错误码测试页 -->
<template>
  <div>
    <d2-container>
      <div class="header" slot="header" style="padding: 10px 20px;">
        <d2-search ref="showSearch" class="show-search" label-width="100px" :search-form="searchForm"
          :form-data="showFormData" />
        <div class="up-btns">
          <el-button @click="handleSearch" size="small" type="primary">
            查询
          </el-button>
          <!-- <el-button size="small"
                     @click="handleReset">
            重置
          </el-button> -->
        </div>
      </div>
      <div class="d2-container-content">
        <!-- <p>原有错误码:{{resultMsg.code}}</p> -->
        <!-- <d2-table ref="recordTable"
                  :get-list-api="getListApi"
                  :search-form="searchFormSearch"
                  :table-params="tableParams"
                  :hasPage="false"
                  :before-search-fn="beforeSearchFn">
        </d2-table>
        <br /><br /><br />
        <d2-table ref="recordTable2"
                  :get-list-api="getListApi2"
                  :search-form="searchFormSearch"
                  :table-params="tableParams2"
                  :hasPage="false"
                  :before-search-fn="beforeSearchFn">
        </d2-table> -->
      </div>
    </d2-container>

  </div>
</template>

<script>
import { deepClone } from '@/common/util'
import { getCode, getNewCode } from '@/api/codeTest.js'
export default {
  name: 'CodeTest',
  components: {

  },
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      searchForm: {
        code: ''
      },
      searchFormSearch: {},
      showFormData: [{
        label: '错误码',
        name: 'code',
        type: 'input',
        maxlength: '20',
        isClear: true
      }],
      resultMsg: {}
      // getListApi: getCode,
      // getListApi2: getNewCode,
      // tableParams: {
      //   btnId: new Date().getTime() + parseInt(Math.random() * 1000),
      //   listName: 'list',
      //   tableOption: false,
      //   tableColumns: [{
      //     label: '原有错误码',
      //     prop: 'merchantName'
      //   }, {
      //     label: '原有错误信息',
      //     prop: 'merchantName'
      //   }]
      // },
      // tableParams2: {
      //   btnId: new Date().getTime() + parseInt(Math.random() * 1000),
      //   listName: 'list',
      //   tableOption: false,
      //   tableColumns: [{
      //     label: '现有错误码',
      //     prop: 'merchantName'
      //   }, {
      //     label: '现有错误信息',
      //     prop: 'merchantName'
      //   }]
      // },
    }
  },
  computed: {
  },
  mounted() {

  },

  methods: {

    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchFormSearch = deepClone(this.searchForm)
        resolve()
      })
    },

    getOptionsList() {
      this.showFormData.forEach((item, index) => {
        if (item.type === 'select') {
          if (this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部') {
            const temp = {}
            temp[this.showFormData[index].optionId] = ''
            temp[this.showFormData[index].optionLabel] = '全部'
            this.baseData[item.optionsName].unshift(temp)
          }
          this.$set(this.showFormData[index], 'optionList', this.baseData[item.optionsName])
        }
      })
    },

    handleSearch() {
      // this.$refs.recordTable.refreshTable()
      // this.$refs.recordTable2.refreshTable()

      this.getCode()
      this.getNewCode()
    },
    // handleReset() {
    //   this.searchForm = {
    //     code: ''
    //   }
    //   this.$refs.recordTable.refreshTable()
    //   this.$refs.recordTable2.refreshTable()
    // },

    // 原返回
    getCode(row) {
      getCode({ code: this.searchForm.code }).then(res => {
        console.log('res', res)
      }).catch(() => { })
    },

    // 现返回
    getNewCode(row) {
      getNewCode({ code: this.searchForm.code }).then(res => {
        console.log('res', res)
      }).catch(() => { })
    }

  }
}

</script>
<style lang="scss" scoped>
.reject-dialog {
  margin: 65px 0;

  .reject-input .el-textarea__inner {
    height: 79px;
    width: 432px;
  }

  .el-textarea .el-input__count {
    right: 90px;
    bottom: -10px;
    font-size: 12px;
    color: #999999;
  }

  .tips {
    color: #999999;
  }
}

.footer {
  display: flex;
  justify-content: flex-end;
}
</style>