2023-11-27 08:29:42 +00:00
|
|
|
<template>
|
|
|
|
|
<div >
|
|
|
|
|
<el-row :gutter="0">
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="区域名称" prop="regionName">
|
|
|
|
|
<el-input v-model="form.regionName" placeholder="请输入区域名称" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="英文名称" prop="regionNameEn">
|
|
|
|
|
<el-input v-model="form.regionNameEn" placeholder="请输入英文名称" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="简称" prop="shortName">
|
|
|
|
|
<el-input v-model="form.shortName" placeholder="请输入简称" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2023-12-13 06:00:09 +00:00
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="父区域" prop="parentId">
|
|
|
|
|
<el-input v-model="form.parentId" placeholder="请输入父区域" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
2023-11-27 08:29:42 +00:00
|
|
|
<el-form-item label="代码" prop="code">
|
|
|
|
|
<el-input v-model="form.code" placeholder="请输入代码" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2023-12-13 06:00:09 +00:00
|
|
|
<el-col :span="8">
|
2024-02-22 03:30:51 +00:00
|
|
|
<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>
|
2023-11-27 08:29:42 +00:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2023-12-13 06:00:09 +00:00
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="国家大区id" prop="countryAreaId">
|
|
|
|
|
<el-input v-model="form.countryAreaId" placeholder="请输入国家大区id" />
|
2023-11-27 08:29:42 +00:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2023-12-13 06:00:09 +00:00
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="类型" prop="regionType">
|
|
|
|
|
<el-select v-model="form.regionType" placeholder="请选择类型">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.emis_region_level_type"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
2023-11-27 08:29:42 +00:00
|
|
|
</el-form-item>
|
2023-12-13 06:00:09 +00:00
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="邮编" prop="zipCode">
|
|
|
|
|
<el-input v-model="form.zipCode" placeholder="请输入邮编" />
|
2023-11-27 08:29:42 +00:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2023-12-13 06:00:09 +00:00
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
2023-11-27 08:29:42 +00:00
|
|
|
</el-form-item>
|
2023-12-13 06:00:09 +00:00
|
|
|
</el-col>
|
2023-11-27 08:29:42 +00:00
|
|
|
|
|
|
|
|
<el-form-item label="上级字典">
|
|
|
|
|
<treeselect
|
|
|
|
|
ref="tree"
|
|
|
|
|
v-model="form.parentId"
|
|
|
|
|
:options="emisRegionOptions"
|
|
|
|
|
:normalizer="normalizer"
|
|
|
|
|
:default-expand-level="1"
|
|
|
|
|
:show-count="true"
|
|
|
|
|
placeholder="选择上级"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-row>
|
|
|
|
|
<div style="text-align: center;margin-bottom: 10px;">
|
|
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listEmisRegion, getEmisRegion, delEmisRegion, addEmisRegion, updateEmisRegion } from "@/api/emis/emisRegion";
|
2024-02-22 03:30:51 +00:00
|
|
|
import { listEmisCountry } from "@/api/emis/emisCountry";
|
2023-11-27 08:29:42 +00:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "emisRegionForm",
|
|
|
|
|
props:{
|
|
|
|
|
id:undefined
|
|
|
|
|
},
|
|
|
|
|
components: { },
|
|
|
|
|
dicts: [
|
2023-12-13 06:00:09 +00:00
|
|
|
'emis_region_level_type',
|
2023-11-27 08:29:42 +00:00
|
|
|
],
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
emisRegionOptions: [],
|
2024-02-22 03:30:51 +00:00
|
|
|
countryIdsOptions: [],
|
2023-11-27 08:29:42 +00:00
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
// 表单参数
|
|
|
|
|
form: {},
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
regionName: [
|
|
|
|
|
{ required: true, message: "区域名称不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
regionNameEn: [
|
|
|
|
|
{ required: true, message: "英文名称不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
parentId: [
|
|
|
|
|
{ required: true, message: "父区域不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
"id": {
|
|
|
|
|
handler (newValue, oldValue) {
|
|
|
|
|
this.id = newValue;
|
|
|
|
|
this.initData();
|
|
|
|
|
},
|
|
|
|
|
deep: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.initData();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
initData() {
|
|
|
|
|
this.reset();
|
2024-02-22 03:30:51 +00:00
|
|
|
this.getCountryList();
|
2023-11-27 08:29:42 +00:00
|
|
|
if(this.id !=undefined) {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
getEmisRegion(this.id).then(response => {
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
this.getTreeselect();
|
|
|
|
|
},
|
2024-02-22 03:30:51 +00:00
|
|
|
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)
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
2023-11-27 08:29:42 +00:00
|
|
|
// 取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.$emit("on-cancel");
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
|
id: null,
|
|
|
|
|
regionName: null,
|
|
|
|
|
regionNameEn: null,
|
|
|
|
|
shortName: null,
|
|
|
|
|
parentId: null,
|
|
|
|
|
code: null,
|
|
|
|
|
countryId: null,
|
|
|
|
|
countryAreaId: null,
|
|
|
|
|
regionType: null,
|
|
|
|
|
zipCode: null,
|
|
|
|
|
remark: null,
|
|
|
|
|
tenantId: null,
|
|
|
|
|
delFlag: null,
|
|
|
|
|
createBy: null,
|
|
|
|
|
createTime: null,
|
|
|
|
|
updateBy: null,
|
|
|
|
|
updateTime: null,
|
|
|
|
|
areaName: null,
|
|
|
|
|
countryCode: null,
|
|
|
|
|
countryName: null
|
|
|
|
|
};
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.id != null) {
|
|
|
|
|
updateEmisRegion(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
this.$emit("on-changed");
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
addEmisRegion(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
this.$emit("on-changed");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 转换菜单数据结构 */
|
|
|
|
|
normalizer(node) {
|
|
|
|
|
if (node.children && !node.children.length) {
|
|
|
|
|
delete node.children;
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
id: node.id,
|
|
|
|
|
label: node.idName,
|
|
|
|
|
children: node.children
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
/** 查询菜单下拉树结构 */
|
|
|
|
|
getTreeselect() {
|
|
|
|
|
const queryParams = {}
|
|
|
|
|
listEmisRegion(queryParams).then(response => {
|
|
|
|
|
this.emisRegionOptions = [];
|
|
|
|
|
const rootItem = { idId: 0, emisRegionName: '-', children: [] };
|
|
|
|
|
rootItem.children = this.handleTree(response.data, "id");
|
|
|
|
|
this.emisRegionOptions.push(rootItem);
|
|
|
|
|
|
|
|
|
|
if(this.parentId != undefined) {
|
|
|
|
|
this.form.parentId = this.parentId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|