fix: naive code
This commit is contained in:
@@ -59,8 +59,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING, 'boolean'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
defaultValue: true,
|
||||
rules: 'required',
|
||||
|
||||
@@ -34,8 +34,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.SYSTEM_USER_SEX, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -44,9 +42,8 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
rules: 'required',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
type: 'datetime',
|
||||
valueFormat: 'YYYY-MM-dd HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -34,8 +34,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.SYSTEM_USER_SEX, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -44,9 +42,8 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
rules: 'required',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
type: 'datetime',
|
||||
valueFormat: 'YYYY-MM-dd HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -34,8 +34,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.SYSTEM_USER_SEX, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -44,9 +42,8 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
rules: 'required',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
type: 'datetime',
|
||||
valueFormat: 'YYYY-MM-dd HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -57,9 +57,7 @@ function handleEdit(row: Demo03StudentApi.Demo03Student) {
|
||||
async function handleDelete(row: Demo03StudentApi.Demo03Student) {
|
||||
const hideLoading = message.loading(
|
||||
$t('ui.actionMessage.deleting', [row.id]),
|
||||
{
|
||||
duration: 0,
|
||||
},
|
||||
{ duration: 0 },
|
||||
);
|
||||
try {
|
||||
await deleteDemo03Student(row.id!);
|
||||
|
||||
@@ -34,8 +34,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.SYSTEM_USER_SEX, 'number'),
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -44,9 +42,8 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
rules: 'required',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
type: 'datetime',
|
||||
valueFormat: 'YYYY-MM-dd HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -50,9 +50,7 @@ function handleEdit(row: Demo03StudentApi.Demo03Student) {
|
||||
async function handleDelete(row: Demo03StudentApi.Demo03Student) {
|
||||
const hideLoading = message.loading(
|
||||
$t('ui.actionMessage.deleting', [row.id]),
|
||||
{
|
||||
duration: 0,
|
||||
},
|
||||
{ duration: 0 },
|
||||
);
|
||||
try {
|
||||
await deleteDemo03Student(row.id!);
|
||||
|
||||
@@ -53,9 +53,7 @@ async function handleCopyUrl(row: InfraFileApi.File) {
|
||||
async function handleDelete(row: InfraFileApi.File) {
|
||||
const hideLoading = message.loading(
|
||||
$t('ui.actionMessage.deleting', [row.name || row.path]),
|
||||
{
|
||||
duration: 0,
|
||||
},
|
||||
{ duration: 0 },
|
||||
);
|
||||
try {
|
||||
await deleteFile(row.id!);
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { UploadFileInfo } from 'naive-ui';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { NUpload } from 'naive-ui';
|
||||
import { NUpload, NUploadDragger } from 'naive-ui';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { message } from '#/adapter/naive';
|
||||
@@ -50,8 +50,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
/** 上传前 */
|
||||
function beforeUpload(file: UploadFileInfo) {
|
||||
formApi.setFieldValue('file', file);
|
||||
function beforeUpload(data: {
|
||||
file: UploadFileInfo;
|
||||
fileList: UploadFileInfo[];
|
||||
}) {
|
||||
formApi.setFieldValue('file', data.file.file);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@@ -62,21 +65,23 @@ function beforeUpload(file: UploadFileInfo) {
|
||||
<template #file>
|
||||
<div class="w-full">
|
||||
<!-- 上传区域 -->
|
||||
<NUpload.Dragger
|
||||
<NUpload
|
||||
name="file"
|
||||
:max-count="1"
|
||||
:max="1"
|
||||
:multiple="false"
|
||||
accept=".jpg,.png,.gif,.webp"
|
||||
:before-upload="beforeUpload"
|
||||
list-type="picture-card"
|
||||
@before-upload="beforeUpload"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<span class="icon-[ant-design--inbox-outlined] text-2xl"></span>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或拖拽文件到此区域上传</p>
|
||||
<p class="ant-upload-hint">
|
||||
支持 .jpg、.png、.gif、.webp 格式图片文件
|
||||
</p>
|
||||
</NUpload.Dragger>
|
||||
<NUploadDragger>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<span class="icon-[ant-design--inbox-outlined] text-2xl"></span>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或拖拽文件到此区域上传</p>
|
||||
<p class="ant-upload-hint">
|
||||
支持 .jpg、.png、.gif、.webp 格式图片文件
|
||||
</p>
|
||||
</NUploadDragger>
|
||||
</NUpload>
|
||||
</div>
|
||||
</template>
|
||||
</Form>
|
||||
|
||||
@@ -130,8 +130,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{ label: '主动模式', value: 'Active' },
|
||||
{ label: '被动模式', value: 'Passive' },
|
||||
],
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
@@ -201,8 +199,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{ label: '启用', value: true },
|
||||
{ label: '禁用', value: false },
|
||||
],
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
@@ -220,8 +216,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
{ label: '公开', value: true },
|
||||
{ label: '私有', value: false },
|
||||
],
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
@@ -326,7 +320,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 240,
|
||||
width: 280,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
|
||||
@@ -45,9 +45,7 @@ function handleEdit(row: InfraFileConfigApi.FileConfig) {
|
||||
async function handleMaster(row: InfraFileConfigApi.FileConfig) {
|
||||
const hideLoading = message.loading(
|
||||
$t('ui.actionMessage.updating', [row.name]),
|
||||
{
|
||||
duration: 0,
|
||||
},
|
||||
{ duration: 0 },
|
||||
);
|
||||
try {
|
||||
await updateFileConfigMaster(row.id!);
|
||||
@@ -83,9 +81,7 @@ async function handleTest(row: InfraFileConfigApi.FileConfig) {
|
||||
async function handleDelete(row: InfraFileConfigApi.FileConfig) {
|
||||
const hideLoading = message.loading(
|
||||
$t('ui.actionMessage.deleting', [row.name]),
|
||||
{
|
||||
duration: 0,
|
||||
},
|
||||
{ duration: 0 },
|
||||
);
|
||||
try {
|
||||
await deleteFileConfig(row.id!);
|
||||
|
||||
@@ -110,9 +110,7 @@ function handleLog(row?: InfraJobApi.Job) {
|
||||
async function handleDelete(row: InfraJobApi.Job) {
|
||||
const hideLoading = message.loading(
|
||||
$t('ui.actionMessage.deleting', [row.name]),
|
||||
{
|
||||
duration: 0,
|
||||
},
|
||||
{ duration: 0 },
|
||||
);
|
||||
try {
|
||||
await deleteJob(row.id!);
|
||||
|
||||
@@ -9,8 +9,6 @@ import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
@@ -31,12 +29,10 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
clearable: true,
|
||||
type: 'datetime',
|
||||
valueFormat: 'YYYY-MM-dd HH:mm:ss',
|
||||
defaultTime: '00:00:00',
|
||||
placeholder: '选择开始执行时间',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
showTime: {
|
||||
format: 'HH:mm:ss',
|
||||
defaultValue: dayjs('00:00:00', 'HH:mm:ss'),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -45,12 +41,10 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
clearable: true,
|
||||
type: 'datetime',
|
||||
valueFormat: 'YYYY-MM-dd HH:mm:ss',
|
||||
defaultTime: '23:59:59',
|
||||
placeholder: '选择结束执行时间',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
showTime: {
|
||||
format: 'HH:mm:ss',
|
||||
defaultValue: dayjs('23:59:59', 'HH:mm:ss'),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user