|
|
@@ -7,7 +7,7 @@
|
|
|
title="记录分类"
|
|
|
:location="location"
|
|
|
category-key="FLOW_TYPE"
|
|
|
- :hasPermission="true"
|
|
|
+ :hasPermission="hasPermission"
|
|
|
@node-click="handleNodeClick"
|
|
|
@expand-collapse="handleExpandCollapse"
|
|
|
/>
|
|
|
@@ -47,20 +47,17 @@
|
|
|
<!-- 弹框内容 -->
|
|
|
<div class="div_content">
|
|
|
<!-- 获取所有输出报告-->
|
|
|
- <div
|
|
|
- v-if="currReportCont.report.length > 0"
|
|
|
- v-for="(item, i) in currReportCont.report"
|
|
|
- class="content_butts"
|
|
|
- >
|
|
|
- <span style="cursor: pointer;" @click="clickCont(currReportCont, i)">
|
|
|
- <i class="el-icon-tickets" style="font-size: 18px;"/>
|
|
|
- {{
|
|
|
- item.slice(-item.split('').reverse().join('').indexOf(' '), -item.split('').reverse().join('').indexOf('.') - 1)
|
|
|
- }}
|
|
|
- </span>
|
|
|
- <br/>
|
|
|
- </div>
|
|
|
- <div v-if="currReportCont.file" class="content_butts">
|
|
|
+ <template v-if="record.report.length">
|
|
|
+ <div v-for="item in record.report" class="content_butts">
|
|
|
+ <span style="cursor: pointer;" @click="openReport(item, record.bizKey)">
|
|
|
+ <i class="el-icon-tickets" style="font-size: 18px;"/>
|
|
|
+ <!-- 截取表单名称 -->
|
|
|
+ {{ item | getReportName }}
|
|
|
+ </span>
|
|
|
+ <br/>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <div v-if="record.file.length" class="content_butts">
|
|
|
<ibps-attachment
|
|
|
v-model="fileId"
|
|
|
placeholder="请选择"
|
|
|
@@ -111,37 +108,52 @@
|
|
|
import IbpsTypeTree from '@/business/platform/cat/type/tree'
|
|
|
import FixHeight from '@/mixins/height'
|
|
|
import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
|
|
|
- import curdPost from '@/business/platform/form/utils/custom/joinCURD.js' //增删改查规则
|
|
|
+ import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
|
|
|
import IbpsAttachment from '@/business/platform/file/attachment/selector'
|
|
|
- import GetReport from './corresponding/getReport.js'
|
|
|
+ import { specialType } from './corresponding/index'
|
|
|
export default {
|
|
|
components: {
|
|
|
IbpsTypeTree,
|
|
|
BpmnFormrender,
|
|
|
'ibps-attachment': IbpsAttachment
|
|
|
},
|
|
|
- mixins: [FixHeight, GetReport],
|
|
|
+ mixins: [FixHeight],
|
|
|
props: {
|
|
|
location: {
|
|
|
type: String,
|
|
|
default: 'initial'
|
|
|
}
|
|
|
},
|
|
|
+ filters: {
|
|
|
+ // 截取报表名称
|
|
|
+ getReportName(value) {
|
|
|
+ // 通过/与.截取,eg: 43罗湖/L13-LHXBJY-QP-6.4-04 标准菌株管理程序/LHXBJY-QP-6.4-04-FQ-03 标准菌株鉴定验收记录表.rpx
|
|
|
+ return value.slice(-value.split('').reverse().join('').indexOf('/'), -value.split('').reverse().join('').indexOf('.') - 1)
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
- width: 200,
|
|
|
+ width: 250,
|
|
|
selection: false,
|
|
|
- dialogFormVisible: false, // 弹窗
|
|
|
- instanceId: '', // 编辑dialog需要使用
|
|
|
- pkKey: 'id', // 主键 如果主键不是pk需要传主键
|
|
|
+ dialogFormVisible: false,
|
|
|
+ // 编辑dialog需要使用
|
|
|
+ instanceId: '',
|
|
|
+ // 主键 如果主键不是pk需要传主键
|
|
|
+ pkKey: 'id',
|
|
|
tableTitle: '',
|
|
|
typeId: '',
|
|
|
- srcUrl: '', // 报表字段
|
|
|
- fileId: '', // 文件字段
|
|
|
- isDisable: false, // 判断多次点击
|
|
|
- forClick: '', // 判断是否重复点击
|
|
|
+ srcUrl: '',
|
|
|
+ fileId: '',
|
|
|
+ // 判断多次点击
|
|
|
+ isDisable: false,
|
|
|
visible: false,
|
|
|
- currReportCont: {},
|
|
|
+ record: {
|
|
|
+ report: [],
|
|
|
+ file: [],
|
|
|
+ table: [],
|
|
|
+ field: [],
|
|
|
+ bizKey: ''
|
|
|
+ },
|
|
|
title: '',
|
|
|
loading: true,
|
|
|
height: document.clientHeight,
|
|
|
@@ -149,39 +161,26 @@
|
|
|
listData: [],
|
|
|
pagination: {},
|
|
|
sorts: {},
|
|
|
+ // 默认过滤部分分类
|
|
|
+ hasPermission: true,
|
|
|
listConfig: {
|
|
|
toolbars: [
|
|
|
{ key: 'search' }
|
|
|
],
|
|
|
searchForm: {
|
|
|
forms: [
|
|
|
- {
|
|
|
- prop: 'Q^subject_^SL',
|
|
|
- label: '关键字:',
|
|
|
- width: 125
|
|
|
- }
|
|
|
+ { prop: 'Q^subject_^SL', label: '关键字:', width: 125 }
|
|
|
]
|
|
|
},
|
|
|
// 表格字段配置
|
|
|
columns: [
|
|
|
// { prop: 'subject', label: '任务标题', link: 'dialog', width: 250 },
|
|
|
- { prop: 'tYear', label: '年份', width: 58 },
|
|
|
+ { prop: 'tYear', label: '年份', width: 60 },
|
|
|
{ prop: 'tDept', label: '部门', width: 120 },
|
|
|
- { prop: 'procDefName', label: '表单名称' },
|
|
|
- {
|
|
|
- prop: 'subject',
|
|
|
- label: '事务说明',
|
|
|
- width: 200,
|
|
|
- formatter: this.getDesc
|
|
|
- },
|
|
|
+ { prop: 'procDefName', label: '表单名称', width: 200 },
|
|
|
+ { prop: 'subject', label: '事务说明', formatter: this.getDesc },
|
|
|
{ prop: 'tUser', label: '编制人', width: 80 },
|
|
|
- {
|
|
|
- prop: 'endTime',
|
|
|
- label: '完成时间',
|
|
|
- sortable: 'custom',
|
|
|
- dateFormat: 'yyyy-MM-dd',
|
|
|
- width: 150
|
|
|
- }
|
|
|
+ { prop: 'endTime', label: '完成时间', sortable: 'custom', dateFormat: 'yyyy-MM-dd', width: 150}
|
|
|
],
|
|
|
rowHandle: {
|
|
|
actions: [
|
|
|
@@ -198,9 +197,12 @@
|
|
|
created() {
|
|
|
this.loadData()
|
|
|
this.getConfig()
|
|
|
- let roleArr = this.$store.getters.userInfo.role
|
|
|
- const hasRole = roleArr.some(item => item.name === '系统管理角色')
|
|
|
+ const roleList = this.$store.getters.userInfo.role
|
|
|
+ // 系统管理角色添加删除按钮
|
|
|
+ const hasRole = roleList.some(item => item.name === '系统管理角色')
|
|
|
if (hasRole) {
|
|
|
+ // 系统管理角色不做分类过滤
|
|
|
+ this.hasPermission = false
|
|
|
this.listConfig.toolbars.push({ key: 'remove' })
|
|
|
this.selection = true
|
|
|
}
|
|
|
@@ -214,18 +216,6 @@
|
|
|
}
|
|
|
return cellValue.split('#')[1]
|
|
|
},
|
|
|
- // 获取配置报表数据
|
|
|
- getConfig() {
|
|
|
- const params = {
|
|
|
- tableName: 't_lcidglbdbb',
|
|
|
- paramWhere: {
|
|
|
- 1: '1'
|
|
|
- }
|
|
|
- }
|
|
|
- curdPost('select', params).then((response) => {
|
|
|
- this.reportAll = response.variables.data
|
|
|
- })
|
|
|
- },
|
|
|
// 加载数据
|
|
|
loadData() {
|
|
|
this.loading = true
|
|
|
@@ -233,12 +223,15 @@
|
|
|
let data = response.data && response.data.dataResult
|
|
|
data.forEach(item => {
|
|
|
let temp = this.getParenthesesStr(item.subject)
|
|
|
+ //如果是年度计划, 标题编辑中取年份, 去除默认给与的年份
|
|
|
if (temp.length === 4) {
|
|
|
- //如果是年度计划, 标题编辑中取年份, 去除默认给与的年份
|
|
|
+ // 判断截取内容是否为数字,如果不是则截取创建时间的作为年份
|
|
|
+ item.tYear = isNaN(Number(temp[0])) ? item.createTime.slice(0, 4) : temp[0]
|
|
|
item.tYear = temp[0]
|
|
|
item.tDept = temp[2]
|
|
|
item.tUser = temp[3]
|
|
|
} else if (temp.length > 1) {
|
|
|
+ item.tYear = isNaN(Number(temp[0])) ? item.createTime.slice(0, 4) : temp[0]
|
|
|
item.tYear = temp[0]
|
|
|
item.tDept = temp[1]
|
|
|
item.tUser = temp[2]
|
|
|
@@ -250,10 +243,117 @@
|
|
|
this.loading = false
|
|
|
})
|
|
|
},
|
|
|
+ // 获取所有流程的报表配置数据
|
|
|
+ getConfig() {
|
|
|
+ const sql = 'select bao_biao_lu_jing_, fu_jian_nei_rong_, guan_lian_zi_duan, liu_cheng_xuan_ze, shi_fou_zi_biao_ from t_lcidglbdbb'
|
|
|
+ curdPost('sql', sql).then((res) => {
|
|
|
+ this.reportAll = res.variables && res.variables.data
|
|
|
+ }).catch(error => {
|
|
|
+ console.log('获取流程配置报表数据失败!')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取报表数据及附件数据
|
|
|
+ getReportAndFile({ procDefKey, bizKey, subject }) {
|
|
|
+ if (this.isDisable) {
|
|
|
+ this.$message.error('请勿快速点击!');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.numbersClick()
|
|
|
+ let temp = this.reportAll.find(item => item.liu_cheng_xuan_ze === procDefKey)
|
|
|
+ if (!temp) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.record = {
|
|
|
+ report: temp.liu_cheng_xuan_ze ? temp.bao_biao_lu_jing_.split(',') : [],
|
|
|
+ file: temp.fu_jian_nei_rong_ ? temp.fu_jian_nei_rong_.split('.') : [],
|
|
|
+ table: temp.shi_fou_zi_biao_ ? temp.shi_fou_zi_biao_.split('.') : [],
|
|
|
+ field: temp.guan_lian_zi_duan ? temp.guan_lian_zi_duan.split('.') : [],
|
|
|
+ bizKey
|
|
|
+ }
|
|
|
+ let typeIndex = ''
|
|
|
+ // 特殊类型处理
|
|
|
+ if (specialType.hasOwnProperty(this.typeId)) {
|
|
|
+ specialType[this.typeId].forEach((item, index) => {
|
|
|
+ // 判断当前流程在哪一步,以此决定报表展示
|
|
|
+ if (subject.includes(item)) {
|
|
|
+ // 数组下标+2为当前报表文件排序
|
|
|
+ typeIndex = index + 2
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log(typeIndex)
|
|
|
+ if (typeIndex !== '') {
|
|
|
+ this.record.report = this.record.report.slice(0, typeIndex)
|
|
|
+ }
|
|
|
+ // console.log(this.record)
|
|
|
+ if (this.record.file.length && this.record.table.length) {
|
|
|
+ this.getAllFile(this.record)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取所有附件
|
|
|
+ getAllFile({file, table, field, bizKey}) {
|
|
|
+ let resultList = []
|
|
|
+ table.forEach((item, index) => {
|
|
|
+ let sql = `select ${file[index]} from ${item} where ${field.length && field[index] ? field[index] : 'id_'} = '${bizKey}'`
|
|
|
+ resultList.push(this.getFile(sql, file[index]))
|
|
|
+ })
|
|
|
+ // console.log(resultList)
|
|
|
+ Promise.all(resultList).then(res => {
|
|
|
+ // console.log('所有附件ID:', res)
|
|
|
+ this.fileId = res.join(',')
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('error', err);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取单个请求中的文件
|
|
|
+ getFile(sql, fileField) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ curdPost('sql', sql).then(res => {
|
|
|
+ let result = []
|
|
|
+ let fileList = fileField.split(',')
|
|
|
+ // console.log(fileList)
|
|
|
+ let { data = [] } = res.variables || {}
|
|
|
+ data = data.filter(i => i)
|
|
|
+ data.forEach(item => {
|
|
|
+ // 能获取到值说明文件字段只有一个
|
|
|
+ if (item[fileField]) {
|
|
|
+ result.push(this.getFileId(item[fileField]))
|
|
|
+ } else if (fileList.length > 1) {
|
|
|
+ // 否则文件字段为多个,需嵌套循环
|
|
|
+ fileList.forEach(i => {
|
|
|
+ if (item[i]) {
|
|
|
+ result.push(this.getFileId(item[i]))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ resolve(result.join(','))
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取文件ID
|
|
|
+ getFileId(value) {
|
|
|
+ // 判断是否为图片类型,文件类型只存储文件ID,图片会以对象形式保存
|
|
|
+ if (value.includes('id')) {
|
|
|
+ let result = []
|
|
|
+ let temp = JSON.parse(value)
|
|
|
+ temp.forEach(item => result.push(item.id))
|
|
|
+ return result.join(',')
|
|
|
+ }
|
|
|
+ return value
|
|
|
+ },
|
|
|
+ // 打开报表
|
|
|
+ openReport(path, id) {
|
|
|
+ this.srcUrl = `${this.$reportPash.replace('show', 'pdf')}${path}&id_=${id}`
|
|
|
+ this.visible = true
|
|
|
+ },
|
|
|
getParenthesesStr(text) {
|
|
|
let result = ''
|
|
|
if (!text) return result
|
|
|
+ // 新数据年份、部门、发起人以{}包裹
|
|
|
let regex1 = /\{(.+?)\}/g
|
|
|
+ // 旧数据年份、部门、发起人以()包裹
|
|
|
let regex2 = /\((.+?)\)/g
|
|
|
let options1 = text.match(regex1)
|
|
|
let options2 = text.match(regex2)
|