index.vue 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228
  1. <template>
  2. <div class="ele-body">
  3. <el-card
  4. class="card_box"
  5. :body-style="{
  6. display: 'flex',
  7. flexDirection: 'column',
  8. alignItems: 'flex-start'
  9. }"
  10. shadow="never"
  11. >
  12. <!-- 动态表单配置-->
  13. <div class="content-box">
  14. <div
  15. v-for="category in Object.keys(templateList)"
  16. :key="category"
  17. class="category_box"
  18. >
  19. <div class="category_box_title">{{
  20. getDictV('collaborative_type', category)
  21. }}</div>
  22. <div class="category_box_content">
  23. <div
  24. v-for="v in templateList[category]"
  25. :key="v.id"
  26. class="category_content"
  27. :title="v.name"
  28. @click="handleStartProcess(v)"
  29. >
  30. <svg-icon
  31. style="width: 1.5em; height: 1.5em"
  32. :icon-class="v.icon"
  33. className="svg-icon-set"
  34. ></svg-icon>
  35. <span>
  36. {{
  37. v.name.length > 3
  38. ? v.name[0] + v.name[1] + v.name[2] + '...'
  39. : v.name
  40. }}
  41. </span>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="tab-box el-form-box">
  47. <el-tabs type="border-card">
  48. <el-tab-pane label="个人记录">
  49. <ele-pro-table
  50. ref="table"
  51. height="calc(100vh - 450px)"
  52. :columns="columns"
  53. :datasource="datasource"
  54. :init-load="false"
  55. @columns-change="handleColumnChange"
  56. :cache-key="cacheKeyUrl"
  57. :page-size="20"
  58. >
  59. <template v-slot:toolbar="{ row }">
  60. <div class="filter-container">
  61. <el-form
  62. class="ele-form-search"
  63. @keyup.enter.native="reload"
  64. @submit.native.prevent
  65. >
  66. <el-row
  67. :gutter="15"
  68. style="display: flex; align-items: center"
  69. >
  70. <el-col v-bind="{ span: 4 }">
  71. <el-form-item label="分类:" label-width="60px">
  72. <el-select v-model="params.dictType">
  73. <el-option
  74. v-for="(item, index) in dictList[
  75. 'collaborative_type'
  76. ]"
  77. :key="index"
  78. :value="item.value"
  79. :label="item.label"
  80. ></el-option>
  81. </el-select>
  82. </el-form-item>
  83. </el-col>
  84. <el-col v-bind="{ span: 4 }">
  85. <el-form-item label="单据:" label-width="60px">
  86. <el-select v-model="params.formId">
  87. <el-option
  88. v-for="(item, index) in templateList[
  89. params.dictType
  90. ]"
  91. :key="index"
  92. :value="item.id"
  93. :label="item.name"
  94. ></el-option>
  95. </el-select>
  96. </el-form-item>
  97. </el-col>
  98. <el-col v-bind="{ span: 4 }">
  99. <el-form-item
  100. label="结果:"
  101. prop="result"
  102. label-width="60px"
  103. >
  104. <!-- <el-select
  105. v-model="params.status"
  106. placeholder="请选择状态"
  107. clearable
  108. >
  109. <el-option
  110. v-for="dict in statusList"
  111. :key="dict.value"
  112. :label="dict.label"
  113. :value="dict.value"
  114. />
  115. </el-select> -->
  116. <DictSelection
  117. dictName="流程实例的结果"
  118. clearable
  119. v-model="params.result"
  120. >
  121. </DictSelection>
  122. </el-form-item>
  123. </el-col>
  124. <el-col v-bind="{ span: 10 }">
  125. <el-form-item
  126. label="创建时间:"
  127. prop="createTime1"
  128. label-width="90px"
  129. >
  130. <el-date-picker
  131. v-model="createTime1"
  132. style="width: 100%"
  133. value-format="yyyy-MM-dd HH:mm:ss"
  134. type="daterange"
  135. range-separator="-"
  136. start-placeholder="开始日期"
  137. end-placeholder="结束日期"
  138. :default-time="['00:00:00', '23:59:59']"
  139. />
  140. </el-form-item>
  141. </el-col>
  142. </el-row>
  143. </el-form>
  144. </div>
  145. </template>
  146. <template v-slot:toolkit="{ row }">
  147. <div class="filter-container">
  148. <div class="ele-form-actions">
  149. <el-button
  150. type="primary"
  151. icon="el-icon-search"
  152. class="ele-btn-icon"
  153. @click="reload"
  154. >
  155. 查询
  156. </el-button>
  157. <el-button @click="reset">重置</el-button>
  158. </div>
  159. </div>
  160. </template>
  161. <template v-slot:result="{ row }">
  162. <el-tag
  163. size="medium"
  164. :type="
  165. getTimelineItemType(
  166. getDictValue('流程实例的结果', row.result)
  167. )
  168. "
  169. >
  170. {{ getDictValue('流程实例的结果', row.result) }}
  171. </el-tag>
  172. </template>
  173. <template v-slot:dictType="{ row }">
  174. {{ getDictV('collaborative_type', row.dictType) }}
  175. </template>
  176. <template v-slot:durationInMillis="{ row }">
  177. {{ getDateTime(row.durationInMillis) }}
  178. </template>
  179. <template v-slot:name="{ row }">
  180. <el-link
  181. type="primary"
  182. :underline="false"
  183. @click="handleDetail(row)"
  184. >
  185. {{ row.name }}
  186. </el-link>
  187. </template>
  188. <template
  189. v-if="formColumnList.length"
  190. v-for="(item, index) in formColumnList"
  191. v-slot:[item.model]="{ row }"
  192. >
  193. <div v-if="item.type == 'imgupload'">
  194. <el-image
  195. v-if="row[item.model].length"
  196. style="width: 100px; height: 100px"
  197. :src="row[item.model][0].url"
  198. :preview-src-list="row[item.model].map((i) => i.url)"
  199. >
  200. </el-image>
  201. </div>
  202. <div v-else-if="item.type == 'fileupload'">
  203. <el-button
  204. type="text"
  205. v-if="row[item.model]?.length"
  206. @click="getFiles(row[item.model])"
  207. >下载
  208. </el-button>
  209. </div>
  210. <div v-else-if="item.type == 'userSelect'">
  211. {{ getUserName(row[item.model]) }}
  212. </div>
  213. <div v-else-if="item.type == 'deptAndUserCascader'">
  214. {{ getDeptAndUserName(row[item.model]) }}
  215. </div>
  216. <div v-else-if="item.type == 'deptCascader'">
  217. {{ getDeptName(row[item.model]) }}
  218. </div>
  219. <div v-else>
  220. {{ row[item.model] }}
  221. </div>
  222. </template>
  223. <!-- 操作列 -->
  224. <template v-slot:action="{ row }">
  225. <el-button
  226. size="mini"
  227. type="text"
  228. icon="el-icon-edit"
  229. @click="handleAudit(row)"
  230. >详情
  231. </el-button>
  232. </template>
  233. </ele-pro-table>
  234. </el-tab-pane>
  235. <el-tab-pane label="部门记录">
  236. <ele-pro-table
  237. ref="deptTable"
  238. :columns="deptColumns"
  239. :datasource="deptDatasource"
  240. cache-key="deptDatasource"
  241. :toolkit="[]"
  242. height="calc(100vh - 450px)"
  243. :init-load="false"
  244. >
  245. <template v-slot:toolbar="{ row }">
  246. <div class="filter-container">
  247. <el-form
  248. class="ele-form-search"
  249. @keyup.enter.native="deptReload"
  250. @submit.native.prevent
  251. >
  252. <el-row
  253. :gutter="15"
  254. style="display: flex; align-items: center"
  255. >
  256. <el-col v-bind="{ span: 4 }">
  257. <el-form-item label="分类:" label-width="60px">
  258. <el-select v-model="params.dictType">
  259. <el-option
  260. v-for="(item, index) in dictList[
  261. 'collaborative_type'
  262. ]"
  263. :key="index"
  264. :value="item.value"
  265. :label="item.label"
  266. ></el-option>
  267. </el-select>
  268. </el-form-item>
  269. </el-col>
  270. <el-col v-bind="{ span: 4 }">
  271. <el-form-item label="单据:" label-width="60px">
  272. <el-select v-model="params.formId">
  273. <el-option
  274. v-for="(item, index) in defaultTemplateList"
  275. :key="index"
  276. :value="item.id"
  277. :label="item.name"
  278. ></el-option>
  279. </el-select>
  280. </el-form-item>
  281. </el-col>
  282. <el-col v-bind="{ span: 4 }">
  283. <el-form-item
  284. label="结果:"
  285. prop="result"
  286. label-width="60px"
  287. >
  288. <!-- <el-select
  289. v-model="params.status"
  290. placeholder="请选择状态"
  291. clearable
  292. >
  293. <el-option
  294. v-for="dict in statusList"
  295. :key="dict.value"
  296. :label="dict.label"
  297. :value="dict.value"
  298. />
  299. </el-select> -->
  300. <DictSelection
  301. dictName="流程实例的结果"
  302. clearable
  303. v-model="params.result"
  304. >
  305. </DictSelection>
  306. </el-form-item>
  307. </el-col>
  308. <el-col v-bind="{ span: 4 }">
  309. <el-form-item
  310. label="发起人:"
  311. prop="startUserName"
  312. label-width="70px"
  313. >
  314. <el-input v-model="params.startUserName"></el-input>
  315. </el-form-item>
  316. </el-col>
  317. <el-col v-bind="{ span: 6 }">
  318. <el-form-item
  319. label="创建时间:"
  320. prop="createTime1"
  321. label-width="90px"
  322. >
  323. <el-date-picker
  324. v-model="createTime1"
  325. style="width: 100%"
  326. value-format="yyyy-MM-dd HH:mm:ss"
  327. type="daterange"
  328. range-separator="-"
  329. start-placeholder="开始日期"
  330. end-placeholder="结束日期"
  331. :default-time="['00:00:00', '23:59:59']"
  332. />
  333. </el-form-item>
  334. </el-col>
  335. </el-row>
  336. </el-form>
  337. </div>
  338. </template>
  339. <template v-slot:toolkit="{ row }">
  340. <div class="filter-container">
  341. <div class="ele-form-actions">
  342. <el-button
  343. type="primary"
  344. icon="el-icon-search"
  345. class="ele-btn-icon"
  346. @click="deptReload"
  347. >
  348. 查询
  349. </el-button>
  350. <el-button @click="deptReset">重置</el-button>
  351. </div>
  352. </div>
  353. </template>
  354. <template v-slot:dictType="{ row }">
  355. {{ getDictV('collaborative_type', row.dictType) }}
  356. </template>
  357. <template
  358. v-if="formColumnList.length"
  359. v-for="(item, index) in formColumnList"
  360. v-slot:[item.model]="{ row }"
  361. >
  362. <div v-if="item.type == 'imgupload'">
  363. <el-image
  364. v-if="row[item.model].length"
  365. style="width: 100px; height: 100px"
  366. :src="row[item.model][0].url"
  367. :preview-src-list="row[item.model].map((i) => i.url)"
  368. >
  369. </el-image>
  370. </div>
  371. <div v-else-if="item.type == 'fileupload'">
  372. <el-button
  373. type="text"
  374. v-if="row[item.model]?.length"
  375. @click="getFiles(row[item.model])"
  376. >下载
  377. </el-button>
  378. </div>
  379. <div v-else-if="item.type == 'userSelect'">
  380. {{ getUserName(row[item.model]) }}
  381. </div>
  382. <div v-else-if="item.type == 'deptAndUserCascader'">
  383. {{ getDeptAndUserName(row[item.model]) }}
  384. </div>
  385. <div v-else-if="item.type == 'deptCascader'">
  386. {{ getDeptName(row[item.model]) }}
  387. </div>
  388. <div v-else>
  389. {{ row[item.model] }}
  390. </div>
  391. </template>
  392. <template v-slot:result="{ row }">
  393. <el-tag
  394. size="medium"
  395. :type="
  396. getTimelineItemType(
  397. getDictValue('流程实例的结果', row.result)
  398. )
  399. "
  400. >
  401. {{ getDictValue('流程实例的结果', row.result) }}
  402. </el-tag>
  403. </template>
  404. <template v-slot:durationInMillis="{ row }">
  405. {{ getDateTime(row.durationInMillis) }}
  406. </template>
  407. <template v-slot:name="{ row }">
  408. <el-link
  409. type="primary"
  410. :underline="false"
  411. @click="handleDetail(row)"
  412. >
  413. {{ row.name }}
  414. </el-link>
  415. </template>
  416. <!-- 操作列 -->
  417. <template v-slot:action="{ row }">
  418. <el-button
  419. size="mini"
  420. type="text"
  421. icon="el-icon-edit"
  422. @click="handleAudit(row)"
  423. >详情
  424. </el-button>
  425. </template>
  426. </ele-pro-table>
  427. </el-tab-pane>
  428. <el-tab-pane label="通知我的记录">
  429. <ele-pro-table
  430. ref="noticeTable"
  431. :columns="deptColumns"
  432. :datasource="noticeDatasource"
  433. cache-key="noticeDatasource"
  434. height="calc(100vh - 450px)"
  435. :toolkit="[]"
  436. :init-load="false"
  437. >
  438. <template v-slot:toolbar="{ row }">
  439. <div class="filter-container">
  440. <el-form
  441. class="ele-form-search"
  442. @keyup.enter.native="noticeReload"
  443. @submit.native.prevent
  444. >
  445. <el-row
  446. :gutter="15"
  447. style="display: flex; align-items: center"
  448. >
  449. <el-col v-bind="{ span: 4 }">
  450. <el-form-item label="单据:" label-width="60px">
  451. <el-select v-model="params.dictType">
  452. <el-option
  453. v-for="(item, index) in dictList[
  454. 'collaborative_type'
  455. ]"
  456. :key="index"
  457. :value="item.value"
  458. :label="item.label"
  459. ></el-option>
  460. </el-select>
  461. </el-form-item>
  462. </el-col>
  463. <el-col v-bind="{ span: 4 }">
  464. <el-form-item label="分类:" label-width="60px">
  465. <el-select v-model="params.formId">
  466. <el-option
  467. v-for="(item, index) in defaultTemplateList"
  468. :key="index"
  469. :value="item.id"
  470. :label="item.name"
  471. ></el-option>
  472. </el-select>
  473. </el-form-item>
  474. </el-col>
  475. <el-col v-bind="{ span: 4 }">
  476. <el-form-item
  477. label="结果:"
  478. prop="result"
  479. label-width="60px"
  480. >
  481. <!-- <el-select
  482. v-model="params.status"
  483. placeholder="请选择状态"
  484. clearable
  485. >
  486. <el-option
  487. v-for="dict in statusList"
  488. :key="dict.value"
  489. :label="dict.label"
  490. :value="dict.value"
  491. />
  492. </el-select> -->
  493. <DictSelection
  494. dictName="流程实例的结果"
  495. clearable
  496. v-model="params.result"
  497. >
  498. </DictSelection>
  499. </el-form-item>
  500. </el-col>
  501. <el-col v-bind="{ span: 4 }">
  502. <el-form-item
  503. label="发起人:"
  504. prop="startUserName"
  505. label-width="70px"
  506. >
  507. <el-input v-model="params.startUserName"></el-input>
  508. </el-form-item>
  509. </el-col>
  510. <el-col v-bind="{ span: 6 }">
  511. <el-form-item
  512. label="创建时间:"
  513. prop="createTime1"
  514. label-width="90px"
  515. >
  516. <el-date-picker
  517. v-model="createTime1"
  518. style="width: 100%"
  519. value-format="yyyy-MM-dd HH:mm:ss"
  520. type="daterange"
  521. range-separator="-"
  522. start-placeholder="开始日期"
  523. end-placeholder="结束日期"
  524. :default-time="['00:00:00', '23:59:59']"
  525. />
  526. </el-form-item>
  527. </el-col>
  528. </el-row>
  529. </el-form>
  530. </div>
  531. </template>
  532. <template v-slot:toolkit="{ row }">
  533. <div class="filter-container">
  534. <div class="ele-form-actions">
  535. <el-button
  536. type="primary"
  537. icon="el-icon-search"
  538. class="ele-btn-icon"
  539. @click="noticeReload"
  540. >
  541. 查询
  542. </el-button>
  543. <el-button @click="noticeReset">重置</el-button>
  544. </div>
  545. </div>
  546. </template>
  547. <template v-slot:dictType="{ row }">
  548. {{ getDictV('collaborative_type', row.dictType) }}
  549. </template>
  550. <template
  551. v-if="formColumnList.length"
  552. v-for="(item, index) in formColumnList"
  553. v-slot:[item.model]="{ row }"
  554. >
  555. <div v-if="item.type == 'imgupload'">
  556. <el-image
  557. v-if="row[item.model].length"
  558. style="width: 100px; height: 100px"
  559. :src="row[item.model][0].url"
  560. :preview-src-list="row[item.model].map((i) => i.url)"
  561. >
  562. </el-image>
  563. </div>
  564. <div v-else-if="item.type == 'fileupload'">
  565. <el-button
  566. type="text"
  567. v-if="row[item.model]?.length"
  568. @click="getFiles(row[item.model])"
  569. >下载
  570. </el-button>
  571. </div>
  572. <div v-else-if="item.type == 'userSelect'">
  573. {{ getUserName(row[item.model]) }}
  574. </div>
  575. <div v-else-if="item.type == 'deptAndUserCascader'">
  576. {{ getDeptAndUserName(row[item.model]) }}
  577. </div>
  578. <div v-else-if="item.type == 'deptCascader'">
  579. {{ getDeptName(row[item.model]) }}
  580. </div>
  581. <div v-else>
  582. {{ row[item.model] }}
  583. </div>
  584. </template>
  585. <template v-slot:result="{ row }">
  586. <el-tag
  587. size="medium"
  588. :type="
  589. getTimelineItemType(
  590. getDictValue('流程实例的结果', row.result)
  591. )
  592. "
  593. >
  594. {{ getDictValue('流程实例的结果', row.result) }}
  595. </el-tag>
  596. </template>
  597. <template v-slot:durationInMillis="{ row }">
  598. {{ getDateTime(row.durationInMillis) }}
  599. </template>
  600. <template v-slot:name="{ row }">
  601. <el-link
  602. type="primary"
  603. :underline="false"
  604. @click="handleDetail(row)"
  605. >
  606. {{ row.name }}
  607. </el-link>
  608. </template>
  609. <!-- 操作列 -->
  610. <template v-slot:action="{ row }">
  611. <el-button
  612. size="mini"
  613. type="text"
  614. icon="el-icon-edit"
  615. @click="handleAudit(row)"
  616. >详情
  617. </el-button>
  618. </template>
  619. </ele-pro-table>
  620. </el-tab-pane>
  621. </el-tabs>
  622. </div>
  623. </el-card>
  624. <process-submit-dialog
  625. :process-submit-dialog-flag.sync="processSubmitDialogFlag"
  626. v-if="processSubmitDialogFlag"
  627. ref="processSubmitDialogRef"
  628. @reload="reload"
  629. ></process-submit-dialog>
  630. <detail ref="detailRef"></detail>
  631. <formDetail
  632. v-if="formDetailDialogFlag"
  633. ref="formDetailDialogRef"
  634. :form-detail-dialog-flag.sync="formDetailDialogFlag"
  635. ></formDetail>
  636. </div>
  637. </template>
  638. <script>
  639. import {
  640. getBpmCustomFormList,
  641. getProcessInstanceDeptPage,
  642. getProcessInstanceNoticePage,
  643. getProcessInstancePage
  644. } from '@/api/bpm/task';
  645. import { getDate } from '@/utils/dateUtils';
  646. import dictMixins from '@/mixins/dictMixins';
  647. import detail from '@/views/bpm/processInstance/detail.vue';
  648. import formDetail from './detail.vue';
  649. import { getByCode } from '@/api/system/dictionary-data';
  650. import { getFile } from '@/api/system/file';
  651. import { getUserPage } from '@/api/tickets';
  652. import { listOrganizations } from '@/api/system/organization';
  653. import tabMixins from '@/mixins/tableColumnsMixin';
  654. // 默认表单数据
  655. const defaultParams = {
  656. dictType: '',
  657. status: '',
  658. name: '',
  659. formId: ''
  660. };
  661. export default {
  662. name: 'index',
  663. components: {
  664. detail,
  665. formDetail
  666. },
  667. mixins: [dictMixins, tabMixins],
  668. data() {
  669. return {
  670. cacheKeyUrl: 'wt-eaf1548b-collaborative',
  671. configFormDialogFlag: false,
  672. processSubmitDialogFlag: false,
  673. formDetailDialogFlag: false,
  674. templateList: {},
  675. dictList: {},
  676. defaultTemplateList: [],
  677. userList: [],
  678. deptList: [],
  679. params: { ...defaultParams },
  680. statusList: [],
  681. formColumnList: [],
  682. createTime1: []
  683. };
  684. },
  685. computed: {
  686. // 是否开启响应式布局
  687. styleResponsive() {
  688. return this.$store.state.theme.styleResponsive;
  689. },
  690. columns() {
  691. let list = this.formColumnList.map((item) => {
  692. return {
  693. prop: item.model,
  694. label: item.name,
  695. align: 'center',
  696. slot: item.model,
  697. showOverflowTooltip: true,
  698. minWidth: 120
  699. };
  700. });
  701. return [
  702. {
  703. columnKey: 'index',
  704. label: '序号',
  705. type: 'index',
  706. width: 55,
  707. align: 'center',
  708. showOverflowTooltip: true,
  709. fixed: 'left'
  710. },
  711. {
  712. prop: 'dictType',
  713. label: '分类',
  714. align: 'center',
  715. slot: 'dictType',
  716. showOverflowTooltip: true,
  717. minWidth: 70
  718. },
  719. {
  720. prop: 'formName',
  721. label: '单据',
  722. align: 'center',
  723. slot: 'formName',
  724. showOverflowTooltip: true,
  725. minWidth: 70
  726. },
  727. {
  728. prop: 'name',
  729. label: '名称',
  730. align: 'center',
  731. slot: 'name',
  732. showOverflowTooltip: true,
  733. minWidth: 80
  734. },
  735. ...list,
  736. {
  737. prop: 'result',
  738. slot: 'result',
  739. label: '结果',
  740. align: 'center',
  741. showOverflowTooltip: true,
  742. minWidth: 80
  743. },
  744. {
  745. prop: 'endTime',
  746. label: '审批时间',
  747. align: 'center',
  748. showOverflowTooltip: true,
  749. minWidth: 120
  750. },
  751. {
  752. prop: 'createTime',
  753. label: '创建时间',
  754. align: 'center',
  755. showOverflowTooltip: true,
  756. minWidth: 120
  757. },
  758. // {
  759. // prop: 'durationInMillis',
  760. // slot: 'durationInMillis',
  761. // label: '耗时',
  762. // align: 'center',
  763. // showOverflowTooltip: true,
  764. // minWidth: 130
  765. // },
  766. {
  767. columnKey: 'action',
  768. label: '操作',
  769. width: 100,
  770. align: 'center',
  771. resizable: false,
  772. slot: 'action',
  773. showOverflowTooltip: true,
  774. fixed: 'right'
  775. }
  776. ];
  777. },
  778. deptColumns() {
  779. let list = this.formColumnList.map((item) => {
  780. return {
  781. prop: item.model,
  782. label: item.name,
  783. align: 'center',
  784. slot: item.model,
  785. showOverflowTooltip: true,
  786. minWidth: 120
  787. };
  788. });
  789. return [
  790. {
  791. columnKey: 'index',
  792. label: '序号',
  793. type: 'index',
  794. width: 55,
  795. align: 'center',
  796. showOverflowTooltip: true,
  797. fixed: 'left'
  798. },
  799. {
  800. prop: 'dictType',
  801. label: '分类',
  802. align: 'center',
  803. slot: 'dictType',
  804. showOverflowTooltip: true,
  805. minWidth: 70
  806. },
  807. {
  808. prop: 'formName',
  809. label: '单据',
  810. align: 'center',
  811. slot: 'formName',
  812. showOverflowTooltip: true,
  813. minWidth: 70
  814. },
  815. {
  816. prop: 'name',
  817. label: '名称',
  818. align: 'center',
  819. slot: 'name',
  820. showOverflowTooltip: true,
  821. minWidth: 150
  822. },
  823. {
  824. prop: 'startUserName',
  825. label: '发起人',
  826. align: 'center',
  827. showOverflowTooltip: true,
  828. minWidth: 180
  829. },
  830. ...list,
  831. {
  832. prop: 'result',
  833. slot: 'result',
  834. label: '结果',
  835. align: 'center',
  836. showOverflowTooltip: true,
  837. minWidth: 100
  838. },
  839. {
  840. prop: 'endTime',
  841. label: '审批时间',
  842. align: 'center',
  843. showOverflowTooltip: true,
  844. minWidth: 180
  845. },
  846. {
  847. prop: 'createTime',
  848. label: '创建时间',
  849. align: 'center',
  850. showOverflowTooltip: true,
  851. minWidth: 180
  852. }
  853. // {
  854. // prop: 'durationInMillis',
  855. // slot: 'durationInMillis',
  856. // label: '耗时',
  857. // align: 'center',
  858. // showOverflowTooltip: true,
  859. // minWidth: 130
  860. // },
  861. // {
  862. // columnKey: 'action',
  863. // label: '操作',
  864. // width: 230,
  865. // align: 'center',
  866. // resizable: false,
  867. // slot: 'action',
  868. // showOverflowTooltip: true,
  869. // fixed: 'right'
  870. // }
  871. ];
  872. },
  873. getUserName() {
  874. return (id) => {
  875. if (!id) return '';
  876. let find = this.userList.find((item) => item.id == id) || {};
  877. return find.name;
  878. };
  879. },
  880. getDeptAndUserName() {
  881. return (id = []) => {
  882. if (!id.length) return '';
  883. id = Array.isArray(id) ? id : [id];
  884. let find =
  885. this.userList.find((item) => item.id == id[id.length - 1]) || {};
  886. return find.name;
  887. };
  888. },
  889. getDeptName() {
  890. return (id = []) => {
  891. if (!id.length) return '';
  892. id = Array.isArray(id) ? id : [id];
  893. let find =
  894. this.deptList.find((item) => item.id == id[id.length - 1]) || {};
  895. return find.name;
  896. };
  897. }
  898. },
  899. watch: {
  900. 'params.formId': {
  901. handler(val) {
  902. this.reload();
  903. this.deptReload();
  904. this.reload();
  905. this.noticeReload();
  906. }
  907. },
  908. 'params.dictType': {
  909. handler(val) {
  910. this.params.formId = this.templateList[val][0].id;
  911. this.reload();
  912. this.deptReload();
  913. this.reload();
  914. this.noticeReload();
  915. }
  916. }
  917. },
  918. async created() {
  919. await this.getDictList('collaborative_type');
  920. await this.getTemplateList();
  921. await this.getUserList();
  922. await this.getDeptList();
  923. },
  924. methods: {
  925. getDictV(code, val) {
  926. if (!this.dictList[code]) return '';
  927. return this.dictList[code].find((item) => item.value == val)?.label;
  928. },
  929. async getDictList(code) {
  930. let { data: res } = await getByCode(code);
  931. this.dictList[code] = res.map((item) => {
  932. let values = Object.keys(item);
  933. return {
  934. value: values[0],
  935. label: item[values[0]]
  936. };
  937. });
  938. },
  939. //获取人员数据
  940. async getUserList() {
  941. let params = { pageNum: 1, size: -1 };
  942. let { list } = await getUserPage(params);
  943. this.userList = list;
  944. },
  945. //获取部门数据
  946. async getDeptList() {
  947. this.deptList = await listOrganizations();
  948. },
  949. getFiles(row = []) {
  950. row.forEach((item) => {
  951. getFile({ objectName: item.storePath }, item.name);
  952. });
  953. },
  954. async getTemplateList() {
  955. this.defaultTemplateList = await getBpmCustomFormList({ status: 1 });
  956. this.templateList = _.groupBy(this.defaultTemplateList, 'dictType');
  957. this.params.dictType = this.dictList['collaborative_type'][0].value;
  958. this.params.formId = this.defaultTemplateList[0]?.id;
  959. let makingJson =
  960. JSON.parse(this.defaultTemplateList[0].formJson.makingJson) || {};
  961. this.formColumnList = makingJson.list;
  962. console.log(this.formColumnList);
  963. },
  964. handleStartProcess(i) {
  965. this.processSubmitDialogFlag = true;
  966. this.$nextTick(() => {
  967. this.$refs.processSubmitDialogRef.init(i);
  968. });
  969. },
  970. /* 表格数据源 */
  971. async datasource({ page, limit, where, order }) {
  972. let [createTimeBegin, createTimeEnd] = this.createTime1 || [];
  973. let data = await getProcessInstancePage({
  974. pageNo: page,
  975. pageSize: limit,
  976. ...this.params,
  977. processType: '1',
  978. createTimeBegin,
  979. createTimeEnd
  980. });
  981. data = data.list.map((item) => {
  982. return {
  983. ...item,
  984. ...item.valueJson
  985. };
  986. });
  987. return data;
  988. },
  989. /* 刷新表格 */
  990. reload(where) {
  991. let find =
  992. this.defaultTemplateList.find(
  993. (item) => item.id == this.params.formId
  994. ) || {};
  995. let makingJson = JSON.parse(find.formJson.makingJson) || {};
  996. this.formColumnList = makingJson.list;
  997. this.$refs.table.reload({ page: 1, where });
  998. this.$refs.table.reRenderTable();
  999. },
  1000. /* 重置 */
  1001. reset() {
  1002. this.params = { ...defaultParams };
  1003. this.createTime1 = [];
  1004. this.params.dictType = this.dictList['collaborative_type'][0].value;
  1005. this.params.formId = this.templateList[this.params.dictType][0]?.id;
  1006. this.reload();
  1007. },
  1008. /* 表格数据源 */
  1009. async deptDatasource({ page, limit, where, order }) {
  1010. let [createTimeBegin, createTimeEnd] = this.createTime1 || [];
  1011. let data = await getProcessInstanceDeptPage({
  1012. pageNo: page,
  1013. pageSize: limit,
  1014. ...this.params,
  1015. processType: '1',
  1016. createTimeBegin,
  1017. createTimeEnd
  1018. });
  1019. data = data.list.map((item) => {
  1020. return {
  1021. ...item,
  1022. ...item.valueJson
  1023. };
  1024. });
  1025. return data;
  1026. },
  1027. /* 刷新表格 */
  1028. deptReload(where) {
  1029. let find =
  1030. this.defaultTemplateList.find(
  1031. (item) => item.id == this.params.formId
  1032. ) || {};
  1033. let makingJson = JSON.parse(find.formJson.makingJson) || {};
  1034. this.formColumnList = makingJson.list;
  1035. this.$refs.deptTable.reload({ page: 1, where });
  1036. },
  1037. /* 重置 */
  1038. deptReset() {
  1039. this.params = { ...defaultParams };
  1040. this.createTime1 = [];
  1041. this.params.formId = this.defaultTemplateList[0]?.id;
  1042. this.params.dictType = this.dictList['collaborative_type'][0].value;
  1043. this.deptReload();
  1044. },
  1045. /* 表格数据源 */
  1046. async noticeDatasource({ page, limit, where, order }) {
  1047. let [createTimeBegin, createTimeEnd] = this.createTime1 || [];
  1048. let data = await getProcessInstanceNoticePage({
  1049. pageNo: page,
  1050. pageSize: limit,
  1051. ...this.params,
  1052. processType: '1',
  1053. createTimeBegin,
  1054. createTimeEnd
  1055. });
  1056. data = data.list.map((item) => {
  1057. return {
  1058. ...item,
  1059. ...item.valueJson
  1060. };
  1061. });
  1062. return data;
  1063. },
  1064. /* 刷新表格 */
  1065. noticeReload(where) {
  1066. let find =
  1067. this.defaultTemplateList.find(
  1068. (item) => item.id == this.params.formId
  1069. ) || {};
  1070. let makingJson = JSON.parse(find.formJson.makingJson) || {};
  1071. this.formColumnList = makingJson.list;
  1072. this.$refs.noticeTable.reload({ page: 1, where });
  1073. },
  1074. /* 重置 */
  1075. noticeReset() {
  1076. this.params = { ...defaultParams };
  1077. this.createTime1 = [];
  1078. this.params.formId = this.defaultTemplateList[0]?.id;
  1079. this.params.dictType = this.dictList['collaborative_type'][0].value;
  1080. this.noticeReload();
  1081. },
  1082. /** */
  1083. handleAudit(row) {
  1084. this.$refs.detailRef.open(row.id);
  1085. },
  1086. /** */
  1087. handleDetail(row) {
  1088. this.formDetailDialogFlag = true;
  1089. this.$nextTick(() => {
  1090. this.$refs.formDetailDialogRef.open(row);
  1091. });
  1092. },
  1093. getTimelineItemType(result) {
  1094. if (result === '通过') {
  1095. return 'success';
  1096. }
  1097. if (result === '不通过') {
  1098. return 'danger';
  1099. }
  1100. if (result === '取消') {
  1101. return 'info';
  1102. }
  1103. if (result === '处理中') {
  1104. return 'warning';
  1105. }
  1106. return '';
  1107. },
  1108. getDateTime(ms) {
  1109. return getDate(ms);
  1110. }
  1111. }
  1112. };
  1113. </script>
  1114. <style scoped lang="scss">
  1115. .ele-body {
  1116. padding: 15px;
  1117. }
  1118. .content-box {
  1119. width: 100%;
  1120. //max-width: 273px;
  1121. //min-width: 90px;
  1122. margin-right: 10px;
  1123. display: flex;
  1124. flex-direction: row;
  1125. flex-wrap: wrap;
  1126. //justify-content: space-between;
  1127. .category_box {
  1128. border-left: 1px solid #e1e1e1;
  1129. border-bottom: 1px solid #e1e1e1;
  1130. border-radius: 1px;
  1131. flex: 1 0 25%;
  1132. margin-top: 5px;
  1133. overflow: auto;
  1134. .category_box_title {
  1135. font-size: 14px;
  1136. font-weight: bold;
  1137. color: #fff8f8;
  1138. height: 39px;
  1139. display: flex;
  1140. padding: 5px 20px;
  1141. align-items: center;
  1142. background: #1890ffd6;
  1143. border-bottom: 1px solid #e1e1e1;
  1144. }
  1145. .category_box_content {
  1146. display: flex;
  1147. flex-direction: row;
  1148. flex-wrap: wrap;
  1149. height: 60px;
  1150. overflow: auto;
  1151. .category_content {
  1152. min-width: 60px;
  1153. min-height: 60px;
  1154. //flex: 1 1 0;
  1155. display: flex;
  1156. flex-direction: column;
  1157. border-right: 1px solid #e1e1e1;
  1158. border-bottom: 1px solid #e1e1e1;
  1159. align-items: center;
  1160. justify-content: center;
  1161. // font-weight: bold;
  1162. &:nth-child(n) {
  1163. span:nth-child(1) {
  1164. transform: scale(2);
  1165. }
  1166. span:nth-child(2) {
  1167. padding-top: 5px;
  1168. }
  1169. }
  1170. }
  1171. .category_content:hover {
  1172. cursor: pointer;
  1173. background-color: rgba(135, 181, 243, 0.29);
  1174. }
  1175. }
  1176. }
  1177. .category_box:last-child {
  1178. border-right: 1px solid #e1e1e1;
  1179. }
  1180. }
  1181. .tab-box {
  1182. width: 100%;
  1183. //max-width: 1100px;
  1184. //min-width: 600px;
  1185. margin-top: 6px;
  1186. height: 98%;
  1187. .el-tabs--border-card {
  1188. height: 100%;
  1189. }
  1190. }
  1191. ::v-deep .card_box {
  1192. .el-card__body {
  1193. padding: 10px;
  1194. height: 86vh;
  1195. }
  1196. }
  1197. ::v-deep .ele-table-tool {
  1198. display: flex;
  1199. flex-direction: row;
  1200. flex-wrap: nowrap !important;
  1201. }
  1202. </style>