| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162 |
- <template>
- <div class="details-container">
- <el-dialog
- :visible.sync="visible"
- :title="dialogTitle"
- width="80%"
- top="5vh"
- :close-on-click-modal="false"
- @close="handleClose"
- >
- <!-- 操作按钮区域 -->
- <div class="btn-group">
- <el-button
- v-for="item in buttonData"
- :key="item.id"
- type="primary"
- plain
- @click="handleAuditPass(item)"
- >
- {{ item.value }}
- </el-button>
- </div>
- <!-- 标签页面 -->
- <template v-if="!isShenhe">
- <el-tabs
- v-model="activeTab"
- type="card"
- class="audit-tabs"
- @tab-click="handleTabClick"
- >
- <el-tab-pane label="报送资料" name="submitData">
- <submit-data
- :id="id"
- :current-node="currentNode"
- :current-status="currentStatus"
- :materials="submitMaterials"
- />
- </el-tab-pane>
- <el-tab-pane label="成本调查表" name="costSurvey">
- <cost-survey
- :current-node="currentNode"
- :current-status="currentStatus"
- :paginated-data="costSurveyPaginated"
- :pagination="costSurveyPagination"
- :audited-unit-id="auditedUnitId"
- :upload-id="''"
- :survey-template-id="''"
- :catalog-id="catalogId"
- :project-id="selectedProject && selectedProject.projectId"
- @handle-page-change="handleCostSurveyPageChange"
- @handle-size-change="handleCostSurveySizeChange"
- @refresh="handleCostSurveyRefresh"
- />
- </el-tab-pane>
- <el-tab-pane
- v-if="currentNode !== 'clcs'"
- label="成本审核"
- name="costAudit"
- >
- <cost-audit
- :id="id"
- :key="costAuditKey"
- ref="costAudit"
- :selected-project="selectedProject"
- :current-node="currentNode"
- :current-status="currentStatus"
- :catalog-id="catalogId"
- :audited-unit-id="auditedUnitId"
- />
- </el-tab-pane>
- <el-tab-pane
- v-if="currentNode !== 'clcs'"
- label="工作底稿"
- name="workDraft"
- >
- <work-draft
- :id="id"
- ref="workDraft"
- :current-node="currentNode"
- :current-status="currentStatus"
- />
- </el-tab-pane>
- <el-tab-pane
- v-if="currentNode !== 'clcs'"
- label="提取资料登记"
- name="extractMaterial"
- >
- <extract-material
- :id="id"
- ref="extractMaterial"
- :current-node="currentNode"
- :current-status="currentStatus"
- />
- </el-tab-pane>
- <el-tab-pane
- v-if="currentNode !== 'clcs' && currentNode !== 'sdsh'"
- label="成本审核意见"
- name="auditOpinion"
- >
- <audit-opinion
- :id="id"
- ref="auditOpinion"
- :key="opinionKey"
- :current-node="currentNode"
- :current-status="currentStatus"
- @refresh="handleAuditOpinionRefresh"
- @close="handleClose"
- />
- </el-tab-pane>
- <el-tab-pane label="消息通知" name="messageNotify">
- <message-notify :id="id" ref="messageNotify" />
- </el-tab-pane>
- </el-tabs>
- </template>
- <!-- 只显示报送资料 -->
- <div v-else class="submit-data-container">
- <submit-data
- :id="id"
- :current-node="currentNode"
- :current-status="currentStatus"
- :materials="submitMaterials"
- />
- </div>
- </el-dialog>
- <!-- 补充材料弹窗 -->
- <el-dialog
- :visible.sync="showSupplementDialog"
- title="补充材料"
- width="500px"
- >
- <div class="dialog-content">
- <div class="form-item">
- <label class="form-label">补充材料:</label>
- <el-input
- v-model="additionalParams.content"
- type="textarea"
- :rows="6"
- placeholder="请输入补充材料"
- maxlength="500"
- show-word-limit
- />
- </div>
- <!-- <div class="form-item">
- <label class="form-label">发送方式:</label>
- <el-checkbox-group v-model="additionalParams.sendType">
- <el-checkbox label="site">站内消息</el-checkbox>
- <el-checkbox label="sms">短信通知</el-checkbox>
- </el-checkbox-group>
- </div> -->
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitSupplement">发送</el-button>
- <el-button @click="showSupplementDialog = false">取消</el-button>
- </div>
- </el-dialog>
- <!-- 中止监审弹窗 -->
- <el-dialog
- :visible.sync="showAbortDialog"
- title="中止监审"
- width="500px"
- :modal="false"
- >
- <div class="dialog-content">
- <div class="form-item">
- <label class="form-label">中止意见:</label>
- <el-input
- v-model="additionalParams.content"
- type="textarea"
- :rows="6"
- placeholder="请输入中止意见"
- maxlength="500"
- show-word-limit
- />
- </div>
- <!-- <div class="form-item">
- <label class="form-label">发送方式:</label>
- <el-checkbox-group v-model="additionalParams.sendType">
- <el-checkbox label="site">站内消息</el-checkbox>
- <el-checkbox label="sms">短信通知</el-checkbox>
- </el-checkbox-group>
- </div> -->
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitAbort">发送</el-button>
- <el-button @click="showAbortDialog = false">取消</el-button>
- </div>
- </el-dialog>
- <!-- 初审退回弹窗 -->
- <el-dialog
- :visible.sync="showRejectDialog"
- :title="dialogTitle + '退回'"
- width="500px"
- >
- <div class="dialog-content">
- <div class="form-item">
- <label class="form-label">退回意见:</label>
- <el-input
- v-model="additionalParams.content"
- type="textarea"
- :rows="6"
- placeholder="请输入退回意见"
- maxlength="500"
- show-word-limit
- />
- </div>
- <!-- <div class="form-item">
- <label class="form-label">发送方式:</label>
- <el-checkbox-group v-model="additionalParams.sendType">
- <el-checkbox label="site">站内消息</el-checkbox>
- <el-checkbox label="sms">短信通知</el-checkbox>
- </el-checkbox-group>
- </div> -->
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitReject">发送</el-button>
- <el-button @click="showRejectDialog = false">取消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import costAudit from './costAudit.vue'
- import costSurvey from './costSurvey.vue'
- import submitData from './submitData.vue'
- import workDraft from './workDraft.vue'
- import extractMaterial from './extractMaterial.vue'
- import auditOpinion from './auditOpinion.vue'
- import messageNotify from './messageNotify.vue'
- import {
- getDataPreliminaryReviewButton,
- doProcessBtn,
- } from '@/api/dataPreliminaryReview'
- import { getTaskRequirementList } from '@/api/auditTaskProcessing'
- import { getSurveyList } from '@/api/audit/survey'
- export default {
- name: 'Details',
- components: {
- costAudit,
- costSurvey,
- submitData,
- workDraft,
- extractMaterial,
- auditOpinion,
- messageNotify,
- },
- props: {
- visible: {
- type: Boolean,
- default: true,
- },
- id: {
- type: [String, Number],
- default: null,
- },
- selectedProject: {
- type: Object,
- default: () => ({}),
- },
- currentNode: {
- type: String,
- default: '',
- },
- currentStatus: {
- type: String,
- default: '',
- },
- // 任务信息(从props传入,替代路由query)
- taskInfo: {
- type: Object,
- default: () => ({}),
- },
- isShenhe: {
- type: Boolean,
- default: false,
- },
- },
- data() {
- return {
- buttonData: [], //资料初审按钮数据
- activeTab: 'submitData', // 默认选中报送资料标签页
- opinionKey: 0, // 用于强制重渲染成本审核意见子组件
- costAuditKey: 0, // 用于强制重渲染成本审核子组件,避免保留上次状态
- // 报送资料数据(从接口获取后下发给子组件)
- submitMaterials: [],
- // 成本调查表数据
- costSurveyAll: [],
- costSurveyPaginated: [],
- costSurveyPagination: { currentPage: 1, pageSize: 10, total: 0 },
- // 弹窗显示状态
- showSupplementDialog: false,
- showAbortDialog: false,
- showRejectDialog: false,
- // 弹窗数据
- additionalParams: {},
- // 当前操作按钮信息
- currentButton: null,
- }
- },
- computed: {
- dialogTitle() {
- // 根据节点类型设置标题
- if (
- this.currentNode === 'sdshenhe' &&
- this.currentStatus === '审核中'
- ) {
- return '审核'
- } else if (
- this.currentNode === 'yjgaozhi' ||
- this.currentNode === 'yjgz'
- ) {
- return '意见告知'
- } else if (this.currentNode === 'clcs') {
- return '资料初审'
- } else if (this.currentNode === 'sdsh') {
- return '成本审核'
- } else if (this.currentNode === 'yjfk') {
- return '意见反馈'
- }
- // 兜底:必须返回一个字符串,避免 eslint 报错
- return '成本审核详情'
- },
- // 从 selectedProject / taskInfo 中派生 auditedUnitId,供模板和子组件使用
- auditedUnitId() {
- return (
- (this.selectedProject &&
- (this.selectedProject.auditedUnitId ||
- this.selectedProject.auditedunitid)) ||
- (this.taskInfo &&
- (this.taskInfo.auditedUnitId || this.taskInfo.auditedunitid)) ||
- ''
- )
- },
- // 从 selectedProject / taskInfo 中派生 catalogId,供模板和查询使用
- catalogId() {
- return (
- (this.selectedProject &&
- (this.selectedProject.catalogId ||
- this.selectedProject.catalogid)) ||
- (this.taskInfo &&
- (this.taskInfo.catalogId || this.taskInfo.catalogid)) ||
- ''
- )
- },
- },
- watch: {
- visible(newVal) {
- // 监听visible变化,弹窗打开时设置标签页并获取按钮数据
- if (newVal && this.id) {
- // 每次打开强制刷新“成本审核意见”子组件,避免保留上次状态
- this.opinionKey++
- // 每次打开强制重建“成本审核”子组件,避免保留上次状态
- this.costAuditKey++
- this.$nextTick(() => {
- // 设置标签页
- this.setActiveTab()
- // 弹窗打开时,无论什么情况都要获取资料初审按钮数据
- this.getPreliminaryReviewButton()
- // 若默认在报送资料页,加载报送资料
- if (this.activeTab === 'submitData') {
- this.loadSubmitMaterials()
- }
- // 若程序设置的活动标签页为“成本审核”,需要主动触发子组件加载版本数据
- if (this.activeTab === 'costAudit') {
- this.$nextTick(() => {
- if (
- this.$refs.costAudit &&
- this.$refs.costAudit.loadFromTaskId
- ) {
- this.$refs.costAudit.loadFromTaskId()
- } else if (
- this.$refs.costAudit &&
- this.$refs.costAudit.getDetail
- ) {
- this.$refs.costAudit.getDetail()
- }
- })
- }
- // 若程序设置的活动标签页为“成本审核意见”,切换过来就调接口刷新
- if (this.activeTab === 'auditOpinion') {
- this.$nextTick(() => {
- if (
- this.$refs.auditOpinion &&
- this.$refs.auditOpinion.getPreliminaryOpinionData
- ) {
- this.$refs.auditOpinion.getPreliminaryOpinionData()
- }
- })
- }
- })
- }
- },
- // 监听currentNode变化,如果弹窗已打开,更新标签页并重新获取按钮数据
- currentNode(newVal, oldVal) {
- if (this.visible && this.id && newVal && newVal !== oldVal) {
- this.$nextTick(() => {
- // 设置标签页
- this.setActiveTab()
- // 重新获取按钮数据
- this.getPreliminaryReviewButton()
- // 如果当前应显示“成本审核”,主动触发加载
- if (this.activeTab === 'costAudit') {
- this.$nextTick(() => {
- if (
- this.$refs.costAudit &&
- this.$refs.costAudit.loadFromTaskId
- ) {
- this.$refs.costAudit.loadFromTaskId()
- } else if (
- this.$refs.costAudit &&
- this.$refs.costAudit.getDetail
- ) {
- this.$refs.costAudit.getDetail()
- }
- })
- }
- // 如果当前应显示“成本审核意见”,主动触发加载
- if (this.activeTab === 'auditOpinion') {
- this.$nextTick(() => {
- if (
- this.$refs.auditOpinion &&
- this.$refs.auditOpinion.getPreliminaryOpinionData
- ) {
- this.$refs.auditOpinion.getPreliminaryOpinionData()
- }
- })
- }
- })
- }
- },
- // 监听currentStatus变化,如果弹窗已打开,更新标签页并重新获取按钮数据
- currentStatus(newVal, oldVal) {
- if (this.visible && this.id && newVal && newVal !== oldVal) {
- this.$nextTick(() => {
- // 设置标签页
- this.setActiveTab()
- // 重新获取按钮数据
- this.getPreliminaryReviewButton()
- })
- }
- },
- // 监听id变化,如果弹窗已打开,重新获取按钮数据
- id(newVal) {
- if (this.visible && newVal) {
- this.$nextTick(() => {
- // 设置标签页
- this.setActiveTab()
- // 获取按钮数据
- this.getPreliminaryReviewButton()
- // 任务变化时,若在报送资料页,刷新报送资料
- if (this.activeTab === 'submitData') {
- this.loadSubmitMaterials()
- }
- // 若当前为成本审核标签,主动加载
- if (this.activeTab === 'costAudit') {
- this.$nextTick(() => {
- if (
- this.$refs.costAudit &&
- this.$refs.costAudit.loadFromTaskId
- ) {
- this.$refs.costAudit.loadFromTaskId()
- } else if (
- this.$refs.costAudit &&
- this.$refs.costAudit.getDetail
- ) {
- this.$refs.costAudit.getDetail()
- }
- })
- }
- // 若当前为成本审核意见标签,主动加载
- if (this.activeTab === 'auditOpinion') {
- this.$nextTick(() => {
- if (
- this.$refs.auditOpinion &&
- this.$refs.auditOpinion.getPreliminaryOpinionData
- ) {
- this.$refs.auditOpinion.getPreliminaryOpinionData()
- }
- })
- }
- })
- }
- },
- },
- mounted() {
- // 设置标签页
- this.setActiveTab()
- // 如果组件挂载时弹窗已打开且有id,也要获取按钮数据
- if (this.visible && this.id) {
- this.$nextTick(() => {
- // 弹窗打开时,无论什么情况都要获取资料初审按钮数据
- this.getPreliminaryReviewButton()
- if (this.activeTab === 'submitData') {
- this.loadSubmitMaterials()
- }
- // 如果默认即处于成本审核页签,也要主动触发加载
- if (this.activeTab === 'costAudit') {
- this.$nextTick(() => {
- if (this.$refs.costAudit && this.$refs.costAudit.loadFromTaskId) {
- this.$refs.costAudit.loadFromTaskId()
- } else if (
- this.$refs.costAudit &&
- this.$refs.costAudit.getDetail
- ) {
- this.$refs.costAudit.getDetail()
- }
- })
- }
- // 如果默认即处于成本审核意见页签,也要主动触发加载
- if (this.activeTab === 'auditOpinion') {
- this.$nextTick(() => {
- if (
- this.$refs.auditOpinion &&
- this.$refs.auditOpinion.getPreliminaryOpinionData
- ) {
- this.$refs.auditOpinion.getPreliminaryOpinionData()
- }
- })
- }
- })
- }
- },
- methods: {
- // 根据 currentNode 和 currentStatus 设置活动标签页
- setActiveTab() {
- if (this.currentNode === 'sdsh' && this.currentStatus === '审核中') {
- this.activeTab = 'costAudit'
- } else if (this.currentNode === 'clcs') {
- // 如果 currentNode 是 'clcs',显示成本调查表标签页
- this.activeTab = 'submitData'
- } else if (
- this.currentNode === 'yjgaozhi' ||
- this.currentNode === 'yjfk'
- ) {
- // 如果 currentNode 是 'yjgaozhi',显示意见告知标签页(成本审核意见)
- this.activeTab = 'auditOpinion'
- } else {
- // 其他情况默认显示报送资料标签页
- this.activeTab = 'submitData'
- }
- },
- // 获取资料初审按钮
- async getPreliminaryReviewButton() {
- // 直接从 props 获取 currentNode,确保是最新的值
- const currentNode = this.currentNode
- // 构建参数对象
- const params = {
- taskId: this.id,
- }
- // 只有当 currentNode 有值时才添加 processNodeKey
- if (currentNode && currentNode.trim() !== '') {
- params.processNodeKey = currentNode === 'ccls' ? 'clcs' : currentNode
- }
- try {
- const response = await getDataPreliminaryReviewButton(params)
- this.buttonData = response.value || []
- } catch (error) {
- this.buttonData = []
- }
- },
- handleClose() {
- // 关闭弹窗时触发事件
- this.$emit('update:visible', false)
- this.$emit('close')
- },
- // 处理审核意见保存成功后的刷新(透传payload)
- handleAuditOpinionRefresh(payload) {
- // 触发父组件刷新列表,透传重置页码标记
- this.$emit('refresh', payload)
- },
- open() {
- // 打开弹窗方法,供父组件通过ref调用
- this.$emit('update:visible', true)
- },
- // 成本调查表审核成功后刷新列表
- handleCostSurveyRefresh() {
- this.loadCostSurveyList()
- },
- handleTabClick(tab) {
- if (tab && tab.name === 'submitData' && this.id) {
- this.loadSubmitMaterials()
- }
- if (tab && tab.name === 'costSurvey' && this.id) {
- // 加载成本调查表列表
- console.log(122)
- this.loadCostSurveyList()
- }
- if (tab && tab.name === 'costAudit' && this.id) {
- // 加载成本审核列表
- this.$nextTick(() => {
- if (this.$refs.costAudit && this.$refs.costAudit.loadFromTaskId) {
- this.$refs.costAudit.loadFromTaskId()
- } else if (this.$refs.costAudit && this.$refs.costAudit.getDetail) {
- this.$refs.costAudit.getDetail()
- }
- })
- }
- if (tab && tab.name === 'auditOpinion' && this.id) {
- // 切换到成本审核意见时,立即调接口刷新
- this.$nextTick(() => {
- if (
- this.$refs.auditOpinion &&
- this.$refs.auditOpinion.getPreliminaryOpinionData
- ) {
- this.$refs.auditOpinion.getPreliminaryOpinionData()
- }
- })
- }
- if (tab && tab.name === 'workDraft' && this.id) {
- // 切换到工作底稿时,主动刷新(走接口)
- this.$nextTick(() => {
- if (this.$refs.workDraft) {
- if (this.$refs.workDraft.getWorkingPaperRecords) {
- this.$refs.workDraft.getWorkingPaperRecords()
- }
- if (this.$refs.workDraft.getWorkingPaperContent) {
- this.$refs.workDraft.getWorkingPaperContent()
- }
- }
- })
- }
- if (tab && tab.name === 'extractMaterial' && this.id) {
- // 切换到提取材料登记时,主动刷新(走接口)
- this.$nextTick(() => {
- if (
- this.$refs.extractMaterial &&
- this.$refs.extractMaterial.getExtractMaterials
- ) {
- this.$refs.extractMaterial.getExtractMaterials()
- }
- })
- }
- if (tab && tab.name === 'messageNotify' && this.id) {
- // 切换到消息通知时,主动刷新(走接口)
- this.$nextTick(() => {
- if (
- this.$refs.messageNotify &&
- this.$refs.messageNotify.getNoticeList
- ) {
- this.$refs.messageNotify.internalPagination.currentPage = 1
- this.$refs.messageNotify.getNoticeList()
- }
- })
- }
- },
- async loadSubmitMaterials() {
- try {
- const resp = await getTaskRequirementList(this.id)
- const list = resp?.value || resp?.data || resp || []
- this.submitMaterials = Array.isArray(list) ? list : []
- } catch (e) {
- this.submitMaterials = []
- }
- },
- // 加载“成本调查表”列表:使用 getSurveyList 接口(从父组件传入的 catalogId/auditedUnitId)
- async loadCostSurveyList() {
- console.log(this.taskInfo, '这行数据')
- try {
- const params = {
- taskId: this.taskInfo.taskId,
- pageNum: this.costSurveyPagination.currentPage,
- pageSize: this.costSurveyPagination.pageSize,
- type: 1,
- }
- console.log('[CostSurvey] call getSurveyList with:', params)
- const resp = await getSurveyList(params)
- // 兼容不同返回结构
- const raw =
- (resp &&
- ((resp.value && (resp.value.records || resp.value)) ||
- resp.data ||
- resp)) ||
- []
- const list = Array.isArray(raw)
- ? raw
- : Array.isArray(raw.records)
- ? raw.records
- : []
- const rows = list.map((it) => {
- const t = String(it.templateType || it.templatetype || '')
- const tableType =
- t === '1'
- ? '单记录'
- : t === '2'
- ? '固定表'
- : t === '3'
- ? '动态表'
- : ''
- return {
- id: it.uploadId || it.id || '',
- name: it.surveyTemplateName,
- dataType: it.dataType || '预置模板',
- tableType,
- isRequired: String(it.isRequired) === '1' ? '是' : '否',
- isUploaded: String(it.isUpload) === '1' || it.isUpload === true,
- uploadId: it.uploadId || it.id || '',
- surveyTemplateId: it.templateId || it.surveyTemplateId || '',
- catalogId: it.catalogId || this.catalogId || '',
- auditedUnitId: it.auditedUnitId || this.auditedUnitId || '',
- tableItems: it.tableItems || [],
- dynamicTableData: it.dynamicTableData || [],
- auditedStatus: it.auditedStatus,
- }
- })
- console.log(
- '[CostSurvey] mapped rows from getSurveyList:',
- rows.length,
- rows
- )
- this.costSurveyAll = rows
- this.costSurveyPagination.total = rows.length
- this.costSurveyPagination.currentPage = 1
- this.paginateCostSurvey()
- } catch (e) {
- console.error('[CostSurvey] loadCostSurveyList error:', e)
- this.costSurveyAll = []
- this.costSurveyPagination = { currentPage: 1, pageSize: 10, total: 0 }
- this.costSurveyPaginated = []
- }
- },
- paginateCostSurvey() {
- const { currentPage, pageSize } = this.costSurveyPagination
- const start = (currentPage - 1) * pageSize
- const end = start + pageSize
- this.costSurveyPaginated = this.costSurveyAll.slice(start, end)
- },
- handleCostSurveyPageChange(page) {
- this.costSurveyPagination.currentPage = page
- this.paginateCostSurvey()
- },
- handleCostSurveySizeChange(size) {
- this.costSurveyPagination.pageSize = size
- this.costSurveyPagination.currentPage = 1
- this.paginateCostSurvey()
- },
- // 处理审核操作按钮点击
- async handleAuditPass(item) {
- this.additionalParams = {
- content: '',
- // sendType: [], // 默认选中站内消息和短信通知
- }
- this.currentButton = item // 保存当前按钮信息
- console.log('点击的按钮数据:', item)
- // “通过”按钮:校验报送资料/成本调查表是否存在【已上传】但【未审核】的数据
- if (this.isPassAction(item)) {
- const ok = await this.validateAllUploadedAudited()
- if (!ok) return
- }
- const key = Number(item.key)
- if (key === 1) {
- this.showSupplementDialog = true
- } else if (key === 2) {
- // 中止监审
- this.showAbortDialog = true
- } else if (key === 4) {
- // 初审退回
- this.showRejectDialog = true
- } else {
- // 添加确认对话框
- this.$confirm(
- `确定要执行"${this.currentButton.value}"操作吗?`,
- '操作确认',
- {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- }
- )
- .then(() => {
- this.executeAuditOperation()
- })
- .catch(() => {
- // 用户取消操作
- this.$message.info('已取消操作')
- })
- }
- },
- // 是否“通过”类操作(按钮文案包含“通过”时触发校验)
- isPassAction(item) {
- const text = (item && (item.value || item.label || '')) || ''
- return String(text).includes('通过')
- },
- // 校验:报送资料/成本调查表中是否存在【已上传】但【未审核】的数据
- async validateAllUploadedAudited() {
- try {
- // 确保两边数据都是最新的
- await Promise.all([
- this.loadSubmitMaterials(),
- this.loadCostSurveyList(),
- ])
- // 同步刷新相关 tab 数据,避免因为未切换到页签导致 refs 数据为空
- await this.validateRequiredTabDataBeforePass({ refreshOnly: true })
- // 1) 报送资料:接口字段通常是 isUpload: '1'/'0'
- const submitPending = (this.submitMaterials || []).filter((it) => {
- const uploaded = String(it && it.isUpload) === '1'
- const pending =
- !it.auditedStatus || String(it.auditedStatus) === '0'
- return uploaded && pending
- })
- if (submitPending.length > 0) {
- const names = submitPending
- .slice(0, 5)
- .map(
- (it) =>
- it.informationName ||
- it.name ||
- it.informationTitle ||
- '未命名资料'
- )
- .join('、')
- this.$message.warning(
- `报送资料中存在已上传但未审核的数据:${names}${
- submitPending.length > 5 ? ' 等' : ''
- },请先完成审核后再执行“通过”。`
- )
- return false
- }
- // 2) 成本调查表:本页映射字段为 isUploaded(boolean) / auditedStatus
- const surveyPending = (this.costSurveyAll || []).filter((it) => {
- const uploaded = it && it.isUploaded === true
- const pending =
- !it.auditedStatus || String(it.auditedStatus) === '0'
- return uploaded && pending
- })
- if (surveyPending.length > 0) {
- const names = surveyPending
- .slice(0, 5)
- .map((it) => it.name || it.surveyTemplateName || '未命名调查表')
- .join('、')
- this.$message.warning(
- `成本调查表中存在已上传但未审核的数据:${names}${
- surveyPending.length > 5 ? ' 等' : ''
- },请先完成审核后再执行“通过”。`
- )
- return false
- }
- // 3) 通过前置校验:成本审核模板/工作底稿在线编辑/提取资料登记
- const okTabs = await this.validateRequiredTabDataBeforePass({
- refreshOnly: false,
- })
- if (!okTabs) return false
- return true
- } catch (e) {
- // 若校验过程中接口失败,保守起见不允许通过
- this.$message.error('校验未审核数据失败,请稍后重试')
- return false
- }
- },
- // “通过”前置校验:
- // 1) 成本审核:必须已生成模板(至少有模板ID/表头)
- // 2) 工作底稿:在线编辑内容或核增核减记录至少存在其一
- // 3) 提取资料登记:列表至少一条
- // refreshOnly=true 时仅刷新子组件数据,不弹提示、不做拦截
- async validateRequiredTabDataBeforePass({ refreshOnly } = {}) {
- try {
- // 仅当对应 tab 存在时才检查(clcs 阶段不显示这些 tab)
- const hasAuditTabs =
- this.currentNode !== 'clcs' && this.currentNode !== ''
- if (!hasAuditTabs) return true
- // 先尽可能刷新数据
- const tasks = []
- if (this.$refs.costAudit) {
- if (typeof this.$refs.costAudit.getDetail === 'function') {
- tasks.push(this.$refs.costAudit.getDetail())
- } else if (
- typeof this.$refs.costAudit.loadFromTaskId === 'function'
- ) {
- tasks.push(this.$refs.costAudit.loadFromTaskId())
- }
- }
- if (this.$refs.workDraft) {
- if (
- typeof this.$refs.workDraft.getWorkingPaperContent === 'function'
- ) {
- tasks.push(this.$refs.workDraft.getWorkingPaperContent())
- }
- if (
- typeof this.$refs.workDraft.getWorkingPaperRecords === 'function'
- ) {
- tasks.push(this.$refs.workDraft.getWorkingPaperRecords())
- }
- }
- if (this.$refs.extractMaterial) {
- if (
- typeof this.$refs.extractMaterial.getExtractMaterials ===
- 'function'
- ) {
- tasks.push(this.$refs.extractMaterial.getExtractMaterials())
- }
- }
- if (tasks.length) {
- try {
- await Promise.all(tasks)
- } catch (e) {
- // ignore: 由后续判断兜底
- }
- }
- if (refreshOnly) return true
- // -------- 1) 成本审核:必须已生成模板 --------
- if (this.$refs.costAudit) {
- const ca = this.$refs.costAudit
- const tplId =
- (ca.auditForm &&
- (ca.auditForm.surveyTemplateId ||
- ca.auditForm.dataTable ||
- ca.auditForm.historyTemplate)) ||
- ''
- const hasHeaders =
- (Array.isArray(ca.tableHeadersRes) &&
- ca.tableHeadersRes.length > 0) ||
- (Array.isArray(ca.costAuditcolumn) &&
- ca.costAuditcolumn.length > 0)
- if (!tplId || !hasHeaders) {
- this.$message.warning(
- '【成本审核】未生成核定表模板,请先生成模板后再执行“通过”。'
- )
- return false
- }
- }
- // -------- 2) 工作底稿:在线编辑内容/记录至少一项有数据 --------
- if (this.$refs.workDraft) {
- const wd = this.$refs.workDraft
- const content = (wd.workingPaperContent || '').trim()
- const records = Array.isArray(wd.workingPaperRecords)
- ? wd.workingPaperRecords
- : []
- if (!content && records.length === 0) {
- this.$message.warning(
- '【工作底稿】在线编辑内容为空且核增核减记录为空,请先录入后再执行“通过”。'
- )
- return false
- }
- }
- // -------- 3) 提取资料登记:列表至少一条 --------
- if (this.$refs.extractMaterial) {
- const em = this.$refs.extractMaterial
- const list = Array.isArray(em.extractMaterials)
- ? em.extractMaterials
- : []
- if (list.length === 0) {
- this.$message.warning(
- '【提取资料登记】暂无数据,请先添加提取资料后再执行“通过”。'
- )
- return false
- }
- }
- return true
- } catch (e) {
- if (!refreshOnly) {
- this.$message.error(
- '校验工作底稿/提取资料/成本审核模板失败,请稍后重试'
- )
- }
- return false
- }
- },
- // 执行审核操作
- async executeAuditOperation() {
- if (!this.id) {
- this.$message.error('缺少任务ID')
- return
- }
- if (!this.currentButton) {
- this.$message.error('操作失败:缺少按钮信息')
- return
- }
- try {
- const params = {
- taskId: this.id,
- processNodeKey: this.currentNode,
- key: this.currentButton.key,
- // sendType: this.additionalParams.sendType?.join(','),
- content: this.additionalParams.content,
- }
- const response = await doProcessBtn(params)
- console.log('操作结果:', response)
- if (response && response.code === 200) {
- this.$message.success(response.value)
- // 关闭所有弹窗
- this.showSupplementDialog = false
- this.showAbortDialog = false
- this.showRejectDialog = false
- // 关闭主弹窗
- this.handleClose()
- // 触发父组件刷新列表
- this.$emit('refresh')
- }
- } catch (error) {
- this.$message.error(this.project.currentNodeName + '驳回')
- }
- },
- // 提交补充材料
- submitSupplement() {
- if (
- !this.additionalParams.content ||
- !this.additionalParams.content.trim()
- ) {
- this.$message.error('请输入补充材料')
- return
- }
- if (this.currentButton) {
- this.executeAuditOperation(this.currentButton)
- } else {
- this.$message.error('操作失败:缺少按钮信息')
- }
- },
- // 提交中止监审
- submitAbort() {
- if (
- !this.additionalParams.content ||
- !this.additionalParams.content.trim()
- ) {
- this.$message.error('请输入中止意见')
- return
- }
- if (this.currentButton) {
- this.executeAuditOperation(this.currentButton)
- } else {
- this.$message.error('操作失败:缺少按钮信息')
- }
- },
- // 提交初审退回
- submitReject() {
- if (
- !this.additionalParams.content ||
- !this.additionalParams.content.trim()
- ) {
- this.$message.error('请输入退回意见')
- return
- }
- if (this.currentButton) {
- this.executeAuditOperation(this.currentButton)
- } else {
- this.$message.error('操作失败:缺少按钮信息')
- }
- },
- },
- }
- </script>
- <style scoped>
- .btn-group {
- /* margin-bottom: 20px;
- margin-left: 20px; */
- }
- .btn-group .el-button {
- margin-right: 10px;
- }
- .details-container {
- width: 100%;
- height: 100%;
- }
- .audit-tabs {
- height: calc(100vh - 150px);
- }
- .audit-tabs .el-tabs__header {
- margin-bottom: 0;
- padding: 15px 15px 0;
- background: #f5f7fa;
- border-bottom: 1px solid #ebeef5;
- }
- .audit-tabs .el-tabs__nav-wrap {
- padding-bottom: 10px;
- }
- .audit-tabs .el-tabs__content {
- height: calc(100% - 60px);
- padding: 15px;
- overflow-y: auto;
- }
- .audit-tabs .el-tab-pane {
- height: 100%;
- }
- /* 弹窗样式 */
- .dialog-content {
- padding: 10px 0;
- }
- .form-item {
- display: flex;
- align-items: flex-start;
- margin-bottom: 20px;
- }
- .form-label {
- display: inline-block;
- width: 100px;
- text-align: center;
- color: #606266;
- vertical-align: top;
- flex-shrink: 0;
- }
- .form-item .el-checkbox-group {
- display: inline-block;
- margin-left: 10px;
- }
- .form-item .el-checkbox {
- margin-right: 20px;
- vertical-align: middle;
- }
- .form-item .el-input,
- .form-item .el-textarea {
- flex: 1;
- }
- .form-item .el-input__inner {
- width: 100%;
- margin-left: 0;
- }
- ::v-deep .el-dialog__body {
- max-height: 720px;
- overflow: auto;
- }
- ::v-deep .el-tabs > .el-tabs__content {
- padding: 20px 0;
- }
- ::v-deep .el-dialog__footer {
- text-align: right;
- }
- </style>
|