| | |
| | | * @version: |
| | | * @Date: 2024-06-18 15:09:48 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-22 16:02:35 |
| | | * @LastEditTime: 2024-09-11 20:39:49 |
| | | --> |
| | | <!-- |
| | | * _oo0oo_ |
| | |
| | | import dtl from './dtl.vue'; |
| | | import baseForm from './baseForm.vue'; |
| | | import GeneralModal from '/@/views/components/GeneralModal.vue'; |
| | | import { AddAfterDelete, SaveEntity } from '/@/api/tigerapi/system'; |
| | | import { AddAfterDelete, isExist, SaveEntity } from '/@/api/tigerapi/system'; |
| | | import { useGlobSetting } from '/@/hooks/setting'; |
| | | import { useRoute, useRouter } from 'vue-router'; |
| | | import CustModal from '/@/views/components/CustModal.vue'; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @desc 挂载组件 |
| | | */ |
| | | onMounted(async () => { |
| | | isMounted.value = false; |
| | | await nextTick(); |
| | |
| | | try { |
| | | const validates = await validate(); |
| | | const Keys = Object.getOwnPropertyNames(useFormData.value); |
| | | let i; |
| | | let p = [] as Promise<any>[]; |
| | | for (i = 0; i < Keys.length; i++) { |
| | | p.push( |
| | | SaveEntity( |
| | | validates[Keys[i]], |
| | | unref(isAllUpdate), |
| | | baseCards.value[i]['entityName'], |
| | | `${objParams.value['IsExist']}='${validates[Keys[i]][objParams.value['IsExist']]}'`, |
| | | true, |
| | | ), |
| | | ); |
| | | } |
| | | await Promise.all(p); |
| | | |
| | | if ( |
| | | !custImport.value['default']()[0].SubmitAll && |
| | | !isFunction(custImport.value['default']()[0].SubmitAll) |
| | | ) { |
| | | /* 默认提交 */ |
| | | let i; |
| | | let p = [] as Promise<any>[]; |
| | | for (i = 0; i < Keys.length; i++) { |
| | | p.push( |
| | | SaveEntity( |
| | | validates[Keys[i]], |
| | | unref(isAllUpdate), |
| | | baseCards.value[i]['entityName'], |
| | | `${objParams.value['IsExist']}='${validates[Keys[i]][objParams.value['IsExist']]}'`, |
| | | true, |
| | | ), |
| | | ); |
| | | } |
| | | await Promise.all(p); |
| | | objParams.value['drawers'].forEach((d) => { |
| | | let where = `${d['code']} = '${keyFieldValues.value[d['code']]}'`; |
| | | /* type: all-表示需要code的所有的值 */ |
| | |
| | | where = `${d['code']} in (${data.value[d['keyName']].map((value) => `'${value[d['code']]}'`).join(',')})`; |
| | | } |
| | | /* 如果高级表单中关联的是ID(IsID == true),则不用初始化ID */ |
| | | if (!objParams.value['IsID']) { |
| | | data.value[d['name']].map((item) => { |
| | | item.ID = buildUUID(); |
| | | }); |
| | | } |
| | | //if (!objParams.value['IsID']) { |
| | | data.value[d['name']].map((item) => { |
| | | item.ID = buildUUID(); |
| | | }); |
| | | //} |
| | | AddAfterDelete(d['name'], data.value[d['name']], where).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | cancel(); |
| | |
| | | }); |
| | | } else { |
| | | /* 如果自定义提交方法存在就用自定义提交 */ |
| | | custImport.value['default']()[0].SubmitAll(data, keyFieldValues, cancel); |
| | | custImport.value['default']()[0].SubmitAll(data, keyFieldValues, cancel, { |
| | | validates, |
| | | isAllUpdate: unref(isAllUpdate), |
| | | baseCards, |
| | | isExist: objParams.value['IsExist'], |
| | | Keys, |
| | | }); |
| | | } |
| | | } catch (error) {} |
| | | } |