index.vue 2.25 KB
/**
* @Description:
* @author cxg
* @date 2023/07/05
*/
<template>
  <div class="use-export-page">
    <dee-dialog
      width="500px"
      title="导出"
      :dialog-visible="dialogShow"
      :dialog-bttons="formButtons"
      form-btn-position="center"
      @handleClose="dialogShow = false"
      @on-submit="takeTimeAddsubmit"
      @on-cancel="dialogShow = false"
    >
      <dee-as-com
        :lay-config="{
          typeName: 'DxOrganization',
          layKey: '944264fb-96e6-48c5-af48-5d389a0fc49a'
        }"
        @check="checkChange"
      />
    </dee-dialog>
  </div>
</template>

<script>
import { downloadFile } from '@/utils/http'
export default {
  componentName: '用户导出',
  name: 'UserExportCom',
  components: { },
  data() {
    return {
      checkData: [],
      dialogShow: false,
      formButtons: [
        {
          'text': '确定',
          'type': 'submit',
          'component': {
            'type': 'primary'
          }
        },
        {
          'text': '取消',
          'type': 'cancel',
          'component': {
          }
        }
      ],
      showImportOrgTempDialog: false
    }
  },

  computed: {},
  mounted() {},
  methods: {
    checkChange(val) {
      this.checkData = val.checked.checkedNodes.map(el => {
        return el.id
      })
    },
    takeTimeAddsubmit() {
      if (!this.checkData.length) {
        this.$utils.showMessageWarning('请选择需要导出用户对应的组织')
        return
      }
      const params = {
        items: [{ 'fieldName': 'orgId', 'operator': 'IN', 'value': this.checkData }],
        'operator': 'AND'
      }
      downloadFile(`/DxUserAccount/export/userInfo?generateOperator=VOTOEXCEL`, 'post', params).then(res => {
        const fileName = res.headers['content-disposition'].substring(res.headers['content-disposition'].indexOf('=') + 1, res.headers['content-disposition'].length)
        const name = fileName.substring(fileName.indexOf('_') + 1, fileName.lastIndexOf('.xlsx'))
        this.$utils.downLoadFile(res, '用户_' + name + '(内部).xlsx')
        this.dialogShow = false
      })
    },
    eventFunc() {
      this.dialogShow = true
    },
    // 导入
    onImportTempOk() {
      this.$emit('import-temp')
    }
  }
}

</script>
<style lang='scss'>
</style>