Commit 749e2052 by yancanhua

feat: 自定义表单修改

1 parent 19b58247
......@@ -16,7 +16,7 @@ import selectDropdown from "@/components/CustomizeForm/selectDropdown.vue";
// 获取父组件传递数据
const props = withDefaults(
defineProps<{
allowNoStructure?: boolean;
bigModuleLabel?: string;
leafNodes?: InspectionNode[];
subTabLabel?: string;
......@@ -26,7 +26,6 @@ const props = withDefaults(
leafNodes: () => [],
bigModuleLabel: "",
subTabLabel: "",
allowNoStructure: false,
templateDefaultData: null,
});
......@@ -42,6 +41,9 @@ const resultStatus = ref(false);
const form = ref({});
const rules = ref({});
//是否支持"无此结构":0-否,1-是
const allowNoStructure = ref(false);
// 加载中
const pageLoading = ref(false);
......@@ -51,8 +53,9 @@ watch(() => props.leafNodes, (nodes) => {
...item,
value: getValueText(item),
})) as InspectionColumnRow[];
console.log("watchLeafNodes", columnsList.value);
if (columnsList.value && columnsList.value.length) {
allowNoStructure.value = columnsList?.value?.[0]?.allowNoStructure == 1;
}
setTimeout(() => {
pageLoading.value = false;
}, 1200);
......@@ -266,12 +269,13 @@ defineExpose({
<template>
<div>
<van-overlay :show="pageLoading" z-index="2000" >
<van-overlay :show="pageLoading" z-index="2000">
<div class="loadingBox">
<van-loading color="#1989fa" size="24px" vertical>加载中...</van-loading>
</div>
</van-overlay>
<div v-if="!pageLoading">
<van-form ref="customizeFormRef" :model="form" :rules="rules">
<div v-if="allowNoStructure" class="formTitle">
<div @click="resultStatus = !resultStatus">
......@@ -290,16 +294,16 @@ defineExpose({
<div v-if="item.interactionType == 'text_input'">
<van-field v-model="item.value" clearable :label="item.nodeName"
:maxlength="getValidationRules(item).maxLength || 120" :placeholder="item.placeholder"
:required="item.required === 1" :disabled="item.editPermission == '0'"
input-align="right" label-width="120px" />
:required="item.required === 1" :disabled="item.editPermission == '0'" input-align="right"
label-width="120px" />
</div>
<!-- 长文本输入框 -->
<div v-if="item.interactionType == 'textarea_input'">
<van-field v-model="item.value" autosize clearable :label="item.nodeName"
:maxlength="getValidationRules(item).maxLength || 120" :placeholder="item.placeholder"
:required="item.required === 1" rows="2" show-word-limit type="textarea"
input-align="right" label-width="120px" />
:required="item.required === 1" rows="2" show-word-limit type="textarea" input-align="right"
label-width="120px" />
</div>
<!-- 数字输入框 -->
......@@ -310,7 +314,7 @@ defineExpose({
:min="getValidationRules(item).min || 0" :placeholder="item.placeholder"
:required="item.required === 1" step="0.01" type="number"
@input="(e) => { item.value = parseFloat(item.value)?.toFixed(getValidationRules(item).decimalDigits || 2) || '' }"
input-align="right" label-width="120px" >
input-align="right" label-width="120px">
<template v-if="item.suffix" #right-icon>
<span>{{ item.suffix }}</span>
</template>
......@@ -347,7 +351,7 @@ defineExpose({
<!-- image_upload_and_button_select -->
<div v-if="item.interactionType == 'image_upload_and_button_select'">
<buttonSelect :item="item" :value="item.value" @update="item.value = $event" />
<buttonSelectAndImageUpload :item="item" @update="item.uploadValue = $event" />
<buttonSelectAndImageUpload :item="item" @update="item.uploadValue = $event" />
</div>
</div>
......@@ -361,7 +365,7 @@ defineExpose({
float: left;
display: flex;
width: 100%;
padding: 16px 12px;
padding: 0 12px;
background: #fff;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!