|
@ -10,34 +10,36 @@ |
|
|
class="ml10">{{item.unit?item.unit:""}}</text> |
|
|
class="ml10">{{item.unit?item.unit:""}}</text> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
<template v-if="item.type==='select'"> |
|
|
|
|
|
<up-input inputAlign="right" v-model="formData[item.key]" disabled disabledColor="#ffffff" |
|
|
|
|
|
|
|
|
<template v-else-if="item.type==='select'"> |
|
|
|
|
|
<up-input inputAlign="right" :value="getDesc(formData[item.key], item.options)" disabled disabledColor="#ffffff" |
|
|
:placeholder="item.placeholder" border="none"></up-input> |
|
|
:placeholder="item.placeholder" border="none"></up-input> |
|
|
<template #right> |
|
|
<template #right> |
|
|
<up-icon name="arrow-right"></up-icon> |
|
|
<up-icon name="arrow-right"></up-icon> |
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
|
<template v-if="item.type==='radio'"> |
|
|
|
|
|
|
|
|
<template v-else-if="item.type==='radio'"> |
|
|
<up-radio-group v-model="formData[item.key]" placement="column"> |
|
|
<up-radio-group v-model="formData[item.key]" placement="column"> |
|
|
<div class="flex-rowr"> |
|
|
<div class="flex-rowr"> |
|
|
<up-radio class="mr16" activeColor="#FFBF60" :customStyle="{marginBottom: '8px'}" |
|
|
<up-radio class="mr16" activeColor="#FFBF60" :customStyle="{marginBottom: '8px'}" |
|
|
v-for="key in item.options" :key="key.name" :label="key.name" :name="key.name"> |
|
|
|
|
|
|
|
|
v-for="option in item.options" :key="option.value" :label="option.name" :name="option.value"> |
|
|
</up-radio> |
|
|
</up-radio> |
|
|
</div> |
|
|
</div> |
|
|
</up-radio-group> |
|
|
</up-radio-group> |
|
|
</template> |
|
|
</template> |
|
|
<template v-if="item.type==='textarea'"> |
|
|
|
|
|
|
|
|
<template v-else-if="item.type==='textarea'"> |
|
|
<up-textarea v-model="formData[item.key]" :placeholder="item.placeholder" count autoHeight |
|
|
<up-textarea v-model="formData[item.key]" :placeholder="item.placeholder" count autoHeight |
|
|
:maxlength="item.maxlength"></up-textarea> |
|
|
:maxlength="item.maxlength"></up-textarea> |
|
|
</template> |
|
|
</template> |
|
|
<template v-if="item.type==='upload'"> |
|
|
|
|
|
|
|
|
<template v-else-if="item.type==='upload'"> |
|
|
<up-upload :fileList="item.fileList" @afterRead="afterRead" @delete="deletePic" name="1" |
|
|
<up-upload :fileList="item.fileList" @afterRead="afterRead" @delete="deletePic" name="1" |
|
|
:multiple="item.multiple" :maxCount="item.maxCount" :accept='item.accept' |
|
|
:multiple="item.multiple" :maxCount="item.maxCount" :accept='item.accept' |
|
|
:previewFullImage="item.previewFullImage"></up-upload> |
|
|
:previewFullImage="item.previewFullImage"></up-upload> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</up-form-item> |
|
|
</up-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<slot :name="item.key"></slot> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<up-button @click="handleSubmit" class="mt20" type="warning" v-if="isFooter">提交</up-button> |
|
|
<up-button @click="handleSubmit" class="mt20" type="warning" v-if="isFooter">提交</up-button> |
|
|
</up-form> |
|
|
</up-form> |
|
@ -50,7 +52,8 @@ |
|
|
import { |
|
|
import { |
|
|
reactive, |
|
|
reactive, |
|
|
ref, |
|
|
ref, |
|
|
computed |
|
|
|
|
|
|
|
|
computed, |
|
|
|
|
|
watch, |
|
|
} from "vue" |
|
|
} from "vue" |
|
|
const { |
|
|
const { |
|
|
list, |
|
|
list, |
|
@ -66,12 +69,18 @@ |
|
|
}, |
|
|
}, |
|
|
isFooter: true |
|
|
isFooter: true |
|
|
}) |
|
|
}) |
|
|
const emit = defineEmits(['submit']) |
|
|
|
|
|
|
|
|
const emit = defineEmits(['submit', 'input']) |
|
|
const formData = reactive({ |
|
|
const formData = reactive({ |
|
|
name: "" |
|
|
name: "" |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
watch(formData, (val) => { |
|
|
|
|
|
emit('input', val) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
const sheet = reactive({ |
|
|
const sheet = reactive({ |
|
|
show: false, |
|
|
show: false, |
|
|
|
|
|
key: null, |
|
|
actions: [], |
|
|
actions: [], |
|
|
title: "", |
|
|
title: "", |
|
|
description: "" |
|
|
description: "" |
|
@ -89,6 +98,7 @@ |
|
|
// 开启弹框 |
|
|
// 开启弹框 |
|
|
const open = (item) => { |
|
|
const open = (item) => { |
|
|
sheet.show = true |
|
|
sheet.show = true |
|
|
|
|
|
sheet.key = item.key |
|
|
sheet.actions = item.options |
|
|
sheet.actions = item.options |
|
|
sheet.title = item.placeholder |
|
|
sheet.title = item.placeholder |
|
|
sheet.description = item.description || "" |
|
|
sheet.description = item.description || "" |
|
@ -100,8 +110,13 @@ |
|
|
|
|
|
|
|
|
// 选择 |
|
|
// 选择 |
|
|
const handleSelect = (val) => { |
|
|
const handleSelect = (val) => { |
|
|
console.log(val) |
|
|
|
|
|
|
|
|
formData[sheet.key] = val?.value |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getDesc = (val, options) => { |
|
|
|
|
|
return options.find(item => item.value === val)?.name |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 上传 |
|
|
// 上传 |
|
|
const afterRead = () => {} |
|
|
const afterRead = () => {} |
|
|
// 删除上传文件 |
|
|
// 删除上传文件 |
|
@ -115,11 +130,17 @@ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const validate = () => { |
|
|
|
|
|
return dFormRef.value.validate() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
defineExpose({ validate }) |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style> |
|
|
<style> |
|
|
.form-item { |
|
|
.form-item { |
|
|
height: 90rpx; |
|
|
|
|
|
|
|
|
min-height: 90rpx; |
|
|
padding-top: 10rpx; |
|
|
padding-top: 10rpx; |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
border-bottom: 1rpx solid #f5f5f5; |
|
|
border-bottom: 1rpx solid #f5f5f5; |
|
|