diff --git a/src/views/data/ComplaintCollection.vue b/src/views/data/ComplaintCollection.vue index 717968c..d007fc2 100644 --- a/src/views/data/ComplaintCollection.vue +++ b/src/views/data/ComplaintCollection.vue @@ -421,6 +421,8 @@ const list = ref([]); const total = ref(0); const loading = ref(false) const getList = async () => { + console.log("===============xxx==================") + console.log(dict.value.sfssSourceTable) loading.value = true; let res = await getComplaintCollectionPage(query.value); console.log(res.complaintCollectionPageDTOS); @@ -669,6 +671,35 @@ const storeDict = computed(() => ]) || {} ); + +// 组装数据 +const sourceTableAndLevel = computed(() => { + const list = storeDict.value.sfssSourceTable || [] + + // 一级:remark 为空 + const parents = list + .filter(d => !d.remark) + .sort((a, b) => (a.dictSort ?? 0) - (b.dictSort ?? 0)) + + // 二级:remark 有值(remark=父级dictValue) + const children = list + .filter(d => d.remark) + .sort((a, b) => (a.dictSort ?? 0) - (b.dictSort ?? 0)) + + return parents.map(p => ({ + label: p.dictLabel, + value: String(p.dictValue), + children: children + .filter(c => String(c.remark) === String(p.dictValue)) + .map(c => ({ + label: c.dictLabel, + value: String(c.dictValue), + })), + })) +}) + + + // ② 页面私有字典 const localDict = { sourceTable: [ @@ -678,100 +709,6 @@ const localDict = { {id: 4, dictLabel: "12389投诉", dictValue: "data_case_verif"}, {id: 5, dictLabel: "领导交办", dictValue: "leader_explain"}, ], - sourceTableAndLevel: [ - { - id: 1, - label: "局长信箱", - value: "23", - children: [ - { - label: "局长信箱", - value: "23_jz", - }, - { - label: "厅长信箱", - value: "23_tz", - }, - ], - }, - { - id: 2, - label: "公安部信访", - value: "22", - children: [ - { - label: "公安部信访件", - value: "22_1", - }, - { - label: "省厅信访件", - value: "22_2", - }, - { - label: "市局信访件", - value: "22_3", - }, - ], - - }, - { - id: 3, - label: "国家信访", - value: "21", - children: [ - { - label: "国家信访件", - value: "21_1", - }, - { - label: "省信访件", - value: "21_2", - }, - { - label: "市信访件", - value: "21_3", - }, - ], - }, - { - id: 4, - label: "12389投诉", - value: "17", - children: [ - { - label: "公安部件", - value: "17_1", - }, - { - label: "省厅件", - value: "17_2", - }, - { - label: "市局件", - value: "17_3", - }, - ], - }, - { - id: 5, - label: "领导交办", - value: "leader_explain", - children: [ - { - label: "市局领导交办", - value: "18", - }, - { - label: "支队领导交办", - value: "19", - }, - { - label: "上级领导交办", - value: "20", - }, - ], - }, - ], yesNo: [ {id: 1, dictLabel: "是", dictValue: "1"}, {id: 2, dictLabel: "否", dictValue: "0"}, @@ -789,6 +726,7 @@ const localDict = { const dict = computed(() => ({ ...storeDict.value, ...localDict, + sourceTableAndLevel: sourceTableAndLevel.value, })); function getDictLabel(list, value) {