| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <ibps-layout ref="layout">
- <div slot="west">
- <ibps-type-tree
- :width="width"
- :height="height"
- title="任务分类"
- category-key="FLOW_TYPE"
- @node-click="handleNodeClick"
- @expand-collapse="handleExpandCollapse"
- />
- </div>
- <ibps-crud
- ref="crud"
- :style="{ marginLeft: width+'px' }"
- :height="height"
- :data="listData"
- :toolbars="listConfig.toolbars"
- :search-form="listConfig.searchForm"
- :pk-key="pkKey"
- :columns="listConfig.columns"
- :pagination="pagination"
- :loading="loading"
- :index-row="false"
- @action-event="handleAction"
- @sort-change="handleSortChange"
- @column-link-click="handleLinkClick"
- @pagination-change="handlePaginationChange"
- />
- <bpmn-formrender
- :visible="dialogFormVisible"
- :def-id="defId"
- :pro-inst-id="proInstId"
- :title="flowName"
- @callback="search"
- @close="visible => dialogFormVisible = visible"
- />
- </ibps-layout>
- </template>
- <script>
- import { myDraft, removeDraft } from '@/api/platform/office/bpmInitiated'
- import ActionUtils from '@/utils/action'
- import FixHeight from '@/mixins/height'
- import IbpsTypeTree from '@/business/platform/cat/type/tree'
- import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
- export default {
- components: {
- IbpsTypeTree,
- BpmnFormrender
- },
- mixins: [FixHeight],
- data() {
- return {
- width: 200,
- height: document.clientHeight,
- dialogFormVisible: false, // 弹窗
- defId: '',
- proInstId: '',
- flowName:'',
- pkKey: 'id', // 主键 如果主键不是pk需要传主键
- typeId: '',
- loading: false,
- listData: [],
- listConfig: {
- // 工具栏
- toolbars: [
- { key: 'search' },
- { key: 'remove' }
- ],
- // 查询条件
- searchForm: {
- forms: [
- { prop: 'Q^subject_^SL', label: '请求标题' },
- { prop: 'Q^proc_def_name_^SL', label: '流程名称' }
- ]
- },
- // 表格字段配置
- columns: [
- { prop: 'taskSubjectName', label: '请求标题', link: 'dialog' },
- { prop: 'procDefName', label: '流程名称', width: 250 },
- { prop: 'createTime', label: '创建时间', width: 200 }
- ]
- },
- pagination: {},
- sorts: {}
- }
- },
- created() {
- this.loadData()
- },
- methods: {
- /**
- * 加载数据
- */
- loadData() {
- this.loading = true
- myDraft(this.getFormatParams()).then(response => {
- response.data.dataResult.forEach((item) => {
- const taskSubject = item.subject.split('#')
- this.$set(item, 'taskSubjectName', taskSubject[0] +'#'+ taskSubject[1]+'#')
- })
- ActionUtils.handleListData(this, response.data)
- this.loading = false
- }).catch(() => {
- this.loading = false
- })
- },
- /**
- * 获取格式化参数
- */
- getFormatParams() {
- const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
- if (this.$utils.isNotEmpty(this.typeId)) {
- params['Q^TYPE_ID_^S'] = this.typeId
- }
- return ActionUtils.formatParams(
- params,
- this.pagination,
- this.sorts)
- },
- /**
- * 处理分页事件
- */
- handlePaginationChange(page) {
- ActionUtils.setPagination(this.pagination, page)
- this.loadData()
- },
- /**
- * 处理排序
- */
- handleSortChange(sort) {
- ActionUtils.setSorts(this.sorts, sort)
- this.loadData()
- },
- search() {
- this.loadData()
- },
- /**
- * 重置查询条件
- */
- reset() {
- this.$refs['crud'].handleReset()
- },
- /**
- * 点击链接
- */
- handleLinkClick(data, columns) {
- this.flowName = data.name
- this.defId = data.procDefId || ''
- this.proInstId = data.id || ''
- this.dialogFormVisible = true
- },
- /**
- * 处理按钮事件
- */
- handleAction(command, position, selection, data) {
- switch (command) {
- case 'search':// 查询
- ActionUtils.setFirstPagination(this.pagination)
- this.search()
- break
- case 'remove':// 删除
- ActionUtils.removeRecord(selection).then((ids) => {
- this.handleRemove(ids)
- }).catch(() => { })
- break
- default:
- break
- }
- },
- /**
- * 处理删除
- */
- handleRemove(ids) {
- removeDraft({ ids: ids }).then(response => {
- ActionUtils.removeSuccessMessage()
- this.search()
- }).catch(() => {
- })
- },
- handleNodeClick(typeId) {
- this.typeId = typeId
- this.loadData()
- },
- handleExpandCollapse(isExpand) {
- this.width = isExpand ? 230 : 30
- }
- }
- }
- </script>
|