[update] 企标制修订和企标更改流程的在线编辑
This commit is contained in:
@@ -30,9 +30,8 @@
|
||||
</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>
|
||||
<p>{{ $t('enterpriseStandard') }}</p>
|
||||
<a-button type="primary" @click="onlineEditView">{{ $t('workCenter.enStandardRevision.onLineEditing') }}</a-button>
|
||||
</div>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
@@ -45,6 +44,9 @@
|
||||
import BaseInfoForm from './BaseInfoForm'
|
||||
import JTable from '@/components/jero/JTable'
|
||||
import TextContentModal from '../../../businessSupport/askForAdvice/modules/TextContentModal'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { kkFilePreview } from '@/utils/kkFilePreview'
|
||||
|
||||
export default {
|
||||
name: 'ApproveBaseInfo',
|
||||
@@ -137,7 +139,8 @@ export default {
|
||||
}
|
||||
],
|
||||
dataSource: [],
|
||||
loading: false
|
||||
loading: false,
|
||||
onEditFile: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -153,6 +156,7 @@ export default {
|
||||
...item
|
||||
}
|
||||
})
|
||||
this.onEditFile = data.onEditFile
|
||||
// 给表单赋值
|
||||
this.$nextTick(() => {
|
||||
this.$refs.baseInfoForm.initData(data)
|
||||
@@ -172,6 +176,11 @@ export default {
|
||||
// 修改前按钮点击
|
||||
beforeUpdateClick (record) {
|
||||
this.$refs.textContentModal.open(record.beforeUpdate)
|
||||
},
|
||||
// 在线编辑的查看
|
||||
onlineEditView () {
|
||||
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${this.onEditFile}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${this.onEditFile_dictText}`
|
||||
kkFilePreview(fileFullUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,6 +629,7 @@ export default {
|
||||
console.log(value)
|
||||
this.loading = true
|
||||
this.isEditSetData = true
|
||||
this.$emit('listChange', value)
|
||||
// 企标名称
|
||||
this.formInline.standardName = value[0].standardName
|
||||
// 根据返回的id查询企标数据
|
||||
@@ -717,6 +718,20 @@ export default {
|
||||
standard_name: this.formInline.standardName, // 标准名称
|
||||
standard_english_name: this.formInline.standardEnglishName // 标准英文名称
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 校验部分字段
|
||||
* @param fields
|
||||
*/
|
||||
validateFormByFields (fields) {
|
||||
const resultList = []
|
||||
this.$refs.ruleForm.validateField(fields, (error) => {
|
||||
resultList.push(error)
|
||||
})
|
||||
if (resultList.every(tt => !tt)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<base-info-form ref="baseInfoForm" :disabled="disabled" @processNameChange="processNameChange"></base-info-form>
|
||||
<base-info-form ref="baseInfoForm" :disabled="disabled" @processNameChange="processNameChange" @listChange="listChange"></base-info-form>
|
||||
<!-- 标准文本 -->
|
||||
<div class="box-title-text form-flex-item">
|
||||
<div class="title-text">
|
||||
@@ -10,9 +10,8 @@
|
||||
</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>
|
||||
<p>{{ $t('enterpriseStandard') }}</p>
|
||||
<a-button type="primary" @click="toOnlineEditor">{{ $t('workCenter.enStandardRevision.onLineEditing') }}</a-button>
|
||||
</div>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
@@ -257,6 +256,8 @@ import BaseInfoForm from './BaseInfoForm'
|
||||
import JTable from '@/components/jero/JTable'
|
||||
import UpdateListModal from './UpdateListModal'
|
||||
import TextContentModal from '../../../businessSupport/askForAdvice/modules/TextContentModal'
|
||||
import { getEnterpriseStandardInfoById } from '../../../../api/enterpriseStandardLibraryApi'
|
||||
import { onlineEditor } from '../../../../utils/onlyOfficeUtils'
|
||||
|
||||
export default {
|
||||
name: 'MainDrafterInitBaseInfo',
|
||||
@@ -432,12 +433,14 @@ export default {
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
standardCanOnlineEditFile: '', // 标准文件中本身就可以在线预览的文件
|
||||
onEditFile: '' // 在线编辑的文件id
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
||||
initData (data) {
|
||||
async initData (data) {
|
||||
// 给表格赋值,在线编辑不知道要怎么赋值?
|
||||
this.dataSource = data.list.map(item => {
|
||||
const uidGenerator = () => {
|
||||
@@ -448,6 +451,11 @@ export default {
|
||||
...item
|
||||
}
|
||||
})
|
||||
if (!data.onEditFile) {
|
||||
await this.getStandardFile(data.standardId)
|
||||
}
|
||||
// 在线编辑
|
||||
this.onEditFile = data.onEditFile || this.standardCanOnlineEditFile
|
||||
const formInline = {}
|
||||
// 更改级别代号
|
||||
formInline.levelCode = data.levelCode
|
||||
@@ -475,8 +483,43 @@ export default {
|
||||
// 给表单赋值
|
||||
this.$nextTick(() => {
|
||||
this.$refs.baseInfoForm.initData(data)
|
||||
this.onEditFile = data.onEditFile || ''
|
||||
})
|
||||
},
|
||||
// 获取标准本身的文件
|
||||
async getStandardFile (standardId) {
|
||||
await getEnterpriseStandardInfoById({ id: standardId, type: '2' }).then(res => {
|
||||
if (res.success) {
|
||||
// 过程稿件id 发布稿>修改单>报批稿>送审稿>征求意见稿>草稿
|
||||
const fieldArr = ['publish_of_original', 'modification_list', 'draft_for_review', 'draft_for_comment', 'draft']
|
||||
const needSuffixArr = ['doc', 'docx']
|
||||
let fileId = ''
|
||||
for (const item of fieldArr) {
|
||||
if (!fileId) {
|
||||
const fileNameArr = res.result[item + '_dictText'].split(',')
|
||||
for (let i = 0; i < fileNameArr.length; i++) {
|
||||
// 截取文件后缀名
|
||||
const fileSuffix = (fileNameArr[i] ? fileNameArr[i].split('.')[fileNameArr[i].split('.').length - 1] : '').toLowerCase()
|
||||
if (needSuffixArr.includes(fileSuffix)) {
|
||||
// 说明是支持在线编辑的文件格式
|
||||
console.log('支持在线编辑的文件', res.result[item].split(',')[i], res.result[item + '_dictText'].split(',')[i])
|
||||
fileId = res.result[item].split(',')[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.standardCanOnlineEditFile = fileId
|
||||
}
|
||||
})
|
||||
},
|
||||
// 上方表单企标编号修改了
|
||||
async listChange (value) {
|
||||
console.log(value)
|
||||
await this.getStandardFile(value[0].id)
|
||||
// 在线编辑
|
||||
this.onEditFile = this.onEditFile || this.standardCanOnlineEditFile
|
||||
console.log(this.onEditFile)
|
||||
},
|
||||
// 外层要获取数据
|
||||
getData () {
|
||||
// 把数据抛出,在线编辑不知道要不要抛
|
||||
@@ -486,6 +529,7 @@ export default {
|
||||
...this.formInline
|
||||
}
|
||||
data.dataSource = this.dataSource
|
||||
data.onEditFile = this.onEditFile
|
||||
return data
|
||||
},
|
||||
// 外层获取数据要过校验,返回false表示没有通过校验
|
||||
@@ -498,6 +542,7 @@ export default {
|
||||
if (this.dataSource.length > 0) {
|
||||
data.formInline = { ...formInline, ...this.formInline }
|
||||
data.dataSource = this.dataSource
|
||||
data.onEditFile = this.onEditFile
|
||||
} else {
|
||||
this.$message.warning(this.$t('addAtLeastOneRowOfData'))
|
||||
data = false
|
||||
@@ -575,6 +620,20 @@ export default {
|
||||
// 修改前按钮点击
|
||||
beforeUpdateClick (record) {
|
||||
this.$refs.textContentModal.open(record.beforeUpdate)
|
||||
},
|
||||
/**
|
||||
* 跳转在线编辑
|
||||
*/
|
||||
toOnlineEditor () {
|
||||
// 获取参数(用于自动生成封面)
|
||||
const params = this.$refs.baseInfoForm.getOnlineEditorParams()
|
||||
// 校验必填字段(最后一个字段是企标编号)
|
||||
const requiredField = ['implementationDate', 'releaseDate', 'standardName', 'standardNumber']
|
||||
const validateResult = this.$refs.baseInfoForm.validateFormByFields(requiredField)
|
||||
if (validateResult) {
|
||||
console.log(this.onEditFile)
|
||||
onlineEditor(params, this.onEditFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user