|
|
@ -63,6 +63,37 @@ |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
<template v-else-if="item.type === 'step'"> |
|
|
|
|
|
<div class="grid-container gap2"> |
|
|
|
|
|
<div v-for="(sItem, key) in item.config" class="c-Item flex item-center" :class="getSpanClass(sItem)" |
|
|
|
|
|
:key="key"> |
|
|
|
|
|
<div class="step-title" v-if="sItem.label">{{ sItem.label }}</div> |
|
|
|
|
|
<div v-if="sItem.type === 'dateTime'"> |
|
|
|
|
|
<HandleFormItem type="dateTime" :item="sItem" v-model="formFields[key]" |
|
|
|
|
|
@copy="onCopy(sItem, key)" /> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div v-else-if="sItem.type === 'select'" class="flex flex1"> |
|
|
|
|
|
<HandleFormItem type="select" :item="sItem" style="width: auto;flex:1" v-model="formFields[key]" |
|
|
|
|
|
@copy="onCopy(sItem, key)" @change="onSelectChange(key, $event)" /> |
|
|
|
|
|
<div v-show="isShowOther(formFields[key])" class="flex flex1"> |
|
|
|
|
|
<div class="other-title">其他</div> |
|
|
|
|
|
<div class="flex"> |
|
|
|
|
|
<HandleFormItem class="sub-select" :item="getOtherItem(sItem)" v-model="formFields[sItem.otherCode]" |
|
|
|
|
|
@copy="onCopy(sItem, key)" /> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div v-else-if="sItem.type === 'input'" class="flex flex1"> |
|
|
|
|
|
<HandleFormItem class="flex1" :item="sItem" v-model="formFields[key]" |
|
|
|
|
|
@copy="onCopy(sItem, key)" /> |
|
|
|
|
|
<HandleFormItem v-if="sItem.subType === 'select'" type="select" class="sub-select" :item="getSubItem(sItem)" v-model="formFields[sItem.subKey]" |
|
|
|
|
|
@copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" /> |
|
|
|
|
|
<div v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div> |
|
|
|
|
|
<div class="clickable" v-else-if = "sItem.subType ==='clickable'" @click="handleClickable(sItem)">{{ formFields[sItem.subKey] }}</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</template> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
@ -104,6 +135,10 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
handleClickable(sItem){ |
|
|
|
|
|
console.log(sItem) |
|
|
|
|
|
this.$emit("clickable",sItem) |
|
|
|
|
|
}, |
|
|
//根据span判断一行显示几列 |
|
|
//根据span判断一行显示几列 |
|
|
getSpanClass(sItem){ |
|
|
getSpanClass(sItem){ |
|
|
const spanArr = ["full-row","","three-row"] |
|
|
const spanArr = ["full-row","","three-row"] |
|
|
@ -112,12 +147,19 @@ export default { |
|
|
} |
|
|
} |
|
|
return "" |
|
|
return "" |
|
|
}, |
|
|
}, |
|
|
|
|
|
//获取其他下拉框的配置 |
|
|
getOtherItem(sItem){ |
|
|
getOtherItem(sItem){ |
|
|
return { |
|
|
return { |
|
|
label:"其他", |
|
|
label:"其他", |
|
|
fillType: sItem.fillType, |
|
|
fillType: sItem.fillType, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
getSubItem(sItem){ |
|
|
|
|
|
return { |
|
|
|
|
|
label: sItem.label, |
|
|
|
|
|
options: sItem.subOptions || [], |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
isShowOther(v = []) { |
|
|
isShowOther(v = []) { |
|
|
// 确保v是数组类型,以避免类型错误 |
|
|
// 确保v是数组类型,以避免类型错误 |
|
|
const arr = Array.isArray(v) ? v : [v]; |
|
|
const arr = Array.isArray(v) ? v : [v]; |
|
|
@ -177,6 +219,11 @@ export default { |
|
|
result[otherCode] = formData[otherCode] || ''; |
|
|
result[otherCode] = formData[otherCode] || ''; |
|
|
config[otherCode] = { label: "其他", type: "input" } |
|
|
config[otherCode] = { label: "其他", type: "input" } |
|
|
} |
|
|
} |
|
|
|
|
|
if (currentConfig.subKey) { |
|
|
|
|
|
const { subKey } = currentConfig; |
|
|
|
|
|
result[subKey] = formData[subKey] || ''; |
|
|
|
|
|
config[subKey] = { label: currentConfig.label, type: currentConfig.subType } |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 处理可能存在的直接otherCode字段 |
|
|
// 处理可能存在的直接otherCode字段 |
|
|
@ -295,6 +342,14 @@ export default { |
|
|
font-weight: normal; |
|
|
font-weight: normal; |
|
|
color: #606266; |
|
|
color: #606266; |
|
|
} |
|
|
} |
|
|
|
|
|
.step-title{ |
|
|
|
|
|
font-size: 14px; |
|
|
|
|
|
font-weight: normal; |
|
|
|
|
|
color: #606266; |
|
|
|
|
|
width: 150px; |
|
|
|
|
|
text-align: right; |
|
|
|
|
|
padding-right: 10px; |
|
|
|
|
|
} |
|
|
.p-r-20{ |
|
|
.p-r-20{ |
|
|
padding-right: 20px; |
|
|
padding-right: 20px; |
|
|
} |
|
|
} |
|
|
@ -315,8 +370,16 @@ export default { |
|
|
.flex { |
|
|
.flex { |
|
|
display: flex; |
|
|
display: flex; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.other-title{ |
|
|
|
|
|
width: 50px; |
|
|
|
|
|
text-align: right; |
|
|
|
|
|
margin: 0 10px; |
|
|
|
|
|
} |
|
|
.mr-24 { |
|
|
.mr-24 { |
|
|
margin-right: 24px; |
|
|
margin-right: 24px; |
|
|
} |
|
|
} |
|
|
|
|
|
.sub-select{ |
|
|
|
|
|
width: auto; |
|
|
|
|
|
margin-left: 10px; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |