new-home.vue 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623
  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'" v-loading="loading">
  231. <el-row ref="row" :gutter="12">
  232. <el-col :span="12">
  233. <div>检测任务统计</div>
  234. <div id="a1" style="width: 100%; height:600px;" />
  235. </el-col>
  236. <el-col :span="12">
  237. <div>任务事宜统计</div>
  238. <div id="a2" style="width: 100%;height:600px;" />
  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: '20%',
  434. barGap: '20%',
  435. // barWidth: 20,
  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: '20%',
  452. barGap: '20%',
  453. // barWidth: 20,
  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: '20%',
  470. barGap: '20%',
  471. // barWidth: 20,
  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: '20%',
  488. barGap: '20%',
  489. // barWidth: 20,
  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. barCategoryGap: '20%',
  531. barGap: '20%',
  532. // barWidth: 20,
  533. label: {
  534. show: true,
  535. position: 'top',
  536. offset: [0, 0],
  537. valueAnimation: true
  538. },
  539. itemStyle: {
  540. normal: {
  541. color: ['#3598dc']
  542. }
  543. }
  544. },
  545. {
  546. name: '已办事宜数',
  547. type: 'bar',
  548. data: [],
  549. barCategoryGap: '20%',
  550. barGap: '20%',
  551. // barWidth: 20,
  552. label: {
  553. show: true,
  554. position: 'top',
  555. offset: [-5, -5],
  556. valueAnimation: true
  557. },
  558. itemStyle: {
  559. normal: {
  560. color: ['#32c5d2']
  561. }
  562. }
  563. },
  564. {
  565. name: '办结事宜',
  566. type: 'bar',
  567. data: [],
  568. barCategoryGap: '20%',
  569. barGap: '20%',
  570. // barWidth: 20,
  571. label: {
  572. show: true,
  573. position: 'top',
  574. offset: [4, 4],
  575. valueAnimation: true
  576. },
  577. itemStyle: {
  578. normal: {
  579. color: ['#1bbc9b']
  580. }
  581. }
  582. },
  583. {
  584. name: '暂存事宜',
  585. type: 'bar',
  586. data: [],
  587. barCategoryGap: '20%',
  588. barGap: '20%',
  589. // barWidth: 20,
  590. label: {
  591. show: true,
  592. position: 'top',
  593. offset: [0, 0],
  594. valueAnimation: true
  595. },
  596. itemStyle: {
  597. normal: {
  598. color: ['#3598dc']
  599. }
  600. }
  601. }
  602. ]
  603. },
  604. grdata,
  605. tabList,
  606. stateOption,
  607. dataList: [],
  608. paginate: {},
  609. searchParams: {
  610. typeId: '',
  611. subject: '',
  612. createTime: ''
  613. },
  614. selection: [],
  615. taskId: '', // 编辑dialog需要使用
  616. waiJian: '', // 编辑dialog需要使用
  617. instanceId: '',
  618. defId: '',
  619. proInstId: '',
  620. loading: false,
  621. drawer: false,
  622. dialogFormVisible: false,
  623. orgName: '',
  624. roleName: '',
  625. FlowName: '',
  626. posName: '',
  627. defaultPagination: { page: 1, limit: 15 },
  628. sorts: { CREATE_TIME_: 'DESC' },
  629. timer: null,
  630. processName: '',
  631. userList: [],
  632. orgInfo: {},
  633. activeTab: 'wait',
  634. width: 250,
  635. height: document.body.clientHeight - 130
  636. }
  637. },
  638. mounted: function () {
  639. this.loadData()
  640. this.getUserList()
  641. this.getOrgInfo()
  642. if (this.timer) {
  643. clearInterval(this.timer)
  644. }
  645. // 轮询刷新公告数据和任务数据
  646. this.timer = setInterval(() => {
  647. // 仅待办事宜自动更新数据
  648. if (this.activeTab === 'wait') {
  649. this.getData(this.activeTab)
  650. }
  651. }, 30 * 1000)
  652. },
  653. beforeDestroy () {
  654. clearInterval(this.timer)
  655. },
  656. // 路由离开时
  657. beforeRouteLeave (to, from, next) {
  658. clearInterval(this.timer)
  659. },
  660. methods: {
  661. // 图表数据加载
  662. async chartLoading () {
  663. // 获取所有检测人员任务统计
  664. const this_ = this
  665. 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
  666. t_lhjczb tj,ibps_party_employee ie
  667. WHERE ie.status_ = 'actived' and ie.group_id_ LIKE '%1040707841519779840%' and tj.jian_ce_yuan_ = ie.ID_ GROUP BY jian_ce_yuan_
  668. ) jc LEFT JOIN
  669. (
  670. 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
  671. t_lhjczb tj,ibps_party_employee ie
  672. WHERE ie.status_ = 'actived' and ie.group_id_ LIKE '%1040707841519779840%' and tj.fu_he_yuan_ = ie.ID_ GROUP BY fu_he_yuan_
  673. ) fh ON jc.jcName = fh.fhName
  674. UNION (
  675. 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
  676. t_lhjczb tj,ibps_party_employee ie
  677. WHERE ie.status_ = 'actived' and tj.jian_ce_yuan_ = ie.ID_ GROUP BY jian_ce_yuan_
  678. ) jc RIGHT JOIN
  679. (
  680. 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
  681. t_lhjczb tj,ibps_party_employee ie
  682. WHERE ie.status_ = 'actived' and ie.group_id_ LIKE '%1040707841519779840%' and tj.fu_he_yuan_ = ie.ID_ GROUP BY fu_he_yuan_
  683. ) fh ON jc.jcName = fh.fhName
  684. )`
  685. this.option.xAxis.data = []
  686. this.option.series[0].data = []
  687. this.option.series[1].data = []
  688. this.option.series[2].data = []
  689. this.option.series[3].data = []
  690. this.chartData = []
  691. let dataAll = []
  692. var dataAllName = ''
  693. await curdPost('sql', sql)
  694. .then((res) => {
  695. const data = res.variables.data
  696. dataAll = data
  697. for (const i of data) {
  698. dataAllName += i.jcName + i.fhName
  699. this_.option.xAxis.data.push(i.jcName ? i.jcName : i.fhName)
  700. // 检测未完成数
  701. this_.option.series[0].data.push(
  702. i.jianCeWeiWanCheng ? i.jianCeWeiWanCheng : 0
  703. )
  704. // 检测已完成数
  705. this_.option.series[1].data.push(
  706. i.jianCeYiWanCheng ? i.jianCeYiWanCheng : 0
  707. )
  708. // 复核未完成数
  709. this_.option.series[2].data.push(
  710. i.fuHeWeiWanCheng ? i.fuHeWeiWanCheng : 0
  711. )
  712. // 复核已完成数
  713. this_.option.series[3].data.push(
  714. i.fuHeYiWanCheng ? i.fuHeYiWanCheng : 0
  715. )
  716. this_.chartData.push(i)
  717. }
  718. })
  719. .catch((error) => {
  720. console.log(error)
  721. })
  722. // console.log(dataAllName, '12321')
  723. const len = this_.option.xAxis.data.length
  724. let wuData = []
  725. const sql1 = `select id_,name_ FROM ibps_party_employee WHERE status_ = 'actived' AND group_id_ LIKE '%1040707841519779840%'`
  726. await curdPost('sql', sql1).then((res) => {
  727. wuData = res.variables.data
  728. if (wuData.length !== len) {
  729. for (const item of wuData) {
  730. if (!dataAllName.includes(item.name_)) {
  731. this_.option.xAxis.data.push(item.name_)
  732. this_.option.series[0].data.push(0)
  733. this_.option.series[1].data.push(0)
  734. this_.option.series[2].data.push(0)
  735. this_.option.series[3].data.push(0)
  736. }
  737. }
  738. }
  739. })
  740. },
  741. async getTtaskMattersData () {
  742. const this_ = this
  743. this_.optionPerson.xAxis.data = []
  744. this_.optionPerson.series[0].data = []
  745. this_.optionPerson.series[1].data = []
  746. let create_by_ = ''
  747. let datary = []
  748. let data = []
  749. const csData = []
  750. let banjie = []
  751. let zhancun = []
  752. let yiban1 = []
  753. let personIds = ''
  754. // 待办
  755. 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_ != ''`
  756. await curdPost('sql', sqlry).then((res) => {
  757. datary = res.variables.data
  758. })
  759. for (const item of datary) {
  760. create_by_ += create_by_ + ',' + item.id_
  761. }
  762. create_by_ = create_by_.slice(0, create_by_.length - 1)
  763. 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 `
  764. await curdPost('sql', sql).then((res) => {
  765. data = res.variables.data
  766. })
  767. for (var i = 0; i < data.length; i++) {
  768. this_.optionPerson.xAxis.data.push(data[i].name_)
  769. this_.optionPerson.series[0].data.push(data[i].num)
  770. if (i === data.length - 1) {
  771. personIds += "'" + data[i].executor_ + "'"
  772. } else {
  773. personIds += "'" + data[i].executor_ + "',"
  774. }
  775. }
  776. // 超时
  777. // 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_
  778. // 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 `
  779. // await curdPost('sql', cssql).then((res) => {
  780. // csData = res.variables.data
  781. // })
  782. // for (const it of csData) {
  783. // // this_.optionPerson.series[2].data.push(it.num)
  784. // personIds += "'" + it.executor_ + "',"
  785. // console.log(personIds)
  786. // }
  787. // 办结
  788. 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_ `
  789. await curdPost('sql', banjiesql).then((res) => {
  790. banjie = res.variables.data
  791. })
  792. for (const it of banjie) {
  793. this_.optionPerson.series[2].data.push(it.num)
  794. }
  795. // 已办未办结
  796. 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_`
  797. await curdPost('sql', yibansql2).then((res) => {
  798. yiban1 = res.variables.data
  799. })
  800. for (const items of yiban1) {
  801. for (const el of banjie) {
  802. if (items.AUDITOR_ === el.AUDITOR_) {
  803. this_.optionPerson.series[1].data.push(
  804. Number(items.num) + Number(el.num)
  805. )
  806. }
  807. }
  808. }
  809. // 暂存
  810. 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}) `
  811. await curdPost('sql', zhancunsql).then((res) => {
  812. zhancun = res.variables.data
  813. })
  814. for (const it of zhancun) {
  815. this_.optionPerson.series[3].data.push(it.num)
  816. }
  817. },
  818. loadData () {
  819. // let user = this.$store.getters.userInfo
  820. // let pos, role
  821. // this.orgName = user.employee.orgName
  822. // for (let i in user.positions) {
  823. // if (i == 0) pos = user.positions[0].name
  824. // else pos = pos + ',' + user.positions[i].name
  825. // }
  826. // let contRole = this.unique(user.role) //去重
  827. // for (let i in contRole) {
  828. // if (i == 0) role = contRole[0].name
  829. // else role = role + ',' + contRole[i].name
  830. // }
  831. // this.posName = pos
  832. // this.roleName = role
  833. // this.getMessage()
  834. // 获取任务数据
  835. this.getData(this.activeTab)
  836. },
  837. // 获取系统用户信息
  838. getUserList () {
  839. const { userList } = this.$store.getters
  840. // store中有则无需请求
  841. if (userList && userList.length) {
  842. this.userList = userList
  843. return
  844. }
  845. const sql = 'select id_ as userId, name_ as userName, mobile_ as phone from ibps_party_employee'
  846. curdPost('sql', sql).then(res => {
  847. this.userList = res.variables && res.variables.data
  848. })
  849. },
  850. // 获取用户部门信息
  851. getOrgInfo () {
  852. const { org = {}} = this.$store.getters
  853. if (!org || !org.id) {
  854. return
  855. }
  856. const params = {
  857. parameters: [{ key: 'Q^MANAGER_ORG_ID_^S', value: org.id }]
  858. }
  859. queryOrgManager(params).then(res => {
  860. this.orgInfo = {}
  861. const data = res.data.dataResult
  862. if (data && data.length) {
  863. const { id, name, mobile, account, gender, groupID } = data[0]
  864. this.orgInfo = { id, name, mobile, account, gender, groupID, orgName: org.name }
  865. }
  866. })
  867. },
  868. handleNodeClick (typeId) {
  869. this.dataList = []
  870. this.paginate = {}
  871. this.searchParams.typeId = typeId
  872. this.loadData()
  873. },
  874. handleExpandCollapse (isExpand) {
  875. this.width = isExpand ? 230 : 30
  876. },
  877. getName ({ createBy, updateBy }) {
  878. const id = updateBy || createBy
  879. const { name = '' } = this.$store.getters
  880. if (this.activeTab === 'finish') {
  881. const t = this.userList.find(i => i.userId === id)
  882. return t ? t.userName : ''
  883. }
  884. return name
  885. },
  886. tableRowClassName ({ row, rowIndex }) {
  887. if (rowIndex % 2 === 1) return 'warning-row'
  888. return 'success-row'
  889. },
  890. // 获取表格数据
  891. getData (type) {
  892. this.loading = true
  893. operate[this.activeTab](this.getFormatParams(null, this.defaultPagination, null)).then(response => {
  894. const { dataResult, pageResult } = response.data
  895. if (dataResult && dataResult.length) {
  896. // 待办事宜对任务发起人做额外处理
  897. if (type === 'wait') {
  898. const instList = []
  899. dataResult.forEach(item => {
  900. instList.push(item.bpmnInstId)
  901. })
  902. 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(',')}')`
  903. const currentTime = Date.now()
  904. curdPost('sql', sql).then(res => {
  905. const data = res.variables && res.variables.data
  906. data.forEach((item, index) => {
  907. dataResult[index].submitBy = item.name_
  908. dataResult[index].workName = dataResult[index].subject.includes('#') ? dataResult[index].subject.split('#')[0] : dataResult[index].subject.split('(')[0]
  909. dataResult[index].workType = this.plan.includes(dataResult[index].procDefKey) ? 'plan' : 'normal'
  910. 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') {
  911. // 检测项目,检测报告办理进度处理
  912. const time = dataResult[index].subject.match(/收样日期:(.*?),/) ? dataResult[index].subject.match(/收样日期:(.*?),/)[1] : null
  913. const dataNum = dataResult[index].subject.match(/检测时限:(.*?),/) ? dataResult[index].subject.match(/检测时限:(.*?),/)[1] : null
  914. if (time && dataNum) {
  915. const j = Math.round(dataNum / 3 * 2) > 1 ? Math.ceil(dataNum / 3 * 2) - 1 : 0
  916. const currentTime = new Date().getTime()
  917. const soonTime = new Date(time).setDate(new Date(time).getDate() + j)
  918. const overtimeTime = new Date(time).setDate(new Date(time).getDate() + Number(dataNum))
  919. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime), dataNum, j)
  920. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  921. }
  922. } else if (dataResult[index].procDefKey === 'Process_0oo8gzf') {
  923. // 周期性推送事务办理进度处理-周
  924. 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
  925. if (time) {
  926. const currentTime = new Date().getTime()
  927. const soonTime = new Date(this.getWeekDataList(time)[3] + ' 01:00:00').getTime()
  928. const overtimeTime = new Date(this.getWeekDataList(time)[7] + ' 01:00:00').getTime()
  929. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  930. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  931. }
  932. } else if (dataResult[index].procDefKey === 'Process_1h50uwi' || dataResult[index].procDefKey === 'Process_0x3emzx') {
  933. // 周期性推送事务办理进度处理-月
  934. 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
  935. if (time) {
  936. const currentTime = new Date().getTime()
  937. const soonTime = this.getMonthDataList(time)[0].getTime()
  938. const overtimeTime = this.getMonthDataList(time)[1].getTime()
  939. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  940. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  941. }
  942. } else if (dataResult[index].procDefKey === 'Process_0mn0pk4' || dataResult[index].procDefKey === 'Process_1ve13oo') {
  943. // 改进不符合项
  944. const time = dataResult[index].subject.match(/改进截至日期:(.*?)#/) ? dataResult[index].subject.match(/改进截至日期:(.*?)#/)[1] + ' 00:00:00' : null
  945. if (time) {
  946. const currentTime = new Date().getTime()
  947. const soonTime = new Date(time).setDate(new Date(time).getDate() - 7)
  948. const overtimeTime = new Date(time).setDate(new Date(time).getDate() + 1)
  949. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  950. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  951. }
  952. } else if (dataResult[index].procDefKey === 'Process_0w9fzlq') {
  953. // 管理评审汇报材料 计划评审时间
  954. const time = dataResult[index].subject.match(/评审时间:(.*?),/) ? dataResult[index].subject.match(/评审时间:(.*?),/)[1] + ' 00:00:00' : null
  955. if (time) {
  956. const currentTime = new Date().getTime()
  957. const soonTime = new Date(time).setDate(new Date(time).getDate() - 7)
  958. const overtimeTime = new Date(time).setDate(new Date(time).getDate() - 1)
  959. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  960. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  961. }
  962. } else if (dataResult[index].procDefKey === 'Process_129f4hh') {
  963. // 管理评审报告编制 纪要提交时间
  964. const time = dataResult[index].createTime
  965. if (time) {
  966. const currentTime = new Date().getTime()
  967. const soonTime = new Date(time).setDate(new Date(time).getDate() + 7)
  968. const overtimeTime = new Date(time).setDate(new Date(time).getDate() + 10)
  969. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  970. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  971. }
  972. } else if (dataResult[index].procDefKey === 'Process_1c7w93s') {
  973. // 年度人员培训计划 生成记录定时任务
  974. const time = dataResult[index].subject.match(/计划时间:(.*?)#/) ? dataResult[index].subject.match(/计划时间:(.*?)#/)[1] + ' 00:00:00' : null
  975. if (time) {
  976. const currentTime = new Date().getTime()
  977. const soonTime = new Date(time).setDate(new Date(time).getDate() - 3)
  978. const overtimeTime = new Date(time).setDate(new Date(time).getDate() + 1)
  979. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  980. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  981. }
  982. } else if (dataResult[index].procDefKey === 'Process_1aamj6j' || dataResult[index].procDefKey === 'Activity_0drpspe') {
  983. // 设备检定,期间核查
  984. 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
  985. if (time) {
  986. const currentTime = new Date().getTime()
  987. const soonTime = this.getMonthDataList(time)[0].getTime()
  988. const overtimeTime = this.getMonthDataList(time)[1].getTime()
  989. console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  990. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  991. }
  992. } else if (dataResult[index].procDefKey === 'Process_1q2uqjq') {
  993. // 内审检查表 常规附加
  994. 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
  995. if (time) {
  996. const currentTime = new Date().getTime()
  997. const soonTime = new Date(time).setDate(new Date(time).getDate() - 3)
  998. const overtimeTime = new Date(time).setDate(new Date(time).getDate())
  999. // console.log(this.TimestampToDate2(currentTime), this.TimestampToDate2(soonTime), this.TimestampToDate2(overtimeTime))
  1000. dataResult[index].state = currentTime < soonTime ? 'wait' : currentTime < overtimeTime ? 'soon' : currentTime > overtimeTime ? 'overtime' : ''
  1001. }
  1002. } else {
  1003. dataResult[index].state = 'wait'
  1004. }
  1005. // else {
  1006. // dataResult[index].state = this.judgeExpire(dataResult[index].createTime, currentTime, dataResult[index].workType, '1')
  1007. // }
  1008. // console.log(dataResult[index].procDefKey, dataResult[index].state)
  1009. })
  1010. this.dataList = dataResult.sort((a, b) => b.createTime.localeCompare(a.createTime))
  1011. this.paginate = pageResult
  1012. })
  1013. // this.urgeToManager()
  1014. } else {
  1015. this.dataList = dataResult
  1016. this.paginate = pageResult
  1017. }
  1018. }
  1019. this.loading = false
  1020. }).catch(() => {
  1021. this.loading = false
  1022. // 请求出错清除轮询
  1023. clearInterval(this.timer)
  1024. })
  1025. },
  1026. // 延迟更新列表数据
  1027. updateList () {
  1028. setTimeout(() => {
  1029. this.getData(this.activeTab)
  1030. }, 750)
  1031. },
  1032. // 查询
  1033. search () {
  1034. this.dataList = []
  1035. this.paginate = {}
  1036. this.getData(this.activeTab)
  1037. },
  1038. // 删除暂存数据
  1039. remove () {
  1040. if (!this.selection.length) {
  1041. this.$message.warning('请选择暂存事务!')
  1042. return
  1043. }
  1044. const idList = []
  1045. this.selection.forEach(i => idList.push(i.id))
  1046. ActionUtils.removeRecord(idList).then(ids => {
  1047. removeDraft({ ids }).then(() => {
  1048. ActionUtils.removeSuccessMessage()
  1049. this.selection = []
  1050. this.search()
  1051. })
  1052. }).catch(() => { })
  1053. },
  1054. async changeTab () {
  1055. // 数据、筛选条件初始化
  1056. this.dataList = []
  1057. this.paginate = {}
  1058. this.selection = []
  1059. this.typeId = ''
  1060. this.defaultPagination.page = 1
  1061. if (this.activeTab === 'gr') {
  1062. // this.getDpmInfo()
  1063. tabList.forEach((item, index) => {
  1064. if (item.key !== 'gr' && item.key !== 'zt') {
  1065. let finish = ''
  1066. if (item.key === 'finish') {
  1067. finish = 'finish'
  1068. }
  1069. operate[item.key](this.getFormatParams(null, this.defaultPagination, finish)).then(response => {
  1070. grdata[index].dataText = response.data.pageResult.length > 0 ? '0' : response.data.pageResult.totalCount
  1071. })
  1072. }
  1073. })
  1074. } else if (this.activeTab === 'zt') {
  1075. this.loading = true
  1076. setTimeout(() => {
  1077. this.loading = false
  1078. }, 30000)
  1079. await this.chartLoading()
  1080. await this.getTtaskMattersData()
  1081. console.log(this.optionPerson)
  1082. var chartDom1 = document.getElementById('a1')
  1083. var myChart1 = echarts.init(chartDom1)
  1084. myChart1.setOption(this.option)
  1085. var chartDom2 = document.getElementById('a2')
  1086. var myChart2 = echarts.init(chartDom2)
  1087. myChart2.setOption(this.optionPerson)
  1088. this.loading = false
  1089. } else {
  1090. this.getData(this.activeTab)
  1091. }
  1092. },
  1093. // 数组去重
  1094. unique (arr) {
  1095. const res = new Map()
  1096. return arr.filter(arr => !res.has(arr.id) && res.set(arr.id, 1))
  1097. },
  1098. // 分页
  1099. changePage (val) {
  1100. this.dataList = []
  1101. this.paginate = {}
  1102. this.defaultPagination.page = val
  1103. this.getData(this.activeTab)
  1104. },
  1105. // 转换状态码
  1106. contOfValue (cont) {
  1107. const s = taskState[cont]
  1108. return s || '暂停'
  1109. },
  1110. getFormatParams (v, pagination, finish) {
  1111. const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
  1112. if (this.$utils.isNotEmpty(this.searchParams.typeId)) {
  1113. params[`Q^${paramsType[this.activeTab]}TYPE_ID_^S`] = this.searchParams.typeId
  1114. }
  1115. if (this.$utils.isNotEmpty(this.searchParams.subject)) {
  1116. params[`Q^${paramsType[this.activeTab]}subject_^SL`] = this.searchParams.subject
  1117. }
  1118. if (this.searchParams.createTime && this.searchParams.createTime.length) {
  1119. params[`Q^${paramsType[this.activeTab]}create_time_^DL`] = dateFormat(this.searchParams.createTime[0]).slice(0, 10)
  1120. params[`Q^${paramsType[this.activeTab]}create_time_^DG`] = dateFormat(this.searchParams.createTime[1]).slice(0, 10)
  1121. }
  1122. if (this.activeTab === 'finish' || finish == 'finish') {
  1123. params.end = '1'
  1124. }
  1125. return ActionUtils.formatParams(params, pagination, this.sorts)
  1126. },
  1127. // 处理表格点击事件
  1128. handleLinkClick (data) {
  1129. this.taskId = data.id || ''
  1130. this.waiJian = data.waiJian || ''
  1131. this.instanceId = data.id || ''
  1132. this.defId = data.procDefId || ''
  1133. this.proInstId = data.id || ''
  1134. this.FlowName = data.name
  1135. this.processName = this.getProjectName(data.procDefKey, data.subject)
  1136. this.dialogFormVisible = true
  1137. },
  1138. // 开关右侧栏抽屉
  1139. handleClose () {
  1140. this.drawer = !this.drawer
  1141. },
  1142. // 文字替换
  1143. getParenthesesStr (text) {
  1144. let result = ''
  1145. if (!text) return result
  1146. const regex1 = /\{(.+?)\}/g
  1147. const regex2 = /\((.+?)\)/g
  1148. const options1 = text.match(regex1)
  1149. const options2 = text.match(regex2)
  1150. const options = options1 && options1.length ? options1 : options2
  1151. if (options) {
  1152. const option = options[0]
  1153. if (option) {
  1154. result = option.substring(1, option.length - 1)
  1155. }
  1156. if (options[1]) {
  1157. const yersOption = options[1]
  1158. if (yersOption) {
  1159. result = result + '/' + yersOption.substring(1, yersOption.length - 1)
  1160. }
  1161. }
  1162. }
  1163. return result.split('/')
  1164. },
  1165. // 判断是否为检测项目流程,是则截取流程标题为表单名称
  1166. getProjectName (key, subject) {
  1167. // 从store中获取保存的检测流程信息数组,默认设置已知的四个流程key(三非通用一通用),流程key有变化需修改此处默认值
  1168. const { testingList = ['Process_0idt26n', 'Process_1rwhy1r', 'Process_05lkhio', 'Process_140upmu'] } = this.$store.getters
  1169. const res = testingList.includes(key)
  1170. return res ? subject.includes('#') ? subject.split('#')[0] : '' : ''
  1171. },
  1172. /**
  1173. * 主管提醒
  1174. * 数据处理,将所有待办数据根据是否过期处理为两个数组
  1175. * 过期判断依据:普通事务-创建时间到当前时间超过三天即为过期;计划事务【事务名称中含计划】-创建当月月末前七天
  1176. * 逻辑说明:过期数组中不存于在主管提醒表中的数据插入主管提醒表,并发送内部通知,主管提醒表删除不存在于未过期数组中的数据
  1177. */
  1178. urgeToManager () {
  1179. const { userId } = this.$store.getters
  1180. const params = {
  1181. parameters: [],
  1182. sorts: []
  1183. }
  1184. const sql = `select id_, shi_wu_id_ as taskId from t_gqswb where position('${userId}' in chu_li_ren_id_) FOR UPDATE`
  1185. // Promise.all([pending(params), curdPost('sql', sql)]).then(([res1, res2]) => {
  1186. // let workData = res1.data && res1.data.dataResult
  1187. // let noticeData = res2.variables && res2.variables.data
  1188. // if (!workData || !workData.length) {
  1189. // return
  1190. // }
  1191. // this.dealData(workData, noticeData)
  1192. // })
  1193. pending(params).then(res1 => {
  1194. const workData = res1.data && res1.data.dataResult
  1195. curdPost('sql', sql).then(res2 => {
  1196. const noticeData = res2.variables && res2.variables.data
  1197. if (!workData || !workData.length) {
  1198. return
  1199. }
  1200. this.dealData(workData, noticeData)
  1201. })
  1202. })
  1203. },
  1204. // 处理数据
  1205. dealData (workList, noticeList) {
  1206. const result = {
  1207. expire: [],
  1208. unexpire: [],
  1209. all: []
  1210. }
  1211. const currentTime = Date.now()
  1212. // 筛选已过期数据
  1213. workList.forEach(item => {
  1214. // 截取流程名
  1215. item.workName = item.subject.includes('#') ? item.subject.split('#')[0] : item.subject.split('(')[0]
  1216. item.workType = this.plan.includes(item.procDefKey) ? 'plan' : 'normal'
  1217. const isExpire = this.judgeExpire(item.createTime, currentTime, item.workType)
  1218. if (isExpire) {
  1219. result.expire.push(item)
  1220. } else {
  1221. result.unexpire.push(item)
  1222. }
  1223. result.all.push(item)
  1224. })
  1225. // console.log('处理后数据:', result)
  1226. // 有过期数据才执行过期数据处理
  1227. if (result.expire.length) {
  1228. this.dealExpile(result.expire, noticeList)
  1229. }
  1230. // 主管提醒表中有数据才执行数据删除
  1231. if (noticeList && noticeList.length) {
  1232. this.dealUnexpile(result.all, noticeList)
  1233. }
  1234. },
  1235. // 判断是否过期、获取办理状态
  1236. judgeExpire (time, current, type, isState) {
  1237. const D = new Date(time)
  1238. const a = new Date(time).getTime()
  1239. const b = new Date(current).getTime()
  1240. // 创建时间当月最后一天的时间戳
  1241. const c = new Date(D.getFullYear(), D.getMonth() + 1, 0).getTime() + 86400000
  1242. // 返回办理状态
  1243. if (isState) {
  1244. let state = ''
  1245. if (type === 'plan') {
  1246. state = b >= c ? 'overtime' : b + (86400000 * 7) > c ? 'soon' : 'wait'
  1247. } else {
  1248. state = a + (86400000 * 3) < b ? 'overtime' : 'wait'
  1249. }
  1250. return state
  1251. }
  1252. // 返回是否过期
  1253. if (type === 'plan') {
  1254. return b + (86400000 * 7) > c
  1255. } else {
  1256. return a + (86400000 * 3) < b
  1257. }
  1258. },
  1259. // 处理已过期数据
  1260. dealExpile (data, noticeList) {
  1261. // console.log('已过期流程数据:', data)
  1262. // console.log('过期事务表数据:', noticeList)
  1263. const { userId } = this.$store.getters
  1264. const addList = []
  1265. const sendList = []
  1266. const msgContent = {
  1267. plan: '距离过期还剩七天,请及时处理!',
  1268. normal: '至今三天未处理,已超时,请及时处理!'
  1269. }
  1270. const msgTitle = {
  1271. plan: '计划事务即将到期提醒',
  1272. normal: '事务超时提醒'
  1273. }
  1274. const nowTime = new Date(new Date().getTime() + 28800000).toJSON().slice(0, 16).replace('T', ' ')
  1275. data.forEach(item => {
  1276. const isExist = !!noticeList.find(i => i.taskId === item.taskId)
  1277. // 筛选出不存在于主管提醒表的过期数据
  1278. if (!isExist) {
  1279. // 无部门信息的用户不往过期事务表加数据
  1280. if (this.orgInfo.groupID) {
  1281. const obj = {
  1282. // 事务ID
  1283. shi_wu_id_: item.taskId,
  1284. // 完整名称
  1285. wan_zheng_ming_ch: item.subject,
  1286. // 事务说明
  1287. shi_wu_shuo_ming_: item.subject.includes('#') ? item.subject.split('#')[1] : '',
  1288. // 事务名称
  1289. shi_wu_ming_cheng: item.workName,
  1290. // 事务状态
  1291. shi_wu_zhuang_tai: `待${item.name}`,
  1292. // 事务类型
  1293. shi_wu_lei_xing_: item.workType,
  1294. chu_li_ren_ming_: item.ownerName,
  1295. chu_li_ren_id_: this.getInfoByName(item.ownerName, 'id'),
  1296. chu_li_ren_dian_h: this.getInfoByName(item.ownerName, 'phone'),
  1297. bu_men_: this.orgInfo.orgName,
  1298. bu_men_id_: this.orgInfo.groupID,
  1299. // 主管ID与当前用户id相等时将主管ID设置为主任【】的ID,主管电话设为空
  1300. zhu_guan_id_: this.orgInfo.id === userId ? '990927120278487040' : this.orgInfo.id,
  1301. zhu_guan_dian_hua: this.orgInfo.id === userId ? '' : this.orgInfo.mobile,
  1302. bian_zhi_shi_jian: item.createTime,
  1303. ti_xing_ci_shu_: 1,
  1304. duan_xin_ci_shu_: 0,
  1305. ti_xing_shi_jian_: nowTime
  1306. }
  1307. addList.push(obj)
  1308. }
  1309. const msg = {
  1310. subject: msgTitle[item.workType],
  1311. content: `<p>事务【${item.workName}】${msgContent[item.workType]}<p>`,
  1312. receiverId: userId,
  1313. canreply: '0',
  1314. taskId: item.taskId
  1315. }
  1316. sendList.push(msg)
  1317. }
  1318. })
  1319. const addParams = {
  1320. tableName: 't_gqswb',
  1321. paramWhere: addList
  1322. }
  1323. // console.log('新增过期事务表数据:', addList, '发送消息数据', sendList)
  1324. if (addList.length) {
  1325. curdPost('add', JSON.stringify(addParams))
  1326. }
  1327. if (sendList.length) {
  1328. this.sendMsg(sendList)
  1329. }
  1330. },
  1331. // 删除已办的提醒表数据
  1332. dealUnexpile (data, noticeList) {
  1333. // 清除存在于主管提醒表中【处理人含我】,但是不存在于待办中的数据
  1334. const deleteList = []
  1335. noticeList.forEach(item => {
  1336. const isExist = !!data.find(i => i.taskId === item.taskId)
  1337. if (!isExist) {
  1338. deleteList.push(item.id_)
  1339. }
  1340. })
  1341. // console.log('过期事务表中需删除的数据:', deleteList)
  1342. if (!deleteList.length) {
  1343. return
  1344. }
  1345. const params = `{"tableName": "t_gqswb","paramWhere":"{id_:'${deleteList.join(',')}'}"}`
  1346. curdPost('batchDelete', params).then(() => {}).catch(err => {
  1347. console.log(err)
  1348. })
  1349. },
  1350. // 发送站内消息
  1351. sendMsg (data) {
  1352. data.forEach(item => {
  1353. save(item).then(() => {}).catch(err => {
  1354. console.log(err)
  1355. })
  1356. })
  1357. },
  1358. // 通过名字获取id/电话
  1359. getInfoByName (names, type) {
  1360. const res = {
  1361. id: [],
  1362. phone: []
  1363. }
  1364. const temp = names.split(',')
  1365. temp.forEach(item => {
  1366. const t = this.userList.find(i => i.userName === item)
  1367. if (t) {
  1368. res.id.push(t.userId)
  1369. res.phone.push(t.phone)
  1370. }
  1371. })
  1372. return res[type].filter(i => i).join(',')
  1373. },
  1374. // 时间戳转时间
  1375. TimestampToDate2 (Timestamp) {
  1376. const now = new Date(Timestamp)
  1377. const y = now.getFullYear()
  1378. const m = now.getMonth() + 1
  1379. const d = now.getDate()
  1380. return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) + ' ' + now.toTimeString().substr(0, 8)
  1381. },
  1382. // 根据指定日期获取本周一到下周一日期
  1383. getWeekDataList (data) {
  1384. // 根据日期获取本周周一~周日的年-月-日
  1385. var weekList = []
  1386. var date = new Date(data)
  1387. // 判断本日期是否为周日,获取本周一日期
  1388. if (date.getDay() === '0') {
  1389. date.setDate(date.getDate() - 6)
  1390. } else {
  1391. date.setDate(date.getDate() - date.getDay() + 1)
  1392. }
  1393. var myDate = date.getDate()
  1394. var myMonth = date.getMonth() + 1
  1395. if (date.getDate() < 10) {
  1396. myDate = '0' + myDate
  1397. }
  1398. if (date.getMonth() + 1 < 10) {
  1399. myMonth = '0' + myMonth
  1400. }
  1401. weekList.push(date.getFullYear() + '-' + myMonth + '-' + myDate)
  1402. // 获取周二到下周一日期
  1403. for (var i = 0; i < 7; i++) {
  1404. date.setDate(date.getDate() + 1)
  1405. myDate = date.getDate()
  1406. myMonth = date.getMonth() + 1
  1407. if (date.getDate() < 10) {
  1408. myDate = '0' + myDate
  1409. }
  1410. if (date.getMonth() + 1 < 10) {
  1411. myMonth = '0' + myMonth
  1412. }
  1413. weekList.push(date.getFullYear() + '-' + myMonth + '-' + myDate)
  1414. }
  1415. // console.log(weekList)
  1416. return weekList
  1417. },
  1418. // 根据指定日期获取本本月20号下月1号日期
  1419. getMonthDataList (data) {
  1420. var date = new Date(data)
  1421. // 获取该日期所在的年份和月份
  1422. var year = date.getFullYear()
  1423. var month = date.getMonth() // 注意:月份是从0开始的,所以10月是9
  1424. // 创建一个新的日期对象,设置为该年的该月的20号
  1425. var twentyFifth = new Date(year, month, 20, 1, 0, 0)
  1426. // 计算下个月的年份和月份
  1427. var nextMonth = month + 1
  1428. var nextMonthYear = year
  1429. if (nextMonth > 11) { // 如果月份超过11(即12月),则年份加1,月份重置为0(即1月)
  1430. nextMonth = 0
  1431. nextMonthYear += 1
  1432. }
  1433. // 创建一个新的日期对象,设置为下个月的1号
  1434. var firstDayOfNextMonth = new Date(nextMonthYear, nextMonth, 1, 1, 0, 0)
  1435. // console.log(twentyFifth, firstDayOfNextMonth)
  1436. return [twentyFifth, firstDayOfNextMonth]
  1437. }
  1438. }
  1439. }
  1440. </script>
  1441. <style lang="scss" scoped>
  1442. .el-completing {
  1443. background: #409eff !important;
  1444. }
  1445. .el-col {
  1446. min-height: 1px;
  1447. }
  1448. .firstcol {
  1449. padding-right: 10px;
  1450. }
  1451. .el-nothing {
  1452. font-size: 13px;
  1453. }
  1454. .calendar-day {
  1455. text-align: center;
  1456. color: #202535;
  1457. line-height: 30px;
  1458. font-size: 12px;
  1459. }
  1460. .is-selected {
  1461. color: #f8a535;
  1462. font-size: 10px;
  1463. margin-top: 5px;
  1464. }
  1465. #calendar .el-button-group > .el-button:not(:first-child):not(:last-child):after {
  1466. content: '当月';
  1467. }
  1468. #calendar .item {
  1469. position: relative;
  1470. margin: 0;
  1471. padding: 0;
  1472. height: auto;
  1473. border-radius: 4px;
  1474. -webkit-box-sizing: border-box;
  1475. box-sizing: border-box;
  1476. overflow: hidden;
  1477. color: #f8a535;
  1478. }
  1479. .ibps-list-split .ibps-list-item {
  1480. border-bottom: 1px solid #dcdfe6;
  1481. padding: 6px 0;
  1482. }
  1483. .jbd-font-style {
  1484. font-weight: bold;
  1485. }
  1486. .home-text-border {
  1487. color: #999999;
  1488. 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);
  1489. min-height: 20px;
  1490. font-size: 14px;
  1491. margin-left: 60px;
  1492. margin-bottom: 5px;
  1493. }
  1494. .jbd-home-card {
  1495. overflow: auto;
  1496. }
  1497. .jbd-home-task {
  1498. width: 100%;
  1499. padding: 10px;
  1500. cursor: pointer;
  1501. font-size: 12px;
  1502. margin-bottom: 35px;
  1503. }
  1504. .jbd-home-card::-webkit-scrollbar {
  1505. display: none;
  1506. }
  1507. .jbd-control-cont {
  1508. text-align: center;
  1509. position: absolute;
  1510. z-index: 10;
  1511. right: 0px;
  1512. top: 50%;
  1513. }
  1514. .tab-container {
  1515. >div {
  1516. display: inline-block;
  1517. }
  1518. .table-container {
  1519. width: calc(100% - 250px);
  1520. vertical-align: top;
  1521. .search-container {
  1522. display: flex;
  1523. margin-bottom: 10px;
  1524. .search-box {
  1525. display: flex;
  1526. align-items: center;
  1527. height: 30px;
  1528. margin-right: 20px;
  1529. .label {
  1530. margin: 0 6px 0 6px;
  1531. color: #606266;
  1532. font-size: 12px;
  1533. }
  1534. .input {
  1535. width: 200px;
  1536. font-size: 12px;
  1537. height: 28px !important;
  1538. line-height: 28px;
  1539. color: #606266;
  1540. ::v-deep .el-input__inner {
  1541. height: 28px;
  1542. line-height: 28px;
  1543. }
  1544. }
  1545. }
  1546. .btn {
  1547. height: 30px;
  1548. margin-left: 10px;
  1549. background-color: #409eff;
  1550. border-color: #409eff;
  1551. font-size: 12px;
  1552. border-radius: 3px;
  1553. padding: 7px 15px;
  1554. }
  1555. .el-button--danger {
  1556. background-color: #f56c6c;
  1557. border-color: #f56c6c;
  1558. }
  1559. }
  1560. }
  1561. }
  1562. </style>
  1563. <style>
  1564. .ibps-desktop-dashboard{
  1565. padding: 100px 200px;
  1566. }
  1567. .ibps-desktop-dashboard .item{
  1568. height: 150px !important;
  1569. }
  1570. .app-container .el-drawer.rtl {
  1571. overflow: scroll;
  1572. }
  1573. .app-container .el-table th {
  1574. background-color: #a7d6f8 !important;
  1575. font-size: 14px;
  1576. font-weight: bold;
  1577. color: #000000;
  1578. border: 0px;
  1579. }
  1580. .app-container .el-table td {
  1581. padding: 4px;
  1582. }
  1583. .app-container .el-table .warning-row {
  1584. background: #d3ebfc;
  1585. color: #000000;
  1586. }
  1587. .app-container .el-table .success-row {
  1588. background: #f9ffff;
  1589. color: #000000;
  1590. }
  1591. </style>