|
@@ -2,10 +2,10 @@
|
|
|
import WdButton from 'wot-design-uni/components/wd-button/wd-button.vue'
|
|
|
import WdInput from 'wot-design-uni/components/wd-input/wd-input.vue'
|
|
|
import WdPicker from 'wot-design-uni/components/wd-picker/wd-picker.vue'
|
|
|
-import {ConfigProviderThemeVars} from 'wot-design-uni'
|
|
|
-import {DataFormProps, DataFormSchema} from './data-form'
|
|
|
-import {addUnit} from 'wot-design-uni/components/common/util'
|
|
|
-import {omit} from 'radash'
|
|
|
+import { ConfigProviderThemeVars } from 'wot-design-uni'
|
|
|
+import { DataFormProps, DataFormSchema } from './data-form'
|
|
|
+import { addUnit } from 'wot-design-uni/components/common/util'
|
|
|
+import { omit } from 'radash'
|
|
|
import WdForm from 'wot-design-uni/components/wd-form/wd-form.vue'
|
|
|
|
|
|
const types = {
|
|
@@ -85,7 +85,7 @@ const props = withDefaults(
|
|
|
rules?: { [key: string]: { required: boolean; message: string }[] }
|
|
|
direction?: 'horizontal' | 'vertical'
|
|
|
}>(),
|
|
|
- {direction: 'vertical', labelShow: true},
|
|
|
+ { direction: 'vertical', labelShow: true },
|
|
|
)
|
|
|
const emits = defineEmits(['submit'])
|
|
|
const form = ref<InstanceType<typeof WdForm>>()
|
|
@@ -96,7 +96,7 @@ const submitDisabled = computed(() => {
|
|
|
omit(
|
|
|
modelValue.value,
|
|
|
Object.entries(props.schema)
|
|
|
- .filter(([_key, {required}]) => !required)
|
|
|
+ .filter(([_key, { required }]) => !required)
|
|
|
.map(([key]) => key),
|
|
|
),
|
|
|
).some((it) => !it)
|
|
@@ -244,21 +244,27 @@ defineExpose({
|
|
|
? []
|
|
|
: modelValue[prop]?.split(',').map((it) => ({ url: it })),
|
|
|
}"
|
|
|
- @change="({ fileList }) => {
|
|
|
- const newUrls = fileList.map(({ response }) => {
|
|
|
- try {
|
|
|
- return JSON.parse(response).data;
|
|
|
- } catch (e) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- }).filter(Boolean); // 过滤掉无效的 null 值
|
|
|
- const existingUrls = modelValue[prop]?.split(',') ?? [];
|
|
|
- modelValue[prop] = [...existingUrls, ...newUrls].join(',');
|
|
|
-}"
|
|
|
- :before-remove="({file,fileList,resolve}) =>{
|
|
|
- resolve(true)
|
|
|
- modelValue[prop] = fileList.map(({ url }) => url).join(',');
|
|
|
- }"
|
|
|
+ @change="
|
|
|
+ ({ fileList }) => {
|
|
|
+ const newUrls = fileList
|
|
|
+ .map(({ response }) => {
|
|
|
+ try {
|
|
|
+ return JSON.parse(response).data
|
|
|
+ } catch (e) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .filter(Boolean) // 过滤掉无效的 null 值
|
|
|
+ const existingUrls = modelValue[prop]?.split(',') ?? []
|
|
|
+ modelValue[prop] = [...existingUrls, ...newUrls].join(',')
|
|
|
+ }
|
|
|
+ "
|
|
|
+ :before-remove="
|
|
|
+ ({ file, fileList, resolve }) => {
|
|
|
+ resolve(true)
|
|
|
+ modelValue[prop] = fileList.map(({ url }) => url).join(',')
|
|
|
+ }
|
|
|
+ "
|
|
|
></wd-upload>
|
|
|
<wd-button
|
|
|
v-if="type === 'Submit'"
|