| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- import ActionUtils from '@/utils/action'
- export default {
- components: {
- 'bpmn-formrender': () => import('@/business/platform/bpmn/form/dialog'),
- 'ibps-type-tree': () => import('@/business/platform/cat/type/tree'),
- 'ibps-card-list': () => import('@/components/ibps-card-list/list'),
- 'form-rights': () => import('@/business/platform/form/form-rights'),
- 'form-builder': () => import('@/business/platform/form/formbuilder/dialog'),
- 'formrender-preview': () =>
- import('@/business/platform/form/formrender/preview/index')
- },
- data() {
- const { userList = [], deptList = [] } = this.$store.getters
- const defaultWidth = 360
- return {
- userList,
- deptList,
- defaultWidth,
- width: defaultWidth,
- height: document.clientHeight,
- createText: '创建表单',
- query: '',
- typeId: '',
- pkKey: 'id', // 主键 如果主键不是pk需要传主键
- loading: false,
- dialogFormVisible: false,
- copyDialogFormVisible: false,
- rightsDialogFormVisible: false,
- formbuilderDialogVisible: false,
- formrenderDialogVisible: false,
- importFormVisible: false,
- formPrintDialogVisible: false,
- defId: '',
- taskId: '',
- editId: '',
- proInstId: '',
- instanceId: '',
- flowName: '',
- formKey: '',
- searchField: '',
- searchName: '',
- listData: [],
- pagination: {},
- sorts: {}
- }
- },
- methods: {
- /**
- * 获取格式化参数
- */
- getFormatParams(args) {
- let params = this.$refs['crud']
- ? this.$refs['crud'].getSearcFormData()
- : {}
- if (this.$utils.isNotEmpty(this.typeId)) {
- params['Q^TYPE_ID_^S'] = this.typeId
- }
- params = {
- ...params,
- ...args
- }
- 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()
- },
- handleNodeClick(typeId) {
- this.typeId = typeId
- this.loadData()
- },
- handleExpandCollapse(isExpand) {
- this.width = isExpand ? this.defaultWidth : 30
- },
- getTaskDesc(v) {
- if (!v.includes('#')) {
- return ''
- }
- return v.split('#')[1] || ''
- },
- getTaskInfo(val, arg = 'dept') {
- const arr = val.split('#')
- if (!arr[2]) {
- return ''
- }
- arr[2] = arr[2].replace(':', ':')
- let result = {}
- try {
- result = JSON.parse(`{${arr[2]}}`)
- } catch (error) {
- console.log(val)
- }
- if (!result.dept) {
- return ''
- }
- const depts = result.dept.split(',')
- const deptNames = []
- depts.forEach((item) => {
- const t = this.deptList.find((i) => i.positionId === item)
- deptNames.push(t ? t.positionName : result.dept)
- })
- result.deptName = deptNames.join(',')
- return result[arg]
- },
- /**
- * 点击表格
- */
- handleLinkClick(data) {
- this.instanceId = data.id || ''
- this.dialogFormVisible = true
- },
- /**
- * 数据转换,用户、部门
- */
- getTransformData(val, dataset, from, to) {
- if (!val) {
- return ''
- }
- const temp = this[dataset].find((u) => u[from] === val)
- return temp ? temp[to] : ''
- }
- }
- }
|