UNPKG

yuang-framework-ui-pc

Version:

yuang-framework-ui-pc Library

240 lines (239 loc) 7.5 kB
import { defineComponent, ref, watch, resolveComponent, createElementBlock, openBlock, Fragment, createVNode, withCtx, createTextVNode, toDisplayString, normalizeStyle, unref, createElementVNode, createBlock, createCommentVNode } from "vue"; import { User } from "@element-plus/icons-vue"; import UserQuery from "./user-query"; import { UserOutlined } from "../../icons"; import { http } from "yuang-framework-ui-common/lib/config/httpConfig"; import { application } from "yuang-framework-ui-common/lib/config/applicationConfig"; const _sfc_main = /* @__PURE__ */ defineComponent({ ...{ name: "UimsUserList" }, __name: "user-list", props: { param: {}, organization: {} }, setup(__props, { expose: __expose }) { const props = __props; const queryRef = ref(null); const tableRef = ref(null); const columns = ref([ { type: "selection", columnKey: "selection", width: 50, align: "center", fixed: "left", selectable: (row) => { return !row.isUserExistsRole; } }, { type: "index", columnKey: "index", label: "编号", width: 70, align: "center", fixed: "left" }, { prop: "name", label: "用户姓名", sortable: "custom", minWidth: 200, align: "left", slot: "name" }, { prop: "account", label: "用户账号", sortable: "custom", minWidth: 130, align: "left" }, { prop: "avatar", label: "用户头像", minWidth: 100, align: "center", slot: "avatar" }, { prop: "gender", label: "用户性别", sortable: "custom", width: 110, align: "center", formatter: (row) => { if (row.gender == "male") { return "男性"; } else if (row.gender == "female") { return "女性"; } else if (row.gender == "secret") { return "保密"; } return ""; } }, { prop: "status", label: "用户状态", width: 110, align: "center", sortable: "custom", slot: "status", formatter: (row) => row.status == 1 ? "正常" : "禁用" }, { prop: "uimsOrganizationUnit.name", label: "所属单位", width: 180, align: "center" }, { prop: "uimsOrganizationDept.name", label: "所属部门", width: 120, align: "center" }, { prop: "sequence", label: "排序号", sortable: "custom", width: 100, align: "center" }, { prop: "createUserName", label: "创建人", sortable: "custom", width: 100, align: "center" }, { prop: "createTime", label: "创建时间", sortable: "custom", width: 180, align: "center" }, { prop: "lastUpdateUserName", label: "最后更新人", sortable: "custom", width: 120, align: "center" }, { prop: "lastUpdateTime", label: "最后更新时间", sortable: "custom", width: 180, align: "center" } ]); const selections = ref([]); const datasource = async ({ queryParam, pageParam, orderParamList }) => { var _a, _b; const data = { ...queryParam, ...pageParam, orderParamList, organizationIdForEqual: props.organization.id, // 查询用户存在的角色id selectUserExistsRoleIdForEqual: ((_a = props.param) == null ? void 0 : _a.isDisableSelectExistsRole) && ((_b = props.param) == null ? void 0 : _b.selectUserExistsRoleId) }; const res = await http.post(`${application.gatewayServerBaseUrl}/uims-api/admin/uims-user/selectPage`, data); return res.data.data; }; const queryPage = () => { var _a, _b, _c; selections.value = []; (_c = (_a = tableRef.value) == null ? void 0 : _a.reload) == null ? void 0 : _c.call(_a, { currentPage: 1, queryParam: (_b = queryRef.value) == null ? void 0 : _b.queryForm }); }; watch( () => props.organization.id, () => { var _a, _b; (_b = (_a = queryRef.value) == null ? void 0 : _a.resetFields) == null ? void 0 : _b.call(_a); queryPage(); } ); __expose({ selections }); return (_ctx, _cache) => { const _component_el_icon = resolveComponent("el-icon"); const _component_el_tag = resolveComponent("el-tag"); const _component_el_avatar = resolveComponent("el-avatar"); const _component_ele_pro_table = resolveComponent("ele-pro-table"); return openBlock(), createElementBlock(Fragment, null, [ createVNode(UserQuery, { ref_key: "queryRef", ref: queryRef, style: { "margin-bottom": "-14px" }, onQuery: queryPage }, null, 512), createVNode(_component_ele_pro_table, { ref_key: "tableRef", ref: tableRef, "row-key": "id", border: "", sticky: false, columns: columns.value, datasource, "show-overflow-tooltip": true, selections: selections.value, "onUpdate:selections": _cache[0] || (_cache[0] = ($event) => selections.value = $event), "highlight-current-row": true, "header-cell-style": { "text-align": "center" }, "footer-style": { paddingBottom: "16px" } }, { name: withCtx(({ row }) => [ createVNode(_component_el_icon, { size: 15, style: { "margin-right": "8px", "vertical-align": "-2px" } }, { default: withCtx(() => [ createVNode(unref(User)) ]), _: 1 }), createElementVNode("span", null, toDisplayString(row.name), 1), row.isSystemUser ? (openBlock(), createBlock(_component_el_tag, { key: 0, type: "warning", "disable-transitions": true, class: "yu-name-tag" }, { default: withCtx(() => _cache[1] || (_cache[1] = [ createTextVNode("系统用户") ])), _: 1, __: [1] })) : createCommentVNode("", true) ]), avatar: withCtx(({ row }) => [ createVNode(_component_el_avatar, { size: 28, src: row.avatarUrl, icon: row.avatarUrl ? void 0 : unref(UserOutlined), style: normalizeStyle(row.avatarUrl ? "transform: translateY(2px);" : "transform: translateY(2px);margin-bottom: 7px;") }, null, 8, ["src", "icon", "style"]) ]), status: withCtx(({ row }) => [ createVNode(_component_el_tag, { type: row.status === 1 ? "success" : "danger", "disable-transitions": true }, { default: withCtx(() => [ createTextVNode(toDisplayString(row.status === 1 ? "正常" : "禁用"), 1) ]), _: 2 }, 1032, ["type"]) ]), _: 1 }, 8, ["columns", "selections"]) ], 64); }; } }); export { _sfc_main as default };