Files
----/后端源码/yifan.action-ai.cn/index/js/index.C7h5-SaY.js

1533 lines
67 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { V as ElCol, w as ElForm, x as ElFormItem, y as ElInput, aq as ElSelect, ar as ElOption, h as ElButton, t as ElLink, i as ElIcon, ag as arrow_up_default, af as arrow_down_default, T as ElCard, U as ElRow, m as ElDropdown, n as ElDropdownMenu, o as ElDropdownItem, l as ElTooltip, al as ElTable, am as ElTableColumn, C as ElAvatar, q as ElTag, u as ElEmpty, ao as vLoading, a9 as question_filled_default, a3 as ElDescriptions, a4 as ElDescriptionsItem, aH as ElTreeSelect, M as ElSwitch, P as ElRadioGroup, Q as ElRadio, L as ElDrawer, D as ElMessageBox, E as ElMessage } from "./element-plus.CkEW9frc.js";
import { _ as __unplugin_components_19 } from "./index.fgd49PES.js";
import { D as DatePicker } from "./index.Cu5O_6Z1.js";
import { J as defineComponent, t as onMounted, aP as resolveDirective, S as openBlock, _ as createElementBlock, $ as createVNode, a0 as withCtx, o as unref, a1 as createBaseVNode, aw as withModifiers, T as createBlock, z as isRef, a8 as createCommentVNode, a6 as withDirectives, a9 as createTextVNode, aa as toDisplayString, H as Fragment, ay as renderList, r as ref, j as computed, ak as reactive, n as nextTick } from "./.pnpm.BW3P1y8f.js";
import { u as useAppStore, U as UserAPI, f as useUserStore, R as ResultEnum, D as DeviceEnum } from "./index.CMd5bD1r.js";
import { f as formatTree } from "./common.ySZAMJjg.js";
import { P as PositionAPI } from "./position.QXDy5vCW.js";
import { D as DeptAPI } from "./dept.BQxPXXgN.js";
import { R as RoleAPI } from "./role.B8EtFSdB.js";
import { f as formatToDateTime } from "./dateUtil.SHphbRyf.js";
import { _ as _sfc_main$1 } from "./DeptTree.vue_vue_type_script_setup_true_lang.DJ6-tBs5.js";
import { _ as _sfc_main$2 } from "./UserTableSelect.vue_vue_type_script_setup_true_lang.7Fjc3bJT.js";
import { _ as _sfc_main$3 } from "./ImportModal.vue_vue_type_script_setup_true_lang.DYvH1hkB.js";
import { _ as _sfc_main$4 } from "./ExportModal.vue_vue_type_script_setup_true_lang.Bok1HJuH.js";
import "./_plugin-vue_export-helper.1tPrXgE0.js";
import "./codemirror.CvJAcn2d.js";
import "./exceljs.CkFT-P7Q.js";
const _hoisted_1 = { class: "app-container" };
const _hoisted_2 = { class: "search-container" };
const _hoisted_3 = { class: "card-header" };
const _hoisted_4 = { class: "data-table__toolbar" };
const _hoisted_5 = { class: "data-table__toolbar--left" };
const _hoisted_6 = { class: "data-table__toolbar--right" };
const _hoisted_7 = { class: "dialog-footer" };
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "User",
inheritAttrs: false
},
__name: "index",
emits: ["import-success"],
setup(__props, { emit: __emit }) {
const appStore = useAppStore();
const queryFormRef = ref();
const dataFormRef = ref();
const total = ref(0);
const loading = ref(false);
const isExpand = ref(false);
const isExpandable = ref(true);
const drawerSize = computed(() => appStore.device === DeviceEnum.DESKTOP ? "450px" : "90%");
const selectionRows = ref([]);
const selectIds = ref([]);
const deptOptions = ref();
const roleOptions = ref();
const positionOptions = ref();
const importDialogVisible = ref(false);
const exportsDialogVisible = ref(false);
const pageTableData = ref([]);
const detailFormData = ref({});
const queryFormData = reactive({
page_no: 1,
page_size: 10,
username: void 0,
name: void 0,
status: void 0,
dept_id: void 0,
created_time: void 0,
created_id: void 0,
updated_id: void 0
});
const formData = reactive({
id: void 0,
username: void 0,
name: void 0,
dept_id: void 0,
dept_name: void 0,
role_ids: void 0,
role_names: void 0,
position_ids: void 0,
position_names: void 0,
password: void 0,
gender: void 0,
email: void 0,
mobile: void 0,
is_superuser: false,
//默认不是超管
status: "0",
description: void 0
});
const dialogVisible = reactive({
title: "",
visible: false,
type: "create"
});
const rules = reactive({
username: [{ required: true, message: "请输入账号", trigger: "blur" }],
name: [{ required: true, message: "请输入用户名", trigger: "blur" }],
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
gender: [{ required: false, message: "请选择性别", trigger: "blur" }],
email: [
{
pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/,
message: "请输入正确的邮箱地址",
trigger: "blur"
}
],
mobile: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
],
is_superuser: [{ required: true, message: "请选择是否超管", trigger: "blur" }],
status: [{ required: true, message: "请选择状态", trigger: "blur" }]
});
const dateRange = ref([]);
const exportColumns = [
{ prop: "username", label: "账号" },
{ prop: "name", label: "名称" },
{ prop: "status", label: "状态" },
{ prop: "gender", label: "性别" },
{ prop: "email", label: "邮箱" },
{ prop: "mobile", label: "手机号" },
{ prop: "is_superuser", label: "是否超管" },
{ prop: "description", label: "描述" },
{ prop: "created_time", label: "创建时间" },
{ prop: "updated_time", label: "更新时间" }
];
const curdContentConfig = {
permPrefix: "module_system:user",
cols: exportColumns,
importTemplate: () => UserAPI.downloadTemplateUser(),
exportsAction: async (params) => {
var _a, _b, _c, _d;
const query = { ...params };
if (typeof query.status === "string") {
query.status = query.status === "true";
}
query.page_no = 1;
query.page_size = 9999;
const all = [];
while (true) {
const res = await UserAPI.listUser(query);
const items = ((_b = (_a = res.data) == null ? void 0 : _a.data) == null ? void 0 : _b.items) || [];
const total2 = ((_d = (_c = res.data) == null ? void 0 : _c.data) == null ? void 0 : _d.total) || 0;
all.push(...items);
if (all.length >= total2 || items.length === 0) break;
query.page_no += 1;
}
return all;
}
};
function handleConfirm() {
handleQuery();
}
function handleDateRangeChange(range) {
dateRange.value = range;
if (range && range.length === 2) {
queryFormData.created_time = [formatToDateTime(range[0]), formatToDateTime(range[1])];
} else {
queryFormData.created_time = void 0;
}
}
async function handleRefresh() {
await loadingData();
}
async function loadingData() {
loading.value = true;
try {
const response = await UserAPI.listUser(queryFormData);
pageTableData.value = response.data.data.items;
total.value = response.data.data.total;
} catch (error) {
console.error(error);
} finally {
loading.value = false;
}
}
async function handleQuery() {
queryFormData.page_no = 1;
loadingData();
}
async function handleResetQuery() {
queryFormRef.value.resetFields();
dateRange.value = [];
queryFormData.created_time = void 0;
queryFormData.dept_id = void 0;
queryFormData.created_id = void 0;
queryFormData.page_no = 1;
loadingData();
}
const initialFormData = {
id: void 0,
username: void 0,
name: void 0,
dept_id: void 0,
dept_name: void 0,
role_ids: void 0,
role_names: void 0,
position_ids: void 0,
position_names: void 0,
password: void 0,
gender: void 0,
email: void 0,
mobile: void 0,
is_superuser: false,
//默认不是超管
status: "0",
description: void 0
};
async function resetForm() {
if (dataFormRef.value) {
dataFormRef.value.resetFields();
dataFormRef.value.clearValidate();
}
Object.assign(formData, initialFormData);
}
async function handleSelectionChange(selection) {
selectIds.value = selection.map((item) => item.id);
selectionRows.value = selection;
}
function hancleResetPassword(row) {
ElMessageBox.prompt("请输入用户【" + row.username + "】的新密码", "重置密码", {
confirmButtonText: "确定",
cancelButtonText: "取消"
}).then(
async ({ value }) => {
if (!value || value.length < 6) {
ElMessage.warning("密码至少需要6位字符请重新输入");
return false;
}
await UserAPI.resetUserPassword({ id: row.id, password: value });
},
() => {
ElMessageBox.close();
}
);
}
async function handleCloseDialog() {
dialogVisible.visible = false;
resetForm();
}
async function handleOpenDialog(type, id) {
dialogVisible.type = type;
if (id) {
const response = await UserAPI.detailUser(id);
if (type === "detail") {
dialogVisible.title = "用户详情";
Object.assign(detailFormData.value, response.data.data);
} else if (type === "update") {
dialogVisible.title = "修改用户";
Object.assign(formData, response.data.data);
formData.role_ids = (response.data.data.roles || []).map((item) => item.id);
formData.position_ids = (response.data.data.positions || []).map((item) => item.id);
}
} else {
dialogVisible.title = "新增用户";
formData.id = void 0;
}
dialogVisible.visible = true;
await nextTick();
if (dataFormRef.value) {
dataFormRef.value.clearValidate();
}
const deptResponse = await DeptAPI.listDept(queryFormData);
const treeData = deptResponse.data.data;
deptOptions.value = formatTree(treeData);
const roleResponse = await RoleAPI.listRole();
roleOptions.value = roleResponse.data.data.items.filter((item) => item.id !== void 0 && item.name !== void 0).map((item) => ({
value: item.id,
label: item.name,
disabled: item.status === "1"
})).filter((opt) => !opt.disabled);
const positionResponse = await PositionAPI.listPosition();
positionOptions.value = positionResponse.data.data.items.filter((item) => item.id !== void 0 && item.name !== void 0).map((item) => ({
value: item.id,
label: item.name,
disabled: item.status === "1"
})).filter((opt) => !opt.disabled);
}
async function handleSubmit() {
dataFormRef.value.validate(async (valid) => {
if (valid) {
loading.value = true;
const id = formData.id;
try {
if (id) {
await UserAPI.updateUser(id, { id, ...formData });
} else {
await UserAPI.createUser(formData);
}
dialogVisible.visible = false;
resetForm();
handleResetQuery();
const userStore = useUserStore();
if (id === userStore.basicInfo.id) {
await userStore.getUserInfo();
}
} catch (error) {
console.error(error);
} finally {
loading.value = false;
}
}
});
}
async function handleDelete(ids) {
ElMessageBox.confirm("确认删除该项数据?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
try {
loading.value = true;
await UserAPI.deleteUser(ids);
handleResetQuery();
} catch (error) {
console.error(error);
} finally {
loading.value = false;
}
}).catch(() => {
ElMessageBox.close();
});
}
async function handleMoreClick(status) {
if (selectIds.value.length) {
ElMessageBox.confirm("确认启用或停用该项数据?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
try {
loading.value = true;
await UserAPI.batchUser({ ids: selectIds.value, status });
handleResetQuery();
} catch (error) {
console.error(error);
} finally {
loading.value = false;
}
}).catch(() => {
ElMessageBox.close();
});
}
}
function handleOpenImportDialog() {
importDialogVisible.value = true;
}
function handleOpenExportsModal() {
exportsDialogVisible.value = true;
}
const emit = __emit;
const handleUpload = async (formData2) => {
try {
const response = await UserAPI.importUser(formData2);
if (response.data.code === ResultEnum.SUCCESS) {
ElMessage.success(`${response.data.msg}${response.data.data}`);
importDialogVisible.value = false;
await handleQuery();
emit("import-success");
}
} catch (error) {
console.error(error);
ElMessage.error("上传失败:" + error);
}
};
onMounted(() => {
handleQuery();
});
return (_ctx, _cache) => {
const _component_el_col = ElCol;
const _component_el_input = ElInput;
const _component_el_form_item = ElFormItem;
const _component_el_option = ElOption;
const _component_el_select = ElSelect;
const _component_DatePicker = DatePicker;
const _component_el_button = ElButton;
const _component_el_icon = ElIcon;
const _component_el_link = ElLink;
const _component_el_form = ElForm;
const _component_el_tooltip = ElTooltip;
const _component_el_dropdown_item = ElDropdownItem;
const _component_el_dropdown_menu = ElDropdownMenu;
const _component_el_dropdown = ElDropdown;
const _component_el_row = ElRow;
const _component_el_empty = ElEmpty;
const _component_el_table_column = ElTableColumn;
const _component_el_avatar = ElAvatar;
const _component_el_tag = ElTag;
const _component_el_table = ElTable;
const _component_pagination = __unplugin_components_19;
const _component_el_card = ElCard;
const _component_el_descriptions_item = ElDescriptionsItem;
const _component_el_descriptions = ElDescriptions;
const _component_el_tree_select = ElTreeSelect;
const _component_el_switch = ElSwitch;
const _component_el_radio = ElRadio;
const _component_el_radio_group = ElRadioGroup;
const _component_el_drawer = ElDrawer;
const _directive_hasPerm = resolveDirective("hasPerm");
const _directive_loading = vLoading;
return openBlock(), createElementBlock("div", _hoisted_1, [
createVNode(_component_el_row, {
gutter: 12,
justify: "space-around"
}, {
default: withCtx(() => [
createVNode(_component_el_col, { span: 4 }, {
default: withCtx(() => [
createVNode(_sfc_main$1, {
modelValue: unref(queryFormData).dept_id,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(queryFormData).dept_id = $event),
class: "h-820px",
onNodeClick: handleQuery
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_col, { span: 20 }, {
default: withCtx(() => [
createBaseVNode("div", _hoisted_2, [
createVNode(_component_el_form, {
ref_key: "queryFormRef",
ref: queryFormRef,
model: unref(queryFormData),
inline: true,
"label-suffix": ":",
onSubmit: withModifiers(handleQuery, ["prevent"])
}, {
default: withCtx(() => [
createVNode(_component_el_form_item, {
prop: "username",
label: "账号"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: unref(queryFormData).username,
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(queryFormData).username = $event),
placeholder: "请输入账号",
clearable: ""
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
prop: "name",
label: "用户名"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: unref(queryFormData).name,
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(queryFormData).name = $event),
placeholder: "请输入用户名",
clearable: ""
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
prop: "status",
label: "状态"
}, {
default: withCtx(() => [
createVNode(_component_el_select, {
modelValue: unref(queryFormData).status,
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(queryFormData).status = $event),
placeholder: "请选择状态",
style: { "width": "167.5px" },
clearable: ""
}, {
default: withCtx(() => [
createVNode(_component_el_option, {
value: "0",
label: "启用"
}),
createVNode(_component_el_option, {
value: "1",
label: "停用"
})
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
}),
unref(isExpand) ? (openBlock(), createBlock(_component_el_form_item, {
key: 0,
prop: "start_time",
label: "创建时间"
}, {
default: withCtx(() => [
createVNode(_component_DatePicker, {
modelValue: unref(dateRange),
"onUpdate:modelValue": [
_cache[4] || (_cache[4] = ($event) => isRef(dateRange) ? dateRange.value = $event : null),
handleDateRangeChange
]
}, null, 8, ["modelValue"])
]),
_: 1
})) : createCommentVNode("", true),
unref(isExpand) ? (openBlock(), createBlock(_component_el_form_item, {
key: 1,
prop: "created_id",
label: "创建人"
}, {
default: withCtx(() => [
createVNode(_sfc_main$2, {
modelValue: unref(queryFormData).created_id,
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(queryFormData).created_id = $event),
onConfirmClick: handleConfirm,
onClearClick: handleQuery
}, null, 8, ["modelValue"])
]),
_: 1
})) : createCommentVNode("", true),
createVNode(_component_el_form_item, { class: "search-buttons" }, {
default: withCtx(() => [
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "primary",
icon: "search",
"native-type": "submit"
}, {
default: withCtx(() => [..._cache[29] || (_cache[29] = [
createTextVNode(" 查询 ", -1)
])]),
_: 1
})), [
[_directive_hasPerm, ["module_system:user:query"]]
]),
withDirectives((openBlock(), createBlock(_component_el_button, {
icon: "refresh",
onClick: handleResetQuery
}, {
default: withCtx(() => [..._cache[30] || (_cache[30] = [
createTextVNode(" 重置 ", -1)
])]),
_: 1
})), [
[_directive_hasPerm, ["module_system:user:query"]]
]),
unref(isExpandable) ? (openBlock(), createBlock(_component_el_link, {
key: 0,
class: "ml-3",
type: "primary",
underline: "never",
onClick: _cache[6] || (_cache[6] = ($event) => isExpand.value = !unref(isExpand))
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(isExpand) ? "收起" : "展开") + " ", 1),
createVNode(_component_el_icon, null, {
default: withCtx(() => [
unref(isExpand) ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(arrow_down_default), { key: 1 }))
]),
_: 1
})
]),
_: 1
})) : createCommentVNode("", true)
]),
_: 1
})
]),
_: 1
}, 8, ["model"])
]),
createVNode(_component_el_card, { class: "data-table" }, {
header: withCtx(() => [
createBaseVNode("div", _hoisted_3, [
createBaseVNode("span", null, [
createVNode(_component_el_tooltip, { content: "用户管理系统用户" }, {
default: withCtx(() => [
createVNode(unref(question_filled_default), { class: "w-4 h-4 mx-1" })
]),
_: 1
}),
_cache[31] || (_cache[31] = createTextVNode(" 用户列表 ", -1))
])
])
]),
footer: withCtx(() => [
createVNode(_component_pagination, {
total: unref(total),
"onUpdate:total": _cache[11] || (_cache[11] = ($event) => isRef(total) ? total.value = $event : null),
page: unref(queryFormData).page_no,
"onUpdate:page": _cache[12] || (_cache[12] = ($event) => unref(queryFormData).page_no = $event),
limit: unref(queryFormData).page_size,
"onUpdate:limit": _cache[13] || (_cache[13] = ($event) => unref(queryFormData).page_size = $event),
onPagination: loadingData
}, null, 8, ["total", "page", "limit"])
]),
default: withCtx(() => [
createBaseVNode("div", _hoisted_4, [
createBaseVNode("div", _hoisted_5, [
createVNode(_component_el_row, { gutter: 10 }, {
default: withCtx(() => [
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "success",
icon: "plus",
onClick: _cache[7] || (_cache[7] = ($event) => handleOpenDialog("create"))
}, {
default: withCtx(() => [..._cache[32] || (_cache[32] = [
createTextVNode(" 新增 ", -1)
])]),
_: 1
})), [
[_directive_hasPerm, ["module_system:user:create"]]
])
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "danger",
icon: "delete",
disabled: unref(selectIds).length === 0,
onClick: _cache[8] || (_cache[8] = ($event) => handleDelete(unref(selectIds)))
}, {
default: withCtx(() => [..._cache[33] || (_cache[33] = [
createTextVNode(" 批量删除 ", -1)
])]),
_: 1
}, 8, ["disabled"])), [
[_directive_hasPerm, ["module_system:user:delete"]]
])
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
withDirectives((openBlock(), createBlock(_component_el_dropdown, { trigger: "click" }, {
dropdown: withCtx(() => [
createVNode(_component_el_dropdown_menu, null, {
default: withCtx(() => [
createVNode(_component_el_dropdown_item, {
icon: "Check",
onClick: _cache[9] || (_cache[9] = ($event) => handleMoreClick("0"))
}, {
default: withCtx(() => [..._cache[35] || (_cache[35] = [
createTextVNode(" 批量启用 ", -1)
])]),
_: 1
}),
createVNode(_component_el_dropdown_item, {
icon: "CircleClose",
onClick: _cache[10] || (_cache[10] = ($event) => handleMoreClick("1"))
}, {
default: withCtx(() => [..._cache[36] || (_cache[36] = [
createTextVNode(" 批量停用 ", -1)
])]),
_: 1
})
]),
_: 1
})
]),
default: withCtx(() => [
createVNode(_component_el_button, {
type: "default",
disabled: unref(selectIds).length === 0,
icon: "ArrowDown"
}, {
default: withCtx(() => [..._cache[34] || (_cache[34] = [
createTextVNode(" 更多 ", -1)
])]),
_: 1
}, 8, ["disabled"])
]),
_: 1
})), [
[_directive_hasPerm, ["module_system:user:patch"]]
])
]),
_: 1
})
]),
_: 1
})
]),
createBaseVNode("div", _hoisted_6, [
createVNode(_component_el_row, { gutter: 10 }, {
default: withCtx(() => [
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
createVNode(_component_el_tooltip, { content: "导入" }, {
default: withCtx(() => [
withDirectives(createVNode(_component_el_button, {
type: "info",
icon: "upload",
circle: "",
onClick: handleOpenImportDialog
}, null, 512), [
[_directive_hasPerm, ["module_system:user:import"]]
])
]),
_: 1
})
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
createVNode(_component_el_tooltip, { content: "导出" }, {
default: withCtx(() => [
withDirectives(createVNode(_component_el_button, {
type: "warning",
icon: "download",
circle: "",
onClick: handleOpenExportsModal
}, null, 512), [
[_directive_hasPerm, ["module_system:user:export"]]
])
]),
_: 1
})
]),
_: 1
}),
createVNode(_component_el_col, { span: 1.5 }, {
default: withCtx(() => [
createVNode(_component_el_tooltip, { content: "刷新" }, {
default: withCtx(() => [
withDirectives(createVNode(_component_el_button, {
type: "default",
icon: "refresh",
circle: "",
onClick: handleRefresh
}, null, 512), [
[_directive_hasPerm, ["module_system:user:query"]]
])
]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
])
]),
withDirectives((openBlock(), createBlock(_component_el_table, {
ref: "dataTableRef",
data: unref(pageTableData),
"highlight-current-row": "",
class: "data-table__content",
height: "488",
"max-height": "488",
border: "",
stripe: "",
onSelectionChange: handleSelectionChange
}, {
empty: withCtx(() => [
createVNode(_component_el_empty, {
"image-size": 80,
description: "暂无数据"
})
]),
default: withCtx(() => [
createVNode(_component_el_table_column, {
type: "selection",
"min-width": "55",
align: "center"
}),
createVNode(_component_el_table_column, {
type: "index",
fixed: "",
label: "序号",
"min-width": "60"
}, {
default: withCtx((scope) => [
createTextVNode(toDisplayString((unref(queryFormData).page_no - 1) * unref(queryFormData).page_size + scope.$index + 1), 1)
]),
_: 1
}),
createVNode(_component_el_table_column, {
label: "头像",
prop: "avatar",
"min-width": "80",
align: "center"
}, {
default: withCtx((scope) => [
scope.row.avatar ? (openBlock(), createBlock(_component_el_avatar, {
key: 0,
size: "small",
src: scope.row.avatar
}, null, 8, ["src"])) : (openBlock(), createBlock(_component_el_avatar, {
key: 1,
size: "small",
icon: "UserFilled"
}))
]),
_: 1
}),
createVNode(_component_el_table_column, {
label: "账号",
prop: "username",
"min-width": "100"
}),
createVNode(_component_el_table_column, {
label: "用户名",
prop: "name",
"min-width": "100"
}),
createVNode(_component_el_table_column, {
label: "状态",
prop: "status",
"min-width": "100"
}, {
default: withCtx((scope) => [
createVNode(_component_el_tag, {
type: scope.row.status === "0" ? "success" : "danger"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(scope.row.status === "0" ? "启用" : "停用"), 1)
]),
_: 2
}, 1032, ["type"])
]),
_: 1
}),
createVNode(_component_el_table_column, {
label: "是否超管",
prop: "is_superuser",
"min-width": "100"
}, {
default: withCtx((scope) => [
createVNode(_component_el_tag, {
type: scope.row.is_superuser ? "success" : "info"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(scope.row.is_superuser ? "是" : "否"), 1)
]),
_: 2
}, 1032, ["type"])
]),
_: 1
}),
createVNode(_component_el_table_column, {
label: "部门",
prop: "dept",
"min-width": "100"
}, {
default: withCtx((scope) => [
createTextVNode(toDisplayString(scope.row.dept ? scope.row.dept.name : ""), 1)
]),
_: 1
}),
createVNode(_component_el_table_column, {
label: "性别",
prop: "gender",
"min-width": "100"
}, {
default: withCtx((scope) => [
scope.row.gender === "0" ? (openBlock(), createBlock(_component_el_tag, {
key: 0,
type: "success"
}, {
default: withCtx(() => [..._cache[37] || (_cache[37] = [
createTextVNode("男", -1)
])]),
_: 1
})) : scope.row.gender === "1" ? (openBlock(), createBlock(_component_el_tag, {
key: 1,
type: "warning"
}, {
default: withCtx(() => [..._cache[38] || (_cache[38] = [
createTextVNode("女", -1)
])]),
_: 1
})) : (openBlock(), createBlock(_component_el_tag, {
key: 2,
type: "info"
}, {
default: withCtx(() => [..._cache[39] || (_cache[39] = [
createTextVNode("未知", -1)
])]),
_: 1
}))
]),
_: 1
}),
createVNode(_component_el_table_column, {
label: "手机号",
prop: "mobile",
"min-width": "160"
}),
createVNode(_component_el_table_column, {
label: "邮箱",
prop: "email",
"min-width": "160"
}),
createVNode(_component_el_table_column, {
label: "创建时间",
prop: "created_time",
"min-width": "200"
}),
createVNode(_component_el_table_column, {
label: "更新时间",
prop: "updated_time",
"min-width": "200"
}),
createVNode(_component_el_table_column, {
label: "创建人",
prop: "created_id",
"min-width": "120"
}, {
default: withCtx((scope) => {
var _a;
return [
createTextVNode(toDisplayString((_a = scope.row.created_by) == null ? void 0 : _a.name), 1)
];
}),
_: 1
}),
createVNode(_component_el_table_column, {
label: "更新人",
prop: "updated_id",
"min-width": "120"
}, {
default: withCtx((scope) => {
var _a;
return [
createTextVNode(toDisplayString((_a = scope.row.updated_by) == null ? void 0 : _a.name), 1)
];
}),
_: 1
}),
createVNode(_component_el_table_column, {
fixed: "right",
label: "操作",
align: "center",
"min-width": "280"
}, {
default: withCtx((scope) => [
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "warning",
icon: "RefreshLeft",
size: "small",
link: "",
disabled: scope.row.is_superuser === true,
onClick: ($event) => hancleResetPassword(scope.row)
}, {
default: withCtx(() => [..._cache[40] || (_cache[40] = [
createTextVNode(" 重置密码 ", -1)
])]),
_: 1
}, 8, ["disabled", "onClick"])), [
[_directive_hasPerm, ["module_system:user:update"]]
]),
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "info",
size: "small",
link: "",
icon: "document",
onClick: ($event) => handleOpenDialog("detail", scope.row.id)
}, {
default: withCtx(() => [..._cache[41] || (_cache[41] = [
createTextVNode(" 详情 ", -1)
])]),
_: 1
}, 8, ["onClick"])), [
[_directive_hasPerm, ["module_system:user:detail"]]
]),
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "primary",
size: "small",
link: "",
icon: "edit",
disabled: scope.row.is_superuser === true,
onClick: ($event) => handleOpenDialog("update", scope.row.id)
}, {
default: withCtx(() => [..._cache[42] || (_cache[42] = [
createTextVNode(" 编辑 ", -1)
])]),
_: 1
}, 8, ["disabled", "onClick"])), [
[_directive_hasPerm, ["module_system:user:update"]]
]),
withDirectives((openBlock(), createBlock(_component_el_button, {
type: "danger",
size: "small",
link: "",
icon: "delete",
disabled: scope.row.is_superuser === true,
onClick: ($event) => handleDelete([scope.row.id])
}, {
default: withCtx(() => [..._cache[43] || (_cache[43] = [
createTextVNode(" 删除 ", -1)
])]),
_: 1
}, 8, ["disabled", "onClick"])), [
[_directive_hasPerm, ["module_system:user:delete"]]
])
]),
_: 1
})
]),
_: 1
}, 8, ["data"])), [
[_directive_loading, unref(loading)]
])
]),
_: 1
})
]),
_: 1
})
]),
_: 1
}),
createVNode(_component_el_drawer, {
modelValue: unref(dialogVisible).visible,
"onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => unref(dialogVisible).visible = $event),
title: unref(dialogVisible).title,
"append-to-body": "",
size: unref(drawerSize),
onClose: handleCloseDialog
}, {
footer: withCtx(() => [
createBaseVNode("div", _hoisted_7, [
unref(dialogVisible).type === "create" || unref(dialogVisible).type === "update" ? (openBlock(), createBlock(_component_el_button, {
key: 0,
type: "primary",
onClick: handleSubmit
}, {
default: withCtx(() => [..._cache[49] || (_cache[49] = [
createTextVNode(" 确定 ", -1)
])]),
_: 1
})) : (openBlock(), createBlock(_component_el_button, {
key: 1,
type: "primary",
onClick: handleCloseDialog
}, {
default: withCtx(() => [..._cache[50] || (_cache[50] = [
createTextVNode("确定", -1)
])]),
_: 1
})),
createVNode(_component_el_button, { onClick: handleCloseDialog }, {
default: withCtx(() => [..._cache[51] || (_cache[51] = [
createTextVNode("取消", -1)
])]),
_: 1
})
])
]),
default: withCtx(() => [
unref(dialogVisible).type === "detail" ? (openBlock(), createBlock(_component_el_descriptions, {
key: 0,
column: 2,
border: ""
}, {
default: withCtx(() => [
createVNode(_component_el_descriptions_item, {
label: "编号",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).id), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "头像",
span: 2
}, {
default: withCtx(() => [
unref(detailFormData).avatar ? (openBlock(), createBlock(_component_el_avatar, {
key: 0,
src: unref(detailFormData).avatar,
size: "small"
}, null, 8, ["src"])) : (openBlock(), createBlock(_component_el_avatar, {
key: 1,
icon: "UserFilled",
size: "small"
}))
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "账号",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).username), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "用户名",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).name), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "性别",
span: 2
}, {
default: withCtx(() => [
unref(detailFormData).gender === "0" ? (openBlock(), createBlock(_component_el_tag, {
key: 0,
type: "success"
}, {
default: withCtx(() => [..._cache[44] || (_cache[44] = [
createTextVNode("男", -1)
])]),
_: 1
})) : unref(detailFormData).gender === "1" ? (openBlock(), createBlock(_component_el_tag, {
key: 1,
type: "warning"
}, {
default: withCtx(() => [..._cache[45] || (_cache[45] = [
createTextVNode("女", -1)
])]),
_: 1
})) : (openBlock(), createBlock(_component_el_tag, {
key: 2,
type: "info"
}, {
default: withCtx(() => [..._cache[46] || (_cache[46] = [
createTextVNode("未知", -1)
])]),
_: 1
}))
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "部门",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).dept ? unref(detailFormData).dept.name : ""), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "角色",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).roles ? unref(detailFormData).roles.map((item) => item.name).join("、") : ""), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "岗位",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).positions ? unref(detailFormData).positions.map((item) => item.name).join("、") : ""), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "邮箱",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).email), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "手机号",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).mobile), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "是否超管",
span: 2
}, {
default: withCtx(() => [
createVNode(_component_el_tag, {
type: unref(detailFormData).is_superuser ? "success" : "info"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).is_superuser ? "是" : "否"), 1)
]),
_: 1
}, 8, ["type"])
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "状态",
span: 2
}, {
default: withCtx(() => [
createVNode(_component_el_tag, {
type: unref(detailFormData).status ? "success" : "danger"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).status ? "启用" : "停用"), 1)
]),
_: 1
}, 8, ["type"])
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "上次登录时间",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).last_login), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "创建人",
span: 2
}, {
default: withCtx(() => {
var _a;
return [
createTextVNode(toDisplayString((_a = unref(detailFormData).created_by) == null ? void 0 : _a.name), 1)
];
}),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "更新人",
span: 2
}, {
default: withCtx(() => {
var _a;
return [
createTextVNode(toDisplayString((_a = unref(detailFormData).updated_by) == null ? void 0 : _a.name), 1)
];
}),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "创建时间",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).created_time), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "更新时间",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).updated_time), 1)
]),
_: 1
}),
createVNode(_component_el_descriptions_item, {
label: "描述",
span: 4
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(detailFormData).description), 1)
]),
_: 1
})
]),
_: 1
})) : (openBlock(), createBlock(_component_el_form, {
key: 1,
ref_key: "dataFormRef",
ref: dataFormRef,
model: unref(formData),
rules: unref(rules),
"label-suffix": ":",
"label-width": "auto",
"label-position": "right"
}, {
default: withCtx(() => [
createVNode(_component_el_form_item, {
label: "账号",
prop: "username"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: unref(formData).username,
"onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => unref(formData).username = $event),
disabled: !!unref(formData).id,
placeholder: "请输入账号"
}, null, 8, ["modelValue", "disabled"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "用户名",
prop: "name"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: unref(formData).name,
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(formData).name = $event),
placeholder: "请输入用户名"
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "性别",
prop: "gender"
}, {
default: withCtx(() => [
createVNode(_component_el_select, {
modelValue: unref(formData).gender,
"onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => unref(formData).gender = $event),
placeholder: "请选择性别"
}, {
default: withCtx(() => [
createVNode(_component_el_option, {
label: "男",
value: "0"
}),
createVNode(_component_el_option, {
label: "女",
value: "1"
}),
createVNode(_component_el_option, {
label: "未知",
value: "2"
})
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "手机号",
prop: "mobile"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: unref(formData).mobile,
"onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => unref(formData).mobile = $event),
placeholder: "请输入手机号码",
maxlength: "11"
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "邮箱",
prop: "email"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: unref(formData).email,
"onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => unref(formData).email = $event),
placeholder: "请输入邮箱",
maxlength: "50"
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "部门",
prop: "dept_id"
}, {
default: withCtx(() => [
createVNode(_component_el_tree_select, {
modelValue: unref(formData).dept_id,
"onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => unref(formData).dept_id = $event),
placeholder: "请选择上级部门",
data: unref(deptOptions),
props: { children: "children", label: "label", disabled: "disabled" },
filterable: "",
"check-strictly": "",
"render-after-expand": false
}, null, 8, ["modelValue", "data"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "角色",
prop: "role_ids"
}, {
default: withCtx(() => [
createVNode(_component_el_select, {
modelValue: unref(formData).role_ids,
"onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => unref(formData).role_ids = $event),
multiple: "",
placeholder: "请选择角色"
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(roleOptions), (item) => {
return openBlock(), createBlock(_component_el_option, {
key: item.value,
label: item.label,
value: item.value,
disabled: item.disabled
}, null, 8, ["label", "value", "disabled"]);
}), 128))
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "岗位",
prop: "position_ids"
}, {
default: withCtx(() => [
createVNode(_component_el_select, {
modelValue: unref(formData).position_ids,
"onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => unref(formData).position_ids = $event),
multiple: "",
placeholder: "请选择岗位"
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(positionOptions), (item) => {
return openBlock(), createBlock(_component_el_option, {
key: item.value,
label: item.label,
value: item.value,
disabled: item.disabled
}, null, 8, ["label", "value", "disabled"]);
}), 128))
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "密码",
prop: "password"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: unref(formData).password,
"onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => unref(formData).password = $event),
readonly: !!unref(formData).id,
placeholder: "请输入密码",
type: "password",
"show-password": "",
clearable: ""
}, null, 8, ["modelValue", "readonly"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "是否超管",
prop: "is_superuser"
}, {
default: withCtx(() => [
createVNode(_component_el_switch, {
modelValue: unref(formData).is_superuser,
"onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => unref(formData).is_superuser = $event)
}, null, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "状态",
prop: "status"
}, {
default: withCtx(() => [
createVNode(_component_el_radio_group, {
modelValue: unref(formData).status,
"onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => unref(formData).status = $event)
}, {
default: withCtx(() => [
createVNode(_component_el_radio, { value: "0" }, {
default: withCtx(() => [..._cache[47] || (_cache[47] = [
createTextVNode("启用", -1)
])]),
_: 1
}),
createVNode(_component_el_radio, { value: "1" }, {
default: withCtx(() => [..._cache[48] || (_cache[48] = [
createTextVNode("停用", -1)
])]),
_: 1
})
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
}),
createVNode(_component_el_form_item, {
label: "描述",
prop: "description"
}, {
default: withCtx(() => [
createVNode(_component_el_input, {
modelValue: unref(formData).description,
"onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => unref(formData).description = $event),
rows: 4,
maxlength: 100,
"show-word-limit": "",
type: "textarea",
placeholder: "请输入描述"
}, null, 8, ["modelValue"])
]),
_: 1
})
]),
_: 1
}, 8, ["model", "rules"]))
]),
_: 1
}, 8, ["modelValue", "title", "size"]),
createVNode(_sfc_main$3, {
modelValue: unref(importDialogVisible),
"onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => isRef(importDialogVisible) ? importDialogVisible.value = $event : null),
"content-config": curdContentConfig,
onUpload: handleUpload
}, null, 8, ["modelValue"]),
createVNode(_sfc_main$4, {
modelValue: unref(exportsDialogVisible),
"onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => isRef(exportsDialogVisible) ? exportsDialogVisible.value = $event : null),
"content-config": curdContentConfig,
"query-params": unref(queryFormData),
"page-data": unref(pageTableData),
"selection-data": unref(selectionRows)
}, null, 8, ["modelValue", "query-params", "page-data", "selection-data"])
]);
};
}
});
export {
_sfc_main as default
};