31
0
Fork 0

feat: 用户模块的新增表单内容优化

develop
JINGYJ 2 years ago
parent d810b6abce
commit 0ea8281f70

@ -8,4 +8,4 @@ VITE_PUBLIC_PATH = /
VITE_ROUTER_HISTORY = "hash" VITE_ROUTER_HISTORY = "hash"
# 开发环境后端地址 # 开发环境后端地址
VITE_APP_BASE_URL = 'http://192.168.10.13:8000' VITE_APP_BASE_URL = 'http://192.168.10.81:8848'

@ -33,12 +33,12 @@ export type RefreshTokenResult = {
}; };
/** 登录 */ /** 登录 */
// export const getLogin = (data?: object) => {
// return http.request<UserResult>("post", "/login", { data });
// };
export const getLogin = (data?: object) => { export const getLogin = (data?: object) => {
return http.request<UserResult>("post", baseUrlApi("login"), { data }); return http.request<UserResult>("post", "/login", { data });
}; };
// export const getLogin = (data?: object) => {
// return http.request<UserResult>("post", baseUrlApi("login"), { data });
// };
// export const getLogin = (data?: object) => { // export const getLogin = (data?: object) => {
// const AdminHostUrl = getConfig().AdminHostUrl; // const AdminHostUrl = getConfig().AdminHostUrl;

@ -4,7 +4,7 @@ export default {
meta: { meta: {
icon: "lollipop", icon: "lollipop",
title: "配置管理", title: "配置管理",
// showLink: false, showLink: false,
rank: 5 rank: 5
}, },
children: [ children: [

@ -4,7 +4,7 @@ export default {
meta: { meta: {
icon: "lollipop", icon: "lollipop",
title: "数据统计", title: "数据统计",
// showLink: false, showLink: false,
rank: 4 rank: 4
}, },
children: [ children: [

@ -18,16 +18,158 @@ const props = withDefaults(defineProps<FormProps>(), {
/** 状态 */ /** 状态 */
status: null, status: null,
/** 组织 */ /** 组织 */
dept: { deptId: null
id: null,
name: ""
}
}) })
}); });
const ruleFormRef = ref(); const ruleFormRef = ref();
const newFormInline = ref(props.formInline); const newFormInline = ref(props.formInline);
// const deptList = reactive([
// {
// name: "",
// parentId: 0,
// id: 100,
// sort: 0,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 1, // 1 0
// type: 1, // 1 2 3
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// },
// {
// name: "",
// parentId: 100,
// id: 101,
// sort: 1,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 1,
// type: 2,
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// },
// {
// name: "",
// parentId: 101,
// id: 103,
// sort: 1,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 1,
// type: 3,
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// },
// {
// name: "",
// parentId: 102,
// id: 108,
// sort: 1,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 1,
// type: 3,
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// },
// {
// name: "",
// parentId: 100,
// id: 102,
// sort: 2,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 1,
// type: 2,
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// },
// {
// name: "",
// parentId: 101,
// id: 104,
// sort: 2,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 1,
// type: 3,
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// },
// {
// name: "",
// parentId: 102,
// id: 109,
// sort: 2,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 1,
// type: 3,
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// },
// {
// name: "",
// parentId: 101,
// id: 105,
// sort: 3,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 0,
// type: 3,
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// },
// {
// name: "",
// parentId: 101,
// id: 106,
// sort: 4,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 1,
// type: 3,
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// },
// {
// name: "",
// parentId: 101,
// id: 107,
// sort: 5,
// phone: "15888888888",
// principal: "@cname()",
// email: "@email",
// status: 0,
// type: 3,
// createTime: 1605456000000,
// remark: "@cparagraph(1, 3)"
// }
// ]);
// const buildTree = (data: any, parentId: number) => {
// const children = data.filter(
// (node: { parentId: number }) => node.parentId === parentId
// );
// return children.map((node: { id: any; name: any }) => {
// const { id, name } = node;
// return {
// value: id,
// label: name,
// children: buildTree(data, id)
// };
// });
// };
function getRef() { function getRef() {
return ruleFormRef.value; return ruleFormRef.value;
} }
@ -67,5 +209,22 @@ defineExpose({ getRef });
inactive-text="已关闭" inactive-text="已关闭"
/> />
</el-form-item> </el-form-item>
<el-form-item label="性别" prop="sex">
<el-select v-model="newFormInline.sex" placeholder="请选择">
<el-option label="未知" :value="2" />
<el-option label="男" :value="0" />
<el-option label="女" :value="1" />
</el-select>
</el-form-item>
<!-- <el-form-item label="所属部门" prop="deptId">
<el-tree-select
v-model="newFormInline.deptId"
placeholder="请选择所属部门"
:data="buildTree(deptList, 0)"
filterable
check-strictly
:render-after-expand="false"
/>
</el-form-item> -->
</el-form> </el-form>
</template> </template>

@ -37,6 +37,7 @@ const {
confirmClick, confirmClick,
handleCheckAllChange, handleCheckAllChange,
handleCheckedCitiesChange, handleCheckedCitiesChange,
resetPassword,
onSearch, onSearch,
openDialog, openDialog,
resetForm, resetForm,
@ -162,7 +163,6 @@ console.log(allRole);
link link
type="primary" type="primary"
:size="size" :size="size"
@click="handleUpdate(row)"
:icon="useRenderIcon(More)" :icon="useRenderIcon(More)"
/> />
<template #dropdown> <template #dropdown>
@ -173,6 +173,7 @@ console.log(allRole);
link link
type="primary" type="primary"
:size="size" :size="size"
@click="resetPassword(row)"
:icon="useRenderIcon(Password)" :icon="useRenderIcon(Password)"
> >
重置密码 重置密码
@ -211,7 +212,7 @@ console.log(allRole);
v-model="checkAll" v-model="checkAll"
:indeterminate="isIndeterminate" :indeterminate="isIndeterminate"
@change="handleCheckAllChange" @change="handleCheckAllChange"
class="!w-[200px]" class="!w-[100%]"
>全部</el-checkbox >全部</el-checkbox
> >
<el-checkbox-group <el-checkbox-group

@ -163,6 +163,7 @@ export function useUser() {
function handleUpdate(row) { function handleUpdate(row) {
console.log(row); console.log(row);
openDialog("编辑", row);
} }
function handleDelete(row) { function handleDelete(row) {
@ -284,7 +285,8 @@ export function useUser() {
formInline: { formInline: {
username: row?.username ?? "", username: row?.username ?? "",
mobile: row?.mobile ?? "", mobile: row?.mobile ?? "",
status: row?.status ?? "" status: row?.status ?? "",
sex: row?.sex ?? ""
} }
}, },
width: "40%", width: "40%",
@ -396,6 +398,26 @@ export function useUser() {
//不确定的样式 //不确定的样式
isIndeterminate.value = value.length !== allRole.value.length; isIndeterminate.value = value.length !== allRole.value.length;
} }
function resetPassword(row: { username: string; id: any }) {
ElMessageBox.prompt(
"请输入用户「" + row.username + "」的新密码",
"重置密码",
{
confirmButtonText: "确定",
cancelButtonText: "取消"
}
)
.then(({ value }) => {
if (!value) {
message(`请输入新密码`, {
type: "warning"
});
return false;
}
})
.catch(() => {});
}
onMounted(() => { onMounted(() => {
onSearch(); onSearch();
}); });
@ -415,6 +437,7 @@ export function useUser() {
confirmClick, confirmClick,
handleCheckAllChange, handleCheckAllChange,
handleCheckedCitiesChange, handleCheckedCitiesChange,
resetPassword,
onSearch, onSearch,
openDialog, openDialog,
resetForm, resetForm,

@ -7,6 +7,10 @@ interface FormItemProps {
status: number; status: number;
/** 手机 */ /** 手机 */
mobile: string; mobile: string;
/** 性别 */
sex: number;
/** 性别 */
deptId: number;
} }
interface FormProps { interface FormProps {
formInline: FormItemProps; formInline: FormItemProps;

Loading…
Cancel
Save