|
@@ -185,8 +185,10 @@ const toDel = (item) => {
|
|
|
.then(async () => {
|
|
|
let res
|
|
|
if (routeType.value == 'achievement') res = await achieveStore.del(item._id)
|
|
|
- else if (routeType.value == 'demand') res = await demandStore.del(item._id)
|
|
|
- else if (routeType.value == 'project') res = await projectStore.del(item._id)
|
|
|
+ else if (routeType.value == 'demand') {
|
|
|
+ if (typeDemand.value == '0') res = await demandStore.del(item._id)
|
|
|
+ else if (typeDemand.value == '1') res = await supplyStore.del(item._id)
|
|
|
+ } else if (routeType.value == 'project') res = await projectStore.del(item._id)
|
|
|
else if (routeType.value == 'match') res = await matchStore.del(item._id)
|
|
|
if ($checkRes(res, true)) {
|
|
|
search({ skip: 0, limit })
|
|
@@ -209,16 +211,20 @@ const submitForm = async (formEl) => {
|
|
|
let res
|
|
|
if (get(data, '_id')) {
|
|
|
if (routeType.value == 'achievement') res = await achieveStore.update({ ...data, ...other })
|
|
|
- else if (routeType.value == 'demand') res = await demandStore.update({ ...data, ...other })
|
|
|
- else if (routeType.value == 'project')
|
|
|
+ else if (routeType.value == 'demand') {
|
|
|
+ if (typeDemand.value == '0') res = await demandStore.update({ ...data, ...other })
|
|
|
+ else if (typeDemand.value == '1') res = await supplyStore.update({ ...data, ...other })
|
|
|
+ } else if (routeType.value == 'project') {
|
|
|
res = await projectStore.update({ ...data, ...other })
|
|
|
- else if (routeType.value == 'match') res = await matchStore.update({ ...data, ...other })
|
|
|
+ } else if (routeType.value == 'match') res = await matchStore.update({ ...data, ...other })
|
|
|
} else {
|
|
|
if (routeType.value == 'achievement') res = await achieveStore.create({ ...data, ...other })
|
|
|
- else if (routeType.value == 'demand') res = await demandStore.create({ ...data, ...other })
|
|
|
- else if (routeType.value == 'project')
|
|
|
+ else if (routeType.value == 'demand') {
|
|
|
+ if (typeDemand.value == '0') res = await demandStore.create({ ...data, ...other })
|
|
|
+ else if (typeDemand.value == '1') res = await supplyStore.create({ ...data, ...other })
|
|
|
+ } else if (routeType.value == 'project') {
|
|
|
res = await projectStore.create({ ...data, ...other })
|
|
|
- else if (routeType.value == 'match') res = await matchStore.create({ ...data, ...other })
|
|
|
+ } else if (routeType.value == 'match') res = await matchStore.create({ ...data, ...other })
|
|
|
}
|
|
|
if ($checkRes(res, true)) {
|
|
|
type.value = '0'
|