diff --git a/src/views/base/region.vue b/src/views/base/region.vue
index 586f18a..ae605f4 100644
--- a/src/views/base/region.vue
+++ b/src/views/base/region.vue
@@ -15,19 +15,37 @@
新增下级
删除
- 导入
- 导出
- 调试
+ 导入
+ 导出
+ 调试
-
+
{{regionForm.parentCode}}
+
+
+
+
+ 点击下载
+
+
+
+
+
+
+
@@ -37,6 +55,7 @@
import {getLazyTree, getDetail, submit, remove} from "@/api/base/region";
import {mapGetters} from "vuex";
import {validatenull} from "@/util/validate";
+ import {getToken} from "@/util/auth";
export default {
data() {
@@ -153,12 +172,115 @@
},
]
},
- data: []
+ excelBox: false,
+ excelForm: {},
+ excelOption: {
+ submitBtn: false,
+ emptyBtn: false,
+ column: [
+ {
+ label: '模板上传',
+ prop: 'excelFile',
+ type: 'upload',
+ drag: true,
+ loadText: '模板上传中,请稍等',
+ span: 24,
+ propsHttp: {
+ res: 'data'
+ },
+ tip: '请上传 .xls,.xlsx 标准格式文件',
+ action: "/api/blade-system/region/import-region"
+ },
+ {
+ label: "数据覆盖",
+ prop: "isCovered",
+ type: "switch",
+ align: "center",
+ width: 80,
+ dicData: [
+ {
+ label: "否",
+ value: 0
+ },
+ {
+ label: "是",
+ value: 1
+ }
+ ],
+ value: 0,
+ slot: true,
+ rules: [
+ {
+ required: true,
+ message: "请选择是否覆盖",
+ trigger: "blur"
+ }
+ ]
+ },
+ {
+ label: '模板下载',
+ prop: 'excelTemplate',
+ formslot: true,
+ span: 24,
+ }
+ ]
+ },
+ debugBox: false,
+ debugForm: {},
+ debugOption: {
+ labelWidth: 50,
+ submitBtn: false,
+ emptyBtn: false,
+ column: [
+ {
+ label: '省份',
+ prop: 'province',
+ type: 'select',
+ props: {
+ label: 'name',
+ value: 'code'
+ },
+ cascaderItem: ['city', 'district'],
+ dicUrl: '/api/blade-system/region/select',
+ span: 24,
+ },
+ {
+ label: '地市',
+ prop: 'city',
+ type: 'select',
+ props: {
+ label: 'name',
+ value: 'code'
+ },
+ dicFlag: false,
+ dicUrl: '/api/blade-system/region/select?code={{key}}',
+ span: 24,
+ },
+ {
+ label: '区县',
+ prop: 'district',
+ type: 'select',
+ props: {
+ label: 'name',
+ value: 'code'
+ },
+ dicFlag: false,
+ dicUrl: '/api/blade-system/region/select?code={{key}}',
+ span: 24,
+ }
+ ]
+ }
};
},
watch: {
'regionForm.subCode'() {
this.regionForm.code = this.regionForm.parentCode + this.regionForm.subCode;
+ },
+ 'excelForm.isCovered'() {
+ if (this.excelForm.isCovered !== '') {
+ const column = this.findObject(this.excelOption.column, "excelFile");
+ column.action = `/api/blade-system/region/import-region?isCovered=${this.excelForm.isCovered}`;
+ }
}
},
computed: {
@@ -253,6 +375,30 @@
this.$refs.form.resetForm();
});
},
+ uploadAfter(res, done, loading, column) {
+ window.console.log(column);
+ this.excelBox = false;
+ this.initTree();
+ done();
+ },
+ handleDebug() {
+ this.debugBox = true;
+ },
+ handleImport() {
+ this.excelBox = true;
+ },
+ handleExport() {
+ this.$confirm("是否导出行政区划数据?", "提示", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ }).then(() => {
+ window.open(`/api/blade-system/region/export-region?Blade-Auth=${getToken()}`);
+ });
+ },
+ handleTemplate() {
+ window.open(`/api/blade-system/region/export-template?Blade-Auth=${getToken()}`);
+ },
}
};