diff --git a/src/views/DataAnalyse/diagram/components/MultiChart.vue b/src/views/DataAnalyse/diagram/components/MultiChart.vue index fe4c379d..72da4b37 100644 --- a/src/views/DataAnalyse/diagram/components/MultiChart.vue +++ b/src/views/DataAnalyse/diagram/components/MultiChart.vue @@ -108,7 +108,10 @@ export default defineComponent({ } return obj }) - let result = Object.entries(data[0]) + let result = []; + if(data.length > 0){ + result = Object.entries(data[0]) + } if(empty_option) { result = result.filter(item => item[1] !== 0) } @@ -180,16 +183,30 @@ export default defineComponent({ tableInstance.value.data = tableData tableInstance.value.columns = data.head columns.value = data.head.map((item, index) => { - return { - ...item, - title: () => , - name: item.title, - dataIndex: item.key, - slots: { customRender: item.key }, - width: 100, - // align: "center", - fixed: index === 0 ? 'left' : null - }; + if(item.key !== 'option' && item.key !== '1.00' && item.key !== '2.00'&& item.key !== '3.00'&& item.key !== '4.00'&& item.key !== '5.00'){ + return { + ...item, + title: () => , + name: item.title, + dataIndex: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? 'left' : null, + sorter: (a, b) => { return a[item.key] > b[item.key] ? 1 : -1 }, + }; + }else{ + return { + ...item, + title: () => , + name: item.title, + dataIndex: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? 'left' : null + }; + } }); }, { diff --git a/src/views/DataAnalyse/diagram/components/SingleChart.vue b/src/views/DataAnalyse/diagram/components/SingleChart.vue index 07d703e8..7cc8181c 100644 --- a/src/views/DataAnalyse/diagram/components/SingleChart.vue +++ b/src/views/DataAnalyse/diagram/components/SingleChart.vue @@ -125,7 +125,19 @@ export default defineComponent({ // align: "center", fixed: index === 0 ? "left" : null, }; - }else { + } else if (item.key === 'number') { + return { + ...item, + title: () => , + dataIndex: item.key, + key: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? "left" : null, + sorter: (a, b) => { return a.number > b.number? 1 : -1 }, + }; + } else { return { ...item, title: () => , @@ -137,7 +149,7 @@ export default defineComponent({ fixed: index === 0 ? "left" : null, }; } - + }) || []; tableInstance.value.data = tableSource.value; tableInstance.value.columns = data.head; diff --git a/src/views/DataAnalyse/diagram/components/questionTypes/basic/ConstantAggregate.vue b/src/views/DataAnalyse/diagram/components/questionTypes/basic/ConstantAggregate.vue index 4b992157..cfc7a198 100644 --- a/src/views/DataAnalyse/diagram/components/questionTypes/basic/ConstantAggregate.vue +++ b/src/views/DataAnalyse/diagram/components/questionTypes/basic/ConstantAggregate.vue @@ -124,16 +124,54 @@ export default defineComponent({ (data) => { tableInstance.value.columns = data.head columns.value = data.head.map((item, index) => { - return { - ...item, - title: () => , - dataIndex: item.key, - key: item.key, - slots: { customRender: item.key }, - width: 100, - // align: "center", - fixed: index === 0 ? "left" : null, - }; + if(item.key === 'avg'){ + return { + ...item, + title: () => , + name: item.title, + dataIndex: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? 'left' : null, + sorter: (a, b) => { return a.avg > b.avg? 1 : -1 }, + }; + }else if(item.key === 'min'){ + return { + ...item, + title: () => , + name: item.title, + dataIndex: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? 'left' : null, + sorter: (a, b) => { return a.min > b.min? 1 : -1 }, + }; + }else if(item.key === 'max'){ + return { + ...item, + title: () => , + name: item.title, + dataIndex: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? 'left' : null, + sorter: (a, b) => { return a.max > b.max? 1 : -1 }, + }; + }else { + return { + ...item, + title: () => , + dataIndex: item.key, + key: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? "left" : null, + }; + } }); tableSource.value = getTableData(data.head, data.option); diff --git a/src/views/DataAnalyse/diagram/components/questionTypes/quick/CascaderType.vue b/src/views/DataAnalyse/diagram/components/questionTypes/quick/CascaderType.vue index 467e7311..284dbe2a 100644 --- a/src/views/DataAnalyse/diagram/components/questionTypes/quick/CascaderType.vue +++ b/src/views/DataAnalyse/diagram/components/questionTypes/quick/CascaderType.vue @@ -137,6 +137,18 @@ watch( // align: "center", fixed: index === 0 ? "left" : null, }; + }else if (item.key === 'number') { + return { + ...item, + title: () => , + dataIndex: item.key, + key: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? "left" : null, + sorter: (a, b) => { return a.number > b.number? 1 : -1 }, + }; }else{ return { ...item, diff --git a/src/views/DataAnalyse/diagram/components/questionTypes/quick/Institution.vue b/src/views/DataAnalyse/diagram/components/questionTypes/quick/Institution.vue index b5c9169c..a78dcf07 100644 --- a/src/views/DataAnalyse/diagram/components/questionTypes/quick/Institution.vue +++ b/src/views/DataAnalyse/diagram/components/questionTypes/quick/Institution.vue @@ -140,6 +140,18 @@ watch( // align: "center", fixed: index === 0 ? "left" : null, }; + }else if (item.key === 'number') { + return { + ...item, + title: () => , + dataIndex: item.key, + key: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? "left" : null, + sorter: (a, b) => { return a.number > b.number? 1 : -1 }, + }; }else{ return { ...item, diff --git a/src/views/DataAnalyse/diagram/components/questionTypes/quick/Major.vue b/src/views/DataAnalyse/diagram/components/questionTypes/quick/Major.vue index 2cc301f2..b02b09ef 100644 --- a/src/views/DataAnalyse/diagram/components/questionTypes/quick/Major.vue +++ b/src/views/DataAnalyse/diagram/components/questionTypes/quick/Major.vue @@ -132,6 +132,18 @@ watch( // align: "center", fixed: index === 0 ? "left" : null, }; + }else if (item.key === 'number') { + return { + ...item, + title: () => , + dataIndex: item.key, + key: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? "left" : null, + sorter: (a, b) => { return a.number > b.number? 1 : -1 }, + }; }else{ return { ...item, diff --git a/src/views/DataAnalyse/diagram/components/questionTypes/quick/ProvinceCityType.vue b/src/views/DataAnalyse/diagram/components/questionTypes/quick/ProvinceCityType.vue index 97ff601e..8982e469 100644 --- a/src/views/DataAnalyse/diagram/components/questionTypes/quick/ProvinceCityType.vue +++ b/src/views/DataAnalyse/diagram/components/questionTypes/quick/ProvinceCityType.vue @@ -140,6 +140,18 @@ watch( // align: "center", fixed: index === 0 ? "left" : null, }; + }else if (item.key === 'number') { + return { + ...item, + title: () => , + dataIndex: item.key, + key: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? "left" : null, + sorter: (a, b) => { return a.number > b.number? 1 : -1 }, + }; }else{ return { ...item, diff --git a/src/views/DataAnalyse/diagram/components/questionTypes/quick/ProvinceDistrictType.vue b/src/views/DataAnalyse/diagram/components/questionTypes/quick/ProvinceDistrictType.vue index 356bf35e..877e49cc 100644 --- a/src/views/DataAnalyse/diagram/components/questionTypes/quick/ProvinceDistrictType.vue +++ b/src/views/DataAnalyse/diagram/components/questionTypes/quick/ProvinceDistrictType.vue @@ -140,6 +140,18 @@ watch( // align: "center", fixed: index === 0 ? "left" : null, }; + }else if (item.key === 'number') { + return { + ...item, + title: () => , + dataIndex: item.key, + key: item.key, + slots: { customRender: item.key }, + width: 100, + // align: "center", + fixed: index === 0 ? "left" : null, + sorter: (a, b) => { return a.number > b.number? 1 : -1 }, + }; }else{ return { ...item,