提交 2c2309d8 authored 作者: 刘旭's avatar 刘旭

修改日志同步功能

上级 44a0455a
......@@ -23,7 +23,7 @@ const avatar = store.state.user.userAvatar
//退出登录
const loginOut = async () => {
window.location.href = "/login";
window.location.href = "/#/login";
cleanSession();
// let confirm = await global.$myconfirm('确定退出登录吗?')
// if (confirm) {
......
import { List } from "echarts";
import { request } from "../../config";
// 查询日志
......@@ -17,11 +18,11 @@ export function getQueryxyunLog(
});
}
export function getSynchroni(id: number) {
export function getSynchroni(idList: any) {
return request({
url: '/api/abnormal/synchronization',
method: 'get',
params: { id }
method: 'post',
data: { idList }
})
}
......@@ -22,6 +22,9 @@
</el-space>
</el-form>
</div>
<el-span>
<el-button type="primary" @click="hanleSynchronis">同步</el-button>
</el-span>
</el-space>
<el-divider />
......@@ -29,8 +32,8 @@
<!-- 表格 -->
<el-table v-loading="loading" :data="tableList" border stripe style="width: 100%"
@selection-change="handleSelectionChange" @filter-change="filterChange">
<!-- <el-table-column type="selection" width="55" /> -->
<el-table-column type="index" :index="indexMethod(1)" />
<el-table-column type="selection" width="55" />
<!-- <el-table-column type="index" :index="indexMethod(1)" /> -->
<el-table-column prop="flag" label="同步状态" :filters="[
{ text: '同步成功', value: '1' },
{ text: '同步失败', value: '0' },
......@@ -46,7 +49,7 @@
<el-table-column prop="createTime" label="创建时间" align="center" />
<el-table-column label="操作" align="center" width="155px">
<template #default="scope">
<el-button link type="primary" size="small" @click="hanleSynchroni(scope.row.id)">同步</el-button>
<!-- <el-button link type="primary" size="small" @click="hanleSynchroni(scope.row.id)">同步</el-button> -->
<el-button link type="primary" size="small" @click="handleDetails(scope.row)">详情</el-button>
</template>
</el-table-column>
......@@ -127,7 +130,7 @@ const indexMethod = (index: number) => {
};
const visible = ref(false);
// 多选框
const multipleSelection = ref<List[]>([]);
const multipleSelection = ref([]);
// 分页
const disabled = ref(false);
const filters = ref();
......@@ -135,9 +138,12 @@ const { tableList, total, loading, pageSize, currentPage } =
useXyunLogTableList();
// 同步筛选
const filterChange = (value: any) => {
let i = "";
Object.values(value).forEach((e: any) => {
i = e[0];
});
nextTick(() => {
const flag = value["el-table_1_column_2"][0];
filters.value = flag;
filters.value = i;
page(
currentPage.value,
pageSize.value,
......@@ -154,30 +160,49 @@ const dateChange = (value: any) => {
filterForm.value.dateTo = moment(value[1]).format("YYYY-MM-DD HH:mm:ss");
};
// 选择多选框的数据
const handleSelectionChange = (val: List[]) => {
multipleSelection.value = val;
};
const handleSelectionChange = (val: []) => multipleSelection.value = val;
// 详情
const handleDetails = (scope: any) => {
console.log(filterForm.value);
detailForm.value = scope;
visible.value = true;
};
// 同步
const hanleSynchroni = (id: number) => {
getSynchroni(id).then((res: any) => {
if (res.code == 200) page(
currentPage.value,
pageSize.value,
filterForm.value.dateFrom,
filterForm.value.dateTo,
filterForm.value.name,
filterForm.value.content,
filters.value
);
})
// const hanleSynchroni = (id: number) => {
// getSynchroni(id).then((res: any) => {
// if (res.code == 200) page(
// currentPage.value,
// pageSize.value,
// filterForm.value.dateFrom,
// filterForm.value.dateTo,
// filterForm.value.name,
// filterForm.value.content,
// filters.value
// );
// })
// }
// 批量同步
const hanleSynchronis = () => {
if (multipleSelection.value.length !== 0) {
let listId = []
for (let s in multipleSelection.value) {
listId.push(multipleSelection.value[s]?.id)
}
getSynchroni(listId).then((res: any) => {
if (res.code == 200) page(
currentPage.value,
pageSize.value,
filterForm.value.dateFrom,
filterForm.value.dateTo,
filterForm.value.name,
filterForm.value.content,
filters.value
);
})
}
}
// 对话框取消按钮
const cancelVisible1 = () => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论