[update] 修改/sys/common/view接口的token字段名改为at

This commit is contained in:
lideqin
2024-01-12 13:38:22 +08:00
committed by 赵霄
parent f033eda45b
commit c60b1a915e
8 changed files with 173 additions and 142 deletions
+1 -1
View File
@@ -296,7 +296,7 @@ export default {
})
return
}
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
// 图片预览,使用自己添加的组件
if (canPreview && FILE_TYPE_IMGS.includes(fileSuffix.toLowerCase())) {
this.imageUrl = getFileAccessHttpUrl(file.id)
@@ -8,7 +8,7 @@
<a-col :span="6">
<a-form-item :label="$t('businessSupport.questionAnswer.classify')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
:placeholder="$t('pleaseEnter')+$t('businessSupport.questionAnswer.classify')"
:placeholder="$t('pleaseSelect')+$t('businessSupport.questionAnswer.classify')"
dict-code="problem_library_type"
v-model="queryParam.type">
</j-dict-select-tag>
@@ -128,6 +128,8 @@ import { kkFilePreview } from '@/utils/kkFilePreview'
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf'
// 支持预览的文件后缀
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
export default {
name: 'QuestionAnswerList',
@@ -223,7 +225,15 @@ export default {
handleAttachClick (record) {
// 截取文件后缀名
const fileSuffix = record.declareFileName ? record.declareFileName.split('.')[record.declareFileName.split('.').length - 1] : ''
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${record.declareFile}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${record.declareFileName}`
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${record.declareFile}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${record.declareFileName}`
const canPreview = CAN_PREVIEW_FILE_SUFFIX.some(tt => fileSuffix === tt)
// 判断是否为可预览格式的文件
if (!canPreview) {
this.$message.loading(this.$t('uploadFile.cannotPreview')).then(() => {
this.handleDownload(record.declareFile, record.declareFileName)
})
return
}
// 图片预览,使用自己添加的组件
if (FILE_TYPE_IMGS.includes(fileSuffix)) {
this.imageUrl = getFileAccessHttpUrl(record.declareFile)
@@ -240,13 +250,12 @@ export default {
window.open(url)
return
}
// word用KKfile预览
if (fileSuffix === 'doc' || fileSuffix === 'docx') {
kkFilePreview(fileFullUrl)
return
}
// 如果都不能预览就下载
downloadFile(`/sys/common/download/${record.declareFile}`, record.declareFileName)
// 其余可预览文件仍使用KKFile进行预览
kkFilePreview(fileFullUrl)
},
handleDownload (id, name) {
// 下载文件
downloadFile(`/sys/common/download/${id}`, name)
},
// 查看
handleDetail (record) {
@@ -212,7 +212,7 @@ export default {
})
return
}
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
// 图片预览,使用自己添加的组件
if (canPreview && FILE_TYPE_IMGS.includes(fileSuffix.toLowerCase())) {
this.imageUrl = getFileAccessHttpUrl(file.id)
@@ -224,7 +224,7 @@ export default {
})
return
}
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
// 图片预览,使用自己添加的组件
if (canPreview && FILE_TYPE_IMGS.includes(fileSuffix.toLowerCase())) {
this.imageUrl = getFileAccessHttpUrl(file.id)
@@ -274,7 +274,7 @@ export default {
})
return
}
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
// 图片预览,使用自己添加的组件
if (canPreview && FILE_TYPE_IMGS.includes(fileSuffix.toLowerCase())) {
this.imageUrl = getFileAccessHttpUrl(file.id)
@@ -121,7 +121,7 @@ export default {
const url = previewPdf(file.id)
this.iframeSrc = url
} else if (fileSuffix === 'docx') {
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
// word文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
this.iframeSrc = url
@@ -151,7 +151,7 @@ export default {
const url = previewPdf(file.id)
this.iframeSrc = url
} else if (fileSuffix === 'docx') {
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.fileName}`
// word文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
this.iframeSrc = url
@@ -17,7 +17,7 @@
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="standard-file-div">
<a class="link-a" @click="handleLookUploadStandard(record)">{{ record.standardFile_dictText }}</a>
<a class="link-a" @click="handleLookUploadStandard(record)">{{ record.fileId_dictText }}</a>
<a class="download-a" @click="handleDownloadUploadStandard(record)">{{ $t('download') }}</a>
</div>
</a-tooltip>
@@ -26,106 +26,103 @@
</j-table>
</div>
<a-form-model :model="formInline" class="form-add" :rules="rules" ref="ruleForm">
<div class="collapsible-panel-form">
<div class="form-flex-box collapsible-panel-form-content collapsible-content-no-head">
<!-- 标准文本 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<div class="form-flex-box">
<!-- 标准文本 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.standardText')">
{{ $t('workCenter.enStandardRevision.standardText') }}
</span>
</div>
<a-form-model-item class="item-model">
<div class="online-edit-wrapper">
<!-- todo: 还不确定这里展示的是什么 -->
<p>企业标准</p>
<a-button type="primary">{{ $t('workCenter.enStandardRevision.onLineEditing') }}</a-button>
</div>
</a-form-model-item>
</div>
<!-- 参会人员 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.conferee')">
<a-form-model-item class="item-model">
<div class="online-edit-wrapper">
<!-- todo: 还不确定这里展示的是什么 -->
<p>企业标准</p>
<a-button type="primary">{{ $t('workCenter.enStandardRevision.onLineEditing') }}</a-button>
</div>
</a-form-model-item>
</div>
<!-- 参会人员 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.conferee')">
{{ $t('workCenter.enStandardRevision.conferee') }}
</span>
</div>
<a-form-model-item class="item-model" prop="conferee">
<user-selection v-model="formInline.conferee"
:placeholder="$t('pleaseSelect')+$t('workCenter.enStandardRevision.conferee')"
:disabled="disabled"
filedName="conferee"
@nameChange="userSelectNameChange"
:nameStr="formInline.conferee_dictText"
type="checkbox"/>
</a-form-model-item>
</div>
<!-- 会议纪要 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.meetingSummary')">
<a-form-model-item class="item-model" prop="meetingUsers">
<user-selection v-model="formInline.meetingUsers"
:placeholder="$t('pleaseSelect')+$t('workCenter.enStandardRevision.conferee')"
:disabled="disabled"
filedName="meetingUsers"
@nameChange="userSelectNameChange"
:nameStr="formInline.meetingUsers_dictText"
type="checkbox"/>
</a-form-model-item>
</div>
<!-- 会议纪要 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.meetingSummary')">
{{ $t('workCenter.enStandardRevision.meetingSummary') }}
</span>
</div>
<a-form-model-item class="item-model" prop="meetingSummary">
<a-button type="primary" class="button-text" style="width: 200px" @click="clickButtonToUpload('meetingSummary')">
{{
(formInline.meetingSummary === 'null' || formInline.meetingSummary === ''
|| formInline.meetingSummary === null || formInline.meetingSummary === undefined)
? $t('uploadFile.clickUpload')
: $t('uploadFile.viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
<!-- 编制说明 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.compilationIllustration')">
<a-form-model-item class="item-model" prop="meetingSummary">
<a-button type="primary" class="button-text" style="width: 200px" @click="clickButtonToUpload('meetingSummary')">
{{
(formInline.meetingSummary === 'null' || formInline.meetingSummary === ''
|| formInline.meetingSummary === null || formInline.meetingSummary === undefined)
? $t('uploadFile.clickUpload')
: $t('uploadFile.viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
<!-- 编制说明 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.compilationIllustration')">
{{ $t('workCenter.enStandardRevision.compilationIllustration') }}
</span>
</div>
<a-form-model-item class="item-model" prop="comp_illustration">
<a-button type="primary" class="button-text" style="width: 200px" @click="clickButtonToUpload('comp_illustration')">
{{
(formInline.comp_illustration === 'null' || formInline.comp_illustration === ''
|| formInline.comp_illustration === null || formInline.comp_illustration === undefined)
? $t('uploadFile.clickUpload')
: $t('uploadFile.viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
<!-- 是否需要稽查 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.isNeedAudit')">
<a-form-model-item class="item-model" prop="compIllustration">
<a-button type="primary" class="button-text" style="width: 200px" @click="clickButtonToUpload('compIllustration')">
{{
(formInline.compIllustration === 'null' || formInline.compIllustration === ''
|| formInline.compIllustration === null || formInline.compIllustration === undefined)
? $t('uploadFile.clickUpload')
: $t('uploadFile.viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
<!-- 稽查内容 -->
<p class="base-info-inner-title">{{ $t('enterpriseStandardLibrary.standard.auditContent') }}</p>
<!-- 是否需要稽查 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.isNeedAudit')">
{{ $t('workCenter.enStandardRevision.isNeedAudit') }}
</span>
</div>
<a-form-model-item class="item-model" prop="isNeedAudit">
<a-radio-group v-model="formInline.isNeedAudit">
<a-radio :value="1">
{{ $t('yes') }}
</a-radio>
<a-radio :value="2">
{{ $t('not') }}
</a-radio>
</a-radio-group>
</a-form-model-item>
</div>
<a-form-model-item class="item-model" prop="inspectFlag">
<a-radio-group v-model="formInline.inspectFlag">
<a-radio value="1">
{{ $t('yes') }}
</a-radio>
<a-radio value="0">
{{ $t('not') }}
</a-radio>
</a-radio-group>
</a-form-model-item>
</div>
</div>
</a-form-model>
<!-- 是否需要稽查选择是需要填写稽查内容否则隐藏稽查内容区域 -->
<template v-if="formInline.isNeedAudit === 1">
<!-- 稽查内容 -->
<p class="base-info-inner-title">{{ $t('enterpriseStandardLibrary.standard.auditContent') }}</p>
<template v-if="formInline.inspectFlag === '1'">
<!-- 操作区域 -->
<div v-if="!disabled" class="table-operator">
<!-- 新增 -->
@@ -149,7 +146,7 @@
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.id, index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
<a @click="handleDelete(index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
</div>
</j-table>
@@ -204,32 +201,32 @@ export default {
title: this.$t('workCenter.enStandardRevision.draftingUnit'),
align: 'center',
width: 180,
dataIndex: 'draftingUnit_dictText',
dataIndex: 'dept_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 起草人
title: this.$t('workCenter.enStandardRevision.drafter'),
align: 'center',
width: 180,
dataIndex: 'drafter_dictText',
dataIndex: 'user_dictText',
scopedSlots: { customRender: 'text' }
},
{ // 起草范围
title: this.$t('workCenter.enStandardRevision.draftingScope'),
align: 'center',
width: 180,
dataIndex: 'draftingScope',
dataIndex: 'scope',
scopedSlots: { customRender: 'text' }
},
{ // 截止日期
title: this.$t('expirationDate'),
align: 'center',
width: 180,
dataIndex: 'expirationDate',
dataIndex: 'deadline',
scopedSlots: { customRender: 'text' }
},
{ // 企标文本
dataIndex: 'standardFile_dictText',
dataIndex: 'fileId_dictText',
title: this.$t('workCenter.enStandardRevision.enterpriseStandardText'),
scopedSlots: { customRender: 'standardFile' },
align: 'center',
@@ -237,12 +234,12 @@ export default {
}
],
// 起草人表格数据
drafterDataSource: [{id: 1, standardFile: '1715299701232504833', standardFile_dictText: '测试上传excel测试测试测试测试.xls'}],
drafterDataSource: [],
drafterLoading: false,
formInline: {},
rules: {
// 参会人员
conferee: [
meetingUsers: [
{
required: true,
message: this.$t('workCenter.enStandardRevision.conferee') + this.$t('cannotEmpty'),
@@ -257,8 +254,16 @@ export default {
trigger: 'change'
}
],
// 编制说明
compIllustration: [
{
required: true,
message: this.$t('workCenter.enStandardRevision.compilationIllustration') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
// 是否需要稽查
isNeedAudit: [
inspectFlag: [
{
required: true,
message: this.$t('workCenter.enStandardRevision.isNeedAudit') + this.$t('cannotEmpty'),
@@ -268,25 +273,35 @@ export default {
},
// 稽查内容表格列
columns: [
{
{ // 条款
title: this.$t('enterpriseStandardLibrary.standard.subjectToClause'),
align: 'center',
width: 180,
dataIndex: 'clause',
scopedSlots: { customRender: 'text' }
},
{
{ // 标准内容和要求
title: this.$t('enterpriseStandardLibrary.standard.standardContentOrRequirements'),
align: 'center',
width: 180,
dataIndex: 'requirement',
scopedSlots: { customRender: 'text' }
},
{ // 整改部门
title: this.$t('enterpriseStandardLibrary.standard.rectificationDepartment'),
align: 'center',
width: 200,
dataIndex: 'rectificationDepartment',
customRender: (value, row, index) => {
return <j-select-depart v-model={this.dataSource[index].rectificationDepartment}
backDepart={true} />
}
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
width: 200
width: 150
}
],
// 稽查内容表格数据
@@ -294,27 +309,27 @@ export default {
loading: false,
fileMaxSize: undefined,
image: false,
imageUrl: ''
imageUrl: '',
uploadName: ''
}
},
methods: {
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
initData (data) {
// 给表格赋值,在线编辑不知道要怎么赋值?
// this.drafterDataSource =
// this.dataSource =
// this.formInline =
this.drafterDataSource = data.otherDraftUserVOS
this.dataSource = data.inspectContents || []
this.formInline = Object.assign({}, data)
// 给表单赋值
// this.$nextTick(() => {
// this.$refs.baseInfoForm.formInline =
// })
this.$nextTick(() => {
this.$refs.baseInfoForm.initData(data)
})
},
// 外层要获取数据
getData () {
// 把数据抛出,在线编辑不知道要不要抛
const data = {}
data.dataSource = this.dataSource
data.formInline = this.formInline
const data = Object.assign({}, this.formInline)
data.inspectContents = this.dataSource || []
return data
},
// 外层获取数据要过校验,返回false表示没有通过校验
@@ -322,10 +337,19 @@ export default {
let data = {}
await this.$refs.ruleForm.validate(valid => {
if (valid) {
if (this.dataSource && this.dataSource.length > 0) {
if (this.formInline.inspectFlag === '1' && this.dataSource && this.dataSource.length > 0) {
if (this.dataSource.map(item => item.rectificationDepartment).every(item => !!item)) {
// 每一个的整改部门都填了
// 有数据可以抛出
data = Object.assign({}, this.formInline)
data.inspectContents = this.dataSource || []
} else {
this.$message.warning(this.$t('pleaseCompleteTableInfo'))
data = false
}
} else if (this.formInline.inspectFlag === '0') {
// 有数据可以抛出
data.dataSource = this.dataSource
data.formInline = this.formInline
data = Object.assign({}, this.formInline)
} else {
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
data = false
@@ -339,7 +363,7 @@ export default {
// 查看企标文本
handleLookUploadStandard (record) {
// 截取文件后缀名
const fileSuffix = record.standardFile_dictText ? record.standardFile_dictText.split('.')[record.standardFile_dictText.split('.').length - 1].toLowerCase() : ''
const fileSuffix = record.fileId_dictText ? record.fileId_dictText.split('.')[record.fileId_dictText.split('.').length - 1].toLowerCase() : ''
const canPreview = CAN_PREVIEW_FILE_SUFFIX.some(tt => fileSuffix.toLowerCase() === tt)
// 判断是否为可预览格式的文件
if (!canPreview) {
@@ -348,10 +372,10 @@ export default {
})
return
}
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${record.standardFile}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${record.standardFile_dictText}`
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${record.fileId}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${record.fileId_dictText}`
// 图片预览,使用自己添加的组件
if (canPreview && FILE_TYPE_IMGS.includes(fileSuffix)) {
this.imageUrl = getFileAccessHttpUrl(record.standardFile)
this.imageUrl = getFileAccessHttpUrl(record.fileId)
// 获取viewer实例
const viewer = this.$el.querySelector('.image').$viewer
// 调用show方法进行显示预览图
@@ -361,22 +385,17 @@ export default {
}
// pdf预览
if (canPreview && FILE_TYPE_PDF.includes(fileSuffix)) {
const url = previewPdf(record.standardFile)
const url = previewPdf(record.fileId)
window.open(url)
return
}
// word用KKfile预览
if (canPreview && (fileSuffix === 'doc' || fileSuffix === 'docx')) {
kkFilePreview(fileFullUrl)
return
}
// 如果都不能预览就下载
downloadFile(`/sys/common/download/${record.standardFile}`, record.standardFile_dictText)
// 其余可预览文件仍使用KKFile进行预览
kkFilePreview(fileFullUrl)
},
// 下载企标文本
handleDownloadUploadStandard (record) {
// 下载文件
downloadFile(`/sys/common/download/${record.standardFile}`, record.standardFile_dictText)
downloadFile(`/sys/common/download/${record.fileId}`, record.fileId_dictText)
},
// 选择用户得到用户名
userSelectNameChange (value, fieldName) {
@@ -384,11 +403,6 @@ export default {
},
// 点击文件上传
clickButtonToUpload (fieldName) {
if (fieldName === 'uploadAttachment') {
this.fileMaxSize = 10
} else {
this.fileMaxSize = undefined
}
this.$refs.uploadFile.open(this.formInline[fieldName])
this.uploadName = fieldName
},
@@ -420,7 +434,13 @@ export default {
},
// 稽查内容的删除
handleDelete (index) {
this.dataSource.splice(index, 1)
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
this.dataSource.splice(index, 1)
}
})
},
// 稽查内容新增编辑完成
checkContentOk (value, index) {
@@ -439,9 +459,10 @@ export default {
<style scoped lang="less">
@import '~@assets/less/common.less';
.collapsible-content-no-head {
border-top: 1px solid #E5E6EB;
border-radius: 8px 8px 8px 8px;
.form-add {
margin-top: 30px;
margin-bottom: 0;
}
.online-edit-wrapper {
@@ -456,6 +477,7 @@ export default {
}
.base-info-inner-title {
width: 100%;
color: #1D2129;
font-size: 16px;
font-weight: 500;