<script setup lang="ts">
|
import { ref } from "vue";
|
import ReCol from "@/components/ReCol";
|
import { formRules } from "../utils/rule";
|
import { FormProps } from "../utils/types";
|
import { usePublicHooks } from "../../hooks";
|
|
const props = withDefaults(defineProps<FormProps>(), {
|
formInline: () => ({
|
title: "新增",
|
higherDeptOptions: [],
|
id: null, // ID (integer($int64), 可空)
|
cusExtendId: null, // 组织机构ID (integer($int64), 可空)
|
name: null, // 姓名 (string, 可空)
|
nickname: null, // 昵称 (string, 可空)
|
phoneNumber: null, // 电话号码 (string, 可空)
|
remarks: null, // 备注 (string, 可空)
|
jobTitle: null, // 职务 (string, 可空)
|
avatar: null, // 头像 (string, 可空)
|
isEn: true, // 是否启用 (boolean, 不可空)
|
passWord: null, // 密码 (string, 可空)
|
isManager: false, // 是否是管理员 全权限 (boolean, 不可空)
|
signature: null // isEn:false,//是否启用 (string, 可空)
|
})
|
});
|
|
const sexOptions = [
|
{
|
value: 0,
|
label: "男"
|
},
|
{
|
value: 1,
|
label: "女"
|
}
|
];
|
const ruleFormRef = ref();
|
const { switchStyle } = usePublicHooks();
|
const newFormInline = ref(props.formInline);
|
|
function getRef() {
|
return ruleFormRef.value;
|
}
|
|
defineExpose({ getRef });
|
</script>
|
|
<template>
|
<el-form
|
ref="ruleFormRef"
|
:model="newFormInline"
|
:rules="formRules"
|
label-width="82px"
|
>
|
<el-row :gutter="30">
|
<re-col :value="12" :xs="24" :sm="24">
|
<el-form-item label="姓名" prop="name">
|
<el-input
|
v-model="newFormInline.name"
|
clearable
|
placeholder="请输入姓名"
|
/>
|
</el-form-item>
|
</re-col>
|
<re-col :value="12" :xs="24" :sm="24">
|
<el-form-item label="手机号" prop="phoneNumber">
|
<el-input
|
v-model="newFormInline.phoneNumber"
|
clearable
|
placeholder="请输入手机号"
|
/>
|
</el-form-item>
|
</re-col>
|
<re-col
|
v-if="newFormInline.title === '新增'"
|
:value="12"
|
:xs="24"
|
:sm="24"
|
>
|
<el-form-item label="是否管理员">
|
<el-switch
|
v-model="newFormInline.isManager"
|
inline-prompt
|
:active-value="true"
|
:inactive-value="false"
|
active-text="是"
|
inactive-text="否"
|
:style="switchStyle"
|
/>
|
</el-form-item>
|
</re-col>
|
<re-col :value="12" :xs="24" :sm="24">
|
<el-form-item label="是否启用">
|
<el-switch
|
v-model="newFormInline.isEn"
|
inline-prompt
|
:active-value="true"
|
:inactive-value="false"
|
active-text="启用"
|
inactive-text="停用"
|
:style="switchStyle"
|
/>
|
</el-form-item>
|
</re-col>
|
|
<re-col>
|
<el-form-item label="备注">
|
<el-input
|
v-model="newFormInline.remarks"
|
placeholder="请输入备注信息"
|
type="textarea"
|
/>
|
</el-form-item>
|
</re-col>
|
</el-row>
|
</el-form>
|
</template>
|