新增系统模块注释
This commit is contained in:
parent
857bdfe37f
commit
2b53c953c8
@ -73,6 +73,10 @@
|
||||
import { onMounted, reactive, ref, shallowRef } from 'vue';
|
||||
import { message, buildTree } from '@/utils/auth';
|
||||
import { useLockFn } from '@/utils/useLockFn';
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -89,6 +93,10 @@
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义选项数据
|
||||
*/
|
||||
const optionData = reactive({
|
||||
deptTypeList: [
|
||||
{
|
||||
@ -111,6 +119,10 @@
|
||||
});
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const formRef = shallowRef<FormInstance>();
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
//父级id
|
||||
@ -121,23 +133,36 @@
|
||||
name: '',
|
||||
//排序
|
||||
sort: 0,
|
||||
// 备注
|
||||
note: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
/**
|
||||
* 定义上级部门数据选项
|
||||
*/
|
||||
const deptOptions = ref<any[]>([]);
|
||||
|
||||
const getMenu = async () => {
|
||||
/**
|
||||
* 获取部门数据
|
||||
*/
|
||||
const getDept = async () => {
|
||||
const data: any = await getDeptList();
|
||||
const menu: any = [{ id: 0, name: '顶级', children: [] }];
|
||||
const dept: any = [{ id: 0, name: '顶级', children: [] }];
|
||||
const lists = buildTree(data);
|
||||
menu[0].children.push(...lists);
|
||||
deptOptions.value = menu;
|
||||
dept[0].children.push(...lists);
|
||||
deptOptions.value = dept;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行提交表单数据
|
||||
*/
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate();
|
||||
props.deptId ? await deptUpdate(formData) : await deptAdd(formData);
|
||||
@ -148,6 +173,10 @@
|
||||
|
||||
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
* @param data 参数
|
||||
*/
|
||||
const setFormData = (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
@ -156,13 +185,19 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取部门详情
|
||||
*/
|
||||
const getDetail = async () => {
|
||||
const data = await getDeptDetail(props.deptId);
|
||||
setFormData(data);
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
getMenu();
|
||||
getDept();
|
||||
if (props.deptId) {
|
||||
getDetail();
|
||||
} else {
|
||||
|
@ -98,6 +98,9 @@
|
||||
const pid = ref(0);
|
||||
const lists = ref([]);
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
*/
|
||||
const getLists = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
@ -109,6 +112,10 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*执行添加
|
||||
* @param parentId 上级ID
|
||||
*/
|
||||
const handleAdd = async (parentId: any) => {
|
||||
deptId.value = 0;
|
||||
pid.value = parentId ? parentId : 0;
|
||||
@ -116,12 +123,20 @@
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
* @param data 参数
|
||||
*/
|
||||
const handleEdit = async (data: any) => {
|
||||
deptId.value = data.id;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param deptId 部门ID
|
||||
*/
|
||||
const handleDelete = async (deptId: number) => {
|
||||
await confirm('确定要删除?');
|
||||
try {
|
||||
@ -134,11 +149,19 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行扩展、收缩
|
||||
*/
|
||||
const handleExpand = () => {
|
||||
isExpand.value = !isExpand.value;
|
||||
toggleExpand(lists.value, isExpand.value);
|
||||
};
|
||||
|
||||
/**
|
||||
* 扩展、收缩函数实现
|
||||
* @param children 子级数据
|
||||
* @param unfold
|
||||
*/
|
||||
const toggleExpand = (children: any[], unfold = true) => {
|
||||
for (const key in children) {
|
||||
tableRef.value?.toggleRowExpansion(children[key], unfold);
|
||||
@ -148,10 +171,16 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取全部数据
|
||||
*/
|
||||
const getAll = () => {
|
||||
getLists();
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
getAll();
|
||||
});
|
||||
|
@ -41,6 +41,10 @@
|
||||
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const formRef = shallowRef<FormInstance>();
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
@ -48,6 +52,9 @@
|
||||
sort: 0,
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -61,6 +68,9 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
*/
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate();
|
||||
props.levelId ? await levelUpdate(formData) : await levelAdd(formData);
|
||||
@ -69,12 +79,18 @@
|
||||
emit('success');
|
||||
};
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
*/
|
||||
const setFormData = async () => {
|
||||
const data = await getLevelDetail(props.levelId);
|
||||
for (const key in formData) {
|
||||
@ -85,6 +101,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
if (props.levelId) {
|
||||
setFormData();
|
||||
|
@ -94,20 +94,40 @@
|
||||
import { PlusOutlined } from '@vicons/antd';
|
||||
import { message, confirm, loading, closeLoading } from '@/utils/auth';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
|
||||
// 导入编辑组件
|
||||
const editDialog = defineAsyncComponent(() => import('./edit.vue'));
|
||||
|
||||
/**
|
||||
* 定义参数变量
|
||||
*/
|
||||
const levelId = ref(0);
|
||||
const upload = ref<UploadInstance>();
|
||||
const exportLoading = ref(false);
|
||||
const editVisible = ref(false);
|
||||
const selectionData = ref([]);
|
||||
const tableRef = ref();
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
// 职级名称
|
||||
name: '',
|
||||
// 职级状态
|
||||
status: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 上传请求头设置
|
||||
*/
|
||||
const uploadHeaders = reactive({
|
||||
authorization: useUserStore().getToken,
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
label: '操作',
|
||||
@ -137,14 +157,25 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
*/
|
||||
const loadDataTable = async (res: any) => {
|
||||
const result = await getLevelList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
*刷新数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
labelWidth: 80,
|
||||
layout: 'horizontal',
|
||||
@ -152,6 +183,11 @@
|
||||
submitOnReset: true,
|
||||
schemas,
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
handleReset();
|
||||
for (const key in values) {
|
||||
@ -160,23 +196,38 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
*/
|
||||
function handleReset() {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行添加
|
||||
*/
|
||||
const handleAdd = async () => {
|
||||
levelId.value = 0;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
* @param record 参数
|
||||
*/
|
||||
const handleEdit = async (record: Recordable) => {
|
||||
levelId.value = record.row.id;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param record 参数
|
||||
*/
|
||||
async function handleDelete(record: Recordable) {
|
||||
let ids = [];
|
||||
if (!record) {
|
||||
@ -187,9 +238,19 @@
|
||||
message('删除成功');
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 选项发生变化
|
||||
* @param value 参数
|
||||
*/
|
||||
function onSelectionChange(value) {
|
||||
selectionData.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传之前
|
||||
* @param file 文件
|
||||
*/
|
||||
const beforeUpload = (file: UploadFile) => {
|
||||
const isLt2M = file.size / 1024 / 1024 < 200;
|
||||
if (!isLt2M) {
|
||||
@ -203,6 +264,10 @@
|
||||
loading('上传中');
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* 上传成功处理
|
||||
* @param file 文件
|
||||
*/
|
||||
const onSuccess = (file: UploadFile) => {
|
||||
upload.value!.clearFiles();
|
||||
closeLoading();
|
||||
@ -213,12 +278,18 @@
|
||||
message(file.msg ? file.msg : '导入失败', 'error');
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 上传失败处理
|
||||
*/
|
||||
const onError = () => {
|
||||
upload.value!.clearFiles();
|
||||
closeLoading();
|
||||
message('导入失败', 'error');
|
||||
};
|
||||
//导出
|
||||
|
||||
/**
|
||||
* 执行导出
|
||||
*/
|
||||
const handleExport = async () => {
|
||||
exportLoading.value = true;
|
||||
const data = await levelExport();
|
||||
|
@ -53,11 +53,19 @@
|
||||
const editVisible = ref(false);
|
||||
const selectionData = ref([]);
|
||||
const tableRef = ref();
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
username: '',
|
||||
type: '',
|
||||
status: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
label: '操作',
|
||||
@ -71,7 +79,7 @@
|
||||
label: '详情',
|
||||
icon: 'View',
|
||||
type: 'warning',
|
||||
onClick: handleInfo.bind(null, record),
|
||||
onClick: handleDetail.bind(null, record),
|
||||
auth: ['sys:loginLog:detail'],
|
||||
},
|
||||
{
|
||||
@ -86,14 +94,24 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载数据表
|
||||
*/
|
||||
const loadDataTable = async (res: any) => {
|
||||
const result = await getLoginLogList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 刷新数据表
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
labelWidth: 80,
|
||||
layout: 'horizontal',
|
||||
@ -101,6 +119,11 @@
|
||||
submitOnReset: true,
|
||||
schemas,
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
handleReset();
|
||||
for (const key in values) {
|
||||
@ -109,17 +132,28 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
*/
|
||||
function handleReset() {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
}
|
||||
}
|
||||
const handleInfo = async (record: Recordable) => {
|
||||
|
||||
/**
|
||||
* 执行查询详情
|
||||
* @param record 参数
|
||||
*/
|
||||
const handleDetail = async (record: Recordable) => {
|
||||
loginlogId.value = record.row.id;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
*/
|
||||
async function handleDelete(record: Recordable) {
|
||||
let ids = [];
|
||||
if (!record) {
|
||||
@ -130,6 +164,11 @@
|
||||
message('删除成功');
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 选项发生变量
|
||||
* @param value 参数
|
||||
*/
|
||||
function onSelectionChange(value) {
|
||||
selectionData.value = value;
|
||||
}
|
||||
|
@ -55,6 +55,9 @@
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const formData = ref({});
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -68,16 +71,26 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
*/
|
||||
const setFormData = async () => {
|
||||
const data = await getLoginLogDetail(props.loginlogId);
|
||||
formData.value = data;
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
// 组件挂载后执行的代码
|
||||
if (props.loginlogId) {
|
||||
setFormData();
|
||||
}
|
||||
|
@ -53,10 +53,18 @@
|
||||
const editVisible = ref(false);
|
||||
const selectionData = ref([]);
|
||||
const tableRef = ref();
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
title: '',
|
||||
status: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
label: '操作',
|
||||
@ -70,7 +78,7 @@
|
||||
label: '详情',
|
||||
icon: 'View',
|
||||
type: 'warning',
|
||||
onClick: handleInfo.bind(null, record),
|
||||
onClick: handleDetail.bind(null, record),
|
||||
auth: ['sys:operLog:detail'],
|
||||
},
|
||||
{
|
||||
@ -85,14 +93,25 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
*/
|
||||
const loadDataTable = async (res: any) => {
|
||||
const result = await getOperLogList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 刷新数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
labelWidth: 80,
|
||||
layout: 'horizontal',
|
||||
@ -100,6 +119,11 @@
|
||||
submitOnReset: true,
|
||||
schemas,
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交表达那
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
handleReset();
|
||||
for (const key in values) {
|
||||
@ -108,17 +132,29 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
*/
|
||||
function handleReset() {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
}
|
||||
}
|
||||
const handleInfo = async (record: Recordable) => {
|
||||
|
||||
/**
|
||||
* 执行查询详情
|
||||
* @param record 参数
|
||||
*/
|
||||
const handleDetail = async (record: Recordable) => {
|
||||
operlogId.value = record.row.id;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param record 参数
|
||||
*/
|
||||
async function handleDelete(record: Recordable) {
|
||||
let ids = [];
|
||||
if (!record) {
|
||||
@ -129,6 +165,11 @@
|
||||
message('删除成功');
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 选项发生变化
|
||||
* @param value 参数
|
||||
*/
|
||||
function onSelectionChange(value) {
|
||||
selectionData.value = value;
|
||||
}
|
||||
|
@ -55,6 +55,9 @@
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const formData = ref({});
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -68,16 +71,26 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
*/
|
||||
const setFormData = async () => {
|
||||
const data = await getOperLogDetail(props.operlogId);
|
||||
formData.value = data;
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
// 组件挂载后执行的代码
|
||||
if (props.operlogId) {
|
||||
setFormData();
|
||||
}
|
||||
|
@ -126,6 +126,10 @@
|
||||
import { treeToArray, message, buildTree } from '@/utils/auth';
|
||||
import { useLockFn } from '@/utils/useLockFn';
|
||||
import IconPicker from '@/components/icon/picker.vue';
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -155,6 +159,9 @@
|
||||
cb(results.map((item) => ({ value: item })));
|
||||
};
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
//父级id
|
||||
@ -186,6 +193,9 @@
|
||||
|
||||
const menuOptions = ref<any[]>([]);
|
||||
|
||||
/**
|
||||
* 获取菜单数据
|
||||
*/
|
||||
const getMenu = async () => {
|
||||
const data: any = await getMenuList();
|
||||
const menu: any = { id: 0, name: '顶级', children: [] };
|
||||
@ -194,6 +204,9 @@
|
||||
menuOptions.value.push(menu);
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
*/
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate();
|
||||
props.menuId ? await menuUpdate(formData) : await menuAdd(formData);
|
||||
@ -204,6 +217,9 @@
|
||||
|
||||
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
*/
|
||||
const setFormData = (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
@ -217,11 +233,11 @@
|
||||
setFormData(data);
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close');
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
// 组件挂载后执行的代码
|
||||
getMenu();
|
||||
if (props.menuId) {
|
||||
getDetail();
|
||||
|
@ -127,6 +127,9 @@
|
||||
const pid = ref(0);
|
||||
const lists = ref([]);
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
const getLists = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
@ -138,6 +141,10 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行添加
|
||||
* @param parentId 上级ID
|
||||
*/
|
||||
const handleAdd = async (parentId: any) => {
|
||||
menuId.value = 0;
|
||||
pid.value = parentId ? parentId : 0;
|
||||
@ -145,6 +152,10 @@
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
* @param data 参数
|
||||
*/
|
||||
const handleEdit = async (data: any) => {
|
||||
menuId.value = data.id;
|
||||
await nextTick();
|
||||
@ -163,11 +174,17 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行扩展、收缩
|
||||
*/
|
||||
const handleExpand = () => {
|
||||
isExpand.value = !isExpand.value;
|
||||
toggleExpand(lists.value, isExpand.value);
|
||||
};
|
||||
|
||||
/**
|
||||
* 扩展、收缩实现
|
||||
*/
|
||||
const toggleExpand = (children: any[], unfold = true) => {
|
||||
for (const key in children) {
|
||||
tableRef.value?.toggleRowExpansion(children[key], unfold);
|
||||
@ -177,11 +194,18 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取全部数据
|
||||
*/
|
||||
const getAll = () => {
|
||||
getLists();
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
// 组件挂载后执行的代码
|
||||
getAll();
|
||||
});
|
||||
|
||||
|
@ -41,6 +41,10 @@
|
||||
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const formRef = shallowRef<FormInstance>();
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
@ -48,6 +52,9 @@
|
||||
sort: 0,
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -61,6 +68,9 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
*/
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate();
|
||||
props.positionId ? await positionUpdate(formData) : await positionAdd(formData);
|
||||
@ -69,12 +79,18 @@
|
||||
emit('success');
|
||||
};
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
*/
|
||||
const setFormData = async () => {
|
||||
const data = await getPositionDetail(props.positionId);
|
||||
for (const key in formData) {
|
||||
@ -85,6 +101,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
if (props.positionId) {
|
||||
setFormData();
|
||||
|
@ -62,10 +62,18 @@
|
||||
const editVisible = ref(false);
|
||||
const selectionData = ref([]);
|
||||
const tableRef = ref();
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
name: '',
|
||||
status: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
label: '操作',
|
||||
@ -94,14 +102,26 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
* @param res 参数
|
||||
*/
|
||||
const loadDataTable = async (res: any) => {
|
||||
const result = await getPositionList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 刷新数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
labelWidth: 80,
|
||||
layout: 'horizontal',
|
||||
@ -109,6 +129,10 @@
|
||||
submitOnReset: true,
|
||||
schemas,
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
handleReset();
|
||||
for (const key in values) {
|
||||
@ -117,23 +141,38 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
*/
|
||||
function handleReset() {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行添加
|
||||
*/
|
||||
const handleAdd = async () => {
|
||||
positionId.value = 0;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
* @param record 参数
|
||||
*/
|
||||
const handleEdit = async (record: Recordable) => {
|
||||
positionId.value = record.row.id;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param record 参数
|
||||
*/
|
||||
async function handleDelete(record: Recordable) {
|
||||
let ids = [];
|
||||
if (!record) {
|
||||
@ -144,6 +183,11 @@
|
||||
message('删除成功');
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 选项发生变化
|
||||
* @param value 参数
|
||||
*/
|
||||
function onSelectionChange(value) {
|
||||
selectionData.value = value;
|
||||
}
|
||||
|
@ -43,6 +43,16 @@
|
||||
import { nextTick, onMounted, ref, shallowRef } from 'vue';
|
||||
import { useLockFn } from '@/utils/useLockFn';
|
||||
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const treeRef = shallowRef<InstanceType<typeof ElTree>>();
|
||||
const formRef = shallowRef<FormInstance>();
|
||||
const isExpand = ref(false);
|
||||
const menuArray = ref<any[]>([]);
|
||||
const menuTree = ref<any[]>([]);
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -55,12 +65,6 @@
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const treeRef = shallowRef<InstanceType<typeof ElTree>>();
|
||||
const formRef = shallowRef<FormInstance>();
|
||||
const isExpand = ref(false);
|
||||
const menuArray = ref<any[]>([]);
|
||||
const menuTree = ref<any[]>([]);
|
||||
|
||||
// 获取所有选择的节点
|
||||
const getDeptAllCheckedKeys = () => {
|
||||
@ -70,6 +74,9 @@
|
||||
return checkedKeys;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行扩展、收缩
|
||||
*/
|
||||
const handleExpand = (check: CheckboxValueType) => {
|
||||
const treeList = menuTree.value;
|
||||
for (let i = 0; i < treeList.length; i++) {
|
||||
@ -77,6 +84,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行选中全部
|
||||
*/
|
||||
const handleSelectAll = (check: CheckboxValueType) => {
|
||||
if (check) {
|
||||
treeRef.value?.setCheckedKeys(menuArray.value.map((item) => item.id));
|
||||
@ -85,6 +95,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
*/
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate();
|
||||
const menuIds = getDeptAllCheckedKeys()!;
|
||||
@ -96,10 +109,16 @@
|
||||
|
||||
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
*/
|
||||
const setFormData = async () => {
|
||||
const data = await getRoleMenuList(props.roleId);
|
||||
menuTree.value = buildTree(data);
|
||||
@ -113,6 +132,9 @@
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
setFormData();
|
||||
});
|
||||
|
@ -45,6 +45,10 @@
|
||||
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const formRef = shallowRef<FormInstance>();
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
@ -53,6 +57,9 @@
|
||||
note: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -66,6 +73,9 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
*/
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate();
|
||||
props.roleId ? await roleUpdate(formData) : await roleAdd(formData);
|
||||
@ -74,12 +84,18 @@
|
||||
emit('success');
|
||||
};
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
*/
|
||||
const setFormData = async () => {
|
||||
const data = await getRoleDetail(props.roleId);
|
||||
for (const key in formData) {
|
||||
@ -90,6 +106,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
if (props.roleId) {
|
||||
setFormData();
|
||||
|
@ -63,17 +63,32 @@
|
||||
import { columns } from './columns';
|
||||
import { PlusOutlined } from '@vicons/antd';
|
||||
import { message, confirm } from '@/utils/auth';
|
||||
const formParams = reactive({
|
||||
name: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 注册组件
|
||||
*/
|
||||
const editDialog = defineAsyncComponent(() => import('./edit.vue'));
|
||||
const authDialog = defineAsyncComponent(() => import('./auth.vue'));
|
||||
|
||||
/**
|
||||
* 定义参数变量
|
||||
*/
|
||||
const roleId = ref(0);
|
||||
const editVisible = ref(false);
|
||||
const authVisible = ref(false);
|
||||
const selectionData = ref([]);
|
||||
const tableRef = ref();
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
name: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 300,
|
||||
label: '操作',
|
||||
@ -111,14 +126,25 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
*/
|
||||
const loadDataTable = async (res: any) => {
|
||||
const result = await getRoleList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 刷新数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
labelWidth: 80,
|
||||
layout: 'horizontal',
|
||||
@ -126,6 +152,11 @@
|
||||
submitOnReset: true,
|
||||
schemas,
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
handleReset();
|
||||
for (const key in values) {
|
||||
@ -134,28 +165,48 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
*/
|
||||
function handleReset() {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行添加
|
||||
*/
|
||||
const handleAdd = async () => {
|
||||
roleId.value = 0;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
* @param record 参数
|
||||
*/
|
||||
const handleEdit = async (record: Recordable) => {
|
||||
roleId.value = record.row.id;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行权限设置
|
||||
* @param record 参数
|
||||
*/
|
||||
const handleAuth = async (record: Recordable) => {
|
||||
roleId.value = record.row.id;
|
||||
await nextTick();
|
||||
authVisible.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param record 参数
|
||||
*/
|
||||
async function handleDelete(record: Recordable) {
|
||||
let ids = [];
|
||||
if (!record) {
|
||||
@ -166,6 +217,11 @@
|
||||
message('删除成功');
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 选项发生变化
|
||||
* @param value 参数
|
||||
*/
|
||||
function onSelectionChange(value) {
|
||||
selectionData.value = value;
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ export const schemas: FormSchema[] = [
|
||||
{
|
||||
field: 'name',
|
||||
component: 'Input',
|
||||
label: '角色名',
|
||||
label: '角色名称',
|
||||
componentProps: {
|
||||
placeholder: '请输入角色名',
|
||||
placeholder: '请输入角色名称',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -173,6 +173,10 @@
|
||||
|
||||
const formRef = shallowRef<FormInstance>();
|
||||
import { useLockFn } from '@/utils/useLockFn';
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -187,6 +191,10 @@
|
||||
});
|
||||
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formData = reactive({
|
||||
id: 0,
|
||||
code: '',
|
||||
@ -205,10 +213,17 @@
|
||||
number: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
* @param row 参数
|
||||
*/
|
||||
const setFormData = async (row: any) => {
|
||||
const data = await getTenantDetail(row.tenantId);
|
||||
for (const key in formData) {
|
||||
@ -231,6 +246,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
*/
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate();
|
||||
props.tenantId ? await tenantUpdate(formData) : await tenantAdd(formData);
|
||||
@ -240,6 +258,9 @@
|
||||
|
||||
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
if (props.tenantId) {
|
||||
setFormData({ tenantId: props.tenantId });
|
||||
|
@ -74,11 +74,20 @@
|
||||
const editVisible = ref(false);
|
||||
const selectionData = ref([]);
|
||||
const editDialog = defineAsyncComponent(() => import('./edit.vue'));
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
// 租户名称
|
||||
name: '',
|
||||
// 租户状态
|
||||
status: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 320,
|
||||
label: '操作',
|
||||
@ -115,25 +124,54 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
* @param res 参数
|
||||
*/
|
||||
const loadDataTable = async (res) => {
|
||||
const result = await getTenantList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 刷新数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加添加
|
||||
*/
|
||||
function addTenant() {
|
||||
tenantId.value = 0;
|
||||
editVisible.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
* @param record 参数
|
||||
*/
|
||||
async function handleEdit(record: Recordable) {
|
||||
tenantId.value = record.row.id;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行添加账号
|
||||
* @param recored 参数
|
||||
*/
|
||||
const handleAddAccount = async (recored: Recordable) => {
|
||||
await tenantAccount({ tenantId: recored.row.id });
|
||||
message('创建成功');
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param record 参数
|
||||
*/
|
||||
async function handleDelete(record: Recordable) {
|
||||
let ids = [];
|
||||
if (!record) {
|
||||
@ -145,6 +183,10 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
handleReset();
|
||||
for (const key in values) {
|
||||
@ -153,14 +195,26 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
*/
|
||||
function handleReset() {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 选项发生变化
|
||||
* @param value 参数
|
||||
*/
|
||||
function onSelectionChange(value) {
|
||||
selectionData.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
labelWidth: 80,
|
||||
layout: 'horizontal',
|
||||
@ -168,11 +222,6 @@
|
||||
submitOnReset: true,
|
||||
schemas,
|
||||
});
|
||||
//添加
|
||||
function addTenant() {
|
||||
tenantId.value = 0;
|
||||
editVisible.value = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
@ -248,6 +248,10 @@
|
||||
import { useGlobSetting } from '@/hooks/setting';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
const globSetting = useGlobSetting();
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
@ -262,6 +266,10 @@
|
||||
});
|
||||
const cropperCircled = ref();
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formData = reactive({
|
||||
id: 0,
|
||||
avatarName: '',
|
||||
@ -292,14 +300,26 @@
|
||||
callback();
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行上传
|
||||
* @param data 参数
|
||||
*/
|
||||
const uploadSuccess = (data) => {
|
||||
formData.avatar = data.fileUrl;
|
||||
formRef.value?.validateField('avatar');
|
||||
};
|
||||
|
||||
/**
|
||||
* 关闭窗体
|
||||
*/
|
||||
const dialogClose = () => {
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置表单数据
|
||||
* @param row 参数
|
||||
*/
|
||||
const setFormData = async (row: any) => {
|
||||
const data = await getUserDetail(row.userId);
|
||||
for (const key in formData) {
|
||||
@ -322,6 +342,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
*/
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate();
|
||||
props.userId ? await userUpdate(formData) : await userAdd(formData);
|
||||
@ -331,6 +354,9 @@
|
||||
|
||||
const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit);
|
||||
|
||||
/**
|
||||
* 定义选项数据
|
||||
*/
|
||||
const optionData = reactive({
|
||||
roleList: [],
|
||||
deptList: [],
|
||||
@ -346,6 +372,9 @@
|
||||
console.log(file);
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取全部字典数据
|
||||
*/
|
||||
const getAllDict = async () => {
|
||||
let list = await getRoleAllList();
|
||||
optionData.roleList = list ? list : [];
|
||||
@ -356,6 +385,10 @@
|
||||
list = await getPositionAllList();
|
||||
optionData.positionList = list ? list : [];
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
getAllDict();
|
||||
if (props.userId) {
|
||||
|
@ -124,12 +124,19 @@
|
||||
const exportLoading = ref(false);
|
||||
const editDialog = defineAsyncComponent(() => import('./edit.vue'));
|
||||
const userUpload = defineAsyncComponent(() => import('./userUpload.vue'));
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
realname: '',
|
||||
role: '',
|
||||
status: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 400,
|
||||
label: '操作',
|
||||
@ -185,26 +192,53 @@
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
*/
|
||||
const loadDataTable = async (res) => {
|
||||
const result = await getUserList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 刷新数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行添加
|
||||
*/
|
||||
function addUser() {
|
||||
userId.value = 0;
|
||||
editVisible.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
*/
|
||||
async function handleEdit(record: Recordable) {
|
||||
userId.value = record.row.id;
|
||||
await nextTick();
|
||||
editVisible.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置密码
|
||||
* @param record 参数
|
||||
*/
|
||||
async function handleResetPassWord(record: Recordable) {
|
||||
await confirm('确定重置密码?');
|
||||
await resetPwd({ userId: record.row.id });
|
||||
message('重置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param record 参数
|
||||
*/
|
||||
async function handleDelete(record: Recordable) {
|
||||
let ids = [];
|
||||
if (!record) {
|
||||
@ -215,6 +249,11 @@
|
||||
message('删除成功');
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行打印
|
||||
* @param record 参数
|
||||
*/
|
||||
const handlePrint = async (record: Recordable) => {
|
||||
const res = await getUserDocument(record.row.id);
|
||||
printJS({
|
||||
@ -224,6 +263,10 @@
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
handleReset();
|
||||
for (const key in values) {
|
||||
@ -232,14 +275,26 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
*/
|
||||
function handleReset() {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 选项发生变化
|
||||
* @param value 参数
|
||||
*/
|
||||
function onSelectionChange(value) {
|
||||
selectionData.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
labelWidth: 80,
|
||||
layout: 'horizontal',
|
||||
@ -247,13 +302,10 @@
|
||||
submitOnReset: true,
|
||||
schemas,
|
||||
});
|
||||
//添加
|
||||
function addUser() {
|
||||
userId.value = 0;
|
||||
editVisible.value = true;
|
||||
}
|
||||
|
||||
//导出
|
||||
/**
|
||||
* 执行导出
|
||||
*/
|
||||
const handleExport = async () => {
|
||||
exportLoading.value = true;
|
||||
const data = await userExport();
|
||||
|
@ -39,6 +39,9 @@
|
||||
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
|
||||
/**
|
||||
* 定义接收的参数
|
||||
*/
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
|
Loading…
Reference in New Issue
Block a user