luobisheng
2022-11-16 13e9ddabf4ba3a89aa2a93fe8d3b35c8604c6813
src/views/systemSetting/platform/cockpitManage/index.vue
@@ -30,7 +30,6 @@
                        :http-request="importTable"
                        :show-file-list="false"
                        :auto-upload="true"
                        multiple
                        :limit="1">
                      <el-button type="primary">导入</el-button>
                    </el-upload>
@@ -136,6 +135,7 @@
import detailUser from "./detailUser";
import { deleteTeam, exportTeamInfo, importTeamInfo, searchTeamInfo } from "@/api/system/portal/teamConstruction";
import {SUCCESS_CODE} from "@/utils";
import {downloadFile} from "@/utils/helper";
export default {
    components: { updateUser, detailUser },
@@ -143,8 +143,8 @@
    data() {
        return {
            updateDepartmentData: null,
            searchDepartment: '',
            searchStatus: '',
            searchDepartment: null,
            searchStatus: null,
            dialogUpdate: false,
            dialogcheck: false,
            tableData: [],
@@ -161,6 +161,7 @@
            unsame: false,
            myIdx: 0,
            preMyIdx: 0,
            file: null,
            options: [
                {
                    value: 0,
@@ -235,20 +236,8 @@
        exportTable() {
          exportTeamInfo({ current: this.currentPage, size: this.pageSize, departName: this.searchDepartment, status: this.searchStatus })
              .then(res => {
                const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' });
                const fileName = res.contentDisposition.split('=')[1];
                if (window.navigator && window.navigator.msSaveBlob) {
                  navigator.msSaveBlob(blob, fileName);
                } else {
                  const link = document.createElement('a');
                  link.style.display = 'none';
                  link.href = URL.createObjectURL(blob);
                  link.setAttribute('download', decodeURI(fileName));
                  document.body.appendChild(link);
                  link.click();
                  URL.revokeObjectURL(link.href);
                  document.body.removeChild(link);
                }
                downloadFile(res);
                this.$message({ type: 'success', message: '操作成功' });
              })
              .catch(err => {
                this.$message({ type: 'error', message: err });
@@ -257,7 +246,9 @@
        // 导入
        importTable(file) {
          importTeamInfo({ 'multipartFile': file.file })
          const formData = new FormData();
          formData.append('file', file.file);
          importTeamInfo(formData)
              .then(() => {
                  this.$message({ type: 'success', message: '操作成功' });
                  this.getDepartmentList();
@@ -265,6 +256,7 @@
              })
              .catch(err => {
                this.$message({ type: 'error', message: err });
                this.$refs.uploadFile.clearFiles();
              });
        },