update 在线编辑调试

This commit is contained in:
赵霄
2024-01-23 16:47:14 +08:00
parent 5b91dbab19
commit f2bcb2ad89
4 changed files with 41 additions and 31 deletions
+4 -1
View File
@@ -644,5 +644,8 @@ module.exports = {
// 首页
dashboard,
// 工作中心
workCenter
workCenter,
onlineEditor: {
missRequireField: '缺少必填字段'
}
}
+14 -22
View File
@@ -50,28 +50,12 @@ const getEmptyFileTemplate = (params) => {
* @param fileId 文件id,有的话是编辑,没有是新增
*/
export const onlineEditor = async (params, fileId) => {
let fileInfo = {
'id': '1749318391395676161',
'standId': null,
'userId': null,
'mesg': null,
'taskInfo': null,
'taskId': 'task_2442bc43',
'fileName': 'Q/JC 40004-2023 ldq流程新建完整字段企标计划.docx',
'createTime': '2024-01-22 14:29:39',
'updateTime': null,
'editStatus': null,
'editFilePath': 'model/task_2442bc43/task_2442bc43_top_2442bc43_node.docx',
'editType': null,
'delFlag': '0',
'downLoadUrl': null,
'pid': 'top_2442bc43'
}
let fileInfo
if (fileId) {
fileInfo = await queryFileInfo(fileId)
} else {
const param = {
model: `${params.standard_name}` // 处理文件名
model: `${params.standard_number} ${params.standard_name}` // 处理文件名
}
fileInfo = await getEmptyFileTemplate(param)
}
@@ -82,9 +66,17 @@ export const onlineEditor = async (params, fileId) => {
const userInfo = Vue.ls.get(USER_INFO)
// 截取文件后缀名
const fileSuffix = (fileInfo.fileName ? fileInfo.fileName.split('.')[fileInfo.fileName.split('.').length - 1] : '').toLowerCase()
// 处理文件路径
// const filePathArr = fileInfo.editFilePath.split('/')
// const filePath = filePathArr[0] + '/' + filePathArr[1] + '/'
const url = `${window._CONFIG.onlyOfficeUrl}/editor?filePath=${fileInfo.editFilePath}&fileName=${fileInfo.fileName}&fileType=${fileSuffix}&fileId=${fileInfo.id}&key=${fileInfo.id}&userId=${userInfo.id}&userName=${userInfo.realname}`
// Q/ZZ 部分截取
const standardNumberPrefix = params.standard_number.split(' ')[0]
const businessParams = {
standCode: params.standard_number,
dtqbbhbuss: params.substitute_standard_number,
standName: params.standard_name,
standEnName: params.standard_english_name,
issueTime: params.release_date,
putTime: params.implementation_date,
standardNumberPrefix: standardNumberPrefix
}
const url = `${window._CONFIG.onlyOfficeUrl}/editor?filePath=${fileInfo.editFilePath}&fileName=${fileInfo.fileName}&fileType=${fileSuffix}&fileId=${fileInfo.id}&key=${fileInfo.id}&userId=${userInfo.id}&userName=${userInfo.realname}&business=${JSON.stringify(businessParams)}`
window.open(url, '_blank')
}
@@ -35,7 +35,7 @@
:standard-number="formInline.standard_number"
:searchParam="{projectStatus: 1}"
@listChange="listChange"
:disabled="disabled"/>
:disabled="disabled" />
</a-form-model-item>
</div>
<!--
@@ -201,6 +201,7 @@ import StandardSelection from '@/components/selection/StandardSelection'
import UploadFile from '@/components/UploadFile'
import EnterprisePlanSelection from '@/components/selection/EnterprisePlanSelection'
import TreeSelection from '@/components/selection/TreeSelection'
import error from '../../../result/Error'
export default {
name: 'BaseInfoForm',
@@ -680,6 +681,20 @@ export default {
standard_name: this.formInline.standard_name, // 标准名称
standard_english_name: this.formInline.standard_english_name // 标准英文名称
}
},
/**
* 校验部分字段
* @param fields
*/
validateFormByFields (fields) {
const resultList = []
this.$refs.ruleForm.validateField(fields, (error) => {
resultList.push(error)
})
if (resultList.every(tt => !tt)) {
return true
}
return false
}
}
}
@@ -206,14 +206,14 @@ export default {
* 跳转在线编辑
*/
toOnlineEditor () {
// 获取参数(用于自动生成封面,企标编号、代替标准号、发布日期、实施日期、企标名称
// const params = this.$refs.baseInfoForm.getOnlineEditorParams()
// 第一个参数type:如果之前没有文件,就是add,否则是edit
const params = {
standard_number: 'Q/JC 40004-2023',
standard_name: 'ldq流程新建完整字段企标计划'
// 获取参数(用于自动生成封面)
const params = this.$refs.baseInfoForm.getOnlineEditorParams()
// 校验必填字段(最后一个字段是企标编号)
const requiredField = ['implementation_date', 'release_date', 'standard_name', 'standard_number', 'espId']
const validateResult = this.$refs.baseInfoForm.validateFormByFields(requiredField)
if (validateResult) {
onlineEditor(params)
}
onlineEditor(params)
}
}
}