Ben Lin
2024-06-21 2abb91c893f2eed3761bd09aabe12400460d2863
src/views/tigerprojects/system/lowcode/normal/basDefectGrp.ts
@@ -1,10 +1,13 @@
import { h, unref } from 'vue';
import { Ref, h, unref } from 'vue';
import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
import { useLocale } from '/@/locales/useLocale';
import { Tag } from 'ant-design-vue';
import { DeleteEntity, GetEnum, getEntity } from '/@/api/tigerapi/system';
import { isNullOrEmpty } from '/@/utils/is';
import { buildUUID } from '/@/utils/uuid';
import { useUserStore } from '/@/store/modules/user';
import { formatToDateTime } from '/@/utils/dateUtil';
const { t } = useI18n();
const { getLocale } = useLocale();
@@ -61,7 +64,7 @@
 * @return {*}
 */
export function DftGrpEdit(args: Fn[], params: {}) {
  const param = { CODE: params['record']['DFTG_CODE'], ID: params['record']['ID'], Name: 'BAS_DEFECT', Title: `编辑不良代码组:${params['record']['DFTG_CODE']}`, pCode: 'DFTG_CODE' };
  const param = { CODE: params['record']['DFTG_CODE'], ID: params['record']['ID'], Name: 'BAS_DEFECT', Title: `编辑不良代码组:${params['record']['DFTG_CODE']}`, pCode: 'DFTG_CODE', IsID: false };
  args[5](`/BAS_DEFECT/High/${encodeURI(JSON.stringify(param))}`);
}
@@ -82,12 +85,51 @@
      dataSource: params['data'],
    });
    args[1]();
  }else{
  } else {
    DeleteEntity(params['record'], params['entityName']).then((action) => {
      if (action.IsSuccessed) {
        args[1]();
      }
    });
  }
}
/**
 * @description: 自定义明细表中编辑返回方法
 * @param {string} type
 * @param {*} d
 * @param {*} u
 * @return {*}
 */
export function dftEditeOperation(data: Ref<any[]>, d, u) {
  if (u.isUpdate) {
    //更新
    var _data = data.value.map((item) => {
      if (item['ID'] == d.ID)
        return {
          ...item,
          DFT_CODE: d.DFT_CODE,
          DFT_NAME: d.DFT_NAME,
          DFT_LEVEL: d.DFT_LEVEL,
          REMARK: d.REMARK,
        };
      return item;
    });
    data.value = _data;
  } else {
    //新增
    d.ID = buildUUID();
    d.CREATE_USER = useUserStore().getUserInfo.userId as string;
    d.UPDATE_TIME = formatToDateTime(new Date());
    d.UPDATE_USER = useUserStore().getUserInfo.userId as string;
    var _data2: any[] = [];
    if (!isNullOrEmpty(data.value)) {
      _data2 = data.value.map((item) => {
        return item;
      });
    }
    _data2.push(d);
    data.value = _data2;
  }
}
@@ -152,11 +194,12 @@
    ],
    tableName: 'BAS_ITEM',
    rowKey: 'ITEM_CODE',
    searchInfo: {TABLE_NAME: 'BAS_ITEM'}
  });
}
/**
 * @description: 基本信息
 * @description: 不良代码基本信息
 * @return {*}
 */
export const baseSchema: FormSchema[] = [
@@ -186,6 +229,15 @@
      span: 8,
    },
  },
  {
    label: 'ID',
    field: 'ID',
    component: 'Input',
    colProps: {
      span: 8,
    },
    show: false,
  },
];
export const searchSchema: FormSchema[] = [
@@ -208,7 +260,7 @@
];
/**
 * @description: 获取增删改表单
 * @description: 获取不良代码增删改表单
 * @return {*}
 */
export const crudSchema: FormSchema[] = [