mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
fix(components): 修复上传组件回显问题,修改accept参数逻辑
This commit is contained in:
@ -53,12 +53,13 @@ function createDefaultModel(): Model {
|
||||
};
|
||||
}
|
||||
|
||||
type RuleKey = Extract<keyof Model, 'id' | 'deptId' | 'userId' | 'testKey' | 'value'>;
|
||||
type RuleKey = Extract<keyof Model, 'id' | 'deptId' | 'userId' | 'orderNum' | 'testKey' | 'value'>;
|
||||
|
||||
const rules: Record<RuleKey, App.Global.FormRule> = {
|
||||
id: createRequiredRule('主键不能为空'),
|
||||
deptId: createRequiredRule('部门不能为空'),
|
||||
userId: createRequiredRule('用户不能为空'),
|
||||
orderNum: createRequiredRule('排序号不能为空'),
|
||||
testKey: createRequiredRule('key 键不能为空'),
|
||||
value: createRequiredRule('值不能为空')
|
||||
};
|
||||
@ -124,7 +125,7 @@ watch(visible, () => {
|
||||
<NInput v-model:value="model.testKey" placeholder="请输入 key 键" />
|
||||
</NFormItem>
|
||||
<NFormItem label="值" path="value">
|
||||
<NInput v-model:value="model.value" placeholder="请输入值" />
|
||||
<OssUpload v-model:value="model.value as string" upload-type="image" placeholder="请输入值" />
|
||||
</NFormItem>
|
||||
<NFormItem label="备注" path="remark">
|
||||
<NInput v-model:value="model.remark" type="textarea" placeholder="请输入备注" />
|
||||
|
@ -2,6 +2,7 @@
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import type { UploadFileInfo } from 'naive-ui';
|
||||
import FileUpload from '@/components/custom/file-upload.vue';
|
||||
import { AcceptType } from '@/enum/business';
|
||||
|
||||
defineOptions({
|
||||
name: 'OssUploadModal'
|
||||
@ -23,9 +24,7 @@ const visible = defineModel<boolean>('visible', {
|
||||
default: false
|
||||
});
|
||||
|
||||
const accept = computed(() => {
|
||||
return props.uploadType === 'file' ? '.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.pdf' : '.jpg,.jpeg,.png,.gif,.bmp,.webp';
|
||||
});
|
||||
const accept = computed(() => (props.uploadType === 'file' ? AcceptType.File : AcceptType.Image));
|
||||
|
||||
const fileList = ref<UploadFileInfo[]>([]);
|
||||
|
||||
|
Reference in New Issue
Block a user