index.vue 9.4 KB

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