Compare commits

...

2 Commits

8 changed files with 390 additions and 365 deletions

View File

@ -1,7 +1,7 @@
// /resource/getByDept // /resource/getByDept
import http from '@/utils/request' import http from '@/utils/request'
function Request({ function Request ({
methods, url, data, success, fali methods, url, data, success, fali
}) { }) {
const _key = methods == 'get' ? 'params' : 'data' const _key = methods == 'get' ? 'params' : 'data'
@ -15,7 +15,7 @@ function Request({
}) })
}) })
} }
function RequestPost({ function RequestPost ({
methods, url, data, success, fali methods, url, data, success, fali
}) { }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -114,7 +114,7 @@ export const getResourceByDept = (data, success, fail) => {
Request({ Request({
methods: 'get', methods: 'get',
// url: '/resource/getByDept', // url: '/resource/getByDept',
url: '/workdynamics/getDeptWork', url: '/workdynamics/page',
data data
}).then(res => { }).then(res => {
success && success(res) success && success(res)

View File

@ -86,7 +86,8 @@ export default {
getResourceByDept () { getResourceByDept () {
const data = { const data = {
limit: 5, limit: 5,
page: 1 page: 1,
name: ''
} }
this.loadingDynamic = true this.loadingDynamic = true
Apis.getResourceByDept( Apis.getResourceByDept(

View File

@ -1,3 +1,10 @@
<!--
* @Author: hisense.wuhongjian
* @Date: 2022-07-05 12:53:03
* @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-08-26 10:24:16
* @Description: 告诉大家这是什么
-->
<template> <template>
<div class="center-view"> <div class="center-view">
<!-- 频率 --> <!-- 频率 -->
@ -14,7 +21,7 @@ import RiskView from './risk-view.vue'
import TrendView from './trend-view.vue' import TrendView from './trend-view.vue'
export default { export default {
components: { frequencyTop5View, TrendView, RiskView }, components: { frequencyTop5View, TrendView, RiskView }
} }
</script> </script>
@ -29,4 +36,4 @@ export default {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
</style> </style>

View File

@ -8,185 +8,185 @@
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts'
export default { export default {
data() { data () {
return { return {
dataListCopy: [], dataListCopy: [],
myChart: null, myChart: null
}
},
props: {
id: {
type: String,
default: ''
},
title: {
type: String,
default: ''
},
dataList: {
type: Array,
default: () => []
},
colorArray: {
type: Array,
default: () => [
'#fe845e', '#ff3e55', '#d5c438', '#ff9999', '#9c78ed', '#48c760', '#48c6c7', '#0058e1',
]
},
},
watch: {
dataList: {
handler(newVal, oldVal) {
if (newVal) {
this.dataListCopy = newVal;
this.initChart()
}
},
deep: true,
immediate: true
},
},
mounted() {
},
methods: {
initChart() {
var chartDom = document.getElementById(this.id);
if (this.myChart) {
this.myChart.dispose()
}
this.myChart = chartDom && echarts.init(chartDom);
let lengendArr = this.dataListCopy.filter(v => v.name);
let total = 0;
this.dataListCopy.map(v => {
if (v.value || v.value === 0) {
total = total + Number(v.value || 0)
}
})
let option = {
"animation": true,
title: [
{
text: '{val|' + total + '} {unit|' + '个' + '}',
top: 'top',
left: 'center',
textStyle: {
rich: {
val: {
fontSize: 20,
fontWeight: 'bold',
color: '#212121',
padding: [80, 0]
},
unit: {
fontSize: 16,
fontWeight: 'normal',
color: '#212121',
padding: [80, 0],
}
},
},
},
],
tooltip: {
triagger: 'item',
formatter: (params) => {
let str = ''
if (params.name == '线') {
str = ''
} else {
str = `<span style="display:inline-block;margin-right:5px;
border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>${params.name}: ${params.value}`
}
return str;
}
},
"legend": {
type: 'scroll',
"width": "90%",
"left": "center",
"textStyle": {
"color": "#212121",
"fontSize": 12
},
"icon": "circle",
"right": "0",
"bottom": "30",
// "padding": [10, 60],
"itemGap": 10,
"data": lengendArr
},
"series": [{
"type": "pie",
"center": ["50%", "40%"],
"radius": ["50%", "63%"],
"color": this.colorArray,
"startAngle": 135,
label: {
show: false
},
"emphasis": {
"label": {
"show": false,
"formatter": "{b|{b}:} {per|{d}%} ",
"backgroundColor": "rgba(255, 147, 38, 0)",
"borderColor": "transparent",
"borderRadius": 4,
"rich": {
"a": {
"color": "#999",
"lineHeight": 22,
"align": "center"
},
"hr": {
"borderColor": "#aaa",
"width": "100%",
"borderWidth": 1,
"height": 0
},
"b": {
"color": "#fff",
"fontSize": 18,
"lineHeight": 33
},
"c": {
"fontSize": 14,
"color": "#eee"
},
"per": {
"color": "#FDF44E",
"fontSize": 25,
"padding": [5, 6],
"borderRadius": 2
}
}
}
},
data: this.dataListCopy,
},
{
"type": "pie",
"center": ["50%", "40%"],
"radius": ["38%", "39%"],
"label": {
"show": false
},
hoverAnimation: false,
showTooltip: false,
color: ['#d8dde8'],
"data": [{
"value": 0,
"name": "线",
}]
}
]
}
this.myChart && option && this.myChart.setOption(option, true);
}
} }
},
props: {
id: {
type: String,
default: ''
},
title: {
type: String,
default: ''
},
dataList: {
type: Array,
default: () => []
},
colorArray: {
type: Array,
default: () => [
'#fe845e', '#ff3e55', '#d5c438', '#ff9999', '#9c78ed', '#48c760', '#48c6c7', '#0058e1'
]
}
},
watch: {
dataList: {
handler (newVal, oldVal) {
if (newVal) {
this.dataListCopy = newVal
this.initChart()
}
},
deep: true,
immediate: true
}
},
mounted () {
},
methods: {
initChart () {
var chartDom = document.getElementById(this.id)
if (this.myChart) {
this.myChart.dispose()
}
this.myChart = chartDom && echarts.init(chartDom)
const lengendArr = this.dataListCopy.filter(v => v.name)
let total = 0
this.dataListCopy.map(v => {
if (v.value || v.value === 0) {
total = total + Number(v.value || 0)
}
})
const option = {
animation: true,
title: [
{
text: '{val|' + total + '} {unit|' + '个' + '}',
top: 'top',
left: 'center',
textStyle: {
rich: {
val: {
fontSize: 20,
fontWeight: 'bold',
color: '#212121',
padding: [80, 0]
},
unit: {
fontSize: 16,
fontWeight: 'normal',
color: '#212121',
padding: [80, 0]
}
}
}
}
],
tooltip: {
triagger: 'item',
formatter: (params) => {
let str = ''
if (params.name == '线') {
str = ''
} else {
str = `<span style="display:inline-block;margin-right:5px;
border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>${params.name}: ${params.value}`
}
return str
}
},
legend: {
type: 'scroll',
width: '90%',
left: 'center',
textStyle: {
color: '#212121',
fontSize: 12
},
icon: 'circle',
right: '0',
bottom: '30',
// "padding": [10, 60],
itemGap: 10,
data: lengendArr
},
series: [{
type: 'pie',
center: ['50%', '40%'],
radius: ['50%', '63%'],
color: this.colorArray,
startAngle: 135,
label: {
show: false
},
emphasis: {
label: {
show: false,
formatter: '{b|{b}:} {per|{d}%} ',
backgroundColor: 'rgba(255, 147, 38, 0)',
borderColor: 'transparent',
borderRadius: 4,
rich: {
a: {
color: '#999',
lineHeight: 22,
align: 'center'
},
hr: {
borderColor: '#aaa',
width: '100%',
borderWidth: 1,
height: 0
},
b: {
color: '#fff',
fontSize: 18,
lineHeight: 33
},
c: {
fontSize: 14,
color: '#eee'
},
per: {
color: '#FDF44E',
fontSize: 25,
padding: [5, 6],
borderRadius: 2
}
}
}
},
data: this.dataListCopy
},
{
type: 'pie',
center: ['50%', '40%'],
radius: ['38%', '39%'],
label: {
show: false
},
hoverAnimation: false,
showTooltip: false,
color: ['#d8dde8'],
data: [{
value: 0,
name: '线'
}]
}
]
}
this.myChart && option && this.myChart.setOption(option, true)
}
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -218,4 +218,4 @@ export default {
color: #212121; color: #212121;
text-align: center; text-align: center;
} }
</style> </style>

View File

@ -100,7 +100,19 @@ import processModule from '@/mixins/process-module'
export default { export default {
mixins: [mixinViewModule, processModule], mixins: [mixinViewModule, processModule],
data () { data () {
return {} return {
mixinViewModuleOptions: {
createdIsNeed: false, //
activatedIsNeed: false, //
getDataListURL: '', // API
getDataListIsPage: false, //
deleteURL: '', // API
deleteIsBatch: false, //
deleteIsBatchKey: 'id', // keypiduid...
exportURL: '', // API
requestCallback: null //
}
}
}, },
props: { props: {
dataInfo: { dataInfo: {

View File

@ -61,7 +61,7 @@ export default {
) )
.then((res) => { .then((res) => {
console.log(res.data.data) console.log(res.data.data)
if (res.data.data) { if (res.data.data && res.data.data.length > 0) {
this.topData = res.data.data this.topData = res.data.data
this.oneData = this.topData[0].count this.oneData = this.topData[0].count
} else { } else {

View File

@ -91,19 +91,27 @@ export default {
// if (res.data.code !== 0) { // if (res.data.code !== 0) {
// return // return
// } // }
this.data = res.data.data[0].values if (res.data.data && res.data.data.length > 0) {
this.data.map((item) => { this.data = res.data.data[0].values
const time = moment(item[0] * 1000).format('YYYY-MM-DD') this.data.map((item) => {
this.ydata.map((itemSon, indexSon) => { const time = moment(item[0] * 1000).format('YYYY-MM-DD')
if (itemSon === time) { this.ydata.map((itemSon, indexSon) => {
this.xaxis[indexSon] = parseInt(item[1]) if (itemSon === time) {
} this.xaxis[indexSon] = parseInt(item[1])
}
})
}) })
}) this.trendChartData = {
this.trendChartData = { xaxis: this.ydata,
xaxis: this.ydata, ydata: this.xaxis
ydata: this.xaxis }
} else {
this.trendChartData = {
xaxis: [],
ydata: []
}
} }
this.$nextTick(() => { this.$nextTick(() => {
trendLineChart('trendId', this.trendChartData) trendLineChart('trendId', this.trendChartData)
}) })

View File

@ -37,181 +37,178 @@ import deptTodoView from '../workBench/components/dept-todo-view.vue'
import * as Apis from './api.js' import * as Apis from './api.js'
export default { export default {
components: { components: {
deptTodoView, deptTodoView,
BottomView, BottomView,
CenterView, CenterView,
DeptChartView, DeptChartView
}, },
data() { data () {
return { return {
// //
toToData: { toToData: {
color: '#f86f01', color: '#f86f01',
imgSrc: require('@/assets/img/workBench/todo.png'), imgSrc: require('@/assets/img/workBench/todo.png'),
bgColor: 'rgba(228,138,1,0.12)', bgColor: 'rgba(228,138,1,0.12)',
borderColor: 'rgba(250,123,12,0.54)', borderColor: 'rgba(250,123,12,0.54)',
textColor: '#f86f01', textColor: '#f86f01',
num: 0, num: 0,
list: [], list: [],
type: 'todo', type: 'todo',
url: 'activiti-my-todo-task' url: 'activiti-my-todo-task'
}, },
// //
hasToDodoData: { hasToDodoData: {
noMarginleft: true, noMarginleft: true,
color: '#21b107', color: '#21b107',
imgSrc: require('@/assets/img/workBench/hasToDo.png'), imgSrc: require('@/assets/img/workBench/hasToDo.png'),
bgColor: 'rgba(37,165,13,0.12)', bgColor: 'rgba(37,165,13,0.12)',
borderColor: 'rgba(49,194,20,0.54)', borderColor: 'rgba(49,194,20,0.54)',
textColor: '#21b107', textColor: '#21b107',
num: 0, num: 0,
list: [], list: [],
url: 'activiti-my-join-task' url: 'activiti-my-join-task'
}, },
// //
resourceData: [], resourceData: [],
resourceColor: ['#7b2cff', '#fd5151', , '#2ca1ff', '#0adbfa', '#febe13', '#65e5dd', '#f071ff', '#85f67a'], resourceColor: ['#7b2cff', '#fd5151', , '#2ca1ff', '#0adbfa', '#febe13', '#65e5dd', '#f071ff', '#85f67a'],
// //
applyData: [], applyData: [],
applyColor: ["#5085f2", "#e75fc3", "#f87be2", "#f2719a", "#fca4bb", "#f59a8f", "#fdb301", "#57e7ec", "#cf9ef1"], applyColor: ['#5085f2', '#e75fc3', '#f87be2', '#f2719a', '#fca4bb', '#f59a8f', '#fdb301', '#57e7ec', '#cf9ef1'],
// //
requireData: [], requireData: [],
requireColor: ['#FD866A', '#9E87FF', '#58D5FF', '#73DDFF', '#73ACFF', '#FDD56A', '#FDB36A',], requireColor: ['#FD866A', '#9E87FF', '#58D5FF', '#73DDFF', '#73ACFF', '#FDD56A', '#FDB36A'],
loadingToDo: false, loadingToDo: false,
loadingHasToDo: false, loadingHasToDo: false,
loadingResource: false, loadingResource: false,
loadingApply: false, loadingApply: false,
loadingRequire: false, loadingRequire: false
}
},
mounted () {
//
this.getToDo()
//
this.getHasToDo()
//
this.getShelvesTotal()
//
this.getApplyTotal()
//
this.getRequireTotal()
},
methods: {
//
getToDo () {
this.loadingToDo = true
const data = {
limit: 5,
page: 1
}
Apis.getToDoTask(data, res => {
this.loadingToDo = false
if (res.data.code !== 0) {
return this.$message.error(res.data.msg)
} }
console.log('res----待办-------->', res.data)
this.toToData.list = res.data.data.records || []
this.toToData.num = res.data.data.total || 0
}, err => {
this.$message.error(err)
this.loadingToDo = false
})
}, },
mounted() { //
// getHasToDo () {
this.getToDo() const data = {
// limit: 5,
this.getHasToDo() page: 1
// }
this.getShelvesTotal() this.loadingHasToDo = true
// Apis.getHasToDoTask(data, res => {
this.getApplyTotal() this.loadingHasToDo = false
// if (res.data.code !== 0) {
this.getRequireTotal() return this.$message.error(res.data.msg)
}
console.log('res----已办-------->', res.data)
this.hasToDodoData.list = res.data.data.records || []
this.hasToDodoData.num = res.data.data.total || 0
}, err => {
this.$message.error(err)
this.loadingHasToDo = false
console.log('err-----已办------->', err)
})
}, },
methods: { //
// getShelvesTotal () {
getToDo() { this.loadingResource = true
this.loadingToDo = true; Apis.getTotalByDept({}, res => {
let data = { this.loadingResource = false
limit: 5, if (res.data.code !== 0) {
page: 1, return this.$message.error(res.data.msg)
} }
Apis.getToDoTask(data, res => { console.log('res----部门上架-------->', res.data)
this.loadingToDo = false; this.resourceData = this.formatList(res.data.data.total || [])
if (res.data.code !== 0) { this.$nextTick(() => {
return this.$message.error(res.data.msg) this.$refs.resourceChart.initChart(this.resourceData)
} })
console.log('res----待办-------->', res.data); }, err => {
this.toToData.list = res.data.data.records || [] this.$message.error(err)
this.toToData.num = res.data.data.total || 0 this.loadingResource = false
}, err => { })
this.$message.error(err);
this.loadingToDo = false;
})
},
//
getHasToDo() {
let data = {
limit: 5,
page: 1,
}
this.loadingHasToDo = true;
Apis.getHasToDoTask(data, res => {
this.loadingHasToDo = false;
if (res.data.code !== 0) {
return this.$message.error(res.data.msg)
}
console.log('res----已办-------->', res.data);
this.hasToDodoData.list = res.data.data.records || []
this.hasToDodoData.num = res.data.data.total || 0
}, err => {
this.$message.error(err)
this.loadingHasToDo = false;
console.log('err-----已办------->', err);
})
},
//
getShelvesTotal() {
this.loadingResource = true;
Apis.getTotalByDept({}, res => {
this.loadingResource = false;
if (res.data.code !== 0) {
return this.$message.error(res.data.msg)
}
console.log('res----部门上架-------->', res.data);
this.resourceData = this.formatList(res.data.data.total || [])
this.$nextTick(() => {
this.$refs.resourceChart.initChart(this.resourceData)
})
}, err => {
this.$message.error(err)
this.loadingResource = false;
})
},
//
getApplyTotal() {
this.loadingApply = true;
Apis.getApply({}, res => {
this.loadingApply = false;
if (res.data.code !== 0) {
return this.$message.error(res.data.msg)
}
console.log('res----部门申请-------->', res.data);
this.applyData = this.formatList(res.data.data.total || [])
this.$nextTick(() => {
console.log('this.applyData------------>', this.applyData);
this.$refs.applyChart.initChart(this.applyData)
})
}, err => {
this.$message.error(err)
this.loadingApply = false;
})
},
formatList(list = [], nameStr = 'type') {
let arr = []
list.map(v => {
let obj = {}
obj.name = v[nameStr];
obj.value = v.count;
arr.push(obj)
})
return arr;
},
//
getRequireTotal() {
this.loadingRequire = true;
Apis.getRequire({}, res => {
this.loadingRequire = false;
if (res.data.code !== 0) {
return this.$message.error(res.data.msg)
}
console.log('res----部门需求-------->', res.data);
this.requireData = this.formatList(res.data.data.total || [], 'flag')
this.$nextTick(() => {
this.$refs.requireChart.initChart(this.requireData)
})
}, err => {
this.$message.error(err)
this.loadingRequire = false;
})
},
}, },
//
getApplyTotal () {
this.loadingApply = true
Apis.getApply({}, res => {
this.loadingApply = false
if (res.data.code !== 0) {
return this.$message.error(res.data.msg)
}
console.log('res----部门申请-------->', res.data)
this.applyData = this.formatList(res.data.data.total || [])
this.$nextTick(() => {
console.log('this.applyData------------>', this.applyData)
this.$refs.applyChart.initChart(this.applyData)
})
}, err => {
this.$message.error(err)
this.loadingApply = false
})
},
formatList (list = [], nameStr = 'type') {
const arr = []
list.map(v => {
const obj = {}
obj.name = v[nameStr]
obj.value = v.count
arr.push(obj)
})
return arr
},
//
getRequireTotal () {
this.loadingRequire = true
Apis.getRequire({}, res => {
this.loadingRequire = false
if (res.data.code !== 0) {
return this.$message.error(res.data.msg)
}
console.log('res----部门需求-------->', res.data)
this.requireData = this.formatList(res.data.data.total || [], 'flag')
this.$nextTick(() => {
this.$refs.requireChart.initChart(this.requireData)
})
}, err => {
this.$message.error(err)
this.loadingRequire = false
})
}
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.margin-h-16 { .margin-h-16 {
margin: 0 16px; margin: 0 16px;
@ -243,4 +240,4 @@ export default {
background: #fff; background: #fff;
} }
} }
</style> </style>