Merge remote-tracking branch 'origin/thirdStage' into thirdStage

This commit is contained in:
赵霄
2024-01-12 15:04:16 +08:00
2 changed files with 45 additions and 16 deletions
@@ -527,18 +527,16 @@ export default {
}, },
// 新增修改单 // 新增修改单
handleAdd () { handleAdd () {
// 不知道左侧要预览哪个文件 const standardId = this.$refs.baseInfoForm.formInline.standardId || ''
const file = ''
this.$refs.updateListModal.title = this.$t('newlyAdded') this.$refs.updateListModal.title = this.$t('newlyAdded')
this.$refs.updateListModal.add(file) this.$refs.updateListModal.add(standardId)
}, },
// 修改单的编辑 // 修改单的编辑
handleEdit (record, index) { handleEdit (record, index) {
// 不知道左侧要预览哪个文件 const standardId = this.$refs.baseInfoForm.formInline.standardId || ''
const file = ''
this.$refs.updateListModal.title = this.$t('edit') this.$refs.updateListModal.title = this.$t('edit')
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
this.$refs.updateListModal.edit(file, record, dataIndex) this.$refs.updateListModal.edit(standardId, record, dataIndex)
}, },
// 修改单的删除 // 修改单的删除
handleDelete (index) { handleDelete (index) {
@@ -10,8 +10,10 @@
<div class="content"> <div class="content">
<!-- 左侧文件预览 --> <!-- 左侧文件预览 -->
<div class="content-left"> <div class="content-left">
<iframe v-if="iframeSrc" :src="iframeSrc" width="100%" frameborder="0"></iframe> <a-spin :spinning="leftLoading" class="left-spin">
<a-empty class="empty-file" v-else description="当前文件类型暂不支持预览"></a-empty> <iframe v-if="iframeSrc" :src="iframeSrc" width="100%" frameborder="0"></iframe>
<a-empty class="empty-file" v-else description="当前文件类型暂不支持预览"></a-empty>
</a-spin>
</div> </div>
<!-- 右侧表单区域 --> <!-- 右侧表单区域 -->
<div class="content-right"> <div class="content-right">
@@ -81,6 +83,7 @@ import { getFileInfo } from '@/api/api'
import { previewPdf } from '@/utils/previewPdf' import { previewPdf } from '@/utils/previewPdf'
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getEnterpriseStandardInfoById } from '@/api/enterpriseStandardLibraryApi'
const Base64 = require('js-base64').Base64 const Base64 = require('js-base64').Base64
@@ -90,6 +93,7 @@ export default {
return { return {
title: '', title: '',
visible: false, visible: false,
leftLoading: true,
confirmLoading: false, confirmLoading: false,
form: this.$form.createForm(this), form: this.$form.createForm(this),
model: {}, model: {},
@@ -144,18 +148,14 @@ export default {
} }
}, },
methods: { methods: {
add (file) { add (standardId) {
this.getFileInfo(file).then(res => { this.getStandardFile(standardId)
this.handlePreview(res)
})
this.isAdd = true this.isAdd = true
this.visible = true this.visible = true
this.form.resetFields() this.form.resetFields()
}, },
edit (file, record, index) { edit (standardId, record, index) {
this.getFileInfo(file).then(res => { this.getStandardFile(standardId)
this.handlePreview(res)
})
this.visible = true this.visible = true
this.index = index this.index = index
this.form.resetFields() this.form.resetFields()
@@ -164,6 +164,31 @@ export default {
this.form.setFieldsValue(pick(this.model, 'clauseNumber', 'clauseName', 'beforeUpdate', 'afterUpdate', 'updateReason')) this.form.setFieldsValue(pick(this.model, 'clauseNumber', 'clauseName', 'beforeUpdate', 'afterUpdate', 'updateReason'))
}) })
}, },
// 根据企标id查询标准详情数据,为了获取发布稿,修改单左侧预览
getStandardFile (standardId) {
if (!standardId) {
return
}
this.leftLoading = true
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']
let fileId = ''
for (const item of fieldArr) {
if (!fileId) {
fileId = res.result[item] ? res.result[item].split(',')[0] : ''
}
}
if (fileId)
this.getFileInfo(fileId).then(res => {
this.handlePreview(res)
})
}
}).finally(() => {
this.leftLoading = false
})
},
getFileInfo (fileId) { getFileInfo (fileId) {
return new Promise(resolve => { return new Promise(resolve => {
let fileInfo let fileInfo
@@ -240,6 +265,12 @@ export default {
width: 60%; width: 60%;
height: 100%; height: 100%;
overflow-y: scroll; overflow-y: scroll;
.left-spin {
height: 100%;
}
/deep/ .ant-spin-container {
height: 100%;
}
iframe { iframe {
height: calc(100% - 20px) !important; height: calc(100% - 20px) !important;
} }