feat:限制模块名称规则
This commit is contained in:
parent
66f19d8ef1
commit
a36fa86d8d
@ -8,7 +8,6 @@ use Exception;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Develop\Support\Generate\Create\Schema;
|
||||
use Illuminate\Support\Facades\Schema as SchemaFacade;
|
||||
|
||||
class Schemas extends CatchModel
|
||||
{
|
||||
@ -108,22 +107,4 @@ class Schemas extends CatchModel
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete
|
||||
*
|
||||
* @param $id
|
||||
* @param bool $force
|
||||
* @return bool|null
|
||||
*/
|
||||
public function deleteBy($id, bool $force = false): ?bool
|
||||
{
|
||||
$schema = parent::firstBy($id);
|
||||
|
||||
if ($schema->delete()) {
|
||||
SchemaFacade::dropIfExists($schema->name);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,16 @@
|
||||
required: true,
|
||||
message: '模块名称必须填写',
|
||||
},
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
if (! /^[A-Za-z]+$/.test(value)) {
|
||||
callback('模块名称只允许大小字母组合')
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<el-input v-model="formData.title" />
|
||||
|
@ -64,7 +64,7 @@ const schemaVisible = ref<boolean>(false)
|
||||
const api = 'schema'
|
||||
|
||||
const { data, query, search, reset, loading } = useGetList(api)
|
||||
const { destroy, deleted } = useDestroy('确认删除吗? 将会删除数据库的 Schema,请提前做好备份,一旦删除,将无法恢复!')
|
||||
const { destroy, deleted } = useDestroy('确认删除吗? 删除后数据表将会保留,如需删除相关表,请手动进行删除!')
|
||||
const { open, close, title, visible, id } = useOpen()
|
||||
|
||||
const tableData = computed(() => data.value?.data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user