index.vue 43 KB

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