From 4aef25f2a55460040a72a73b8ec0cbb6bec0691d Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 18 十月 2023 16:45:56 +0800
Subject: [PATCH] 首页-主数据动态统计
---
Source/UBCS-WEB/src/api/system/statistic.js | 16 +++
Source/UBCS-WEB/src/views/wel/Statistic.vue | 196 +++++++++++++++++++++++++++++++------------------
Source/UBCS-WEB/src/views/docking/info.vue | 1
Source/UBCS-WEB/src/views/system/user.vue | 2
4 files changed, 139 insertions(+), 76 deletions(-)
diff --git a/Source/UBCS-WEB/src/api/system/statistic.js b/Source/UBCS-WEB/src/api/system/statistic.js
index fc60966..b01e586 100644
--- a/Source/UBCS-WEB/src/api/system/statistic.js
+++ b/Source/UBCS-WEB/src/api/system/statistic.js
@@ -1,11 +1,23 @@
import request from '@/router/axios';
-export const getList = (url, params) => {
+//娓叉煋
+export const getList = (params) => {
return request({
- url: url,
+ url: '/api/ubcs-code/mdmCount/getMdmCounts',
method: 'get',
params: {
...params
}
})
}
+
+export const save = (userId, mdmNameList) => {
+ return request({
+ url: '/api/ubcs-system/mdmCountConfig/save',
+ method: 'post',
+ data: {
+ userId,
+ mdmNameList
+ }
+ })
+}
diff --git a/Source/UBCS-WEB/src/views/docking/info.vue b/Source/UBCS-WEB/src/views/docking/info.vue
index eaf994b..02ba409 100644
--- a/Source/UBCS-WEB/src/views/docking/info.vue
+++ b/Source/UBCS-WEB/src/views/docking/info.vue
@@ -110,7 +110,6 @@
addBtn: false,
editBtn: false,
delBtn: false,
- columnBtn: false,
column: [ {
label: '鏄惁鍚敤',
prop: 'usedFlag',
diff --git a/Source/UBCS-WEB/src/views/system/user.vue b/Source/UBCS-WEB/src/views/system/user.vue
index 2320aff..8d6a5cf 100644
--- a/Source/UBCS-WEB/src/views/system/user.vue
+++ b/Source/UBCS-WEB/src/views/system/user.vue
@@ -742,7 +742,7 @@
}
},
created() {
- updateUserStatus({userid:'1702600796324032513',status:true}).then(res=>{
+ updateUserStatus({userid:'1702600796147871745',status:true}).then(res=>{
console.log(res)
})
this.selecload()
diff --git a/Source/UBCS-WEB/src/views/wel/Statistic.vue b/Source/UBCS-WEB/src/views/wel/Statistic.vue
index 918d584..dbac618 100644
--- a/Source/UBCS-WEB/src/views/wel/Statistic.vue
+++ b/Source/UBCS-WEB/src/views/wel/Statistic.vue
@@ -1,106 +1,158 @@
<template>
<div>
- <avue-data-box :option="option" :animation="true"></avue-data-box>
+ <div style="display: flex; justify-content: flex-end;margin-bottom: 10px">
+ <el-button icon="el-icon-more" type="primary" plain size="small" @click="MoreHandler">鏇村</el-button>
+ </div>
+ <avue-data-box :option="option" :animation="true">
+ <template>
+ <el-switch></el-switch>
+ </template>
+ </avue-data-box>
+ <el-dialog title="涓绘暟鎹厤缃�" :visible.sync="dialogTableVisible" append-to-body class="avue-dialog avue-dialog--top" top="0">
+ <avue-crud ref="crud"
+ v-model="Crud.form"
+ :data="Crud.data"
+ @selection-change="selectionChange"
+ :option="Crud.option">
+ </avue-crud>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="primary" plain @click="SaveHandler">淇濆瓨</el-button>
+ </div>
+ </el-dialog>
</div>
</template>
<script>
import {validatenull} from "@/util/validate";
-import {getList} from "@/api/system/statistic";
+import {getList,save} from "@/api/system/statistic";
import {flowRoute} from "@/util/flow";
export default {
name: "Statistic",
data(){
return {
+ Crud:{
+ form:'',
+ data:[],
+ option:{
+ calcHeight: 80,
+ tip: false,
+ searchShow: false,
+ addBtn:false,
+ columnBtn:false,
+ header:false,
+ menu:false,
+ border: true,
+ index: true,
+ selection: true,
+ column:[
+ {
+ label: "涓绘暟鎹悕绉�",
+ prop: "menuName",
+ },
+ {
+ label: "寰呭姙鏁版嵁",
+ prop: "mdmCount",
+ },
+ {
+ label: "icon鍥炬爣",
+ prop: "icon",
+ overHidden:true,
+ },
+ {
+ label: "璺敱鍦板潃",
+ prop: "menuRoute",
+ overHidden:true,
+ },
+ {
+ label: "code",
+ prop: "code",
+ overHidden:true,
+ },
+ ]
+ }
+ },
userId:'',
+ hexColor:'',
+ newData:[],
+ SelectRow:[],
countByServer:true,
+ dialogTableVisible:false,
// listMyTask:[]
option: {
span:6,
- data: [
- {
- click: this.handleItemAClick,
- title: '鐗╁搧涓绘暟鎹�',
- count: 1723,
- icon: 'iconfont iconicon_doc',
- color: 'rgb(49, 180, 141)',
- uiUrl: "/MasterData/items?id=wupin@name=鐗╁搧涓绘暟鎹�",
- countUrl:'priceIndexController/countNeedConfirmPlan'
- },
- {
- click: this.handleItemBClick,
- title: '浜哄憳涓绘暟鎹�',
- count: 1225,
- icon: 'iconfont iconicon_dispose',
- color: 'rgb(56, 161, 242)',
- uiUrl:'/MasterData/items?id=renyuan@@name=浜哄憳涓绘暟鎹�',
- countUrl:'priceIndexController/countPricingPlan'
- },
- {
- click: this.handleItemCClick,
- title: 'Part',
- count: 523,
- icon: 'el-icon-setting',
- color: 'rgb(117, 56, 199)',
- uiUrl:'/MasterData/items?id=10@@name=Part',
- countUrl:'priceIndexController/countNeedFeedbackPlan'
- },
- {
- click: this.handleItemDClick,
- title: '渚涘簲鍟嗕富鏁版嵁',
- count: 0,
- icon: 'iconfont iconicon_work',
- color: 'rgb(255, 102, 51)',
- uiUrl:'/MasterData/items?id=gongyingshang@@name=渚涘簲鍟嗕富鏁版嵁',
- countUrl:'priceIndexController/countMyUnCreatePricePlan'
- },
- ]
+ data: []
},
}
},
created() {
- this.userId=sessionStorage.userId
- getList('/api/ubcs-code/mdmCount/getMdmCounts',{id:this.userId}).then(res=>{
- console.log(res)
- })
+ this.MasterGetList()
},
computed(){
},
methods: {
- handleItemAClick() {
- this.$router.push({ path: "/MasterData/items?id=wupin@name=鐗╁搧涓绘暟鎹�"} );
+ selectionChange(row){
+ // console.log(row)
+ this.SelectRow=row;
},
- handleItemBClick() {
- this.$router.push({ path: '/MasterData/items?id=renyuan@@name=浜哄憳涓绘暟鎹�'} );
+ SaveHandler(){
+ if(this.SelectRow.length <= 0){
+ this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹紒')
+ return
+ }
+ let mdmNameList=[];
+ mdmNameList=this.SelectRow.map(item=>{return item.code})
+ console.log(mdmNameList)
+ save(this.userId,mdmNameList).then(res=>{
+ console.log(res)
+ if(res.data.code === 200){
+ this.$message.success('淇濆瓨鎴愬姛锛�')
+ this.option.data=[];
+ this.MasterGetList()
+ this.dialogTableVisible=false;
+ }
+ })
},
- handleItemCClick() {
- this.$router.push({ path: '/MasterData/items?id=10@@name=Part'} );
+ MoreHandler(){
+ this.dialogTableVisible=true
},
- handleItemDClick() {
- this.$router.push({ path: '/MasterData/items?id=gongyingshang@@name=渚涘簲鍟嗕富鏁版嵁'} );
+ // 闅忔満鑹�
+ randomColor() {
+ const r = Math.floor(Math.random() * 256); // 鐢熸垚 0 鍒� 255 涔嬮棿鐨勯殢鏈烘暟
+ const g = Math.floor(Math.random() * 256);
+ const b = Math.floor(Math.random() * 256);
+ // 灏� RGB 鍊艰浆鎹负鍗佸叚杩涘埗琛ㄧず褰㈠紡
+ const hexColor = "#" + r.toString(16).padStart(2, '0') + g.toString(16).padStart(2, '0') + b.toString(16).padStart(2, '0');
+ return hexColor;
},
- // getList() {
- // // debugger
- // Object.values(this.option.data).map(record => {
- // record.count = record.count || 0;
- // if (!this.countByServer) {
- // // 鏄墠绔煡璇�
- // getList(record.countUrl, {}).then(res => {
- // // console.log('res',res)
- // if (res.data.data.success) {
- // record.count = res.data.data.obj;
- // } else {
- // record.count = 0;
- // }
- // });
- // }
- // return {
- // ...record
- // };
- // });
- // },
+ MasterGetList() {
+ this.userId = localStorage.getItem('userId');
+ getList({ userId: this.userId }).then(res => {
+ res.data.data.filter(item => {
+ if (item.isDefault === 1) {
+ this.hexColor = this.randomColor();
+ this.option.data.push({
+ click: (item) => {
+ this.$router.push({ path: item.uiUrl });
+ },
+ title: item.menuName,
+ count: parseInt(item.mdmCount),
+ icon: item.icon,
+ code: item.code,
+ isDefault: item.isDefault,
+ color:this.hexColor,
+ uiUrl: item.menuRoute,
+ });
+ } else if (item.isDefault === 0) {
+ this.newData.push(item);
+ this.Crud.data=this.newData;
+ }
+ });
+ // console.log(this.option.data);
+ // console.log(this.newData);
+ });
+ }
}
}
</script>
--
Gitblit v1.9.3