| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623 |
- <template>
- <div class="app-container">
- <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 v-if="item.key!=='gr'&&item.key!=='zt'" class="tab-container">
- <div slot="west" class="kind">
- <ibps-type-tree
- :width="width"
- :height="height"
- title=""
- category-key="FLOW_TYPE"
- :has-permission="true"
- @node-click="handleNodeClick"
- @expand-collapse="handleExpandCollapse"
- />
- </div>
- <div class="table-container">
- <div class="search-container">
- <div class="search-box">
- <span class="label">事务名称</span>
- <el-input
- v-model="searchParams.subject"
- class="input"
- placeholder="请输入内容"
- clearable
- @keyup.enter.native="search"
- />
- </div>
- <div class="search-box">
- <span class="label">{{ item.time }}时间</span>
- <el-date-picker
- v-model="searchParams.createTime"
- type="daterange"
- class="input"
- start-placeholder="请选择"
- end-placeholder="请选择"
- size="mini"
- clearable
- @keyup.enter.native="search"
- />
- </div>
- <el-button class="btn" type="primary" @click="search">
- <i class="ibps-icon-search" />查询
- </el-button>
- <el-button v-if="activeTab === 'save'" :key="Date.now() + Math.random()" class="btn" type="danger" @click="remove">
- <i class="ibps-icon-close" />删除
- </el-button>
- </div>
- <el-table
- ref="dataTable"
- v-loading="loading"
- :data="dataList"
- style="color: #000"
- align="center"
- size="mini"
- border
- class="jbd-home-task"
- :row-class-name="tableRowClassName"
- @row-click="handleLinkClick"
- @selection-change="val => selection = val"
- >
- <el-table-column v-if="activeTab === 'save'" :key="Date.now() + Math.random()" type="selection" width="55" />
- <el-table-column
- prop="subject"
- label="事务名称"
- width="250"
- show-overflow-tooltip
- >
- <template slot-scope="scope">{{ scope.row.subject | getWorkInfo('name') }}</template>
- </el-table-column>
- <el-table-column label="事务说明" show-overflow-tooltip>
- <template slot-scope="scope">{{ scope.row.subject | getWorkInfo('desc') }}</template>
- </el-table-column>
- <template v-if="['wait'].includes(activeTab)">
- <el-table-column
- show-overflow-tooltip
- width="120"
- label="事务状态"
- >
- <template slot-scope="scope">{{ '待' + scope.row.name }}</template>
- </el-table-column>
- <el-table-column show-overflow-tooltip width="100">
- <template slot="header" slot-scope="scope">
- <span>办理进度</span>
- <el-tooltip effect="dark" placement="top">
- <div slot="content">
- 1、检验能力范围调整,区分常规、加急、特急情况下的检验时限,以及对应的即将超时时限。检测项目依据项目是否加急及其对应的检验时限判定超时状态,检测报告的超时状态根据报告中检测时限最长的项目判定。
- <br>
- 2、周期性推送事务:每周推送的事务在每周四状态变更为即将超时,次周的周一变更为超时;每月推送的事务在每月20日变更为即将超时,次月1日变更为已超时。
- <br>
- 3、不符合项(含内审)、改进项增加对应的改进截止时间,用于判断是否超时以及即将超时。具体规则为截止日期前7天内状态变更为即将超时,截止日期后变更为已超时。
- <br>
- 4、内审计划以及部分计划(仪器设备的检定、校准计划以及期间核查计划)的推送时间调整,在计划日期前两个月推在计划月的20日变更为即将超时,次月一日变更为已超内审检查表在内市首次会议前3天内状态变更为即将超,首次会议当天状态变更为已超时。
- <br>
- 5、管理评审汇报材料:管理评审的评审时间前7天内变更为即将超时,会议前1天内变更为已超时;管理评审报告编制:管理评审会议纪要提交后7天,状态变更为即将超时,会议纪要提交10天后变更为已超时
- <br>
- 6、岗前培训计划时间前三天变更为即将超时,超过计划培训时间后变更为已超时。
- <br>
- 7、所有超时状态按具体时间计算,不在以上规则内的事务不做超时判走,办理状态固定为待处理。
- </div>
- <i class="el-icon-info" />
- </el-tooltip>
- </template>
- <template slot-scope="scope">
- <el-tag :type="scope.row.state ? stateOption[scope.row.state].type : ''">{{ scope.row.state ? stateOption[scope.row.state].label : '待办理' }}</el-tag>
- </template>
- </el-table-column>
- <el-table-column
- prop="startDept"
- show-overflow-tooltip
- width="120"
- label="发起部门"
- />
- <el-table-column
- :key="Date.now() + Math.random()"
- prop="submitBy"
- show-overflow-tooltip
- width="100"
- >
- <template slot="header" slot-scope="scope">
- <span>发起人</span>
- <el-tooltip effect="dark" placement="top">
- <div slot="content">
- 该事务对应流程的发起人
- </div>
- <i class="el-icon-info" />
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column
- :key="Date.now() + Math.random()"
- prop="forwardBy"
- show-overflow-tooltip
- width="100"
- >
- <template slot="header" slot-scope="scope">
- <span>上节点</span><br>
- <span>提交人</span>
- <el-tooltip effect="dark" placement="top">
- <div slot="content">
- 该事务对应流程上一节点的提交人
- </div>
- <i class="el-icon-info" />
- </el-tooltip>
- </template>
- </el-table-column>
- </template>
- <template v-else-if="['over', 'finish'].includes(activeTab)">
- <el-table-column
- show-overflow-tooltip
- label="事务状态"
- width="100"
- >
- <template slot-scope="scope">{{ scope.row.curNode ? scope.row.status == 'running' ? '已发起' : '已' + scope.row.curNode : contOfValue(scope.row.status) }}</template>
- </el-table-column>
- <el-table-column
- show-overflow-tooltip
- label="发起部门"
- width="100"
- >
- <template slot-scope="scope">{{ getParenthesesStr(scope.row.subject)[1] }}</template>
- </el-table-column>
- <el-table-column
- show-overflow-tooltip
- label="发起人"
- width="100"
- >
- <template slot-scope="scope">{{ scope.row.createBy | getUserName(userList) }}</template>
- </el-table-column>
- <el-table-column
- show-overflow-tooltip
- label="提交人"
- width="100"
- >
- <template slot-scope="scope">{{ getName(scope.row) }}</template>
- </el-table-column>
- </template>
- <el-table-column :key="Date.now() + Math.random()" show-overflow-tooltip width="160">
- <template slot="header" slot-scope="scope">
- <template v-if="['wait'].includes(activeTab)">
- <span>上节点</span><br>
- </template>
- <span>{{ item.time + '时间' }}</span>
- </template>
- <template slot-scope="scope">{{ scope.row[item.field] ? scope.row[item.field].slice(0, 16) : scope.row.createTime.slice(0, 16) }}</template>
- </el-table-column>
- </el-table>
- <div v-if="dataList.length">
- <el-pagination
- :current-page.sync="paginate.page"
- :page-size="paginate.limit"
- layout="total, prev, pager, next"
- :total="paginate.totalCount"
- @current-change="changePage"
- />
- </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"> </div>
- <div class="item-body">
- <h2> </h2>
- </div>
- <p class="item-tip"> </p>
- </div>
- </el-col>
- </template>
- </el-row>
- </el-card>
- </div>
- <div v-if="item.key==='zt'" v-loading="loading">
- <el-row ref="row" :gutter="12">
- <el-col :span="12">
- <div>检测任务统计</div>
- <div id="a1" style="width: 100%; height:600px;" />
- </el-col>
- <el-col :span="12">
- <div>任务事宜统计</div>
- <div id="a2" style="width: 100%;height:600px;" />
- </el-col>
- </el-row>
- </div>
- </el-tab-pane>
- </el-tabs>
- <bpmn-formrender
- :visible="dialogFormVisible"
- :task-id="activeTab === 'wait' ? taskId : null"
- :wai-jian="activeTab === 'wait' ? waiJian : null"
- :instance-id="['over', 'finish'].includes(activeTab) ? instanceId : null"
- :def-id="activeTab === 'save' ? defId : null"
- :pro-inst-id="activeTab === 'save' ? proInstId : null"
- :title="['wait', 'save'].includes(activeTab) ? FlowName : null"
- :process-name="processName"
- @callback="loadData"
- @close="visible => (dialogFormVisible = visible)"
- />
- </div>
- </template>
- <script>
- import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
- import homeCalendar from './home-calendar'
- import { pending, handledTask } from '@/api/platform/office/bpmReceived'
- import { myDraft, removeDraft } from '@/api/platform/office/bpmInitiated'
- import { queryOrgManager } from '@/api/platform/org/employee'
- import { save } from '@/api/platform/message/innerMessage'
- 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 = [
- {
- label: '待办事宜',
- key: 'wait',
- icon: 'el-icon-edit',
- time: '提交',
- field: 'createTime'
- },
- {
- label: '已办事宜',
- key: 'over',
- icon: 'el-icon-document-remove',
- time: '创建',
- field: 'updateTime'
- },
- {
- label: '办结事宜',
- key: 'finish',
- icon: 'el-icon-paperclip',
- time: '结束',
- field: 'updateTime'
- },
- {
- label: '暂存事宜',
- key: 'save',
- 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 = {
- running: '已发起',
- end: '已结束',
- manualend: '人工结束'
- }
- const paramsType = {
- wait: 'temp.',
- over: '',
- finish: 'inst.',
- save: ''
- }
- const stateOption = {
- wait: {
- label: '待办理',
- type: ''
- },
- soon: {
- label: '即将超时',
- type: 'warning'
- },
- overtime: {
- label: '已超时',
- type: 'danger'
- }
- }
- const operate = {
- wait: pending,
- over: handledTask,
- 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 },
- filters: {
- getWorkInfo (v, type) {
- const hasDesc = v.includes('#')
- const res = {
- name: {
- '0': v.includes('{') ? v.split('{')[0] : v.includes('(') ? v.split('(')[0] : v,
- '1': v.split('#')[0]
- },
- // 无#返回空,有#返回(左边的字符串,
- desc: {
- '0': '',
- '1': v.split('#')[1]
- }
- }
- if (!hasDesc) {
- return res[type]['0']
- }
- return res[type]['1']
- },
- getUserName (v, list) {
- const user = list.find(i => i.userId === v)
- return user ? user.userName : ''
- }
- },
- props: {
- plan: {
- type: Array,
- 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: '20%',
- barGap: '20%',
- // barWidth: 20,
- label: {
- show: true,
- position: 'top',
- valueAnimation: true
- },
- itemStyle: {
- normal: {
- color: ['#ee6666']
- }
- }
- },
- {
- name: '检测已完成数',
- type: 'bar',
- data: [],
- barCategoryGap: '20%',
- barGap: '20%',
- // barWidth: 20,
- label: {
- show: true,
- position: 'top',
- valueAnimation: true
- },
- itemStyle: {
- normal: {
- color: ['#91cc75']
- }
- }
- },
- {
- name: '复核未完成数',
- type: 'bar',
- data: [],
- barCategoryGap: '20%',
- barGap: '20%',
- // barWidth: 20,
- label: {
- show: true,
- position: 'top',
- valueAnimation: true
- },
- itemStyle: {
- normal: {
- color: ['#fac858']
- }
- }
- },
- {
- name: '复核已完成数',
- type: 'bar',
- data: [],
- barCategoryGap: '20%',
- barGap: '20%',
- // barWidth: 20,
- 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: [],
- barCategoryGap: '20%',
- barGap: '20%',
- // barWidth: 20,
- label: {
- show: true,
- position: 'top',
- offset: [0, 0],
- valueAnimation: true
- },
- itemStyle: {
- normal: {
- color: ['#3598dc']
- }
- }
- },
- {
- name: '已办事宜数',
- type: 'bar',
- data: [],
- barCategoryGap: '20%',
- barGap: '20%',
- // barWidth: 20,
- label: {
- show: true,
- position: 'top',
- offset: [-5, -5],
- valueAnimation: true
- },
- itemStyle: {
- normal: {
- color: ['#32c5d2']
- }
- }
- },
- {
- name: '办结事宜',
- type: 'bar',
- data: [],
- barCategoryGap: '20%',
- barGap: '20%',
- // barWidth: 20,
- label: {
- show: true,
- position: 'top',
- offset: [4, 4],
- valueAnimation: true
- },
- itemStyle: {
- normal: {
- color: ['#1bbc9b']
- }
- }
- },
- {
- name: '暂存事宜',
- type: 'bar',
- data: [],
- barCategoryGap: '20%',
- barGap: '20%',
- // barWidth: 20,
- label: {
- show: true,
- position: 'top',
- offset: [0, 0],
- valueAnimation: true
- },
- itemStyle: {
- normal: {
- color: ['#3598dc']
- }
- }
- }
- ]
- },
- grdata,
- tabList,
- stateOption,
- dataList: [],
- paginate: {},
- searchParams: {
- typeId: '',
- subject: '',
- createTime: ''
- },
- selection: [],
- taskId: '', // 编辑dialog需要使用
- waiJian: '', // 编辑dialog需要使用
- instanceId: '',
- defId: '',
- proInstId: '',
- loading: false,
- drawer: false,
- dialogFormVisible: false,
- orgName: '',
- roleName: '',
- FlowName: '',
- posName: '',
- defaultPagination: { page: 1, limit: 15 },
- sorts: { CREATE_TIME_: 'DESC' },
- timer: null,
- processName: '',
- userList: [],
- orgInfo: {},
- activeTab: 'wait',
- width: 250,
- height: document.body.clientHeight - 130
- }
- },
- mounted: function () {
- this.loadData()
- this.getUserList()
- this.getOrgInfo()
- if (this.timer) {
- clearInterval(this.timer)
- }
- // 轮询刷新公告数据和任务数据
- this.timer = setInterval(() => {
- // 仅待办事宜自动更新数据
- if (this.activeTab === 'wait') {
- this.getData(this.activeTab)
- }
- }, 30 * 1000)
- },
- beforeDestroy () {
- clearInterval(this.timer)
- },
- // 路由离开时
- beforeRouteLeave (to, from, next) {
- 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
- // this.orgName = user.employee.orgName
- // for (let i in user.positions) {
- // if (i == 0) pos = user.positions[0].name
- // else pos = pos + ',' + user.positions[i].name
- // }
- // let contRole = this.unique(user.role) //去重
- // for (let i in contRole) {
- // if (i == 0) role = contRole[0].name
- // else role = role + ',' + contRole[i].name
- // }
- // this.posName = pos
- // this.roleName = role
- // this.getMessage()
- // 获取任务数据
- this.getData(this.activeTab)
- },
- // 获取系统用户信息
- getUserList () {
- const { userList } = this.$store.getters
- // store中有则无需请求
- if (userList && userList.length) {
- this.userList = userList
- return
- }
- const sql = 'select id_ as userId, name_ as userName, mobile_ as phone from ibps_party_employee'
- curdPost('sql', sql).then(res => {
- this.userList = res.variables && res.variables.data
- })
- },
- // 获取用户部门信息
- getOrgInfo () {
- const { org = {}} = this.$store.getters
- if (!org || !org.id) {
- return
- }
- const params = {
- parameters: [{ key: 'Q^MANAGER_ORG_ID_^S', value: org.id }]
- }
- queryOrgManager(params).then(res => {
- this.orgInfo = {}
- const data = res.data.dataResult
- if (data && data.length) {
- const { id, name, mobile, account, gender, groupID } = data[0]
- this.orgInfo = { id, name, mobile, account, gender, groupID, orgName: org.name }
- }
- })
- },
- handleNodeClick (typeId) {
- this.dataList = []
- this.paginate = {}
- this.searchParams.typeId = typeId
- this.loadData()
- },
- handleExpandCollapse (isExpand) {
- this.width = isExpand ? 230 : 30
- },
- getName ({ createBy, updateBy }) {
- const id = updateBy || createBy
- const { name = '' } = this.$store.getters
- if (this.activeTab === 'finish') {
- const t = this.userList.find(i => i.userId === id)
- return t ? t.userName : ''
- }
- return name
- },
- tableRowClassName ({ row, rowIndex }) {
- if (rowIndex % 2 === 1) return 'warning-row'
- return 'success-row'
- },
- // 获取表格数据
- getData (type) {
- this.loading = true
- operate[this.activeTab](this.getFormatParams(null, this.defaultPagination, null)).then(response => {
- const { dataResult, pageResult } = response.data
- if (dataResult && dataResult.length) {
- // 待办事宜对任务发起人做额外处理
- if (type === 'wait') {
- const instList = []
- dataResult.forEach(item => {
- instList.push(item.bpmnInstId)
- })
- const sql = `select b.bpmn_inst_id_, b.create_by_, a.name_ from ibps_bpm_inst b left join ibps_party_employee a on a.id_ = b.create_by_ where b.bpmn_inst_id_ in (${instList.join(',')}) order by find_in_set(b.bpmn_inst_id_,'${instList.join(',')}')`
- const currentTime = Date.now()
- curdPost('sql', sql).then(res => {
- const data = res.variables && res.variables.data
- data.forEach((item, index) => {
- dataResult[index].submitBy = item.name_
- dataResult[index].workName = dataResult[index].subject.includes('#') ? dataResult[index].subject.split('#')[0] : dataResult[index].subject.split('(')[0]
- dataResult[index].workType = this.plan.includes(dataResult[index].procDefKey) ? 'plan' : 'normal'
- if (dataResult[index].procDefKey === 'Process_0idt26n' || dataResult[index].procDefKey === 'Process_05lkhio' || dataResult[index].procDefKey === 'Process_1rwhy1r' || dataResult[index].procDefKey === 'Process_140upmu' || dataResult[index].procDefKey === 'Process_0bx4cg1') {
- // 检测项目,检测报告办理进度处理
- const time = dataResult[index].subject.match(/收样日期:(.*?),/) ? dataResult[index].subject.match(/收样日期:(.*?),/)[1] : null
- const dataNum = dataResult[index].subject.match(/检测时限:(.*?),/) ? dataResult[index].subject.match(/检测时限:(.*?),/)[1] : null
- if (time && dataNum) {
- const j = Math.round(dataNum / 3 * 2) > 1 ? Math.ceil(dataNum / 3 * 2) - 1 : 0
- const currentTime = new Date().getTime()
- const soonTime = new Date(time).setDate(new Date(time).getDate() + j)
- const overtimeTime = new Date(time).setDate(new Date(time).getDate() + Number(dataNum))
- // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime), dataNum, j)
- dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
- }
- } else if (dataResult[index].procDefKey === 'Process_0oo8gzf') {
- // 周期性推送事务办理进度处理-周
- const time = dataResult[index].createTime.match(/\d{4}-\d{2}-\d{2}/g) ? dataResult[index].createTime.match(/\d{4}-\d{2}-\d{2}/)[0] : null
- if (time) {
- const currentTime = new Date().getTime()
- const soonTime = new Date(this.getWeekDataList(time)[3] + ' 01:00:00').getTime()
- const overtimeTime = new Date(this.getWeekDataList(time)[7] + ' 01:00:00').getTime()
- // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
- dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
- }
- } else if (dataResult[index].procDefKey === 'Process_1h50uwi' || dataResult[index].procDefKey === 'Process_0x3emzx') {
- // 周期性推送事务办理进度处理-月
- const time = dataResult[index].createTime.match(/\d{4}-\d{2}-\d{2}/g) ? dataResult[index].createTime.match(/\d{4}-\d{2}-\d{2}/)[0] : null
- if (time) {
- const currentTime = new Date().getTime()
- const soonTime = this.getMonthDataList(time)[0].getTime()
- const overtimeTime = this.getMonthDataList(time)[1].getTime()
- // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
- dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
- }
- } else if (dataResult[index].procDefKey === 'Process_0mn0pk4' || dataResult[index].procDefKey === 'Process_1ve13oo') {
- // 改进不符合项
- const time = dataResult[index].subject.match(/改进截至日期:(.*?)#/) ? dataResult[index].subject.match(/改进截至日期:(.*?)#/)[1] + ' 00:00:00' : null
- if (time) {
- const currentTime = new Date().getTime()
- const soonTime = new Date(time).setDate(new Date(time).getDate() - 7)
- const overtimeTime = new Date(time).setDate(new Date(time).getDate() + 1)
- // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
- dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
- }
- } else if (dataResult[index].procDefKey === 'Process_0w9fzlq') {
- // 管理评审汇报材料 计划评审时间
- const time = dataResult[index].subject.match(/评审时间:(.*?),/) ? dataResult[index].subject.match(/评审时间:(.*?),/)[1] + ' 00:00:00' : null
- if (time) {
- const currentTime = new Date().getTime()
- const soonTime = new Date(time).setDate(new Date(time).getDate() - 7)
- const overtimeTime = new Date(time).setDate(new Date(time).getDate() - 1)
- // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
- dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
- }
- } else if (dataResult[index].procDefKey === 'Process_129f4hh') {
- // 管理评审报告编制 纪要提交时间
- const time = dataResult[index].createTime
- if (time) {
- const currentTime = new Date().getTime()
- const soonTime = new Date(time).setDate(new Date(time).getDate() + 7)
- const overtimeTime = new Date(time).setDate(new Date(time).getDate() + 10)
- // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
- dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
- }
- } else if (dataResult[index].procDefKey === 'Process_1c7w93s') {
- // 年度人员培训计划 生成记录定时任务
- const time = dataResult[index].subject.match(/计划时间:(.*?)#/) ? dataResult[index].subject.match(/计划时间:(.*?)#/)[1] + ' 00:00:00' : null
- if (time) {
- const currentTime = new Date().getTime()
- const soonTime = new Date(time).setDate(new Date(time).getDate() - 3)
- const overtimeTime = new Date(time).setDate(new Date(time).getDate() + 1)
- // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
- dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
- }
- } else if (dataResult[index].procDefKey === 'Process_1aamj6j' || dataResult[index].procDefKey === 'Activity_0drpspe') {
- // 设备检定,期间核查
- const time = dataResult[index].subject.match(/(?<=计划日期:)\d{4}-\d{2}-\d{2}/g) ? dataResult[index].subject.match(/(?<=计划日期:)\d{4}-\d{2}-\d{2}/)[0] : null
- if (time) {
- const currentTime = new Date().getTime()
- const soonTime = this.getMonthDataList(time)[0].getTime()
- const overtimeTime = this.getMonthDataList(time)[1].getTime()
- console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
- dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
- }
- } else if (dataResult[index].procDefKey === 'Process_1q2uqjq') {
- // 内审检查表 常规附加
- const time = dataResult[index].subject.match(/(?<=首次会议开始时间:)\d{4}-\d{2}-\d{2}/g) ? dataResult[index].subject.match(/(?<=首次会议开始时间:)\d{4}-\d{2}-\d{2}/)[0] : null
- if (time) {
- const currentTime = new Date().getTime()
- const soonTime = new Date(time).setDate(new Date(time).getDate() - 3)
- const overtimeTime = new Date(time).setDate(new Date(time).getDate())
- // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
- dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
- }
- } else {
- dataResult[index].state = 'wait'
- }
- // else {
- // dataResult[index].state = this.judgeExpire(dataResult[index].createTime, currentTime, dataResult[index].workType, '1')
- // }
- // console.log(dataResult[index].procDefKey, dataResult[index].state)
- })
- this.dataList = dataResult.sort((a, b) => b.createTime.localeCompare(a.createTime))
- this.paginate = pageResult
- })
- // this.urgeToManager()
- } else {
- this.dataList = dataResult
- this.paginate = pageResult
- }
- }
- this.loading = false
- }).catch(() => {
- this.loading = false
- // 请求出错清除轮询
- clearInterval(this.timer)
- })
- },
- // 延迟更新列表数据
- updateList () {
- setTimeout(() => {
- this.getData(this.activeTab)
- }, 750)
- },
- // 查询
- search () {
- this.dataList = []
- this.paginate = {}
- this.getData(this.activeTab)
- },
- // 删除暂存数据
- remove () {
- if (!this.selection.length) {
- this.$message.warning('请选择暂存事务!')
- return
- }
- const idList = []
- this.selection.forEach(i => idList.push(i.id))
- ActionUtils.removeRecord(idList).then(ids => {
- removeDraft({ ids }).then(() => {
- ActionUtils.removeSuccessMessage()
- this.selection = []
- this.search()
- })
- }).catch(() => { })
- },
- async changeTab () {
- // 数据、筛选条件初始化
- this.dataList = []
- this.paginate = {}
- this.selection = []
- this.typeId = ''
- this.defaultPagination.page = 1
- if (this.activeTab === 'gr') {
- // this.getDpmInfo()
- tabList.forEach((item, index) => {
- if (item.key !== 'gr' && item.key !== 'zt') {
- let finish = ''
- if (item.key === 'finish') {
- finish = 'finish'
- }
- operate[item.key](this.getFormatParams(null, this.defaultPagination, finish)).then(response => {
- grdata[index].dataText = response.data.pageResult.length > 0 ? '0' : response.data.pageResult.totalCount
- })
- }
- })
- } else if (this.activeTab === 'zt') {
- this.loading = true
- setTimeout(() => {
- this.loading = false
- }, 30000)
- 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)
- this.loading = false
- } else {
- this.getData(this.activeTab)
- }
- },
- // 数组去重
- unique (arr) {
- const res = new Map()
- return arr.filter(arr => !res.has(arr.id) && res.set(arr.id, 1))
- },
- // 分页
- changePage (val) {
- this.dataList = []
- this.paginate = {}
- this.defaultPagination.page = val
- this.getData(this.activeTab)
- },
- // 转换状态码
- contOfValue (cont) {
- const s = taskState[cont]
- return s || '暂停'
- },
- getFormatParams (v, pagination, finish) {
- const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
- if (this.$utils.isNotEmpty(this.searchParams.typeId)) {
- params[`Q^${paramsType[this.activeTab]}TYPE_ID_^S`] = this.searchParams.typeId
- }
- if (this.$utils.isNotEmpty(this.searchParams.subject)) {
- params[`Q^${paramsType[this.activeTab]}subject_^SL`] = this.searchParams.subject
- }
- if (this.searchParams.createTime && this.searchParams.createTime.length) {
- params[`Q^${paramsType[this.activeTab]}create_time_^DL`] = dateFormat(this.searchParams.createTime[0]).slice(0, 10)
- params[`Q^${paramsType[this.activeTab]}create_time_^DG`] = dateFormat(this.searchParams.createTime[1]).slice(0, 10)
- }
- if (this.activeTab === 'finish' || finish == 'finish') {
- params.end = '1'
- }
- return ActionUtils.formatParams(params, pagination, this.sorts)
- },
- // 处理表格点击事件
- handleLinkClick (data) {
- this.taskId = data.id || ''
- this.waiJian = data.waiJian || ''
- this.instanceId = data.id || ''
- this.defId = data.procDefId || ''
- this.proInstId = data.id || ''
- this.FlowName = data.name
- this.processName = this.getProjectName(data.procDefKey, data.subject)
- this.dialogFormVisible = true
- },
- // 开关右侧栏抽屉
- handleClose () {
- this.drawer = !this.drawer
- },
- // 文字替换
- getParenthesesStr (text) {
- let result = ''
- if (!text) return result
- const regex1 = /\{(.+?)\}/g
- const regex2 = /\((.+?)\)/g
- const options1 = text.match(regex1)
- const options2 = text.match(regex2)
- const options = options1 && options1.length ? options1 : options2
- if (options) {
- const option = options[0]
- if (option) {
- result = option.substring(1, option.length - 1)
- }
- if (options[1]) {
- const yersOption = options[1]
- if (yersOption) {
- result = result + '/' + yersOption.substring(1, yersOption.length - 1)
- }
- }
- }
- return result.split('/')
- },
- // 判断是否为检测项目流程,是则截取流程标题为表单名称
- getProjectName (key, subject) {
- // 从store中获取保存的检测流程信息数组,默认设置已知的四个流程key(三非通用一通用),流程key有变化需修改此处默认值
- const { testingList = ['Process_0idt26n', 'Process_1rwhy1r', 'Process_05lkhio', 'Process_140upmu'] } = this.$store.getters
- const res = testingList.includes(key)
- return res ? subject.includes('#') ? subject.split('#')[0] : '' : ''
- },
- /**
- * 主管提醒
- * 数据处理,将所有待办数据根据是否过期处理为两个数组
- * 过期判断依据:普通事务-创建时间到当前时间超过三天即为过期;计划事务【事务名称中含计划】-创建当月月末前七天
- * 逻辑说明:过期数组中不存于在主管提醒表中的数据插入主管提醒表,并发送内部通知,主管提醒表删除不存在于未过期数组中的数据
- */
- urgeToManager () {
- const { userId } = this.$store.getters
- const params = {
- parameters: [],
- sorts: []
- }
- const sql = `select id_, shi_wu_id_ as taskId from t_gqswb where position('${userId}' in chu_li_ren_id_) FOR UPDATE`
- // Promise.all([pending(params), curdPost('sql', sql)]).then(([res1, res2]) => {
- // let workData = res1.data && res1.data.dataResult
- // let noticeData = res2.variables && res2.variables.data
- // if (!workData || !workData.length) {
- // return
- // }
- // this.dealData(workData, noticeData)
- // })
- pending(params).then(res1 => {
- const workData = res1.data && res1.data.dataResult
- curdPost('sql', sql).then(res2 => {
- const noticeData = res2.variables && res2.variables.data
- if (!workData || !workData.length) {
- return
- }
- this.dealData(workData, noticeData)
- })
- })
- },
- // 处理数据
- dealData (workList, noticeList) {
- const result = {
- expire: [],
- unexpire: [],
- all: []
- }
- const currentTime = Date.now()
- // 筛选已过期数据
- workList.forEach(item => {
- // 截取流程名
- item.workName = item.subject.includes('#') ? item.subject.split('#')[0] : item.subject.split('(')[0]
- item.workType = this.plan.includes(item.procDefKey) ? 'plan' : 'normal'
- const isExpire = this.judgeExpire(item.createTime, currentTime, item.workType)
- if (isExpire) {
- result.expire.push(item)
- } else {
- result.unexpire.push(item)
- }
- result.all.push(item)
- })
- // console.log('处理后数据:', result)
- // 有过期数据才执行过期数据处理
- if (result.expire.length) {
- this.dealExpile(result.expire, noticeList)
- }
- // 主管提醒表中有数据才执行数据删除
- if (noticeList && noticeList.length) {
- this.dealUnexpile(result.all, noticeList)
- }
- },
- // 判断是否过期、获取办理状态
- judgeExpire (time, current, type, isState) {
- const D = new Date(time)
- const a = new Date(time).getTime()
- const b = new Date(current).getTime()
- // 创建时间当月最后一天的时间戳
- const c = new Date(D.getFullYear(), D.getMonth() + 1, 0).getTime() + 86400000
- // 返回办理状态
- if (isState) {
- let state = ''
- if (type === 'plan') {
- state = b >= c ? 'overtime' : b + (86400000 * 7) > c ? 'soon' : 'wait'
- } else {
- state = a + (86400000 * 3) < b ? 'overtime' : 'wait'
- }
- return state
- }
- // 返回是否过期
- if (type === 'plan') {
- return b + (86400000 * 7) > c
- } else {
- return a + (86400000 * 3) < b
- }
- },
- // 处理已过期数据
- dealExpile (data, noticeList) {
- // console.log('已过期流程数据:', data)
- // console.log('过期事务表数据:', noticeList)
- const { userId } = this.$store.getters
- const addList = []
- const sendList = []
- const msgContent = {
- plan: '距离过期还剩七天,请及时处理!',
- normal: '至今三天未处理,已超时,请及时处理!'
- }
- const msgTitle = {
- plan: '计划事务即将到期提醒',
- normal: '事务超时提醒'
- }
- const nowTime = new Date(new Date().getTime() + 28800000).toJSON().slice(0, 16).replace('T', ' ')
- data.forEach(item => {
- const isExist = !!noticeList.find(i => i.taskId === item.taskId)
- // 筛选出不存在于主管提醒表的过期数据
- if (!isExist) {
- // 无部门信息的用户不往过期事务表加数据
- if (this.orgInfo.groupID) {
- const obj = {
- // 事务ID
- shi_wu_id_: item.taskId,
- // 完整名称
- wan_zheng_ming_ch: item.subject,
- // 事务说明
- shi_wu_shuo_ming_: item.subject.includes('#') ? item.subject.split('#')[1] : '',
- // 事务名称
- shi_wu_ming_cheng: item.workName,
- // 事务状态
- shi_wu_zhuang_tai: `待${item.name}`,
- // 事务类型
- shi_wu_lei_xing_: item.workType,
- chu_li_ren_ming_: item.ownerName,
- chu_li_ren_id_: this.getInfoByName(item.ownerName, 'id'),
- chu_li_ren_dian_h: this.getInfoByName(item.ownerName, 'phone'),
- bu_men_: this.orgInfo.orgName,
- bu_men_id_: this.orgInfo.groupID,
- // 主管ID与当前用户id相等时将主管ID设置为主任【】的ID,主管电话设为空
- zhu_guan_id_: this.orgInfo.id === userId ? '990927120278487040' : this.orgInfo.id,
- zhu_guan_dian_hua: this.orgInfo.id === userId ? '' : this.orgInfo.mobile,
- bian_zhi_shi_jian: item.createTime,
- ti_xing_ci_shu_: 1,
- duan_xin_ci_shu_: 0,
- ti_xing_shi_jian_: nowTime
- }
- addList.push(obj)
- }
- const msg = {
- subject: msgTitle[item.workType],
- content: `<p>事务【${item.workName}】${msgContent[item.workType]}<p>`,
- receiverId: userId,
- canreply: '0',
- taskId: item.taskId
- }
- sendList.push(msg)
- }
- })
- const addParams = {
- tableName: 't_gqswb',
- paramWhere: addList
- }
- // console.log('新增过期事务表数据:', addList, '发送消息数据', sendList)
- if (addList.length) {
- curdPost('add', JSON.stringify(addParams))
- }
- if (sendList.length) {
- this.sendMsg(sendList)
- }
- },
- // 删除已办的提醒表数据
- dealUnexpile (data, noticeList) {
- // 清除存在于主管提醒表中【处理人含我】,但是不存在于待办中的数据
- const deleteList = []
- noticeList.forEach(item => {
- const isExist = !!data.find(i => i.taskId === item.taskId)
- if (!isExist) {
- deleteList.push(item.id_)
- }
- })
- // console.log('过期事务表中需删除的数据:', deleteList)
- if (!deleteList.length) {
- return
- }
- const params = `{"tableName": "t_gqswb","paramWhere":"{id_:'${deleteList.join(',')}'}"}`
- curdPost('batchDelete', params).then(() => {}).catch(err => {
- console.log(err)
- })
- },
- // 发送站内消息
- sendMsg (data) {
- data.forEach(item => {
- save(item).then(() => {}).catch(err => {
- console.log(err)
- })
- })
- },
- // 通过名字获取id/电话
- getInfoByName (names, type) {
- const res = {
- id: [],
- phone: []
- }
- const temp = names.split(',')
- temp.forEach(item => {
- const t = this.userList.find(i => i.userName === item)
- if (t) {
- res.id.push(t.userId)
- res.phone.push(t.phone)
- }
- })
- return res[type].filter(i => i).join(',')
- },
- // 时间戳转时间
- TimestampToDate2 (Timestamp) {
- const now = new Date(Timestamp)
- const y = now.getFullYear()
- const m = now.getMonth() + 1
- const d = now.getDate()
- return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) + ' ' + now.toTimeString().substr(0, 8)
- },
- // 根据指定日期获取本周一到下周一日期
- getWeekDataList (data) {
- // 根据日期获取本周周一~周日的年-月-日
- var weekList = []
- var date = new Date(data)
- // 判断本日期是否为周日,获取本周一日期
- if (date.getDay() === '0') {
- date.setDate(date.getDate() - 6)
- } else {
- date.setDate(date.getDate() - date.getDay() + 1)
- }
- var myDate = date.getDate()
- var myMonth = date.getMonth() + 1
- if (date.getDate() < 10) {
- myDate = '0' + myDate
- }
- if (date.getMonth() + 1 < 10) {
- myMonth = '0' + myMonth
- }
- weekList.push(date.getFullYear() + '-' + myMonth + '-' + myDate)
- // 获取周二到下周一日期
- for (var i = 0; i < 7; i++) {
- date.setDate(date.getDate() + 1)
- myDate = date.getDate()
- myMonth = date.getMonth() + 1
- if (date.getDate() < 10) {
- myDate = '0' + myDate
- }
- if (date.getMonth() + 1 < 10) {
- myMonth = '0' + myMonth
- }
- weekList.push(date.getFullYear() + '-' + myMonth + '-' + myDate)
- }
- // console.log(weekList)
- return weekList
- },
- // 根据指定日期获取本本月20号下月1号日期
- getMonthDataList (data) {
- var date = new Date(data)
- // 获取该日期所在的年份和月份
- var year = date.getFullYear()
- var month = date.getMonth() // 注意:月份是从0开始的,所以10月是9
- // 创建一个新的日期对象,设置为该年的该月的20号
- var twentyFifth = new Date(year, month, 20, 1, 0, 0)
- // 计算下个月的年份和月份
- var nextMonth = month + 1
- var nextMonthYear = year
- if (nextMonth > 11) { // 如果月份超过11(即12月),则年份加1,月份重置为0(即1月)
- nextMonth = 0
- nextMonthYear += 1
- }
- // 创建一个新的日期对象,设置为下个月的1号
- var firstDayOfNextMonth = new Date(nextMonthYear, nextMonth, 1, 1, 0, 0)
- // console.log(twentyFifth, firstDayOfNextMonth)
- return [twentyFifth, firstDayOfNextMonth]
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .el-completing {
- background: #409eff !important;
- }
- .el-col {
- min-height: 1px;
- }
- .firstcol {
- padding-right: 10px;
- }
- .el-nothing {
- font-size: 13px;
- }
- .calendar-day {
- text-align: center;
- color: #202535;
- line-height: 30px;
- font-size: 12px;
- }
- .is-selected {
- color: #f8a535;
- font-size: 10px;
- margin-top: 5px;
- }
- #calendar .el-button-group > .el-button:not(:first-child):not(:last-child):after {
- content: '当月';
- }
- #calendar .item {
- position: relative;
- margin: 0;
- padding: 0;
- height: auto;
- border-radius: 4px;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- overflow: hidden;
- color: #f8a535;
- }
- .ibps-list-split .ibps-list-item {
- border-bottom: 1px solid #dcdfe6;
- padding: 6px 0;
- }
- .jbd-font-style {
- font-weight: bold;
- }
- .home-text-border {
- color: #999999;
- box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.1), 0 0 0 0 rgba(0, 0, 0, 0.1), 0 0 0 0 rgba(0, 0, 0, 0.1), 0 1px 0px 0 rgba(0, 0, 0, 0.1);
- min-height: 20px;
- font-size: 14px;
- margin-left: 60px;
- margin-bottom: 5px;
- }
- .jbd-home-card {
- overflow: auto;
- }
- .jbd-home-task {
- width: 100%;
- padding: 10px;
- cursor: pointer;
- font-size: 12px;
- margin-bottom: 35px;
- }
- .jbd-home-card::-webkit-scrollbar {
- display: none;
- }
- .jbd-control-cont {
- text-align: center;
- position: absolute;
- z-index: 10;
- right: 0px;
- top: 50%;
- }
- .tab-container {
- >div {
- display: inline-block;
- }
- .table-container {
- width: calc(100% - 250px);
- vertical-align: top;
- .search-container {
- display: flex;
- margin-bottom: 10px;
- .search-box {
- display: flex;
- align-items: center;
- height: 30px;
- margin-right: 20px;
- .label {
- margin: 0 6px 0 6px;
- color: #606266;
- font-size: 12px;
- }
- .input {
- width: 200px;
- font-size: 12px;
- height: 28px !important;
- line-height: 28px;
- color: #606266;
- ::v-deep .el-input__inner {
- height: 28px;
- line-height: 28px;
- }
- }
- }
- .btn {
- height: 30px;
- margin-left: 10px;
- background-color: #409eff;
- border-color: #409eff;
- font-size: 12px;
- border-radius: 3px;
- padding: 7px 15px;
- }
- .el-button--danger {
- background-color: #f56c6c;
- border-color: #f56c6c;
- }
- }
- }
- }
- </style>
- <style>
- .ibps-desktop-dashboard{
- padding: 100px 200px;
- }
- .ibps-desktop-dashboard .item{
- height: 150px !important;
- }
- .app-container .el-drawer.rtl {
- overflow: scroll;
- }
- .app-container .el-table th {
- background-color: #a7d6f8 !important;
- font-size: 14px;
- font-weight: bold;
- color: #000000;
- border: 0px;
- }
- .app-container .el-table td {
- padding: 4px;
- }
- .app-container .el-table .warning-row {
- background: #d3ebfc;
- color: #000000;
- }
- .app-container .el-table .success-row {
- background: #f9ffff;
- color: #000000;
- }
- </style>
|