|
@@ -14,11 +14,11 @@
|
|
|
:data="level2"
|
|
|
:disabled="disabled"
|
|
|
v-model="level2Check"
|
|
|
- :placeholder="level2?.[0]?.aname"
|
|
|
+ :placeholder="placeholder"
|
|
|
labelKey="aname"
|
|
|
valueKey="id"
|
|
|
:clearable="true"
|
|
|
- multiple
|
|
|
+ :multiple="multipleComp"
|
|
|
class="multipre"
|
|
|
style="margin-right: 8px; width: 180px"
|
|
|
>
|
|
@@ -35,6 +35,7 @@
|
|
|
v-show="
|
|
|
level3.length &&
|
|
|
(select == 'brand' ||
|
|
|
+ select == 'station' ||
|
|
|
select == 'project' ||
|
|
|
select == 'line' ||
|
|
|
select == 'square' ||
|
|
@@ -61,6 +62,63 @@
|
|
|
multiple
|
|
|
style="width: 160px"
|
|
|
/>
|
|
|
+ <eselect
|
|
|
+ :disabled="disabled"
|
|
|
+ v-show="
|
|
|
+ level5.length &&
|
|
|
+ (select == 'project' ||
|
|
|
+ select == 'line' ||
|
|
|
+ select == 'square' ||
|
|
|
+ select == 'wind')
|
|
|
+ "
|
|
|
+ :data="level5"
|
|
|
+ v-model="level5Check"
|
|
|
+ placeholder="全部期次"
|
|
|
+ labelKey="aname"
|
|
|
+ :clearable="true"
|
|
|
+ valueKey="id"
|
|
|
+ multiple
|
|
|
+ style="margin-right: 8px; width: 160px"
|
|
|
+ />
|
|
|
+ <eselect
|
|
|
+ :disabled="disabled"
|
|
|
+ v-show="
|
|
|
+ level6.length &&
|
|
|
+ (select == 'line' || select == 'square' || select == 'wind')
|
|
|
+ "
|
|
|
+ :data="level6"
|
|
|
+ v-model="level6Check"
|
|
|
+ placeholder="全部线路"
|
|
|
+ labelKey="nemName"
|
|
|
+ :clearable="true"
|
|
|
+ valueKey="id"
|
|
|
+ multiple
|
|
|
+ style="margin-right: 8px; width: 160px"
|
|
|
+ />
|
|
|
+ <eselect
|
|
|
+ :disabled="disabled"
|
|
|
+ v-show="level7.length && (select == 'square' || select == 'wind')"
|
|
|
+ :data="level7"
|
|
|
+ v-model="level7Check"
|
|
|
+ placeholder="全部阵区"
|
|
|
+ labelKey="aname"
|
|
|
+ :clearable="true"
|
|
|
+ valueKey="id"
|
|
|
+ multiple
|
|
|
+ style="margin-right: 8px; width: 160px"
|
|
|
+ />
|
|
|
+ <eselect
|
|
|
+ :disabled="disabled"
|
|
|
+ v-show="level8.length && select == 'wind'"
|
|
|
+ :data="level8"
|
|
|
+ v-model="level8Check"
|
|
|
+ placeholder="全部设备"
|
|
|
+ labelKey="aname"
|
|
|
+ :clearable="true"
|
|
|
+ valueKey="id"
|
|
|
+ multiple
|
|
|
+ style="margin-right: 8px; width: 160px"
|
|
|
+ />
|
|
|
</el-row>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -68,6 +126,10 @@ import {
|
|
|
GetStationByCompany,
|
|
|
GetOrganization,
|
|
|
GetModelList,
|
|
|
+ GetProjectList,
|
|
|
+ GetLineList,
|
|
|
+ GetSquareList,
|
|
|
+ GeWtList,
|
|
|
} from "@/api/headerNav.js";
|
|
|
import eselect from "@/components/eselect/index.vue";
|
|
|
import { Debounce } from "@/utils/common";
|
|
@@ -85,8 +147,8 @@ export default {
|
|
|
},
|
|
|
props: {
|
|
|
type: {
|
|
|
- type: String,
|
|
|
- default: "-2",
|
|
|
+ type: Number,
|
|
|
+ default: -2,
|
|
|
},
|
|
|
select: {
|
|
|
type: String,
|
|
@@ -102,20 +164,48 @@ export default {
|
|
|
disabled: {
|
|
|
default: false,
|
|
|
},
|
|
|
+ multipleComp: { default: true },
|
|
|
+ benchFlag: { default: false },
|
|
|
+ benchObj: { default: {} },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
//风光类型
|
|
|
- level1Check: this.type.toString(),
|
|
|
+ level1Check: this.type,
|
|
|
// 公司
|
|
|
- level2Check: [],
|
|
|
+ level2Check: this.multipleComp
|
|
|
+ ? this.benchFlag
|
|
|
+ ? this.benchObj.companys
|
|
|
+ : []
|
|
|
+ : "",
|
|
|
// 场站
|
|
|
level3Check: [],
|
|
|
// 型号
|
|
|
level4Check: [],
|
|
|
+ // 期次
|
|
|
+ level5Check: [],
|
|
|
+ // 线路
|
|
|
+ level6Check: [],
|
|
|
+ // 阵区
|
|
|
+ level7Check: [],
|
|
|
+ // 设备
|
|
|
+ level8Check: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
+ placeholder() {
|
|
|
+ return this.multipleComp
|
|
|
+ ? this.benchFlag
|
|
|
+ ? this.level2Check.length
|
|
|
+ ? ""
|
|
|
+ : this.level2[0]?.aname
|
|
|
+ : this.level2[0]?.aname
|
|
|
+ : this.benchFlag
|
|
|
+ ? this.level2Check.length
|
|
|
+ ? ""
|
|
|
+ : this.level2[0]?.aname
|
|
|
+ : this.level2[0]?.aname;
|
|
|
+ },
|
|
|
level1() {
|
|
|
return this.level1Map.value;
|
|
|
},
|
|
@@ -138,45 +228,132 @@ export default {
|
|
|
},
|
|
|
// 场站列表
|
|
|
level3() {
|
|
|
- if (!this.level2Check.length) {
|
|
|
+ if (this.multipleComp) {
|
|
|
+ if (!this.level2Check.length) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ const r = [];
|
|
|
+ this.level2Check.forEach((c) => {
|
|
|
+ const cl = this.level3Map[c];
|
|
|
+ if (!cl) {
|
|
|
+ this.getPowerStation(this.level1Check, c);
|
|
|
+ } else {
|
|
|
+ cl.length && r.push(...cl);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return [...new Set(r)];
|
|
|
+ } else {
|
|
|
+ if (!this.level2Check.length) {
|
|
|
+ return [];
|
|
|
+ } else {
|
|
|
+ const r = [];
|
|
|
+ const cl = this.level3Map[this.level2Check];
|
|
|
+ if (!cl) {
|
|
|
+ this.getPowerStation(this.level1Check, this.level2Check);
|
|
|
+ } else {
|
|
|
+ cl.length && r.push(...cl);
|
|
|
+ }
|
|
|
+ return [...new Set(r)];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 型号列表
|
|
|
+ level4() {
|
|
|
+ if (this.select == "brand") {
|
|
|
+ if (!this.level3Check.length) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ const r = [];
|
|
|
+ this.level3Check.forEach((c) => {
|
|
|
+ const cl = this.level4Map[c];
|
|
|
+ if (!cl) {
|
|
|
+ this.getBrand(c);
|
|
|
+ } else {
|
|
|
+ cl.length && r.push(...cl);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return [...new Set(r.map((i) => i.modelId))].map((i) => ({
|
|
|
+ modelId: i,
|
|
|
+ }));
|
|
|
+ } else {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 期次列表
|
|
|
+ level5() {
|
|
|
+ if (!this.level3Check.length) {
|
|
|
return [];
|
|
|
}
|
|
|
const r = [];
|
|
|
- this.level2Check.forEach((c) => {
|
|
|
- const cl = this.level3Map[c];
|
|
|
+ this.level3Check.forEach((c) => {
|
|
|
+ const cl = this.level5Map[c];
|
|
|
if (!cl) {
|
|
|
- this.getPowerStation(this.level1Check, c);
|
|
|
+ this.getProject(c);
|
|
|
} else {
|
|
|
cl.length && r.push(...cl);
|
|
|
}
|
|
|
});
|
|
|
return [...new Set(r)];
|
|
|
},
|
|
|
- // 型号列表
|
|
|
- level4() {
|
|
|
- if (!this.level3Check.length) {
|
|
|
+ // 线路列表
|
|
|
+ level6() {
|
|
|
+ if (!this.level5Check.length) {
|
|
|
return [];
|
|
|
}
|
|
|
const r = [];
|
|
|
- this.level3Check.forEach((c) => {
|
|
|
- const cl = this.level4Map[c];
|
|
|
+ this.level5Check.forEach((c) => {
|
|
|
+ const cl = this.level6Map[c];
|
|
|
if (!cl) {
|
|
|
- this.getBrand(c);
|
|
|
+ this.getLine(c);
|
|
|
} else {
|
|
|
cl.length && r.push(...cl);
|
|
|
}
|
|
|
});
|
|
|
- return [...new Set(r.map((i) => i.modelId))].map((i) => ({
|
|
|
- modelId: i,
|
|
|
- }));
|
|
|
+ return [...new Set(r)];
|
|
|
+ },
|
|
|
+ // 阵区列表
|
|
|
+ level7() {
|
|
|
+ if (!this.level6Check.length) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ const r = [];
|
|
|
+ this.level6Check.forEach((c) => {
|
|
|
+ const cl = this.level7Map[c];
|
|
|
+ if (!cl) {
|
|
|
+ this.getSquare(c);
|
|
|
+ } else {
|
|
|
+ cl.length && r.push(...cl);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return [...new Set(r)];
|
|
|
+ },
|
|
|
+ // 设备列表
|
|
|
+ level8() {
|
|
|
+ if (!this.level7Check.length) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ const r = [];
|
|
|
+ this.level7Check.forEach((c) => {
|
|
|
+ const cl = this.level8Map[c];
|
|
|
+ if (!cl) {
|
|
|
+ this.getWind(c);
|
|
|
+ } else {
|
|
|
+ cl.length && r.push(...cl);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return [...new Set(r)];
|
|
|
},
|
|
|
|
|
|
checks() {
|
|
|
return [
|
|
|
this.level1Check,
|
|
|
- this.level2Check.join(","),
|
|
|
+ this.multipleComp ? this.level2Check.join(",") : this.level2Check,
|
|
|
this.level3Check.join(","),
|
|
|
this.level4Check.join(","),
|
|
|
+ this.level5Check.join(","),
|
|
|
+ this.level6Check.join(","),
|
|
|
+ this.level7Check.join(","),
|
|
|
+ this.level8Check.join(","),
|
|
|
].join("|");
|
|
|
},
|
|
|
},
|
|
@@ -192,30 +369,121 @@ export default {
|
|
|
immediate: true,
|
|
|
},
|
|
|
level2Check(n, old) {
|
|
|
- console.log(n, old);
|
|
|
+ if (this.multipleComp) {
|
|
|
+ if (n.length < old.length) {
|
|
|
+ // 删除选项了 需要检查删除选中的lv3的
|
|
|
+ const newCheck = [];
|
|
|
+ const arr = old.filter((i) => !n.includes(i));
|
|
|
+ arr.forEach((item) => {
|
|
|
+ const l2arr = this.level3Map[item].map?.((it) => it.id) ?? [];
|
|
|
+ newCheck.push(...l2arr);
|
|
|
+ });
|
|
|
+ this.level3Check = this.level3Check.filter(
|
|
|
+ (item) => !newCheck.includes(item)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.level3Check = this.benchFlag
|
|
|
+ ? n != this.benchObj?.companys
|
|
|
+ ? []
|
|
|
+ : this.benchObj?.stations
|
|
|
+ ? this.benchObj?.stations
|
|
|
+ : []
|
|
|
+ : [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ level3Check(n, old) {
|
|
|
+ if (n.length < old.length) {
|
|
|
+ // 删除选项了 需要检查删除选中的lv3的
|
|
|
+ if (this.select == "brand") {
|
|
|
+ const newCheck = [];
|
|
|
+ const arr = old.filter((i) => !n.includes(i));
|
|
|
+ arr.forEach((item) => {
|
|
|
+ const l3arr = this.level4Map[item].map?.((it) => it.modelId) ?? [];
|
|
|
+ newCheck.push(...l3arr);
|
|
|
+ });
|
|
|
+ this.level4Check = this.level4Check.filter(
|
|
|
+ (item) => !newCheck.includes(item)
|
|
|
+ );
|
|
|
+ } else if (this.select != "station") {
|
|
|
+ const newCheck = [];
|
|
|
+ const arr = old.filter((i) => !n.includes(i));
|
|
|
+ arr.forEach((item) => {
|
|
|
+ const l3arr = this.level5Map[item].map?.((it) => it.id) ?? [];
|
|
|
+ newCheck.push(...l3arr);
|
|
|
+ });
|
|
|
+ this.level5Check = this.level5Check.filter(
|
|
|
+ (item) => !newCheck.includes(item)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.benchFlag) {
|
|
|
+ if (n != this.benchObj?.stations) {
|
|
|
+ this.level5Check = [];
|
|
|
+ } else {
|
|
|
+ this.level5Check = this.benchObj?.projects
|
|
|
+ ? this.benchObj?.projects
|
|
|
+ : [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ level5Check(n, old) {
|
|
|
+ if (n.length < old.length) {
|
|
|
+ // 删除选项了 需要检查删除选中的lv3的
|
|
|
+ const newCheck = [];
|
|
|
+ const arr = old.filter((i) => !n.includes(i));
|
|
|
+ arr.forEach((item) => {
|
|
|
+ const l5arr = this.level6Map[item].map?.((it) => it.id) ?? [];
|
|
|
+ newCheck.push(...l5arr);
|
|
|
+ });
|
|
|
+ this.level6Check = this.level6Check.filter(
|
|
|
+ (item) => !newCheck.includes(item)
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ if (this.benchFlag) {
|
|
|
+ if (n != this.benchObj?.projects) {
|
|
|
+ this.level6Check = [];
|
|
|
+ } else {
|
|
|
+ this.level6Check = this.benchObj?.lines ? this.benchObj?.lines : [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ level6Check(n, old) {
|
|
|
if (n.length < old.length) {
|
|
|
// 删除选项了 需要检查删除选中的lv3的
|
|
|
const newCheck = [];
|
|
|
const arr = old.filter((i) => !n.includes(i));
|
|
|
arr.forEach((item) => {
|
|
|
- const l2arr = this.level3Map[item].map?.((it) => it.id) ?? [];
|
|
|
- newCheck.push(...l2arr);
|
|
|
+ const l6arr = this.level7Map[item].map?.((it) => it.id) ?? [];
|
|
|
+ newCheck.push(...l6arr);
|
|
|
});
|
|
|
- this.level3Check = this.level3Check.filter(
|
|
|
+ this.level7Check = this.level7Check.filter(
|
|
|
(item) => !newCheck.includes(item)
|
|
|
);
|
|
|
+ } else {
|
|
|
+ if (this.benchFlag) {
|
|
|
+ if (n != this.benchObj?.lines) {
|
|
|
+ this.level7Check = [];
|
|
|
+ } else {
|
|
|
+ this.level7Check = this.benchObj?.squares
|
|
|
+ ? this.benchObj?.squares
|
|
|
+ : [];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- level3Check(n, old) {
|
|
|
+ level7Check(n, old) {
|
|
|
if (n.length < old.length) {
|
|
|
// 删除选项了 需要检查删除选中的lv3的
|
|
|
const newCheck = [];
|
|
|
const arr = old.filter((i) => !n.includes(i));
|
|
|
arr.forEach((item) => {
|
|
|
- const l3arr = this.level4Map[item].map?.((it) => it.modelId) ?? [];
|
|
|
- newCheck.push(...l3arr);
|
|
|
+ const l7arr = this.level8Map[item].map?.((it) => it.id) ?? [];
|
|
|
+ newCheck.push(...l7arr);
|
|
|
});
|
|
|
- this.level4Check = this.level4Check.filter(
|
|
|
+ this.level8Check = this.level8Check.filter(
|
|
|
(item) => !newCheck.includes(item)
|
|
|
);
|
|
|
}
|
|
@@ -235,22 +503,28 @@ export default {
|
|
|
companys: this.level2Check,
|
|
|
stations: this.level3Check,
|
|
|
brands: this.level4Check,
|
|
|
- values: this.level4Check.length
|
|
|
- ? this.level4Check
|
|
|
- : this.level3Check.length
|
|
|
- ? this.level3Check
|
|
|
- : this.level2Check,
|
|
|
+ projects: this.level5Check,
|
|
|
+ lines: this.level6Check,
|
|
|
+ squares: this.level7Check,
|
|
|
+ winds: this.level8Check,
|
|
|
});
|
|
|
}, 500);
|
|
|
},
|
|
|
methods: {
|
|
|
+ initBench({ type, companys }) {
|
|
|
+ this.level1Check = type;
|
|
|
+ this.level2Check = companys;
|
|
|
+ },
|
|
|
+ // init() {
|
|
|
+ // this.level2Check = this.level2[0].id;
|
|
|
+ // this.level3Check = this.level3.slice(0, 2).map((i) => i.id);
|
|
|
+ // },
|
|
|
//获取风光类型
|
|
|
gettypeData() {
|
|
|
const data = this.typeOptions;
|
|
|
const df = data.map((i) => ({
|
|
|
...i,
|
|
|
icon: i.type,
|
|
|
- type: String(i.type),
|
|
|
}));
|
|
|
this.setLevel1(df);
|
|
|
},
|
|
@@ -259,6 +533,9 @@ export default {
|
|
|
const { data } = await GetOrganization({ type });
|
|
|
if (data && data.length > 0) {
|
|
|
this.setLevel2(type, data);
|
|
|
+ if (this.select == "wind") {
|
|
|
+ this.level2Check = this.level2[0].id;
|
|
|
+ }
|
|
|
} else {
|
|
|
this.setLevel2(type, []);
|
|
|
}
|
|
@@ -271,15 +548,52 @@ export default {
|
|
|
});
|
|
|
if (data) {
|
|
|
this.setLevel3(checkNode, data);
|
|
|
+ if (this.select == "wind") {
|
|
|
+ this.level3Check = this.level3.slice(0, 1).map((i) => i.id);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- //获取场站信息
|
|
|
+ //获取型号信息
|
|
|
async getBrand(checkNode) {
|
|
|
const { data } = await GetModelList(checkNode);
|
|
|
if (data) {
|
|
|
this.setLevel4(checkNode, data);
|
|
|
}
|
|
|
},
|
|
|
+ //获取期次信息
|
|
|
+ async getProject(checkNode) {
|
|
|
+ const { data } = await GetProjectList(checkNode);
|
|
|
+ if (data) {
|
|
|
+ this.setLevel5(checkNode, data);
|
|
|
+ if (this.select == "wind") {
|
|
|
+ this.level5Check = this.level5.slice(0, 1).map((i) => i.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取线路信息
|
|
|
+ async getLine(checkNode) {
|
|
|
+ const { data } = await GetLineList(checkNode);
|
|
|
+ if (data) {
|
|
|
+ this.setLevel6(checkNode, data);
|
|
|
+ if (this.select == "wind") {
|
|
|
+ this.level6Check = this.level6.slice(0, 1).map((i) => i.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取阵区信息
|
|
|
+ async getSquare(checkNode) {
|
|
|
+ const { data } = await GetSquareList(checkNode);
|
|
|
+ if (data) {
|
|
|
+ this.setLevel7(checkNode, data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取设备信息
|
|
|
+ async getWind(checkNode) {
|
|
|
+ const { data } = await GeWtList(checkNode);
|
|
|
+ if (data) {
|
|
|
+ this.setLevel8(checkNode, data);
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|