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>

View File

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

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,6 +91,7 @@ export default {
// if (res.data.code !== 0) { // if (res.data.code !== 0) {
// return // return
// } // }
if (res.data.data && res.data.data.length > 0) {
this.data = res.data.data[0].values this.data = res.data.data[0].values
this.data.map((item) => { this.data.map((item) => {
const time = moment(item[0] * 1000).format('YYYY-MM-DD') const time = moment(item[0] * 1000).format('YYYY-MM-DD')
@ -104,6 +105,13 @@ export default {
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

@ -41,9 +41,9 @@ export default {
deptTodoView, deptTodoView,
BottomView, BottomView,
CenterView, CenterView,
DeptChartView, DeptChartView
}, },
data() { data () {
return { return {
// //
toToData: { toToData: {
@ -74,18 +74,18 @@ export default {
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() { mounted () {
// //
this.getToDo() this.getToDo()
// //
@ -99,119 +99,116 @@ export default {
}, },
methods: { methods: {
// //
getToDo() { getToDo () {
this.loadingToDo = true; this.loadingToDo = true
let data = { const data = {
limit: 5, limit: 5,
page: 1, page: 1
} }
Apis.getToDoTask(data, res => { Apis.getToDoTask(data, res => {
this.loadingToDo = false; this.loadingToDo = false
if (res.data.code !== 0) { if (res.data.code !== 0) {
return this.$message.error(res.data.msg) return this.$message.error(res.data.msg)
} }
console.log('res----待办-------->', res.data); console.log('res----待办-------->', res.data)
this.toToData.list = res.data.data.records || [] this.toToData.list = res.data.data.records || []
this.toToData.num = res.data.data.total || 0 this.toToData.num = res.data.data.total || 0
}, err => { }, err => {
this.$message.error(err); this.$message.error(err)
this.loadingToDo = false; this.loadingToDo = false
}) })
}, },
// //
getHasToDo() { getHasToDo () {
let data = { const data = {
limit: 5, limit: 5,
page: 1, page: 1
} }
this.loadingHasToDo = true; this.loadingHasToDo = true
Apis.getHasToDoTask(data, res => { Apis.getHasToDoTask(data, res => {
this.loadingHasToDo = false; this.loadingHasToDo = false
if (res.data.code !== 0) { if (res.data.code !== 0) {
return this.$message.error(res.data.msg) return this.$message.error(res.data.msg)
} }
console.log('res----已办-------->', res.data); console.log('res----已办-------->', res.data)
this.hasToDodoData.list = res.data.data.records || [] this.hasToDodoData.list = res.data.data.records || []
this.hasToDodoData.num = res.data.data.total || 0 this.hasToDodoData.num = res.data.data.total || 0
}, err => { }, err => {
this.$message.error(err) this.$message.error(err)
this.loadingHasToDo = false; this.loadingHasToDo = false
console.log('err-----已办------->', err); console.log('err-----已办------->', err)
}) })
}, },
// //
getShelvesTotal() { getShelvesTotal () {
this.loadingResource = true; this.loadingResource = true
Apis.getTotalByDept({}, res => { Apis.getTotalByDept({}, res => {
this.loadingResource = false; this.loadingResource = false
if (res.data.code !== 0) { if (res.data.code !== 0) {
return this.$message.error(res.data.msg) return this.$message.error(res.data.msg)
} }
console.log('res----部门上架-------->', res.data); console.log('res----部门上架-------->', res.data)
this.resourceData = this.formatList(res.data.data.total || []) this.resourceData = this.formatList(res.data.data.total || [])
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.resourceChart.initChart(this.resourceData) this.$refs.resourceChart.initChart(this.resourceData)
}) })
}, err => { }, err => {
this.$message.error(err) this.$message.error(err)
this.loadingResource = false; this.loadingResource = false
}) })
}, },
// //
getApplyTotal() { getApplyTotal () {
this.loadingApply = true; this.loadingApply = true
Apis.getApply({}, res => { Apis.getApply({}, res => {
this.loadingApply = false; this.loadingApply = false
if (res.data.code !== 0) { if (res.data.code !== 0) {
return this.$message.error(res.data.msg) return this.$message.error(res.data.msg)
} }
console.log('res----部门申请-------->', res.data); console.log('res----部门申请-------->', res.data)
this.applyData = this.formatList(res.data.data.total || []) this.applyData = this.formatList(res.data.data.total || [])
this.$nextTick(() => { this.$nextTick(() => {
console.log('this.applyData------------>', this.applyData); console.log('this.applyData------------>', this.applyData)
this.$refs.applyChart.initChart(this.applyData) this.$refs.applyChart.initChart(this.applyData)
}) })
}, err => { }, err => {
this.$message.error(err) this.$message.error(err)
this.loadingApply = false; this.loadingApply = false
}) })
}, },
formatList(list = [], nameStr = 'type') { formatList (list = [], nameStr = 'type') {
let arr = [] const arr = []
list.map(v => { list.map(v => {
let obj = {} const obj = {}
obj.name = v[nameStr]; obj.name = v[nameStr]
obj.value = v.count; obj.value = v.count
arr.push(obj) arr.push(obj)
}) })
return arr; return arr
}, },
// //
getRequireTotal() { getRequireTotal () {
this.loadingRequire = true; this.loadingRequire = true
Apis.getRequire({}, res => { Apis.getRequire({}, res => {
this.loadingRequire = false; this.loadingRequire = false
if (res.data.code !== 0) { if (res.data.code !== 0) {
return this.$message.error(res.data.msg) return this.$message.error(res.data.msg)
} }
console.log('res----部门需求-------->', res.data); console.log('res----部门需求-------->', res.data)
this.requireData = this.formatList(res.data.data.total || [], 'flag') this.requireData = this.formatList(res.data.data.total || [], 'flag')
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.requireChart.initChart(this.requireData) this.$refs.requireChart.initChart(this.requireData)
}) })
}, err => { }, err => {
this.$message.error(err) this.$message.error(err)
this.loadingRequire = false; 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;