Преглед на файлове

修复日志列表的删除权限

iZaiZaiA преди 2 години
родител
ревизия
e58977034b
променени са 1 файла, в които са добавени 20 реда и са изтрити 14 реда
  1. 20 14
      src/views/ledger/components/table-list.vue

+ 20 - 14
src/views/ledger/components/table-list.vue

@@ -49,7 +49,7 @@
                         <el-button type="primary" size="small" plain @click="handleTableQuery(row)">查询</el-button>
                     </HcTooltip>
                     <HcTooltip keys="ledger_query_table_del">
-                        <el-button type="danger" size="small" plain :disabled="!row.operation" @click="handleTableDel(row)">删除</el-button>
+                        <el-button type="danger" size="small" plain :disabled="!row.operation || row.status !== 0" @click="handleTableDel(row)">删除</el-button>
                     </HcTooltip>
                 </template>
             </HcTable>
@@ -303,8 +303,9 @@ const batchAbolishSave = async (ids) => {
 //批量删除
 const batchDeleteClick = () => {
     const rows = tableCheckedKeys.value;
-    const result = rows.every(({operation})=> {
-        return operation
+    //判断是否满足条件
+    const result = rows.every(({status, operation})=> {
+        return status === 0 && operation
     })
     //判断状态
     if (result) {
@@ -320,7 +321,7 @@ const batchDeleteClick = () => {
             }
         })
     } else {
-        window.$message?.warning('只能删除自己上报日志文件')
+        window.$message?.warning('只能删除自己的未上报日志文件')
     }
 }
 
@@ -354,17 +355,22 @@ const handleTableQuery = ({evisaPdfUrl, pdfUrl}) => {
 }
 
 //删除
-const handleTableDel = (row) => {
-    window?.$messageBox?.alert('是否删除勾选的日志文件?', '删除文件', {
-        showCancelButton: true,
-        confirmButtonText: '确定删除',
-        cancelButtonText: '取消',
-        callback: (action) => {
-            if (action === 'confirm') {
-                theLogRemoveByIds([row.id])
+const handleTableDel = ({id, status, operation}) => {
+    //判断是否满足条件
+    if (status === 0 && operation) {
+        window?.$messageBox?.alert('是否删除勾选的日志文件?', '删除文件', {
+            showCancelButton: true,
+            confirmButtonText: '确定删除',
+            cancelButtonText: '取消',
+            callback: (action) => {
+                if (action === 'confirm') {
+                    theLogRemoveByIds([id])
+                }
             }
-        }
-    })
+        })
+    } else {
+        window.$message?.warning('只能删除自己的未上报日志文件')
+    }
 }
 
 //删除