staffExamineList.vue 8.78 KB
<!-- 员工审核 - 列表 -->
<template>
  <div>
    <!-- class="order-detail" -->
    <d2-container>
      <!-- <div class="offline-account"> -->
      <div class="header"
           slot="header"
           style="padding: 10px 20px;">
        <d2-search ref="showSearch"
                   class="show-search"
                   :search-form="searchForm"
                   :label-width="labelWidth"
                   :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>
      <!-- </d2-container>
          <d2-container> -->
      <div class="d2-container-content">
        <d2-table ref="recordTable"
                  :get-list-api="getListApi"
                  :search-form="searchFormSearch"
                  :table-params="tableParams"
                  :before-search-fn="beforeSearchFn">
          <div slot="auth-button"
               slot-scope="scope">
            <!-- 审核 -->
            <span style="margin-right: 10px;"
                  v-if="scope.scope.auditStatus == 0">
              <auth-button :data="scope.scope"
                           :show-btn-ids="['9120901']" />
            </span>
            <!-- 驳回 -->
            <span style="margin-right: 10px;"
                  v-if="scope.scope.auditStatus == 0">
              <auth-button :data="scope.scope"
                           :show-btn-ids="['9120902']" />
            </span>
          </div>
        </d2-table>
      </div>
    </d2-container>
    <!-- 驳回 -->
    <reject-dialog :reject-visible="rejectVisible"
                   :params-obj="recordInfo"
                   v-if="rejectVisible"
                   @dialogClose="rejectDialogClose" />
  </div>
</template>

<script>
import { Util, deepClone } from '@/common/util'
// import { mapActions, mapState } from 'vuex'
import { auditStatusList, auditTypeList } from '@/common/constants.js'
import { staffAuditPage, staffAuditUpdate } from "@api/resident"
import rejectDialog from './components/rejectDialog'
export default {
  name: 'StaffExamineList',
  components: {
    rejectDialog
  },
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      labelWidth: '110px',
      searchForm: {
        auditStatus: '',
        staffPhone: '',
        staffName: '',
        serviceMerchantName: ''
      },
      searchFormSearch: {},
      showFormData: [{
        label: '员工姓名',
        name: 'staffName',
        type: 'input',
        maxlength: '20',
        isClear: true
      }, {
        label: "员工手机号",
        name: "staffPhone",
        type: "input",
        maxlength: "11",
        isClear: true
      }, {
        label: '所属服务中心',
        name: 'serviceMerchantName',
        type: 'input',
        maxlength: '20',
        isClear: true
      }, {
        label: '申请状态',
        name: 'auditStatus',
        type: 'select',
        isClear: true,
        optionList: [],
        optionId: 'confId',
        optionLabel: 'confValue',
        optionsName: 'auditStatusList'
      }],
      getListApi: staffAuditPage,
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        tableOption: { width: '200px' },
        tableColumns: [{
          label: '员工姓名',
          prop: 'staffName',
          width: '120px'
        }, {
          label: '员工手机号',
          prop: 'staffPhone',
          width: '120px'
        }, {
          label: '新员工姓名',
          prop: 'staffNameNew',
          width: '120px'
        }, {
          label: '新员工手机号',
          prop: 'staffPhoneNew',
          width: '120px'
        }, {
          label: '所属服务中心',
          prop: 'serviceMerchantName'
        }, {
          label: '申请类型',
          prop: 'auditType',
          width: '100px',
          formatter: (cellValue) => {
            return this.baseData.auditTypeList.find(item => item.confId === cellValue.auditType)?.confValue
          }
        }, {
          label: '申请时间',
          prop: 'applyTime',
          width: '150px',
          formatter: (cellValue) => {
            return cellValue.applyTime ? Util.dateFormate(cellValue.applyTime, 'YYYY-MM-DD HH:mm:ss') : '-'
          }
        }, {
          label: '申请状态',
          prop: 'auditStatus',
          width: '100px',
          formatter: (cellValue) => {
            return this.baseData.auditStatusList.find(item => item.confId === cellValue.auditStatus)?.confValue
          }
        }, {
          label: '审核人',
          prop: 'auditAccount'
        }, {
          label: '审核时间',
          prop: 'auditTime',
          width: '150px',
          formatter: (cellValue) => {
            return cellValue.auditTime ? Util.dateFormate(cellValue.auditTime, 'YYYY-MM-DD HH:mm:ss') : '-'
          }
        }
        ]
      },
      baseData: {
        auditStatusList: deepClone(auditStatusList),
        auditTypeList: deepClone(auditTypeList)
      },

      rejectVisible: false,
      recordInfo: null
    }
  },
  computed: {
    // ...mapState({
    //   dowloadList: (state) => state.d2admin.user.dowloadList
    // })
  },
  mounted() {
    // this.getPlatformMerchantList()
    this.getBaseData()
  },

  methods: {
    // ...mapActions({
    //   get: 'd2admin/base/get',
    //   close: 'd2admin/page/close'
    // }),
    // ...mapActions('d2admin/user', ['actionSetDownloadList']),

    async getBaseData() {
      this.getOptionsList()
    },

    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchFormSearch = deepClone(this.searchForm)
        // if (this.searchFormSearch.transferAccountsDate) {
        //   this.searchFormSearch.transferStartTimeStr = Util.dateFormate(this.searchFormSearch.transferAccountsDate[0], 'YYYY-MM-DD HH:mm:ss')
        //   this.searchFormSearch.transferEndTimeStr = Util.dateFormate(this.searchFormSearch.transferAccountsDate[1], 'YYYY-MM-DD') + ' 23:59:59'
        //   delete this.searchFormSearch.transferAccountsDate
        // }
        // if (this.searchFormSearch.status || this.searchFormSearch.status == '0') {
        //   this.searchFormSearch.statuses[0] = this.searchFormSearch.status
        //   delete this.searchFormSearch.status
        // }
        // if (this.searchFormSearch.sceneType || this.searchFormSearch.sceneType == '0') {
        //   this.searchFormSearch.sceneTypes[0] = this.searchFormSearch.sceneType
        //   delete this.searchFormSearch.sceneType
        // }
        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(false, true)
    },
    handleReset() {
      this.searchForm = {
        auditStatus: '',
        staffPhone: '',
        staffName: '',
        serviceMerchantName: ''
      }
      this.$refs.recordTable.refreshTable(false, true)
    },

    // 驳回
    handleReject(row) {
      this.recordInfo = row
      this.rejectVisible = !this.rejectVisible
    },

    // 关闭驳回弹窗
    rejectDialogClose(obj) {
      this[obj.attrName] = !this[obj.attrName]
      if (obj.flag) {
        this.$refs.recordTable.refreshTable()
      }
    },

    // 审核
    handleExamine(row) {
      const params = {}
      params.id = row.id
      params.auditStatus = 1 // 审核状态 0:待审核 1:已审核 2:已驳回
      this.$confirm('审核通过后,系统会自动更新对应的员工状态及信息。是否确定审核?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        closeOnClickModal: false
      }).then(() => {
        staffAuditUpdate(params).then(res => {
          this.notice.okTips()
          this.$refs.recordTable.refreshTable()
        })
      }).catch(err => {
        console.log(err)
      })
    }

  }
}

</script>
<style scoped>
.count-txt {
  font-weight: 700;
  color: #2a58ad;
  margin: 0 2px;
}

.leftSpan {
  display: inline-block;
  box-sizing: border-box;
  margin-right: 10px;
}

.tableHeaderBtn {
  margin-left: 10px;
}
</style>