作者 lixiang

框架修改

  1 +import { defHttp } from '/@/utils/http/axios';
  2 +import { useMessage } from '/@/hooks/web/useMessage';
  3 +
  4 +const { createConfirm } = useMessage();
  5 +
  6 +enum Api {
  7 + list = '/embeddings/embeddings/list',
  8 + save = '/embeddings/embeddings/add',
  9 + edit = '/embeddings/embeddings/edit',
  10 + deleteOne = '/embeddings/embeddings/delete',
  11 + deleteBatch = '/embeddings/embeddings/deleteBatch',
  12 + importExcel = '/embeddings/embeddings/importExcel',
  13 + exportXls = '/embeddings/embeddings/exportXls',
  14 +}
  15 +/**
  16 + * 导出api
  17 + * @param params
  18 + */
  19 +export const getExportUrl = Api.exportXls;
  20 +/**
  21 + * 导入api
  22 + */
  23 +export const getImportUrl = Api.importExcel;
  24 +/**
  25 + * 列表接口
  26 + * @param params
  27 + */
  28 +export const list = (params) => defHttp.get({ url: Api.list, params });
  29 +
  30 +/**
  31 + * 删除单个
  32 + */
  33 +export const deleteOne = (params, handleSuccess) => {
  34 + return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
  35 + handleSuccess();
  36 + });
  37 +};
  38 +/**
  39 + * 批量删除
  40 + * @param params
  41 + */
  42 +export const batchDelete = (params, handleSuccess) => {
  43 + createConfirm({
  44 + iconType: 'warning',
  45 + title: '确认删除',
  46 + content: '是否删除选中数据',
  47 + okText: '确认',
  48 + cancelText: '取消',
  49 + onOk: () => {
  50 + return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
  51 + handleSuccess();
  52 + });
  53 + },
  54 + });
  55 +};
  56 +/**
  57 + * 保存或者更新
  58 + * @param params
  59 + */
  60 +export const saveOrUpdate = (params, isUpdate) => {
  61 + const url = isUpdate ? Api.edit : Api.save;
  62 + return defHttp.post({ url: url, params });
  63 +};
  1 +import { BasicColumn } from '/@/components/Table';
  2 +import { FormSchema } from '/@/components/Table';
  3 +//列表数据
  4 +export const columns: BasicColumn[] = [
  5 + {
  6 + title: 'name',
  7 + align: 'center',
  8 + dataIndex: 'name',
  9 + },
  10 +];
  11 +//查询数据
  12 +export const searchFormSchema: FormSchema[] = [];
  13 +//表单数据
  14 +export const formSchema: FormSchema[] = [
  15 + {
  16 + label: 'name',
  17 + field: 'name',
  18 + component: 'Input',
  19 + },
  20 + // TODO 主键隐藏字段,目前写死为ID
  21 + {
  22 + label: '',
  23 + field: 'id',
  24 + component: 'Input',
  25 + show: false,
  26 + },
  27 +];
  28 +
  29 +// 高级查询数据
  30 +export const superQuerySchema = {
  31 + name: { title: 'name', order: 0, view: 'text', type: 'string' },
  32 +};
  33 +
  34 +/**
  35 + * 流程表单调用这个方法获取formSchema
  36 + * @param param
  37 + */
  38 +export function getBpmFormSchema(_formData): FormSchema[] {
  39 + // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
  40 + return formSchema;
  41 +}