From c842794d0d2a06b65711f51065b6805aa8b84985 Mon Sep 17 00:00:00 2001 From: aixianling Date: Mon, 9 Sep 2024 17:34:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=B8=A4=E4=B8=AA=E6=9F=B1?= =?UTF-8?q?=E7=8A=B6=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/biaopin/dv/weiyang/AppDvWeiyang.vue | 161 ++++++++++++++---- project/biaopin/dv/weiyang/comps/navTabs.vue | 5 + .../biaopin/dv/weiyang/comps/subHeader.vue | 1 - ui/packages/tools/AiEchart.vue | 27 ++- 4 files changed, 143 insertions(+), 51 deletions(-) diff --git a/project/biaopin/dv/weiyang/AppDvWeiyang.vue b/project/biaopin/dv/weiyang/AppDvWeiyang.vue index a6429054..7c95fb4d 100644 --- a/project/biaopin/dv/weiyang/AppDvWeiyang.vue +++ b/project/biaopin/dv/weiyang/AppDvWeiyang.vue @@ -8,6 +8,50 @@ import ChargingPercent from "./comps/chargingPercent.vue"; import AiEchart from "dui/packages/tools/AiEchart.vue"; import NavTabs from "./comps/navTabs.vue"; +const handlePercent = v => parseFloat(isNaN(v) ? 0 : v.toFixed(2)) +const calcComparePercent = (v = 1, target = 1) => { + const value = (v - target) / target * 100 + return handlePercent(value) +} +const hide = {show: false} +const aiTrend = { + series: { + type: "bar", barWidth: 12, itemStyle: { + color: { + type: "linear", x: 0, y: 0, x2: 0, y2: 1, colorStops: [ + {offset: 0, color: "#00EFFF"}, + {offset: 1, color: "#00527D"}, + ] + } + }, encode: {x: 'd', y: 'c'} + }, + yAxis: {type: "value", axisLabel: hide, axisLine: hide, splitLine: hide}, + xAxis: {type: "category", axisLabel: hide, axisLine: {itemStyle: {color: 'rgba(179,223,255,0.4)'}}}, + legend: {show: false}, + grid: {left: 0, right: 0, bottom: 1, top: 0, containLabel: true}, +} +const workChain = { + series: Array(5).fill({type: "bar"}), + yAxis: {type: "category"}, + xAxis: {show: false, type: "value"} +} +const residentDistribution = { + series: { + type: "bar", barWidth: 12, itemStyle: { + color: { + type: "linear", x: 0, y: 0, x2: 0, y2: 1, colorStops: [ + {offset: 0, color: "#00EFFF"}, + {offset: 1, color: "#00527D"}, + ] + } + }, + encode: {x: 'name', y: 'c'} + }, + yAxis: {type: "value", axisLine: {show: false}, splitLine: {lineStyle: {type: 'dashed', color: 'rgba(61,82,102,0.65)'}}}, + xAxis: {type: "category", axisTick: {show: false}, axisLabel: {rotate: 45}}, + grid: {left: 12, right: 12, top: 20, bottom: 0, containLabel: true}, + legend: {show: false}, +} export default { name: "AppDvWeiyang", components: {NavTabs, AiEchart, ChargingPercent, ValueUnit, IconSmallPanel, IconStaPanel, SubHeader}, @@ -19,7 +63,10 @@ export default { }, data() { return { - areaId: "" + areaId: "", + integralOrderType: "", + sta: {}, + chartData: {} } }, computed: { @@ -27,16 +74,16 @@ export default { currentAreaId: v => v.areaId || v.user.info.areaId, isLastAreaLevel: v => !/0{3}$/.test(v.currentAreaId), areaSta: v => [ - {label: "社区数", icon: "https://cdn.sinoecare.com/i/2024/09/04/66d80346ec1ea.png", value: 0, unit: "个"}, - {label: "小区数", icon: "https://cdn.sinoecare.com/i/2024/09/04/66d7fd4c0445d.png", value: 0, unit: "个"}, - {label: "村数", icon: "https://cdn.sinoecare.com/i/2024/09/04/66d7fd4d28f1b.png", value: 0, unit: "个"}, - ], + {label: "社区数", icon: "66d80346ec1ea", prop: "communityCount", unit: "个"}, + {label: "小区数", icon: "66d7fd4c0445d", prop: "residentialQuartersCount", unit: "个"}, + {label: "村数", icon: "66d7fd4d28f1b", prop: "villageCount", unit: "个"}, + ].map(e => ({...e, label: v.getLabel(e.prop), value: v.sta[e.prop] || 0, icon: `https://cdn.sinoecare.com/i/2024/09/04/${e.icon}.png`})), workorderSta: v => [ - {label: "已处理", value: 0, unit: "个"}, - {label: "办理中", value: 0, unit: "个"}, - {label: "待受理", value: 0, unit: "个"}, - {label: "延期", value: 0, unit: "个", isRed: !0}, - ], + {label: "已处理", prop: 'workOrderCountFinishNowMonth', unit: "个"}, + {label: "办理中", prop: 'workOrderCountProcessingNowMonth', unit: "个"}, + {label: "待受理", prop: 'workOrderCountPendingNowMonth', unit: "个"}, + {label: "延期", prop: 'workOrderCountExtensionNowMonth', unit: "个", isRed: !0}, + ].map(e => ({...e, label: v.getLabel(e.prop), value: v.sta[e.prop] || 0})), workorderTable: v => ({ header: ['时间', '状态', '事件描述'], headerBGC: '#21b4fd1a', @@ -44,29 +91,70 @@ export default { evenRowBGC: "transparent", data: [] }), - tabs: v => [ - {label: "楼栋长", value: ""}, - {label: "治安协理员", value: ""}, - {label: "业委会", value: ""}, - {label: "网格员", value: ""}, - {label: "第三方机构", value: ""}, - ] + tabs: v => v.$dict.getDict("wyIntegralOrderType").map(e => { + return { + label: e.dictName, + value: e.dictValue + } + }), + monthOnMonth: v => calcComparePercent(v.sta.residentCountLastMonth, v.sta.residentCount), + yearOnYear: v => calcComparePercent(v.sta.residentCountLastYear, v.sta.residentCount), + workorderFinishedPercent: v => handlePercent(v.sta.workOrderCountFinish / v.sta.workOrderCount * 100), + chart: v => { + return {aiTrend, workChain, residentDistribution} + }, }, methods: { getData() { + const {instance: http, currentAreaId: areaId, integralOrderType} = this + return Promise.all([ + http.post("/app/wyDiy/pvr", null, {params: {areaId}}).then(res => { + if (res?.data) { + this.sta = res.data + } + }), + http.post("/app/wyDiy/aiTrend", null, {params: {areaId}}).then(res => { + if (res?.data) { + this.$set(this.chartData, "aiTrend", res.data.map(e => [e.d, e.c])) + } + }), + http.post("/app/wyDiy/integralOrder", null, {params: {areaId, type: integralOrderType}}).then(res => { + if (res?.data) { + } + }), + http.post("/app/wyDiy/residentDistribution", null, {params: {areaId}}).then(res => { + if (res?.data) { + this.$set(this.chartData, "residentDistribution", res.data) + } + }), + http.post("/app/wyDiy/spDistribution", null, {params: {areaId}}).then(res => { + if (res?.data) { + + } + }), + http.post("/app/wyDiy/workChain", null, {params: {areaId}}).then(res => { + if (res?.data) { + + } + }), + http.post("/app/wyDiy/wotDistribution", null, {params: {areaId}}).then(res => { + if (res?.data) { + + } + }), + ]) }, getLabel(key) { return this.dict.getLabel("wyBasicCount", key) || key } }, created() { - this.dict.load("wyBasicCount") + this.dict.load("wyBasicCount", "wyIntegralOrderType") this.getData() } } -