hi-ucs/back/src/views/modules/workBench/workBench.vue

227 lines
7.0 KiB
Vue
Raw Normal View History

2022-06-29 15:50:26 +08:00
<template>
<div class="work-brnch-box">
<!-- -->
<div class="flex-row-start top">
<div class="flex-row-start dept-left">
2022-06-30 13:15:27 +08:00
<dept-todo-view title="部门待办" v-loading="loadingToDo" :dataInfo="toToData"></dept-todo-view>
<dept-todo-view title="部门已办" v-loading="loadingHasToDo" :dataInfo="hasToDodoData"
style="margin-left: 0"></dept-todo-view>
2022-06-30 10:33:23 +08:00
</div>
<div class="flex-row-start dept-chart-box">
2022-06-30 13:15:27 +08:00
<dept-chart-view id="shelves" title="部门上架" v-loading="loadingResource" :dataList="resourceData">
</dept-chart-view>
<dept-chart-view id="apply" title="部门申请" v-loading="loadingApply" :dataList="applyData">
</dept-chart-view>
<dept-chart-view id="demand" title="部门需求" v-loading="loadingRequire" :dataList="requireData">
</dept-chart-view>
2022-06-29 15:50:26 +08:00
</div>
</div>
<!-- -->
<div class="center">
<center-view></center-view>
</div>
<!-- -->
<div class="bottom">
<bottom-view></bottom-view>
</div>
</div>
</template>
<script>
import BottomView from '../workBench/components/bottom-view.vue'
import CenterView from '../workBench/components/center-view.vue'
2022-06-30 10:33:23 +08:00
import DeptChartView from '../workBench/components/dept-chart-view.vue'
2022-06-29 15:50:26 +08:00
import deptTodoView from '../workBench/components/dept-todo-view.vue'
2022-06-30 10:33:23 +08:00
import * as Apis from './api.js'
2022-06-29 15:50:26 +08:00
export default {
components: {
deptTodoView,
BottomView,
CenterView,
2022-06-30 10:33:23 +08:00
DeptChartView,
2022-06-29 15:50:26 +08:00
},
data() {
return {
// 部门待办
toToData: {
color: '#f86f01',
2022-06-29 17:23:32 +08:00
imgSrc: require('@/assets/img/workBench/todo.png'),
bgColor: 'rgba(228,138,1,0.12)',
borderColor: 'rgba(250,123,12,0.54)',
textColor: '#f86f01',
2022-06-30 10:33:23 +08:00
num: 0,
2022-06-29 17:23:32 +08:00
list: [],
nameStr: 'taskName'
2022-06-29 15:50:26 +08:00
},
// 部门已办
hasToDodoData: {
2022-06-29 17:23:32 +08:00
noMarginleft: true,
2022-06-29 15:50:26 +08:00
color: '#21b107',
2022-06-29 17:23:32 +08:00
imgSrc: require('@/assets/img/workBench/hasToDo.png'),
bgColor: 'rgba(37,165,13,0.12)',
borderColor: 'rgba(49,194,20,0.54)',
textColor: '#21b107',
2022-06-30 10:33:23 +08:00
num: 0,
2022-06-29 17:23:32 +08:00
list: [],
nameStr: 'processDefinitionName'
2022-06-30 10:33:23 +08:00
},
// 上架
resourceData: [],
// 上架
applyData: [],
// 上架
requireData: [],
2022-06-30 13:15:27 +08:00
loadingToDo: false,
loadingHasToDo: false,
loadingResource: false,
loadingApply: false,
loadingRequire: false,
2022-06-29 15:50:26 +08:00
}
},
2022-06-29 17:23:32 +08:00
mounted() {
2022-06-30 10:33:23 +08:00
// 部门待办
2022-06-29 17:23:32 +08:00
this.getToDo()
2022-06-30 10:33:23 +08:00
// 部门已办
2022-06-29 17:23:32 +08:00
this.getHasToDo()
2022-06-30 10:33:23 +08:00
// 上架
this.getShelvesTotal()
// 申请
this.getApplyTotal()
// 需求
this.getRequireTotal()
2022-06-29 17:23:32 +08:00
},
2022-06-29 15:50:26 +08:00
methods: {
2022-06-29 17:23:32 +08:00
// 待办
getToDo() {
2022-06-30 13:15:27 +08:00
this.loadingToDo = true;
2022-06-29 17:23:32 +08:00
let data = {
limit: 5,
page: 1,
}
Apis.getToDoTask(data, res => {
2022-06-30 13:15:27 +08:00
this.loadingToDo = false;
2022-06-29 17:23:32 +08:00
if (res.data.code !== 0) {
2022-06-30 10:33:23 +08:00
return this.$message.error(res.data.msg)
2022-06-29 17:23:32 +08:00
}
console.log('res----待办-------->', res.data);
this.toToData.list = res.data.data.records || []
2022-07-01 13:29:38 +08:00
this.toToData.num = res.data.data.total || 0
2022-06-29 17:23:32 +08:00
}, err => {
2022-06-30 13:15:27 +08:00
this.$message.error(err);
this.loadingToDo = false;
2022-06-29 17:23:32 +08:00
})
},
// 已办
getHasToDo() {
let data = {
limit: 5,
page: 1,
}
2022-06-30 13:15:27 +08:00
this.loadingHasToDo = true;
2022-06-29 17:23:32 +08:00
Apis.getHasToDoTask(data, res => {
2022-06-30 13:15:27 +08:00
this.loadingHasToDo = false;
2022-06-29 17:23:32 +08:00
if (res.data.code !== 0) {
2022-06-30 10:33:23 +08:00
return this.$message.error(res.data.msg)
2022-06-29 17:23:32 +08:00
}
console.log('res----已办-------->', res.data);
this.hasToDodoData.list = res.data.data.records || []
2022-07-01 13:29:38 +08:00
this.hasToDodoData.num = res.data.data.total || 0
2022-06-29 17:23:32 +08:00
}, err => {
2022-06-30 10:33:23 +08:00
this.$message.error(err)
2022-06-30 13:15:27 +08:00
this.loadingHasToDo = false;
2022-06-29 17:23:32 +08:00
console.log('err-----已办------->', err);
})
},
2022-06-30 10:33:23 +08:00
// 部门上架
getShelvesTotal() {
2022-06-30 13:15:27 +08:00
this.loadingResource = true;
2022-06-30 10:33:23 +08:00
Apis.getTotalByDept({}, res => {
2022-06-30 13:15:27 +08:00
this.loadingResource = false;
2022-06-30 10:33:23 +08:00
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 || [])
}, err => {
this.$message.error(err)
2022-06-30 13:15:27 +08:00
this.loadingResource = false;
2022-06-30 10:33:23 +08:00
})
},
// 部门申请
getApplyTotal() {
2022-06-30 13:15:27 +08:00
this.loadingApply = true;
2022-06-30 10:33:23 +08:00
Apis.getApply({}, res => {
2022-06-30 13:15:27 +08:00
this.loadingApply = false;
2022-06-30 10:33:23 +08:00
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 || [])
}, err => {
this.$message.error(err)
2022-06-30 13:15:27 +08:00
this.loadingApply = false;
2022-06-30 10:33:23 +08:00
})
},
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() {
2022-06-30 13:15:27 +08:00
this.loadingRequire = true;
2022-06-30 10:33:23 +08:00
Apis.getRequire({}, res => {
2022-06-30 13:15:27 +08:00
this.loadingRequire = false;
2022-06-30 10:33:23 +08:00
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')
2022-06-30 13:15:27 +08:00
2022-06-30 10:33:23 +08:00
}, err => {
this.$message.error(err)
2022-06-30 13:15:27 +08:00
this.loadingRequire = false;
2022-06-30 10:33:23 +08:00
})
},
2022-06-29 15:50:26 +08:00
},
}
</script>
<style lang="scss" scoped>
.margin-h-16 {
margin: 0 16px;
}
.flex-row-start {
display: flex;
align-items: center;
justify-content: flex-start;
}
.work-brnch-box {
.top {
height: 284px;
margin-bottom: 16px;
2022-06-30 10:33:23 +08:00
2022-06-29 15:50:26 +08:00
}
.dept-left {
width: 836px;
2022-06-30 10:33:23 +08:00
background: #fff;
margin-right: 16px;
2022-06-29 15:50:26 +08:00
}
.dept-chart-box {
width: 780px;
height: 100%;
2022-06-30 10:33:23 +08:00
background: #fff;
2022-06-29 15:50:26 +08:00
}
}
</style>