2024-01-10 05:16:16 +00:00
|
|
|
<template>
|
|
|
|
|
<div >
|
2024-05-09 23:54:53 +00:00
|
|
|
<el-form ref="form" size="mini" :model="form" :rules="rules" label-width="100px">
|
|
|
|
|
<el-row :gutter="0" style="display: flex;flex-wrap: wrap;">
|
2024-04-22 05:33:25 +00:00
|
|
|
<el-col :span="12">
|
2024-01-10 05:16:16 +00:00
|
|
|
<el-form-item label="目的地名称" prop="destName">
|
|
|
|
|
<el-input v-model="form.destName" placeholder="请输入目的地名称" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-04-22 05:33:25 +00:00
|
|
|
<el-col :span="12">
|
2024-01-10 05:16:16 +00:00
|
|
|
<el-form-item label="英文名称" prop="destNameEn">
|
|
|
|
|
<el-input v-model="form.destNameEn" placeholder="请输入英文名称" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-04-22 05:33:25 +00:00
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="目的地编码" prop="destCode">
|
|
|
|
|
<el-input v-model="form.destCode" placeholder="请输入目的地编码" />
|
2024-01-10 05:16:16 +00:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
2024-04-22 05:33:25 +00:00
|
|
|
<el-form-item label="所属国家" prop="country">
|
|
|
|
|
<CountryPicker :placeholder="$t('所属国家')" v-model="form.country" ></CountryPicker>
|
2024-01-10 05:16:16 +00:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-04-22 05:33:25 +00:00
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="服务网点" prop="siteCode">
|
|
|
|
|
<EmisSiteSimplePicker :placeholder="$t('服务网点')" :countryCode="form.country" v-model="form.siteCode" ></EmisSiteSimplePicker>
|
2024-01-10 05:16:16 +00:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-05-09 23:54:53 +00:00
|
|
|
<!-- <el-col :span="12">
|
2024-04-22 05:33:25 +00:00
|
|
|
<el-form-item label="所属线路" prop="lineCode">
|
|
|
|
|
<TransLinePicker v-model="form.lineCode" :countryCode="form.country"></TransLinePicker>
|
2024-01-10 05:16:16 +00:00
|
|
|
</el-form-item>
|
2024-05-09 23:54:53 +00:00
|
|
|
</el-col> -->
|
2024-04-22 05:33:25 +00:00
|
|
|
|
2024-05-07 04:53:25 +00:00
|
|
|
<!-- <el-col :span="24">
|
2024-04-22 05:33:25 +00:00
|
|
|
<el-form-item label="省市区" prop="province">
|
|
|
|
|
<div style="display: inline-flex">
|
|
|
|
|
<ProvincePicker v-model="form.province" :countryCode="form.country" ></ProvincePicker>
|
|
|
|
|
<CityPicker v-model="form.city" :parentCode="form.province" style="margin-left:5px" ></CityPicker>
|
|
|
|
|
<DistrictPicker v-model="form.county" :parentCode="form.city" style="margin-left:5px"></DistrictPicker>
|
|
|
|
|
<TownPicker v-model="form.town" :parentCode="form.county" style="margin-left:5px" ></TownPicker>
|
|
|
|
|
</div>
|
2024-01-10 05:16:16 +00:00
|
|
|
</el-form-item>
|
2024-05-07 04:53:25 +00:00
|
|
|
</el-col> -->
|
2024-04-22 05:33:25 +00:00
|
|
|
|
|
|
|
|
<el-col :span="24" >
|
|
|
|
|
<el-form-item label="服务片区" prop="countryAreaId">
|
|
|
|
|
<CountryAreaPicker :placeholder="$t('管辖片区')" :countryCode="form.country" v-model="form.countryAreaId" ></CountryAreaPicker>
|
|
|
|
|
<!-- <el-input v-model="form.provs" type="textarea" rows="8" placeholder="包含区域" disabled /> -->
|
|
|
|
|
<CountryAreaRegionPanel :placeholder="$t('区域')" :areaId="form.countryAreaId" ></CountryAreaRegionPanel>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="启用" prop="status">
|
|
|
|
|
<el-radio-group v-model="form.status">
|
|
|
|
|
<el-radio :label="1">是</el-radio>
|
|
|
|
|
<el-radio :label="0">否</el-radio>
|
|
|
|
|
</el-radio-group>
|
2024-01-10 05:16:16 +00:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-04-22 05:33:25 +00:00
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="偏远地区" prop="isHinterland">
|
|
|
|
|
<!-- <el-checkbox style="font-size:400;margin-right:10px;font-size:10px" v-model="form.isHinterland" :true-label="1" :false-label="0"><span style="font-size:10px">是否偏远</span></el-checkbox> -->
|
|
|
|
|
<el-radio-group v-model="form.isHinterland">
|
|
|
|
|
<el-radio :label="1">是</el-radio>
|
|
|
|
|
<el-radio :label="0">否</el-radio>
|
|
|
|
|
</el-radio-group>
|
2024-01-10 05:16:16 +00:00
|
|
|
</el-form-item>
|
2024-04-22 05:33:25 +00:00
|
|
|
</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>
|
2024-05-09 23:54:53 +00:00
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
2024-01-10 05:16:16 +00:00
|
|
|
|
2024-04-22 05:33:25 +00:00
|
|
|
<div style="text-align: center;margin-bottom: 10px;">
|
|
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
2024-01-10 05:16:16 +00:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listEmisDestination, getEmisDestination, delEmisDestination, addEmisDestination, updateEmisDestination } from "@/api/emis/emisDestination";
|
2024-04-22 05:33:25 +00:00
|
|
|
import ProvincePicker from '@/views/emis/EmisBaseTools/ProvincePicker.vue';
|
|
|
|
|
import CityPicker from '@/views/emis/EmisBaseTools/CityPicker.vue';
|
|
|
|
|
import DistrictPicker from '@/views/emis/EmisBaseTools/DistrictPicker.vue';
|
|
|
|
|
import TownPicker from '@/views/emis/EmisBaseTools/TownPicker.vue';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import CountryAreaPicker from '@/views/emis/EmisBaseTools/CountryAreaPicker.vue';
|
|
|
|
|
import CountryAreaRegionPanel from '@/views/emis/EmisBaseTools/CountryAreaRegionPanel.vue';
|
|
|
|
|
|
|
|
|
|
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
|
|
|
|
|
import EmisSiteSimplePicker from '@/views/emis/EmisBaseTools/EmisSiteSimplePicker.vue';
|
|
|
|
|
import TransLinePicker from '@/views/emis/EmisBaseTools/TransLinePicker.vue';
|
|
|
|
|
|
2024-01-10 05:16:16 +00:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "emisDestinationForm",
|
|
|
|
|
props:{
|
2024-04-22 05:33:25 +00:00
|
|
|
id:{type:Number}
|
2024-01-10 05:16:16 +00:00
|
|
|
},
|
2024-04-22 05:33:25 +00:00
|
|
|
components: { CountryAreaRegionPanel,CountryPicker,ProvincePicker,CountryAreaPicker,CityPicker,DistrictPicker,TownPicker,EmisSiteSimplePicker,TransLinePicker },
|
2024-01-10 05:16:16 +00:00
|
|
|
dicts: [
|
|
|
|
|
'sys_normal_disable',
|
|
|
|
|
],
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
emisDestinationOptions: [],
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
// 表单参数
|
|
|
|
|
form: {},
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
destCode: [
|
2024-04-22 05:33:25 +00:00
|
|
|
{ required: true, message: "目的地编码不能为空", trigger: "blur" },
|
|
|
|
|
{ validator: this.validateCode, trigger: "blur" }
|
|
|
|
|
|
2024-01-10 05:16:16 +00:00
|
|
|
],
|
|
|
|
|
destName: [
|
|
|
|
|
{ required: true, message: "目的地名称不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
status: [
|
|
|
|
|
{ required: true, message: "启用状态不能为空", trigger: "blur" }
|
|
|
|
|
],
|
2024-04-22 05:33:25 +00:00
|
|
|
lineCode: [
|
|
|
|
|
{ required: true, message: "线路编号不能为空", trigger: "blur" }
|
|
|
|
|
],
|
2024-01-10 05:16:16 +00:00
|
|
|
country: [
|
|
|
|
|
{ required: true, message: "所属国家不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
siteCode: [
|
|
|
|
|
{ required: true, message: "服务网点编号不能为空", trigger: "change" }
|
|
|
|
|
],
|
2024-04-22 05:33:25 +00:00
|
|
|
province: [
|
|
|
|
|
{ required: true, message: "省不能为空", trigger: "blur" }
|
2024-01-10 05:16:16 +00:00
|
|
|
],
|
2024-04-22 05:33:25 +00:00
|
|
|
city: [
|
|
|
|
|
{ required: true, message: "市不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
|
2024-01-10 05:16:16 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
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();
|
|
|
|
|
},
|
2024-04-22 05:33:25 +00:00
|
|
|
validateCode (rule, value, callback) {
|
|
|
|
|
if (!value) {
|
|
|
|
|
callback(new Error("请输入编码"));
|
|
|
|
|
} else if (value.length > 10) {
|
|
|
|
|
callback(new Error("长度为1-10"));
|
|
|
|
|
} else {
|
|
|
|
|
if (this.form.id) {
|
|
|
|
|
// 修改时检查账号是否重复
|
|
|
|
|
listEmisDestination({ destCode: value})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.rows.length==0) {
|
|
|
|
|
callback();
|
|
|
|
|
} else {
|
|
|
|
|
if(res.rows[0].id != this.form.id ){
|
|
|
|
|
callback(new Error("编码重复"));
|
|
|
|
|
}else{
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
callback(new Error("验证失败,请重试"));
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// 新增时检查账号是否重复
|
|
|
|
|
listEmisDestination({ destCode: value})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.rows.length==0) {
|
|
|
|
|
callback();
|
|
|
|
|
} else {
|
|
|
|
|
callback(new Error("编码重复"));
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
callback(new Error("验证失败,请重试"));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-01-10 05:16:16 +00:00
|
|
|
// 取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.$emit("on-cancel");
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
|
id: null,
|
|
|
|
|
destCode: null,
|
|
|
|
|
destName: null,
|
|
|
|
|
destNameEn: null,
|
2024-04-22 05:33:25 +00:00
|
|
|
status: 1,
|
|
|
|
|
lineCode: null,
|
2024-01-10 05:16:16 +00:00
|
|
|
country: null,
|
|
|
|
|
siteCode: null,
|
|
|
|
|
province: null,
|
|
|
|
|
city: null,
|
|
|
|
|
county: null,
|
|
|
|
|
town: null,
|
2024-04-22 05:33:25 +00:00
|
|
|
isHinterland: 0,
|
|
|
|
|
countryAreaId: null,
|
2024-01-10 05:16:16 +00:00
|
|
|
remark: null,
|
|
|
|
|
tenantId: null,
|
|
|
|
|
delFlag: null,
|
|
|
|
|
createBy: null,
|
2024-04-22 05:33:25 +00:00
|
|
|
createSite: null,
|
2024-01-10 05:16:16 +00:00
|
|
|
createTime: null,
|
|
|
|
|
updateBy: null,
|
2024-04-22 05:33:25 +00:00
|
|
|
updateSite: null,
|
2024-01-10 05:16:16 +00:00
|
|
|
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>
|