|
@@ -10,7 +10,7 @@
|
|
|
ref="testForm">
|
|
|
<van-cell-group inset>
|
|
|
<div v-for="(i, index) in formConfig" :key="index" :style="i.style || ''">
|
|
|
- <van-field v-if="i.type == 'title'" style="background: #ecebeb;">
|
|
|
+ <van-field v-if="i.type == 'title'" style="background: #ecebeb">
|
|
|
<template #input>
|
|
|
<div class="_title">
|
|
|
{{ i.title }}
|
|
@@ -135,7 +135,7 @@
|
|
|
is-link
|
|
|
:readonly="true"
|
|
|
:placeholder="i.placeholder ? i.placeholder : '请选择'"
|
|
|
- @click="() => (!formOption.readonly ?i.needDefault? defaultTimeFn(i, index) :i.showPicker=true: '')"
|
|
|
+ @click="() => (!formOption.readonly ? (i.needDefault ? defaultTimeFn(i, index) : (i.showPicker = true)) : '')"
|
|
|
:rules="getRules(i.prop)"
|
|
|
:required="getRequired(i.prop)">
|
|
|
</van-field>
|
|
@@ -285,7 +285,6 @@
|
|
|
@confirm="
|
|
|
(option) => (item.changeFn ? item.changeFn(option, item, currentIndex, currentSonIndex, btnConfigCopy.prop) : onConfirmListPicker(option, item))
|
|
|
" />
|
|
|
- <!-- @confirm="(option) => onConfirmListPicker(option, item)" -->
|
|
|
</van-popup>
|
|
|
<van-popup v-model:show="item.showPicker" round position="bottom" v-if="item.type == 'picker' && item.itemType == 'datePicker'">
|
|
|
<van-date-picker
|
|
@@ -326,11 +325,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { showLoadingToast, closeToast, showNotify } from "vant";
|
|
|
+import { showLoadingToast, closeToast } from "vant";
|
|
|
import { formatDate } from "@/utils/auth";
|
|
|
-import { ref, getCurrentInstance, onMounted, reactive, computed, toRefs, watch } from "vue";
|
|
|
+import { ref, getCurrentInstance, computed, toRefs, watch } from "vue";
|
|
|
|
|
|
-const submitBtn = ref(null);
|
|
|
const props = defineProps({
|
|
|
modelValue: {
|
|
|
type: Object,
|
|
@@ -355,7 +353,6 @@ const formData = computed(() => {
|
|
|
return proxy.modelValue;
|
|
|
});
|
|
|
const cityOption = ref([]);
|
|
|
-const fileList = ref([]);
|
|
|
const fieldNames = { text: "label", value: "id", children: "children" };
|
|
|
const onePickerFieldNames = {
|
|
|
text: "text",
|
|
@@ -382,10 +379,6 @@ const getRequired = (prop) => {
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
-const getReadonly = (i) => {
|
|
|
- return i.readonly ? i.readonly : i.name == "picker" ? true : false;
|
|
|
-};
|
|
|
-
|
|
|
const getFieldReadonly = (i) => {
|
|
|
if (i.readonly && i.readonly === true) {
|
|
|
return true;
|
|
@@ -448,7 +441,6 @@ let callNum = ref(0);
|
|
|
let callListNum = ref(0);
|
|
|
const formDataListShowLabel = () => {
|
|
|
for (let i = 0; i < formData.value[btnConfigCopy.prop].length; i++) {
|
|
|
- const iele = formData.value[btnConfigCopy.prop][i];
|
|
|
for (let j = 0; j < btnConfigCopy.listConfig.length; j++) {
|
|
|
const jele = btnConfigCopy.listConfig[j];
|
|
|
if (jele.type === "picker" && jele.itemType !== "datePicker") {
|
|
@@ -551,8 +543,6 @@ const formDataInit = () => {
|
|
|
if (element.type === "cascader" && element.itemType === "city" && cityStatus) {
|
|
|
cityStatus = false;
|
|
|
cityOptionInit();
|
|
|
- // formData.value[element.prop] = map[element.type];
|
|
|
- // formData.value[element.prop + "Name"] = map[element.type];
|
|
|
}
|
|
|
if (formData.value[element.prop] === undefined || formData.value[element.prop] === "") {
|
|
|
if (element.type === "slot") {
|
|
@@ -822,7 +812,7 @@ const defaultTimeFn = (item, index) => {
|
|
|
const validateForm = async () => {
|
|
|
try {
|
|
|
const flag = await testForm.value.validate();
|
|
|
- return flag
|
|
|
+ return flag;
|
|
|
} catch (err) {
|
|
|
return true;
|
|
|
}
|
|
@@ -833,7 +823,6 @@ defineExpose({
|
|
|
btnConfigCopy,
|
|
|
validateForm,
|
|
|
});
|
|
|
-// onMounted(() => {});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|