234 lines
6.9 KiB
Vue
234 lines
6.9 KiB
Vue
|
|
<template>
|
||
|
|
<div >
|
||
|
|
<el-row :gutter="0">
|
||
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||
|
|
<el-col :span="8">
|
||
|
|
<el-form-item label="目的地编码" prop="destCode">
|
||
|
|
<el-input v-model="form.destCode" placeholder="请输入目的地编码" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="24">
|
||
|
|
<el-form-item label="目的地名称" prop="destName">
|
||
|
|
<el-input v-model="form.destName" placeholder="请输入目的地名称" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="24">
|
||
|
|
<el-form-item label="英文名称" prop="destNameEn">
|
||
|
|
<el-input v-model="form.destNameEn" placeholder="请输入英文名称" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="8">
|
||
|
|
<el-form-item label="所属国家" prop="country">
|
||
|
|
<el-input v-model="form.country" placeholder="请输入所属国家" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="12">
|
||
|
|
<el-form-item label="服务网点名称" prop="siteName">
|
||
|
|
<el-input v-model="form.siteName" placeholder="请输入服务网点名称" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="6">
|
||
|
|
<el-form-item label="省" prop="province">
|
||
|
|
<el-input v-model="form.province" placeholder="请输入省" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="6">
|
||
|
|
<el-form-item label="市" prop="city">
|
||
|
|
<el-input v-model="form.city" placeholder="请输入市" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="6">
|
||
|
|
<el-form-item label="区" prop="county">
|
||
|
|
<el-input v-model="form.county" placeholder="请输入区" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="6">
|
||
|
|
<el-form-item label="乡镇" prop="town">
|
||
|
|
<el-input v-model="form.town" placeholder="请输入乡镇" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="24">
|
||
|
|
<el-form-item label="备注" prop="remark">
|
||
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
|
||
|
|
<el-form-item label="上级字典">
|
||
|
|
<treeselect
|
||
|
|
ref="tree"
|
||
|
|
v-model="form.parentId"
|
||
|
|
:options="emisDestinationOptions"
|
||
|
|
: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 { listEmisDestination, getEmisDestination, delEmisDestination, addEmisDestination, updateEmisDestination } from "@/api/emis/emisDestination";
|
||
|
|
|
||
|
|
export default {
|
||
|
|
name: "emisDestinationForm",
|
||
|
|
props:{
|
||
|
|
id:undefined
|
||
|
|
},
|
||
|
|
components: { },
|
||
|
|
dicts: [
|
||
|
|
'sys_normal_disable',
|
||
|
|
],
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
emisDestinationOptions: [],
|
||
|
|
// 遮罩层
|
||
|
|
loading: true,
|
||
|
|
// 表单参数
|
||
|
|
form: {},
|
||
|
|
// 表单校验
|
||
|
|
rules: {
|
||
|
|
destCode: [
|
||
|
|
{ required: true, message: "目的地编码不能为空", trigger: "blur" }
|
||
|
|
],
|
||
|
|
destName: [
|
||
|
|
{ required: true, message: "目的地名称不能为空", trigger: "blur" }
|
||
|
|
],
|
||
|
|
destNameEn: [
|
||
|
|
{ required: true, message: "英文名称不能为空", trigger: "blur" }
|
||
|
|
],
|
||
|
|
status: [
|
||
|
|
{ required: true, message: "启用状态不能为空", trigger: "blur" }
|
||
|
|
],
|
||
|
|
country: [
|
||
|
|
{ required: true, message: "所属国家不能为空", trigger: "blur" }
|
||
|
|
],
|
||
|
|
transLineCode: [
|
||
|
|
{ required: true, message: "所属线路不能为空", trigger: "change" }
|
||
|
|
],
|
||
|
|
transLine: [
|
||
|
|
{ required: true, message: "所属线路名称不能为空", trigger: "change" }
|
||
|
|
],
|
||
|
|
siteCode: [
|
||
|
|
{ required: true, message: "服务网点编号不能为空", trigger: "change" }
|
||
|
|
],
|
||
|
|
siteName: [
|
||
|
|
{ required: true, message: "服务网点名称不能为空", trigger: "blur" }
|
||
|
|
],
|
||
|
|
}
|
||
|
|
};
|
||
|
|
},
|
||
|
|
watch: {
|
||
|
|
"id": {
|
||
|
|
handler (newValue, oldValue) {
|
||
|
|
this.id = newValue;
|
||
|
|
this.initData();
|
||
|
|
},
|
||
|
|
deep: true
|
||
|
|
}
|
||
|
|
},
|
||
|
|
created() {
|
||
|
|
this.initData();
|
||
|
|
},
|
||
|
|
|
||
|
|
methods: {
|
||
|
|
initData() {
|
||
|
|
this.reset();
|
||
|
|
if(this.id !=undefined) {
|
||
|
|
this.loading = true;
|
||
|
|
getEmisDestination(this.id).then(response => {
|
||
|
|
this.form = response.data;
|
||
|
|
this.loading = false;
|
||
|
|
});
|
||
|
|
}
|
||
|
|
this.getTreeselect();
|
||
|
|
},
|
||
|
|
// 取消按钮
|
||
|
|
cancel() {
|
||
|
|
this.reset();
|
||
|
|
this.$emit("on-cancel");
|
||
|
|
},
|
||
|
|
// 表单重置
|
||
|
|
reset() {
|
||
|
|
this.form = {
|
||
|
|
id: null,
|
||
|
|
destCode: null,
|
||
|
|
destName: null,
|
||
|
|
destNameEn: null,
|
||
|
|
status: null,
|
||
|
|
country: null,
|
||
|
|
transLineCode: null,
|
||
|
|
transLine: null,
|
||
|
|
siteCode: null,
|
||
|
|
siteName: null,
|
||
|
|
province: null,
|
||
|
|
city: null,
|
||
|
|
county: null,
|
||
|
|
town: null,
|
||
|
|
remark: null,
|
||
|
|
tenantId: null,
|
||
|
|
delFlag: null,
|
||
|
|
createBy: null,
|
||
|
|
createTime: null,
|
||
|
|
updateBy: null,
|
||
|
|
updateTime: null
|
||
|
|
};
|
||
|
|
this.resetForm("form");
|
||
|
|
},
|
||
|
|
/** 提交按钮 */
|
||
|
|
submitForm() {
|
||
|
|
this.$refs["form"].validate(valid => {
|
||
|
|
if (valid) {
|
||
|
|
if (this.form.id != null) {
|
||
|
|
updateEmisDestination(this.form).then(response => {
|
||
|
|
this.$modal.msgSuccess("修改成功");
|
||
|
|
this.$emit("on-changed");
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
addEmisDestination(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 = {}
|
||
|
|
listEmisDestination(queryParams).then(response => {
|
||
|
|
this.emisDestinationOptions = [];
|
||
|
|
const rootItem = { idId: 0, emisDestinationName: '-', children: [] };
|
||
|
|
rootItem.children = this.handleTree(response.data, "id");
|
||
|
|
this.emisDestinationOptions.push(rootItem);
|
||
|
|
|
||
|
|
if(this.parentId != undefined) {
|
||
|
|
this.form.parentId = this.parentId;
|
||
|
|
}
|
||
|
|
|
||
|
|
});
|
||
|
|
},
|
||
|
|
}
|
||
|
|
};
|
||
|
|
</script>
|