Compare commits

...

2 Commits

8 changed files with 390 additions and 365 deletions

View File

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

View File

@ -86,7 +86,8 @@ export default {
getResourceByDept () {
const data = {
limit: 5,
page: 1
page: 1,
name: ''
}
this.loadingDynamic = true
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>
<div class="center-view">
<!-- 频率 -->
@ -14,7 +21,7 @@ import RiskView from './risk-view.vue'
import TrendView from './trend-view.vue'
export default {
components: { frequencyTop5View, TrendView, RiskView },
components: { frequencyTop5View, TrendView, RiskView }
}
</script>
@ -29,4 +36,4 @@ export default {
align-items: center;
justify-content: space-between;
}
</style>
</style>

View File

@ -8,185 +8,185 @@
</template>
<script>
import * as echarts from 'echarts';
import * as echarts from 'echarts'
export default {
data() {
return {
dataListCopy: [],
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);
}
data () {
return {
dataListCopy: [],
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)
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>
<style lang="scss" scoped>
@ -218,4 +218,4 @@ export default {
color: #212121;
text-align: center;
}
</style>
</style>

View File

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

View File

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

View File

@ -91,19 +91,27 @@ export default {
// if (res.data.code !== 0) {
// return
// }
this.data = res.data.data[0].values
this.data.map((item) => {
const time = moment(item[0] * 1000).format('YYYY-MM-DD')
this.ydata.map((itemSon, indexSon) => {
if (itemSon === time) {
this.xaxis[indexSon] = parseInt(item[1])
}
if (res.data.data && res.data.data.length > 0) {
this.data = res.data.data[0].values
this.data.map((item) => {
const time = moment(item[0] * 1000).format('YYYY-MM-DD')
this.ydata.map((itemSon, indexSon) => {
if (itemSon === time) {
this.xaxis[indexSon] = parseInt(item[1])
}
})
})
})
this.trendChartData = {
xaxis: this.ydata,
ydata: this.xaxis
this.trendChartData = {
xaxis: this.ydata,
ydata: this.xaxis
}
} else {
this.trendChartData = {
xaxis: [],
ydata: []
}
}
this.$nextTick(() => {
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'
export default {
components: {
deptTodoView,
BottomView,
CenterView,
DeptChartView,
},
data() {
return {
//
toToData: {
color: '#f86f01',
imgSrc: require('@/assets/img/workBench/todo.png'),
bgColor: 'rgba(228,138,1,0.12)',
borderColor: 'rgba(250,123,12,0.54)',
textColor: '#f86f01',
num: 0,
list: [],
type: 'todo',
url: 'activiti-my-todo-task'
},
//
hasToDodoData: {
noMarginleft: true,
color: '#21b107',
imgSrc: require('@/assets/img/workBench/hasToDo.png'),
bgColor: 'rgba(37,165,13,0.12)',
borderColor: 'rgba(49,194,20,0.54)',
textColor: '#21b107',
num: 0,
list: [],
url: 'activiti-my-join-task'
},
//
resourceData: [],
resourceColor: ['#7b2cff', '#fd5151', , '#2ca1ff', '#0adbfa', '#febe13', '#65e5dd', '#f071ff', '#85f67a'],
//
applyData: [],
applyColor: ["#5085f2", "#e75fc3", "#f87be2", "#f2719a", "#fca4bb", "#f59a8f", "#fdb301", "#57e7ec", "#cf9ef1"],
//
requireData: [],
requireColor: ['#FD866A', '#9E87FF', '#58D5FF', '#73DDFF', '#73ACFF', '#FDD56A', '#FDB36A',],
loadingToDo: false,
loadingHasToDo: false,
loadingResource: false,
loadingApply: false,
loadingRequire: false,
components: {
deptTodoView,
BottomView,
CenterView,
DeptChartView
},
data () {
return {
//
toToData: {
color: '#f86f01',
imgSrc: require('@/assets/img/workBench/todo.png'),
bgColor: 'rgba(228,138,1,0.12)',
borderColor: 'rgba(250,123,12,0.54)',
textColor: '#f86f01',
num: 0,
list: [],
type: 'todo',
url: 'activiti-my-todo-task'
},
//
hasToDodoData: {
noMarginleft: true,
color: '#21b107',
imgSrc: require('@/assets/img/workBench/hasToDo.png'),
bgColor: 'rgba(37,165,13,0.12)',
borderColor: 'rgba(49,194,20,0.54)',
textColor: '#21b107',
num: 0,
list: [],
url: 'activiti-my-join-task'
},
//
resourceData: [],
resourceColor: ['#7b2cff', '#fd5151', , '#2ca1ff', '#0adbfa', '#febe13', '#65e5dd', '#f071ff', '#85f67a'],
//
applyData: [],
applyColor: ['#5085f2', '#e75fc3', '#f87be2', '#f2719a', '#fca4bb', '#f59a8f', '#fdb301', '#57e7ec', '#cf9ef1'],
//
requireData: [],
requireColor: ['#FD866A', '#9E87FF', '#58D5FF', '#73DDFF', '#73ACFF', '#FDD56A', '#FDB36A'],
loadingToDo: false,
loadingHasToDo: false,
loadingResource: false,
loadingApply: 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() {
//
this.getToDo()
//
this.getHasToDo()
//
this.getShelvesTotal()
//
this.getApplyTotal()
//
this.getRequireTotal()
//
getHasToDo () {
const 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)
})
},
methods: {
//
getToDo() {
this.loadingToDo = true;
let 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;
})
},
//
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;
})
},
//
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') {
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>
<style lang="scss" scoped>
.margin-h-16 {
margin: 0 16px;
@ -243,4 +240,4 @@ export default {
background: #fff;
}
}
</style>
</style>