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