修改菜单栏重复点击console会显示bug , 以及行政地区不回显问题
parent
2dac958227
commit
33bb16a0d3
|
@ -97,6 +97,14 @@ const ShopEntry = (resolve) =>
|
||||||
|
|
||||||
Vue.use(Router);
|
Vue.use(Router);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解决重复点击菜单会控制台报错bug
|
||||||
|
*/
|
||||||
|
const routerPush = Router.prototype.push
|
||||||
|
Router.prototype.push = function push(location) {
|
||||||
|
return routerPush.call(this, location).catch(error=> error)
|
||||||
|
}
|
||||||
|
|
||||||
export default new Router({
|
export default new Router({
|
||||||
mode: "history",
|
mode: "history",
|
||||||
routes: [
|
routes: [
|
||||||
|
|
|
@ -13,6 +13,14 @@ const RouterConfig = {
|
||||||
routes: routers
|
routes: routers
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解决重复点击菜单会控制台报错bug
|
||||||
|
*/
|
||||||
|
const routerPush = VueRouter.prototype.push
|
||||||
|
VueRouter.prototype.push = function push(location) {
|
||||||
|
return routerPush.call(this, location).catch(error=> error)
|
||||||
|
}
|
||||||
|
|
||||||
export const router = new VueRouter(RouterConfig);
|
export const router = new VueRouter(RouterConfig);
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
|
@ -44,3 +52,5 @@ router.afterEach((to) => {
|
||||||
ViewUI.LoadingBar.finish();
|
ViewUI.LoadingBar.finish();
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<Card>
|
<Card>
|
||||||
<Row class="operation">
|
<Row class="operation">
|
||||||
<Button @click="handleAsyncRegion" :loading="asyncLoading" type="primary" icon="md-add"
|
<Button
|
||||||
|
@click="handleAsyncRegion"
|
||||||
|
:loading="asyncLoading"
|
||||||
|
type="primary"
|
||||||
|
icon="md-add"
|
||||||
>同步数据</Button
|
>同步数据</Button
|
||||||
>
|
>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -10,7 +14,6 @@
|
||||||
class="tree"
|
class="tree"
|
||||||
:data="data"
|
:data="data"
|
||||||
:load-data="loadData"
|
:load-data="loadData"
|
||||||
expand-node
|
|
||||||
@on-select-change="changeTree"
|
@on-select-change="changeTree"
|
||||||
></Tree>
|
></Tree>
|
||||||
<div class="form">
|
<div class="form">
|
||||||
|
@ -27,7 +30,11 @@
|
||||||
<Input v-model="formValidate.cityCode" />
|
<Input v-model="formValidate.cityCode" />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="行政区划级别" prop="cityCode">
|
<FormItem label="行政区划级别" prop="cityCode">
|
||||||
<RadioGroup type="button" button-style="solid" v-model="formValidate.level">
|
<RadioGroup
|
||||||
|
type="button"
|
||||||
|
button-style="solid"
|
||||||
|
v-model="formValidate.level"
|
||||||
|
>
|
||||||
<Radio disabled label="country">国家</Radio>
|
<Radio disabled label="country">国家</Radio>
|
||||||
<Radio disabled label="province">省份</Radio>
|
<Radio disabled label="province">省份</Radio>
|
||||||
<Radio disabled label="city">市</Radio>
|
<Radio disabled label="city">市</Radio>
|
||||||
|
@ -95,16 +102,18 @@ import {
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
asyncLoading:false, // 加载状态
|
asyncLoading: false, // 加载状态
|
||||||
num: 10, // 更新倒计时
|
num: 10, // 更新倒计时
|
||||||
modalFlag: false, // 新增编辑标识
|
modalFlag: false, // 新增编辑标识
|
||||||
timerNum: 10, // 定时器
|
timerNum: 10, // 定时器
|
||||||
data: [], // 加载数据
|
data: [], // 加载数据
|
||||||
id: 0, // id
|
id: 0, // id
|
||||||
addValidate: { // 添加级别
|
addValidate: {
|
||||||
|
// 添加级别
|
||||||
parentName: "无父级",
|
parentName: "无父级",
|
||||||
},
|
},
|
||||||
formValidate: { // 表单数据
|
formValidate: {
|
||||||
|
// 表单数据
|
||||||
adCode: "",
|
adCode: "",
|
||||||
cityCode: "",
|
cityCode: "",
|
||||||
center: "",
|
center: "",
|
||||||
|
@ -112,7 +121,8 @@ export default {
|
||||||
orderNum: "",
|
orderNum: "",
|
||||||
level: "",
|
level: "",
|
||||||
},
|
},
|
||||||
ruleValidate: { // 验证规则
|
ruleValidate: {
|
||||||
|
// 验证规则
|
||||||
adCode: [
|
adCode: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -227,12 +237,13 @@ export default {
|
||||||
},
|
},
|
||||||
// 树结构点击事件
|
// 树结构点击事件
|
||||||
changeTree(array, val) {
|
changeTree(array, val) {
|
||||||
this.formValidate = val;
|
val.cityCode == "null" ? (val.cityCode = "") : val.cityCode;
|
||||||
|
this.$set(this, "formValidate", val);
|
||||||
},
|
},
|
||||||
// 异步加载数据
|
// 异步加载数据
|
||||||
loadData(item, callback) {
|
loadData(item, callback) {
|
||||||
item.loading = true;
|
item.loading = true;
|
||||||
console.log(item);
|
// console.log(item);
|
||||||
getChildRegion(item.id).then((res) => {
|
getChildRegion(item.id).then((res) => {
|
||||||
if (res.result.length <= 0) {
|
if (res.result.length <= 0) {
|
||||||
item.loading = false;
|
item.loading = false;
|
||||||
|
@ -302,7 +313,7 @@ export default {
|
||||||
let timer;
|
let timer;
|
||||||
let number;
|
let number;
|
||||||
|
|
||||||
this.asyncLoading = true
|
this.asyncLoading = true;
|
||||||
|
|
||||||
this.$Message.info({
|
this.$Message.info({
|
||||||
duration: this.timerNum,
|
duration: this.timerNum,
|
||||||
|
@ -315,9 +326,9 @@ export default {
|
||||||
on: {
|
on: {
|
||||||
click: () => {
|
click: () => {
|
||||||
this.$Message.destroy();
|
this.$Message.destroy();
|
||||||
this.asyncLoading = false
|
this.asyncLoading = false;
|
||||||
clearInterval(number);
|
clearInterval(number);
|
||||||
clearTimeout(timer)
|
clearTimeout(timer);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -332,9 +343,9 @@ export default {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
clearInterval(number)
|
clearInterval(number);
|
||||||
asyncRegion().then((res) => {
|
asyncRegion().then((res) => {
|
||||||
this.asyncLoading = false
|
this.asyncLoading = false;
|
||||||
this.$Message.loading("地区数据正在更新中!");
|
this.$Message.loading("地区数据正在更新中!");
|
||||||
});
|
});
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
|
@ -13,6 +13,14 @@ const RouterConfig = {
|
||||||
routes: routers
|
routes: routers
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解决重复点击菜单会控制台报错bug
|
||||||
|
*/
|
||||||
|
const routerPush = VueRouter.prototype.push
|
||||||
|
VueRouter.prototype.push = function push(location) {
|
||||||
|
return routerPush.call(this, location).catch(error=> error)
|
||||||
|
}
|
||||||
|
|
||||||
export const router = new VueRouter(RouterConfig);
|
export const router = new VueRouter(RouterConfig);
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
|
|
Loading…
Reference in New Issue