index.vue 4.96 KB
<!--
 * @Author: huyue
 * @Date: 2022-02-11 10:20:32
 * @LastEditTime: 2022-07-11 18:22:25
 * @LastEditors: huyue
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \scrm-micro-pay\src\views\account\index.vue
-->
<template>
  <div class="container">
    <div>
      <span class="container-header">代开发应用配置</span>
      <span class="container-tip">提供企微代开发应用的配置管理</span>
    </div>
    <div class="table-box">
      <GLCombiForm :rowNumber="1" :formObj="searchForm.condition" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
      <GLTable ref="accountTable" :noDataImg="url" :getListApi="getListApi" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
        <template slot="auth-button" slot-scope="scope" :data="scope.scope">
          <!-- <el-button type="text" @click="viewConfig(scope.scope)">查看配置</el-button> -->
          <GLButton type="text" @click="viewConfig(scope.scope)" fn="查看配置">查看配置</GLButton>
        </template>
      </GLTable>
    </div>
  </div>
</template>

<script>
import { MODEL } from '@/utils/data'
import url from '@/assets/empty.png'
export default {
  name: 'AppConfig',
  data() {
    return {
      url,
      searchForm: {
        condition: {}
      },
      searchFormData: [
        {
          label: '模式',
          name: 'merchantModel',
          type: 'select',
          optionList: [
            {
              label: '全部',
              value: ''
            },
            {
              label: '单店企微模式',
              value: 2
            },
            {
              label: '集团企微模式',
              value: 1
            }
          ],
          optionId: 'value',
          optionLabel: 'label',
          isClear: true
        },
        {
          label: '商户名称',
          name: 'merchantName',
          type: 'input',
          isClear: true
        },
        {
          label: '商户号',
          name: 'merchantId',
          type: 'input',
          isClear: true,
          listeners: {
            input: value => {
              this.searchForm.condition.merchantId = value.replace(/[^\d]/g, '')
            }
          }
        },
        {
          label: '关联的企微',
          name: 'corpAlias',
          type: 'input',
          isClear: true
        }
      ],
      tableParams: {
        listName: 'list',
        tableOption: true,
        tableColumns: [
          {
            label: '商户号',
            prop: 'merchantId'
          },
          {
            label: '商户名称',
            prop: 'merchantName'
          },
          {
            label: '模式',
            prop: 'merchantModel',
            formatter: cellValue => {
              return MODEL[cellValue.merchantModel]
            }
          },
          {
            label: '关联的企业微信',
            prop: 'corpAlias'
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      tableData: [
        {
          id: 1,
          merchantId: 10000,
          merchantName: '嘀加A门店',
          merchantModel: 1,
          corpAlias: '嘀加云科技'
        },
        {
          id: 2,
          merchantId: 10001,
          merchantName: '嘀加b门店',
          merchantModel: 2,
          corpAlias: '嘀加云科技'
        },
        {
          id: 3,
          merchantId: 10002,
          merchantName: '嘀加C门店',
          merchantModel: 1,
          corpAlias: ''
        },
        {
          id: 4,
          merchantId: 10003,
          merchantName: '嘀加D门店',
          merchantModel: 1,
          corpAlias: '嘀加云科技'
        }
      ],
      getListApi: this.$apis.appConfig.agentList
    }
  },
  mounted() {},
  methods: {
    viewConfig(row) {
      this.$router.push('/appConfig/viewConfig/' + row.appId)
    },
    handleSearch() {
      this.$refs.accountTable.refreshTable()
    },
    handleReset() {
      this.searchForm.condition = {}
      this.handleSearch()
    },
    setTableFinishFun() {
      console.log(this.$refs.accountTable.data, '---')
      //接收到的数据为空
      this.$refs.accountTable.data.length ? (this.$refs.accountTable.tableHeightValues = '') : this.$refs.accountTable.setTableHeightFun()
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  &-header {
    font-size: 20px;
    font-weight: 600;
    color: #333333;
    line-height: 20px;
    letter-spacing: 1px;
    margin-right: 12px;
  }
  &-tip {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #666666;
    line-height: 20px;
  }
  .table-box {
    margin: 20px 0;
    padding: 20px;
    background-color: #fff;
  }
  .footer-btns {
    float: right;
  }
}
/deep/.el-table th > .cell {
  padding: 0 16px;
}
</style>