|
@@ -232,6 +232,7 @@ export default {
|
|
|
lx: [],
|
|
|
lxArr: [],
|
|
|
ydlx: [],
|
|
|
+ ydlx_n: [],
|
|
|
ydlxDicts: ydlxDicts,
|
|
|
query: {
|
|
|
xzqmc: '',
|
|
@@ -272,7 +273,6 @@ export default {
|
|
|
total: 100
|
|
|
},
|
|
|
nf: '2021',
|
|
|
- isAllSelected: false,
|
|
|
isOther: false
|
|
|
}
|
|
|
},
|
|
@@ -282,22 +282,35 @@ export default {
|
|
|
this.getTsxzListData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ computedYdlx () {
|
|
|
+ const list = this.ydlx
|
|
|
+ const map = {};
|
|
|
+ list.forEach((item) => {
|
|
|
+ if (map[item[0]]) {
|
|
|
+ map[item[0]].push(item[1])
|
|
|
+ } else {
|
|
|
+ map[item[0]] = [item[1]];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return map;
|
|
|
+ },
|
|
|
async queryData() {
|
|
|
+ this.ydlx_n = [];
|
|
|
this.isOther = false;
|
|
|
- this.isAllSelected = false;
|
|
|
if (this.ydlx.length > 0) {
|
|
|
- const otherBms = this.ydlx.filter(arr => arr[0] === 'Q');
|
|
|
- if (otherBms.length === 0) {
|
|
|
- const pBm = this.ydlx[0][0]
|
|
|
- const selected = ydlxDicts.filter(item => item.value === pBm);
|
|
|
- if (selected && selected.length > 0) {
|
|
|
- if (selected[0]['children'].length === this.ydlx.length) {
|
|
|
- this.isAllSelected = true;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.isAllSelected = true;
|
|
|
+ const ydlxMap = this.computedYdlx();
|
|
|
+ if (ydlxMap['Q']) {
|
|
|
this.isOther = true;
|
|
|
+ } else {
|
|
|
+ ydlxDicts.forEach((item) => {
|
|
|
+ if (ydlxMap[item['value']]) {
|
|
|
+ if (ydlxMap[item['value']].length === item.children.length) {
|
|
|
+ this.ydlx_n.push(item['value'])
|
|
|
+ } else {
|
|
|
+ this.ydlx_n.push(...ydlxMap[item['value']])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
this.initHZ()
|
|
@@ -369,8 +382,8 @@ export default {
|
|
|
if (this.isOther) {
|
|
|
p['dlbms'] = ydlxDicts.map((item) => item['value']);
|
|
|
} else {
|
|
|
- if (this.ydlx.length > 0) {
|
|
|
- p['dlbms'] = this.isAllSelected ? [this.ydlx[0][0]] : this.ydlx.map(arr => arr[1])
|
|
|
+ if (this.ydlx_n.length > 0) {
|
|
|
+ p['dlbms'] = this.ydlx_n.map(item=> item)
|
|
|
}
|
|
|
}
|
|
|
return new Promise((resolve, reject) => {
|
|
@@ -392,8 +405,8 @@ export default {
|
|
|
if (this.isOther) {
|
|
|
p['dlbms'] = ydlxDicts.map((item) => item['value']);
|
|
|
} else {
|
|
|
- if (this.ydlx.length > 0) {
|
|
|
- p['dlbms'] = this.isAllSelected ? [this.ydlx[0][0]] : this.ydlx.map(arr => arr[1])
|
|
|
+ if (this.ydlx_n.length > 0) {
|
|
|
+ p['dlbms'] = this.ydlx_n.map(item=> item)
|
|
|
}
|
|
|
}
|
|
|
const urlApi = `/api/ybz-bj/wlydTJ`;
|
|
@@ -423,8 +436,8 @@ export default {
|
|
|
if (this.isOther) {
|
|
|
p['dlbms'] = ydlxDicts.map((item) => item['value']);
|
|
|
} else {
|
|
|
- if (this.ydlx.length > 0) {
|
|
|
- p['dlbms'] = this.isAllSelected ? [this.ydlx[0][0]] : this.ydlx.map(arr => arr[1])
|
|
|
+ if (this.ydlx_n.length > 0) {
|
|
|
+ p['dlbms'] = this.ydlx_n.map(item=> item)
|
|
|
}
|
|
|
}
|
|
|
this.$ajax.get(urlApi, p, this, false).then((result) => {
|
|
@@ -459,8 +472,8 @@ export default {
|
|
|
if (this.isOther) {
|
|
|
sendData['dlbms'] = ydlxDicts.map((item) => item['value']);
|
|
|
} else {
|
|
|
- if (this.ydlx.length > 0) {
|
|
|
- sendData['dlbms'] = this.isAllSelected ? [this.ydlx[0][0]] : this.ydlx.map(arr => arr[1])
|
|
|
+ if (this.ydlx_n.length > 0) {
|
|
|
+ sendData['dlbms'] = this.ydlx_n.map(item=> item)
|
|
|
}
|
|
|
}
|
|
|
this.$axios({
|