new-home.vue 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606
  1. <template>
  2. <div class="app-container">
  3. <el-tabs v-model="activeTab" @tab-click="changeTab">
  4. <el-tab-pane v-for="item in tabList" :key="item.key" :name="item.key">
  5. <span slot="label"><i :class="item.icon" /> {{ item.label }}</span>
  6. <div v-if="item.key!=='gr'&&item.key!=='zt'" class="tab-container">
  7. <div slot="west" class="kind">
  8. <ibps-type-tree
  9. :width="width"
  10. :height="height"
  11. title=""
  12. category-key="FLOW_TYPE"
  13. :has-permission="true"
  14. @node-click="handleNodeClick"
  15. @expand-collapse="handleExpandCollapse"
  16. />
  17. </div>
  18. <div class="table-container">
  19. <div class="search-container">
  20. <div class="search-box">
  21. <span class="label">事务名称</span>
  22. <el-input
  23. v-model="searchParams.subject"
  24. class="input"
  25. placeholder="请输入内容"
  26. clearable
  27. @keyup.enter.native="search"
  28. />
  29. </div>
  30. <div class="search-box">
  31. <span class="label">{{ item.time }}时间</span>
  32. <el-date-picker
  33. v-model="searchParams.createTime"
  34. type="daterange"
  35. class="input"
  36. start-placeholder="请选择"
  37. end-placeholder="请选择"
  38. size="mini"
  39. clearable
  40. @keyup.enter.native="search"
  41. />
  42. </div>
  43. <el-button class="btn" type="primary" @click="search">
  44. <i class="ibps-icon-search" />查询
  45. </el-button>
  46. <el-button v-if="activeTab === 'save'" :key="Date.now() + Math.random()" class="btn" type="danger" @click="remove">
  47. <i class="ibps-icon-close" />删除
  48. </el-button>
  49. </div>
  50. <el-table
  51. ref="dataTable"
  52. v-loading="loading"
  53. :data="dataList"
  54. style="color: #000"
  55. align="center"
  56. size="mini"
  57. border
  58. class="jbd-home-task"
  59. :row-class-name="tableRowClassName"
  60. @row-click="handleLinkClick"
  61. @selection-change="val => selection = val"
  62. >
  63. <el-table-column v-if="activeTab === 'save'" :key="Date.now() + Math.random()" type="selection" width="55" />
  64. <el-table-column
  65. prop="subject"
  66. label="事务名称"
  67. width="250"
  68. show-overflow-tooltip
  69. >
  70. <template slot-scope="scope">{{ scope.row.subject | getWorkInfo('name') }}</template>
  71. </el-table-column>
  72. <el-table-column label="事务说明" show-overflow-tooltip>
  73. <template slot-scope="scope">{{ scope.row.subject | getWorkInfo('desc') }}</template>
  74. </el-table-column>
  75. <template v-if="['wait'].includes(activeTab)">
  76. <el-table-column
  77. show-overflow-tooltip
  78. width="120"
  79. label="事务状态"
  80. >
  81. <template slot-scope="scope">{{ '待' + scope.row.name }}</template>
  82. </el-table-column>
  83. <el-table-column show-overflow-tooltip width="100">
  84. <template slot="header" slot-scope="scope">
  85. <span>办理进度</span>
  86. <el-tooltip effect="dark" placement="top">
  87. <div slot="content">
  88. 1、检验能力范围调整,区分常规、加急、特急情况下的检验时限,以及对应的即将超时时限。检测项目依据项目是否加急及其对应的检验时限判定超时状态,检测报告的超时状态根据报告中检测时限最长的项目判定。
  89. <br>
  90. 2、周期性推送事务:每周推送的事务在每周四状态变更为即将超时,次周的周一变更为超时;每月推送的事务在每月20日变更为即将超时,次月1日变更为已超时。
  91. <br>
  92. 3、不符合项(含内审)、改进项增加对应的改进截止时间,用于判断是否超时以及即将超时。具体规则为截止日期前7天内状态变更为即将超时,截止日期后变更为已超时。
  93. <br>
  94. 4、内审计划以及部分计划(仪器设备的检定、校准计划以及期间核查计划)的推送时间调整,在计划日期前两个月推在计划月的20日变更为即将超时,次月一日变更为已超内审检查表在内市首次会议前3天内状态变更为即将超,首次会议当天状态变更为已超时。
  95. <br>
  96. 5、管理评审汇报材料:管理评审的评审时间前7天内变更为即将超时,会议前1天内变更为已超时;管理评审报告编制:管理评审会议纪要提交后7天,状态变更为即将超时,会议纪要提交10天后变更为已超时
  97. <br>
  98. 6、岗前培训计划时间前三天变更为即将超时,超过计划培训时间后变更为已超时。
  99. <br>
  100. 7、所有超时状态按具体时间计算,不在以上规则内的事务不做超时判走,办理状态固定为待处理。
  101. </div>
  102. <i class="el-icon-info" />
  103. </el-tooltip>
  104. </template>
  105. <template slot-scope="scope">
  106. <el-tag :type="scope.row.state ? stateOption[scope.row.state].type : ''">{{ scope.row.state ? stateOption[scope.row.state].label : '待办理' }}</el-tag>
  107. </template>
  108. </el-table-column>
  109. <el-table-column
  110. prop="startDept"
  111. show-overflow-tooltip
  112. width="120"
  113. label="发起部门"
  114. />
  115. <el-table-column
  116. :key="Date.now() + Math.random()"
  117. prop="submitBy"
  118. show-overflow-tooltip
  119. width="100"
  120. >
  121. <template slot="header" slot-scope="scope">
  122. <span>发起人</span>
  123. <el-tooltip effect="dark" placement="top">
  124. <div slot="content">
  125. 该事务对应流程的发起人
  126. </div>
  127. <i class="el-icon-info" />
  128. </el-tooltip>
  129. </template>
  130. </el-table-column>
  131. <el-table-column
  132. :key="Date.now() + Math.random()"
  133. prop="forwardBy"
  134. show-overflow-tooltip
  135. width="100"
  136. >
  137. <template slot="header" slot-scope="scope">
  138. <span>上节点</span><br>
  139. <span>提交人</span>
  140. <el-tooltip effect="dark" placement="top">
  141. <div slot="content">
  142. 该事务对应流程上一节点的提交人
  143. </div>
  144. <i class="el-icon-info" />
  145. </el-tooltip>
  146. </template>
  147. </el-table-column>
  148. </template>
  149. <template v-else-if="['over', 'finish'].includes(activeTab)">
  150. <el-table-column
  151. show-overflow-tooltip
  152. label="事务状态"
  153. width="100"
  154. >
  155. <template slot-scope="scope">{{ scope.row.curNode ? scope.row.status == 'running' ? '已发起' : '已' + scope.row.curNode : contOfValue(scope.row.status) }}</template>
  156. </el-table-column>
  157. <el-table-column
  158. show-overflow-tooltip
  159. label="发起部门"
  160. width="100"
  161. >
  162. <template slot-scope="scope">{{ getParenthesesStr(scope.row.subject)[1] }}</template>
  163. </el-table-column>
  164. <el-table-column
  165. show-overflow-tooltip
  166. label="发起人"
  167. width="100"
  168. >
  169. <template slot-scope="scope">{{ scope.row.createBy | getUserName(userList) }}</template>
  170. </el-table-column>
  171. <el-table-column
  172. show-overflow-tooltip
  173. label="提交人"
  174. width="100"
  175. >
  176. <template slot-scope="scope">{{ getName(scope.row) }}</template>
  177. </el-table-column>
  178. </template>
  179. <el-table-column :key="Date.now() + Math.random()" show-overflow-tooltip width="160">
  180. <template slot="header" slot-scope="scope">
  181. <template v-if="['wait'].includes(activeTab)">
  182. <span>上节点</span><br>
  183. </template>
  184. <span>{{ item.time + '时间' }}</span>
  185. </template>
  186. <template slot-scope="scope">{{ scope.row[item.field] ? scope.row[item.field].slice(0, 16) : scope.row.createTime.slice(0, 16) }}</template>
  187. </el-table-column>
  188. </el-table>
  189. <div v-if="dataList.length">
  190. <el-pagination
  191. :current-page.sync="paginate.page"
  192. :page-size="paginate.limit"
  193. layout="total, prev, pager, next"
  194. :total="paginate.totalCount"
  195. @current-change="changePage"
  196. />
  197. </div>
  198. </div>
  199. </div>
  200. <div v-if="item.key==='gr'">
  201. <el-card class="ibps-desktop-dashboard">
  202. <el-row ref="row" :gutter="12">
  203. <template v-if="grdata && grdata.length >0">
  204. <el-col v-for="item in grdata" :key="item.id" :span="24" :sm="12" :md="6" :lg="6" :xl="6">
  205. <div :class="'bg-'+item.color" class="item">
  206. <div class="item-header">
  207. <h3>{{ item.dataContent }}</h3>
  208. </div>
  209. <div class="item-body">
  210. <h2><count-to :end-val="parseInt(item.dataText,10)" :duration="4000" /></h2>
  211. </div>
  212. <p class="item-tip">{{ item.dataContent[0] }}</p>
  213. </div>
  214. </el-col>
  215. </template>
  216. <template v-else>
  217. <el-col v-for="(item,i) in 8" :key="i" :span="24" :sm="12" :md="6" :lg="6" :xl="6">
  218. <div class="item bg-grey-steel">
  219. <div class="item-header">&nbsp;</div>
  220. <div class="item-body">
  221. <h2>&nbsp;</h2>
  222. </div>
  223. <p class="item-tip">&nbsp;</p>
  224. </div>
  225. </el-col>
  226. </template>
  227. </el-row>
  228. </el-card>
  229. </div>
  230. <div v-if="item.key==='zt'">
  231. <el-row ref="row" :gutter="12">
  232. <el-col :span="12">
  233. <div>检测任务统计</div>
  234. <div id="a1" style="height:500px;" />
  235. </el-col>
  236. <el-col :span="12">
  237. <div>任务事宜统计</div>
  238. <div id="a2" style="height:500px;" />
  239. </el-col>
  240. </el-row>
  241. </div>
  242. </el-tab-pane>
  243. </el-tabs>
  244. <bpmn-formrender
  245. :visible="dialogFormVisible"
  246. :task-id="activeTab === 'wait' ? taskId : null"
  247. :wai-jian="activeTab === 'wait' ? waiJian : null"
  248. :instance-id="['over', 'finish'].includes(activeTab) ? instanceId : null"
  249. :def-id="activeTab === 'save' ? defId : null"
  250. :pro-inst-id="activeTab === 'save' ? proInstId : null"
  251. :title="['wait', 'save'].includes(activeTab) ? FlowName : null"
  252. :process-name="processName"
  253. @callback="loadData"
  254. @close="visible => (dialogFormVisible = visible)"
  255. />
  256. </div>
  257. </template>
  258. <script>
  259. import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
  260. import homeCalendar from './home-calendar'
  261. import { pending, handledTask } from '@/api/platform/office/bpmReceived'
  262. import { myDraft, removeDraft } from '@/api/platform/office/bpmInitiated'
  263. import { queryOrgManager } from '@/api/platform/org/employee'
  264. import { save } from '@/api/platform/message/innerMessage'
  265. import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
  266. import ActionUtils from '@/utils/action'
  267. import IbpsTypeTree from '@/business/platform/cat/type/tree'
  268. import { dateFormat } from '@/filters'
  269. import * as echarts from 'echarts'
  270. const tabList = [
  271. {
  272. label: '待办事宜',
  273. key: 'wait',
  274. icon: 'el-icon-edit',
  275. time: '提交',
  276. field: 'createTime'
  277. },
  278. {
  279. label: '已办事宜',
  280. key: 'over',
  281. icon: 'el-icon-document-remove',
  282. time: '创建',
  283. field: 'updateTime'
  284. },
  285. {
  286. label: '办结事宜',
  287. key: 'finish',
  288. icon: 'el-icon-paperclip',
  289. time: '结束',
  290. field: 'updateTime'
  291. },
  292. {
  293. label: '暂存事宜',
  294. key: 'save',
  295. icon: 'el-icon-receiving',
  296. time: '暂存',
  297. field: 'createTime'
  298. },
  299. {
  300. label: '个人任务统计',
  301. key: 'gr',
  302. icon: 'el-icon-receiving',
  303. time: '个人任务',
  304. field: 'createTime'
  305. },
  306. {
  307. label: '总体任务统计',
  308. key: 'zt',
  309. icon: 'el-icon-receiving',
  310. time: '总体任务',
  311. field: 'createTime'
  312. }
  313. ]
  314. const taskState = {
  315. running: '已发起',
  316. end: '已结束',
  317. manualend: '人工结束'
  318. }
  319. const paramsType = {
  320. wait: 'temp.',
  321. over: '',
  322. finish: 'inst.',
  323. save: ''
  324. }
  325. const stateOption = {
  326. wait: {
  327. label: '待办理',
  328. type: ''
  329. },
  330. soon: {
  331. label: '即将超时',
  332. type: 'warning'
  333. },
  334. overtime: {
  335. label: '已超时',
  336. type: 'danger'
  337. }
  338. }
  339. const operate = {
  340. wait: pending,
  341. over: handledTask,
  342. finish: handledTask,
  343. save: myDraft
  344. }
  345. const grdata = [
  346. {
  347. dataContent: '待办事宜',
  348. url: '',
  349. color: 'blue',
  350. dataText: '0'
  351. },
  352. {
  353. dataContent: '已办事宜',
  354. url: '',
  355. color: 'green',
  356. dataText: '0'
  357. },
  358. {
  359. dataContent: '办结事宜',
  360. url: '',
  361. color: 'green-meadow',
  362. dataText: '0'
  363. },
  364. {
  365. dataContent: '暂存事宜',
  366. url: '',
  367. color: 'blue',
  368. dataText: '0'
  369. }
  370. ]
  371. export default {
  372. name: 'calendar',
  373. components: { BpmnFormrender, homeCalendar, IbpsTypeTree },
  374. filters: {
  375. getWorkInfo (v, type) {
  376. const hasDesc = v.includes('#')
  377. const res = {
  378. name: {
  379. '0': v.includes('{') ? v.split('{')[0] : v.includes('(') ? v.split('(')[0] : v,
  380. '1': v.split('#')[0]
  381. },
  382. // 无#返回空,有#返回(左边的字符串,
  383. desc: {
  384. '0': '',
  385. '1': v.split('#')[1]
  386. }
  387. }
  388. if (!hasDesc) {
  389. return res[type]['0']
  390. }
  391. return res[type]['1']
  392. },
  393. getUserName (v, list) {
  394. const user = list.find(i => i.userId === v)
  395. return user ? user.userName : ''
  396. }
  397. },
  398. props: {
  399. plan: {
  400. type: Array,
  401. default: () => []
  402. }
  403. },
  404. data () {
  405. return {
  406. option: {
  407. title: {
  408. text: ''
  409. },
  410. tooltip: {
  411. trigger: 'axis',
  412. axisPointer: {
  413. type: 'shadow'
  414. }
  415. },
  416. legend: {
  417. show: true
  418. },
  419. xAxis: {
  420. type: 'category',
  421. name: '检测人员',
  422. data: []
  423. },
  424. yAxis: {
  425. type: 'value',
  426. name: '任务数量'
  427. },
  428. series: [
  429. {
  430. name: '检测未完成数',
  431. type: 'bar',
  432. data: [],
  433. // barCategoryGap: '0',
  434. barGap: '0',
  435. barWidth: 30,
  436. label: {
  437. show: true,
  438. position: 'top',
  439. valueAnimation: true
  440. },
  441. itemStyle: {
  442. normal: {
  443. color: ['#ee6666']
  444. }
  445. }
  446. },
  447. {
  448. name: '检测已完成数',
  449. type: 'bar',
  450. data: [],
  451. // barCategoryGap: '0',
  452. barGap: '0',
  453. barWidth: 30,
  454. label: {
  455. show: true,
  456. position: 'top',
  457. valueAnimation: true
  458. },
  459. itemStyle: {
  460. normal: {
  461. color: ['#91cc75']
  462. }
  463. }
  464. },
  465. {
  466. name: '复核未完成数',
  467. type: 'bar',
  468. data: [],
  469. // barCategoryGap: '0',
  470. barGap: '0',
  471. barWidth: 30,
  472. label: {
  473. show: true,
  474. position: 'top',
  475. valueAnimation: true
  476. },
  477. itemStyle: {
  478. normal: {
  479. color: ['#fac858']
  480. }
  481. }
  482. },
  483. {
  484. name: '复核已完成数',
  485. type: 'bar',
  486. data: [],
  487. // barCategoryGap: '0',
  488. barGap: '0',
  489. barWidth: 30,
  490. label: {
  491. show: true,
  492. position: 'top',
  493. valueAnimation: true
  494. },
  495. itemStyle: {
  496. normal: {
  497. color: ['#5470c6']
  498. }
  499. }
  500. }
  501. ]
  502. },
  503. optionPerson: {
  504. title: {
  505. text: ''
  506. },
  507. tooltip: {
  508. trigger: 'axis',
  509. axisPointer: {
  510. type: 'shadow'
  511. }
  512. },
  513. legend: {
  514. show: true
  515. },
  516. xAxis: {
  517. type: 'category',
  518. name: '人员',
  519. data: []
  520. },
  521. yAxis: {
  522. type: 'value',
  523. name: '任务数量'
  524. },
  525. series: [
  526. {
  527. name: '待办事宜数',
  528. type: 'bar',
  529. data: [],
  530. barGap: '0',
  531. barWidth: 20,
  532. label: {
  533. show: true,
  534. position: 'top',
  535. valueAnimation: true
  536. },
  537. itemStyle: {
  538. normal: {
  539. color: ['#3598dc']
  540. }
  541. }
  542. },
  543. {
  544. name: '已办事宜数',
  545. type: 'bar',
  546. data: [],
  547. barGap: '0',
  548. barWidth: 20,
  549. label: {
  550. show: true,
  551. position: 'top',
  552. valueAnimation: true
  553. },
  554. itemStyle: {
  555. normal: {
  556. color: ['#32c5d2']
  557. }
  558. }
  559. },
  560. {
  561. name: '办结事宜',
  562. type: 'bar',
  563. data: [],
  564. barGap: '0',
  565. barWidth: 20,
  566. label: {
  567. show: true,
  568. position: 'top',
  569. valueAnimation: true
  570. },
  571. itemStyle: {
  572. normal: {
  573. color: ['#1bbc9b']
  574. }
  575. }
  576. },
  577. {
  578. name: '暂存事宜',
  579. type: 'bar',
  580. data: [],
  581. barGap: '0',
  582. barWidth: 20,
  583. label: {
  584. show: true,
  585. position: 'top',
  586. valueAnimation: true
  587. },
  588. itemStyle: {
  589. normal: {
  590. color: ['#3598dc']
  591. }
  592. }
  593. }
  594. ]
  595. },
  596. grdata,
  597. tabList,
  598. stateOption,
  599. dataList: [],
  600. paginate: {},
  601. searchParams: {
  602. typeId: '',
  603. subject: '',
  604. createTime: ''
  605. },
  606. selection: [],
  607. taskId: '', // 编辑dialog需要使用
  608. waiJian: '', // 编辑dialog需要使用
  609. instanceId: '',
  610. defId: '',
  611. proInstId: '',
  612. loading: false,
  613. drawer: false,
  614. dialogFormVisible: false,
  615. orgName: '',
  616. roleName: '',
  617. FlowName: '',
  618. posName: '',
  619. defaultPagination: { page: 1, limit: 15 },
  620. sorts: { CREATE_TIME_: 'DESC' },
  621. timer: null,
  622. processName: '',
  623. userList: [],
  624. orgInfo: {},
  625. activeTab: 'wait',
  626. width: 250,
  627. height: document.body.clientHeight - 130
  628. }
  629. },
  630. mounted: function () {
  631. this.loadData()
  632. this.getUserList()
  633. this.getOrgInfo()
  634. if (this.timer) {
  635. clearInterval(this.timer)
  636. }
  637. // 轮询刷新公告数据和任务数据
  638. this.timer = setInterval(() => {
  639. // 仅待办事宜自动更新数据
  640. if (this.activeTab === 'wait') {
  641. this.getData(this.activeTab)
  642. }
  643. }, 30 * 1000)
  644. },
  645. beforeDestroy () {
  646. clearInterval(this.timer)
  647. },
  648. // 路由离开时
  649. beforeRouteLeave (to, from, next) {
  650. clearInterval(this.timer)
  651. },
  652. methods: {
  653. // 图表数据加载
  654. async chartLoading () {
  655. // 获取所有检测人员任务统计
  656. const this_ = this
  657. 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
  658. t_lhjczb tj,ibps_party_employee ie
  659. WHERE ie.status_ = 'actived' and ie.group_id_ LIKE '%1040707841519779840%' and tj.jian_ce_yuan_ = ie.ID_ GROUP BY jian_ce_yuan_
  660. ) jc LEFT JOIN
  661. (
  662. 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
  663. t_lhjczb tj,ibps_party_employee ie
  664. WHERE ie.status_ = 'actived' and ie.group_id_ LIKE '%1040707841519779840%' and tj.fu_he_yuan_ = ie.ID_ GROUP BY fu_he_yuan_
  665. ) fh ON jc.jcName = fh.fhName
  666. UNION (
  667. 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
  668. t_lhjczb tj,ibps_party_employee ie
  669. WHERE ie.status_ = 'actived' and tj.jian_ce_yuan_ = ie.ID_ GROUP BY jian_ce_yuan_
  670. ) jc RIGHT JOIN
  671. (
  672. 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
  673. t_lhjczb tj,ibps_party_employee ie
  674. WHERE ie.status_ = 'actived' and ie.group_id_ LIKE '%1040707841519779840%' and tj.fu_he_yuan_ = ie.ID_ GROUP BY fu_he_yuan_
  675. ) fh ON jc.jcName = fh.fhName
  676. )`
  677. this.option.xAxis.data = []
  678. this.option.series[0].data = []
  679. this.option.series[1].data = []
  680. this.option.series[2].data = []
  681. this.option.series[3].data = []
  682. this.chartData = []
  683. let dataAll = []
  684. var dataAllName = ''
  685. await curdPost('sql', sql)
  686. .then((res) => {
  687. const data = res.variables.data
  688. dataAll = data
  689. for (const i of data) {
  690. dataAllName += i.jcName + i.fhName
  691. this_.option.xAxis.data.push(i.jcName ? i.jcName : i.fhName)
  692. // 检测未完成数
  693. this_.option.series[0].data.push(
  694. i.jianCeWeiWanCheng ? i.jianCeWeiWanCheng : 0
  695. )
  696. // 检测已完成数
  697. this_.option.series[1].data.push(
  698. i.jianCeYiWanCheng ? i.jianCeYiWanCheng : 0
  699. )
  700. // 复核未完成数
  701. this_.option.series[2].data.push(
  702. i.fuHeWeiWanCheng ? i.fuHeWeiWanCheng : 0
  703. )
  704. // 复核已完成数
  705. this_.option.series[3].data.push(
  706. i.fuHeYiWanCheng ? i.fuHeYiWanCheng : 0
  707. )
  708. this_.chartData.push(i)
  709. }
  710. })
  711. .catch((error) => {
  712. console.log(error)
  713. })
  714. // console.log(dataAllName, '12321')
  715. const len = this_.option.xAxis.data.length
  716. let wuData = []
  717. const sql1 = `select id_,name_ FROM ibps_party_employee WHERE status_ = 'actived' AND group_id_ LIKE '%1040707841519779840%'`
  718. await curdPost('sql', sql1).then((res) => {
  719. wuData = res.variables.data
  720. if (wuData.length !== len) {
  721. for (const item of wuData) {
  722. if (!dataAllName.includes(item.name_)) {
  723. this_.option.xAxis.data.push(item.name_)
  724. this_.option.series[0].data.push(0)
  725. this_.option.series[1].data.push(0)
  726. this_.option.series[2].data.push(0)
  727. this_.option.series[3].data.push(0)
  728. }
  729. }
  730. }
  731. })
  732. },
  733. async getTtaskMattersData () {
  734. const this_ = this
  735. this_.optionPerson.xAxis.data = []
  736. this_.optionPerson.series[0].data = []
  737. this_.optionPerson.series[1].data = []
  738. let create_by_ = ''
  739. let datary = []
  740. let data = []
  741. const csData = []
  742. let banjie = []
  743. let zhancun = []
  744. let yiban1 = []
  745. let personIds = ''
  746. // 待办
  747. 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_ != ''`
  748. await curdPost('sql', sqlry).then((res) => {
  749. datary = res.variables.data
  750. })
  751. for (const item of datary) {
  752. create_by_ += create_by_ + ',' + item.id_
  753. }
  754. create_by_ = create_by_.slice(0, create_by_.length - 1)
  755. 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 `
  756. await curdPost('sql', sql).then((res) => {
  757. data = res.variables.data
  758. })
  759. for (var i = 0; i < data.length; i++) {
  760. this_.optionPerson.xAxis.data.push(data[i].name_)
  761. this_.optionPerson.series[0].data.push(data[i].num)
  762. if (i === data.length - 1) {
  763. personIds += "'" + data[i].executor_ + "'"
  764. } else {
  765. personIds += "'" + data[i].executor_ + "',"
  766. }
  767. }
  768. // 超时
  769. // 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_
  770. // 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 `
  771. // await curdPost('sql', cssql).then((res) => {
  772. // csData = res.variables.data
  773. // })
  774. // for (const it of csData) {
  775. // // this_.optionPerson.series[2].data.push(it.num)
  776. // personIds += "'" + it.executor_ + "',"
  777. // console.log(personIds)
  778. // }
  779. // 办结
  780. 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_ `
  781. await curdPost('sql', banjiesql).then((res) => {
  782. banjie = res.variables.data
  783. })
  784. for (const it of banjie) {
  785. this_.optionPerson.series[2].data.push(it.num)
  786. }
  787. // 已办未办结
  788. 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_`
  789. await curdPost('sql', yibansql2).then((res) => {
  790. yiban1 = res.variables.data
  791. })
  792. for (const items of yiban1) {
  793. for (const el of banjie) {
  794. if (items.AUDITOR_ === el.AUDITOR_) {
  795. this_.optionPerson.series[1].data.push(
  796. Number(items.num) + Number(el.num)
  797. )
  798. }
  799. }
  800. }
  801. // 暂存
  802. 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}) `
  803. await curdPost('sql', zhancunsql).then((res) => {
  804. zhancun = res.variables.data
  805. })
  806. for (const it of zhancun) {
  807. this_.optionPerson.series[3].data.push(it.num)
  808. }
  809. },
  810. loadData () {
  811. // let user = this.$store.getters.userInfo
  812. // let pos, role
  813. // this.orgName = user.employee.orgName
  814. // for (let i in user.positions) {
  815. // if (i == 0) pos = user.positions[0].name
  816. // else pos = pos + ',' + user.positions[i].name
  817. // }
  818. // let contRole = this.unique(user.role) //去重
  819. // for (let i in contRole) {
  820. // if (i == 0) role = contRole[0].name
  821. // else role = role + ',' + contRole[i].name
  822. // }
  823. // this.posName = pos
  824. // this.roleName = role
  825. // this.getMessage()
  826. // 获取任务数据
  827. this.getData(this.activeTab)
  828. },
  829. // 获取系统用户信息
  830. getUserList () {
  831. const { userList } = this.$store.getters
  832. // store中有则无需请求
  833. if (userList && userList.length) {
  834. this.userList = userList
  835. return
  836. }
  837. const sql = 'select id_ as userId, name_ as userName, mobile_ as phone from ibps_party_employee'
  838. curdPost('sql', sql).then(res => {
  839. this.userList = res.variables && res.variables.data
  840. })
  841. },
  842. // 获取用户部门信息
  843. getOrgInfo () {
  844. const { org = {}} = this.$store.getters
  845. if (!org || !org.id) {
  846. return
  847. }
  848. const params = {
  849. parameters: [{ key: 'Q^MANAGER_ORG_ID_^S', value: org.id }]
  850. }
  851. queryOrgManager(params).then(res => {
  852. this.orgInfo = {}
  853. const data = res.data.dataResult
  854. if (data && data.length) {
  855. const { id, name, mobile, account, gender, groupID } = data[0]
  856. this.orgInfo = { id, name, mobile, account, gender, groupID, orgName: org.name }
  857. }
  858. })
  859. },
  860. handleNodeClick (typeId) {
  861. this.dataList = []
  862. this.paginate = {}
  863. this.searchParams.typeId = typeId
  864. this.loadData()
  865. },
  866. handleExpandCollapse (isExpand) {
  867. this.width = isExpand ? 230 : 30
  868. },
  869. getName ({ createBy, updateBy }) {
  870. const id = updateBy || createBy
  871. const { name = '' } = this.$store.getters
  872. if (this.activeTab === 'finish') {
  873. const t = this.userList.find(i => i.userId === id)
  874. return t ? t.userName : ''
  875. }
  876. return name
  877. },
  878. tableRowClassName ({ row, rowIndex }) {
  879. if (rowIndex % 2 === 1) return 'warning-row'
  880. return 'success-row'
  881. },
  882. // 获取表格数据
  883. getData (type) {
  884. this.loading = true
  885. operate[this.activeTab](this.getFormatParams(null, this.defaultPagination)).then(response => {
  886. const { dataResult, pageResult } = response.data
  887. if (dataResult && dataResult.length) {
  888. // 待办事宜对任务发起人做额外处理
  889. if (type === 'wait') {
  890. const instList = []
  891. dataResult.forEach(item => {
  892. instList.push(item.bpmnInstId)
  893. })
  894. 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(',')}')`
  895. const currentTime = Date.now()
  896. curdPost('sql', sql).then(res => {
  897. const data = res.variables && res.variables.data
  898. data.forEach((item, index) => {
  899. dataResult[index].submitBy = item.name_
  900. dataResult[index].workName = dataResult[index].subject.includes('#') ? dataResult[index].subject.split('#')[0] : dataResult[index].subject.split('(')[0]
  901. dataResult[index].workType = this.plan.includes(dataResult[index].procDefKey) ? 'plan' : 'normal'
  902. 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') {
  903. // 检测项目,检测报告办理进度处理
  904. const time = dataResult[index].subject.match(/收样日期:(.*?),/) ? dataResult[index].subject.match(/收样日期:(.*?),/)[1] : null
  905. const dataNum = dataResult[index].subject.match(/检测时限:(.*?),/) ? dataResult[index].subject.match(/检测时限:(.*?),/)[1] : null
  906. if (time && dataNum) {
  907. const j = Math.round(dataNum / 3 * 2) > 1 ? Math.ceil(dataNum / 3 * 2) - 1 : 0
  908. const currentTime = new Date().getTime()
  909. const soonTime = new Date(time).setDate(new Date(time).getDate() + j)
  910. const overtimeTime = new Date(time).setDate(new Date(time).getDate() + Number(dataNum))
  911. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime), dataNum, j)
  912. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  913. }
  914. } else if (dataResult[index].procDefKey === 'Process_0oo8gzf') {
  915. // 周期性推送事务办理进度处理-周
  916. 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
  917. if (time) {
  918. const currentTime = new Date().getTime()
  919. const soonTime = new Date(this.getWeekDataList(time)[3] + ' 01:00:00').getTime()
  920. const overtimeTime = new Date(this.getWeekDataList(time)[7] + ' 01:00:00').getTime()
  921. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  922. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  923. }
  924. } else if (dataResult[index].procDefKey === 'Process_1h50uwi' || dataResult[index].procDefKey === 'Process_0x3emzx') {
  925. // 周期性推送事务办理进度处理-月
  926. 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
  927. if (time) {
  928. const currentTime = new Date().getTime()
  929. const soonTime = this.getMonthDataList(time)[0].getTime()
  930. const overtimeTime = this.getMonthDataList(time)[1].getTime()
  931. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  932. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  933. }
  934. } else if (dataResult[index].procDefKey === 'Process_0mn0pk4' || dataResult[index].procDefKey === 'Process_1ve13oo') {
  935. // 改进不符合项
  936. const time = dataResult[index].subject.match(/改进截至日期:(.*?)#/) ? dataResult[index].subject.match(/改进截至日期:(.*?)#/)[1] + ' 00:00:00' : null
  937. if (time) {
  938. const currentTime = new Date().getTime()
  939. const soonTime = new Date(time).setDate(new Date(time).getDate() - 7)
  940. const overtimeTime = new Date(time).setDate(new Date(time).getDate() + 1)
  941. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  942. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  943. }
  944. } else if (dataResult[index].procDefKey === 'Process_0w9fzlq') {
  945. // 管理评审汇报材料 计划评审时间
  946. const time = dataResult[index].subject.match(/评审时间:(.*?),/) ? dataResult[index].subject.match(/评审时间:(.*?),/)[1] + ' 00:00:00' : null
  947. if (time) {
  948. const currentTime = new Date().getTime()
  949. const soonTime = new Date(time).setDate(new Date(time).getDate() - 7)
  950. const overtimeTime = new Date(time).setDate(new Date(time).getDate() - 1)
  951. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  952. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  953. }
  954. } else if (dataResult[index].procDefKey === 'Process_129f4hh') {
  955. // 管理评审报告编制 纪要提交时间
  956. const time = dataResult[index].createTime
  957. if (time) {
  958. const currentTime = new Date().getTime()
  959. const soonTime = new Date(time).setDate(new Date(time).getDate() + 7)
  960. const overtimeTime = new Date(time).setDate(new Date(time).getDate() + 10)
  961. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  962. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  963. }
  964. } else if (dataResult[index].procDefKey === 'Process_1c7w93s') {
  965. // 年度人员培训计划 生成记录定时任务
  966. const time = dataResult[index].subject.match(/计划时间:(.*?)#/) ? dataResult[index].subject.match(/计划时间:(.*?)#/)[1] + ' 00:00:00' : null
  967. if (time) {
  968. const currentTime = new Date().getTime()
  969. const soonTime = new Date(time).setDate(new Date(time).getDate() - 3)
  970. const overtimeTime = new Date(time).setDate(new Date(time).getDate() + 1)
  971. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  972. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  973. }
  974. } else if (dataResult[index].procDefKey === 'Process_1aamj6j' || dataResult[index].procDefKey === 'Activity_0drpspe') {
  975. // 设备检定,期间核查
  976. 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
  977. if (time) {
  978. const currentTime = new Date().getTime()
  979. const soonTime = this.getMonthDataList(time)[0].getTime()
  980. const overtimeTime = this.getMonthDataList(time)[1].getTime()
  981. console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  982. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  983. }
  984. } else if (dataResult[index].procDefKey === 'Process_1q2uqjq') {
  985. // 内审检查表 常规附加
  986. 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
  987. if (time) {
  988. const currentTime = new Date().getTime()
  989. const soonTime = new Date(time).setDate(new Date(time).getDate() - 3)
  990. const overtimeTime = new Date(time).setDate(new Date(time).getDate())
  991. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  992. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  993. }
  994. } else {
  995. dataResult[index].state = 'wait'
  996. }
  997. // else {
  998. // dataResult[index].state = this.judgeExpire(dataResult[index].createTime, currentTime, dataResult[index].workType, '1')
  999. // }
  1000. // console.log(dataResult[index].procDefKey, dataResult[index].state)
  1001. })
  1002. this.dataList = dataResult.sort((a, b) => b.createTime.localeCompare(a.createTime))
  1003. this.paginate = pageResult
  1004. })
  1005. // this.urgeToManager()
  1006. } else {
  1007. this.dataList = dataResult
  1008. this.paginate = pageResult
  1009. }
  1010. }
  1011. this.loading = false
  1012. }).catch(() => {
  1013. this.loading = false
  1014. // 请求出错清除轮询
  1015. clearInterval(this.timer)
  1016. })
  1017. },
  1018. // 延迟更新列表数据
  1019. updateList () {
  1020. setTimeout(() => {
  1021. this.getData(this.activeTab)
  1022. }, 750)
  1023. },
  1024. // 查询
  1025. search () {
  1026. this.dataList = []
  1027. this.paginate = {}
  1028. this.getData(this.activeTab)
  1029. },
  1030. // 删除暂存数据
  1031. remove () {
  1032. if (!this.selection.length) {
  1033. this.$message.warning('请选择暂存事务!')
  1034. return
  1035. }
  1036. const idList = []
  1037. this.selection.forEach(i => idList.push(i.id))
  1038. ActionUtils.removeRecord(idList).then(ids => {
  1039. removeDraft({ ids }).then(() => {
  1040. ActionUtils.removeSuccessMessage()
  1041. this.selection = []
  1042. this.search()
  1043. })
  1044. }).catch(() => { })
  1045. },
  1046. async changeTab () {
  1047. // 数据、筛选条件初始化
  1048. this.dataList = []
  1049. this.paginate = {}
  1050. this.selection = []
  1051. this.typeId = ''
  1052. this.defaultPagination.page = 1
  1053. if (this.activeTab === 'gr') {
  1054. // this.getDpmInfo()
  1055. tabList.forEach((item, index) => {
  1056. if (item.key !== 'gr' && item.key !== 'zt') {
  1057. operate[item.key](this.getFormatParams(null, this.defaultPagination)).then(response => {
  1058. grdata[index].dataText = response.data.pageResult.totalCount
  1059. })
  1060. }
  1061. })
  1062. } else if (this.activeTab === 'zt') {
  1063. await this.chartLoading()
  1064. await this.getTtaskMattersData()
  1065. console.log(this.optionPerson)
  1066. var chartDom1 = document.getElementById('a1')
  1067. var myChart1 = echarts.init(chartDom1)
  1068. myChart1.setOption(this.option)
  1069. var chartDom2 = document.getElementById('a2')
  1070. var myChart2 = echarts.init(chartDom2)
  1071. myChart2.setOption(this.optionPerson)
  1072. } else {
  1073. this.getData(this.activeTab)
  1074. }
  1075. },
  1076. // 数组去重
  1077. unique (arr) {
  1078. const res = new Map()
  1079. return arr.filter(arr => !res.has(arr.id) && res.set(arr.id, 1))
  1080. },
  1081. // 分页
  1082. changePage (val) {
  1083. this.dataList = []
  1084. this.paginate = {}
  1085. this.defaultPagination.page = val
  1086. this.getData(this.activeTab)
  1087. },
  1088. // 转换状态码
  1089. contOfValue (cont) {
  1090. const s = taskState[cont]
  1091. return s || '暂停'
  1092. },
  1093. getFormatParams (v, pagination) {
  1094. const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
  1095. if (this.$utils.isNotEmpty(this.searchParams.typeId)) {
  1096. params[`Q^${paramsType[this.activeTab]}TYPE_ID_^S`] = this.searchParams.typeId
  1097. }
  1098. if (this.$utils.isNotEmpty(this.searchParams.subject)) {
  1099. params[`Q^${paramsType[this.activeTab]}subject_^SL`] = this.searchParams.subject
  1100. }
  1101. if (this.searchParams.createTime && this.searchParams.createTime.length) {
  1102. params[`Q^${paramsType[this.activeTab]}create_time_^DL`] = dateFormat(this.searchParams.createTime[0]).slice(0, 10)
  1103. params[`Q^${paramsType[this.activeTab]}create_time_^DG`] = dateFormat(this.searchParams.createTime[1]).slice(0, 10)
  1104. }
  1105. if (this.activeTab === 'finish') {
  1106. params.end = '1'
  1107. }
  1108. return ActionUtils.formatParams(params, pagination, this.sorts)
  1109. },
  1110. // 处理表格点击事件
  1111. handleLinkClick (data) {
  1112. this.taskId = data.id || ''
  1113. this.waiJian = data.waiJian || ''
  1114. this.instanceId = data.id || ''
  1115. this.defId = data.procDefId || ''
  1116. this.proInstId = data.id || ''
  1117. this.FlowName = data.name
  1118. this.processName = this.getProjectName(data.procDefKey, data.subject)
  1119. this.dialogFormVisible = true
  1120. },
  1121. // 开关右侧栏抽屉
  1122. handleClose () {
  1123. this.drawer = !this.drawer
  1124. },
  1125. // 文字替换
  1126. getParenthesesStr (text) {
  1127. let result = ''
  1128. if (!text) return result
  1129. const regex1 = /\{(.+?)\}/g
  1130. const regex2 = /\((.+?)\)/g
  1131. const options1 = text.match(regex1)
  1132. const options2 = text.match(regex2)
  1133. const options = options1 && options1.length ? options1 : options2
  1134. if (options) {
  1135. const option = options[0]
  1136. if (option) {
  1137. result = option.substring(1, option.length - 1)
  1138. }
  1139. if (options[1]) {
  1140. const yersOption = options[1]
  1141. if (yersOption) {
  1142. result = result + '/' + yersOption.substring(1, yersOption.length - 1)
  1143. }
  1144. }
  1145. }
  1146. return result.split('/')
  1147. },
  1148. // 判断是否为检测项目流程,是则截取流程标题为表单名称
  1149. getProjectName (key, subject) {
  1150. // 从store中获取保存的检测流程信息数组,默认设置已知的四个流程key(三非通用一通用),流程key有变化需修改此处默认值
  1151. const { testingList = ['Process_0idt26n', 'Process_1rwhy1r', 'Process_05lkhio', 'Process_140upmu'] } = this.$store.getters
  1152. const res = testingList.includes(key)
  1153. return res ? subject.includes('#') ? subject.split('#')[0] : '' : ''
  1154. },
  1155. /**
  1156. * 主管提醒
  1157. * 数据处理,将所有待办数据根据是否过期处理为两个数组
  1158. * 过期判断依据:普通事务-创建时间到当前时间超过三天即为过期;计划事务【事务名称中含计划】-创建当月月末前七天
  1159. * 逻辑说明:过期数组中不存于在主管提醒表中的数据插入主管提醒表,并发送内部通知,主管提醒表删除不存在于未过期数组中的数据
  1160. */
  1161. urgeToManager () {
  1162. const { userId } = this.$store.getters
  1163. const params = {
  1164. parameters: [],
  1165. sorts: []
  1166. }
  1167. const sql = `select id_, shi_wu_id_ as taskId from t_gqswb where position('${userId}' in chu_li_ren_id_) FOR UPDATE`
  1168. // Promise.all([pending(params), curdPost('sql', sql)]).then(([res1, res2]) => {
  1169. // let workData = res1.data && res1.data.dataResult
  1170. // let noticeData = res2.variables && res2.variables.data
  1171. // if (!workData || !workData.length) {
  1172. // return
  1173. // }
  1174. // this.dealData(workData, noticeData)
  1175. // })
  1176. pending(params).then(res1 => {
  1177. const workData = res1.data && res1.data.dataResult
  1178. curdPost('sql', sql).then(res2 => {
  1179. const noticeData = res2.variables && res2.variables.data
  1180. if (!workData || !workData.length) {
  1181. return
  1182. }
  1183. this.dealData(workData, noticeData)
  1184. })
  1185. })
  1186. },
  1187. // 处理数据
  1188. dealData (workList, noticeList) {
  1189. const result = {
  1190. expire: [],
  1191. unexpire: [],
  1192. all: []
  1193. }
  1194. const currentTime = Date.now()
  1195. // 筛选已过期数据
  1196. workList.forEach(item => {
  1197. // 截取流程名
  1198. item.workName = item.subject.includes('#') ? item.subject.split('#')[0] : item.subject.split('(')[0]
  1199. item.workType = this.plan.includes(item.procDefKey) ? 'plan' : 'normal'
  1200. const isExpire = this.judgeExpire(item.createTime, currentTime, item.workType)
  1201. if (isExpire) {
  1202. result.expire.push(item)
  1203. } else {
  1204. result.unexpire.push(item)
  1205. }
  1206. result.all.push(item)
  1207. })
  1208. // console.log('处理后数据:', result)
  1209. // 有过期数据才执行过期数据处理
  1210. if (result.expire.length) {
  1211. this.dealExpile(result.expire, noticeList)
  1212. }
  1213. // 主管提醒表中有数据才执行数据删除
  1214. if (noticeList && noticeList.length) {
  1215. this.dealUnexpile(result.all, noticeList)
  1216. }
  1217. },
  1218. // 判断是否过期、获取办理状态
  1219. judgeExpire (time, current, type, isState) {
  1220. const D = new Date(time)
  1221. const a = new Date(time).getTime()
  1222. const b = new Date(current).getTime()
  1223. // 创建时间当月最后一天的时间戳
  1224. const c = new Date(D.getFullYear(), D.getMonth() + 1, 0).getTime() + 86400000
  1225. // 返回办理状态
  1226. if (isState) {
  1227. let state = ''
  1228. if (type === 'plan') {
  1229. state = b >= c ? 'overtime' : b + (86400000 * 7) > c ? 'soon' : 'wait'
  1230. } else {
  1231. state = a + (86400000 * 3) < b ? 'overtime' : 'wait'
  1232. }
  1233. return state
  1234. }
  1235. // 返回是否过期
  1236. if (type === 'plan') {
  1237. return b + (86400000 * 7) > c
  1238. } else {
  1239. return a + (86400000 * 3) < b
  1240. }
  1241. },
  1242. // 处理已过期数据
  1243. dealExpile (data, noticeList) {
  1244. // console.log('已过期流程数据:', data)
  1245. // console.log('过期事务表数据:', noticeList)
  1246. const { userId } = this.$store.getters
  1247. const addList = []
  1248. const sendList = []
  1249. const msgContent = {
  1250. plan: '距离过期还剩七天,请及时处理!',
  1251. normal: '至今三天未处理,已超时,请及时处理!'
  1252. }
  1253. const msgTitle = {
  1254. plan: '计划事务即将到期提醒',
  1255. normal: '事务超时提醒'
  1256. }
  1257. const nowTime = new Date(new Date().getTime() + 28800000).toJSON().slice(0, 16).replace('T', ' ')
  1258. data.forEach(item => {
  1259. const isExist = !!noticeList.find(i => i.taskId === item.taskId)
  1260. // 筛选出不存在于主管提醒表的过期数据
  1261. if (!isExist) {
  1262. // 无部门信息的用户不往过期事务表加数据
  1263. if (this.orgInfo.groupID) {
  1264. const obj = {
  1265. // 事务ID
  1266. shi_wu_id_: item.taskId,
  1267. // 完整名称
  1268. wan_zheng_ming_ch: item.subject,
  1269. // 事务说明
  1270. shi_wu_shuo_ming_: item.subject.includes('#') ? item.subject.split('#')[1] : '',
  1271. // 事务名称
  1272. shi_wu_ming_cheng: item.workName,
  1273. // 事务状态
  1274. shi_wu_zhuang_tai: `待${item.name}`,
  1275. // 事务类型
  1276. shi_wu_lei_xing_: item.workType,
  1277. chu_li_ren_ming_: item.ownerName,
  1278. chu_li_ren_id_: this.getInfoByName(item.ownerName, 'id'),
  1279. chu_li_ren_dian_h: this.getInfoByName(item.ownerName, 'phone'),
  1280. bu_men_: this.orgInfo.orgName,
  1281. bu_men_id_: this.orgInfo.groupID,
  1282. // 主管ID与当前用户id相等时将主管ID设置为主任【】的ID,主管电话设为空
  1283. zhu_guan_id_: this.orgInfo.id === userId ? '990927120278487040' : this.orgInfo.id,
  1284. zhu_guan_dian_hua: this.orgInfo.id === userId ? '' : this.orgInfo.mobile,
  1285. bian_zhi_shi_jian: item.createTime,
  1286. ti_xing_ci_shu_: 1,
  1287. duan_xin_ci_shu_: 0,
  1288. ti_xing_shi_jian_: nowTime
  1289. }
  1290. addList.push(obj)
  1291. }
  1292. const msg = {
  1293. subject: msgTitle[item.workType],
  1294. content: `<p>事务【${item.workName}】${msgContent[item.workType]}<p>`,
  1295. receiverId: userId,
  1296. canreply: '0',
  1297. taskId: item.taskId
  1298. }
  1299. sendList.push(msg)
  1300. }
  1301. })
  1302. const addParams = {
  1303. tableName: 't_gqswb',
  1304. paramWhere: addList
  1305. }
  1306. // console.log('新增过期事务表数据:', addList, '发送消息数据', sendList)
  1307. if (addList.length) {
  1308. curdPost('add', JSON.stringify(addParams))
  1309. }
  1310. if (sendList.length) {
  1311. this.sendMsg(sendList)
  1312. }
  1313. },
  1314. // 删除已办的提醒表数据
  1315. dealUnexpile (data, noticeList) {
  1316. // 清除存在于主管提醒表中【处理人含我】,但是不存在于待办中的数据
  1317. const deleteList = []
  1318. noticeList.forEach(item => {
  1319. const isExist = !!data.find(i => i.taskId === item.taskId)
  1320. if (!isExist) {
  1321. deleteList.push(item.id_)
  1322. }
  1323. })
  1324. // console.log('过期事务表中需删除的数据:', deleteList)
  1325. if (!deleteList.length) {
  1326. return
  1327. }
  1328. const params = `{"tableName": "t_gqswb","paramWhere":"{id_:'${deleteList.join(',')}'}"}`
  1329. curdPost('batchDelete', params).then(() => {}).catch(err => {
  1330. console.log(err)
  1331. })
  1332. },
  1333. // 发送站内消息
  1334. sendMsg (data) {
  1335. data.forEach(item => {
  1336. save(item).then(() => {}).catch(err => {
  1337. console.log(err)
  1338. })
  1339. })
  1340. },
  1341. // 通过名字获取id/电话
  1342. getInfoByName (names, type) {
  1343. const res = {
  1344. id: [],
  1345. phone: []
  1346. }
  1347. const temp = names.split(',')
  1348. temp.forEach(item => {
  1349. const t = this.userList.find(i => i.userName === item)
  1350. if (t) {
  1351. res.id.push(t.userId)
  1352. res.phone.push(t.phone)
  1353. }
  1354. })
  1355. return res[type].filter(i => i).join(',')
  1356. },
  1357. // 时间戳转时间
  1358. TimestampToDate2 (Timestamp) {
  1359. const now = new Date(Timestamp)
  1360. const y = now.getFullYear()
  1361. const m = now.getMonth() + 1
  1362. const d = now.getDate()
  1363. return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) + ' ' + now.toTimeString().substr(0, 8)
  1364. },
  1365. // 根据指定日期获取本周一到下周一日期
  1366. getWeekDataList (data) {
  1367. // 根据日期获取本周周一~周日的年-月-日
  1368. var weekList = []
  1369. var date = new Date(data)
  1370. // 判断本日期是否为周日,获取本周一日期
  1371. if (date.getDay() === '0') {
  1372. date.setDate(date.getDate() - 6)
  1373. } else {
  1374. date.setDate(date.getDate() - date.getDay() + 1)
  1375. }
  1376. var myDate = date.getDate()
  1377. var myMonth = date.getMonth() + 1
  1378. if (date.getDate() < 10) {
  1379. myDate = '0' + myDate
  1380. }
  1381. if (date.getMonth() + 1 < 10) {
  1382. myMonth = '0' + myMonth
  1383. }
  1384. weekList.push(date.getFullYear() + '-' + myMonth + '-' + myDate)
  1385. // 获取周二到下周一日期
  1386. for (var i = 0; i < 7; i++) {
  1387. date.setDate(date.getDate() + 1)
  1388. myDate = date.getDate()
  1389. myMonth = date.getMonth() + 1
  1390. if (date.getDate() < 10) {
  1391. myDate = '0' + myDate
  1392. }
  1393. if (date.getMonth() + 1 < 10) {
  1394. myMonth = '0' + myMonth
  1395. }
  1396. weekList.push(date.getFullYear() + '-' + myMonth + '-' + myDate)
  1397. }
  1398. // console.log(weekList)
  1399. return weekList
  1400. },
  1401. // 根据指定日期获取本本月20号下月1号日期
  1402. getMonthDataList (data) {
  1403. var date = new Date(data)
  1404. // 获取该日期所在的年份和月份
  1405. var year = date.getFullYear()
  1406. var month = date.getMonth() // 注意:月份是从0开始的,所以10月是9
  1407. // 创建一个新的日期对象,设置为该年的该月的20号
  1408. var twentyFifth = new Date(year, month, 20, 1, 0, 0)
  1409. // 计算下个月的年份和月份
  1410. var nextMonth = month + 1
  1411. var nextMonthYear = year
  1412. if (nextMonth > 11) { // 如果月份超过11(即12月),则年份加1,月份重置为0(即1月)
  1413. nextMonth = 0
  1414. nextMonthYear += 1
  1415. }
  1416. // 创建一个新的日期对象,设置为下个月的1号
  1417. var firstDayOfNextMonth = new Date(nextMonthYear, nextMonth, 1, 1, 0, 0)
  1418. // console.log(twentyFifth, firstDayOfNextMonth)
  1419. return [twentyFifth, firstDayOfNextMonth]
  1420. }
  1421. }
  1422. }
  1423. </script>
  1424. <style lang="scss" scoped>
  1425. .el-completing {
  1426. background: #409eff !important;
  1427. }
  1428. .el-col {
  1429. min-height: 1px;
  1430. }
  1431. .firstcol {
  1432. padding-right: 10px;
  1433. }
  1434. .el-nothing {
  1435. font-size: 13px;
  1436. }
  1437. .calendar-day {
  1438. text-align: center;
  1439. color: #202535;
  1440. line-height: 30px;
  1441. font-size: 12px;
  1442. }
  1443. .is-selected {
  1444. color: #f8a535;
  1445. font-size: 10px;
  1446. margin-top: 5px;
  1447. }
  1448. #calendar .el-button-group > .el-button:not(:first-child):not(:last-child):after {
  1449. content: '当月';
  1450. }
  1451. #calendar .item {
  1452. position: relative;
  1453. margin: 0;
  1454. padding: 0;
  1455. height: auto;
  1456. border-radius: 4px;
  1457. -webkit-box-sizing: border-box;
  1458. box-sizing: border-box;
  1459. overflow: hidden;
  1460. color: #f8a535;
  1461. }
  1462. .ibps-list-split .ibps-list-item {
  1463. border-bottom: 1px solid #dcdfe6;
  1464. padding: 6px 0;
  1465. }
  1466. .jbd-font-style {
  1467. font-weight: bold;
  1468. }
  1469. .home-text-border {
  1470. color: #999999;
  1471. 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);
  1472. min-height: 20px;
  1473. font-size: 14px;
  1474. margin-left: 60px;
  1475. margin-bottom: 5px;
  1476. }
  1477. .jbd-home-card {
  1478. overflow: auto;
  1479. }
  1480. .jbd-home-task {
  1481. width: 100%;
  1482. padding: 10px;
  1483. cursor: pointer;
  1484. font-size: 12px;
  1485. margin-bottom: 35px;
  1486. }
  1487. .jbd-home-card::-webkit-scrollbar {
  1488. display: none;
  1489. }
  1490. .jbd-control-cont {
  1491. text-align: center;
  1492. position: absolute;
  1493. z-index: 10;
  1494. right: 0px;
  1495. top: 50%;
  1496. }
  1497. .tab-container {
  1498. >div {
  1499. display: inline-block;
  1500. }
  1501. .table-container {
  1502. width: calc(100% - 250px);
  1503. vertical-align: top;
  1504. .search-container {
  1505. display: flex;
  1506. margin-bottom: 10px;
  1507. .search-box {
  1508. display: flex;
  1509. align-items: center;
  1510. height: 30px;
  1511. margin-right: 20px;
  1512. .label {
  1513. margin: 0 6px 0 6px;
  1514. color: #606266;
  1515. font-size: 12px;
  1516. }
  1517. .input {
  1518. width: 200px;
  1519. font-size: 12px;
  1520. height: 28px !important;
  1521. line-height: 28px;
  1522. color: #606266;
  1523. ::v-deep .el-input__inner {
  1524. height: 28px;
  1525. line-height: 28px;
  1526. }
  1527. }
  1528. }
  1529. .btn {
  1530. height: 30px;
  1531. margin-left: 10px;
  1532. background-color: #409eff;
  1533. border-color: #409eff;
  1534. font-size: 12px;
  1535. border-radius: 3px;
  1536. padding: 7px 15px;
  1537. }
  1538. .el-button--danger {
  1539. background-color: #f56c6c;
  1540. border-color: #f56c6c;
  1541. }
  1542. }
  1543. }
  1544. }
  1545. </style>
  1546. <style>
  1547. .ibps-desktop-dashboard{
  1548. padding: 100px 200px;
  1549. }
  1550. .ibps-desktop-dashboard .item{
  1551. height: 150px !important;
  1552. }
  1553. .app-container .el-drawer.rtl {
  1554. overflow: scroll;
  1555. }
  1556. .app-container .el-table th {
  1557. background-color: #a7d6f8 !important;
  1558. font-size: 14px;
  1559. font-weight: bold;
  1560. color: #000000;
  1561. border: 0px;
  1562. }
  1563. .app-container .el-table td {
  1564. padding: 4px;
  1565. }
  1566. .app-container .el-table .warning-row {
  1567. background: #d3ebfc;
  1568. color: #000000;
  1569. }
  1570. .app-container .el-table .success-row {
  1571. background: #f9ffff;
  1572. color: #000000;
  1573. }
  1574. </style>