性能优化
This commit is contained in:
parent
99757054eb
commit
eb370cd4ed
|
@ -46,6 +46,7 @@ const BASE_DATA = {
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
reRender: false,
|
||||||
currentPanel: "基础信息",
|
currentPanel: "基础信息",
|
||||||
modalData: {},
|
modalData: {},
|
||||||
modalConfig: {
|
modalConfig: {
|
||||||
|
@ -108,7 +109,7 @@ export default {
|
||||||
) {
|
) {
|
||||||
item.conditionType = "件数+金额";
|
item.conditionType = "件数+金额";
|
||||||
} else if (
|
} else if (
|
||||||
typeof item.price == 'number' &&
|
typeof item.price == "number" &&
|
||||||
typeof item.number != "number"
|
typeof item.number != "number"
|
||||||
) {
|
) {
|
||||||
item.conditionType = "金额";
|
item.conditionType = "金额";
|
||||||
|
@ -165,13 +166,18 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
computedCityOptions() {
|
computedCityOptions() {
|
||||||
return ($rowIndex, list = []) => {
|
|
||||||
// console.time();
|
|
||||||
let _arr = cloneDeep(this.$api.mer_admin.getCityOptions());
|
let _arr = cloneDeep(this.$api.mer_admin.getCityOptions());
|
||||||
let selectedArray = [];
|
return ($rowIndex, list = []) => {
|
||||||
|
console.log("计算");
|
||||||
|
|
||||||
|
if (this.reRender == false) {
|
||||||
|
return _arr;
|
||||||
|
}
|
||||||
|
// console.time();
|
||||||
|
let selectedArray = new Set();
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
if (i != $rowIndex) {
|
if (i != $rowIndex) {
|
||||||
selectedArray = selectedArray.concat(list[i].cityCodes);
|
selectedArray = new Set([...selectedArray, ...list[i].cityCodes]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 根据数组过滤树形结构数组
|
// 根据数组过滤树形结构数组
|
||||||
|
@ -191,7 +197,7 @@ export default {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !bList.includes(item.code);
|
return !bList.has(item.code);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
let new_arr = filterTreeArray(_arr, selectedArray);
|
let new_arr = filterTreeArray(_arr, selectedArray);
|
||||||
|
@ -266,11 +272,10 @@ export default {
|
||||||
//自定义运费
|
//自定义运费
|
||||||
{
|
{
|
||||||
label: "自定义运费配置",
|
label: "自定义运费配置",
|
||||||
|
prop: "customShippingFareConfig",
|
||||||
type: "jsx-out",
|
type: "jsx-out",
|
||||||
show: this.modalData.fareConfig == "自定义运费",
|
show: this.modalData.fareConfig == "自定义运费",
|
||||||
render: () => {
|
render: () => {
|
||||||
console.log("执行了render函数");
|
|
||||||
|
|
||||||
const tableCols = [
|
const tableCols = [
|
||||||
{
|
{
|
||||||
title: "运送到",
|
title: "运送到",
|
||||||
|
@ -278,6 +283,7 @@ export default {
|
||||||
field: "cityCodes",
|
field: "cityCodes",
|
||||||
type: "jsx",
|
type: "jsx",
|
||||||
render: ({ row, $rowIndex }) => {
|
render: ({ row, $rowIndex }) => {
|
||||||
|
console.log("this.reRender", this.reRender);
|
||||||
const change = (e) => {
|
const change = (e) => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
console.log(
|
console.log(
|
||||||
|
@ -300,6 +306,10 @@ export default {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<el-cascader
|
<el-cascader
|
||||||
|
on-visible-change={(e) => {
|
||||||
|
console.log(e);
|
||||||
|
this.reRender = e;
|
||||||
|
}}
|
||||||
ref="cityCode"
|
ref="cityCode"
|
||||||
style="width:100%;"
|
style="width:100%;"
|
||||||
v-model={row.cityCodes}
|
v-model={row.cityCodes}
|
||||||
|
@ -603,7 +613,7 @@ export default {
|
||||||
//指定包邮条件
|
//指定包邮条件
|
||||||
{
|
{
|
||||||
label: "",
|
label: "",
|
||||||
prop: "",
|
prop: "123",
|
||||||
type: "jsx-out",
|
type: "jsx-out",
|
||||||
show: this.modalData.fareConfig == "自定义运费",
|
show: this.modalData.fareConfig == "自定义运费",
|
||||||
render: () => {
|
render: () => {
|
||||||
|
@ -634,6 +644,10 @@ export default {
|
||||||
style="width:100%;"
|
style="width:100%;"
|
||||||
v-model={row.cityCodes}
|
v-model={row.cityCodes}
|
||||||
onChange={change}
|
onChange={change}
|
||||||
|
on-visible-change={(e) => {
|
||||||
|
console.log(e);
|
||||||
|
this.reRender = e;
|
||||||
|
}}
|
||||||
options={this.computedCityOptions(
|
options={this.computedCityOptions(
|
||||||
$rowIndex,
|
$rowIndex,
|
||||||
this.modalData.shippingTemplatesConditionList
|
this.modalData.shippingTemplatesConditionList
|
||||||
|
|
Loading…
Reference in New Issue