Commit 4eb08240 authored by 沈良进's avatar 沈良进

城市管理新增经纬度

parent d9995db5
<style> <style>
.cityManagement .w150 .el-input { .cityManagement .w150 .el-input {
width: 150px; width: 150px;
} }
.cityManagement .btmAddStore {
border-top: 1px solid #d1d1d1; .cityManagement .btmAddStore {
width: 100%; border-top: 1px solid #d1d1d1;
display: none; width: 100%;
overflow-x: auto; display: none;
overflow-y: auto; overflow-x: auto;
position: fixed; overflow-y: auto;
background: #f9f9f9; position: fixed;
bottom: 0; background: #f9f9f9;
} bottom: 0;
.cityManagement .isShow { }
display: block !important;
} .cityManagement .isShow {
.cityManagement .changeMsg { display: block !important;
width: 80%; }
}
.cityManagement .changeMsg li { .cityManagement .changeMsg {
float: left; width: 80%;
} }
.cityManagement .btmTitle {
padding: 0 10px; .cityManagement .changeMsg li {
margin: 20px 0 20px 40px; float: left;
border-left: 3px solid #e95252; }
font-size: 14px;
color: #000000; .cityManagement .btmTitle {
} padding: 0 10px;
.cityManagement .cityBtnList { margin: 20px 0 20px 40px;
margin: 5px 0 20px 40px; border-left: 3px solid #e95252;
} font-size: 14px;
.cityManagement .query-box li { color: #000000;
margin: 20px 30px 20px 0; }
}
.cityManagement ._addUpload_box>div:hover{ .cityManagement .cityBtnList {
background-color: #f5f5f5; margin: 5px 0 20px 40px;
} }
.cityManagement .el-upload-dragger{
font-size: 28px; .cityManagement .query-box li {
color: #8c939d; margin: 20px 30px 20px 0;
width: 126px; }
height: 80px;
line-height: 41px; .cityManagement ._addUpload_box>div:hover {
text-align: center; background-color: #f5f5f5;
} }
.cityManagement ._show_img_box{
position: fixed; .cityManagement .el-upload-dragger {
background: rgba(0,0,0,.6); font-size: 28px;
left: 0; color: #8c939d;
top:0; width: 126px;
width: 100%; height: 80px;
height: 100%; line-height: 41px;
z-index: 9999; text-align: center;
text-align: center; }
}
.cityManagement ._addUpload_box{ .cityManagement ._show_img_box {
display: block; position: fixed;
} background: rgba(0, 0, 0, .6);
.cityManagement ._addUpload_box img{ left: 0;
width: 100%; top: 0;
height:100%; width: 100%;
} height: 100%;
.cityManagement ._addUpload_box>div{ z-index: 9999;
float: left; text-align: center;
width:138px; }
height:92px;
border:1px dashed rgba(210,210,210,1); .cityManagement ._addUpload_box {
border-radius:2px; display: block;
cursor: pointer; }
margin-bottom: 10px;
padding: 5px; .cityManagement ._addUpload_box img {
margin-right: 10px; width: 100%;
position: relative; height: 100%;
} }
.cityManagement ._addUpload_box .icon-guanbi1 {
font-size: 12px; .cityManagement ._addUpload_box>div {
color: white; float: left;
display: inline-block; width: 138px;
margin-left: 15px; height: 92px;
position: absolute; border: 1px dashed rgba(210, 210, 210, 1);
right: -6px; border-radius: 2px;
top: -9px; cursor: pointer;
background-color: #f56c6c; margin-bottom: 10px;
border-radius: 50%; padding: 5px;
height: 20px; margin-right: 10px;
width: 20px; position: relative;
text-align: center; }
line-height: 20px;
} .cityManagement ._addUpload_box .icon-guanbi1 {
font-size: 12px;
color: white;
display: inline-block;
margin-left: 15px;
position: absolute;
right: -6px;
top: -9px;
background-color: #f56c6c;
border-radius: 50%;
height: 20px;
width: 20px;
text-align: center;
line-height: 20px;
}
</style> </style>
<template> <template>
<div class="flexOne cityManagement"> <div class="flexOne cityManagement">
...@@ -114,8 +129,8 @@ ...@@ -114,8 +129,8 @@
</li> </li>
<li> <li>
<span></span> <span></span>
<el-select v-model="msg.QProvince" clearable class="w150" filterable @change="getProvinceList(msg.QProvince,2)" <el-select v-model="msg.QProvince" clearable class="w150" filterable
:placeholder="$t('hotel.hotel_province')"> @change="getProvinceList(msg.QProvince,2)" :placeholder="$t('hotel.hotel_province')">
<el-option :label="$t('pub.unlimitedSel')" value='0'></el-option> <el-option :label="$t('pub.unlimitedSel')" value='0'></el-option>
<el-option v-for='item in provinceList' :key="item.ID" :label="item.Name" :value="item.ID"> <el-option v-for='item in provinceList' :key="item.ID" :label="item.Name" :value="item.ID">
</el-option> </el-option>
...@@ -144,7 +159,8 @@ ...@@ -144,7 +159,8 @@
</li> </li>
<li> <li>
<button class="normalBtn" type="button" @click="addCityInfo">{{$t('pub.addBtn')}}</button> <button class="normalBtn" type="button" @click="addCityInfo">{{$t('pub.addBtn')}}</button>
<button class="hollowFixedBtn" type="button" @click="resetPageIndex(),initData()">{{$t('pub.searchBtn')}}</button> <button class="hollowFixedBtn" type="button"
@click="resetPageIndex(),initData()">{{$t('pub.searchBtn')}}</button>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -157,6 +173,8 @@ ...@@ -157,6 +173,8 @@
<th>所属国家</th> <th>所属国家</th>
<th>所属省份</th> <th>所属省份</th>
<th>所属市</th> <th>所属市</th>
<th>经度</th>
<th>纬度</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
<tr v-for="item in tabelDate" :key="item.subCode"> <tr v-for="item in tabelDate" :key="item.subCode">
...@@ -166,20 +184,23 @@ ...@@ -166,20 +184,23 @@
<td>{{item.CountryName}}</td> <td>{{item.CountryName}}</td>
<td>{{item.ProvinceName}}</td> <td>{{item.ProvinceName}}</td>
<td>{{item.CityName}}</td> <td>{{item.CityName}}</td>
<td>{{item.Lng}}</td>
<td>{{item.Lat}}</td>
<td> <td>
<el-tooltip class="item" effect="dark" content="修改" placement="top-start"> <el-tooltip class="item" effect="dark" content="修改" placement="top-start">
<el-button type="primary" @click="isShow=true,titleInfo='修改城市',updateCity(item.ID)" icon="el-icon-edit" <el-button type="primary" @click="isShow=true,titleInfo='修改城市',updateCity(item.ID)" icon="el-icon-edit"
circle></el-button> circle></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top-start"> <el-tooltip class="item" effect="dark" content="删除" placement="top-start">
<el-button type="danger" icon="el-icon-delete" @click="delArea(item.ID,item.CodeLevel)" circle></el-button> <el-button type="danger" icon="el-icon-delete" @click="delArea(item.ID,item.CodeLevel)" circle>
</el-button>
</el-tooltip> </el-tooltip>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage" layout="total,prev, pager, next, jumper" <el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage"
:page-size="this.msg.pageSize" :total="total"> layout="total,prev, pager, next, jumper" :page-size="this.msg.pageSize" :total="total">
</el-pagination> </el-pagination>
<div class="btmAddStore" :class="{'isShow':isShow}"> <div class="btmAddStore" :class="{'isShow':isShow}">
<div class="btmTitle">{{titleInfo}}</div> <div class="btmTitle">{{titleInfo}}</div>
...@@ -191,7 +212,7 @@ ...@@ -191,7 +212,7 @@
</el-form-item> </el-form-item>
</li> </li>
<li> <li>
<el-form-item label="英文名称" prop="EnName"> <el-form-item label="英文名称">
<el-input v-model="addMsg.EnName" class="w150" maxlength="20"></el-input> <el-input v-model="addMsg.EnName" class="w150" maxlength="20"></el-input>
</el-form-item> </el-form-item>
</li> </li>
...@@ -216,8 +237,8 @@ ...@@ -216,8 +237,8 @@
</li> </li>
<li v-if="disCountry"> <li v-if="disCountry">
<el-form-item label="所属国家" prop="CountryID"> <el-form-item label="所属国家" prop="CountryID">
<el-select v-model="addMsg.CountryID" clearable class="w150" filterable @change="getProvinceList(addMsg.CountryID,1)" <el-select v-model="addMsg.CountryID" clearable class="w150" filterable
placeholder="请选择"> @change="getProvinceList(addMsg.CountryID,1)" placeholder="请选择">
<el-option :label="$t('pub.unlimitedSel')" value='0'></el-option> <el-option :label="$t('pub.unlimitedSel')" value='0'></el-option>
<el-option v-for='item in countryListOther' :key="item.ID" :label="item.Name" :value="item.ID"> <el-option v-for='item in countryListOther' :key="item.ID" :label="item.Name" :value="item.ID">
</el-option> </el-option>
...@@ -226,8 +247,8 @@ ...@@ -226,8 +247,8 @@
</li> </li>
<li v-if="disProvince"> <li v-if="disProvince">
<el-form-item label="所属省份" prop="ProvinceID"> <el-form-item label="所属省份" prop="ProvinceID">
<el-select v-model="addMsg.ProvinceID" clearable class="w150" filterable @change="getProvinceList(addMsg.ProvinceID,2)" <el-select v-model="addMsg.ProvinceID" clearable class="w150" filterable
placeholder="请选择"> @change="getProvinceList(addMsg.ProvinceID,2)" placeholder="请选择">
<el-option :label="$t('pub.unlimitedSel')" value='0'></el-option> <el-option :label="$t('pub.unlimitedSel')" value='0'></el-option>
<el-option v-for='item in provinceList' :key="item.ID" :label="item.Name" :value="item.ID"> <el-option v-for='item in provinceList' :key="item.ID" :label="item.Name" :value="item.ID">
</el-option> </el-option>
...@@ -244,28 +265,36 @@ ...@@ -244,28 +265,36 @@
</el-form-item> </el-form-item>
</li> </li>
<li> <li>
<el-form-item label="三码" ><!--prop="ThreeCode"--> <el-form-item label="三码">
<!--prop="ThreeCode"-->
<el-input v-model="addMsg.ThreeCode" class="w150" maxlength="3"></el-input> <el-input v-model="addMsg.ThreeCode" class="w150" maxlength="3"></el-input>
</el-form-item> </el-form-item>
</li> </li>
<li>
<el-form-item label="经度">
<el-input v-model="addMsg.Lng" class="w150"></el-input>
</el-form-item>
</li>
<li>
<el-form-item label="纬度">
<el-input v-model="addMsg.Lat" class="w150"></el-input>
</el-form-item>
</li>
<li> <li>
<el-form-item label="图片"> <el-form-item label="图片">
<div class="_addUpload_box clearfix" > <div class="_addUpload_box clearfix">
<div v-if="addMsg.Images && addMsg.Images!=''"> <div v-if="addMsg.Images && addMsg.Images!=''">
<div style="width:100%;height:100%;overflow: hidden;"> <div style="width:100%;height:100%;overflow: hidden;">
<img :src="addMsg.Images"/> <img :src="addMsg.Images" />
</div>
<span class="iconfont icon-guanbi1" @click="deleteUploadFile()"></span>
</div>
<div v-else class="_pic_upload">
<el-upload
drag
:http-request="uploadFileBtn"
:multiple="false" :show-file-list="false" action="">
<i class="el-icon-plus avatar-uploader-icon"></i>
<div class="el-upload__text">{{$t("active.ld_djscwj")}}</div>
</el-upload>
</div> </div>
<span class="iconfont icon-guanbi1" @click="deleteUploadFile()"></span>
</div>
<div v-else class="_pic_upload">
<el-upload drag :http-request="uploadFileBtn" :multiple="false" :show-file-list="false" action="">
<i class="el-icon-plus avatar-uploader-icon"></i>
<div class="el-upload__text">{{$t("active.ld_djscwj")}}</div>
</el-upload>
</div>
</div> </div>
</el-form-item> </el-form-item>
</li> </li>
...@@ -281,136 +310,123 @@ ...@@ -281,136 +310,123 @@
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
total: 0, total: 0,
currentPage: 1, currentPage: 1,
loading: true, loading: true,
AreaList: "", AreaList: "",
RegionList: "", RegionList: "",
countryList: "", countryList: "",
countryListOther: "", countryListOther: "",
provinceList: "", provinceList: "",
cityList: "", cityList: "",
district: "", district: "",
titleInfo: "", titleInfo: "",
tabelDate: "", tabelDate: "",
isShow: false, isShow: false,
District: "", District: "",
disCountry: false, disCountry: false,
disProvince: false, disProvince: false,
disCity: false, disCity: false,
msg: { msg: {
pageIndex: 1, pageIndex: 1,
pageSize: 15, pageSize: 15,
Name: "", Name: "",
QArea: "", QArea: "",
QCountry: "", QCountry: "",
QProvince: "", QProvince: "",
QCity: "", QCity: "",
QDistrict: "" QDistrict: ""
}, },
addMsg: { addMsg: {
ID: 0, ID: 0,
Name: "", Name: "",
EnName: "", EnName: "",
ParentID: "", ParentID: "",
CodeLevel: "", CodeLevel: "",
ThreeCode: "", ThreeCode: "",
FourCode: "", FourCode: "",
Area: "", Area: "",
CountryID: "", CountryID: "",
ProvinceID: "", ProvinceID: "",
CityID: "" CityID: "",
}, Lng: "", //经度
rules: { Lat: "", //纬度
Name: [ },
{ rules: {
Name: [{
required: true, required: true,
message: "请输入中文名称", message: "请输入中文名称",
trigger: "change" trigger: "change"
} }],
], EnName: [{
EnName: [ required: true,
{ message: "请输入英文名称",
required: true, trigger: "change"
message: "请输入英文名称", },
trigger: "change" {
}, pattern: this.$commonUtils.Regex.el_IsEnglish,
{ message: "请输入英文"
pattern: this.$commonUtils.Regex.el_IsEnglish, }
message: "请输入英文" ],
} CodeLevel: [{
],
CodeLevel: [
{
required: true, required: true,
message: "请选择行政级别", message: "请选择行政级别",
trigger: "change" trigger: "change"
} }],
], Area: [{
Area: [
{
required: true, required: true,
message: "请选择洲", message: "请选择洲",
trigger: "change" trigger: "change"
} }],
], CountryID: [{
CountryID: [
{
required: true, required: true,
message: "请选择国家", message: "请选择国家",
trigger: "change" trigger: "change"
} }],
], ProvinceID: [{
ProvinceID: [
{
required: true, required: true,
message: "请选择省", message: "请选择省",
trigger: "change" trigger: "change"
} }],
], CityID: [{
CityID: [
{
required: true, required: true,
message: "请选择市", message: "请选择市",
trigger: "change" trigger: "change"
} }],
], ThreeCode: [{
ThreeCode: [
{
required: true, required: true,
message: "请输入三码", message: "请输入三码",
trigger: "change" trigger: "change"
} }]
] }
} };
};
},
methods: {
deleteUploadFile(){ // 删除上传文件
this.addMsg.Images='';
}, },
//上传图片 methods: {
uploadFileBtn(file) { //上传 deleteUploadFile() { // 删除上传文件
if(file.file.size > 1024 * 1024 * 10) { this.addMsg.Images = '';
this.$message.warning(this.$t('tips.wjdxbncgsz')) },
return //上传图片
uploadFileBtn(file) { //上传
if (file.file.size > 1024 * 1024 * 10) {
this.$message.warning(this.$t('tips.wjdxbncgsz'))
return
} }
// 1 文档 2 数据 3 图片 // 1 文档 2 数据 3 图片
let typeArr=[ let typeArr = [{
{stringArr:'GIF|JPG|JPEG|PNG|BMP',type:3}, stringArr: 'GIF|JPG|JPEG|PNG|BMP',
] type: 3
let ft=file.file.name.substring(file.file.name.lastIndexOf('.')+1,file.file.name.length).toUpperCase(); }, ]
let ft = file.file.name.substring(file.file.name.lastIndexOf('.') + 1, file.file.name.length).toUpperCase();
let fileTypeNumber = 2; let fileTypeNumber = 2;
let typeOk = false; let typeOk = false;
typeArr.forEach(x=>{ typeArr.forEach(x => {
if(x.stringArr.indexOf(ft)!='-1') if (x.stringArr.indexOf(ft) != '-1') {
{ fileTypeNumber = x.type
fileTypeNumber=x.type typeOk = true;
typeOk = true; }
}
}) })
if (!typeOk) return this.$message.error(this.$t('tips.qsctpian')); if (!typeOk) return this.$message.error(this.$t('tips.qsctpian'));
let newArr = []; let newArr = [];
...@@ -418,292 +434,295 @@ export default { ...@@ -418,292 +434,295 @@ export default {
let path = "/Upload/plat/" let path = "/Upload/plat/"
this.$message.info(this.$t('tips.shangchuanzhong')) this.$message.info(this.$t('tips.shangchuanzhong'))
this.UploadSelfFileT(path, newArr, x => { this.UploadSelfFileT(path, newArr, x => {
let fileSize = file.file.size<1024? file.file.size:(file.file.size / 1024).toFixed(0); let fileSize = file.file.size < 1024 ? file.file.size : (file.file.size / 1024).toFixed(0);
this.addMsg.Images = this.domainManager().ViittoFileUrl + x.data.FilePath this.addMsg.Images = this.domainManager().ViittoFileUrl + x.data.FilePath
this.$message.success(this.$t('tips.scchenggong')); this.$message.success(this.$t('tips.scchenggong'));
// this.$forceUpdate(); // this.$forceUpdate();
}); });
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.msg.pageIndex = val; this.msg.pageIndex = val;
this.initData(); this.initData();
}, },
resetPageIndex() { resetPageIndex() {
this.msg.pageIndex = 1; this.msg.pageIndex = 1;
this.currentPage = 1; this.currentPage = 1;
}, },
//初始化表格数据 //初始化表格数据
initData() { initData() {
this.loading = true; this.loading = true;
this.apipost( this.apipost(
"dict_post_Destination_GetPageList", "dict_post_Destination_GetPageList",
this.msg, this.msg,
res => {
this.loading = false;
if (res.data.resultCode == 1) {
this.tabelDate = res.data.data.pageData;
this.total = res.data.data.count;
}
},
null
);
},
delArea(ID, CodeLevel) {
var that = this;
this.Confirm("是否删除?", function() {
let msg = {
ID: ID,
CodeLevel: CodeLevel
};
that.apipost(
"dict_post_Destination_Remove",
msg,
res => { res => {
this.loading = false;
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
that.Success("删除成功"); this.tabelDate = res.data.data.pageData;
that.initData(); this.total = res.data.data.count;
} else {
that.Error(res.data.message);
} }
}, },
null null
); );
}); },
}, delArea(ID, CodeLevel) {
addCityInfo() { var that = this;
this.isShow = true; this.Confirm("是否删除?", function () {
this.titleInfo = "新增城市"; let msg = {
this.addMsg.ID = 0; ID: ID,
}, CodeLevel: CodeLevel
saveInfo() { };
if (this.addMsg.Area == 0) { that.apipost(
this.Error("请选择洲"); "dict_post_Destination_Remove",
return; msg,
} res => {
switch (this.addMsg.CodeLevel) { if (res.data.resultCode == 1) {
case 1: that.Success("删除成功");
this.addMsg.ParentID = 0; that.initData();
break; } else {
case 2: that.Error(res.data.message);
this.addMsg.ParentID = this.addMsg.CountryID; }
if (this.addMsg.CountryID == 0) { },
this.Error("请选择所属国家"); null
return; );
} });
break; },
case 3: addCityInfo() {
this.addMsg.ParentID = this.addMsg.ProvinceID; this.isShow = true;
if (this.addMsg.ProvinceID == 0) { this.titleInfo = "新增城市";
this.Error("请选择所属省份"); this.addMsg.ID = 0;
return; },
} saveInfo() {
break; if (this.addMsg.Area == 0) {
case 4: this.Error("请选择洲");
this.addMsg.ParentID = this.addMsg.CityID; return;
if (this.addMsg.CityID == 0) { }
this.Error("请选择所属市"); switch (this.addMsg.CodeLevel) {
return; case 1:
} this.addMsg.ParentID = 0;
break; break;
} case 2:
this.apipost( this.addMsg.ParentID = this.addMsg.CountryID;
"dict_post_Destination_Set", if (this.addMsg.CountryID == 0) {
this.addMsg, this.Error("请选择所属国家");
res => { return;
if (res.data.resultCode == 1) { }
this.initData(); break;
this.Success("保存成功"); case 3:
this.isShow = false; this.addMsg.ParentID = this.addMsg.ProvinceID;
this.resetForm("addMsg"); if (this.addMsg.ProvinceID == 0) {
} else { this.Error("请选择所属省份");
this.Error(res.data.message); return;
}
},
err => {}
);
},
//修改信息
updateCity(ID) {
let msg = {
ID: ID
};
this.addMsg.ID = ID;
this.apipost(
"dict_post_Destination_Get",
msg,
res => {
this.disCountry = false;
this.disProvince = false;
this.disCity = false;
if (res.data.resultCode == 1) {
if (res.data.data.CodeLevel == 1) {
this.addMsg.ParentID = 0;
} else if (res.data.data.CodeLevel == 2) {
this.disCountry = true;
this.addMsg.ParentID = res.data.data.CountryID;
} else if (res.data.data.CodeLevel == 3) {
this.addMsg.ParentID = res.data.data.ProvinceID;
this.disCountry = true;
this.disProvince = true;
} else if (res.data.data.CodeLevel == 4) {
this.addMsg.ParentID = res.data.data.CityID;
this.disCountry = true;
this.disProvince = true;
this.disCity = true;
} }
this.addMsg = res.data.data; break;
this.addMsg.CountryID = res.data.data.CountryID; case 4:
this.addMsg.ProvinceID = res.data.data.ProvinceID; this.addMsg.ParentID = this.addMsg.CityID;
this.addMsg.CityID = res.data.data.CityID; if (this.addMsg.CityID == 0) {
this.addMsg.Images = res.data.data.Images; this.Error("请选择所属市");
if (this.addMsg.Area == 0) { return;
this.addMsg.Area = this.addMsg.Area.toString(); }
break;
}
this.apipost(
"dict_post_Destination_Set",
this.addMsg,
res => {
if (res.data.resultCode == 1) {
this.initData();
this.Success("保存成功");
this.isShow = false;
this.resetForm("addMsg");
} else { } else {
this.addMsg.Area = parseInt(this.addMsg.Area); this.Error(res.data.message);
} }
this.getCountry(this.addMsg.Area, 2); },
err => {}
);
},
//修改信息
updateCity(ID) {
let msg = {
ID: ID
};
this.addMsg.ID = ID;
this.apipost(
"dict_post_Destination_Get",
msg,
res => {
this.disCountry = false;
this.disProvince = false;
this.disCity = false;
if (res.data.resultCode == 1) {
if (res.data.data.CodeLevel == 1) {
this.addMsg.ParentID = 0;
} else if (res.data.data.CodeLevel == 2) {
this.disCountry = true;
this.addMsg.ParentID = res.data.data.CountryID;
} else if (res.data.data.CodeLevel == 3) {
this.addMsg.ParentID = res.data.data.ProvinceID;
this.disCountry = true;
this.disProvince = true;
} else if (res.data.data.CodeLevel == 4) {
this.addMsg.ParentID = res.data.data.CityID;
this.disCountry = true;
this.disProvince = true;
this.disCity = true;
}
this.addMsg = res.data.data;
this.addMsg.CountryID = res.data.data.CountryID;
this.addMsg.ProvinceID = res.data.data.ProvinceID;
this.addMsg.CityID = res.data.data.CityID;
this.addMsg.Images = res.data.data.Images;
this.addMsg.Lng=res.data.data.Lng;
this.addMsg.Lat=res.data.data.Lat;
if (this.addMsg.Area == 0) {
this.addMsg.Area = this.addMsg.Area.toString();
} else {
this.addMsg.Area = parseInt(this.addMsg.Area);
}
this.getCountry(this.addMsg.Area, 2);
} else {
this.Error(res.data.message);
}
},
err => {}
);
},
getProvinceList(ID, type) {
//根据省份获取城市
let msg = {
Id: ID
};
if (type == 1) {
this.msg.QProvince = "";
this.msg.QCity = "";
this.msg.QDistrict = "";
} else if (type == 2) {
this.msg.QCity = "";
this.msg.QDistrict = "";
} else if (type == 3) {
this.msg.QDistrict = "";
}
if (this.msg.QCountry != "" || this.Country != "") {
this.apipost(
"dict_post_Destination_GetChildList",
msg,
res => {
if (type == 1) {
this.provinceList = res.data.data;
} else if (type == 2) {
this.cityList = res.data.data;
} else if (type == 3) {
this.district = res.data.data;
}
},
err => {}
);
}
},
//取消
cancelPanel() {
this.isShow = false;
this.resetForm("addMsg");
},
submitForm(addMsg) {
//提交创建、修改表单
let that = this;
that.$refs[addMsg].validate(valid => {
if (valid) {
that.saveInfo();
} else { } else {
this.Error(res.data.message); return false;
} }
}, });
err => {} },
); resetForm(formName) {
}, this.$refs[formName].resetFields();
getProvinceList(ID, type) { },
//根据省份获取城市 //获取洲下拉数据
let msg = { getContinentList() {
Id: ID let msg = {};
}; this.apipost(
if (type == 1) { "dict_post_Destination_GetContinentList",
this.msg.QProvince = ""; msg,
this.msg.QCity = ""; res => {
this.msg.QDistrict = ""; this.AreaList = res.data.data.AreaList;
} else if (type == 2) { this.RegionList = res.data.data.RegionList;
this.msg.QCity = ""; },
this.msg.QDistrict = ""; err => {}
} else if (type == 3) { );
this.msg.QDistrict = ""; },
} //根据洲获取国家
if (this.msg.QCountry != "" || this.Country != "") { getCountry(Area, type) {
let msg = {
Area: Area
};
this.msg.QCountry = "";
this.apipost( this.apipost(
"dict_post_Destination_GetChildList", "dict_post_Destination_GetCountryByArea",
msg, msg,
res => { res => {
if (type == 1) { if (type == 1) {
this.provinceList = res.data.data; this.countryList = res.data.data;
} else if (type == 2) { } else {
this.cityList = res.data.data; this.countryListOther = res.data.data;
} else if (type == 3) {
this.district = res.data.data;
} }
}, },
err => {} err => {}
); );
} },
}, //根据行政区别获取ParentID
//取消 getCodeLevel(CodeLevel) {
cancelPanel() { this.disCountry = false;
this.isShow = false; this.disProvince = false;
this.resetForm("addMsg"); this.disCity = false;
}, if (CodeLevel == 1) {
submitForm(addMsg) { this.addMsg.ParentID = 0;
//提交创建、修改表单 if (this.addMsg.Area == 0) {
let that = this; this.addMsg.Area = this.addMsg.Area.toString();
that.$refs[addMsg].validate(valid => { }
if (valid) { } else if (CodeLevel == 2) {
that.saveInfo(); this.disCountry = true;
} else { this.addMsg.ParentID = this.addMsg.CountryID;
return false; if (this.addMsg.Area == 0) {
} this.addMsg.Area = this.addMsg.Area.toString();
}); }
}, if (this.addMsg.CountryID == 0) {
resetForm(formName) { this.addMsg.CountryID = this.addMsg.CountryID.toString();
this.$refs[formName].resetFields(); }
}, } else if (CodeLevel == 3) {
//获取洲下拉数据 this.disCountry = true;
getContinentList() { this.disProvince = true;
let msg = {}; if (this.addMsg.Area == 0) {
this.apipost( this.addMsg.Area = this.addMsg.Area.toString();
"dict_post_Destination_GetContinentList", }
msg, if (this.addMsg.CountryID == 0) {
res => { this.addMsg.CountryID = this.addMsg.CountryID.toString();
this.AreaList = res.data.data.AreaList; }
this.RegionList = res.data.data.RegionList; if (this.addMsg.ProvinceID == 0) {
}, this.addMsg.ProvinceID = this.addMsg.ProvinceID.toString();
err => {} }
); this.addMsg.ParentID = this.addMsg.ProvinceID;
}, } else if (CodeLevel == 4) {
//根据洲获取国家 this.disCountry = true;
getCountry(Area, type) { this.disProvince = true;
let msg = { this.disCity = true;
Area: Area this.addMsg.ParentID = this.addMsg.CityID;
}; if (this.addMsg.CountryID == 0) {
this.msg.QCountry = ""; this.addMsg.CountryID = this.addMsg.CountryID.toString();
this.apipost( }
"dict_post_Destination_GetCountryByArea", if (this.addMsg.ProvinceID == 0) {
msg, this.addMsg.ProvinceID = this.addMsg.ProvinceID.toString();
res => { }
if (type == 1) { if (this.addMsg.CityID == 0) {
this.countryList = res.data.data; this.addMsg.CityID = this.addMsg.CityID.toString();
} else {
this.countryListOther = res.data.data;
} }
},
err => {}
);
},
//根据行政区别获取ParentID
getCodeLevel(CodeLevel) {
this.disCountry = false;
this.disProvince = false;
this.disCity = false;
if (CodeLevel == 1) {
this.addMsg.ParentID = 0;
if (this.addMsg.Area == 0) {
this.addMsg.Area = this.addMsg.Area.toString();
}
} else if (CodeLevel == 2) {
this.disCountry = true;
this.addMsg.ParentID = this.addMsg.CountryID;
if (this.addMsg.Area == 0) {
this.addMsg.Area = this.addMsg.Area.toString();
}
if (this.addMsg.CountryID == 0) {
this.addMsg.CountryID = this.addMsg.CountryID.toString();
}
} else if (CodeLevel == 3) {
this.disCountry = true;
this.disProvince = true;
if (this.addMsg.Area == 0) {
this.addMsg.Area = this.addMsg.Area.toString();
}
if (this.addMsg.CountryID == 0) {
this.addMsg.CountryID = this.addMsg.CountryID.toString();
}
if (this.addMsg.ProvinceID == 0) {
this.addMsg.ProvinceID = this.addMsg.ProvinceID.toString();
}
this.addMsg.ParentID = this.addMsg.ProvinceID;
} else if (CodeLevel == 4) {
this.disCountry = true;
this.disProvince = true;
this.disCity = true;
this.addMsg.ParentID = this.addMsg.CityID;
if (this.addMsg.CountryID == 0) {
this.addMsg.CountryID = this.addMsg.CountryID.toString();
}
if (this.addMsg.ProvinceID == 0) {
this.addMsg.ProvinceID = this.addMsg.ProvinceID.toString();
}
if (this.addMsg.CityID == 0) {
this.addMsg.CityID = this.addMsg.CityID.toString();
} }
} }
},
mounted() {
this.initData();
this.getContinentList();
} }
}, };
mounted() {
this.initData();
this.getContinentList();
}
};
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment