mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-02 23:40:24 +08:00
fix: 数据库表新增数据表单全必填问题修复等
This commit is contained in:
@@ -259,6 +259,7 @@ const handleSrcTableCheckChange = (data: { id: string; name: string }, checked:
|
||||
}
|
||||
}
|
||||
if (data.id && (data.id + '').startsWith('list-item')) {
|
||||
//
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ const handleBlur = () => {
|
||||
if (editorOpening.value) {
|
||||
return;
|
||||
}
|
||||
if (props.dataType == DataType.Number && !/^-?\d*\.?\d+$/.test(itemValue.value)) {
|
||||
if (props.dataType == DataType.Number && itemValue.value && !/^-?\d*\.?\d+$/.test(itemValue.value)) {
|
||||
ElMessage.error('输入内容与类型不匹配');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:key="column.columnName"
|
||||
class="w100 mb5"
|
||||
:prop="column.columnName"
|
||||
:required="column.nullable != 'YES' && !column.isPrimaryKey && !column.isIdentity"
|
||||
:required="!column.nullable && !column.isPrimaryKey && !column.isIdentity"
|
||||
>
|
||||
<template #label>
|
||||
<span class="pointer" :title="`${column.columnType} | ${column.columnComment}`">
|
||||
|
||||
@@ -58,13 +58,6 @@
|
||||
placeholder="请输入密码, 修改操作可不填"
|
||||
autocomplete="new-password"
|
||||
>
|
||||
<!-- <template v-if="form.id && form.id != 0" #suffix>
|
||||
<el-popover @hide="pwd = ''" placement="right" title="原密码" :width="200" trigger="click" :content="pwd">
|
||||
<template #reference>
|
||||
<el-link @click="getPwd" :underline="false" type="primary" class="mr5">原密码</el-link>
|
||||
</template>
|
||||
</el-popover>
|
||||
</template> -->
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="db" label="库号" required>
|
||||
@@ -106,7 +99,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { toRefs, reactive, ref, watchEffect } from 'vue';
|
||||
import { toRefs, reactive, ref, watch } from 'vue';
|
||||
import { redisApi } from './api';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import TagTreeSelect from '../component/TagTreeSelect.vue';
|
||||
@@ -207,23 +200,25 @@ const { dialogVisible, tabActiveName, form, submitForm, dbList } = toRefs(state)
|
||||
const { isFetching: testConnBtnLoading, execute: testConnExec } = redisApi.testConn.useApi(submitForm);
|
||||
const { isFetching: saveBtnLoading, execute: saveRedisExec } = redisApi.saveRedis.useApi(submitForm);
|
||||
|
||||
watchEffect(() => {
|
||||
state.dialogVisible = props.visible;
|
||||
if (!state.dialogVisible) {
|
||||
return;
|
||||
watch(
|
||||
() => props.visible,
|
||||
() => {
|
||||
state.dialogVisible = props.visible;
|
||||
if (!state.dialogVisible) {
|
||||
return;
|
||||
}
|
||||
state.tabActiveName = 'basic';
|
||||
const redis: any = props.redis;
|
||||
if (redis) {
|
||||
state.form = { ...redis };
|
||||
state.form.tagCodePaths = redis.tags.map((t: any) => t.codePath);
|
||||
convertDb(state.form.db);
|
||||
} else {
|
||||
state.form = { db: '0', tagCodePaths: [] } as any;
|
||||
state.dbList = [0];
|
||||
}
|
||||
}
|
||||
state.tabActiveName = 'basic';
|
||||
const redis: any = props.redis;
|
||||
if (redis) {
|
||||
state.form = { ...redis };
|
||||
state.form.tagCodePaths = redis.tags.map((t: any) => t.codePath);
|
||||
convertDb(state.form.db);
|
||||
} else {
|
||||
state.form = { db: '0', tagCodePaths: [] } as any;
|
||||
|
||||
state.dbList = [0];
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
const convertDb = (db: string) => {
|
||||
state.dbList = db.split(',').map((x) => Number.parseInt(x));
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<DrawerHeader :header="addTeamDialog.form.id ? '编辑团队' : '添加团队'" :back="cancelSaveTeam" />
|
||||
</template>
|
||||
|
||||
<el-form ref="teamForm" :model="addTeamDialog.form" label-width="auto">
|
||||
<el-form ref="teamForm" :model="addTeamDialog.form" :rules="teamFormRules" label-width="auto">
|
||||
<el-form-item prop="name" label="团队名" required>
|
||||
<el-input :disabled="addTeamDialog.form.id" v-model="addTeamDialog.form.name" auto-complete="off"></el-input>
|
||||
</el-form-item>
|
||||
@@ -106,6 +106,16 @@ const teamForm: any = ref(null);
|
||||
const pageTableRef: Ref<any> = ref(null);
|
||||
const showMemPageTableRef: Ref<any> = ref(null);
|
||||
|
||||
const teamFormRules = {
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入团队名',
|
||||
trigger: ['change', 'blur'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const searchItems = [SearchItem.input('name', '团队名称')];
|
||||
const columns = [
|
||||
TableColumn.new('name', '团队名称'),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog :title="title" v-model="dvisible" :show-close="false" :before-close="cancel" width="900px" :destroy-on-close="true">
|
||||
<el-form ref="configForm" :model="form" label-width="auto">
|
||||
<el-form ref="configForm" :model="form" :rules="rules" label-width="auto">
|
||||
<el-form-item prop="name" label="配置项" required>
|
||||
<el-input v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
@@ -46,6 +46,23 @@ import { configApi, accountApi } from '../api';
|
||||
import { DynamicFormEdit } from '@/components/dynamic-form';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
const rules = {
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入配置项',
|
||||
trigger: ['change', 'blur'],
|
||||
},
|
||||
],
|
||||
key: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入配置key',
|
||||
trigger: ['change', 'blur'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
|
||||
@@ -255,6 +255,13 @@ const changeLinkType = () => {
|
||||
};
|
||||
|
||||
const btnOk = async () => {
|
||||
try {
|
||||
await menuForm.value.validate();
|
||||
} catch (e: any) {
|
||||
ElMessage.error('请正确填写信息');
|
||||
return false;
|
||||
}
|
||||
|
||||
const submitForm = { ...state.form };
|
||||
if (submitForm.type == 1) {
|
||||
// 如果是菜单,则解析meta,如果值为false或者''则去除该值
|
||||
@@ -263,13 +270,6 @@ const btnOk = async () => {
|
||||
submitForm.meta = null as any;
|
||||
}
|
||||
|
||||
try {
|
||||
await menuForm.value.validate();
|
||||
} catch (e: any) {
|
||||
ElMessage.error('请正确填写信息');
|
||||
return false;
|
||||
}
|
||||
|
||||
state.submitForm = submitForm;
|
||||
await saveResouceExec();
|
||||
|
||||
@@ -317,10 +317,4 @@ const cancel = () => {
|
||||
emit('cancel');
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
// .m-dialog {
|
||||
// .el-cascader {
|
||||
// width: 100%;
|
||||
// }
|
||||
// }
|
||||
</style>
|
||||
<style lang="scss"></style>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="role-dialog">
|
||||
<el-dialog :title="title" v-model="dvisible" :show-close="false" :before-close="cancel" width="500px" :destroy-on-close="true">
|
||||
<el-form ref="roleForm" :model="form" label-width="auto">
|
||||
<el-form ref="roleForm" :model="form" :rules="rules" label-width="auto">
|
||||
<el-form-item prop="name" label="角色名称" required>
|
||||
<el-input v-model="form.name" auto-complete="off"></el-input>
|
||||
</el-form-item>
|
||||
@@ -32,6 +32,30 @@ import { ref, toRefs, reactive, watchEffect } from 'vue';
|
||||
import { roleApi } from '../api';
|
||||
import { RoleStatusEnum } from '../enums';
|
||||
|
||||
const rules = {
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入角色名称',
|
||||
trigger: ['change', 'blur'],
|
||||
},
|
||||
],
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入角色编号',
|
||||
trigger: ['change', 'blur'],
|
||||
},
|
||||
],
|
||||
status: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择状态',
|
||||
trigger: ['change', 'blur'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
|
||||
Reference in New Issue
Block a user