shenqilong 1 rok temu
rodzic
commit
333190505e
1 zmienionych plików z 482 dodań i 5 usunięć
  1. 482 5
      src/views/system/dashboard/components/new-home.vue

+ 482 - 5
src/views/system/dashboard/components/new-home.vue

@@ -3,7 +3,7 @@
         <el-tabs v-model="activeTab" @tab-click="changeTab">
             <el-tab-pane v-for="item in tabList" :key="item.key" :name="item.key">
                 <span slot="label"><i :class="item.icon" /> {{ item.label }}</span>
-                <div class="tab-container">
+                <div v-if="item.key!=='gr'&&item.key!=='zt'" class="tab-container">
                     <div slot="west" class="kind">
                         <ibps-type-tree
                             :width="width"
@@ -197,6 +197,49 @@
                         </div>
                     </div>
                 </div>
+                <div v-if="item.key==='gr'">
+                    <el-card class="ibps-desktop-dashboard">
+                        <el-row ref="row" :gutter="12">
+                            <template v-if="grdata && grdata.length >0">
+                                <el-col v-for="item in grdata" :key="item.id" :span="24" :sm="12" :md="6" :lg="6" :xl="6">
+                                    <div :class="'bg-'+item.color" class="item">
+                                        <div class="item-header">
+                                            <h3>{{ item.dataContent }}</h3>
+                                        </div>
+                                        <div class="item-body">
+                                            <h2><count-to :end-val="parseInt(item.dataText,10)" :duration="4000" /></h2>
+                                        </div>
+                                        <p class="item-tip">{{ item.dataContent[0] }}</p>
+                                    </div>
+                                </el-col>
+                            </template>
+                            <template v-else>
+                                <el-col v-for="(item,i) in 8" :key="i" :span="24" :sm="12" :md="6" :lg="6" :xl="6">
+                                    <div class="item bg-grey-steel">
+                                        <div class="item-header">&nbsp;</div>
+                                        <div class="item-body">
+                                            <h2>&nbsp;</h2>
+                                        </div>
+                                        <p class="item-tip">&nbsp;</p>
+                                    </div>
+                                </el-col>
+                            </template>
+                        </el-row>
+                    </el-card>
+                </div>
+                <div v-if="item.key==='zt'">
+                    <el-row ref="row" :gutter="12">
+
+                        <el-col :span="12">
+                            <div>检测任务统计</div>
+                            <div id="a1" style="height:500px;" />
+                        </el-col>
+                        <el-col :span="12">
+                            <div>任务事宜统计</div>
+                            <div id="a2" style="height:500px;" />
+                        </el-col>
+                    </el-row>
+                </div>
             </el-tab-pane>
         </el-tabs>
         <bpmn-formrender
@@ -225,6 +268,7 @@ import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
 import ActionUtils from '@/utils/action'
 import IbpsTypeTree from '@/business/platform/cat/type/tree'
 import { dateFormat } from '@/filters'
+import * as echarts from 'echarts'
 
 const tabList = [
     {
@@ -254,6 +298,20 @@ const tabList = [
         icon: 'el-icon-receiving',
         time: '暂存',
         field: 'createTime'
+    },
+    {
+        label: '个人任务统计',
+        key: 'gr',
+        icon: 'el-icon-receiving',
+        time: '个人任务',
+        field: 'createTime'
+    },
+    {
+        label: '总体任务统计',
+        key: 'zt',
+        icon: 'el-icon-receiving',
+        time: '总体任务',
+        field: 'createTime'
     }
 ]
 const taskState = {
@@ -287,7 +345,32 @@ const operate = {
     finish: handledTask,
     save: myDraft
 }
-
+const grdata = [
+    {
+        dataContent: '待办事宜',
+        url: '',
+        color: 'blue',
+        dataText: '0'
+    },
+    {
+        dataContent: '已办事宜',
+        url: '',
+        color: 'green',
+        dataText: '0'
+    },
+    {
+        dataContent: '办结事宜',
+        url: '',
+        color: 'green-meadow',
+        dataText: '0'
+    },
+    {
+        dataContent: '暂存事宜',
+        url: '',
+        color: 'blue',
+        dataText: '0'
+    }
+]
 export default {
     name: 'calendar',
     components: { BpmnFormrender, homeCalendar, IbpsTypeTree },
@@ -323,6 +406,204 @@ export default {
     },
     data () {
         return {
+            option: {
+                title: {
+                    text: ''
+                },
+                tooltip: {
+                    trigger: 'axis',
+                    axisPointer: {
+                        type: 'shadow'
+                    }
+                },
+                legend: {
+                    show: true
+
+                },
+                xAxis: {
+                    type: 'category',
+                    name: '检测人员',
+                    data: []
+
+                },
+                yAxis: {
+                    type: 'value',
+                    name: '任务数量'
+
+                },
+                series: [
+                    {
+                        name: '检测未完成数',
+                        type: 'bar',
+                        data: [],
+                        // barCategoryGap: '0',
+                        barGap: '0',
+                        barWidth: 30,
+                        label: {
+                            show: true,
+                            position: 'top',
+                            valueAnimation: true
+                        },
+                        itemStyle: {
+                            normal: {
+                                color: ['#ee6666']
+                            }
+                        }
+                    },
+                    {
+                        name: '检测已完成数',
+                        type: 'bar',
+                        data: [],
+                        // barCategoryGap: '0',
+                        barGap: '0',
+                        barWidth: 30,
+                        label: {
+                            show: true,
+                            position: 'top',
+                            valueAnimation: true
+                        },
+                        itemStyle: {
+                            normal: {
+                                color: ['#91cc75']
+                            }
+                        }
+                    },
+                    {
+                        name: '复核未完成数',
+                        type: 'bar',
+                        data: [],
+                        // barCategoryGap: '0',
+                        barGap: '0',
+                        barWidth: 30,
+                        label: {
+                            show: true,
+                            position: 'top',
+                            valueAnimation: true
+                        },
+                        itemStyle: {
+                            normal: {
+                                color: ['#fac858']
+                            }
+                        }
+                    },
+                    {
+                        name: '复核已完成数',
+                        type: 'bar',
+                        data: [],
+                        // barCategoryGap: '0',
+                        barGap: '0',
+                        barWidth: 30,
+                        label: {
+                            show: true,
+                            position: 'top',
+                            valueAnimation: true
+                        },
+                        itemStyle: {
+                            normal: {
+                                color: ['#5470c6']
+                            }
+                        }
+                    }
+                ]
+            },
+            optionPerson: {
+                title: {
+                    text: ''
+                },
+
+                tooltip: {
+                    trigger: 'axis',
+                    axisPointer: {
+                        type: 'shadow'
+                    }
+                },
+                legend: {
+                    show: true
+                },
+
+                xAxis: {
+                    type: 'category',
+                    name: '人员',
+                    data: []
+
+                },
+                yAxis: {
+                    type: 'value',
+                    name: '任务数量'
+
+                },
+                series: [
+                    {
+                        name: '待办事宜数',
+                        type: 'bar',
+                        data: [],
+                        barGap: '0',
+                        barWidth: 20,
+                        label: {
+                            show: true,
+                            position: 'top',
+                            valueAnimation: true
+                        },
+                        itemStyle: {
+                            normal: {
+                                color: ['#3598dc']
+                            }
+                        }
+                    },
+                    {
+                        name: '已办事宜数',
+                        type: 'bar',
+                        data: [],
+                        barGap: '0',
+                        barWidth: 20,
+                        label: {
+                            show: true,
+                            position: 'top',
+                            valueAnimation: true
+                        },
+                        itemStyle: {
+                            normal: {
+                                color: ['#32c5d2']
+                            }
+                        }
+                    },
+                    {
+                        name: '办结事宜',
+                        type: 'bar',
+                        data: [],
+                        barGap: '0',
+                        barWidth: 20,
+                        label: {
+                            show: true,
+                            position: 'top',
+                            valueAnimation: true
+                        },
+                        itemStyle: {
+                            normal: {
+                                color: ['#1bbc9b']
+                            }
+                        }
+                    },
+                    {
+                        name: '暂存事宜',
+                        type: 'bar',
+                        data: [],
+                        barGap: '0',
+                        barWidth: 20,
+                        label: {
+                            show: true,
+                            position: 'top',
+                            valueAnimation: true
+                        },
+                        itemStyle: {
+                            normal: {
+                                color: ['#3598dc']
+                            }
+                        }
+                    }
+                ]
+            },
+            grdata,
             tabList,
             stateOption,
             dataList: [],
@@ -379,6 +660,172 @@ export default {
         clearInterval(this.timer)
     },
     methods: {
+        // 图表数据加载
+        async chartLoading () {
+            // 获取所有检测人员任务统计
+            const this_ = this
+            const sql = `select  *FROM (SELECT ie.ID_ AS jcId,ie.NAME_ AS jcName,COUNT(tj.zhuang_tai_ = '待数据输入' OR NULL) AS jianCeWeiWanCheng,COUNT(tj.zhuang_tai_ = '待数据校验' OR tj.zhuang_tai_ = '已完成' OR NULL) AS jianCeYiWanCheng FROM 
+                          t_lhjczb tj,ibps_party_employee ie 
+                          WHERE  ie.status_ = 'actived' and ie.group_id_ LIKE '%1040707841519779840%' and tj.jian_ce_yuan_ = ie.ID_ GROUP BY jian_ce_yuan_ 
+                          ) jc  LEFT JOIN 
+                          (
+                          SELECT ie.ID_ AS fhId,ie.NAME_ AS fhName,COUNT(tj.zhuang_tai_ = '待数据校验' OR NULL) AS fuHeWeiWanCheng,COUNT(tj.zhuang_tai_ = '已完成' OR NULL) AS fuHeYiWanCheng FROM 
+                          t_lhjczb tj,ibps_party_employee ie 
+                          WHERE ie.status_ = 'actived' and ie.group_id_ LIKE '%1040707841519779840%' and tj.fu_he_yuan_ = ie.ID_ GROUP BY fu_he_yuan_ 
+                          ) fh ON jc.jcName = fh.fhName
+                          UNION (
+                          SELECT  *FROM (SELECT ie.ID_ AS jcId, ie.NAME_ AS jcName,COUNT(tj.zhuang_tai_ = '待数据输入' OR NULL) AS jianCeWeiWanCheng,COUNT(tj.zhuang_tai_ = '待数据校验' OR tj.zhuang_tai_ = '已完成' OR NULL) AS jianCeYiWanCheng FROM 
+                          t_lhjczb tj,ibps_party_employee ie 
+                          WHERE ie.status_ = 'actived' and tj.jian_ce_yuan_ = ie.ID_ GROUP BY jian_ce_yuan_ 
+                          ) jc  RIGHT JOIN 
+                          (
+                          SELECT ie.ID_ AS fhId,ie.NAME_ AS fhName,COUNT(tj.zhuang_tai_ = '待数据校验' OR NULL) AS fuHeWeiWanCheng,COUNT(tj.zhuang_tai_ = '已完成' OR NULL) AS fuHeYiWanCheng FROM 
+                          t_lhjczb tj,ibps_party_employee ie 
+                          WHERE ie.status_ = 'actived' and ie.group_id_ LIKE '%1040707841519779840%' and tj.fu_he_yuan_ = ie.ID_ GROUP BY fu_he_yuan_ 
+                          ) fh ON jc.jcName = fh.fhName
+                          )`
+            this.option.xAxis.data = []
+            this.option.series[0].data = []
+            this.option.series[1].data = []
+            this.option.series[2].data = []
+            this.option.series[3].data = []
+
+            this.chartData = []
+            let dataAll = []
+            var dataAllName = ''
+            await curdPost('sql', sql)
+                .then((res) => {
+                    const data = res.variables.data
+                    dataAll = data
+                    for (const i of data) {
+                        dataAllName += i.jcName + i.fhName
+                        this_.option.xAxis.data.push(i.jcName ? i.jcName : i.fhName)
+                        // 检测未完成数
+                        this_.option.series[0].data.push(
+                            i.jianCeWeiWanCheng ? i.jianCeWeiWanCheng : 0
+                        )
+                        // 检测已完成数
+                        this_.option.series[1].data.push(
+                            i.jianCeYiWanCheng ? i.jianCeYiWanCheng : 0
+                        )
+                        // 复核未完成数
+                        this_.option.series[2].data.push(
+                            i.fuHeWeiWanCheng ? i.fuHeWeiWanCheng : 0
+                        )
+                        // 复核已完成数
+                        this_.option.series[3].data.push(
+                            i.fuHeYiWanCheng ? i.fuHeYiWanCheng : 0
+                        )
+                        this_.chartData.push(i)
+                    }
+                })
+                .catch((error) => {
+                    console.log(error)
+                })
+            // console.log(dataAllName, '12321')
+            const len = this_.option.xAxis.data.length
+            let wuData = []
+            const sql1 = `select id_,name_ FROM ibps_party_employee WHERE  status_ = 'actived' AND group_id_ LIKE '%1040707841519779840%'`
+            await curdPost('sql', sql1).then((res) => {
+                wuData = res.variables.data
+                if (wuData.length !== len) {
+                    for (const item of wuData) {
+                        if (!dataAllName.includes(item.name_)) {
+                            this_.option.xAxis.data.push(item.name_)
+                            this_.option.series[0].data.push(0)
+                            this_.option.series[1].data.push(0)
+                            this_.option.series[2].data.push(0)
+                            this_.option.series[3].data.push(0)
+                        }
+                    }
+                }
+            })
+        },
+
+        async getTtaskMattersData () {
+            const this_ = this
+
+            this_.optionPerson.xAxis.data = []
+            this_.optionPerson.series[0].data = []
+            this_.optionPerson.series[1].data = []
+            let create_by_ = ''
+            let datary = []
+            let data = []
+            const csData = []
+            let banjie = []
+            let zhancun = []
+            let yiban1 = []
+            let personIds = ''
+            // 待办
+            const sqlry = `select a.id_,a.parent_id_,b.name_,a.zui_gao_xue_li_x_,a.zhi_cheng_deng_ji,b.jian_ding_zi_ge_z,a.ru_zhi_shi_jian_ from  t_ryjbqk as a join  ibps_party_employee as b on a.parent_id_= b.id_ where a.id_ !='861622496187645952' AND b.status_ = 'actived' and  b.GROUP_ID_ != ''`
+            await curdPost('sql', sqlry).then((res) => {
+                datary = res.variables.data
+            })
+            for (const item of datary) {
+                create_by_ += create_by_ + ',' + item.id_
+            }
+            create_by_ = create_by_.slice(0, create_by_.length - 1)
+            const sql = `select  executor_,count(executor_) as num ,c.name_ FROM  IBPS_BPM_TASKS as a join IBPS_BPM_TASK_ASSIGN as b  on a.task_id_ = b.task_id_ join ibps_party_employee as c on b.executor_ = c.id_ and  c.STATUS_= 'actived' and c.ID_ != '1' and c.ID_ != '-1' and c.ID_ != '702117247933480960' and c.GROUP_ID_ not like '%1041786072788369408%'   GROUP BY  executor_ order by c.CREATE_TIME_ asc `
+            await curdPost('sql', sql).then((res) => {
+                data = res.variables.data
+            })
+            for (var i = 0; i < data.length; i++) {
+                this_.optionPerson.xAxis.data.push(data[i].name_)
+                this_.optionPerson.series[0].data.push(data[i].num)
+                if (i === data.length - 1) {
+                    personIds += "'" + data[i].executor_ + "'"
+                } else {
+                    personIds += "'" + data[i].executor_ + "',"
+                }
+            }
+
+            // 超时
+            // const cssql = `select  executor_ ,count(executor_) as num ,c.name_,a.create_time_ FROM  IBPS_BPM_TASKS as a join IBPS_BPM_TASK_ASSIGN as b  on a.task_id_ = b.task_id_ join ibps_party_employee as c on b.executor_ = c.id_
+            //       where now()> SUBDATE(a.create_time_,interval - 3 day) and  c.STATUS_= 'actived' and c.ID_ != '1' and c.ID_ != '-1' and c.ID_ != '702117247933480960' and c.GROUP_ID_ not like '%1041786072788369408%'  GROUP BY  executor_  order by  c.CREATE_TIME_ asc `
+            // await curdPost('sql', cssql).then((res) => {
+            //     csData = res.variables.data
+            // })
+            // for (const it of csData) {
+            //     // this_.optionPerson.series[2].data.push(it.num)
+            //     personIds += "'" + it.executor_ + "',"
+            //     console.log(personIds)
+            // }
+
+            // 办结
+            const banjiesql = `select  count(AUDITOR_) as num, NAME_, AUDITOR_ FROM (select a.PROC_INST_ID_,a.AUDITOR_ ,d.NAME_ from (select * FROM ibps_bpm_approval_his group by PROC_INST_ID_,AUDITOR_) as a join ibps_bpm_inst_his as b on a.PROC_INST_ID_ = b.ID_  join  ibps_party_employee as d on a.AUDITOR_ = d.ID_ ) as aa WHERE AUDITOR_ in(${personIds}) group by AUDITOR_ `
+            await curdPost('sql', banjiesql).then((res) => {
+                banjie = res.variables.data
+            })
+
+            for (const it of banjie) {
+                this_.optionPerson.series[2].data.push(it.num)
+            }
+            // 已办未办结
+            const yibansql2 = `select count(NAME_) as num, NAME_, AUDITOR_  from ( select aa.NAME_,aa.ID_,bb.PROC_INST_ID_,bb.AUDITOR_ from ibps_party_employee as aa left join (select b.AUDITOR_,b.PROC_INST_ID_,b.OPINION_ FROM ibps_bpm_inst as a join ibps_bpm_approval as b on b.PROC_INST_ID_ = a.ID_) as bb on aa.ID_ = bb.AUDITOR_  GROUP BY PROC_INST_ID_, ID_) as zz WHERE ID_ in(${personIds}) group by ID_`
+            await curdPost('sql', yibansql2).then((res) => {
+                yiban1 = res.variables.data
+            })
+
+            for (const items of yiban1) {
+                for (const el of banjie) {
+                    if (items.AUDITOR_ === el.AUDITOR_) {
+                        this_.optionPerson.series[1].data.push(
+                            Number(items.num) + Number(el.num)
+                        )
+                    }
+                }
+            }
+
+            // 暂存
+            const zhancunsql = `select * from ( SELECT aa.num,bb.NAME_,bb.ID_ FROM  ibps_party_employee as bb left join (select count(ID_) as num, NAME_,ID_ FROM (select b.NAME_,b.ID_ FROM (select * FROM ibps_bpm_inst WHERE STATUS_ = 'draft' ) as a join ibps_party_employee as b on b.ID_ = a.CREATE_BY_) as zz  group by NAME_ ) as aa   on bb.ID_ = aa.ID_ ) as cc WHERE ID_ in(${personIds}) `
+            await curdPost('sql', zhancunsql).then((res) => {
+                zhancun = res.variables.data
+            })
+
+            for (const it of zhancun) {
+                this_.optionPerson.series[3].data.push(it.num)
+            }
+        },
         loadData () {
             // let user = this.$store.getters.userInfo
             // let pos, role
@@ -619,15 +1066,38 @@ export default {
                 })
             }).catch(() => { })
         },
-        // 切换tab
-        changeTab () {
+
+        async changeTab () {
             // 数据、筛选条件初始化
             this.dataList = []
             this.paginate = {}
             this.selection = []
             this.typeId = ''
             this.defaultPagination.page = 1
-            this.getData(this.activeTab)
+            if (this.activeTab === 'gr') {
+                // this.getDpmInfo()
+                tabList.forEach((item, index) => {
+                    if (item.key !== 'gr' && item.key !== 'zt') {
+                        operate[item.key](this.getFormatParams(null, this.defaultPagination)).then(response => {
+                            grdata[index].dataText = response.data.pageResult.totalCount
+                        })
+                    }
+                })
+            } else if (this.activeTab === 'zt') {
+                await this.chartLoading()
+                await this.getTtaskMattersData()
+                console.log(this.optionPerson)
+
+                var chartDom1 = document.getElementById('a1')
+                var myChart1 = echarts.init(chartDom1)
+                myChart1.setOption(this.option)
+
+                var chartDom2 = document.getElementById('a2')
+                var myChart2 = echarts.init(chartDom2)
+                myChart2.setOption(this.optionPerson)
+            } else {
+                this.getData(this.activeTab)
+            }
         },
         // 数组去重
         unique (arr) {
@@ -1105,6 +1575,13 @@ export default {
     }
 </style>
 <style>
+    .ibps-desktop-dashboard{
+        padding: 100px 200px;
+
+    }
+    .ibps-desktop-dashboard .item{
+        height: 150px !important;
+    }
     .app-container .el-drawer.rtl {
         overflow: scroll;
     }