|
@@ -16,7 +16,7 @@
|
|
|
:globalParams="querys"
|
|
:globalParams="querys"
|
|
|
/>
|
|
/>
|
|
|
<Height :height="20" />
|
|
<Height :height="20" />
|
|
|
- <Button type="primary" @click="submit">提交</Button>
|
|
|
|
|
|
|
+ <Button type="primary" :loading="loading" @click="submit">提交</Button>
|
|
|
</FlexCol>
|
|
</FlexCol>
|
|
|
<XBarSpace />
|
|
<XBarSpace />
|
|
|
</CommonRoot>
|
|
</CommonRoot>
|
|
@@ -32,7 +32,7 @@ import { showError } from '@/common/composeabe/ErrorDisplay';
|
|
|
import { backAndCallOnPageBack } from '@/components/utils/PageAction';
|
|
import { backAndCallOnPageBack } from '@/components/utils/PageAction';
|
|
|
import { toast } from '@/components/utils/DialogAction';
|
|
import { toast } from '@/components/utils/DialogAction';
|
|
|
import { confirm } from '@/components/dialog/CommonRoot';
|
|
import { confirm } from '@/components/dialog/CommonRoot';
|
|
|
-import { Debounce, RequestApiError, waitTimeOut } from '@imengyu/imengyu-utils';
|
|
|
|
|
|
|
+import { Debounce, ObjectUtils, RequestApiError, waitTimeOut } from '@imengyu/imengyu-utils';
|
|
|
import VillageInfoApi, { CommonInfoModel } from '@/api/inhert/VillageInfoApi';
|
|
import VillageInfoApi, { CommonInfoModel } from '@/api/inhert/VillageInfoApi';
|
|
|
import DynamicForm from '@/components/dynamic/DynamicForm.vue';
|
|
import DynamicForm from '@/components/dynamic/DynamicForm.vue';
|
|
|
import LoadingPage from '@/components/display/loading/LoadingPage.vue';
|
|
import LoadingPage from '@/components/display/loading/LoadingPage.vue';
|
|
@@ -81,7 +81,7 @@ const { querys } = useLoadQuerys({
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
let formData = undefined;
|
|
let formData = undefined;
|
|
|
- await waitTimeOut(200);
|
|
|
|
|
|
|
+ await waitTimeOut(800);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
currentFormInfo = getVillageInfoForm(querys.subType, querys.subId);
|
|
currentFormInfo = getVillageInfoForm(querys.subType, querys.subId);
|
|
@@ -92,16 +92,38 @@ const { querys } = useLoadQuerys({
|
|
|
...forms(formRef as any)
|
|
...forms(formRef as any)
|
|
|
};
|
|
};
|
|
|
if (querys.id >= 0) {
|
|
if (querys.id >= 0) {
|
|
|
- formData = await VillageInfoApi.getInfo(
|
|
|
|
|
- collectStore.getCollectModuleId(querys.subType),
|
|
|
|
|
- querys.subType,
|
|
|
|
|
- querys.subId,
|
|
|
|
|
- querys.subKey,
|
|
|
|
|
- querys.villageId,
|
|
|
|
|
- querys.villageVolunteerId,
|
|
|
|
|
- querys.id,
|
|
|
|
|
- model,
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ if (currentFormInfo?.[2].typeName && querys.subId == -1) {
|
|
|
|
|
+ const ids = getVillageInfoFormIds(querys.subType);
|
|
|
|
|
+
|
|
|
|
|
+ for (const id of ids) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const data = await VillageInfoApi.getInfo(
|
|
|
|
|
+ collectStore.getCollectModuleId(querys.subType),
|
|
|
|
|
+ querys.subType,
|
|
|
|
|
+ id,
|
|
|
|
|
+ querys.subKey,
|
|
|
|
|
+ querys.villageId,
|
|
|
|
|
+ querys.villageVolunteerId,
|
|
|
|
|
+ querys.id,
|
|
|
|
|
+ model,
|
|
|
|
|
+ );
|
|
|
|
|
+ ObjectUtils.cloneValuesToObject(data, formModel.value);
|
|
|
|
|
+ } catch {
|
|
|
|
|
+ //ignore
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ formData = await VillageInfoApi.getInfo(
|
|
|
|
|
+ collectStore.getCollectModuleId(querys.subType),
|
|
|
|
|
+ querys.subType,
|
|
|
|
|
+ querys.subId,
|
|
|
|
|
+ querys.subKey,
|
|
|
|
|
+ querys.villageId,
|
|
|
|
|
+ querys.villageVolunteerId,
|
|
|
|
|
+ querys.id,
|
|
|
|
|
+ model,
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.log(e);
|
|
console.log(e);
|
|
@@ -111,12 +133,17 @@ const { querys } = useLoadQuerys({
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- formData = await loadLocalSave(formData as CommonInfoModel);
|
|
|
|
|
- if (formData)
|
|
|
|
|
- formModel.value = formData as any;
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ formData = await loadLocalSave(formData as CommonInfoModel);
|
|
|
|
|
+ if (formData)
|
|
|
|
|
+ formModel.value = formData as any;
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ showError(e, '加载本地保存数据失败');
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
await nextTick();
|
|
await nextTick();
|
|
|
- await waitTimeOut(100);
|
|
|
|
|
|
|
+ await waitTimeOut(400);
|
|
|
formRef.value.initDefaultValuesToModel();
|
|
formRef.value.initDefaultValuesToModel();
|
|
|
|
|
|
|
|
console.log(formModel.value);
|
|
console.log(formModel.value);
|
|
@@ -135,7 +162,6 @@ async function submit() {
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
- formModel.value.type = querys.value.subId;
|
|
|
|
|
await waitTimeOut(800);
|
|
await waitTimeOut(800);
|
|
|
if (currentFormInfo?.[2].typeName && querys.value.subId == -1) {
|
|
if (currentFormInfo?.[2].typeName && querys.value.subId == -1) {
|
|
|
const ids = getVillageInfoFormIds(querys.value.subType);
|
|
const ids = getVillageInfoFormIds(querys.value.subType);
|
|
@@ -161,6 +187,7 @@ async function submit() {
|
|
|
formModel.value as CommonInfoModel,
|
|
formModel.value as CommonInfoModel,
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
+ deleteLocalSave();
|
|
|
confirm({
|
|
confirm({
|
|
|
content: '您的提交已成功,感谢您的参与!',
|
|
content: '您的提交已成功,感谢您的参与!',
|
|
|
cancelText: '继续编辑',
|
|
cancelText: '继续编辑',
|