|
@@ -26,7 +26,7 @@
|
|
|
:type="i.itemType ? i.itemType : 'text'"
|
|
|
:placeholder="i.placeholder ? i.placeholder : '请输入'"
|
|
|
:clearable="i.clearable ? i.clearable : false"
|
|
|
- :readonly="i.readonly != undefined ? i.readonly : false"
|
|
|
+ :readonly="getFieldReadonly(i)"
|
|
|
:rules="getRules(i.prop)"
|
|
|
:required="getRequired(i.prop)"
|
|
|
>
|
|
@@ -94,7 +94,7 @@
|
|
|
:name="i.prop"
|
|
|
v-model="formData[i.prop + 'Name']"
|
|
|
is-link
|
|
|
- :readonly="i.readonly != undefined ? i.readonly : true"
|
|
|
+ :readonly="true"
|
|
|
:placeholder="i.placeholder ? i.placeholder : '请选择'"
|
|
|
@click="() => (!formOption.readonly ? (i.showPicker = true) : '')"
|
|
|
:rules="getRules(i.prop)"
|
|
@@ -113,7 +113,12 @@
|
|
|
i.fieldNames ? i.fieldNames : onePickerFieldNames
|
|
|
"
|
|
|
@cancel="i.showPicker = false"
|
|
|
- @confirm="(option) => onConfirmPicker(option, i, index)"
|
|
|
+ @confirm="
|
|
|
+ (option) =>
|
|
|
+ i.changeFn
|
|
|
+ ? i.changeFn(option, i, index)
|
|
|
+ : onConfirmPicker(option, i, index)
|
|
|
+ "
|
|
|
/>
|
|
|
</van-popup>
|
|
|
<!-- 时间选择器 -->
|
|
@@ -123,7 +128,7 @@
|
|
|
:name="i.prop"
|
|
|
v-model="formData[i.prop]"
|
|
|
is-link
|
|
|
- :readonly="i.readonly != undefined ? i.readonly : true"
|
|
|
+ :readonly="true"
|
|
|
:placeholder="i.placeholder ? i.placeholder : '请选择'"
|
|
|
@click="() => (!formOption.readonly ? (i.showPicker = true) : '')"
|
|
|
:rules="getRules(i.prop)"
|
|
@@ -151,7 +156,7 @@
|
|
|
:name="i.prop"
|
|
|
v-model="formData[i.prop + 'Name']"
|
|
|
is-link
|
|
|
- :readonly="i.readonly != undefined ? i.readonly : true"
|
|
|
+ :readonly="true"
|
|
|
:placeholder="i.placeholder ? i.placeholder : '请选择'"
|
|
|
@click="() => (!formOption.readonly ? (i.showPicker = true) : '')"
|
|
|
:rules="getRules(i.prop)"
|
|
@@ -182,7 +187,7 @@
|
|
|
:name="i.prop"
|
|
|
v-model="formData[i.prop + 'Name']"
|
|
|
is-link
|
|
|
- :readonly="i.readonly != undefined ? i.readonly : true"
|
|
|
+ :readonly="true"
|
|
|
:placeholder="i.placeholder ? i.placeholder : '请选择'"
|
|
|
@click="() => (!formOption.readonly ? (i.showPicker = true) : '')"
|
|
|
:rules="getRules(i.prop)"
|
|
@@ -263,7 +268,7 @@
|
|
|
:type="i.itemType ? i.itemType : 'text'"
|
|
|
:placeholder="i.placeholder ? i.placeholder : '请输入'"
|
|
|
:clearable="i.clearable ? i.clearable : false"
|
|
|
- :readonly="i.readonly != undefined ? i.readonly : false"
|
|
|
+ :readonly="getFieldReadonly(i)"
|
|
|
:rules="getRules(i.prop)"
|
|
|
:required="getRequired(i.prop)"
|
|
|
@change="
|
|
@@ -280,7 +285,7 @@
|
|
|
:name="i.prop"
|
|
|
v-model="formData[btnConfigCopy.prop][index][i.prop + 'Name']"
|
|
|
is-link
|
|
|
- :readonly="i.readonly != undefined ? i.readonly : true"
|
|
|
+ :readonly="true"
|
|
|
:placeholder="i.placeholder ? i.placeholder : '请选择'"
|
|
|
@click="handleListItemClick(i, index, sonIndex)"
|
|
|
:rules="getRules(i.prop)"
|
|
@@ -294,7 +299,7 @@
|
|
|
:name="i.prop"
|
|
|
v-model="formData[btnConfigCopy.prop][index][i.prop]"
|
|
|
is-link
|
|
|
- :readonly="i.readonly != undefined ? i.readonly : true"
|
|
|
+ :readonly="true"
|
|
|
:placeholder="i.placeholder ? i.placeholder : '请选择'"
|
|
|
@click="handleListItemClick(i, index, sonIndex)"
|
|
|
:rules="getRules(i.prop)"
|
|
@@ -437,6 +442,18 @@ const getReadonly = (i) => {
|
|
|
return i.readonly ? i.readonly : i.name == "picker" ? true : false;
|
|
|
};
|
|
|
|
|
|
+const getFieldReadonly = (i) => {
|
|
|
+ if (i.readonly && i.readonly === true) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ if (formOption.value.readonly && formOption.value.readonly === true) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
// 国家初始化
|
|
|
const cityOptionInit = () => {
|
|
|
proxy.post("/areaInfo/list", { parentId: "0" }).then((res) => {
|
|
@@ -552,38 +569,6 @@ const formDataShowLabel = () => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (formOption.value.btnConfig && formOption.value.btnConfig.isNeed) {
|
|
|
- const list = formData.value[btnConfigCopy.prop];
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
- const x = list[i];
|
|
|
- for (let j = 0; j < btnConfigCopy.listConfig.length; j++) {
|
|
|
- const listEle = btnConfigCopy.listConfig[j];
|
|
|
- if (
|
|
|
- listEle.type === "picker" &&
|
|
|
- listEle.itemType &&
|
|
|
- listEle.itemType !== "datePicker"
|
|
|
- ) {
|
|
|
- if (listEle.data && listEle.data.length > 0) {
|
|
|
- formData.value[btnConfigCopy.prop][i][listEle.prop + "Name"] =
|
|
|
- selectDataEcho(
|
|
|
- listEle,
|
|
|
- formData.value[btnConfigCopy.prop][i][listEle.prop]
|
|
|
- );
|
|
|
- } else {
|
|
|
- if (callNum.value <= 3) {
|
|
|
- setTimeout(() => {
|
|
|
- callNum.value++;
|
|
|
- return formDataShowLabel();
|
|
|
- }, 1500);
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- } else {
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
};
|
|
|
|
|
|
const formDataInit = () => {
|
|
@@ -598,7 +583,10 @@ const formDataInit = () => {
|
|
|
upload: [],
|
|
|
};
|
|
|
// 判断是否需要按钮
|
|
|
- if (formOption.value.btnConfig && formOption.value.btnConfig.isNeed) {
|
|
|
+ if (
|
|
|
+ formOption.value.btnConfig &&
|
|
|
+ Object.keys(formOption.value.btnConfig).length > 0
|
|
|
+ ) {
|
|
|
btnConfigCopy = { ...formOption.value.btnConfig };
|
|
|
if (formData.value[btnConfigCopy.prop] === undefined) {
|
|
|
formData.value[btnConfigCopy.prop] = [];
|
|
@@ -667,18 +655,16 @@ const onConfirmPicker = (option, item, index) => {
|
|
|
const currentIndex = ref(-1);
|
|
|
const currentSonIndex = ref(-1);
|
|
|
const handleListItemClick = (i, index, sonIndex) => {
|
|
|
- if (i.readonly && i.readonly === true) {
|
|
|
+ if (i.readonly !== undefined && i.readonly === true) {
|
|
|
return;
|
|
|
- }
|
|
|
- if (i.readonly !== undefined && i.readonly === false) {
|
|
|
- currentIndex.value = index;
|
|
|
- currentSonIndex.value = sonIndex;
|
|
|
- btnConfigCopy.listConfig[sonIndex].showPicker = true;
|
|
|
- }
|
|
|
- if (!formOption.value.readonly) {
|
|
|
- currentIndex.value = index;
|
|
|
- currentSonIndex.value = sonIndex;
|
|
|
- btnConfigCopy.listConfig[sonIndex].showPicker = true;
|
|
|
+ } else {
|
|
|
+ if (formOption.value.readonly) {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ currentIndex.value = index;
|
|
|
+ currentSonIndex.value = sonIndex;
|
|
|
+ btnConfigCopy.listConfig[sonIndex].showPicker = true;
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
const onConfirmListPicker = (option, item) => {
|