|
@@ -75,6 +75,10 @@
|
|
|
<template slot="menuLeft">
|
|
|
<el-button type="primary" size="mini" @click.stop="newAdd()">新建客户
|
|
|
</el-button>
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-bottom" @click="excelBox = true">导入
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-bottom" @click="outExport">导出
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
<template slot-scope="{ row, index }" slot="cname">
|
|
|
<span style="color: #409EFF;cursor: pointer" @click.stop="viewInfo(row)">{{ row.cname }}
|
|
@@ -131,22 +135,65 @@
|
|
|
<el-button @click="addCorpType" type="primary" size="mini">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog title="导入客户" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
|
|
|
+ v-dialog-drag>
|
|
|
+ <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading"
|
|
|
+ :upload-before="uploadBefore" :upload-after="uploadAfter">
|
|
|
+ <template slot="excelTemplate">
|
|
|
+ <el-button type="primary" @click="derivation">
|
|
|
+ 点击下载<i class="el-icon-download el-icon--right"></i>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </avue-form>
|
|
|
+ <p style="text-align: center;color: #DC0505">
|
|
|
+ 温馨提示 第一次导入时请先下载模板
|
|
|
+ </p>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
+
|
|
|
<script>
|
|
|
import detailsInfo from "./detailsInfo";
|
|
|
import detailsPage from "./detailsPage";
|
|
|
import { option } from "./js/optionList";
|
|
|
import { getList, getCorpType, pageStatistics, remove, addCorpType, customerList } from "@/api/basicData/client";
|
|
|
import corpType from '@/components/corpType/index'
|
|
|
+import {getToken} from "@/util/auth";
|
|
|
export default {
|
|
|
name: "index",
|
|
|
data() {
|
|
|
return {
|
|
|
corpTypeVisible: false,
|
|
|
+ excelForm:{},
|
|
|
+ excelOption: {
|
|
|
+ submitBtn: false,
|
|
|
+ emptyBtn: false,
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: "模板下载",
|
|
|
+ prop: "excelTemplate",
|
|
|
+ formslot: true,
|
|
|
+ span: 24
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "导入客户",
|
|
|
+ prop: "excelFile",
|
|
|
+ type: "upload",
|
|
|
+ drag: true,
|
|
|
+ loadText: "客户上传中,请稍等",
|
|
|
+ accept:'.xls,.xlsx',
|
|
|
+ span: 24,
|
|
|
+ propsHttp: {
|
|
|
+ res: "data"
|
|
|
+ },
|
|
|
+ tip: "请上传 .xls,.xlsx 标准格式文件",
|
|
|
+ action: "/api/blade-client/partsCorps/import-desc"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
src: '',
|
|
|
show: true,
|
|
|
+ excelBox: false,
|
|
|
showInfo: true,
|
|
|
loading: false,
|
|
|
search: {},
|
|
@@ -277,7 +324,8 @@ export default {
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
- hostUrl: ''
|
|
|
+ hostUrl: '',
|
|
|
+ option:{}
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
@@ -294,6 +342,49 @@ export default {
|
|
|
this.$refs.crud.refreshTable();
|
|
|
},
|
|
|
methods: {
|
|
|
+ derivation() {
|
|
|
+ window.open(
|
|
|
+ `/api/blade-client/partsCorps/export-template?${this.website.tokenHeader
|
|
|
+ }=${getToken()}`
|
|
|
+ );
|
|
|
+ },
|
|
|
+ //导出
|
|
|
+ outExport() {
|
|
|
+ let config = {params: {...this.search}}
|
|
|
+ if (config.params) {
|
|
|
+ for (const propName of Object.keys(config.params)) {
|
|
|
+ const value = config.params[propName];
|
|
|
+ if (value !== null && typeof (value) !== "undefined") {
|
|
|
+ if (value instanceof Array) {
|
|
|
+ for (const key of Object.keys(value)) {
|
|
|
+ let params = propName + '[' + key + ']';
|
|
|
+ config.params[params] = value[key]
|
|
|
+ }
|
|
|
+ delete config.params[propName]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const routeData = this.$router.resolve({
|
|
|
+ path: '/api/blade-client/partsCorps/export-desc', //跳转目标窗口的地址
|
|
|
+ query: {
|
|
|
+ ...config.params, //括号内是要传递给新窗口的参数
|
|
|
+ identification:this.url
|
|
|
+ }
|
|
|
+ })
|
|
|
+ window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
|
|
|
+ },
|
|
|
+ uploadBefore(file, done, loading) {
|
|
|
+ done();
|
|
|
+ loading = true;
|
|
|
+ },
|
|
|
+ uploadAfter(res, done, loading, column) {
|
|
|
+ this.excelBox = false;
|
|
|
+ this.$message.success("导入成功!");
|
|
|
+ this.refreshChange();
|
|
|
+ loading = false;
|
|
|
+ done();
|
|
|
+ },
|
|
|
filterNode(value, data) {
|
|
|
console.log(value, data)
|
|
|
if (!value) return true;
|
|
@@ -461,7 +552,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
+
|
|
|
<style lang="scss" scoped>
|
|
|
.page-crad ::v-deep .basic-container__card {
|
|
|
height: 94.2vh;
|
|
@@ -510,4 +601,3 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
-
|