|
@@ -24,7 +24,7 @@
|
|
|
|
|
|
<div class="part-box">
|
|
|
<a-space class="part-action" :size="6">
|
|
|
- <a-button type="text" @click="newUser">
|
|
|
+ <a-button type="text" @click="toAdd">
|
|
|
<template #icon>
|
|
|
<svg-icon name="add"></svg-icon>
|
|
|
</template>
|
|
@@ -101,7 +101,7 @@
|
|
|
</template>
|
|
|
<template v-if="column.dataIndex === 'action'">
|
|
|
<div class="action-cell">
|
|
|
- <a-button type="text" @click="showModal(record)">编辑</a-button>
|
|
|
+ <a-button type="text" @click="toEdit(record)">编辑</a-button>
|
|
|
<a-button
|
|
|
type="text"
|
|
|
:danger="record.enable"
|
|
@@ -118,52 +118,6 @@
|
|
|
</a-table>
|
|
|
</div>
|
|
|
|
|
|
- <a-modal
|
|
|
- v-model:open="visible"
|
|
|
- title="用户信息页"
|
|
|
- okText="确定"
|
|
|
- cancelText="取消"
|
|
|
- :width="438"
|
|
|
- @ok="handleOk"
|
|
|
- >
|
|
|
- <a-form :labelCol="{ span: 4 }">
|
|
|
- <a-form-item v-if="store.isSuperAdmin" label="学校">
|
|
|
- <RootOrgSelect
|
|
|
- v-model:value="userObj.rootOrgId"
|
|
|
- :disabled="!!userObj.id"
|
|
|
- selectFirst
|
|
|
- />
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="姓名">
|
|
|
- <a-input v-model:value="userObj.name"></a-input>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="登录名">
|
|
|
- <a-input
|
|
|
- v-model:value="userObj.loginName"
|
|
|
- :disabled="!!userObj.id"
|
|
|
- ></a-input>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="登录密码">
|
|
|
- <a-input
|
|
|
- v-model:value="userObj.password"
|
|
|
- :disabled="!!userObj.id"
|
|
|
- ></a-input>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="角色">
|
|
|
- <RoleSelect
|
|
|
- v-model:value="userObj.role"
|
|
|
- :rootOrgId="userObj.rootOrgId"
|
|
|
- />
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="状态">
|
|
|
- <a-radio-group v-model:value="userObj.enable">
|
|
|
- <a-radio :value="true">启用</a-radio>
|
|
|
- <a-radio :value="false">禁用</a-radio>
|
|
|
- </a-radio-group>
|
|
|
- </a-form-item>
|
|
|
- </a-form>
|
|
|
- </a-modal>
|
|
|
-
|
|
|
<a-modal
|
|
|
v-model:open="importModalVisible"
|
|
|
title="批量用户导入"
|
|
@@ -173,10 +127,10 @@
|
|
|
>
|
|
|
<a-form>
|
|
|
<a-form-item v-show="store.isSuperAdmin" label="学校">
|
|
|
- <RootOrgSelect
|
|
|
+ <!-- <RootOrgSelect
|
|
|
v-show="store.isSuperAdmin"
|
|
|
v-model:value="userObj.rootOrgId"
|
|
|
- />
|
|
|
+ /> -->
|
|
|
</a-form-item>
|
|
|
<a-form-item label="文件地址">
|
|
|
<input id="file-input" :multiple="false" type="file" />
|
|
@@ -188,6 +142,9 @@
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
</a-modal>
|
|
|
+
|
|
|
+ <!-- ModifyUser -->
|
|
|
+ <ModifyUser ref="modifyUserRef" :row-data="curRow" @modified="search" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -198,14 +155,13 @@ import {
|
|
|
importUsers,
|
|
|
resetPasswords,
|
|
|
toggleUsers,
|
|
|
- updateUser,
|
|
|
} from "@/api/userManagementPage";
|
|
|
-import router from "@/router";
|
|
|
import { useMainStore } from "@/store";
|
|
|
import { User } from "@/types";
|
|
|
import { downloadFileURL } from "@/utils/utils";
|
|
|
import { message, Modal } from "ant-design-vue";
|
|
|
-import { watch, onMounted, ref, reactive, toRaw, h } from "vue";
|
|
|
+import { watch, onMounted, h, ref } from "vue";
|
|
|
+import ModifyUser from "./ModifyUser.vue";
|
|
|
|
|
|
const store = useMainStore();
|
|
|
store.currentLocation = "";
|
|
@@ -316,44 +272,16 @@ onMounted(async () => {
|
|
|
await search();
|
|
|
});
|
|
|
|
|
|
-const visible = ref<boolean>(false);
|
|
|
-
|
|
|
-const showModal = (record: User) => {
|
|
|
- Object.assign(userObj, record);
|
|
|
- visible.value = true;
|
|
|
-};
|
|
|
-
|
|
|
-const handleOk = async () => {
|
|
|
- await updateUser(toRaw(userObj));
|
|
|
- visible.value = false;
|
|
|
- await search();
|
|
|
- void message.success({ content: "操作成功" });
|
|
|
-};
|
|
|
-
|
|
|
-const initUser = <User>(<unknown>{
|
|
|
- id: undefined,
|
|
|
- code: "",
|
|
|
- name: "",
|
|
|
- loginName: "",
|
|
|
- password: "",
|
|
|
- enable: true,
|
|
|
- role: "",
|
|
|
- rootOrgId: store.isSuperAdmin ? null : store.userInfo.rootOrgId,
|
|
|
-});
|
|
|
-let userObj = reactive({ ...initUser });
|
|
|
-
|
|
|
-const newUser = () => {
|
|
|
- Object.assign(userObj, initUser);
|
|
|
- userObj.rootOrgId = rootOrgId as number;
|
|
|
- console.log(userObj.rootOrgId);
|
|
|
-
|
|
|
- showModal(userObj);
|
|
|
-};
|
|
|
-
|
|
|
-// let curRoleCode = $ref("");
|
|
|
-// function roleChange(data: RoleOption | null) {
|
|
|
-// curRoleCode = data ? data.code : "";
|
|
|
-// }
|
|
|
+const modifyUserRef = ref();
|
|
|
+const curRow = ref<User>({} as User);
|
|
|
+function toAdd() {
|
|
|
+ curRow.value = {} as User;
|
|
|
+ modifyUserRef.value?.open();
|
|
|
+}
|
|
|
+function toEdit(row: User) {
|
|
|
+ curRow.value = row;
|
|
|
+ modifyUserRef.value?.open();
|
|
|
+}
|
|
|
|
|
|
function checkEmpty(selectIds: number[]): boolean {
|
|
|
if (selectIds && selectIds.length > 0) {
|
|
@@ -435,10 +363,6 @@ async function downloadTpl() {
|
|
|
await downloadFileURL("/api/ess/user/template");
|
|
|
}
|
|
|
|
|
|
-async function handleUserPrivilege(userId: number) {
|
|
|
- await router.push("/basic/user/privilege/" + userId);
|
|
|
-}
|
|
|
-
|
|
|
const handleRowSelect = (selectedRowKeys: (string | number)[]) => {
|
|
|
selectIds = selectedRowKeys as number[];
|
|
|
};
|