update 法规入库/变更流程、pdfjs
This commit is contained in:
@@ -87,10 +87,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.process-part:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/*表单样式调整*/
|
||||
/deep/ .van-field__label {
|
||||
font-size: 0.28rem;
|
||||
|
||||
@@ -21,5 +21,11 @@ module.exports = {
|
||||
personalInfo: '人员信息',
|
||||
turnTo: '转办',
|
||||
agree: '同意',
|
||||
reject: '驳回'
|
||||
reject: '驳回',
|
||||
processApprovalInfo: '流程审批信息',
|
||||
remark: '备注',
|
||||
standardEntryOrChange: {
|
||||
source: '来源',
|
||||
operationType: '操作类型'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<div>
|
||||
<template v-if="fileList && fileList.length > 0">
|
||||
<div v-for="file in fileList" :key="file.id" class="file-name" @click="handlePreview(file)">{{ file.fileName }}</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getFileInfo } from '../api/api'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '../store/mutation-types'
|
||||
import { getFileAccessHttpUrl } from '../api/manage'
|
||||
import { previewPdf } from '../utils/previewPdf'
|
||||
|
||||
const Base64 = require('js-base64').Base64
|
||||
|
||||
// 支持预览的文件后缀
|
||||
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
|
||||
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
|
||||
const FILE_TYPE_PDF = 'pdf'
|
||||
|
||||
export default {
|
||||
name: 'FileDisplay',
|
||||
props: {
|
||||
// 文件id
|
||||
fileIds: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
fileIds: {
|
||||
handler () {
|
||||
console.log('文件id', this.fileIds)
|
||||
if (this.fileIds) {
|
||||
this.initFileList()
|
||||
} else {
|
||||
this.fileList = []
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取文件列表
|
||||
*/
|
||||
initFileList () {
|
||||
const fileIdArr = this.fileIds.split(',')
|
||||
this.fileList = []
|
||||
fileIdArr.forEach(item => {
|
||||
getFileInfo({ id: item }).then(res => {
|
||||
if (res.success) {
|
||||
this.fileList.push(res.result)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
handlePreview (file) {
|
||||
if (!file || !file.url) {
|
||||
return
|
||||
}
|
||||
// 截取文件后缀名
|
||||
const fileSuffix = file.fileName ? file.fileName.split('.')[file.fileName.split('.').length - 1] : ''
|
||||
const canPreview = CAN_PREVIEW_FILE_SUFFIX.some(tt => fileSuffix.toLowerCase() === tt)
|
||||
// 判断是否为可预览格式的文件
|
||||
if (!canPreview) {
|
||||
this.$message('该文件类型不支持预览')
|
||||
return
|
||||
}
|
||||
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
|
||||
// 图片预览,使用自己添加的组件
|
||||
if (canPreview && FILE_TYPE_IMGS.includes(fileSuffix.toLowerCase())) {
|
||||
this.imageUrl = getFileAccessHttpUrl(file.id)
|
||||
// 获取viewer实例
|
||||
const viewer = this.$el.querySelector('.image').$viewer
|
||||
// 调用show方法进行显示预览图
|
||||
viewer.show()
|
||||
// this.$refs.imagePreviewModal.open(file)
|
||||
return
|
||||
}
|
||||
// pdf预览
|
||||
if (canPreview && FILE_TYPE_PDF.includes(fileSuffix)) {
|
||||
const url = previewPdf(file.id)
|
||||
window.open(url)
|
||||
return
|
||||
}
|
||||
// 其余可预览文件仍使用KKFile进行预览
|
||||
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
|
||||
window.open(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
|
||||
.file-name {
|
||||
color: @primary-color;
|
||||
}
|
||||
</style>
|
||||
+3
-3
@@ -34,9 +34,9 @@ export default class EsEnum {
|
||||
optionList.push(option)
|
||||
}
|
||||
optionList.sort((a, b) => {
|
||||
const value1 = a['index']
|
||||
const value2 = b['index']
|
||||
return decend && (value2 - value1) || (value1 - value2)
|
||||
const value1 = a.index
|
||||
const value2 = b.index
|
||||
return decend ? (value2 - value1) : (value1 - value2)
|
||||
})
|
||||
return optionList
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ export const FieldType = {
|
||||
TREE_MODAL_SELECT: { text: '树形弹框', value: '16' }
|
||||
}
|
||||
|
||||
|
||||
// 标准来源
|
||||
export const StandardSource = {
|
||||
DOMESTIC: { text: '国内', value: '1' },
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import Vue from 'vue'
|
||||
|
||||
const getToken = () => Vue.ls.get(ACCESS_TOKEN)
|
||||
|
||||
// 预览pdf
|
||||
const previewPdf = (id) => {
|
||||
const url = `${window._CONFIG.domianURL}/sys/common/view/${id}?type=view&token=${getToken()}`
|
||||
return `${process.env.BASE_URL}pdfjs/web/viewer.html?file=` + encodeURIComponent(url) + '&.pdf'
|
||||
}
|
||||
|
||||
export {
|
||||
previewPdf
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
autosize
|
||||
readonly
|
||||
rows="1"
|
||||
:placeholder="$t('pleaseEnter')+$t('processName')"
|
||||
:border="false" />
|
||||
<!--截止日期-->
|
||||
<van-field v-model="processInfo.processDueDate"
|
||||
@@ -20,6 +21,7 @@
|
||||
autosize
|
||||
readonly
|
||||
rows="1"
|
||||
:placeholder="$t('pleaseSelect')+$t('expirationDate')"
|
||||
:border="false" />
|
||||
<!--流程说明-->
|
||||
<van-field v-model="processInfo.processDescription"
|
||||
@@ -28,6 +30,63 @@
|
||||
autosize
|
||||
disabled
|
||||
rows="1"
|
||||
:placeholder="$t('pleaseEnter')+$t('processExplain')"
|
||||
:border="false"
|
||||
input-align="left"
|
||||
class="vertical-form-item">
|
||||
</van-field>
|
||||
</van-form>
|
||||
</div>
|
||||
|
||||
<!--业务信息,循环展示-->
|
||||
<template v-for="(part,index) in formList">
|
||||
<div class="process-part" :key="'part' + index" v-if="(part && part.length > 0) || formPartList.findIndex(index) === 0">
|
||||
<div class="process-part-title">{{ index }}</div>
|
||||
<van-form input-align="right">
|
||||
<!--来源-->
|
||||
<van-field v-model="formInline.source_dictText"
|
||||
:label="$t('standardEntryOrChange.source')"
|
||||
type="textarea"
|
||||
autosize
|
||||
readonly
|
||||
rows="1"
|
||||
:border="false" />
|
||||
<!--操作类型-->
|
||||
<van-field v-model="formInline.operateType_dictText"
|
||||
:label="$t('standardEntryOrChange.operationType')"
|
||||
type="textarea"
|
||||
autosize
|
||||
readonly
|
||||
rows="1"
|
||||
:border="false" />
|
||||
<van-field v-for="formItem in part"
|
||||
:key="formItem.id"
|
||||
v-model="formInline[dictField.includes(formItem.dbFieldName) ? formItem.dbFieldName + '_dictText' : formItem.dbFieldName]"
|
||||
:label="formItem.dbFieldTxt"
|
||||
type="textarea"
|
||||
autosize
|
||||
readonly
|
||||
rows="1"
|
||||
:border="false">
|
||||
<template v-slot:input v-if="fileField.includes(formItem.dbFieldName)">
|
||||
<file-display :file-ids="formInline[formItem.dbFieldName]" />
|
||||
</template>
|
||||
</van-field>
|
||||
</van-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!--流程审批信息-->
|
||||
<div class="process-part">
|
||||
<div class="process-part-title">{{ $t('processApprovalInfo') }}</div>
|
||||
<van-form input-align="right">
|
||||
<!--备注-->
|
||||
<van-field v-model="processInfo.processDescription"
|
||||
:label="$t('remark')"
|
||||
type="textarea"
|
||||
autosize
|
||||
rows="1"
|
||||
:placeholder="$t('pleaseEnter')+$t('remark')"
|
||||
:border="false"
|
||||
input-align="left"
|
||||
class="vertical-form-item">
|
||||
@@ -46,17 +105,23 @@
|
||||
|
||||
<script>
|
||||
import ProcessCommonLayout from '../../components/ProcessCommonLayout'
|
||||
import { queryStandardECProcessData } from '../../api/api'
|
||||
import { queryStandardECProcessData, getDomesticStandardFormModal } from '../../api/api'
|
||||
import { FieldType, StandardSource } from '../../enums/commonEnums'
|
||||
import FileDisplay from '../../components/FileDisplay'
|
||||
|
||||
export default {
|
||||
name: 'StandardEntryOrChangeProcess',
|
||||
components: { ProcessCommonLayout },
|
||||
components: { ProcessCommonLayout, FileDisplay },
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
processInfo: {}, // 流程信息数据
|
||||
businessId: null,
|
||||
formInline: {} // 业务信息表单数据
|
||||
formInline: {}, // 业务信息表单数据
|
||||
formList: [], // 表单
|
||||
dictField: [], // 需要翻译的字段
|
||||
fileField: [], // 文件字段
|
||||
formPartList: [] // 展示区域信息
|
||||
}
|
||||
},
|
||||
created () {
|
||||
@@ -69,22 +134,75 @@ export default {
|
||||
initProcessData () {
|
||||
this.loading = true
|
||||
const { processInstanceId, taskId } = this.$route.query
|
||||
queryStandardECProcessData({ processInstanceId, taskId }).then(res => {
|
||||
queryStandardECProcessData({ processInstanceId, taskId }).then(async res => {
|
||||
if (res.success) {
|
||||
const { result = {} } = res
|
||||
const businessData = { ...result.businessInfoDTO.businessMap }
|
||||
this.formInline.source = businessData.source
|
||||
this.processInfo = Object.assign({}, result.basicProcessInfoDTO)
|
||||
this.formInline = { ...result.businessInfoDTO.businessMap }
|
||||
switch (this.formInline.source) {
|
||||
case StandardSource.DOMESTIC.value:
|
||||
await this.getDomesticFormItem()
|
||||
break
|
||||
case StandardSource.OVERSEAS.value:
|
||||
await this.getOverseasFormItem()
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
} else {
|
||||
this.$message(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取国标的表单
|
||||
*/
|
||||
getDomesticFormItem () {
|
||||
return new Promise(resolve => {
|
||||
getDomesticStandardFormModal({
|
||||
module: StandardSource.DOMESTIC.value,
|
||||
type: 2 // 2是新增;1是详情
|
||||
}).then(res => {
|
||||
if (res.success) {
|
||||
this.formList = res.result
|
||||
this.dealFileAndDict()
|
||||
} else {
|
||||
this.$message(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取海外表单
|
||||
*/
|
||||
getOverseasFormItem () {
|
||||
return new Promise()
|
||||
},
|
||||
dealFileAndDict () {
|
||||
this.formPartList = Object.keys(this.formList)
|
||||
// 字段列表
|
||||
const formArr = Object.values(this.formList).reduce((acc, cur) => acc.concat(cur), [])
|
||||
this.fileField = []
|
||||
this.dictField = []
|
||||
formArr.forEach(item => {
|
||||
if (item.fieldShowType === FieldType.FILE_UP.value) {
|
||||
this.fileField.push(item.dbFieldName)
|
||||
}
|
||||
const dictType = [FieldType.USER_SINGLE.value, FieldType.ORGAN_SINGLE.value, FieldType.ORGAN_MORE.value, FieldType.OPTION_SINGLE.value, FieldType.OPTION_MORE.value, FieldType.TREE.value, FieldType.TREE_SINGLE.value]
|
||||
if (dictType.includes(item.fieldShowType)) {
|
||||
this.dictField.push(item.dbFieldName)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user