Ben Lin
2024-06-18 ebbd788fbb2c0b45d4473798efc57eec8ba74a25
src/views/tigerprojects/system/lowcode/normalDrawer.vue
@@ -49,15 +49,20 @@
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,
@@ -79,6 +84,7 @@
  // );
  formSchema.value = data?.formJson;
  crudColSlots.value = data?.crudColSlots;
  isExistSql.value = data?.isExistSql
  resetFields();
  setDrawerProps({ confirmLoading: false });
@@ -105,10 +111,12 @@
    // 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 {