From f3ace8e13e6c00385f9252b54e4637f7291d5059 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9B=B9=E8=BE=89?= <814457906@qq.com>
Date: Wed, 17 May 2023 16:44:14 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/system/area.js | 8 ++
src/views/system/area/index.vue | 208 +++++++++++++++-----------------
2 files changed, 108 insertions(+), 108 deletions(-)
diff --git a/src/api/system/area.js b/src/api/system/area.js
index fa736d6..23661cc 100644
--- a/src/api/system/area.js
+++ b/src/api/system/area.js
@@ -76,4 +76,12 @@ export function updateRemoteSigns(id, remoteSigns) {
url: `/system/area/updateRemoteSigns?id=${id}&remoteSigns=${remoteSigns}`,
method: 'POST'
})
+}
+
+//同步百度地图
+export function getAreaList(keyword, areaLevel, parentCode, parentId) {
+ return request({
+ url: `/system/area/getAreaList?keyword=${keyword}&areaLevel=${areaLevel}&parentCode=${parentCode}&parentId=${parentId}`,
+ method: 'get'
+ })
}
\ No newline at end of file
diff --git a/src/views/system/area/index.vue b/src/views/system/area/index.vue
index 42752b9..23c29cb 100644
--- a/src/views/system/area/index.vue
+++ b/src/views/system/area/index.vue
@@ -49,16 +49,14 @@
/>
- 搜索
- 重置
+ 搜索
+ 重置
+
+
+
+ 点击同步百度地图区域信息
+ ({{getbaidulist.areaName=='区域列表'?'全国':getbaidulist.areaName}})
+
-
+ -->
+
@@ -129,17 +123,11 @@
active-color="#13ce66"
inactive-color="#ff4949"
@change="updateRemoteSigns(scope.row)"
- >
-
-
+ >
-
+
新增
+ >新增
修改
+ >修改
+ >-->
@@ -177,33 +163,14 @@
/>
-
-
-
+
+
-
-
+
+
@@ -213,12 +180,12 @@
+ -->
否
是
-
+
{
+ selectAreaListquery(val).then(res => {
this.deptOptions = res.data;
});
}
@@ -331,16 +300,34 @@ export default {
this.selectAreaListin();
}
}
- },
+ }
},
methods: {
+ //同步百度地图
+ getbaiduArea() {
+ console.log(this.getbaidulist)
+ if (this.getbaidulist.areaName == "区域列表") {
+ getAreaList("", 1, "", "").then(res => {
+ this.handleNodeClick(this.getbaidulist);
+ });
+ } else {
+ getAreaList(
+ this.getbaidulist.areaName,
+ "",
+ this.getbaidulist.areaCode,
+ this.getbaidulist.id
+ ).then(res => {
+ this.handleNodeClick(this.getbaidulist);
+ });
+ }
+ },
//修改是否为边远地区
updateRemoteSigns(row) {
if (row.remoteSigns) {
this.$confirm('确定修改"' + row.areaName + '"为偏远地区吗?', {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning",
+ type: "warning"
})
.then(() => {
var remoteSigns = null;
@@ -349,11 +336,11 @@ export default {
} else {
remoteSigns = 0;
}
- updateRemoteSigns(row.id, remoteSigns).then((res) => {
+ updateRemoteSigns(row.id, remoteSigns).then(res => {
if (res.code == 200) {
this.$message({
type: "success",
- message: "修改为偏远地区!",
+ message: "修改为偏远地区!"
});
}
});
@@ -362,14 +349,14 @@ export default {
row.remoteSigns = false;
this.$message({
type: "info",
- message: "取消修改",
+ message: "取消修改"
});
});
} else {
this.$confirm('确定修改"' + row.areaName + '"为非偏远地区吗吗?', {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning",
+ type: "warning"
})
.then(() => {
var remoteSigns = null;
@@ -378,11 +365,11 @@ export default {
} else {
remoteSigns = 0;
}
- updateRemoteSigns(row.id, remoteSigns).then((res) => {
+ updateRemoteSigns(row.id, remoteSigns).then(res => {
if (res.code == 200) {
this.$message({
type: "success",
- message: "修改为非偏远地区!",
+ message: "修改为非偏远地区!"
});
}
});
@@ -391,25 +378,26 @@ export default {
row.remoteSigns = true;
this.$message({
type: "info",
- message: "取消修改",
+ message: "取消修改"
});
});
}
},
// 节点单击事件
handleNodeClick(data) {
+ this.getbaidulist = data;
this.queryParams.areaLevel = null;
this.loading = true;
this.queryParams.parentCode = data.areaCode;
if (data.areaCode != 1) {
this.handleQuery();
- selectAreaList("", data.areaCode).then((res) => {
+ selectAreaList("", data.areaCode).then(res => {
if (res.data.length > 0) {
- res.data.forEach((e) => {
+ res.data.forEach(e => {
e.children = [
{
- areaName: "",
- },
+ areaName: ""
+ }
];
});
} else {
@@ -422,13 +410,13 @@ export default {
this.queryParams.parentCode = null;
this.queryParams.areaLevel = 1;
this.handleQuery();
- selectAreaListinfo(1).then((res) => {
+ selectAreaListinfo(1).then(res => {
if (res.data.length > 0) {
- res.data.forEach((e) => {
+ res.data.forEach(e => {
e.children = [
{
- areaName: "",
- },
+ areaName: ""
+ }
];
});
} else {
@@ -441,20 +429,20 @@ export default {
},
selectAreaListin() {
this.loading = true;
- selectAreaListinfo(1).then((res) => {
- res.data.forEach((e) => {
+ selectAreaListinfo(1).then(res => {
+ res.data.forEach(e => {
e.children = [
{
- areaName: "",
- },
+ areaName: ""
+ }
];
});
var obj = [
{
areaName: "区域列表",
children: res.data,
- areaCode: 1,
- },
+ areaCode: 1
+ }
];
this.deptOptions = obj;
this.loading = false;
@@ -462,11 +450,11 @@ export default {
},
info() {
this.loading = true;
- selectAreaList(this.areaName).then((res) => {
+ selectAreaList(this.areaName).then(res => {
this.loading = false;
var obj = {
areaName: "区域列表",
- children: res.data,
+ children: res.data
};
this.deptOptions = obj;
});
@@ -474,8 +462,8 @@ export default {
/** 查询区域列表 */
getList() {
this.loading = true;
- listArea(this.queryParams).then((response) => {
- response.rows.forEach((e) => {
+ listArea(this.queryParams).then(response => {
+ response.rows.forEach(e => {
if (e.remoteSigns == 1) {
e.remoteSigns = true;
} else {
@@ -508,7 +496,7 @@ export default {
updateTime: null,
areaType: null,
parentCode: null,
- remoteSigns: "0",
+ remoteSigns: "0"
};
this.resetForm("form");
},
@@ -529,11 +517,15 @@ export default {
this.resetForm("queryForm");
this.queryParams.parentCode = null;
this.queryParams.areaLevel = 1;
+ this.getbaidulist = {
+ areaName: "区域列表",
+ areaLevel: 1
+ };
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
- this.ids = selection.map((item) => item.id);
+ this.ids = selection.map(item => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
@@ -551,7 +543,7 @@ export default {
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
- getArea(id).then((response) => {
+ getArea(id).then(response => {
response.data.remoteSigns = String(response.data.remoteSigns);
this.form = response.data;
this.open = true;
@@ -560,24 +552,24 @@ export default {
},
/** 提交按钮 */
submitForm() {
- this.$refs["form"].validate((valid) => {
+ this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
- updateArea(this.form).then((response) => {
+ updateArea(this.form).then(response => {
if (response.code == 200) {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.getList();
+ this.$modal.msgSuccess("修改成功");
+ this.open = false;
+ this.getList();
}
});
} else {
- addArea(this.form).then((response) => {
+ addArea(this.form).then(response => {
if (response.code == 200) {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.queryParams.parentCode = this.form.parentCode;
- this.queryParams.areaLevel = null;
- this.getList();
+ this.$modal.msgSuccess("新增成功");
+ this.open = false;
+ this.queryParams.parentCode = this.form.parentCode;
+ this.queryParams.areaLevel = null;
+ this.getList();
}
});
}
@@ -589,7 +581,7 @@ export default {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除区域名称为"' + row.areaName + '"的数据项吗?')
- .then(function () {
+ .then(function() {
return delArea(ids);
})
.then(() => {
@@ -603,11 +595,11 @@ export default {
this.download(
"system/area/export",
{
- ...this.queryParams,
+ ...this.queryParams
},
`area_${new Date().getTime()}.xlsx`
);
- },
- },
+ }
+ }
};