diff --git a/back/src/views/modules/workBench/api.js b/back/src/views/modules/workBench/api.js index e14a4780..e0975a86 100644 --- a/back/src/views/modules/workBench/api.js +++ b/back/src/views/modules/workBench/api.js @@ -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) diff --git a/back/src/views/modules/workBench/components/bottom-view.vue b/back/src/views/modules/workBench/components/bottom-view.vue index 04adfb58..4e0b1e4e 100644 --- a/back/src/views/modules/workBench/components/bottom-view.vue +++ b/back/src/views/modules/workBench/components/bottom-view.vue @@ -86,7 +86,8 @@ export default { getResourceByDept () { const data = { limit: 5, - page: 1 + page: 1, + name: '' } this.loadingDynamic = true Apis.getResourceByDept( diff --git a/back/src/views/modules/workBench/components/center-view.vue b/back/src/views/modules/workBench/components/center-view.vue index d40976fc..3ccf445f 100644 --- a/back/src/views/modules/workBench/components/center-view.vue +++ b/back/src/views/modules/workBench/components/center-view.vue @@ -1,3 +1,10 @@ + \ No newline at end of file + diff --git a/back/src/views/modules/workBench/components/dept-todo-view.vue b/back/src/views/modules/workBench/components/dept-todo-view.vue index e72e18a3..4a018261 100644 --- a/back/src/views/modules/workBench/components/dept-todo-view.vue +++ b/back/src/views/modules/workBench/components/dept-todo-view.vue @@ -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', // 删除接口,批量状态下由那个key进行标记操作?比如:pid,uid... + exportURL: '', // 导出接口,API地址 + requestCallback: null // 获取列表以后执行的回调 + } + } }, props: { dataInfo: { diff --git a/back/src/views/modules/workBench/components/risk-view.vue b/back/src/views/modules/workBench/components/risk-view.vue index f7f884d3..e65320da 100644 --- a/back/src/views/modules/workBench/components/risk-view.vue +++ b/back/src/views/modules/workBench/components/risk-view.vue @@ -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 { diff --git a/back/src/views/modules/workBench/components/trend-view.vue b/back/src/views/modules/workBench/components/trend-view.vue index 68d95f63..f19d4dc1 100644 --- a/back/src/views/modules/workBench/components/trend-view.vue +++ b/back/src/views/modules/workBench/components/trend-view.vue @@ -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) }) diff --git a/back/src/views/modules/workBench/workBench.vue b/back/src/views/modules/workBench/workBench.vue index 97a1a0b4..de1c70b3 100644 --- a/back/src/views/modules/workBench/workBench.vue +++ b/back/src/views/modules/workBench/workBench.vue @@ -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 + }) + } + + } } - \ No newline at end of file +