index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <div class="filter-container">
  5. <el-form
  6. label-width="100px"
  7. class="ele-form-search"
  8. @keyup.enter.native="reload"
  9. @submit.native.prevent
  10. >
  11. <el-row :gutter="15">
  12. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  13. <el-form-item label="流程名:" prop="name">
  14. <el-input clearable v-model.trim="params.name"></el-input>
  15. </el-form-item>
  16. </el-col>
  17. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  18. <el-form-item label="结果:" prop="result">
  19. <DictSelection
  20. dictName="流程实例的结果"
  21. clearable
  22. v-model="params.result"
  23. >
  24. </DictSelection>
  25. </el-form-item>
  26. </el-col>
  27. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  28. <el-form-item label="创建时间:" prop="createTime">
  29. <el-date-picker
  30. v-model="params.createTime"
  31. style="width: 100%"
  32. value-format="yyyy-MM-dd HH:mm:ss"
  33. type="daterange"
  34. range-separator="-"
  35. start-placeholder="开始日期"
  36. end-placeholder="结束日期"
  37. :default-time="['00:00:00', '23:59:59']"
  38. />
  39. </el-form-item>
  40. </el-col>
  41. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  42. <el-form-item label="是否已读:" prop="isRead">
  43. <el-select style="width: 100%" v-model="params.isRead" placeholder="请选择">
  44. <el-option label="已读" value="1"></el-option>
  45. <el-option label="未读" value="0"></el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col
  50. style="display: flex; justify-content: flex-end"
  51. v-bind="styleResponsive ? { lg: 24, md: 24 } : { span: 6 }"
  52. >
  53. <div class="ele-form-actions">
  54. <el-button
  55. type="primary"
  56. icon="el-icon-search"
  57. class="ele-btn-icon"
  58. @click="reload"
  59. >
  60. 查询
  61. </el-button>
  62. <el-button @click="reset">重置</el-button>
  63. </div>
  64. </el-col>
  65. </el-row>
  66. </el-form>
  67. </div>
  68. <ele-pro-table
  69. ref="table"
  70. :columns="columns"
  71. :datasource="datasource"
  72. cache-key="systemRoleTable5"
  73. >
  74. <template v-slot:result="{ row }">
  75. <el-tag
  76. size="medium"
  77. :type="
  78. getTimelineItemType(getDictValue('流程实例的结果', row.result))
  79. "
  80. >
  81. {{ getDictValue('流程实例的结果', row.result) }}
  82. </el-tag>
  83. </template>
  84. <template v-slot:processResult="{ row }">
  85. <el-tag
  86. size="medium"
  87. :type="
  88. getTimelineItemType(
  89. getDictValue('流程实例的结果', row.processResult)
  90. )
  91. "
  92. >
  93. {{ getDictValue('流程实例的结果', row.processResult) }}
  94. </el-tag>
  95. </template>
  96. <template v-slot:durationInMillis="{ row }">
  97. {{ getDateTime(row.durationInMillis) }}
  98. </template>
  99. <template v-slot:name="{ row }">
  100. <span class="dot" v-if="row.isRead == 0"></span>
  101. <el-link type="primary" :underline="false" @click="handleAudit(row)">
  102. {{ row.name }}</el-link
  103. >
  104. </template>
  105. <!-- 操作列 -->
  106. <template v-slot:action="{ row }">
  107. <el-button
  108. size="mini"
  109. type="text"
  110. icon="el-icon-edit"
  111. @click="handleAudit(row)"
  112. >详情</el-button
  113. >
  114. </template>
  115. </ele-pro-table>
  116. </el-card>
  117. <detail ref="detailRef"></detail>
  118. </div>
  119. </template>
  120. <script>
  121. import dictMixins from '@/mixins/dictMixins';
  122. import { ccPage, ccReaderTask } from '@/api/bpm/task';
  123. import { getDate } from '@/utils/dateUtils';
  124. import detail from '@/views/bpm/done/detailDialog.vue';
  125. // 默认表单数据
  126. const defaultParams = {
  127. status: '',
  128. name: ''
  129. };
  130. export default {
  131. name: 'BpmDoneTask',
  132. components: { detail },
  133. mixins: [dictMixins],
  134. data() {
  135. return {
  136. // 遮罩层
  137. loading: true,
  138. params: { ...defaultParams },
  139. statusList: [],
  140. columns: [
  141. {
  142. columnKey: 'index',
  143. label: '序号',
  144. type: 'index',
  145. width: 55,
  146. align: 'center',
  147. showOverflowTooltip: true,
  148. fixed: 'left'
  149. },
  150. {
  151. prop: 'processTypeName',
  152. label: '流程分类',
  153. align: 'center',
  154. showOverflowTooltip: true,
  155. minWidth: 150
  156. },
  157. {
  158. prop: 'taskName',
  159. label: '当前节点名称',
  160. align: 'center',
  161. showOverflowTooltip: true,
  162. minWidth: 150
  163. },
  164. {
  165. prop: 'name',
  166. slot: 'name',
  167. label: '流程名称',
  168. align: 'center',
  169. showOverflowTooltip: true,
  170. minWidth: 150
  171. },
  172. {
  173. prop: 'vals.businessCode',
  174. label: '单据编码',
  175. align: 'center',
  176. showOverflowTooltip: true,
  177. minWidth: 120
  178. },
  179. {
  180. prop: 'vals.businessName',
  181. label: '单据名称',
  182. align: 'center',
  183. showOverflowTooltip: true,
  184. minWidth: 120
  185. },
  186. {
  187. prop: 'vals.businessType',
  188. label: '单据类型',
  189. align: 'center',
  190. showOverflowTooltip: true,
  191. minWidth: 120
  192. },
  193. {
  194. prop: 'vals.userName',
  195. label: '流程发起人',
  196. align: 'center',
  197. showOverflowTooltip: true,
  198. minWidth: 120
  199. },
  200. {
  201. prop: 'result',
  202. slot: 'result',
  203. label: '当前节点结果',
  204. align: 'center',
  205. showOverflowTooltip: true,
  206. minWidth: 100
  207. },
  208. {
  209. prop: 'processResult',
  210. slot: 'processResult',
  211. label: '流程结果',
  212. align: 'center',
  213. showOverflowTooltip: true,
  214. minWidth: 100
  215. },
  216. // {
  217. // prop: 'reason',
  218. // label: '审批意见',
  219. // align: 'center',
  220. // showOverflowTooltip: true,
  221. // minWidth: 200
  222. // },
  223. {
  224. prop: 'createTime',
  225. label: '创建时间',
  226. align: 'center',
  227. showOverflowTooltip: true,
  228. minWidth: 180
  229. },
  230. {
  231. prop: 'endTime',
  232. label: '审批时间',
  233. align: 'center',
  234. showOverflowTooltip: true,
  235. minWidth: 180
  236. },
  237. {
  238. prop: 'durationInMillis',
  239. slot: 'durationInMillis',
  240. label: '耗时',
  241. align: 'center',
  242. showOverflowTooltip: true,
  243. minWidth: 130
  244. },
  245. {
  246. prop: 'isRead',
  247. label: '是否已读',
  248. align: 'center',
  249. showOverflowTooltip: true,
  250. minWidth: 130,
  251. formatter: (row) => {
  252. return row.isRead == 1 ? '已读' : '未读';
  253. }
  254. }
  255. ]
  256. };
  257. },
  258. computed: {
  259. // 是否开启响应式布局
  260. styleResponsive() {
  261. return this.$store.state.theme.styleResponsive;
  262. }
  263. },
  264. created() {},
  265. methods: {
  266. /* 表格数据源 */
  267. datasource({ page, limit, where, order }) {
  268. return ccPage({
  269. pageNum: page,
  270. size: limit,
  271. ...this.params
  272. });
  273. },
  274. /* 刷新表格 */
  275. reload(where) {
  276. this.$refs.table.reload({ page: 1, where });
  277. },
  278. /* 重置 */
  279. reset() {
  280. this.params = { ...defaultParams };
  281. this.reload();
  282. },
  283. /** 处理审批按钮 */
  284. async handleAudit(row) {
  285. const readStatus = await ccReaderTask({
  286. id: row.id
  287. });
  288. console.log('readStatus~~', readStatus);
  289. if(readStatus) {
  290. row.isRead = 1;
  291. }
  292. const params = {
  293. ...row,
  294. processInstance: {
  295. id: row.processInstanceId
  296. },
  297. businessId:row.vals.businessId,
  298. pcViewRouter: row.pcViewRouter
  299. }
  300. // this.$refs.detailRef.open({
  301. // processInstance: {
  302. // id: row.processInstanceId
  303. // },
  304. // businessId:row.vals.businessId,
  305. // pcViewRouter: row.pcViewRouter
  306. // });
  307. this.$refs.detailRef.open(params);
  308. },
  309. getTimelineItemType(result) {
  310. if (result === '通过') {
  311. return 'success';
  312. }
  313. if (result === '不通过') {
  314. return 'danger';
  315. }
  316. if (result === '取消') {
  317. return 'info';
  318. }
  319. if (result === '处理中') {
  320. return 'warning';
  321. }
  322. return '';
  323. },
  324. getDateTime(ms) {
  325. return getDate(ms);
  326. }
  327. }
  328. };
  329. </script>
  330. <style scoped>
  331. .dot {
  332. display: inline-block;
  333. width: 5px;
  334. height: 5px;
  335. background-color: red;
  336. border-radius: 50%;
  337. position: absolute;
  338. top: 10px;
  339. left: 4px;
  340. }
  341. </style>