diff --git a/src/views/main/DJYTenantParam/addItemForm.vue b/src/views/main/DJYTenantParam/addItemForm.vue index 1f18ac8..4aed6f8 100644 --- a/src/views/main/DJYTenantParam/addItemForm.vue +++ b/src/views/main/DJYTenantParam/addItemForm.vue @@ -137,24 +137,23 @@ export default { DJYTenantParamGet({ pageNo: 1, pageSize: 999 }).then(res => { this.TypeData = res.data let data = [] - let type = '' - let num = -1 res.data.forEach(item => { - if (type != item.type) { - num = num + 1 - type = item.type - } - // if (data.length == 0) { - if (data[num]) { - data[num].push(item) + if (data.length) { + let type2 = false + data.forEach((item2, index2) => { + if (item.type == item2[0].type) { + item2.push(item) + type2 = true + } + }) + if (!type2) { + data[data.length] = [item] + } } else { - data[num] = [] - data[num].push(item) + data[0] = [item] } - // } }) this.WTypeData = data - console.log(data) }) sysDictDataPage({ pageNo: 1, pageSize: 999, typeId: '353559512399941' }).then(res => { this.YWData = res.data.rows diff --git a/src/views/main/DJYTenantParam/editItemForm.vue b/src/views/main/DJYTenantParam/editItemForm.vue index 67974ea..e984518 100644 --- a/src/views/main/DJYTenantParam/editItemForm.vue +++ b/src/views/main/DJYTenantParam/editItemForm.vue @@ -137,24 +137,23 @@ export default { DJYTenantParamGet({ pageNo: 1, pageSize: 999 }).then(res => { this.TypeData = res.data let data = [] - let type = '' - let num = -1 res.data.forEach(item => { - if (type != item.type) { - num = num + 1 - type = item.type - } - // if (data.length == 0) { - if (data[num]) { - data[num].push(item) + if (data.length) { + let type2 = false + data.forEach((item2, index2) => { + if (item.type == item2[0].type) { + item2.push(item) + type2 = true + } + }) + if (!type2) { + data[data.length] = [item] + } } else { - data[num] = [] - data[num].push(item) + data[0] = [item] } - // } }) this.WTypeData = data - console.log(data) }) sysDictDataPage({ pageNo: 1, pageSize: 999, typeId: '353559512399941' }).then(res => { this.YWData = res.data.rows