11
This commit is contained in:
parent
46ab730f58
commit
c46617a6c8
@ -47,7 +47,7 @@
|
||||
style="width:100%">
|
||||
<template>
|
||||
<span style="font-size:13px">{{ data.label }}</span>
|
||||
<span v-show="data.show && data.id > 0" style="margin-left: 10px;">
|
||||
<span v-show="data.show && data.id > 0" style="margin-left: 10px;" >
|
||||
<i @click="handleUpdateContinent(data)" class="el-icon-edit"></i>
|
||||
<i @click="handleDeleteContinent(data)" class="el-icon-delete"></i>
|
||||
</span>
|
||||
|
||||
@ -17,6 +17,18 @@
|
||||
<el-input v-model="form.code" placeholder="请输入编码" />
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="所属国家" prop="countryId">
|
||||
<el-select v-model="form.countryId" placeholder="所属区域" clearable filterable>
|
||||
<el-option
|
||||
v-for="item in countryIdsOptions"
|
||||
v-bind:key="item.value"
|
||||
v-bind:label="item.label"
|
||||
v-bind:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
@ -33,6 +45,7 @@
|
||||
|
||||
<script>
|
||||
import { listEmisCountryArea, getEmisCountryArea, delEmisCountryArea, addEmisCountryArea, updateEmisCountryArea } from "@/api/emis/emisCountryArea";
|
||||
import { listEmisCountry, getEmisCountry, delEmisCountry, addEmisCountry, updateEmisCountry } from "@/api/emis/emisCountry";
|
||||
|
||||
export default {
|
||||
name: "emisCountryAreaForm",
|
||||
@ -45,6 +58,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
emisCountryAreaOptions: [],
|
||||
countryIdsOptions:[],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 表单参数
|
||||
@ -73,6 +87,7 @@ export default {
|
||||
methods: {
|
||||
initData() {
|
||||
this.reset();
|
||||
this.getCountryList();
|
||||
if(this.id !=undefined) {
|
||||
this.loading = true;
|
||||
getEmisCountryArea(this.id).then(response => {
|
||||
@ -82,6 +97,17 @@ export default {
|
||||
}
|
||||
this.getTreeselect();
|
||||
},
|
||||
getCountryList(){
|
||||
this.loading = true;
|
||||
listEmisCountry(this.queryParams).then(response => {
|
||||
this.loading = false;
|
||||
this.countryIdsOptions = [];
|
||||
response.rows.forEach(item =>{
|
||||
var optItem={value:item.id,label:item.name};
|
||||
this.countryIdsOptions.push(optItem)
|
||||
});
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.reset();
|
||||
|
||||
@ -231,13 +231,27 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="国家id" prop="countryId">
|
||||
<el-input v-model="form.countryId" placeholder="请输入国家id" />
|
||||
<el-form-item label="所属国家" prop="countryId">
|
||||
<el-select v-model="form.countryId" placeholder="所属国家" @change="handleCountrySelectionChange" clearable filterable>
|
||||
<el-option
|
||||
v-for="item in countryIdsOptions"
|
||||
v-bind:key="item.value"
|
||||
v-bind:label="item.label"
|
||||
v-bind:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="国家大区id" prop="countryAreaId">
|
||||
<el-input v-model="form.countryAreaId" placeholder="请输入国家大区id" />
|
||||
<el-form-item label="国家大区" prop="countryAreaId">
|
||||
<el-select v-model="form.countryAreaId" placeholder="国家大区" clearable filterable>
|
||||
<el-option
|
||||
v-for="item in countryAreaIdsOptionsForm"
|
||||
v-bind:key="item.value"
|
||||
v-bind:label="item.label"
|
||||
v-bind:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@ -302,7 +316,8 @@ export default {
|
||||
return {
|
||||
countryName:"",
|
||||
areaName:'',
|
||||
currentId:0,
|
||||
currentId:null,
|
||||
currentCountryId:40,
|
||||
// 是否展开,默认全部折叠
|
||||
isExpandAll: false,
|
||||
// 重新渲染表格状态
|
||||
@ -311,6 +326,7 @@ export default {
|
||||
countryIdsOptions:[],
|
||||
areaTree:[],
|
||||
countryAreaIdsOptions:[],
|
||||
countryAreaIdsOptionsForm:[],
|
||||
tableDataCopy:[],
|
||||
tableData:[],
|
||||
showTable:false,
|
||||
@ -384,6 +400,7 @@ export default {
|
||||
created() {
|
||||
this.getList();
|
||||
this.getCountryList();
|
||||
//this.getAreaFormList();
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
@ -423,8 +440,7 @@ export default {
|
||||
//var lastContinentId = -1;
|
||||
response.rows.forEach(item =>{
|
||||
var optItem={value:item.id,label:item.name};
|
||||
this.countryAreaIdsOptions.push(optItem)
|
||||
|
||||
this.countryAreaIdsOptions.push(optItem);
|
||||
var treeItem={"id":item.id,"label":item.name,"show":false};
|
||||
cTree.children.push(treeItem);
|
||||
//lastContinentId = item.id;
|
||||
@ -434,6 +450,18 @@ export default {
|
||||
//this.getList();
|
||||
});
|
||||
},
|
||||
getAreaFormList(){
|
||||
this.loading = true;
|
||||
this.queryParams.countryId = this.currentCountryId;
|
||||
listEmisCountryArea(this.queryParams).then(response => {
|
||||
this.loading = false;
|
||||
this.countryAreaIdsOptionsForm = [];
|
||||
response.rows.forEach(item =>{
|
||||
var optItem={value:item.id,label:item.name};
|
||||
this.countryAreaIdsOptionsForm.push(optItem);
|
||||
});
|
||||
});
|
||||
},
|
||||
getCountryList() {
|
||||
this.loading = true;
|
||||
listEmisCountry(this.queryParams).then(response => {
|
||||
@ -441,20 +469,43 @@ export default {
|
||||
this.countryTree = [];
|
||||
this.countryIdsOptions = [];
|
||||
var cTree={"id":"","label":"国家列表","children":[]};
|
||||
cTree.children.push({"id":40,"label":"中国"});
|
||||
this.countryIdsOptions.push({"value":40,"label":"中国"})
|
||||
//var lastContinentId = -1;
|
||||
response.rows.forEach(item =>{
|
||||
if(item.id != 40){
|
||||
var optItem={value:item.id,label:item.name};
|
||||
this.countryIdsOptions.push(optItem)
|
||||
|
||||
var treeItem={"id":item.id,"label":item.name};
|
||||
cTree.children.push(treeItem);
|
||||
}
|
||||
//lastContinentId = item.id;
|
||||
});
|
||||
//this.queryParams.continentId = lastContinentId;
|
||||
this.queryParams.countryId = this.currentCountryId;
|
||||
this.countryTree.push(cTree);
|
||||
//this.getAreaList();
|
||||
});
|
||||
},
|
||||
handleCountrySelectionChange(id){
|
||||
this.loading = true;
|
||||
var oldCountryId = this.queryParams.countryId;
|
||||
this.currentCountryId = id;
|
||||
this.queryParams.countryId = this.currentCountryId;
|
||||
listEmisCountryArea(this.queryParams).then(response => {
|
||||
this.loading = false;
|
||||
this.countryAreaIdsOptionsForm = [];
|
||||
response.rows.forEach(item =>{
|
||||
var optItem={value:item.id,label:item.name};
|
||||
this.countryAreaIdsOptionsForm.push(optItem);
|
||||
});
|
||||
});
|
||||
if(oldCountryId>0){
|
||||
this.queryParams.countryId = oldCountryId;
|
||||
}else{
|
||||
this.queryParams.countryId = null;
|
||||
}
|
||||
},
|
||||
load (tree, treeNode, resolve) {
|
||||
// 层级关系备份
|
||||
const idCopy = JSON.parse(JSON.stringify(tree.idList))
|
||||
@ -514,7 +565,7 @@ export default {
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeAreaClick(data) {
|
||||
this.queryParams.areaId = data.id;
|
||||
this.queryParams.countryAreaId = data.id;
|
||||
//this.form.continentId= data.id;
|
||||
this.handleAreaQuery();
|
||||
},
|
||||
@ -548,7 +599,10 @@ export default {
|
||||
updateTime: null,
|
||||
areaName: null,
|
||||
countryCode: null,
|
||||
countryName: null
|
||||
countryName: null,
|
||||
name: null,
|
||||
nameEn: null,
|
||||
remark: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@ -566,6 +620,7 @@ export default {
|
||||
handleCountryAreaQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getAreaList();
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
@ -600,10 +655,21 @@ export default {
|
||||
const id = row.id || this.ids
|
||||
getEmisRegion(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.currentCountryId = response.data.countryId;
|
||||
this.open = true;
|
||||
this.queryParams.countryId = this.currentCountryId;
|
||||
listEmisCountryArea(this.queryParams).then(response => {
|
||||
this.loading = false;
|
||||
this.countryAreaIdsOptionsForm = [];
|
||||
response.rows.forEach(item =>{
|
||||
var optItem={value:item.id,label:item.name};
|
||||
this.countryAreaIdsOptionsForm.push(optItem);
|
||||
});
|
||||
});
|
||||
this.title = "修改";
|
||||
});
|
||||
|
||||
|
||||
// 子组件打开模式
|
||||
// this.currentId= row.id || this.ids;
|
||||
// this.openEmisRegion = true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user