fix(user.vue): 用户新增表单状态设置默认值

Former-commit-id: 56cae685d77801726409a5ec162e8304baa3a7b7
This commit is contained in:
郝先瑞
2022-04-30 10:28:24 +08:00
parent 2656603f09
commit 192227edea

View File

@@ -56,9 +56,9 @@ import {
// DOM元素的引用声明定义 变量名和DOM的ref属性值一致 // DOM元素的引用声明定义 变量名和DOM的ref属性值一致
const deptTreeRef = ref(ElTree); // 部门树 const deptTreeRef = ref(ElTree); // 部门树
const queryFormRef = ref(ElForm); // 部门树 const queryFormRef = ref(ElForm); // 查询表单
const dataFormRef = ref(ElForm); // 部门树 const dataFormRef = ref(ElForm); // 用户表单
const importFormRef = ref(ElForm); // 导入 const importFormRef = ref(ElForm); // 导入表单
const { proxy }: any = getCurrentInstance(); const { proxy }: any = getCurrentInstance();
@@ -88,7 +88,9 @@ const state = reactive({
// 角色选项 // 角色选项
roleOptions: [] as RoleItem[], roleOptions: [] as RoleItem[],
// 表单参数 // 表单参数
formData: {} as UserFormData, formData: {
status:1
} as UserFormData,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@@ -392,7 +394,11 @@ async function showImportDialog() {
state.importDialog.visible = true state.importDialog.visible = true
} }
// Excel文件上传 /**
* Excel文件change事件
*
* @param file
*/
function handleExcelChange(file: UploadFile) { function handleExcelChange(file: UploadFile) {
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) { if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
ElMessage.warning('上传Excel只能为xlsx、xls格式'); ElMessage.warning('上传Excel只能为xlsx、xls格式');
@@ -403,6 +409,9 @@ function handleExcelChange(file: UploadFile) {
state.excelFile = file.raw state.excelFile = file.raw
} }
/**
* Excel文件上传
*/
function submitImportForm() { function submitImportForm() {
importFormRef.value.validate((valid: any) => { importFormRef.value.validate((valid: any) => {
if (valid) { if (valid) {
@@ -562,7 +571,7 @@ onMounted(() => {
</el-col> </el-col>
</el-row> </el-row>
<!-- 添加或修改参数配置对话框 --> <!-- 用户表单 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="600px" append-to-body @close="cancel"> <el-dialog :title="dialog.title" v-model="dialog.visible" width="600px" append-to-body @close="cancel">
<el-form ref="dataFormRef" :model="formData" :rules="rules" label-width="80px"> <el-form ref="dataFormRef" :model="formData" :rules="rules" label-width="80px">
<el-form-item label="用户名" prop="username"> <el-form-item label="用户名" prop="username">