|
@@ -68,6 +68,13 @@
|
|
:disabled="multipleSelection.length==0"
|
|
:disabled="multipleSelection.length==0"
|
|
@click="handleBatchDelete"
|
|
@click="handleBatchDelete"
|
|
>删除选中项</el-button>
|
|
>删除选中项</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ size="small"
|
|
|
|
+ plain
|
|
|
|
+ icon="el-icon-upload2"
|
|
|
|
+ @click="batchImportVisible = true"
|
|
|
|
+ >导入</el-button>
|
|
</el-row>
|
|
</el-row>
|
|
<el-row style="padding-left:5px;">
|
|
<el-row style="padding-left:5px;">
|
|
<el-table
|
|
<el-table
|
|
@@ -82,6 +89,7 @@
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
<el-table-column prop="sortNo" label="序号" width="120"></el-table-column>
|
|
<el-table-column prop="sortNo" label="序号" width="120"></el-table-column>
|
|
<el-table-column prop="name" label="单位名称" width="230"></el-table-column>
|
|
<el-table-column prop="name" label="单位名称" width="230"></el-table-column>
|
|
|
|
+ <el-table-column prop="shortName" label="简称" width="230"></el-table-column>
|
|
<el-table-column prop="parentName" label="上级单位" width="230"></el-table-column>
|
|
<el-table-column prop="parentName" label="上级单位" width="230"></el-table-column>
|
|
<el-table-column prop="typeN" label="性质" width="80"></el-table-column>
|
|
<el-table-column prop="typeN" label="性质" width="80"></el-table-column>
|
|
<el-table-column prop="remark" sort-by="remark_" width="350" label="备注"></el-table-column>
|
|
<el-table-column prop="remark" sort-by="remark_" width="350" label="备注"></el-table-column>
|
|
@@ -131,6 +139,49 @@
|
|
:companyId="companyId"
|
|
:companyId="companyId"
|
|
@close="onDetailModalClose"
|
|
@close="onDetailModalClose"
|
|
></companyDeviceRelation-list>
|
|
></companyDeviceRelation-list>
|
|
|
|
+ <el-dialog
|
|
|
|
+ title="导入"
|
|
|
|
+ :visible.sync="batchImportVisible"
|
|
|
|
+ :modal-append-to-body="false"
|
|
|
|
+ style="text-align: left;"
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
+ >
|
|
|
|
+ <el-form label-width="150px">
|
|
|
|
+ <el-form-item label="模板下载">
|
|
|
|
+ <el-link
|
|
|
|
+ href="http://rccs.oss-cn-hangzhou.aliyuncs.com/smart/companyInfo/2020/4/13092503686.xlsx"
|
|
|
|
+ type="primary"
|
|
|
|
+ target="_blank"
|
|
|
|
+ >点击下载模板</el-link>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="上传文件">
|
|
|
|
+ <el-upload
|
|
|
|
+ class="upload-demo"
|
|
|
|
+ accept=".xls"
|
|
|
|
+ :action="uploadUrlXls"
|
|
|
|
+ :data="uploadXlsData"
|
|
|
|
+ :headers="headers"
|
|
|
|
+ :on-preview="handleBatchImportPreview"
|
|
|
|
+ name="uploadFile"
|
|
|
|
+ :multiple="true"
|
|
|
|
+ :limit="1"
|
|
|
|
+ :on-remove="handleBatchImportRemove"
|
|
|
|
+ :before-remove="beforeBatchImportRemove"
|
|
|
|
+ :before-upload="beforeUpload"
|
|
|
|
+ :on-exceed="handleBatchImportExceed"
|
|
|
|
+ :on-success="handleBatchImportSuccess"
|
|
|
|
+ :file-list="batchImportFileList"
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" type="primary" :loading="xlsLoading">点击上传</el-button>
|
|
|
|
+ <div slot="tip" class="el-upload__tip">只能上传xls文件,且不超过500kb</div>
|
|
|
|
+ </el-upload>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="batchImportVisible = false">关 闭</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <!--批量导入E-->
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
@@ -140,6 +191,8 @@ import companyDeviceRelationList from "./companyDeviceRelation-list";
|
|
import companyInfoApi from "@/api/base/companyInfo";
|
|
import companyInfoApi from "@/api/base/companyInfo";
|
|
import SelectTree from "@/components/SelectTree";
|
|
import SelectTree from "@/components/SelectTree";
|
|
import QRCode from "qrcodejs2";
|
|
import QRCode from "qrcodejs2";
|
|
|
|
+
|
|
|
|
+import { getToken } from "@/utils/auth"; // get token from cookie
|
|
import NProgress from "nprogress"; // progress bar
|
|
import NProgress from "nprogress"; // progress bar
|
|
import "nprogress/nprogress.css"; // progress bar style
|
|
import "nprogress/nprogress.css"; // progress bar style
|
|
|
|
|
|
@@ -177,7 +230,18 @@ export default {
|
|
value: "id",
|
|
value: "id",
|
|
label: "name",
|
|
label: "name",
|
|
children: "children"
|
|
children: "children"
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ batchImportVisible: false,
|
|
|
|
+ batchImportFileList: [],
|
|
|
|
+ uploadUrlXls: Constant.serverUrl + "/base/companyInfo/importXls",
|
|
|
|
+ uploadXlsData: {
|
|
|
|
+ subFolder: "company",
|
|
|
|
+ companyId: ""
|
|
|
|
+ },
|
|
|
|
+ headers: {
|
|
|
|
+ Authorization: getToken()
|
|
|
|
+ },
|
|
|
|
+ xlsLoading:false,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -407,7 +471,62 @@ export default {
|
|
dpUrl = dpUrl + "?companyId=" + companyId;
|
|
dpUrl = dpUrl + "?companyId=" + companyId;
|
|
}
|
|
}
|
|
window.open(dpUrl);
|
|
window.open(dpUrl);
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ beforeUpload(file, fileList) {
|
|
|
|
+ //导入前判断
|
|
|
|
+ },
|
|
|
|
+ //批量导入-上传成功
|
|
|
|
+ handleBatchImportSuccess(response, file, fileList) {
|
|
|
|
+ var self = this;
|
|
|
|
+ self.xlsLoading = false;
|
|
|
|
+ if (response.result) {
|
|
|
|
+ self.$message.success(response.message);
|
|
|
|
+ this.batchImportFileList = [];
|
|
|
|
+ this.changePage(1);
|
|
|
|
+ this.uploadCompanyId = "";
|
|
|
|
+ this.uploadXlsData.companyId = "";
|
|
|
|
+ this.batchImportVisible = false;
|
|
|
|
+ } else {
|
|
|
|
+ //this.$message.error(response.message);
|
|
|
|
+ this.batchImportFileList = [];
|
|
|
|
+ this.changePage(1);
|
|
|
|
+ this.uploadCompanyId = "";
|
|
|
|
+ this.uploadXlsData.companyId = "";
|
|
|
|
+
|
|
|
|
+ if (response.data != null) {
|
|
|
|
+ //下载有错误信息提示的报表
|
|
|
|
+ //window.open(response.data);
|
|
|
|
+ self.$message({
|
|
|
|
+ showClose: true,
|
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
|
+ message:
|
|
|
|
+ response.message +
|
|
|
|
+ `,<a href="${response.data}" target="_blank">点击下载未导入的数据报表</a> `,
|
|
|
|
+ duration: 30000
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //批量导入-预览
|
|
|
|
+ handleBatchImportPreview(file) {
|
|
|
|
+ console.log(file.url);
|
|
|
|
+ },
|
|
|
|
+ //批量导入-移除
|
|
|
|
+ handleBatchImportRemove(file, fileList) {
|
|
|
|
+ console.log(file, fileList);
|
|
|
|
+ },
|
|
|
|
+ //批量导入-移除前操作
|
|
|
|
+ beforeBatchImportRemove(file, fileList) {
|
|
|
|
+ console.log(file, fileList);
|
|
|
|
+ },
|
|
|
|
+ //批量导入-文件超出个数限制时的钩子
|
|
|
|
+ handleBatchImportExceed(files, fileList) {
|
|
|
|
+ this.$message.warning(
|
|
|
|
+ `当前限制选择 3 个文件,本次选择了 ${
|
|
|
|
+ files.length
|
|
|
|
+ } 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
|
|
|
+ );
|
|
|
|
+ },
|
|
},
|
|
},
|
|
mounted: function() {
|
|
mounted: function() {
|
|
|
|
|