|
|
|
@ -29,7 +29,9 @@ |
|
|
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['im:userGroup:edit']">修改</el-button> |
|
|
|
</el-col> |
|
|
|
<el-col :span="1.5"> |
|
|
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['im:userGroup:remove']">删除</el-button> |
|
|
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['im:userGroup:remove']" |
|
|
|
>删除</el-button |
|
|
|
> |
|
|
|
</el-col> |
|
|
|
<el-col :span="1.5"> |
|
|
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['im:userGroup:export']">导出</el-button> |
|
|
|
@ -40,7 +42,7 @@ |
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="userGroupList" @selection-change="handleSelectionChange"> |
|
|
|
<el-table-column type="selection" width="55" align="center" /> |
|
|
|
<el-table-column label="id" align="center" prop="id" v-if="true" /> |
|
|
|
<!-- <el-table-column label="id" align="center" prop="id" v-if="true" /> --> |
|
|
|
<el-table-column label="分组名称" align="center" prop="groupName" /> |
|
|
|
<el-table-column label="排序" align="center" prop="sort" /> |
|
|
|
<el-table-column label="备注" align="center" prop="remark" /> |
|
|
|
@ -109,30 +111,20 @@ const initFormData: UserGroupForm = { |
|
|
|
groupName: undefined, |
|
|
|
sort: undefined, |
|
|
|
remark: undefined |
|
|
|
} |
|
|
|
}; |
|
|
|
const data = reactive<PageData<UserGroupForm, UserGroupQuery>>({ |
|
|
|
form: {...initFormData}, |
|
|
|
form: { ...initFormData }, |
|
|
|
queryParams: { |
|
|
|
pageNum: 1, |
|
|
|
pageSize: 10, |
|
|
|
groupName: undefined, |
|
|
|
sort: undefined, |
|
|
|
params: { |
|
|
|
} |
|
|
|
params: {} |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
id: [ |
|
|
|
{ required: true, message: "id不能为空", trigger: "blur" } |
|
|
|
], |
|
|
|
groupName: [ |
|
|
|
{ required: true, message: "分组名称不能为空", trigger: "blur" } |
|
|
|
], |
|
|
|
sort: [ |
|
|
|
{ required: true, message: "排序不能为空", trigger: "blur" } |
|
|
|
], |
|
|
|
remark: [ |
|
|
|
{ required: true, message: "备注不能为空", trigger: "blur" } |
|
|
|
] |
|
|
|
id: [{ required: true, message: 'id不能为空', trigger: 'blur' }], |
|
|
|
groupName: [{ required: true, message: '分组名称不能为空', trigger: 'blur' }], |
|
|
|
sort: [{ required: true, message: '排序不能为空', trigger: 'blur' }] |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
@ -145,55 +137,55 @@ const getList = async () => { |
|
|
|
userGroupList.value = res.rows; |
|
|
|
total.value = res.total; |
|
|
|
loading.value = false; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** 取消按钮 */ |
|
|
|
const cancel = () => { |
|
|
|
reset(); |
|
|
|
dialog.visible = false; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** 表单重置 */ |
|
|
|
const reset = () => { |
|
|
|
form.value = {...initFormData}; |
|
|
|
form.value = { ...initFormData }; |
|
|
|
userGroupFormRef.value?.resetFields(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** 搜索按钮操作 */ |
|
|
|
const handleQuery = () => { |
|
|
|
queryParams.value.pageNum = 1; |
|
|
|
getList(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** 重置按钮操作 */ |
|
|
|
const resetQuery = () => { |
|
|
|
queryFormRef.value?.resetFields(); |
|
|
|
handleQuery(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** 多选框选中数据 */ |
|
|
|
const handleSelectionChange = (selection: UserGroupVO[]) => { |
|
|
|
ids.value = selection.map(item => item.id); |
|
|
|
ids.value = selection.map((item) => item.id); |
|
|
|
single.value = selection.length != 1; |
|
|
|
multiple.value = !selection.length; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** 新增按钮操作 */ |
|
|
|
const handleAdd = () => { |
|
|
|
reset(); |
|
|
|
dialog.visible = true; |
|
|
|
dialog.title = "添加用户分组"; |
|
|
|
} |
|
|
|
dialog.title = '添加用户分组'; |
|
|
|
}; |
|
|
|
|
|
|
|
/** 修改按钮操作 */ |
|
|
|
const handleUpdate = async (row?: UserGroupVO) => { |
|
|
|
reset(); |
|
|
|
const _id = row?.id || ids.value[0] |
|
|
|
const _id = row?.id || ids.value[0]; |
|
|
|
const res = await getUserGroup(_id); |
|
|
|
Object.assign(form.value, res.data); |
|
|
|
dialog.visible = true; |
|
|
|
dialog.title = "修改用户分组"; |
|
|
|
} |
|
|
|
dialog.title = '修改用户分组'; |
|
|
|
}; |
|
|
|
|
|
|
|
/** 提交按钮 */ |
|
|
|
const submitForm = () => { |
|
|
|
@ -201,32 +193,36 @@ const submitForm = () => { |
|
|
|
if (valid) { |
|
|
|
buttonLoading.value = true; |
|
|
|
if (form.value.id) { |
|
|
|
await updateUserGroup(form.value).finally(() => buttonLoading.value = false); |
|
|
|
await updateUserGroup(form.value).finally(() => (buttonLoading.value = false)); |
|
|
|
} else { |
|
|
|
await addUserGroup(form.value).finally(() => buttonLoading.value = false); |
|
|
|
await addUserGroup(form.value).finally(() => (buttonLoading.value = false)); |
|
|
|
} |
|
|
|
proxy?.$modal.msgSuccess("操作成功"); |
|
|
|
proxy?.$modal.msgSuccess('操作成功'); |
|
|
|
dialog.visible = false; |
|
|
|
await getList(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
|
const handleDelete = async (row?: UserGroupVO) => { |
|
|
|
const _ids = row?.id || ids.value; |
|
|
|
await proxy?.$modal.confirm('是否确认删除用户分组编号为"' + _ids + '"的数据项?').finally(() => loading.value = false); |
|
|
|
await proxy?.$modal.confirm('是否确认删除用户分组编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); |
|
|
|
await delUserGroup(_ids); |
|
|
|
proxy?.$modal.msgSuccess("删除成功"); |
|
|
|
proxy?.$modal.msgSuccess('删除成功'); |
|
|
|
await getList(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** 导出按钮操作 */ |
|
|
|
const handleExport = () => { |
|
|
|
proxy?.download('im/userGroup/export', { |
|
|
|
...queryParams.value |
|
|
|
}, `userGroup_${new Date().getTime()}.xlsx`) |
|
|
|
} |
|
|
|
proxy?.download( |
|
|
|
'im/userGroup/export', |
|
|
|
{ |
|
|
|
...queryParams.value |
|
|
|
}, |
|
|
|
`userGroup_${new Date().getTime()}.xlsx` |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
getList(); |
|
|
|
|