fix : 列表按钮加权限

This commit is contained in:
2024-06-10 23:01:28 +08:00
parent 3e6c82dd19
commit 050c5cf57a
4 changed files with 38 additions and 38 deletions

View File

@@ -5,7 +5,7 @@
<el-form-item :label="label" prop="attachment"> <el-form-item :label="label" prop="attachment">
<template v-if="preview&&JSON.stringify(singleFile) !== '{}'&&JSON.stringify(singleFile)!=='null'"> <template v-if="preview&&JSON.stringify(singleFile) !== '{}'&&JSON.stringify(singleFile)!=='null'">
<el-button type="primary" link @click="handleDownload(singleFile)" style="font-size: 16px"> <el-button type="primary" link @click="handleDownload(singleFile)" style="font-size: 16px">
{{ singleFile?.originalFileName }} {{ singleFile ? singleFile?.originalFileName : formData.singleFile?.originalFileName }}
</el-button> </el-button>
<el-button type="danger" link @click="deleteSingleFile(singleFile,1)">删除</el-button> <el-button type="danger" link @click="deleteSingleFile(singleFile,1)">删除</el-button>
</template> </template>
@@ -35,7 +35,7 @@
<script setup lang="jsx"> <script setup lang="jsx">
import FileUpload from '@/components/FileUpload.vue' import FileUpload from '@/components/FileUpload.vue'
import {deleteFile, downloadFile} from "@/api/project-demand"; import {deleteFile, downloadFile} from "@/api/project-demand";
import {ElMessage, ElMessageBox, ElNotification} from "element-plus"; import {ElMessageBox, ElNotification} from "element-plus";
const props = defineProps({ const props = defineProps({
showFileList: { showFileList: {
@@ -59,12 +59,11 @@ const props = defineProps({
default: [] default: []
}, },
formData: { formData: {
type: Array, type: Object,
default: [] default: {}
} }
}) })
const emit = defineEmits(["getAttachment", "getOtherFile"]) const emit = defineEmits(["getAttachment", "getOtherFile"])
const formData = ref({})
const tableConfig = reactive({ const tableConfig = reactive({
columns: [ columns: [
{ {
@@ -115,11 +114,12 @@ const tableConfig = reactive({
)) ))
} }
{ {
row.newFile||props.preview||!props.preview ? <popover-delete name={row.originalFileName} type={'文件'} btnType={'danger'} row.newFile || props.preview || !props.preview ?
perm={['mosr:requirement:del']} <popover-delete name={row.originalFileName} type={'文件'} btnType={'danger'}
onDelete={() => handleDelete(row)}/> perm={['mosr:requirement:del']}
: '' onDelete={() => handleDelete(row)}/>
} : ''
}
</div> </div>
) )
} }
@@ -136,10 +136,18 @@ const allFileList = ref([])
watch(() => props.showTable, (newVal) => { watch(() => props.showTable, (newVal) => {
props.showTable = newVal props.showTable = newVal
}, {deep: true}) }, {deep: true})
watch(() => props.otherFileList, (newVal) => { watch(() => props.formData.fileList, (newVal) => {
console.log('newotherFileList', newVal) console.log('newVal-fileList', newVal)
if (props.preview) { if (props.preview) {
if (props.formData.fileList===null||props.formData.fileList.length===0) { newVal?.forEach(item => {
allFileList.value.push(item)
})
}
}, {deep: true})
watch(() => props.otherFileList, (newVal) => {
console.log('newotherFileList', newVal,props.formData)
if (props.preview) {
if (props.formData.fileList === null || props.formData.fileList.length === 0) {
allFileList.value = newVal allFileList.value = newVal
} else { } else {
newVal?.forEach(item => { newVal?.forEach(item => {
@@ -150,14 +158,6 @@ watch(() => props.otherFileList, (newVal) => {
allFileList.value = newVal allFileList.value = newVal
} }
}, {deep: true}) }, {deep: true})
watch(() => props.formData.fileList, (newVal) => {
console.log('newVal-fileList', newVal)
if (props.preview) {
newVal?.forEach(item => {
allFileList.value.push(item)
})
}
}, {deep: true})
watch(() => props.formData.singleFile, (newVal) => { watch(() => props.formData.singleFile, (newVal) => {
console.log('singleFile', newVal) console.log('singleFile', newVal)
singleFile.value = newVal singleFile.value = newVal
@@ -193,7 +193,7 @@ const deleteAttachment = (val) => {
type: 'success' type: 'success'
}) })
isSingleFile.value = false isSingleFile.value = false
singleFile.value=null singleFile.value = null
} }
}); });
} }
@@ -210,7 +210,7 @@ const deleteSingleFile = (row, type) => {
type: res.code === 1000 ? 'success' : 'error' type: res.code === 1000 ? 'success' : 'error'
}) })
if (res.code === 1000) { if (res.code === 1000) {
isSingleFile.value=false isSingleFile.value = false
if (type === 1) { if (type === 1) {
singleFile.value = null singleFile.value = null
} else { } else {
@@ -249,7 +249,7 @@ defineExpose({
</script> </script>
<style scoped> <style scoped>
:deep(.el-table--fit ){ :deep(.el-table--fit ) {
height: 300px!important; height: 300px !important;
} }
</style> </style>

View File

@@ -233,16 +233,16 @@ const tableConfig = reactive({
let btn = [] let btn = []
let buttons = new Set(Array.from(row.buttons)) let buttons = new Set(Array.from(row.buttons))
if (buttons.has("details")) { if (buttons.has("details")) {
btn.push({label: '详情', prem: ['mosr:requirement:info'], func: () => handleDetail(row), type: 'primary'}) btn.push({label: '详情', prem: ['project:management:filing:detail'], func: () => handleDetail(row), type: 'primary'})
} }
if (buttons.has("attachments")) { if (buttons.has("attachments")) {
btn.push({label: '附件', prem: ['mosr:requirement:resubmit'], func: () => handleAttachment(row), type: 'primary'}) btn.push({label: '附件', prem: ['project:management:filing:attachment'], func: () => handleAttachment(row), type: 'primary'})
} }
if (buttons.has("entry")) { if (buttons.has("entry")) {
btn.push({label: '结项', prem: ['mosr:requirement:del'], func: () => handleConclusion(row), type: 'primary'}) btn.push({label: '结项', prem: ['project:management:filing:conclusion'], func: () => handleConclusion(row), type: 'primary'})
} }
if (buttons.has("edit")) { if (buttons.has("edit")) {
btn.push({label: '编辑', prem: ['mosr:requirement:info'], func: () => handleEdit(row), type: 'primary'}) btn.push({label: '编辑', prem: ['project:management:filing:conclusion'], func: () => handleEdit(row), type: 'primary'})
} }
return ( return (
<div style={{width: '100%'}}> <div style={{width: '100%'}}>

View File

@@ -251,22 +251,22 @@ const tableConfig = reactive({
let btn = [] let btn = []
let buttons = new Set(Array.from(row.buttons)) let buttons = new Set(Array.from(row.buttons))
if (buttons.has("details")) { if (buttons.has("details")) {
btn.push({label: '详情', prem: ['mosr:requirement:info'], func: () => handleDetail(row), type: 'primary'}) btn.push({label: '详情', prem: ['mosr:implementation:info'], func: () => handleDetail(row), type: 'primary'})
} }
if (buttons.has("check")) { if (buttons.has("check")) {
btn.push({label: '验收', prem: ['mosr:requirement:resubmit'], func: () => handleCheck(row), type: 'primary'}) btn.push({label: '验收', prem: ['mosr:implementation:check'], func: () => handleCheck(row), type: 'primary'})
} }
if (buttons.has("edit")) { if (buttons.has("edit")) {
btn.push({label: '编辑', prem: ['mosr:requirement:info'], func: () => handleEdit(row), type: 'primary'}) btn.push({label: '编辑', prem: ['mosr:implementation:resubmit'], func: () => handleEdit(row), type: 'primary'})
} }
if (buttons.has("standing")) { if (buttons.has("standing")) {
btn.push({label: '台账', prem: ['mosr:requirement:info'], func: () => handleStandingBook(row), type: 'primary'}) btn.push({label: '台账', prem: ['project:management:implementation:account'], func: () => handleStandingBook(row), type: 'primary'})
} }
if (buttons.has("attachments")) { if (buttons.has("attachments")) {
btn.push({label: '附件', prem: ['mosr:requirement:info'], func: () => handleAttachment(row), type: 'primary'}) btn.push({label: '附件', prem: ['project:management:implementation:attachment'], func: () => handleAttachment(row), type: 'primary'})
} }
if (buttons.has("viewAllocation")) { if (buttons.has("viewAllocation")) {
btn.push({label: '查看分摊', prem: ['mosr:requirement:info'], func: () => handleShare(row), type: 'primary'}) btn.push({label: '查看分摊', prem: ['project:management:implementation:share'], func: () => handleShare(row), type: 'primary'})
} }
if (buttons.has("phaseChange")) { if (buttons.has("phaseChange")) {
btn.push({label: '阶段变更', prem: ['mosr:phase:change'], func: () => handlePhaseChange(row), type: 'primary'}) btn.push({label: '阶段变更', prem: ['mosr:phase:change'], func: () => handlePhaseChange(row), type: 'primary'})

View File

@@ -232,16 +232,16 @@ const tableConfig = reactive({
let btn = [] let btn = []
let buttons = new Set(Array.from(row.buttons)) let buttons = new Set(Array.from(row.buttons))
if (buttons.has("details")) { if (buttons.has("details")) {
btn.push({label: '详情', prem: ['mosr:requirement:info'], func: () => handleDetail(row), type: 'primary'}) btn.push({label: '详情', prem: ['mosr:approval:info'], func: () => handleDetail(row), type: 'primary'})
} }
if (buttons.has("edit")) { if (buttons.has("edit")) {
btn.push({label: '编辑', prem: ['mosr:requirement:resubmit'], func: () => handleEdit(row), type: 'primary'}) btn.push({label: '编辑', prem: ['mosr:approval:resubmit'], func: () => handleEdit(row), type: 'primary'})
} }
// if (buttons.has("delete")) { // if (buttons.has("delete")) {
// btn.push({label: '删除',prem: ['mosr:requirement:del'], func: () => handleDelete(row), type: 'primary'}) // btn.push({label: '删除',prem: ['mosr:requirement:del'], func: () => handleDelete(row), type: 'primary'})
// } // }
if (buttons.has("apply")) { if (buttons.has("apply")) {
btn.push({label: '立项',prem: ['mosr:requirement:info'], func: () => handleApply(row), type: 'primary'}) btn.push({label: '立项',prem: ['mosr:approval:apply'], func: () => handleApply(row), type: 'primary'})
} }
return ( return (
<div style={{width: '100%'}}> <div style={{width: '100%'}}>