| | |
| | | import { SaveEntity, fetchJson, formatValues } from '/@/api/tigerapi/system'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { GetSelectSuccess, OpenSelectItem } from './data'; |
| | | import { isArray, isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | | import { isNullOrUnDef } from '/@/utils/is'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | |
| | | const emit = defineEmits(['success', 'register']); |
| | | const { t } = useI18n(); |
| | | const {createErrorModal} = useMessage(); |
| | | const globSetting = useGlobSetting(); |
| | | const isUpdate = ref(true); |
| | | const ifSave = ref(true); |
| | | const entityName = ref(''); |
| | | const formSchema = ref([]); |
| | | const crudColSlots = ref<any>([]); |
| | | const isExistSql = ref(''); |
| | | const [registerItemAdd, { openModal: openItemModal }] = useModal(); |
| | | const [registerForm, { resetFields, setFieldsValue, getFieldsValue, validate }] = useForm({ |
| | | labelWidth: 140, |
| | |
| | | // ); |
| | | formSchema.value = data?.formJson; |
| | | crudColSlots.value = data?.crudColSlots; |
| | | isExistSql.value = data?.isExistSql |
| | | resetFields(); |
| | | setDrawerProps({ confirmLoading: false }); |
| | | |
| | |
| | | // TODO custom api |
| | | if (!unref(ifSave)) { |
| | | //保存 |
| | | SaveEntity(values, unref(isUpdate), unref(entityName)).then((action) => { |
| | | SaveEntity(values, unref(isUpdate), unref(entityName), `${isExistSql.value}='${values[isExistSql.value]}'`).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | closeDrawer(); |
| | | emit('success'); |
| | | }else{ |
| | | createErrorModal({ title: t('sys.api.errorTip'), content: action.Message }); |
| | | } |
| | | }); |
| | | } else { |