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