From 7788f5be065a27dca0ea7f8ec1d6505b5bf72508 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Mon, 28 Oct 2024 10:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/temporaryPlan.js | 46 ++++ src/views/dashboard/index.vue | 77 +++--- src/views/system/statictis.vue | 229 ++++++++++++++++++ .../system/workerComponents/department.vue | 14 +- .../system/workerComponents/signStatic.vue | 26 +- src/views/system/workerComponents/total.vue | 28 ++- src/views/system/workerComponents/type.vue | 9 +- 7 files changed, 383 insertions(+), 46 deletions(-) create mode 100644 src/api/system/temporaryPlan.js create mode 100644 src/views/system/statictis.vue diff --git a/src/api/system/temporaryPlan.js b/src/api/system/temporaryPlan.js new file mode 100644 index 0000000..0924b71 --- /dev/null +++ b/src/api/system/temporaryPlan.js @@ -0,0 +1,46 @@ +import request from '@/utils/request' + +export function index (params,noloading=true) { + return request({ + method: "get", + url: "/api/admin/temporary-plan/index", + params, + noloading + }) +} + +export function show (params,noloading=true) { + return request({ + method: "get", + url: "/api/admin/temporary-plan/show", + params, + noloading + }) +} + +export function save (data,noloading=true) { + return request({ + method: "post", + url: "/api/admin/temporary-plan/save", + data, + noloading + }) +} + +export function destroy(params,noloading=true) { + return request({ + method: "get", + url: "/api/admin/temporary-plan/destroy", + params, + noloading + }) +} + +export function statistic(params,noloading=false) { + return request({ + method: "get", + url: "/api/admin/temporary-plan/statistic", + params, + noloading + }) +} diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 7c44975..1e2e122 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -312,8 +312,9 @@ import Pagination from "@/components/Pagination"; import PieChart from "./components/PieChart.vue"; import { adminDepartmentList } from '@/api/system/department'; import { adminUserList, getInfo } from '@/api/user'; -import { getNotice, readNotice, statistic, carry } from "@/api/dashboard/notice"; -import { parseTime, moneyFormatter } from '@/utils'; +import { getNotice, readNotice, carry } from "@/api/dashboard/notice"; +import { statistic } from '@/api/system/temporaryPlan' +import { parseTime, moneyFormatter, deepCopy } from '@/utils'; import { Message } from "element-ui"; import budgetStatic from '@/views/dashboard/components/budgetStatic.vue' import lineChart from '@/views/dashboard/components/LineChart.vue' @@ -368,7 +369,7 @@ export default { { label: "科室", minWidth: 180, - prop: "plan_department.name", + prop: "department.name", sortable: false, align: "left", fixed: "left", @@ -380,9 +381,9 @@ export default { align: "left", fixed: "right", customFn: (row) => { - let m2 = row?.money_total_2; - let m1 = row?.money_total_1; - let m3 = row?.use_money_total; + let m2 = row?.money_total_2 ? Number(row?.money_total_2) : 0; + let m1 = row?.money_total_1 ? Number(row?.money_total_1) : 0; + let m3 = row?.use_money_total ? Number(row?.use_money_total) : 0; let per = 0; if (m2 != 0) { @@ -404,7 +405,7 @@ export default { sortable: false, prop: "money_total_1", formatter: (cell, data, value) => { - return moneyFormatter(value); + return moneyFormatter(value ? Number(value) : 0); }, }, { @@ -414,7 +415,7 @@ export default { sortable: false, prop: "money_total_2", formatter: (cell, data, value) => { - return moneyFormatter(value); + return moneyFormatter(value ? Number(value) : 0); }, }, { @@ -424,7 +425,7 @@ export default { sortable: false, prop: "use_money_total", formatter: (cell, data, value) => { - return moneyFormatter(value); + return moneyFormatter(value ? Number(value) : 0); }, }, ], @@ -432,7 +433,7 @@ export default { { label: "预算类别", width: 100, - prop: "type_text", + prop: "type_detail.value", sortable: false, fixed: "left", }, @@ -443,9 +444,9 @@ export default { align: "left", fixed: "right", customFn: (row) => { - let m2 = row.money_total_2; - let m1 = row.money_total_1; - let m3 = row.use_money_total; + let m2 = row.money_total_2 ? Number(row.money_total_2) : 0; + let m1 = row.money_total_1 ? Number(row.money_total_1) : 0; + let m3 = row.use_money_total ? Number(row.use_money_total) : 0; let per = 0; if (m2 != 0) { @@ -467,7 +468,7 @@ export default { sortable: false, prop: "money_total_1", formatter: (cell, data, value) => { - return moneyFormatter(value); + return moneyFormatter(value ? Number(value) : 0); }, }, { @@ -477,7 +478,7 @@ export default { sortable: false, prop: "money_total_2", formatter: (cell, data, value) => { - return moneyFormatter(value); + return moneyFormatter(value ? Number(value) : 0); }, }, { @@ -487,7 +488,7 @@ export default { sortable: false, prop: "use_money_total", formatter: (cell, data, value) => { - return moneyFormatter(value); + return moneyFormatter(value ? Number(value) : 0); }, }, ], @@ -783,18 +784,38 @@ export default { this.getStatistic(); }, async getStatistic() { - const res = await statistic(this.select); - console.log(res); - this.statistic = res; - let m2 = res.progress.money_total_2; - let m1 = res.progress.money_total_1; - var user_m = res.progress.use_money_total; - var m3=m1-user_m - if (m2 != 0) { - m3=m2-user_m; - } else if (m1 != 0) { - m3=m1-user_m; - } + const res = await statistic(this.select); + console.log(res); + function handleDataStructure(data) { + let cData = deepCopy(data) + cData.progress.money_total_1 = isNaN(Number(cData.progress.plan_money)) ? 0 : Number(cData.progress.plan_money) + cData.progress.money_total_2 = isNaN(Number(cData.progress.plan_money)) ? 0 : Number(cData.progress.plan_money) + cData.progress.use_money_total = isNaN(Number(cData.progress.use_money)) ? 0 : Number(cData.progress.use_money) + + cData.departmentList = cData.departmentList.map(i => ({ + ...i, + money_total_1: isNaN(Number(i.plan_money)) ? 0 : Number(i.plan_money), + money_total_2: isNaN(Number(i.plan_money)) ? 0 : Number(i.plan_money), + use_money_total: isNaN(Number(i.use_money)) ? 0 : Number(i.use_money) + })) + cData.typeList = cData.typeList.map(i => ({ + ...i, + money_total_1: isNaN(Number(i.plan_money)) ? 0 : Number(i.plan_money), + money_total_2: isNaN(Number(i.plan_money)) ? 0 : Number(i.plan_money), + use_money_total: isNaN(Number(i.use_money)) ? 0 : Number(i.use_money) + })) + return cData + } + this.statistic = handleDataStructure(res); + let m2 = this.statistic.progress.money_total_2; + let m1 = this.statistic.progress.money_total_1; + var user_m = this.statistic.progress.use_money_total; + var m3 = m1-user_m + if (m2 != 0) { + m3=m2-user_m; + } else if (m1 != 0) { + m3=m1-user_m; + } this.rptChartData = { xArr: ["预算未执行金额", "预算已执行金额"], radiusArr: "50%", diff --git a/src/views/system/statictis.vue b/src/views/system/statictis.vue new file mode 100644 index 0000000..9cbfefe --- /dev/null +++ b/src/views/system/statictis.vue @@ -0,0 +1,229 @@ + + + + + + + + + + 查询 + 新增 + + + + + + + + + + + + + + + + + + + 编辑 + 删除 + + + + + + { + select.page = e; + getList() + }" + :current-page="select.page" + :page-size="select.page_size" + background + layout="prev, pager, next" :total="total"> + + + + + + + + + + form.year = e"> + + + + + + + + (form.type = e[e.length - 1] || '')" + /> + + + + + + + + + + + + + + + + + diff --git a/src/views/system/workerComponents/department.vue b/src/views/system/workerComponents/department.vue index 7900c74..5a24844 100644 --- a/src/views/system/workerComponents/department.vue +++ b/src/views/system/workerComponents/department.vue @@ -86,9 +86,9 @@ export default { minWidth: 160, fixed: "right", render: (h, { row }) => { - let m2 = row?.money_total_2 || 0; - let m1 = row?.money_total_1 || 0; - let m3 = row?.use_money_total || 0; + let m2 = row?.money_total_2 ? Number(row?.money_total_2) : 0; + let m1 = row?.money_total_1 ? Number(row?.money_total_1) : 0; + let m3 = row?.use_money_total ? Number(row?.use_money_total) : 0; let per = 0; if (m2 != 0) { @@ -146,7 +146,7 @@ export default { show: true }, xAxis: { - data: this.departmentList.map((item) => item.plan_department.name), + data: this.departmentList.map((item) => item.department.name), }, yAxis: { axisLabel: { @@ -188,9 +188,9 @@ export default { position: "top", formatter: (params) => { console.log(params) - let m2 = this.departmentList[params.dataIndex]?.money_total_2 || 0; - let m1 = this.departmentList[params.dataIndex]?.money_total_1 || 0; - let m3 = this.departmentList[params.dataIndex]?.use_money_total || 0; + let m2 = this.departmentList[params.dataIndex]?.money_total_2 ? Number(this.departmentList[params.dataIndex]?.money_total_2) : 0; + let m1 = this.departmentList[params.dataIndex]?.money_total_1 ? Number(this.departmentList[params.dataIndex]?.money_total_1) : 0; + let m3 = this.departmentList[params.dataIndex]?.use_money_total ? Number(this.departmentList[params.dataIndex]?.use_money_total) : 0; let per = 0; if (m2 != 0) { diff --git a/src/views/system/workerComponents/signStatic.vue b/src/views/system/workerComponents/signStatic.vue index 5690ee1..cfae794 100644 --- a/src/views/system/workerComponents/signStatic.vue +++ b/src/views/system/workerComponents/signStatic.vue @@ -41,11 +41,11 @@