add audit file log
Cette révision appartient à :
@@ -1,8 +1,10 @@
|
||||
import { reactive } from 'vue'
|
||||
import { list, remove } from '@/api/audit'
|
||||
import { list, remove, fileList, fileRemove } from '@/api/audit'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useRoute } from 'vue-router'
|
||||
import {formatTime} from '@/utils/time'
|
||||
import { formatTime } from '@/utils/time'
|
||||
import { T } from '@/utils/i18n'
|
||||
|
||||
export function useRepositories () {
|
||||
const listRes = reactive({
|
||||
list: [], total: 0, loading: false,
|
||||
@@ -20,7 +22,7 @@ export function useRepositories () {
|
||||
listRes.loading = false
|
||||
if (res) {
|
||||
listRes.list = res.data.list.map(item => {
|
||||
item.close_time = item.close_time ? formatTime(item.close_time*1000) : '-'
|
||||
item.close_time = item.close_time ? formatTime(item.close_time * 1000) : '-'
|
||||
return item
|
||||
})
|
||||
listRes.total = res.data.total
|
||||
@@ -35,9 +37,9 @@ export function useRepositories () {
|
||||
}
|
||||
|
||||
const del = async (row) => {
|
||||
const cf = await ElMessageBox.confirm('确定删除么?', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
const cf = await ElMessageBox.confirm(T('Confirm?', { param: T('Delete') }), {
|
||||
confirmButtonText: T('Confirm'),
|
||||
cancelButtonText: T('Cancel'),
|
||||
type: 'warning',
|
||||
}).catch(_ => false)
|
||||
if (!cf) {
|
||||
@@ -46,7 +48,64 @@ export function useRepositories () {
|
||||
|
||||
const res = await remove({ id: row.id }).catch(_ => false)
|
||||
if (res) {
|
||||
ElMessage.success('操作成功')
|
||||
ElMessage.success(T('OperationSuccess'))
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
listRes,
|
||||
listQuery,
|
||||
getList,
|
||||
handlerQuery,
|
||||
del,
|
||||
}
|
||||
}
|
||||
|
||||
export function useFileRepositories () {
|
||||
const listRes = reactive({
|
||||
list: [], total: 0, loading: false,
|
||||
})
|
||||
const listQuery = reactive({
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
peer_id: null,
|
||||
from_peer: null,
|
||||
})
|
||||
|
||||
const getList = async () => {
|
||||
listRes.loading = true
|
||||
const res = await fileList(listQuery).catch(_ => false)
|
||||
listRes.loading = false
|
||||
if (res) {
|
||||
listRes.list = res.data.list.map(item => {
|
||||
item.info = item.info ? JSON.parse(item.info) : '-'
|
||||
return item
|
||||
})
|
||||
listRes.total = res.data.total
|
||||
}
|
||||
}
|
||||
const handlerQuery = () => {
|
||||
if (listQuery.page === 1) {
|
||||
getList()
|
||||
} else {
|
||||
listQuery.page = 1
|
||||
}
|
||||
}
|
||||
|
||||
const del = async (row) => {
|
||||
const cf = await ElMessageBox.confirm(T('Confirm?', { param: T('Delete') }), {
|
||||
confirmButtonText: T('Confirm'),
|
||||
cancelButtonText: T('Cancel'),
|
||||
type: 'warning',
|
||||
}).catch(_ => false)
|
||||
if (!cf) {
|
||||
return false
|
||||
}
|
||||
|
||||
const res = await fileRemove({ id: row.id }).catch(_ => false)
|
||||
if (res) {
|
||||
ElMessage.success(T('OperationSuccess'))
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur