|
|
@@ -83,13 +83,28 @@
|
|
|
>
|
|
|
保存核定模版
|
|
|
</el-button>
|
|
|
- <el-button type="primary" size="small" @click="handleExportTemplate">
|
|
|
+ <el-button
|
|
|
+ v-if="showButtons"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleExportTemplate"
|
|
|
+ >
|
|
|
导出模版
|
|
|
</el-button>
|
|
|
- <el-button type="primary" size="small" @click="handleImportData">
|
|
|
+ <el-button
|
|
|
+ v-if="showButtons"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleImportData"
|
|
|
+ >
|
|
|
导入数据
|
|
|
</el-button>
|
|
|
- <el-button type="primary" size="small" @click="handleSaveData">
|
|
|
+ <el-button
|
|
|
+ v-if="showButtons"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleSaveData"
|
|
|
+ >
|
|
|
保存核定数据
|
|
|
</el-button>
|
|
|
</div>
|
|
|
@@ -298,6 +313,7 @@
|
|
|
getCostFormVersionsByTemplateId,
|
|
|
getCostVerifyTemplateDetailByTaskId,
|
|
|
batchSaveOrUpdate,
|
|
|
+ getCostVerifyTemplate,
|
|
|
} from '@/api/costFormManage'
|
|
|
import {
|
|
|
getlistBySurveyTemplateId,
|
|
|
@@ -391,6 +407,8 @@
|
|
|
dictCache: {},
|
|
|
// 生成核定表时的加载状态
|
|
|
loading: false,
|
|
|
+ // 控制按钮显示的标志
|
|
|
+ showButtons: false,
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -433,10 +451,14 @@
|
|
|
mounted() {
|
|
|
// 进入页签时,不论是否已有ID,都尝试解析并加载一次
|
|
|
this.getDetail()
|
|
|
+ // 检查按钮显示权限
|
|
|
+ this.checkButtonVisibility()
|
|
|
},
|
|
|
activated() {
|
|
|
// keep-alive 场景下,激活时同样尝试解析并加载
|
|
|
this.getDetail()
|
|
|
+ // 检查按钮显示权限
|
|
|
+ this.checkButtonVisibility()
|
|
|
},
|
|
|
methods: {
|
|
|
// 尝试从多来源解析模板ID
|
|
|
@@ -1318,12 +1340,14 @@
|
|
|
itemsList: splitData,
|
|
|
}
|
|
|
batchSaveOrUpdate(data)
|
|
|
- .then((data) => {
|
|
|
+ .then(async (data) => {
|
|
|
// 关闭加载状态
|
|
|
this.$loading().close()
|
|
|
if (type != 'delete') {
|
|
|
this.$message.success('保存成功')
|
|
|
this.loadTemplateData()
|
|
|
+ // 保存成功后重新检查按钮显示权限
|
|
|
+ await this.checkButtonVisibility()
|
|
|
}
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
@@ -1650,6 +1674,7 @@
|
|
|
|
|
|
downloadTemplate(params)
|
|
|
.then((res) => {
|
|
|
+ console.log('downloadTemplate res:', res)
|
|
|
const headers = (res && res.headers) || {}
|
|
|
const contentDisposition =
|
|
|
headers['content-disposition'] || headers['Content-Disposition']
|
|
|
@@ -2093,6 +2118,26 @@
|
|
|
if (t === 'year') return fmt || 'yyyy'
|
|
|
return fmt || 'yyyy-MM-dd'
|
|
|
},
|
|
|
+ // 检查按钮显示权限
|
|
|
+ async checkButtonVisibility() {
|
|
|
+ try {
|
|
|
+ const taskId =
|
|
|
+ (this.selectedProject && this.selectedProject.taskId) ||
|
|
|
+ this.id ||
|
|
|
+ ''
|
|
|
+ if (!taskId) {
|
|
|
+ this.showButtons = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const response = await getCostVerifyTemplate({ taskId })
|
|
|
+ console.log('response', response)
|
|
|
+ // 根据接口返回值设置按钮显示状态
|
|
|
+ this.showButtons = !!(response && response.value)
|
|
|
+ } catch (error) {
|
|
|
+ console.error('检查按钮显示权限失败:', error)
|
|
|
+ this.showButtons = false
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|