|
@@ -298,16 +298,29 @@ const toChang = async (name) => {
|
|
|
const onSubmit = async () => {
|
|
|
const data = cloneDeep(form.value)
|
|
|
let res
|
|
|
- if (type.value == 'User') res = await store.update(data)
|
|
|
- else if (type.value == 'Expert') res = await expertStore.update(data)
|
|
|
- else if (type.value == 'Company') res = await companyStore.update(data)
|
|
|
- else if (type.value == 'Unit') res = await unitStore.update(data)
|
|
|
- else if (type.value == 'Association') res = await associationStore.update(data)
|
|
|
- else if (type.value == 'School') res = await schoolStore.update(data)
|
|
|
- else if (type.value == 'Competition') res = await competitionStore.update(data)
|
|
|
- else if (type.value == 'Incubator') res = await incubatorStore.update(data)
|
|
|
- else if (type.value == 'Investment') res = await investmentStore.update(data)
|
|
|
- else if (type.value == 'State') res = await stateStore.update(data)
|
|
|
+ if (data.id) {
|
|
|
+ if (type.value == 'User') res = await store.update(data)
|
|
|
+ else if (type.value == 'Expert') res = await expertStore.update(data)
|
|
|
+ else if (type.value == 'Company') res = await companyStore.update(data)
|
|
|
+ else if (type.value == 'Unit') res = await unitStore.update(data)
|
|
|
+ else if (type.value == 'Association') res = await associationStore.update(data)
|
|
|
+ else if (type.value == 'School') res = await schoolStore.update(data)
|
|
|
+ else if (type.value == 'Competition') res = await competitionStore.update(data)
|
|
|
+ else if (type.value == 'Incubator') res = await incubatorStore.update(data)
|
|
|
+ else if (type.value == 'Investment') res = await investmentStore.update(data)
|
|
|
+ else if (type.value == 'State') res = await stateStore.update(data)
|
|
|
+ } else {
|
|
|
+ if (type.value == 'User') res = await store.create(data)
|
|
|
+ else if (type.value == 'Expert') res = await expertStore.create(data)
|
|
|
+ else if (type.value == 'Company') res = await companyStore.create(data)
|
|
|
+ else if (type.value == 'Unit') res = await unitStore.create(data)
|
|
|
+ else if (type.value == 'Association') res = await associationStore.create(data)
|
|
|
+ else if (type.value == 'School') res = await schoolStore.create(data)
|
|
|
+ else if (type.value == 'Competition') res = await competitionStore.create(data)
|
|
|
+ else if (type.value == 'Incubator') res = await incubatorStore.create(data)
|
|
|
+ else if (type.value == 'Investment') res = await investmentStore.create(data)
|
|
|
+ else if (type.value == 'State') res = await stateStore.create(data)
|
|
|
+ }
|
|
|
if ($checkRes(res, true)) {
|
|
|
search({ skip, limit })
|
|
|
toClose()
|