newProcess.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <ibps-layout ref="layout">
  3. <div slot="west">
  4. <ibps-type-tree
  5. :width="width"
  6. :height="height"
  7. title="流程分类"
  8. category-key="FLOW_TYPE"
  9. @node-click="handleNodeClick"
  10. @expand-collapse="handleExpandCollapse"
  11. />
  12. </div>
  13. <ibps-crud
  14. ref="crud"
  15. :height="height"
  16. :data="listData"
  17. :toolbars="listConfig.toolbars"
  18. :search-form="listConfig.searchForm"
  19. :pk-key="pkKey"
  20. :columns="listConfig.columns"
  21. :pagination="pagination"
  22. :loading="loading"
  23. :index-row="false"
  24. @action-event="handleAction"
  25. @sort-change="handleSortChange"
  26. @column-link-click="handleLinkClick"
  27. @pagination-change="handlePaginationChange"
  28. >
  29. <template slot="favoritesIcon" slot-scope="scope">
  30. <el-tooltip v-if="scope.row.favorites" class="item" effect="dark" content="已收藏" placement="bottom">
  31. <i class="ibps-icon-star" style="margin-left:7px;" @click="handleTips(scope.row.favorites,scope.row.id)" />
  32. </el-tooltip>
  33. <el-tooltip v-else class="item" effect="dark" content="未收藏" placement="bottom">
  34. <i class="ibps-icon-star-o" style="margin-left:7px;" @click="handleTips(scope.row.favorites,scope.row.id)" />
  35. </el-tooltip>
  36. </template>
  37. <template slot="statusCloum" slot-scope="scope">
  38. <el-tag>{{ scope.row.status|optionsFilter(statusOptions,'value','key') }}</el-tag>
  39. </template>
  40. </ibps-crud>
  41. <bpmn-formrender
  42. :visible="dialogFormVisible"
  43. :def-id="defId"
  44. @callback="search"
  45. @close="visible => dialogFormVisible = visible"
  46. />
  47. </ibps-layout>
  48. <!-- <div>
  49. <ibps-layout ref="layout">
  50. <div slot="west">
  51. <ibps-type-tree
  52. :width="width"
  53. :height="height"
  54. title="任务分类"
  55. category-key="FLOW_TYPE"
  56. @node-click="handleNodeClick"
  57. @expand-collapse="handleExpandCollapse"
  58. />
  59. </div>
  60. <ibps-card-list
  61. ref="crud"
  62. :title="title"
  63. :height="height"
  64. :data="listData"
  65. :pagination="pagination"
  66. :pk-key="pkKey"
  67. :toolbars="listConfig.toolbars"
  68. :search-form="listConfig.searchForm"
  69. :columns="listConfig.columns"
  70. :loading="loading"
  71. :index-row="false"
  72. @action-event="handleAction"
  73. @sort-change="handleSortChange"
  74. @pagination-change="handlePaginationChange"
  75. >
  76. <template slot="item-symbol">
  77. <p style="width:60px;height:60px;border: 2px solid #409eff;border-radius: 100%;font-size: 48px;color:#409eff;font-size:30px;line-height: 60px;">启动</p>
  78. </template>
  79. <template slot="item-detail-name">
  80. <span></span>
  81. </template>
  82. <template slot="item-detail-partyTypeName">
  83. <span></span>
  84. </template>
  85. <template slot="item-detail-createTime">
  86. <span></span>
  87. </template>
  88. <template slot="item-detail-taskName">
  89. <span></span>
  90. </template>
  91. <template slot="item-detail-completeTime">
  92. <span></span>
  93. </template>
  94. <template slot="item-detail-curNode">
  95. <span></span>
  96. </template>
  97. <template slot="item-detail-status">
  98. <span></span>
  99. </template>
  100. </ibps-card-list>
  101. <bpmn-formrender
  102. :visible="dialogFormVisible"
  103. :def-id="defId"
  104. @callback="search"
  105. @close="visible => dialogFormVisible = visible"
  106. />
  107. </ibps-layout>
  108. </div> -->
  109. </template>
  110. <script>
  111. import { newProcess, saveFavorites, removeFavorites } from '@/api/platform/office/bpmInitiated'
  112. import { findBpmDefinitionState } from '@/api/platform/bpmn/bpmInfo'
  113. import ActionUtils from '@/utils/action'
  114. import FixHeight from '@/mixins/height'
  115. import IbpsTypeTree from '@/business/platform/cat/type/tree'
  116. import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
  117. export default {
  118. components: {
  119. IbpsTypeTree,
  120. BpmnFormrender,
  121. 'ibps-type-tree': () => import('@/business/platform/cat/type/tree'),
  122. 'ibps-card-list': () => import('@/components/ibps-card-list/list'),
  123. 'form-builder': () => import('@/business/platform/form/formbuilder/dialog'),
  124. 'formrender-preview': () => import('@/business/platform/form/formrender/preview/index')
  125. },
  126. mixins: [FixHeight],
  127. data() {
  128. return {
  129. width: 220,
  130. height: 500,
  131. title: '启动工作流程',
  132. createText: '创建表单',
  133. query: '',
  134. typeId: '',
  135. pkKey: 'id', // 主键 如果主键不是pk需要传主键
  136. loading: false,
  137. dialogFormVisible: false,
  138. copyDialogFormVisible: false,
  139. rightsDialogFormVisible: false,
  140. formbuilderDialogVisible: false,
  141. formrenderDialogVisible: false,
  142. importFormVisible: false,
  143. formPrintDialogVisible: false,
  144. defId: '', // 编辑dialog需要使用
  145. statusOptions: [],
  146. editId: '',
  147. formKey: '',
  148. name:"",
  149. searchField: '',
  150. searchName: 'Q^name_^SL',
  151. listData: [],
  152. listConfig: {
  153. // 工具栏
  154. toolbars: [
  155. { key: 'search' },
  156. {
  157. key: 'saveFavorites',
  158. label: '收藏',
  159. icon: 'ibps-icon-star'
  160. }, {
  161. key: 'removeFavorites',
  162. label: '取消',
  163. icon: 'ibps-icon-star-o'
  164. }
  165. ],
  166. // 查询条件
  167. searchForm: {
  168. forms: [
  169. { prop: 'Q^name_^SL', label: '流程名称' }
  170. ]
  171. },
  172. // 表格字段配置.
  173. columns: [
  174. { prop: 'favorites', label: '收藏', slotName: 'favoritesIcon', width: '60' },
  175. { prop: 'name', label: '任务名称', link: 'dialog' },
  176. // { prop: 'createTime', label: '创建时间', width: 140 },
  177. { prop: 'typeName', label: '所属分类', width: 180 },
  178. { prop: 'status', label: '状态', slotName: 'statusCloum', width: 150 },
  179. { prop: 'version', label: '版本号', width: 80 }
  180. ]
  181. },
  182. pagination: {},
  183. sorts: {}
  184. }
  185. },
  186. created() {
  187. this.loadData()
  188. this.findBpmDefinitionState()
  189. },
  190. methods: {
  191. findBpmDefinitionState() {
  192. findBpmDefinitionState().then(response => {
  193. this.statusOptions = response.data
  194. })
  195. },
  196. handleTips(favorites, id) {
  197. if (favorites) {
  198. this.tips('removeFavorites', '确认取消流程收藏吗?', id)
  199. } else {
  200. this.tips('saveFavorites', '确认流程收藏吗?', id)
  201. }
  202. },
  203. /**
  204. * 加载数据
  205. */
  206. loadData() {
  207. this.loading = true
  208. newProcess(this.getFormatParams()).then(response => {
  209. //debugger
  210. this.listData = response.data.dataResult;
  211. this.name = response.data.dataResult.name
  212. ActionUtils.handleListData(this, response.data)
  213. //this.name = this.$refs['layout'].data.name
  214. this.loading = false
  215. }).catch(() => {
  216. this.loading = false
  217. })
  218. },
  219. /**
  220. * 获取格式化参数
  221. */
  222. getFormatParams() {
  223. const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
  224. if (this.$utils.isNotEmpty(this.typeId)) {
  225. params['Q^TYPE_ID_^S'] = this.typeId
  226. }
  227. return ActionUtils.formatParams(
  228. params,
  229. this.pagination,
  230. this.sorts)
  231. },
  232. /**
  233. * 处理分页事件
  234. */
  235. handlePaginationChange(page) {
  236. ActionUtils.setPagination(this.pagination, page)
  237. this.loadData()
  238. },
  239. /**
  240. * 处理排序
  241. */
  242. handleSortChange(sort) {
  243. ActionUtils.setSorts(this.sorts, sort)
  244. this.loadData()
  245. },
  246. search() {
  247. this.loadData()
  248. },
  249. /**
  250. * 重置查询条件
  251. */
  252. reset() {
  253. this.$refs['crud'].handleReset()
  254. },
  255. /**
  256. * 点击表格
  257. */
  258. handleLinkClick(data) {
  259. this.defId = data.id || ''
  260. this.dialogFormVisible = true
  261. },
  262. /**
  263. * 处理按钮事件
  264. */
  265. handleAction(command, position, selection, data) {
  266. switch (command) {
  267. case 'search':// 查询
  268. ActionUtils.setFirstPagination(this.pagination)
  269. this.search()
  270. break
  271. case 'add':// 添加
  272. this.handleEdit()
  273. break
  274. case 'edit':// 编辑
  275. this.handleEdit(selection)
  276. break
  277. case 'saveFavorites':// 收藏
  278. ActionUtils.selectedMultiRecord(selection).then((id) => {
  279. this.tips('saveFavorites', '确认流程收藏吗?', id)
  280. }).catch(() => { })
  281. break
  282. case 'removeFavorites':// 取消
  283. ActionUtils.selectedMultiRecord(selection).then((id) => {
  284. this.tips('removeFavorites', '确认取消流程收藏吗?', id)
  285. }).catch(() => { })
  286. break
  287. default:
  288. break
  289. }
  290. },
  291. /**
  292. * 编辑
  293. */
  294. handleEdit(id) {
  295. this.defId = id
  296. this.dialogFormVisible = true
  297. },
  298. tips(tip, title, id) {
  299. this.$confirm(title, '消息', {
  300. confirmButtonText: '确定',
  301. cancelButtonText: '取消',
  302. type: 'warning'
  303. }).then(() => {
  304. if (tip === 'saveFavorites') {
  305. saveFavorites({ defIds: id }).then(response => {
  306. ActionUtils.successMessage('收藏成功!')
  307. this.loadData()
  308. })
  309. } else {
  310. removeFavorites({ defIds: id }).then(response => {
  311. ActionUtils.successMessage('取消收藏成功!')
  312. this.loadData()
  313. })
  314. }
  315. }).catch(() => {})
  316. },
  317. handleNodeClick(typeId) {
  318. this.typeId = typeId
  319. this.loadData()
  320. },
  321. handleExpandCollapse(isExpand) {
  322. this.width = isExpand ? 230 : 30
  323. }
  324. }
  325. }
  326. </script>
  327. <style scoped>
  328. .ibps-layout >>> .container-component{
  329. position: absolute;
  330. top: 0px;
  331. right: 0;
  332. bottom: 0px;
  333. left: 220px!important;}
  334. .ibps-card-list-container >>> .ibps-card-list--picture-card{display: block;}
  335. </style>