| | |
| | | import { SaveEntity, fetchJson, formatValues } from '/@/api/tigerapi/system'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { GetSelectSuccess, OpenSelectItem } from './data'; |
| | | import { isArray, isNullOrEmpty } from '/@/utils/is'; |
| | | import { isArray, isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | | |
| | | const emit = defineEmits(['success', 'register']); |
| | | const globSetting = useGlobSetting(); |
| | | const isUpdate = ref(true); |
| | | const ifSave = ref(true); |
| | | const entityName = ref(''); |
| | | const formSchema = ref([]); |
| | | const crudColSlots = ref<any>([]); |
| | |
| | | |
| | | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
| | | isUpdate.value = !!data?.isUpdate; |
| | | ifSave.value = !!data?.ifSave; |
| | | entityName.value = data?.entityName; |
| | | // formSchema.value = await fetchJson( |
| | | // `${globSetting.downloadUrl}/LowCode/${unref(entityName)}/${ |
| | |
| | | setFieldsValue({ |
| | | ...data.record, |
| | | }); |
| | | }else{ |
| | | if(!isNullOrEmpty(data?.others)){} |
| | | setFieldsValue(data?.others); |
| | | } else { |
| | | if (!isNullOrUnDef(data?.others)) { |
| | | setFieldsValue(data?.others); |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | values = formatValues(values); |
| | | setDrawerProps({ confirmLoading: true }); |
| | | // TODO custom api |
| | | //保存 |
| | | SaveEntity(values, unref(isUpdate), unref(entityName)).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | closeDrawer(); |
| | | emit('success'); |
| | | } |
| | | }); |
| | | if (!unref(ifSave)) { |
| | | //保存 |
| | | SaveEntity(values, unref(isUpdate), unref(entityName)).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | closeDrawer(); |
| | | emit('success'); |
| | | } |
| | | }); |
| | | } else { |
| | | closeDrawer(); |
| | | emit('success', values, { isUpdate: isUpdate.value }); |
| | | } |
| | | } finally { |
| | | setDrawerProps({ confirmLoading: false }); |
| | | } |