From f7fa32c8285e4bbc6afe29ea3d97140fc46d207b Mon Sep 17 00:00:00 2001 From: libing Date: Tue, 26 Dec 2023 22:01:40 +0800 Subject: [PATCH] 11 --- src/views/emis/emisRegion/index.vue | 123 ++++++--- src/views/emis/emisTransLine/index.vue | 356 +++++++++++++++++++------ 2 files changed, 355 insertions(+), 124 deletions(-) diff --git a/src/views/emis/emisRegion/index.vue b/src/views/emis/emisRegion/index.vue index fd4231c2..adb05861 100644 --- a/src/views/emis/emisRegion/index.vue +++ b/src/views/emis/emisRegion/index.vue @@ -212,6 +212,44 @@ + + + + + + + + + + + + + + + + + + + + @@ -227,40 +265,11 @@ - - - - - - - - - - - - - - - - - - - @@ -312,10 +321,13 @@ import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker'; import emisRegionView from '@/views/emis/emisRegion/emisRegionView'; import emisRegionForm from '@/views/emis/emisRegion/emisRegionForm'; import emisCountryAreaForm from '@/views/emis/emisCountryArea/emisCountryAreaForm'; +import Treeselect from "@riophae/vue-treeselect"; +import "@riophae/vue-treeselect/dist/vue-treeselect.css"; +import IconSelect from "@/components/IconSelect"; export default { name: "emisRegion", - components: { elDateSimplePicker,emisRegionView,emisRegionForm ,emisCountryAreaForm}, + components: { elDateSimplePicker,emisRegionView,emisRegionForm ,emisCountryAreaForm,Treeselect,IconSelect}, dicts: [ 'emis_region_level_type', ], @@ -336,6 +348,7 @@ export default { countryAreaIdsOptionsForm:[], tableDataCopy:[], tableData:[], + parentAreaOptions:[], showTable:false, defaultProps: { children: "children", @@ -344,6 +357,8 @@ export default { // 遮罩层 loading: true, + //判断是否是编辑或者添加选择的国家 + from_inner:false, // 选中数组 ids: [], // 非单个禁用 @@ -387,6 +402,7 @@ export default { shortName: null, regionType: null, zipCode: null, + currentCountryId:null, }, // 表单参数 form: {}, @@ -422,21 +438,36 @@ export default { /** 查询四级省市区镇表列表 */ getList() { this.loading = true; + this.queryParams.currentCountryId = this.currentCountryId; listEmisRegion(this.queryParams).then(response => { - + //console.log(response.rows); this.tableDataCopy = this.handleTree(response.rows, "id"); - this.tableData = JSON.parse(JSON.stringify(this.tableDataCopy)).map(item => { // 展示数据 - item.hasChildren = item.children && item.children.length > 0 - item.children = null - // 记住层级关系 - item.idList = [item.id] - return item - }) - - + this.parentAreaOptions = this.handleTree(response.rows, "id"); + //编辑或者添加的时候选择国家不影响外面 + if(this.from_inner!=true){ + //console.log(this.from_inner); + this.tableData = JSON.parse(JSON.stringify(this.tableDataCopy)).map(item => { // 展示数据 + item.hasChildren = item.children && item.children.length > 0 + item.children = null + // 记住层级关系 + item.idList = [item.id] + return item + }) + } this.loading = false; }); }, + /** 转换菜单数据结构 */ + normalizer(node) { + if (node.children && !node.children.length) { + delete node.children; + } + return { + id: node.id, + label: node.regionName, + children: node.children, + }; + }, getAreaList(){ this.loading = true; listEmisCountryArea(this.queryParams).then(response => { @@ -499,6 +530,7 @@ export default { var oldCountryId = this.queryParams.countryId; this.currentCountryId = id; this.queryParams.countryId = this.currentCountryId; + this.from_inner = true; listEmisCountryArea(this.queryParams).then(response => { this.loading = false; this.countryAreaIdsOptionsForm = []; @@ -507,6 +539,8 @@ export default { this.countryAreaIdsOptionsForm.push(optItem); }); }); + //更新上级区域列表 + this.getList(); if(oldCountryId>0){ this.queryParams.countryId = oldCountryId; }else{ @@ -567,6 +601,7 @@ export default { // 节点单击事件 handleNodeClick(data) { this.queryParams.countryId = data.id; + this.from_inner = false; //this.form.continentId= data.id; this.handleCountryAreaQuery(); }, @@ -574,6 +609,7 @@ export default { handleNodeAreaClick(data) { this.queryParams.countryAreaId = data.id; //this.form.continentId= data.id; + this.from_inner = false; this.handleAreaQuery(); }, mouseenter(data) { @@ -615,6 +651,7 @@ export default { }, /** 搜索按钮操作 */ handleQuery() { + this.from_inner = false; this.queryParams.pageNum = 1; this.getList(); }, @@ -645,7 +682,11 @@ export default { this.reset(); this.open = true; this.title = "新增"; - + this.form.countryId = row.countryId; + this.queryParams.currentCountryId = row.countryId; + this.getList(); + this.form.parentId = row.id; + console.log(this.form); // 子组件打开模式 // if(row != undefined){ // this.currentParentId = row.id diff --git a/src/views/emis/emisTransLine/index.vue b/src/views/emis/emisTransLine/index.vue index 5e411b86..213c5d81 100644 --- a/src/views/emis/emisTransLine/index.vue +++ b/src/views/emis/emisTransLine/index.vue @@ -1,15 +1,41 @@ - --> - - - - @@ -201,6 +234,24 @@ + + + + --> + + + + + + +