Files
laws-sinotruk-client/src/views/businessSupport/askForAdvice/AskForAdviceDetail.vue
T
2023-12-29 09:42:19 +08:00

342 lines
11 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<internal-detail-page :title="$route.meta.title" :loading="loading">
<template v-slot:titleRightCustom>
<a @click="handleToggle" style="margin-left: 8px">
{{ toggleStatus ? $t('putAway') : $t('open') }}
<a-icon :type="toggleStatus ? 'up' : 'down'" />
</a>
</template>
<div class="detail-page-part-form" v-show="toggleStatus">
<!--标准名称-->
<div class="detail-page-part-form-item">
<label>{{ $t('standardName') }}</label>
<span class="can-click-table-text" @click="toDetailPage">{{ detailFormData.standardNameNumber }}</span>
</div>
<!--附件-->
<div class="detail-page-part-form-item">
<label>{{ $t('businessSupport.questionAnswer.attach') }}</label>
<file-echo :operate-fixed-right="false" :file-ids="detailFormData.standardTextFileId" :can-download="false" />
</div>
<!--流程稿件-->
<div class="detail-page-part-form-item">
<label>{{ $t('businessSupport.askForAdvice.processManuscript') }}</label>
<file-echo :operate-fixed-right="false" :file-ids="detailFormData.relatedFile" :can-download="false" />
</div>
<!--征求意见周期-->
<div class="detail-page-part-form-item">
<label>{{ $t('businessSupport.askForAdvice.consultationCycle') }}</label>
<span>{{ detailFormData.consultationPeriod }}</span>
</div>
</div>
<div class="table-operator">
<!--导出-->
<a-button icon="upload"
type="primary"
ghost
v-has="'askForAdvice:detail:export'"
@click="handleExportXls($t('businessSupport.askForAdvice.detailsOfComments'), '.xlsx')">
{{ $t('export') }}
</a-button>
</div>
<div>
<j-table
ref="table"
size="middle"
:columns="columns"
:data-source="dataSource"
rowKey="id"
:can-drag="true"
:loading="loading"
:pagination="ipagination"
:scroll="{x: '100%'}"
@change="handleTableChange">
<!--修改前修改后修改理由弹框显示内容-->
<template v-slot:modalDetail="{text, record}">
<div class="table-text" @click="showContent(text)" v-if="text">{{ text }}</div>
<div v-else>{{ global.emptyLine }}</div>
</template>
<template v-slot:file="{text}">
<file-echo :file-ids="text" :operate-fixed-right="false" :can-download="false" v-if="text" />
<div v-else>{{ global.emptyLine }}</div>
</template>
</j-table>
</div>
<text-content-modal ref="textContentModal" />
</internal-detail-page>
</template>
<script>
import InternalDetailPage from '../../../components/InternalDetailPage'
import FileEcho from '../../../components/FileEcho'
import { downFile } from '../../../api/manage'
import JTable from '../../../components/jero/JTable'
import { JeroListMixin } from '../../../mixins/JeroListMixin'
import { queryAskForAdviceDetail } from '../../../api/businessSupport'
import { StandardSource } from '../../../enums/commonEnums'
import TextContentModal from './modules/TextContentModal'
export default {
name: 'AskForAdviceDetail',
components: { JTable, FileEcho, InternalDetailPage, TextContentModal },
mixins: [JeroListMixin],
data () {
return {
toggleStatus: true,
disableMixinCreated: true,
loading: false,
columns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{ // 条款号
title: this.$t('workCenter.enStandardRevision.clauseNumber'),
width: 180,
align: 'center',
dataIndex: 'chapterNumber',
scopedSlots: { customRender: 'text' }
},
{ // 条款名称
title: this.$t('docTool.split.clauseName'),
width: 180,
align: 'center',
dataIndex: 'chapterName',
scopedSlots: { customRender: 'text' }
},
{ // 修改意见内容
title: this.$t('workCenter.enStandardChange.revisedOpinionContent'),
children: [
{ // 修改前
title: this.$t('workCenter.enStandardChange.beforeUpdate'),
align: 'center',
width: 180,
dataIndex: 'modificationBefore',
scopedSlots: { customRender: 'modalDetail' }
},
{ // 修改后
title: this.$t('workCenter.enStandardChange.afterUpdate'),
align: 'center',
width: 180,
dataIndex: 'modificationAfter',
scopedSlots: { customRender: 'modalDetail' }
},
{ // 修改理由
title: this.$t('workCenter.enStandardChange.updateReason'),
align: 'center',
width: 180,
dataIndex: 'modificationReason',
scopedSlots: { customRender: 'modalDetail' }
}
]
},
{ // 提出部门
title: this.$t('workCenter.enStandardChange.proposingDepartment'),
align: 'center',
width: 180,
dataIndex: 'depart',
scopedSlots: { customRender: 'text' }
},
{ // 提出人
title: this.$t('workCenter.enStandardChange.introducer'),
align: 'center',
width: 180,
dataIndex: 'designEngineerName',
scopedSlots: { customRender: 'text' }
},
{ // 处理意见
title: this.$t('workCenter.enStandardRevision.handlingSuggestion'),
align: 'center',
width: 180,
dataIndex: 'isAdopt_dictText'
},
// 依据描述
{
dataIndex: 'basisDescription',
title: this.$t('projectLibrary.specialProjectLibrary.basisDescription'),
width: 180
},
// 佐证材料
{
dataIndex: 'basisFile',
title: this.$t('projectLibrary.specialProjectLibrary.supportingMaterial'),
width: 180,
scopedSlots: { customRender: 'file' }
}
],
/* 分页参数 */
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
detailFormData: {} // 上方表单的数据
}
},
created () {
this.initDetailData()
},
methods: {
initDetailData () {
this.loading = true
const params = {
pageNo: this.ipagination.current,
pageSize: this.ipagination.pageSize,
businessId: this.$route.query.id
}
queryAskForAdviceDetail(params).then(res => {
if (res.success) {
// 处理表格数据
const tableResult = res.result.processFbConsultationList
this.dataSource = tableResult.records || []
if (tableResult.total) {
this.ipagination.total = tableResult.total
} else {
this.ipagination.total = 0
}
// 处理表单数据
this.detailFormData = res.result.processFbStandardConsultation || {}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
handleToggle () {
this.toggleStatus = !this.toggleStatus
},
handleExportXls (fileName, fileSuffix = '.xlsx') {
if (!fileName || typeof fileName !== 'string') {
fileName = '导出文件'
}
const param = this.getQueryParams()
param.businessId = this.$route.query.id
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
param.selections = this.selectedRowKeys.join(',')
}
console.log('导出参数', param)
// 加一个大的提示
const modalLoading = this.$info({
title: '提示',
content: <span>正在导出请稍候 <a-spin size="small" /></span>,
keyboard: false
})
// 把知道了这个按钮去掉
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
})
downFile('/laws/consultation/exportExcel', param).then((data) => {
if (!data) {
this.$message.warning('文件下载失败')
return
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + fileSuffix)
} else {
const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', fileName + fileSuffix)
console.log(fileName + fileSuffix)
document.body.appendChild(link)
link.click()
document.body.removeChild(link) // 下载完成移除元素
window.URL.revokeObjectURL(url) // 释放掉blob对象
}
}).finally(() => {
// 销毁这个提示
modalLoading.destroy()
})
},
handleTableChange (pagination, filters, sorter) {
// 分页、排序、筛选变化时触发
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.order ? sorter.field : 'createTime'
this.isorter.order = sorter.order === 'ascend' ? 'asc' : 'desc'
}
this.ipagination = pagination
this.initDetailData()
},
/**
* 跳转标准详情
*/
toDetailPage () {
const source = this.detailFormData.source
const standardId = this.detailFormData.standardId
let path
// 根据来源跳转不同的详情页
switch (source) {
// 国内
case StandardSource.DOMESTIC.value:
path = '/standardRegulationLibrary/DomesticStandardDetail'
break
// 海外
case StandardSource.OVERSEAS.value:
path = '/standardRegulationLibrary/OverseasStandardDetail'
break
// 企标
case StandardSource.ENTERPRISE.value:
path = '/enterpriseStandardLibrary/enterpriseStandardDetail'
break
default:
break
}
if (!path) {
return
}
const query = {
id: standardId
}
this.$openPageNewSheet({
path, query
})
},
showContent (text) {
this.$refs.textContentModal.open(text)
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
.detail-page-part-form {
padding: 0;
}
.detail-page-part-form-item {
width: 100%;
label {
width: 6.5rem;
}
/deep/ .file-info {
font-size: 16px;
}
}
.can-click-table-text {
color: @primary-color !important;
}
</style>