start.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. :option="option"
  5. :table-loading="loading"
  6. :data="data"
  7. :page.sync="page"
  8. v-model="form"
  9. ref="crud"
  10. @search-change="searchChange"
  11. @search-reset="searchReset"
  12. @selection-change="selectionChange"
  13. @current-change="currentChange"
  14. @size-change="sizeChange"
  15. @refresh-change="refreshChange"
  16. @on-load="onLoad"
  17. >
  18. <template slot="menuLeft">
  19. <el-radio-group v-model="mode" size="small">
  20. <el-radio-button label="1">通用流程</el-radio-button>
  21. <el-radio-button label="2">定制流程</el-radio-button>
  22. </el-radio-group>
  23. </template>
  24. <template slot-scope="scope" slot="menu">
  25. <el-button type="text" v-if="permission.work_start_flow" plain class="none-border" @click.stop="handleStart(scope.row)">发起 </el-button>
  26. <el-button type="text" v-if="permission.work_start_image" plain class="none-border" @click.stop="handleImage(scope.row, scope.index)"
  27. >流程图
  28. </el-button>
  29. </template>
  30. <template slot-scope="{ row }" slot="tenantId">
  31. <el-tag>{{ row.tenantId === '' ? '通用' : row.tenantId }}</el-tag>
  32. </template>
  33. <template slot-scope="{ row }" slot="version">
  34. <el-tag>v{{ row.version }}</el-tag>
  35. </template>
  36. <template slot-scope="{ row }" slot="suspensionState">
  37. <el-tag>{{ row.suspensionState === 1 ? '激活' : '挂起' }}</el-tag>
  38. </template>
  39. <template slot-scope="{ row }" slot="category">
  40. <el-tag>{{ row.categoryName }}</el-tag>
  41. </template>
  42. </avue-crud>
  43. <el-dialog title="流程图" append-to-body :visible.sync="flowBox" :fullscreen="true">
  44. <iframe
  45. :src="flowUrl"
  46. width="100%"
  47. height="700"
  48. title="流程图"
  49. frameBorder="no"
  50. border="0"
  51. marginWidth="0"
  52. marginHeight="0"
  53. scrolling="no"
  54. allowTransparency="yes"
  55. >
  56. </iframe>
  57. <span slot="footer" class="dialog-footer">
  58. <el-button @click="flowBox = false">关 闭</el-button>
  59. </span>
  60. </el-dialog>
  61. </basic-container>
  62. </template>
  63. <script>
  64. import { mapGetters } from 'vuex'
  65. import { startList } from '@/api/work/work'
  66. import { flowCategory, flowRoute } from '@/util/flow'
  67. export default {
  68. data() {
  69. return {
  70. form: {},
  71. mode: '1',
  72. selectionId: '',
  73. selectionList: [],
  74. query: {},
  75. loading: true,
  76. page: {
  77. pageSize: 10,
  78. currentPage: 1,
  79. total: 0,
  80. },
  81. flowBox: false,
  82. flowUrl: '',
  83. workBox: false,
  84. option: {
  85. height: 'auto',
  86. calcHeight: 30,
  87. tip: false,
  88. searchShow: true,
  89. searchMenuSpan: 6,
  90. border: true,
  91. index: true,
  92. selection: true,
  93. editBtn: false,
  94. addBtn: false,
  95. viewBtn: false,
  96. delBtn: false,
  97. menuWidth: 150,
  98. dialogWidth: 900,
  99. dialogClickModal: false,
  100. column: [
  101. {
  102. label: '租户编号',
  103. prop: 'tenantId',
  104. slot: true,
  105. width: 120,
  106. },
  107. {
  108. label: '流程分类',
  109. type: 'select',
  110. row: true,
  111. dicUrl: '/blade-system/dict/dictionary?code=flow',
  112. props: {
  113. label: 'dictValue',
  114. value: 'dictKey',
  115. },
  116. dataType: 'number',
  117. slot: true,
  118. prop: 'category',
  119. search: true,
  120. width: 100,
  121. },
  122. {
  123. label: '流程标识',
  124. prop: 'key',
  125. },
  126. {
  127. label: '流程名称',
  128. prop: 'name',
  129. search: true,
  130. },
  131. {
  132. label: '流程版本',
  133. prop: 'version',
  134. slot: true,
  135. width: 80,
  136. },
  137. {
  138. label: '状态',
  139. prop: 'suspensionState',
  140. slot: true,
  141. width: 80,
  142. },
  143. {
  144. label: '部署时间',
  145. prop: 'deploymentTime',
  146. width: 165,
  147. },
  148. ],
  149. },
  150. data: [],
  151. }
  152. },
  153. watch: {
  154. mode() {
  155. this.onLoad(this.page)
  156. },
  157. },
  158. computed: {
  159. ...mapGetters(['permission', 'flowRoutes']),
  160. ids() {
  161. let ids = []
  162. this.selectionList.forEach((ele) => {
  163. ids.push(ele.id)
  164. })
  165. return ids.join(',')
  166. },
  167. },
  168. methods: {
  169. searchReset() {
  170. this.query = {}
  171. this.onLoad(this.page)
  172. },
  173. searchChange(params, done) {
  174. this.query = params
  175. this.page.currentPage = 1
  176. this.onLoad(this.page, params)
  177. done()
  178. },
  179. selectionChange(list) {
  180. this.selectionList = list
  181. },
  182. selectionClear() {
  183. this.selectionList = []
  184. this.$refs.crud.toggleSelection()
  185. },
  186. handleStart(row) {
  187. this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/form/${row.id}` })
  188. },
  189. handleImage(row) {
  190. this.flowUrl = `/blade-flow/process/resource-view?processDefinitionId=${row.id}`
  191. this.flowBox = true
  192. },
  193. currentChange(currentPage) {
  194. this.page.currentPage = currentPage
  195. },
  196. sizeChange(pageSize) {
  197. this.page.pageSize = pageSize
  198. },
  199. refreshChange() {
  200. this.onLoad(this.page, this.query)
  201. },
  202. onLoad(page, params = {}) {
  203. const query = {
  204. ...this.query,
  205. category: params.category ? flowCategory(params.category) : null,
  206. mode: this.mode,
  207. }
  208. this.loading = true
  209. startList(page.currentPage, page.pageSize, Object.assign(params, query)).then((res) => {
  210. const data = res.data.data
  211. this.page.total = data.total
  212. this.data = data.records
  213. this.loading = false
  214. this.selectionClear()
  215. })
  216. },
  217. },
  218. }
  219. </script>
  220. <style>
  221. .none-border {
  222. border: 0;
  223. background-color: transparent !important;
  224. }
  225. </style>