refactor: 优化多个组件的代码结构和功能
- 移除了多个组件中的无用代码和不必要的 console.log 语句 - 优化了部分组件的用户选择和消息展示逻辑 - 统一了消息类型相关的命名 - 调整了部分组件的样式和布局
This commit is contained in:
parent
67e58660ff
commit
6f99833fe5
@ -597,7 +597,6 @@
|
|||||||
const deptTreeSubmit = () => {
|
const deptTreeSubmit = () => {
|
||||||
deptVisible.value = false;
|
deptVisible.value = false;
|
||||||
formData.value.userIds = selectedIds.value;
|
formData.value.userIds = selectedIds.value;
|
||||||
console.log(formData.value.userIds);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 部门树模态框
|
// 部门树模态框
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
}
|
}
|
||||||
const useMessageStore = useMessagesStore();
|
const useMessageStore = useMessagesStore();
|
||||||
const { loading, setLoading } = useLoading(true);
|
const { loading, setLoading } = useLoading(true);
|
||||||
const messageType = ref('other');
|
const messageType = ref('MESSAGE');
|
||||||
const messageData = reactive<{
|
const messageData = reactive<{
|
||||||
renderList: MessagesList[];
|
renderList: MessagesList[];
|
||||||
messageList: MessagesList[];
|
messageList: MessagesList[];
|
||||||
@ -54,11 +54,11 @@
|
|||||||
toRefs(messageData);
|
toRefs(messageData);
|
||||||
const tabList: TabItem[] = [
|
const tabList: TabItem[] = [
|
||||||
{
|
{
|
||||||
key: 'other',
|
key: 'MESSAGE',
|
||||||
title: '消息',
|
title: '消息',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'resetThePassword',
|
key: 'NOTICE',
|
||||||
title: '通知',
|
title: '通知',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -304,7 +304,6 @@
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
formData.value = res.data;
|
formData.value = res.data;
|
||||||
paramsData.value = res.data.extendParams;
|
paramsData.value = res.data.extendParams;
|
||||||
console.log('formData:', formData.value);
|
|
||||||
|
|
||||||
const ID = formData.value.productId;
|
const ID = formData.value.productId;
|
||||||
return queryProductDetail(ID);
|
return queryProductDetail(ID);
|
||||||
|
@ -308,7 +308,6 @@
|
|||||||
// 提交
|
// 提交
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const valid = await CreateRef.value?.validate();
|
const valid = await CreateRef.value?.validate();
|
||||||
console.log(valid);
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
// 新增
|
// 新增
|
||||||
if (props.isCreate) {
|
if (props.isCreate) {
|
||||||
|
@ -641,7 +641,6 @@
|
|||||||
};
|
};
|
||||||
// 删除参数
|
// 删除参数
|
||||||
const handleDeleteParams = (record: any, data: string) => {
|
const handleDeleteParams = (record: any, data: string) => {
|
||||||
console.log(record);
|
|
||||||
if (record !== -1 && data === 'serveInputData') {
|
if (record !== -1 && data === 'serveInputData') {
|
||||||
serveInputData.value.splice(record, 1);
|
serveInputData.value.splice(record, 1);
|
||||||
} else if (record !== -1 && data === 'serveOutputData') {
|
} else if (record !== -1 && data === 'serveOutputData') {
|
||||||
@ -679,7 +678,6 @@
|
|||||||
// 删除属性
|
// 删除属性
|
||||||
const handleDeleteProperty = async (record: any) => {
|
const handleDeleteProperty = async (record: any) => {
|
||||||
const res = await deleteProperty(record.id);
|
const res = await deleteProperty(record.id);
|
||||||
console.log(res);
|
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
Message.success({
|
Message.success({
|
||||||
content: '删除成功',
|
content: '删除成功',
|
||||||
|
@ -257,7 +257,6 @@
|
|||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
onSuccess(res.data);
|
onSuccess(res.data);
|
||||||
formData.value.attachmentIds?.push(res.data.id);
|
formData.value.attachmentIds?.push(res.data.id);
|
||||||
console.log(res.data.id);
|
|
||||||
console.log(formData.value);
|
console.log(formData.value);
|
||||||
} else {
|
} else {
|
||||||
onError(res.data);
|
onError(res.data);
|
||||||
|
@ -150,16 +150,13 @@
|
|||||||
</a-tree>
|
</a-tree>
|
||||||
</a-card>
|
</a-card>
|
||||||
<a-card style="flex: 1">
|
<a-card style="flex: 1">
|
||||||
<a-button
|
<a-table
|
||||||
type="primary"
|
row-key="id"
|
||||||
style="margin-bottom: 10px"
|
:data="renderData"
|
||||||
@click="handleCheckAllUsers"
|
:columns="columns"
|
||||||
>全选</a-button
|
:row-selection="rowSelection"
|
||||||
|
v-model:selected-keys="selectedIds"
|
||||||
>
|
>
|
||||||
<a-table :data="renderData" :columns="columns">
|
|
||||||
<template #id="{ record }">
|
|
||||||
<a-checkbox v-model="selectedIds" :value="record.id"> </a-checkbox>
|
|
||||||
</template>
|
|
||||||
<template #name="{ record }">
|
<template #name="{ record }">
|
||||||
{{ record.username }}
|
{{ record.username }}
|
||||||
</template>
|
</template>
|
||||||
@ -230,16 +227,20 @@
|
|||||||
excludeKeys: ['uploadVideo', 'insertImage', 'insertVideo'],
|
excludeKeys: ['uploadVideo', 'insertImage', 'insertVideo'],
|
||||||
};
|
};
|
||||||
const columns = computed<any[]>(() => [
|
const columns = computed<any[]>(() => [
|
||||||
{
|
// {
|
||||||
title: '操作',
|
// title: '操作',
|
||||||
dataIndex: 'id',
|
// dataIndex: 'id',
|
||||||
slotName: 'id',
|
// slotName: 'id',
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
title: '用户',
|
title: '用户',
|
||||||
dataIndex: 'username',
|
dataIndex: 'username',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
const rowSelection = {
|
||||||
|
type: 'checkbox',
|
||||||
|
showCheckedAll: true, // 默认选中的行 ID
|
||||||
|
};
|
||||||
|
|
||||||
const deptTreeData = ref([
|
const deptTreeData = ref([
|
||||||
{
|
{
|
||||||
@ -303,7 +304,6 @@
|
|||||||
deptId,
|
deptId,
|
||||||
});
|
});
|
||||||
renderData.value = res.data.records;
|
renderData.value = res.data.records;
|
||||||
console.log(renderData);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// you can report use errorHandler or other
|
// you can report use errorHandler or other
|
||||||
}
|
}
|
||||||
@ -386,18 +386,8 @@
|
|||||||
deptVisible.value = false;
|
deptVisible.value = false;
|
||||||
formData.value.userIds = selectedIds.value;
|
formData.value.userIds = selectedIds.value;
|
||||||
selectedNames.value = getNamesByIds(selectedIds.value);
|
selectedNames.value = getNamesByIds(selectedIds.value);
|
||||||
console.log(selectedNames.value);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 选择所有用户
|
|
||||||
const handleCheckAllUsers = () => {
|
|
||||||
if (selectedIds.value.length === 0) {
|
|
||||||
// 遍历 renderData 并提取所有用户的 id
|
|
||||||
selectedIds.value = renderData.value.map((user) => user.id);
|
|
||||||
} else {
|
|
||||||
selectedIds.value = [];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 部门树模态框
|
// 部门树模态框
|
||||||
const deptTreeCancel = () => {
|
const deptTreeCancel = () => {
|
||||||
|
@ -99,8 +99,8 @@
|
|||||||
:bordered="false"
|
:bordered="false"
|
||||||
:size="size"
|
:size="size"
|
||||||
:row-selection="rowSelection"
|
:row-selection="rowSelection"
|
||||||
|
v-model:selected-keys="selectedIds"
|
||||||
style="margin-bottom: 40px"
|
style="margin-bottom: 40px"
|
||||||
@select="select"
|
|
||||||
@page-change="onPageChange"
|
@page-change="onPageChange"
|
||||||
>
|
>
|
||||||
<template #operationTime="{ record }">
|
<template #operationTime="{ record }">
|
||||||
@ -178,9 +178,6 @@
|
|||||||
showCheckedAll: true, // 默认选中的行 ID
|
showCheckedAll: true, // 默认选中的行 ID
|
||||||
};
|
};
|
||||||
|
|
||||||
const select= (selectedRowKeys: number[]) => {
|
|
||||||
selectedIds.value = selectedRowKeys;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 获取日志列表
|
// 获取日志列表
|
||||||
const fetchData = async (params = { size: 10, current: 1 }) => {
|
const fetchData = async (params = { size: 10, current: 1 }) => {
|
||||||
|
@ -190,7 +190,6 @@
|
|||||||
// 高亮行
|
// 高亮行
|
||||||
const highlightRow = (record: BulletinsRecord) => {
|
const highlightRow = (record: BulletinsRecord) => {
|
||||||
if (record.top === true) {
|
if (record.top === true) {
|
||||||
console.log('record', record);
|
|
||||||
return 'background-color: yellow;';
|
return 'background-color: yellow;';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
|
@ -200,7 +200,6 @@
|
|||||||
// 高亮行
|
// 高亮行
|
||||||
const highlightRow = (record: BulletinsRecord) => {
|
const highlightRow = (record: BulletinsRecord) => {
|
||||||
if (record.top === true) {
|
if (record.top === true) {
|
||||||
console.log('record', record);
|
|
||||||
return 'background-color: yellow;';
|
return 'background-color: yellow;';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
|
Loading…
Reference in New Issue
Block a user