|
@@ -64,7 +64,7 @@
|
|
|
:label-width="labelWidth"
|
|
|
type="radio"
|
|
|
/>
|
|
|
-
|
|
|
+
|
|
|
<!-- 时间戳 -->
|
|
|
<wd-calendar
|
|
|
v-if="item.__config__.jnpfKey === 'date'"
|
|
@@ -114,10 +114,6 @@ const props = defineProps({
|
|
|
type: String,
|
|
|
default: '',
|
|
|
},
|
|
|
- dataForm: {
|
|
|
- type: Object,
|
|
|
- default: () => ({}),
|
|
|
- },
|
|
|
rules: {
|
|
|
type: Object,
|
|
|
default: () => ({}),
|
|
@@ -143,20 +139,16 @@ const props = defineProps({
|
|
|
default: null,
|
|
|
},
|
|
|
});
|
|
|
-
|
|
|
-const {
|
|
|
- refName,
|
|
|
- formKey,
|
|
|
- id,
|
|
|
- dataForm,
|
|
|
- rules,
|
|
|
- oldFormData,
|
|
|
- formItemBorder,
|
|
|
- labelWidth,
|
|
|
- filedList,
|
|
|
- uplodKey,
|
|
|
-} = toRefs(props);
|
|
|
-console.log('🚀 ~ filedList,:', filedList);
|
|
|
+
|
|
|
+const { formKey, id, rules, oldFormData, formItemBorder, labelWidth, filedList, uplodKey } =
|
|
|
+ toRefs(props);
|
|
|
+const dataForm = ref({});
|
|
|
+watch(
|
|
|
+ () => oldFormData.value,
|
|
|
+ (newVal) => {
|
|
|
+ dataForm.value = JSON.parse(newVal || '{}');
|
|
|
+ }
|
|
|
+);
|
|
|
const form = ref();
|
|
|
const toast = useToast();
|
|
|
function handleSubmit() {
|
|
@@ -171,8 +163,8 @@ function handleSubmit() {
|
|
|
fileld: item.fileld,
|
|
|
url: item.fileld,
|
|
|
};
|
|
|
- })
|
|
|
- }
|
|
|
+ });
|
|
|
+ }
|
|
|
const params = {
|
|
|
id: id.value,
|
|
|
formKey: formKey.value,
|
|
@@ -193,26 +185,26 @@ function handleSubmit() {
|
|
|
fileld: item.fileld,
|
|
|
url: config.baseURL + item.fileld,
|
|
|
};
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
if (res.code === 200) {
|
|
|
toast.success('更新成功');
|
|
|
} else {
|
|
|
toast.error('提交失败');
|
|
|
- }
|
|
|
+ }
|
|
|
});
|
|
|
- }
|
|
|
+ }
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
console.log(error, 'error');
|
|
|
- })
|
|
|
-}
|
|
|
+ });
|
|
|
+}
|
|
|
watch(
|
|
|
() => filedList.value,
|
|
|
(newVal) => {
|
|
|
initSelectOptions();
|
|
|
- }
|
|
|
+ }
|
|
|
);
|
|
|
function initSelectOptions() {
|
|
|
filedList.value.forEach((item) => {
|
|
@@ -227,7 +219,7 @@ function initSelectOptions() {
|
|
|
[item.__config__.props.label]: dataForm.value[item.__vModel__],
|
|
|
},
|
|
|
];
|
|
|
- }
|
|
|
+ }
|
|
|
} // DemoApi.getSelectOptionsUrl(item.__config__.propsUrl).then((res) => {
|
|
|
// let url = 'bi-api' + res.data.apiUrl;
|
|
|
// // 去除第一位的/
|
|
@@ -243,18 +235,18 @@ function initSelectOptions() {
|
|
|
// item.selectOptions = item.__slot__.options || [];
|
|
|
// }
|
|
|
});
|
|
|
-}
|
|
|
-
|
|
|
+}
|
|
|
+
|
|
|
function handleChangeFile({ fileList }) {
|
|
|
// 如果不是数组
|
|
|
const arr = [];
|
|
|
if (!Array.isArray(fileList)) {
|
|
|
fileList = [];
|
|
|
- }
|
|
|
+ }
|
|
|
for (let i = 0; i < fileList.length; i++) {
|
|
|
const val = fileList[i];
|
|
|
const response = JSON.parse(val.response);
|
|
|
-
|
|
|
+
|
|
|
if (response.code === 200) {
|
|
|
const obj = {
|
|
|
url: config.baseURL + response.msg,
|
|
@@ -262,10 +254,10 @@ function handleChangeFile({ fileList }) {
|
|
|
fileld: response.msg,
|
|
|
};
|
|
|
arr.push(obj);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
dataForm.value[uplodKey.value] = arr;
|
|
|
-}
|
|
|
+}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.footer {
|