From 7610df9f2155c82f4a5f554b9f4c7f0446be6261 Mon Sep 17 00:00:00 2001
From: yuxc <653031404@qq.com>
Date: 星期四, 14 十二月 2023 15:44:47 +0800
Subject: [PATCH] 1、图形统计用户新增图形保存功能
---
Source/UBCS-WEB/src/views/statistic/statisticPage.vue | 142 ++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 133 insertions(+), 9 deletions(-)
diff --git a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
index 415865a..093ef55 100644
--- a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
+++ b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
@@ -2,20 +2,61 @@
<!-- 鏂板鍙充晶鎸夐挳-->
<div>
<div style=" display: flex; justify-content: flex-end;">
- <el-button plain type="primary" @click="addHandler">鏂板</el-button>
+ <el-button plain type="primary" @click="addHandler">閰嶇疆</el-button>
</div>
<!-- 鏂板瀵硅瘽妗�-->
<el-dialog
:visible.sync="addVisible"
append-to-body
- title="鏂板鏁版嵁缁熻鍒嗘瀽"
+ class="avue-dialog avue-dialog--top"
+ title="閰嶇疆鏁版嵁缁熻鍒嗘瀽"
+ top="-50px"
>
+ <el-table
+ ref="table"
+ :data="tableData"
+ border
+ style="width: 100%"
+ @selection-change="selectChange"
+ >
+ <el-table-column
+ type="selection"
+ width="55">
+ </el-table-column>
+ <el-table-column
+ align="center"
+ label="涓绘暟鎹簱鍚�"
+ prop="menuName">
+ </el-table-column>
+ <el-table-column
+ align="center"
+ label="绫诲瀷"
+ prop="codeType">
+ <template slot-scope="{ row }">
+ <el-select v-model="row.codeType" placeholder="璇烽�夋嫨鍥捐〃绫诲瀷">
+ <el-option label="鎶樼嚎鍥�" value="0"></el-option>
+ <el-option label="楗肩姸鍥�" value="1"></el-option>
+ <el-option label="鏌辩姸鍥�" value="2"></el-option>
+ <el-option label="鍫嗗彔鎶樼嚎鍥�" value="3"></el-option>
+ </el-select>
+ </template>
+ </el-table-column>
+ </el-table>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="escHandler">鍙� 娑�</el-button>
+ <el-button type="primary" @click="addSaveHandler">淇濆瓨</el-button>
+ </span>
</el-dialog>
<!-- echarts缁勪欢-->
- <div>
- <lineChart></lineChart>
- <pieChart></pieChart>
- <ColumnarChart></ColumnarChart>
+ <div style="margin-top: 15px;padding-bottom: 35px">
+ <lineChart v-for="(item,index) in lineList" :key="index" :chartName="item.menuName"
+ :lineData="item.menuData"></lineChart>
+ <pieChart v-for="(item,index) in pieList" :key="index" :chartName="item.menuName"
+ :pieData="item.menuData"></pieChart>
+ <ColumnarChart v-for="(item,index) in columnarList" :key="index" :chartName="item.menuName"
+ :columnarData="item.menuData"></ColumnarChart>
+ <mixCart v-for="(item,index) in mixList" :key="index" :chartName="item.menuName"
+ :mixData="item.menuData"></mixCart>
</div>
</div>
</template>
@@ -24,27 +65,110 @@
import lineChart from "../../components/StatisticsComponent/lineChart"
import pieChart from "../../components/StatisticsComponent/pieChart"
import ColumnarChart from "../../components/StatisticsComponent/ColumnarChart"
+import mixCart from "../../components/StatisticsComponent/mixCart"
+import {getStatisticAnalysis} from "@/api/statistic/chart"
+import {getList} from "@/api/system/statistic";
export default {
components: {
lineChart,
pieChart,
- ColumnarChart
+ ColumnarChart,
+ mixCart
},
name: "statisticPage",
data() {
return {
+ menuList: [],
+ dataKeyList: [],
addVisible: false,
+ chartName: "",
+ lineList: [],
+ pieList: [],
+ columnarList: [],
+ mixList: [],
+ selectData: [],
+ tableData: []
}
},
+ created() {
+ this.getMasterList()
+ },
methods: {
+ getMasterList() {
+ const userId = localStorage.getItem('userId');
+ getList({userId: userId}).then(res => {
+ this.tableData = res.data.data;
+ })
+ },
+ //鏂板
addHandler() {
this.addVisible = true;
- }
+ },
+ //鍙栨秷
+ escHandler() {
+ this.addVisible = false;
+ },
+ //淇濆瓨
+ addSaveHandler() {
+ if (this.selectData.length <= 0) {
+ this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
+ return;
+ }
+ let codeStatus = this.selectData.every(key => key.codeType)
+ if (!codeStatus) {
+ this.$message.warning("璇锋鏌ュ凡鍕鹃�夋暟鎹被鍨嬫槸鍚︿负绌猴紒");
+ return;
+ }
+
+ this.dataKeyList = this.selectData.map(obj => obj.code)
+ const btmName = this.dataKeyList.join(",");
+ if (btmName) {
+ getStatisticAnalysis({btmNames: btmName}).then(res => {
+ this.menuList = res.data.data;
+ this.nextSave();
+ this.$message.success('淇濆瓨鎴愬姛')
+ });
+ } else {
+ this.$message.warning('璇烽�夋嫨鏁版嵁锛�')
+ }
+ },
+ nextSave() {
+ const typeList = {
+ "0": "lineList",
+ "1": "pieList",
+ "2": "columnarList",
+ "3": "mixList"
+ };
+
+ let hasValidData = false; // 娣诲姞涓�涓爣蹇楁潵璁板綍鏄惁鏈夋湁鏁堢殑閫夋嫨鏁版嵁
+
+ this.selectData.forEach((item, index) => {
+ item.menuData = this.menuList[index].menuData;
+ const dataKey = typeList[item.codeType];
+ if (dataKey) {
+ this[dataKey].push(item);
+ this[dataKey].forEach(res=>{
+ console.log('this[dataKey]',this[dataKey])
+ console.log('res',res)
+ })
+ hasValidData = true;
+ }
+ });
+
+ if (hasValidData) {
+ // this.$refs.table.clearSelection();
+ this.addVisible = false;
+ }
+ },
+ //琛ㄦ牸澶氶��
+ selectChange(selection) {
+ this.selectData = selection;
+ },
}
}
</script>
-<style scoped>
+<style lang="scss" scoped>
</style>
--
Gitblit v1.10.0