fix(view模块): 消灭大部分黄色警告

移除国际化相关代码并优化公告功能

- 移除了多语言相关代码,统一使用中文
- 重构了公告编辑和详情页面,优化了附件展示和编辑器配置
- 更新了用户管理和菜单管理相关页面的中文文案
- 调整了登录和用户设置页面的验证码输入框属性
This commit is contained in:
Kven 2025-01-15 20:54:47 +08:00
parent 8fa3b8f0c3
commit 9604bca0ea
17 changed files with 201 additions and 191 deletions

View File

@ -8,13 +8,26 @@ export interface BulletinCreateRecord {
attachmentIds?: string[]; attachmentIds?: string[];
} }
export interface AttachmentRecord {
id: string;
fileName: string;
url: string;
uploadTime?: string;
mimeType?: string;
}
export interface BulletinRecord extends BulletinCreateRecord { export interface BulletinRecord extends BulletinCreateRecord {
id: number; id: number;
state: string;
publishTime: string;
createTime: string; createTime: string;
createBy: string;
updateTime: string;
state: string;
editUserId: number;
publishUserId: number;
publishTime: string;
closeUserId: number;
closeTime: string;
attachments?: AttachmentRecord[];
} }
export interface BulletinsRecord { export interface BulletinsRecord {
@ -27,14 +40,9 @@ export interface BulletinsRecord {
size: number; size: number;
} }
export interface AttachmentRecord {
type: string;
file: any;
}
// 查看详情 // 查看详情
export function queryBulletinListAll(id: number) { export function queryBulletinDetail(id: number) {
return axios.get(`/api/rest/bulletin/${id}`); return axios.get(`/api/rest/bulletin/${id}`);
} }

View File

@ -4,17 +4,17 @@ export interface MenuRecord {
id?: number; id?: number;
pid?: number; pid?: number;
name: string; name: string;
path: string; path?: string;
meta: { meta: {
locale: string; locale: string;
title?: string; title?: string;
icon: string; icon?: string;
requiresAuth: boolean; requiresAuth: boolean;
hideInMenu: boolean; hideInMenu: boolean;
order: number; order: number;
permissions: string[]; permissions: string[];
showInMenu: boolean; showInMenu?: boolean;
menuOrder: number; menuOrder?: string;
}; };
children?: MenuRecord[] ; children?: MenuRecord[] ;
}; };
@ -38,7 +38,7 @@ export const createMenu = (data: MenuCreateRecord) => {
}; };
export const updateMenu = (data: MenuCreateRecord) => { export const updateMenu = (data: MenuCreateRecord) => {
return axios.put(`/api/rest/menu/${data.id}`, data); return axios.patch(`/api/rest/menu/${data.id}`, data);
}; };
export const removeMenu = (id: string | number) => { export const removeMenu = (id: string | number) => {

View File

@ -9,11 +9,11 @@ import {
publish, publish,
close, close,
remove, remove,
queryBulletinListAll, queryBulletinDetail,
queryBulletinList, queryBulletinList,
addAttachments, addAttachments,
queryDeptTreeList, // queryDeptTreeList,
addAttachment, // addAttachment,
deleteAttachment deleteAttachment
} from '@/api/bulletin-mgmt'; } from '@/api/bulletin-mgmt';
import { bulletinsStore } from '@/store/modules/bulle-mgmt/type'; import { bulletinsStore } from '@/store/modules/bulle-mgmt/type';
@ -33,8 +33,8 @@ const useBulletinStore = defineStore('bulletin-mgmt', {
}, },
}, },
actions: { actions: {
async queryBulletinListAll(id: number) { async queryBulletinDetail(id: number) {
return queryBulletinListAll(id); return queryBulletinDetail(id);
}, },
async queryBulletinList(params: BulletinsRecord) { async queryBulletinList(params: BulletinsRecord) {
@ -69,15 +69,15 @@ const useBulletinStore = defineStore('bulletin-mgmt', {
return addAttachments(data); return addAttachments(data);
}, },
// 获取部门树 // // 获取部门树
async queryDeptTreeList() { // async queryDeptTreeList() {
return queryDeptTreeList(); // return queryDeptTreeList();
}, // },
// 获取附件信息 // // 获取附件信息
async queryAttachmentInfo(id: string) { // async queryAttachmentInfo(id: string) {
return addAttachment(id); // return addAttachment(id);
}, // },
// 删除附件 // 删除附件
async deleteAttachment(id: string) { async deleteAttachment(id: string) {

View File

@ -158,7 +158,7 @@
:rules="[ :rules="[
{ {
required: true, required: true,
message: t('user.info.code.required'), message: '请输入验证码',
}, },
]" ]"
:validate-trigger="['change', 'input']" :validate-trigger="['change', 'input']"

View File

@ -63,35 +63,29 @@
> >
<!-- v-if="isCreate"--> <!-- v-if="isCreate"-->
<a-upload <a-upload
v-model="formData.attachmentIds" v-model="formData.attachments"
show-file-list show-file-list
:file-list="fileList"
:custom-request="customRequest" :custom-request="customRequest"
@before-remove="beforeRemove" @before-remove="beforeRemove"
> >
<template #upload-item="{ file }">
<div style="display: flex; align-items: center;">
<img :src="file.url" alt="上传文件" style="width: 50px; height: 50px; margin-right: 10px;" />
<span>{{ file.name }}</span>
</div>
</template>
</a-upload> </a-upload>
</a-form-item> </a-form-item>
<a-form-item field="content" label='内容' :rules="[{ required: true}]"> <a-form-item field="content" label='内容' :rules="[{ required: true}]">
<div style="border: 1px solid #ccc;min-width: 700px"> <div style="border: 1px solid #ccc;min-width: 700px;">
<Toolbar <Toolbar
style="border-bottom: 1px solid #ccc" style="border-bottom: 1px solid #ccc;"
:editor="editorRef" :editor="editorRef"
:default-config="toolbarConfig" :default-config="toolbarConfig"
:mode="mode" :mode="mode"
:class="{'fullscreen-toolbar': isFullScreen}"
/> />
<Editor <Editor
style="height: 200px;overflow-y: hidden;"
v-model="formData.content" v-model="formData.content"
style="overflow-y: hidden;height: 200px;"
:default-config="editorConfig" :default-config="editorConfig"
:mode="mode" :mode="mode"
@on-created="handleCreated" @on-created="handleCreated"
:class="{'fullscreen-editor': isFullScreen}"
/> />
</div> </div>
<!-- <a-textarea v-model="formData.content" placeholder="请输入公告内容" style="height: 100px" />--> <!-- <a-textarea v-model="formData.content" placeholder="请输入公告内容" style="height: 100px" />-->
@ -107,8 +101,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import useVisible from '@/hooks/visible'; import useVisible from '@/hooks/visible';
import { computed, defineEmits, PropType, ref, shallowRef,onBeforeUnmount } from 'vue'; import { computed, defineEmits, ref, shallowRef,onBeforeUnmount } from 'vue';
import { BulletinCreateRecord } from '@/api/bulletin-mgmt'; import { BulletinRecord } from '@/api/bulletin-mgmt';
import { FormInstance } from '@arco-design/web-vue/es/form'; import { FormInstance } from '@arco-design/web-vue/es/form';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import { useBulletinStore } from '@/store'; import { useBulletinStore } from '@/store';
@ -117,8 +111,9 @@ import { IEditorConfig } from '@wangeditor/editor'
import '@wangeditor/editor/dist/css/style.css' import '@wangeditor/editor/dist/css/style.css'
const props = defineProps({ const props = defineProps({
prem: { id: {
type: Object as PropType<BulletinCreateRecord>, type: Number,
default: -1,
}, },
isCreate: Boolean, isCreate: Boolean,
}); });
@ -130,27 +125,70 @@ const { visible, setVisible } = useVisible(false);
const checkKeys = ref<number[]>([]); const checkKeys = ref<number[]>([]);
const CreateRef = ref<FormInstance>(); const CreateRef = ref<FormInstance>();
const formData = ref<any>({ const formData = ref<BulletinRecord>({
...props.prem, id: -1,
attachmentIds: [], title: '',
top: false,
content: '',
remark: '',
createTime: '',
createBy: '',
updateTime: '',
state: '',
editUserId: 0,
publishUserId: 0,
publishTime: '',
closeUserId: 0,
closeTime: '',
attachments: [],
}); });
const bulletinStore = useBulletinStore(); const bulletinStore = useBulletinStore();
const editorRef = shallowRef() const editorRef = shallowRef()
const isFullScreen = ref(false);
const mode = 'default'; const mode = 'default';
const toolbarConfig = { excludeKeys: ['uploadVideo', 'insertImage','insertVideo']} const toolbarConfig = { excludeKeys: ['uploadVideo', 'insertImage','insertVideo']}
const handleCreated = (editor: any) => { const handleCreated = (editor: any) => {
editorRef.value = editor; // editor editorRef.value = editor; // editor
//
editor.on('fullScreen', () => {
})
} }
const fileList = computed(() => {
return formData.value.attachments?.map((item: any) => {
return {
name: item.fileName,
url: item.url,
uid: item.id,
};
});
});
// const fileList = [
// {
// uid: '-1',
// name: 'ice.png',
// url: '//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp',
// },
// {
// status: 'error',
// uid: '-2',
// percent: 0,
// response: '',
// name: 'cat.png',
// url: '//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/e278888093bef8910e829486fb45dd69.png~tplv-uwbnlip3yd-webp.webp',
// },
// {
// uid: '-3',
// name: 'light.png',
// url: '//p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/a8c8cdb109cb051163646151a4a5083b.png~tplv-uwbnlip3yd-webp.webp',
// },
// ];
// //
const handleClick = () => { const handleClick = () => {
setVisible(true); setVisible(true);
if(!props.isCreate){
bulletinStore.queryBulletinDetail(props.id).then((res: any) => {
formData.value = res.data;
})
}
}; };
const editorConfig: Partial<IEditorConfig> = { placeholder: '请输入内容...',MENU_CONF:{ const editorConfig: Partial<IEditorConfig> = { placeholder: '请输入内容...',MENU_CONF:{
@ -161,13 +199,12 @@ const editorConfig: Partial<IEditorConfig> = { placeholder: '请输入内容...'
base64LimitSize: 1024 * 1024, base64LimitSize: 1024 * 1024,
// server: '/api/rest/bulletin/1/add', // server: '/api/rest/bulletin/1/add',
} }
} },
} }
// //
const handleSubmit = async () => { const handleSubmit = async () => {
const valid = await CreateRef.value?.validate(); const valid = await CreateRef.value?.validate();
if (!valid) { if (!valid) {
formData.value.permissionIds = checkKeys.value;
// //
if (props.isCreate) { if (props.isCreate) {
// formData.value.username = formData.value.email; // formData.value.username = formData.value.email;
@ -205,9 +242,7 @@ const customRequest = async (option: any) => {
const res = await bulletinStore.addAttachments(formDataFile); const res = await bulletinStore.addAttachments(formDataFile);
if (res.status === 200) { if (res.status === 200) {
onSuccess(res.data); onSuccess(res.data);
console.log(formData.value); formData.value.attachments?.push(res.data);
formData.value.attachmentIds.push(res.data.id);
console.log(formData.value);
} else { } else {
onError(res.data); onError(res.data);
} }
@ -233,23 +268,3 @@ const handleCancel = async () => {
} }
</script> </script>
<style scoped>
.fullscreen-toolbar {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 50px; /* 根据需要调整高度 */
z-index: 999;
background-color: white;
}
.fullscreen-editor {
position: fixed;
top: 50px; /* 根据 toolbar 的高度调整 */
left: 0;
width: 100%;
height: calc(100% - 50px); /* 减去 toolbar 的高度 */
z-index: 999;
background-color: white;
}
</style>

View File

@ -45,7 +45,7 @@
const renderData = ref<any>([]); const renderData = ref<any>([]);
// const attachmentList = ref<any>([]); // const attachmentList = ref<any>([]);
const fetchData = async (Id: number) => { const fetchData = async (Id: number) => {
const res = await bulletinStore.queryBulletinListAll(Id); const res = await bulletinStore.queryBulletinDetail(Id);
// attachmentList.value = await bulletinStore.queryAttachmentInfo( // attachmentList.value = await bulletinStore.queryAttachmentInfo(
// '28452d83420650425d45110c6417bf693b966b29' // '28452d83420650425d45110c6417bf693b966b29'
// ); // );

View File

@ -197,7 +197,7 @@
</a-button> </a-button>
<BulletinEdit <BulletinEdit
ref="editUserRef" ref="editUserRef"
:prem="record" :id="record.id"
:is-create="false" :is-create="false"
@refresh="fetchData" @refresh="fetchData"
/> />

View File

@ -108,7 +108,7 @@
/> />
<Editor <Editor
v-model="formData.content" v-model="formData.content"
style="overflow-y: hidden;height: 200px;" style="overflow-y: hidden;min-height: 200px;"
:default-config="editorConfig" :default-config="editorConfig"
:mode="mode" :mode="mode"
:class="{'fullscreen-editor': isFullScreen}" :class="{'fullscreen-editor': isFullScreen}"
@ -167,7 +167,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import useVisible from '@/hooks/visible'; import useVisible from '@/hooks/visible';
import { computed, defineEmits, PropType, ref, shallowRef, onBeforeUnmount, reactive, onMounted } from 'vue'; import { computed, defineEmits, PropType, ref, shallowRef, onBeforeUnmount, onMounted } from 'vue';
import { CreateRecord } from '@/api/user'; import { CreateRecord } from '@/api/user';
import { FormInstance } from '@arco-design/web-vue/es/form'; import { FormInstance } from '@arco-design/web-vue/es/form';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';

View File

@ -132,7 +132,7 @@
:rules="[{ required: true, message: '请输入权限' }]" :rules="[{ required: true, message: '请输入权限' }]"
> >
<a-input <a-input
v-model="formData.meta.permissions" v-model="formData.meta.permissions[0]"
placeholder='请输入权限' placeholder='请输入权限'
/> />
</a-form-item> </a-form-item>
@ -171,7 +171,7 @@
locale: '', locale: '',
requiresAuth: false, requiresAuth: false,
hideInMenu: false, hideInMenu: false,
menuOrder: 0, menuOrder: '0',
permissions: [], permissions: [],
order: 0, order: 0,
showInMenu: false showInMenu: false
@ -182,11 +182,11 @@
const typeOptions = computed(() => [ const typeOptions = computed(() => [
{ {
label: '菜单', label: '菜单',
value: '1', value: 1,
}, },
{ {
label: '权限', label: '权限',
value: '2', value: 2,
}, },
]); ]);
@ -195,8 +195,6 @@
// //
const handleClick = () => { const handleClick = () => {
setVisible(true); setVisible(true);
console.log(props.menuData);
console.log(props.menu);
}; };
// //

View File

@ -223,6 +223,7 @@
try { try {
const res = await queryMenuList(formModel.value.name || 'all'); const res = await queryMenuList(formModel.value.name || 'all');
renderData.value = res.data; renderData.value = res.data;
} catch (err) { } catch (err) {
// you can report use errorHandler or other // you can report use errorHandler or other
} finally { } finally {

View File

@ -25,84 +25,84 @@
<a-form ref="CreateRef" :model="formData" :style="{ width: '650px' }"> <a-form ref="CreateRef" :model="formData" :style="{ width: '650px' }">
<a-form-item <a-form-item
field="username" field="username"
:label="$t('user.info.username')" label="用户名"
:validate-trigger="['change', 'input']" :validate-trigger="['change', 'input']"
:rules="[ :rules="[
{ required: true, message: t('user.info.username.required') }, { required: true, message: '用户名不能为空' },
{ {
match: /^[a-zA-Z0-9\u4e00-\u9fa5]{1,20}$/, match: /^[a-zA-Z0-9\u4e00-\u9fa5]{1,20}$/,
message: t('user.info.username.format'), message: '请输入正确格式的用户名',
}, },
]" ]"
> >
<a-input <a-input
v-if="props.isCreate" v-if="props.isCreate"
v-model="formData.username" v-model="formData.username"
:placeholder="$t('user.info.username.placeholder')" placeholder="请输入用户名"
/> />
<div v-else>{{ formData.username }}</div> <div v-else>{{ formData.username }}</div>
</a-form-item> </a-form-item>
<a-form-item <a-form-item
field="email" field="email"
:label="$t('user.info.email')" label="Email"
:rules="[ :rules="[
{ {
required: true, required: true,
type: 'email', type: 'email',
message: t('user.info.email.required'), message: 'Email不能为空',
}, },
]" ]"
:validate-trigger="['change', 'input']" :validate-trigger="['change', 'input']"
> >
<a-input <a-input
v-model="formData.email" v-model="formData.email"
:placeholder="$t('user.info.email.placeholder')" placeholder="请输入Email"
/> />
</a-form-item> </a-form-item>
<a-form-item <a-form-item
field="phone" field="phone"
:label="$t('user.info.phone')" label="电话"
:rules="[ :rules="[
{ required: true, message: t('user.info.phone.required') }, { required: true, message: '电话不能为空' },
{ match: /^1[3-9]\d{9}$/, message: t('user.info.phone.format') }, { match: /^1[3-9]\d{9}$/, message: '请输入正确格式的电话' },
]" ]"
:validate-trigger="['change', 'input']" :validate-trigger="['change', 'input']"
> >
<a-input <a-input
v-model="formData.phone" v-model="formData.phone"
:placeholder="$t('user.info.phone.placeholder')" placeholder="请输入电话"
/> />
</a-form-item> </a-form-item>
<a-form-item <a-form-item
field="password" field="password"
:label="$t('user.info.password')" label="密码"
v-if="isCreate" v-if="isCreate"
:validate-trigger="['change', 'input']" :validate-trigger="['change', 'input']"
:rules="[{ required: true, message: t('user.info.password.required') }]" :rules="[{ required: true, message: '密码不能为空' }]"
> >
<a-input <a-input
v-model="formData.password" v-model="formData.password"
:placeholder="$t('user.info.password.placeholder')" placeholder="请输入密码"
/> />
</a-form-item> </a-form-item>
<a-form-item field="nickName" :label="$t('user.info.nickName')"> <a-form-item field="nickName" label="昵称">
<a-input <a-input
v-model="formData.nickName" v-model="formData.nickName"
:placeholder="$t('user.info.nickName.placeholder')" placeholder="请输入昵称"
/> />
</a-form-item> </a-form-item>
<a-form-item field="address" :label="$t('user.info.address')"> <a-form-item field="address" label="地址">
<a-input <a-input
v-model="formData.address" v-model="formData.address"
:placeholder="$t('user.info.address.placeholder')" placeholder="请输入地址"
/> />
</a-form-item> </a-form-item>
<a-form-item <a-form-item
field="deptId" field="deptId"
:label="$t('user.info.dept')" label="部门"
:rules="[{ required: true, message: t('user.info.dept.required') }]" :rules="[{ required: true, message: '部门不能为空' }]"
:validate-trigger="['change']" :validate-trigger="['change']"
> >
<a-tree-select <a-tree-select
@ -114,14 +114,14 @@
}" }"
:data="deptOptions" :data="deptOptions"
allow-clear allow-clear
:placeholder="$t('user.info.dept.placeholder')" placeholder="请选择所属部门"
/> />
</a-form-item> </a-form-item>
<a-form-item <a-form-item
field="roleId" field="roleId"
:label="$t('user.info.role')" label="角色"
:rules="[{ required: true, message: t('user.info.dept.required') }]" :rules="[{ required: true, message: '角色不能为空' }]"
:validate-trigger="['change']" :validate-trigger="['change']"
> >
<a-select <a-select
@ -131,7 +131,7 @@
value: 'id', value: 'id',
label: 'name', label: 'name',
}" }"
:placeholder="$t('user.info.role.placeholder')" placeholder="请选择角色"
/> />
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -139,13 +139,12 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import useVisible from '@/hooks/visible'; import useVisible from '@/hooks/visible';
import { computed, PropType, ref } from 'vue'; import { computed, PropType, ref } from 'vue';
import { CreateRecord } from '@/api/user'; import { CreateRecord } from '@/api/user';
import { FormInstance } from '@arco-design/web-vue/es/form'; import { FormInstance } from '@arco-design/web-vue/es/form';
import { queryRoleList } from '@/api/role'; import { queryRoleList } from '@/api/role';
import { deptList, getAllDeptTree } from '@/api/dept'; import { getAllDeptTree } from '@/api/dept';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import { useUserStore } from '@/store'; import { useUserStore } from '@/store';
@ -155,9 +154,9 @@ const props = defineProps({
}, },
isCreate: Boolean, isCreate: Boolean,
}); });
const { t } = useI18n(); const emit = defineEmits(['refresh']);
const modalTitle = computed(() => { const modalTitle = computed(() => {
return props.isCreate ? t('createUser') : t('editUser'); return props.isCreate ? '新建用户' : '编辑用户';
}); });
const { visible, setVisible } = useVisible(false); const { visible, setVisible } = useVisible(false);
const checkKeys = ref<number[]>([]); const checkKeys = ref<number[]>([]);
@ -165,6 +164,8 @@ const checkKeys = ref<number[]>([]);
const CreateRef = ref<FormInstance>(); const CreateRef = ref<FormInstance>();
const formData = ref<CreateRecord>({ const formData = ref<CreateRecord>({
value: undefined,
code: undefined,
username: '', username: '',
nickName: '', nickName: '',
password: '', password: '',
@ -231,7 +232,7 @@ const handleSubmit = async () => {
const res = await userStore.createUser(formData.value); const res = await userStore.createUser(formData.value);
if (res.status === 200) { if (res.status === 200) {
Message.success({ Message.success({
content: t('create.sucess'), content: '新建成功',
duration: 5 * 1000, duration: 5 * 1000,
}); });
} }
@ -241,7 +242,7 @@ const handleSubmit = async () => {
formDifer = diffDataForm(formData.value, formDifer); formDifer = diffDataForm(formData.value, formDifer);
if (Object.keys(formDifer).length === 0) { if (Object.keys(formDifer).length === 0) {
Message.success({ Message.success({
content: t('unmodified'), content: '未编辑',
duration: 3 * 1000, duration: 3 * 1000,
}); });
} else { } else {
@ -249,13 +250,14 @@ const handleSubmit = async () => {
const res = await userStore.updateUser(formDifer); const res = await userStore.updateUser(formDifer);
if (res.status === 200) { if (res.status === 200) {
Message.success({ Message.success({
content: t('modify.sucess'), content: '修改成功',
duration: 5 * 1000, duration: 5 * 1000,
}); });
} }
} }
} }
checkKeys.value = []; checkKeys.value = [];
emit('refresh');
setVisible(false); setVisible(false);
} }
}; };

View File

@ -32,11 +32,11 @@
<a-col :span="9"> <a-col :span="9">
<a-form-item <a-form-item
field="username" field="username"
:label="$t('searchTable.form.username')" label="用户名"
> >
<a-input <a-input
v-model="formModel.username" v-model="formModel.username"
:placeholder="$t('searchTable.form.username.placeholder')" placeholder="请输入用户名"
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -44,34 +44,34 @@
<a-col :span="9"> <a-col :span="9">
<a-form-item <a-form-item
field="phone" field="phone"
:label="$t('searchTable.form.phone')" label="电话号码"
> >
<a-input <a-input
v-model="formModel.phone" v-model="formModel.phone"
:placeholder="$t('searchTable.form.phone.placeholder')" placeholder="请输入电话号码"
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="9"> <a-col :span="9">
<a-form-item <a-form-item
field="email" field="email"
:label="$t('searchTable.form.email')" label="Email"
> >
<a-input <a-input
v-model="formModel.email" v-model="formModel.email"
:placeholder="$t('searchTable.form.email.placeholder')" placeholder="请输入Email"
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="9"> <a-col :span="9">
<a-form-item <a-form-item
field="enableState" field="enableState"
:label="$t('searchTable.form.status')" label="请选择状态"
> >
<a-select <a-select
v-model="formModel.enableState" v-model="formModel.enableState"
:options="statusOptions" :options="statusOptions"
:placeholder="$t('searchTable.form.status.placeholder')" placeholder="请选择状态"
/> />
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -85,13 +85,13 @@
<template #icon> <template #icon>
<icon-search /> <icon-search />
</template> </template>
{{ $t('searchTable.form.search') }} 查询
</a-button> </a-button>
<a-button @click="reset"> <a-button @click="reset">
<template #icon> <template #icon>
<icon-refresh /> <icon-refresh />
</template> </template>
{{ $t('searchTable.form.reset') }} 重置
</a-button> </a-button>
</a-space> </a-space>
</a-col> </a-col>
@ -107,7 +107,7 @@
<template #icon> <template #icon>
<icon-download size="18" /> <icon-download size="18" />
</template> </template>
{{ $t('searchTable.operation.download') }} 导出
</a-button> </a-button>
</a-col> </a-col>
<a-col <a-col
@ -119,14 +119,14 @@
padding-bottom: 20px; padding-bottom: 20px;
" "
> >
<a-tooltip :content="$t('searchTable.actions.refresh')"> <a-tooltip content="刷新">
<div class="action-icon" @click="search"> <div class="action-icon" @click="search">
<icon-refresh size="18" /> <icon-refresh size="18" />
</div> </div>
</a-tooltip> </a-tooltip>
<a-dropdown @select="handleSelectDensity"> <a-dropdown @select="handleSelectDensity">
<a-tooltip :content="$t('searchTable.actions.density')"> <a-tooltip content="密度">
<div class="action-icon"><icon-line-height size="18" /></div> <div class="action-icon"><icon-line-height size="18" /></div>
</a-tooltip> </a-tooltip>
<template #content> <template #content>
@ -141,7 +141,7 @@
</template> </template>
</a-dropdown> </a-dropdown>
<a-tooltip :content="$t('searchTable.actions.columnSetting')"> <a-tooltip content="列设置">
<a-popover <a-popover
trigger="click" trigger="click"
position="bl" position="bl"
@ -245,10 +245,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onMounted, ref, watch } from 'vue'; import { computed, onMounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import useLoading from '@/hooks/loading'; import useLoading from '@/hooks/loading';
import { UserRecord, UserParams } from '@/api/user'; import { UserRecord, UserParams } from '@/api/user';
import { getAllDeptTree } from '@/api/dept'; // import { getAllDeptTree } from '@/api/dept';
import { Pagination } from '@/types/global'; import { Pagination } from '@/types/global';
import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface'; import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface'; import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
@ -272,7 +271,6 @@ const generateFormModel = () => {
}; };
const { loading, setLoading } = useLoading(true); const { loading, setLoading } = useLoading(true);
const { t } = useI18n();
const renderData = ref<UserRecord[]>([]); const renderData = ref<UserRecord[]>([]);
const formModel = ref(generateFormModel()); const formModel = ref(generateFormModel());
@ -298,66 +296,66 @@ const pagination: Pagination = {
const columns = computed<TableColumnData[]>(() => [ const columns = computed<TableColumnData[]>(() => [
{ {
title: t('userTable.columns.index'), title: '序号',
dataIndex: 'index', dataIndex: 'index',
slotName: 'index', slotName: 'index',
width: 60, width: 60,
}, },
{ {
title: t('userTable.columns.username'), title: '用户名',
dataIndex: 'username', dataIndex: 'username',
sortable: { sortable: {
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
}, },
}, },
{ {
title: t('userTable.columns.phone'), title: '电话',
dataIndex: 'phone', dataIndex: 'phone',
sortable: { sortable: {
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
}, },
}, },
{ {
title: t('userTable.columns.email'), title: '邮箱',
dataIndex: 'email', dataIndex: 'email',
sortable: { sortable: {
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
}, },
}, },
{ {
title: t('userTable.columns.nickName'), title: '昵称',
dataIndex: 'nickName', dataIndex: 'nickName',
sortable: { sortable: {
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
}, },
}, },
{ {
title: t('userTable.columns.address'), title: '地址',
dataIndex: 'address', dataIndex: 'address',
width: 180, width: 180,
}, },
{ {
title: t('userTable.columns.enabled'), title: '是否启用',
dataIndex: 'enableState', dataIndex: 'enableState',
slotName: 'enableState', slotName: 'enableState',
}, },
{ {
title: t('searchTable.columns.operations'), title: '操作',
dataIndex: 'operations', dataIndex: 'operations',
slotName: 'operations', slotName: 'operations',
}, },
]); ]);
const statusOptions = computed<SelectOptionData[]>(() => [ const statusOptions = computed<SelectOptionData[]>(() => [
{ {
label: t('searchTable.form.status.enable'), label: '启用',
value: 'true', value: 'true',
}, },
{ {
label: t('searchTable.form.status.disable'), label: '停用',
value: 'false', value: 'false',
}, },
]); ]);
const deptTreeData = ref<any[]>([]); // const deptTreeData = ref<any[]>([]);
// //
const fetchData = async ( const fetchData = async (
@ -379,12 +377,12 @@ const fetchData = async (
}; };
// //
const getDeptTree = async () => { // const getDeptTree = async () => {
const res = await getAllDeptTree(0); // const res = await getAllDeptTree(0);
if (res.status === 200) { // if (res.status === 200) {
deptTreeData.value = res.data; // deptTreeData.value = res.data;
} // }
} // }
// //
const generateExcel = () => { const generateExcel = () => {
@ -420,14 +418,13 @@ const onPageChange = (current: number) => {
}; };
// //
const onSizeChange = (size: number) => { // const onSizeChange = (size: number) => {
pagination.size = size; // pagination.size = size;
search(); // search();
}; // };
onMounted(() => { onMounted(() => {
search(); search();
// getDeptTree()
}) })
// //
@ -446,27 +443,27 @@ const enabledStatus = async (record: any) => {
const res = await userStore.enabledUser(record.id); const res = await userStore.enabledUser(record.id);
if (res.status === 200) { if (res.status === 200) {
Message.success({ Message.success({
content: t('modify.status.sucess'), content: '修改状态成功',
duration: 3 * 1000, duration: 3 * 1000,
}); });
} else { } else {
Message.error({ Message.error({
content: t('modify.status.fail'), content: '修改状态失败',
duration: 3 * 1000, duration: 3 * 1000,
}); });
} }
}; };
const generateQueryParams = () => { // const generateQueryParams = () => {
return { // return {
pageNum: 1, // pageNum: 1,
pageSize: 10, // pageSize: 10,
userName: undefined, // userName: undefined,
phonenumber: undefined, // phonenumber: undefined,
status: undefined, // status: undefined,
deptId: undefined, // deptId: undefined,
params: undefined, // params: undefined,
}; // };
}; // };
const handleSelectDept = (id: any[]) => { const handleSelectDept = (id: any[]) => {
const [deptId] = id; const [deptId] = id;
formModel.value.deptId = deptId; formModel.value.deptId = deptId;

View File

@ -45,7 +45,7 @@
const renderData = ref<any>([]); const renderData = ref<any>([]);
// const attachmentList = ref<any>([]); // const attachmentList = ref<any>([]);
const fetchData = async (Id: number) => { const fetchData = async (Id: number) => {
const res = await bulletinStore.queryBulletinListAll(Id); const res = await bulletinStore.queryBulletinDetail(Id);
// attachmentList.value = await bulletinStore.queryAttachmentInfo( // attachmentList.value = await bulletinStore.queryAttachmentInfo(
// '28452d83420650425d45110c6417bf693b966b29' // '28452d83420650425d45110c6417bf693b966b29'
// ); // );

View File

@ -45,7 +45,7 @@
const renderData = ref<any>([]); const renderData = ref<any>([]);
// const attachmentList = ref<any>([]); // const attachmentList = ref<any>([]);
const fetchData = async (Id: number) => { const fetchData = async (Id: number) => {
const res = await bulletinStore.queryBulletinListAll(Id); const res = await bulletinStore.queryBulletinDetail(Id);
// attachmentList.value = await bulletinStore.queryAttachmentInfo( // attachmentList.value = await bulletinStore.queryAttachmentInfo(
// '28452d83420650425d45110c6417bf693b966b29' // '28452d83420650425d45110c6417bf693b966b29'
// ); // );

View File

@ -75,7 +75,6 @@
:columns="(cloneColumns as TableColumnData[])" :columns="(cloneColumns as TableColumnData[])"
:data="renderData" :data="renderData"
:bordered="false" :bordered="false"
:size="sizeof"
:style="highlightRow" :style="highlightRow"
style="margin-bottom: 40px" style="margin-bottom: 40px"
:filter-icon-align-left="alignLeft" :filter-icon-align-left="alignLeft"
@ -105,7 +104,6 @@
<a-pagination <a-pagination
style="float: right; position: relative; right: 1px; bottom: 25px" style="float: right; position: relative; right: 1px; bottom: 25px"
:total="pagination.total" :total="pagination.total"
:size="sizeof"
show-total show-total
show-jumper show-jumper
show-page-size show-page-size
@ -122,7 +120,7 @@
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import useLoading from '@/hooks/loading'; import useLoading from '@/hooks/loading';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { Pagination } from '@/types/global'; import usePagination from '@/hooks/pagination';
import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface'; import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface'; import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
import { useBulletinsStore } from '@/store'; import { useBulletinsStore } from '@/store';
@ -138,6 +136,7 @@
publishTimeEnd: '', publishTimeEnd: '',
}; };
}; };
const { pagination,setPagination } = usePagination(true);
const { loading, setLoading } = useLoading(true); const { loading, setLoading } = useLoading(true);
const renderData = ref<BulletinsRecord[]>([]); const renderData = ref<BulletinsRecord[]>([]);
@ -145,21 +144,11 @@
const { const {
cloneColumns, cloneColumns,
showColumns,
densityList,
handleSelectDensity,
handleChange,
popupVisibleChange,
deepClone, deepClone,
} = useTableOption(); } = useTableOption();
const sizeof=useTableOption().size;
const bulletinsStore = useBulletinsStore(); const bulletinsStore = useBulletinsStore();
const pagination: any = {
size: 10,
current: 1
};
const columns = computed<TableColumnData[]>(() => [ const columns = computed<TableColumnData[]>(() => [
{ {
@ -204,9 +193,7 @@
try { try {
const res = await bulletinsStore.getBulletinsList(params); const res = await bulletinsStore.getBulletinsList(params);
renderData.value = res.data.records; renderData.value = res.data.records;
pagination.page = res.data.page; setPagination(res.data);
pagination.current = res.data.current;
pagination.total = res.data.total;
} catch (err) { } catch (err) {
// you can report use errorHandler or other // you can report use errorHandler or other
} finally { } finally {

View File

@ -39,17 +39,17 @@
</a-form-item> </a-form-item>
<a-form-item <a-form-item
field="nickName" field="nickName"
:label="$t('user.info.nickName')" label="昵称"
:rules="[ :rules="[
{ {
required: true, required: true,
message: $t('userSetting.form.error.nickname.required'), message: '请输入昵称',
}, },
]" ]"
> >
<a-input <a-input
v-model="formData.nickName" v-model="formData.nickName"
:placeholder="$t('userSetting.basicInfo.placeholder.nickname')" placeholder="请输入昵称"
/> />
</a-form-item> </a-form-item>
<a-form-item <a-form-item

View File

@ -18,6 +18,7 @@
$t('userSetting.passwordReset.form.label.newPassword.placeholder') $t('userSetting.passwordReset.form.label.newPassword.placeholder')
" "
allow-clear allow-clear
autocomplete="new-password"
> >
</a-input-password> </a-input-password>
</a-form-item> </a-form-item>
@ -33,6 +34,7 @@
$t('userSetting.passwordReset.form.label.confirmPassword.placeholder') $t('userSetting.passwordReset.form.label.confirmPassword.placeholder')
" "
allow-clear allow-clear
autocomplete="new-password"
> >
</a-input-password> </a-input-password>
</a-form-item> </a-form-item>