1120 lines
49 KiB
JavaScript
1120 lines
49 KiB
JavaScript
import { 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, w as ElForm, U as ElRow, V as ElCol, m as ElDropdown, n as ElDropdownMenu, o as ElDropdownItem, l as ElTooltip, ax as ElPopover, F as ElScrollbar, aC as ElCheckbox, al as ElTable, am as ElTableColumn, q as ElTag, E as ElMessage, u as ElEmpty, ao as vLoading, a9 as question_filled_default, T as ElCard, a3 as ElDescriptions, a4 as ElDescriptionsItem, av as ElInputNumber, P as ElRadioGroup, Q as ElRadio, v as ElDialog, D as ElMessageBox } from "./element-plus.CkEW9frc.js";
|
|
import { _ as _sfc_main$2 } from "./PermissonDrawer.vue_vue_type_script_setup_true_lang.CdjriRtw.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, a1 as createBaseVNode, $ as createVNode, a0 as withCtx, o as unref, T as createBlock, z as isRef, a8 as createCommentVNode, a6 as withDirectives, a9 as createTextVNode, aa as toDisplayString, aw as withModifiers, H as Fragment, ay as renderList, r as ref, ak as reactive } from "./.pnpm.BW3P1y8f.js";
|
|
import { R as RoleAPI } from "./role.B8EtFSdB.js";
|
|
import { f as useUserStore } from "./index.CMd5bD1r.js";
|
|
import { _ as _sfc_main$1 } from "./ExportModal.vue_vue_type_script_setup_true_lang.Bok1HJuH.js";
|
|
import { f as formatToDateTime } from "./dateUtil.SHphbRyf.js";
|
|
import "./common.ySZAMJjg.js";
|
|
import "./dept.BQxPXXgN.js";
|
|
import "./menu.uy9JHUjy.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: "Role",
|
|
inheritAttrs: false
|
|
},
|
|
__name: "index",
|
|
setup(__props) {
|
|
const queryFormRef = ref();
|
|
const dataFormRef = ref();
|
|
const selectIds = ref([]);
|
|
const loading = ref(false);
|
|
const total = ref(0);
|
|
const isExpand = ref(false);
|
|
const isExpandable = ref(true);
|
|
const pageTableData = ref([]);
|
|
const drawerVisible = ref(false);
|
|
const tableColumns = ref([
|
|
{ prop: "selection", label: "选择框", show: true },
|
|
{ prop: "index", label: "序号", show: true },
|
|
{ prop: "name", label: "角色名称", show: true },
|
|
{ prop: "data_scope", label: "数据权限", show: true },
|
|
{ prop: "order", label: "排序", show: true },
|
|
{ prop: "code", label: "角色编码", show: true },
|
|
{ prop: "status", label: "状态", show: true },
|
|
{ prop: "description", label: "描述", show: true },
|
|
{ prop: "created_time", label: "创建时间", show: true },
|
|
{ prop: "updated_time", label: "更新时间", show: true },
|
|
{ prop: "operation", label: "操作", show: true }
|
|
]);
|
|
const detailFormData = ref({});
|
|
const checkedRole = ref({});
|
|
const queryFormData = reactive({
|
|
page_no: 1,
|
|
page_size: 10,
|
|
name: "",
|
|
status: void 0,
|
|
created_time: void 0,
|
|
updated_time: void 0
|
|
});
|
|
const formData = reactive({
|
|
id: void 0,
|
|
name: void 0,
|
|
order: 1,
|
|
code: void 0,
|
|
status: "0",
|
|
description: void 0
|
|
});
|
|
const dialogVisible = reactive({
|
|
title: "",
|
|
visible: false,
|
|
type: "create"
|
|
});
|
|
const rules = reactive({
|
|
name: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
|
|
order: [{ required: true, message: "请输入角色排序", trigger: "blur" }],
|
|
status: [{ required: true, message: "请选择状态", trigger: "blur" }]
|
|
});
|
|
async function loadingData() {
|
|
loading.value = true;
|
|
try {
|
|
const response = await RoleAPI.listRole(queryFormData);
|
|
pageTableData.value = response.data.data.items;
|
|
total.value = response.data.data.total;
|
|
} catch (error) {
|
|
console.error(error);
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
}
|
|
async function handleRefresh() {
|
|
await loadingData();
|
|
}
|
|
async function handleQuery() {
|
|
queryFormData.page_no = 1;
|
|
loadingData();
|
|
}
|
|
async function handleSelectionChange(selection) {
|
|
selectIds.value = selection.map((item) => item.id);
|
|
selectionRows.value = selection;
|
|
}
|
|
async function handleResetQuery() {
|
|
queryFormRef.value.resetFields();
|
|
queryFormData.page_no = 1;
|
|
dateRange.value = [];
|
|
queryFormData.created_time = void 0;
|
|
loadingData();
|
|
}
|
|
const initialFormData = {
|
|
id: void 0,
|
|
name: void 0,
|
|
order: 1,
|
|
code: void 0,
|
|
status: "0",
|
|
description: void 0
|
|
};
|
|
const dateRange = ref([]);
|
|
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 resetForm() {
|
|
if (dataFormRef.value) {
|
|
dataFormRef.value.resetFields();
|
|
dataFormRef.value.clearValidate();
|
|
}
|
|
Object.assign(formData, initialFormData);
|
|
}
|
|
async function handleCloseDialog() {
|
|
dialogVisible.visible = false;
|
|
resetForm();
|
|
}
|
|
async function handleOpenDialog(type, id) {
|
|
dialogVisible.type = type;
|
|
if (id) {
|
|
const response = await RoleAPI.detailRole(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);
|
|
}
|
|
} else {
|
|
dialogVisible.title = "新增角色";
|
|
formData.id = void 0;
|
|
}
|
|
dialogVisible.visible = true;
|
|
}
|
|
async function handleSubmit() {
|
|
dataFormRef.value.validate(async (valid) => {
|
|
if (valid) {
|
|
loading.value = true;
|
|
const id = formData.id;
|
|
try {
|
|
if (id) {
|
|
await RoleAPI.updateRole(id, { id, ...formData });
|
|
} else {
|
|
await RoleAPI.createRole(formData);
|
|
}
|
|
dialogVisible.visible = false;
|
|
resetForm();
|
|
handleResetQuery();
|
|
const userStore = useUserStore();
|
|
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 RoleAPI.deleteRole(ids);
|
|
handleResetQuery();
|
|
} catch (error) {
|
|
console.error(error);
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
}).catch(() => {
|
|
ElMessageBox.close();
|
|
});
|
|
}
|
|
function handleOpenExportsModal() {
|
|
exportsDialogVisible.value = true;
|
|
}
|
|
async function handleMoreClick(status) {
|
|
if (selectIds.value.length) {
|
|
ElMessageBox.confirm(`确认${status === "0" ? "启用" : "停用"}该项数据?`, "警告", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
}).then(async () => {
|
|
try {
|
|
loading.value = true;
|
|
await RoleAPI.batchRole({ ids: selectIds.value, status });
|
|
handleResetQuery();
|
|
} catch (error) {
|
|
console.error(error);
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
}).catch(() => {
|
|
ElMessageBox.close();
|
|
});
|
|
}
|
|
}
|
|
async function handleOpenAssignPermDialog(roleId, roleName) {
|
|
if (roleId) {
|
|
drawerVisible.value = true;
|
|
checkedRole.value.id = roleId;
|
|
checkedRole.value.name = roleName;
|
|
}
|
|
}
|
|
const exportsDialogVisible = ref(false);
|
|
const selectionRows = ref([]);
|
|
const exportColumns = [
|
|
{ prop: "name", label: "角色名称" },
|
|
{ prop: "code", label: "角色编码" },
|
|
{ prop: "data_scope", label: "数据权限" },
|
|
{ prop: "order", label: "排序" },
|
|
{ prop: "status", label: "状态" },
|
|
{ prop: "description", label: "描述" },
|
|
{ prop: "created_time", label: "创建时间" },
|
|
{ prop: "updated_time", label: "更新时间" }
|
|
];
|
|
const curdContentConfig = {
|
|
permPrefix: "module_system:role",
|
|
cols: exportColumns,
|
|
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 = 1e3;
|
|
const all = [];
|
|
while (true) {
|
|
const res = await RoleAPI.listRole(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;
|
|
}
|
|
};
|
|
onMounted(() => {
|
|
loadingData();
|
|
});
|
|
return (_ctx, _cache) => {
|
|
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_col = ElCol;
|
|
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_checkbox = ElCheckbox;
|
|
const _component_el_scrollbar = ElScrollbar;
|
|
const _component_el_popover = ElPopover;
|
|
const _component_el_empty = ElEmpty;
|
|
const _component_el_table_column = ElTableColumn;
|
|
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_input_number = ElInputNumber;
|
|
const _component_el_radio = ElRadio;
|
|
const _component_el_radio_group = ElRadioGroup;
|
|
const _component_el_dialog = ElDialog;
|
|
const _component_PermissonDrawer = _sfc_main$2;
|
|
const _directive_hasPerm = resolveDirective("hasPerm");
|
|
const _directive_loading = vLoading;
|
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
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: "name",
|
|
label: "角色名称"
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(_component_el_input, {
|
|
modelValue: unref(queryFormData).name,
|
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($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[1] || (_cache[1] = ($event) => unref(queryFormData).status = $event),
|
|
placeholder: "请选择状态",
|
|
style: { "width": "167.5px" },
|
|
clearable: ""
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(_component_el_option, {
|
|
value: "true",
|
|
label: "启用"
|
|
}),
|
|
createVNode(_component_el_option, {
|
|
value: "false",
|
|
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[2] || (_cache[2] = ($event) => isRef(dateRange) ? dateRange.value = $event : null),
|
|
handleDateRangeChange
|
|
]
|
|
}, 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[19] || (_cache[19] = [
|
|
createTextVNode(" 查询 ", -1)
|
|
])]),
|
|
_: 1
|
|
})), [
|
|
[_directive_hasPerm, ["module_system:role:query"]]
|
|
]),
|
|
withDirectives((openBlock(), createBlock(_component_el_button, {
|
|
icon: "refresh",
|
|
onClick: handleResetQuery
|
|
}, {
|
|
default: withCtx(() => [..._cache[20] || (_cache[20] = [
|
|
createTextVNode(" 重置 ", -1)
|
|
])]),
|
|
_: 1
|
|
})), [
|
|
[_directive_hasPerm, ["module_system:role:query"]]
|
|
]),
|
|
unref(isExpandable) ? (openBlock(), createBlock(_component_el_link, {
|
|
key: 0,
|
|
class: "ml-3",
|
|
type: "primary",
|
|
underline: "never",
|
|
onClick: _cache[3] || (_cache[3] = ($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[21] || (_cache[21] = createTextVNode(" 角色管理列表 ", -1))
|
|
])
|
|
])
|
|
]),
|
|
footer: withCtx(() => [
|
|
createVNode(_component_pagination, {
|
|
total: unref(total),
|
|
"onUpdate:total": _cache[8] || (_cache[8] = ($event) => isRef(total) ? total.value = $event : null),
|
|
page: unref(queryFormData).page_no,
|
|
"onUpdate:page": _cache[9] || (_cache[9] = ($event) => unref(queryFormData).page_no = $event),
|
|
limit: unref(queryFormData).page_size,
|
|
"onUpdate:limit": _cache[10] || (_cache[10] = ($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[4] || (_cache[4] = ($event) => handleOpenDialog("create"))
|
|
}, {
|
|
default: withCtx(() => [..._cache[22] || (_cache[22] = [
|
|
createTextVNode(" 新增 ", -1)
|
|
])]),
|
|
_: 1
|
|
})), [
|
|
[_directive_hasPerm, ["module_system:role: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[5] || (_cache[5] = ($event) => handleDelete(unref(selectIds)))
|
|
}, {
|
|
default: withCtx(() => [..._cache[23] || (_cache[23] = [
|
|
createTextVNode(" 批量删除 ", -1)
|
|
])]),
|
|
_: 1
|
|
}, 8, ["disabled"])), [
|
|
[_directive_hasPerm, ["module_system:role: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[6] || (_cache[6] = ($event) => handleMoreClick("0"))
|
|
}, {
|
|
default: withCtx(() => [..._cache[25] || (_cache[25] = [
|
|
createTextVNode(" 批量启用 ", -1)
|
|
])]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_el_dropdown_item, {
|
|
icon: "CircleClose",
|
|
onClick: _cache[7] || (_cache[7] = ($event) => handleMoreClick("1"))
|
|
}, {
|
|
default: withCtx(() => [..._cache[26] || (_cache[26] = [
|
|
createTextVNode(" 批量停用 ", -1)
|
|
])]),
|
|
_: 1
|
|
})
|
|
]),
|
|
_: 1
|
|
})
|
|
]),
|
|
default: withCtx(() => [
|
|
createVNode(_component_el_button, {
|
|
type: "default",
|
|
disabled: unref(selectIds).length === 0,
|
|
icon: "ArrowDown"
|
|
}, {
|
|
default: withCtx(() => [..._cache[24] || (_cache[24] = [
|
|
createTextVNode(" 更多 ", -1)
|
|
])]),
|
|
_: 1
|
|
}, 8, ["disabled"])
|
|
]),
|
|
_: 1
|
|
})), [
|
|
[_directive_hasPerm, ["module_system:role: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: "warning",
|
|
icon: "download",
|
|
circle: "",
|
|
onClick: handleOpenExportsModal
|
|
}, null, 512), [
|
|
[_directive_hasPerm, ["module_system:role: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: "primary",
|
|
icon: "refresh",
|
|
circle: "",
|
|
onClick: handleRefresh
|
|
}, null, 512), [
|
|
[_directive_hasPerm, ["module_system:role:query"]]
|
|
])
|
|
]),
|
|
_: 1
|
|
})
|
|
]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_el_col, { span: 1.5 }, {
|
|
default: withCtx(() => [
|
|
createVNode(_component_el_popover, {
|
|
placement: "bottom",
|
|
trigger: "click"
|
|
}, {
|
|
reference: withCtx(() => [
|
|
createVNode(_component_el_button, {
|
|
type: "danger",
|
|
icon: "operation",
|
|
circle: ""
|
|
})
|
|
]),
|
|
default: withCtx(() => [
|
|
createVNode(_component_el_scrollbar, { "max-height": "350px" }, {
|
|
default: withCtx(() => [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(tableColumns), (column) => {
|
|
return openBlock(), createElementBlock(Fragment, {
|
|
key: column.prop
|
|
}, [
|
|
column.prop ? (openBlock(), createBlock(_component_el_checkbox, {
|
|
key: 0,
|
|
modelValue: column.show,
|
|
"onUpdate:modelValue": ($event) => column.show = $event,
|
|
label: column.label
|
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "label"])) : createCommentVNode("", true)
|
|
], 64);
|
|
}), 128))
|
|
]),
|
|
_: 1
|
|
})
|
|
]),
|
|
_: 1
|
|
})
|
|
]),
|
|
_: 1
|
|
})
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
]),
|
|
withDirectives((openBlock(), createBlock(_component_el_table, {
|
|
ref: "dataTableRef",
|
|
data: unref(pageTableData),
|
|
"highlight-current-row": "",
|
|
class: "data-table__content",
|
|
height: "500",
|
|
"max-height": "500",
|
|
border: "",
|
|
stripe: "",
|
|
onSelectionChange: handleSelectionChange
|
|
}, {
|
|
empty: withCtx(() => [
|
|
createVNode(_component_el_empty, {
|
|
"image-size": 80,
|
|
description: "暂无数据"
|
|
})
|
|
]),
|
|
default: withCtx(() => {
|
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
return [
|
|
((_a = unref(tableColumns).find((col) => col.prop === "selection")) == null ? void 0 : _a.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: 0,
|
|
type: "selection",
|
|
width: "55",
|
|
align: "center"
|
|
})) : createCommentVNode("", true),
|
|
((_b = unref(tableColumns).find((col) => col.prop === "index")) == null ? void 0 : _b.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: 1,
|
|
type: "index",
|
|
fixed: "",
|
|
label: "序号",
|
|
width: "60"
|
|
}, {
|
|
default: withCtx((scope) => [
|
|
createTextVNode(toDisplayString((unref(queryFormData).page_no - 1) * unref(queryFormData).page_size + scope.$index + 1), 1)
|
|
]),
|
|
_: 1
|
|
})) : createCommentVNode("", true),
|
|
((_c = unref(tableColumns).find((col) => col.prop === "name")) == null ? void 0 : _c.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: "name",
|
|
label: "角色名称",
|
|
prop: "name",
|
|
"min-width": "100"
|
|
})) : createCommentVNode("", true),
|
|
((_d = unref(tableColumns).find((col) => col.prop === "code")) == null ? void 0 : _d.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: "code",
|
|
label: "角色编码",
|
|
prop: "code",
|
|
"min-width": "100"
|
|
})) : createCommentVNode("", true),
|
|
((_e = unref(tableColumns).find((col) => col.prop === "data_scope")) == null ? void 0 : _e.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: "data_scope",
|
|
label: "数据权限",
|
|
prop: "data_scope",
|
|
"min-width": "200"
|
|
}, {
|
|
default: withCtx((scope) => [
|
|
scope.row.data_scope === 1 ? (openBlock(), createBlock(_component_el_tag, {
|
|
key: 0,
|
|
type: "primary"
|
|
}, {
|
|
default: withCtx(() => [..._cache[27] || (_cache[27] = [
|
|
createTextVNode("仅本人数据权限", -1)
|
|
])]),
|
|
_: 1
|
|
})) : scope.row.data_scope === 2 ? (openBlock(), createBlock(_component_el_tag, {
|
|
key: 1,
|
|
type: "info"
|
|
}, {
|
|
default: withCtx(() => [..._cache[28] || (_cache[28] = [
|
|
createTextVNode("本部门数据权限", -1)
|
|
])]),
|
|
_: 1
|
|
})) : scope.row.data_scope === 3 ? (openBlock(), createBlock(_component_el_tag, {
|
|
key: 2,
|
|
type: "warning"
|
|
}, {
|
|
default: withCtx(() => [..._cache[29] || (_cache[29] = [
|
|
createTextVNode(" 本部门及以下数据权限 ", -1)
|
|
])]),
|
|
_: 1
|
|
})) : scope.row.data_scope === 4 ? (openBlock(), createBlock(_component_el_tag, {
|
|
key: 3,
|
|
type: "success"
|
|
}, {
|
|
default: withCtx(() => [..._cache[30] || (_cache[30] = [
|
|
createTextVNode("全部数据权限", -1)
|
|
])]),
|
|
_: 1
|
|
})) : (openBlock(), createBlock(_component_el_tag, {
|
|
key: 4,
|
|
type: "danger"
|
|
}, {
|
|
default: withCtx(() => [..._cache[31] || (_cache[31] = [
|
|
createTextVNode("自定义数据权限", -1)
|
|
])]),
|
|
_: 1
|
|
}))
|
|
]),
|
|
_: 1
|
|
})) : createCommentVNode("", true),
|
|
((_f = unref(tableColumns).find((col) => col.prop === "order")) == null ? void 0 : _f.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: "order",
|
|
label: "排序",
|
|
prop: "order",
|
|
"min-width": "80",
|
|
"show-overflow-tooltip": ""
|
|
})) : createCommentVNode("", true),
|
|
((_g = unref(tableColumns).find((col) => col.prop === "status")) == null ? void 0 : _g.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: "status",
|
|
label: "状态",
|
|
prop: "status",
|
|
"min-width": "80"
|
|
}, {
|
|
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
|
|
})) : createCommentVNode("", true),
|
|
((_h = unref(tableColumns).find((col) => col.prop === "description")) == null ? void 0 : _h.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: "description",
|
|
label: "描述",
|
|
prop: "description",
|
|
"min-width": "100"
|
|
})) : createCommentVNode("", true),
|
|
((_i = unref(tableColumns).find((col) => col.prop === "created_time")) == null ? void 0 : _i.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: "created_time",
|
|
label: "创建时间",
|
|
prop: "created_time",
|
|
"min-width": "200",
|
|
sortable: ""
|
|
})) : createCommentVNode("", true),
|
|
((_j = unref(tableColumns).find((col) => col.prop === "updated_time")) == null ? void 0 : _j.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: "updated_time",
|
|
label: "更新时间",
|
|
prop: "updated_time",
|
|
"min-width": "200",
|
|
sortable: ""
|
|
})) : createCommentVNode("", true),
|
|
((_k = unref(tableColumns).find((col) => col.prop === "operation")) == null ? void 0 : _k.show) ? (openBlock(), createBlock(_component_el_table_column, {
|
|
key: 10,
|
|
fixed: "right",
|
|
label: "操作",
|
|
align: "center",
|
|
"min-width": "280"
|
|
}, {
|
|
default: withCtx((scope) => [
|
|
withDirectives((openBlock(), createBlock(_component_el_button, {
|
|
type: "warning",
|
|
size: "small",
|
|
link: "",
|
|
icon: "position",
|
|
disabled: scope.row.id === 1,
|
|
onClick: ($event) => scope.row.id === 1 ? unref(ElMessage).warning("系统默认角色,不可操作") : handleOpenAssignPermDialog(scope.row.id, scope.row.name)
|
|
}, {
|
|
default: withCtx(() => [..._cache[32] || (_cache[32] = [
|
|
createTextVNode(" 分配权限 ", -1)
|
|
])]),
|
|
_: 1
|
|
}, 8, ["disabled", "onClick"])), [
|
|
[_directive_hasPerm, ["module_system:role:permission"]]
|
|
]),
|
|
withDirectives((openBlock(), createBlock(_component_el_button, {
|
|
type: "info",
|
|
size: "small",
|
|
link: "",
|
|
icon: "document",
|
|
onClick: ($event) => handleOpenDialog("detail", scope.row.id)
|
|
}, {
|
|
default: withCtx(() => [..._cache[33] || (_cache[33] = [
|
|
createTextVNode(" 详情 ", -1)
|
|
])]),
|
|
_: 1
|
|
}, 8, ["onClick"])), [
|
|
[_directive_hasPerm, ["module_system:role:detail"]]
|
|
]),
|
|
withDirectives((openBlock(), createBlock(_component_el_button, {
|
|
type: "primary",
|
|
size: "small",
|
|
link: "",
|
|
icon: "edit",
|
|
disabled: scope.row.id === 1,
|
|
onClick: ($event) => scope.row.id === 1 ? unref(ElMessage).warning("系统默认角色,不可操作") : handleOpenDialog("update", scope.row.id)
|
|
}, {
|
|
default: withCtx(() => [..._cache[34] || (_cache[34] = [
|
|
createTextVNode(" 编辑 ", -1)
|
|
])]),
|
|
_: 1
|
|
}, 8, ["disabled", "onClick"])), [
|
|
[_directive_hasPerm, ["module_system:role:update"]]
|
|
]),
|
|
withDirectives((openBlock(), createBlock(_component_el_button, {
|
|
type: "danger",
|
|
size: "small",
|
|
link: "",
|
|
icon: "delete",
|
|
disabled: scope.row.id === 1,
|
|
onClick: ($event) => scope.row.id === 1 ? unref(ElMessage).warning("系统默认角色,不可操作") : handleDelete([scope.row.id])
|
|
}, {
|
|
default: withCtx(() => [..._cache[35] || (_cache[35] = [
|
|
createTextVNode(" 删除 ", -1)
|
|
])]),
|
|
_: 1
|
|
}, 8, ["disabled", "onClick"])), [
|
|
[_directive_hasPerm, ["module_system:role:delete"]]
|
|
])
|
|
]),
|
|
_: 1
|
|
})) : createCommentVNode("", true)
|
|
];
|
|
}),
|
|
_: 1
|
|
}, 8, ["data"])), [
|
|
[_directive_loading, unref(loading)]
|
|
])
|
|
]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_el_dialog, {
|
|
modelValue: unref(dialogVisible).visible,
|
|
"onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => unref(dialogVisible).visible = $event),
|
|
title: unref(dialogVisible).title,
|
|
onClose: handleCloseDialog
|
|
}, {
|
|
footer: withCtx(() => [
|
|
createBaseVNode("div", _hoisted_7, [
|
|
createVNode(_component_el_button, { onClick: handleCloseDialog }, {
|
|
default: withCtx(() => [..._cache[43] || (_cache[43] = [
|
|
createTextVNode("取 消", -1)
|
|
])]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_el_button, {
|
|
type: "primary",
|
|
onClick: handleSubmit
|
|
}, {
|
|
default: withCtx(() => [..._cache[44] || (_cache[44] = [
|
|
createTextVNode("确 定", -1)
|
|
])]),
|
|
_: 1
|
|
})
|
|
])
|
|
]),
|
|
default: withCtx(() => [
|
|
unref(dialogVisible).type === "detail" ? (openBlock(), createBlock(_component_el_descriptions, {
|
|
key: 0,
|
|
column: 4,
|
|
border: ""
|
|
}, {
|
|
default: withCtx(() => [
|
|
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(() => [
|
|
createTextVNode(toDisplayString(unref(detailFormData).order), 1)
|
|
]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_el_descriptions_item, {
|
|
label: "角色编码",
|
|
span: 2
|
|
}, {
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(detailFormData).code), 1)
|
|
]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_el_descriptions_item, {
|
|
label: "数据权限",
|
|
span: 2
|
|
}, {
|
|
default: withCtx(() => [
|
|
unref(detailFormData).data_scope === 1 ? (openBlock(), createBlock(_component_el_tag, {
|
|
key: 0,
|
|
type: "primary"
|
|
}, {
|
|
default: withCtx(() => [..._cache[36] || (_cache[36] = [
|
|
createTextVNode("仅本人数据权限", -1)
|
|
])]),
|
|
_: 1
|
|
})) : unref(detailFormData).data_scope === 2 ? (openBlock(), createBlock(_component_el_tag, {
|
|
key: 1,
|
|
type: "info"
|
|
}, {
|
|
default: withCtx(() => [..._cache[37] || (_cache[37] = [
|
|
createTextVNode("本部门数据权限", -1)
|
|
])]),
|
|
_: 1
|
|
})) : unref(detailFormData).data_scope === 3 ? (openBlock(), createBlock(_component_el_tag, {
|
|
key: 2,
|
|
type: "warning"
|
|
}, {
|
|
default: withCtx(() => [..._cache[38] || (_cache[38] = [
|
|
createTextVNode(" 本部门及以下数据权限 ", -1)
|
|
])]),
|
|
_: 1
|
|
})) : unref(detailFormData).data_scope === 4 ? (openBlock(), createBlock(_component_el_tag, {
|
|
key: 3,
|
|
type: "success"
|
|
}, {
|
|
default: withCtx(() => [..._cache[39] || (_cache[39] = [
|
|
createTextVNode("全部数据权限", -1)
|
|
])]),
|
|
_: 1
|
|
})) : (openBlock(), createBlock(_component_el_tag, {
|
|
key: 4,
|
|
type: "danger"
|
|
}, {
|
|
default: withCtx(() => [..._cache[40] || (_cache[40] = [
|
|
createTextVNode("自定义数据权限", -1)
|
|
])]),
|
|
_: 1
|
|
}))
|
|
]),
|
|
_: 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).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: "name"
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(_component_el_input, {
|
|
modelValue: unref(formData).name,
|
|
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => unref(formData).name = $event),
|
|
placeholder: "请输入角色名称"
|
|
}, null, 8, ["modelValue"])
|
|
]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_el_form_item, {
|
|
label: "排序",
|
|
prop: "order"
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(_component_el_input_number, {
|
|
modelValue: unref(formData).order,
|
|
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => unref(formData).order = $event),
|
|
"controls-position": "right",
|
|
min: 0,
|
|
style: { "width": "100px" }
|
|
}, null, 8, ["modelValue"])
|
|
]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_el_form_item, {
|
|
label: "角色编码",
|
|
prop: "code"
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(_component_el_input, {
|
|
modelValue: unref(formData).code,
|
|
"onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => unref(formData).code = $event),
|
|
placeholder: "请输入角色编码"
|
|
}, 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[14] || (_cache[14] = ($event) => unref(formData).status = $event)
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(_component_el_radio, { value: "0" }, {
|
|
default: withCtx(() => [..._cache[41] || (_cache[41] = [
|
|
createTextVNode("启用", -1)
|
|
])]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_el_radio, { value: "1" }, {
|
|
default: withCtx(() => [..._cache[42] || (_cache[42] = [
|
|
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[15] || (_cache[15] = ($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"]),
|
|
unref(drawerVisible) ? (openBlock(), createBlock(_component_PermissonDrawer, {
|
|
key: 0,
|
|
modelValue: unref(drawerVisible),
|
|
"onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => isRef(drawerVisible) ? drawerVisible.value = $event : null),
|
|
"role-name": unref(checkedRole).name,
|
|
"role-id": unref(checkedRole).id,
|
|
onSaved: handleRefresh
|
|
}, null, 8, ["modelValue", "role-name", "role-id"])) : createCommentVNode("", true),
|
|
createVNode(_sfc_main$1, {
|
|
modelValue: unref(exportsDialogVisible),
|
|
"onUpdate:modelValue": _cache[18] || (_cache[18] = ($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
|
|
};
|