<template>
  <div>
    <el-dialog
      :title="title"
      :close-on-click-modal="false"
	  draggable
      width="880px"
      append-to-body
      height="500px"
      @close="close"
      v-model="visibleChoose">
      <div style="height: calc(100%);">
        <el-form :inline="true" class="query-form" ref="searchForm" :model="searchForm" @submit.native.prevent>
          <!-- 搜索框-->
          <el-form-item label="" prop="clientNo">
            <el-input v-model="searchForm.clientNo" @keyup.enter.native="list" placeholder="客户编号" clearable></el-input>
          </el-form-item>
          <el-form-item label="" prop="createName">
            <el-input v-model="searchForm.createName" @keyup.enter.native="list" placeholder="修改申请发起人" clearable></el-input>
          </el-form-item>

          <el-form-item label="" prop="status">
            <el-select v-model="searchForm.status" placeholder="申请状态" clearable>
              <el-option
                v-for="item in $dictUtils.getDictList('cw_work_client_temp_status')"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>

          <el-form-item>
            <el-button type="primary" @click="list()" icon="el-icon-search">查询</el-button>
            <el-button @click="resetSearch()" icon="el-icon-refresh-right">重置</el-button>
          </el-form-item>
        </el-form>

        <vxe-table
          border="inner"
          auto-resize
          resizable
          max-height="400px"
          :loading="loading"
          ref="clientTable"
          show-header-overflow
          show-overflow
          highlight-hover-row
          :menu-config="{}"
          :print-config="{}"
          :sort-config="{remote:true}"
          :data="dataList">
          <vxe-column type="seq" width="40"></vxe-column>
          <vxe-column min-width="150" title="客户编号" align="center" field="clientNo"></vxe-column>
          <vxe-column min-width="150" title="修改申请发起人" align="center" field="createName"></vxe-column>
          <vxe-column min-width="150" title="修改申请发起时间" align="center" field="createTime"></vxe-column>
          <vxe-column min-width="150" title="申请状态" align="center" field="status">
            <template #default="scope">
              <span v-if="scope.row.status === '2'" style="color: #409EFF"><b>{{$dictUtils.getDictLabel('cw_work_client_temp_status', scope.row.status, '-')}}</b></span>
              <span v-if="scope.row.status === '3'" style="color: #E6A23C"><b>{{$dictUtils.getDictLabel('cw_work_client_temp_status', scope.row.status, '-')}}</b></span>
              <span v-if="scope.row.status === '4'" style="color: #F56C6C"><b>{{$dictUtils.getDictLabel('cw_work_client_temp_status', scope.row.status, '-')}}</b></span>
              <span v-if="scope.row.status === '5'" style="color: #67C23A"><b>{{$dictUtils.getDictLabel('cw_work_client_temp_status', scope.row.status, '-')}}</b></span>
              <span v-if="scope.row.status === '6'" style="color: #909399">{{$dictUtils.getDictLabel('cw_work_client_temp_status', scope.row.status, '-')}}</span>
            </template>
          </vxe-column>
        </vxe-table>
      </div>
		<template #footer>
			<span class="dialog-footer">
			  <el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
			</span>
		</template>
    </el-dialog>
  </div>
</template>

<script>
  import workClientService from '@/api/cw/workClientInfo/WorkClientService'
  export default {
    data () {
      return {
        title: '',
        method: '',
        visibleChoose: false,
        loading: false,
        tablePage: {
          total: 0,
          currentPage: 1,
          pageSize: 10,
          orders: []
        },
        dataList: [],
        searchForm: {
          createName: '',
          status: '',
          clientNo: ''
        },
        clientId: ''
      }
    },
    created () {
    },
    components: {
    },
    methods: {
      init (clientId) {
        this.title = '客户修改申请记录'
        this.visibleChoose = true
        this.clientId = clientId
        this.list()
      },
      list () {
        this.dataList = []
        this.loading = true
        this.searchForm.clientId = this.clientId
        workClientService.queryUpdateLogList(this.searchForm).then((data) => {
          this.dataList = data
          this.loading = false
        })
      },
      // 当前页
      currentChangeHandle ({currentPage, pageSize}) {
        this.tablePage.currentPage = currentPage
        this.tablePage.pageSize = pageSize
        this.list()
      },
      resetSearch () {
        this.$refs.searchForm.resetFields()
        this.list()
      },
      close () {
        this.$refs.searchForm.resetFields()
        this.visibleChoose = false
      }
    }
  }
</script>
<style scoped>
  /deep/ .el-dialog__body {
    padding-top: 0;
    padding-bottom: 0;
  }
  /deep/ .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
    margin-bottom: 0px;
  }
</style>
