Ben Lin
2024-06-03 8f5009a3d57821c2c97690b8419e428967b5e981
低代码更新
已修改8个文件
已添加2个文件
697 ■■■■ 文件已修改
src/api/tigerapi/system.ts 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/is.ts 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/ItemModal.vue 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/NormalModal.vue 137 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/normal/basDefectGrp.ts 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/normal/data.ts 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/normal/index.vue 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/setting/pageDetail.vue 155 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/system.ts
@@ -30,7 +30,7 @@
  EntityList,
} from './model/systemModel';
import { defHttp } from '/@/utils/http/axios';
import { isNullOrEmpty } from '/@/utils/is';
import { isNullOrEmpty, isTimeType } from '/@/utils/is';
export enum Api {
  QueryUrl = '/Base/Query',
@@ -655,31 +655,53 @@
/* é€šç”¨æŸ¥è¯¢åˆ†é¡µ */
export async function getListByPage<T>(params: T) {
  const Keys = Object.getOwnPropertyNames(params);
  let sqlcmd = '';
  let sqlcmd = '1=1 ';
  let order = '';
  for (const k in Keys) {
    console.log(`${k}:${Keys[k]}`);
    if (
      !isNullOrEmpty(params[Keys[k]]) &&
      Keys[k] != 'page' &&
      Keys[k] != 'pageSize' &&
      Keys[k] != 'TABLE_NAME'
      Keys[k] != 'TABLE_NAME' &&
      Keys[k] != 'order' &&
      Keys[k] != 'field' &&
      Keys[k] != '0'
    ) {
      sqlcmd += `And ${Keys[k]} like '%${params[Keys[k]]}%'`;
      if (!isNullOrEmpty(params[Keys[k]].length) && isTimeType(params[Keys[k]][0])) {
        sqlcmd += ` And ${Keys[k]} > '${params[Keys[k]][0]}'`;
        sqlcmd += ` And ${Keys[k]} < '${params[Keys[k]][1]}'`;
      } else {
        sqlcmd += `And ${Keys[k]} like '%${params[Keys[k]]}%'`;
      }
    }
  }
  const rParams = genActionPage(params['TABLE_NAME'], sqlcmd, params['page'], params['pageSize']);
  if (!isNullOrEmpty(params['order'])) {
    order = params['order'] == 'descend' ? params['field'] + ' desc' : params['field'];
  }
  const rParams = genAction(params['TABLE_NAME'], {
    QueryAble_T: '',
    where: sqlcmd,
    order: order,
    page: {
      pageAble_T: 'string',
      draw: 1,
      pageIndex: params['page'],
      pageSize: params['pageSize'],
    },
  });
  return getListByPageAsync(rParams);
}
async function getListByPageAsync(params: ApiActionPage) {
  const data = await defHttp.post<ApiActionPage>(
    { url: Api.EntityPageList, params },
async function getListByPageAsync(params: any) {
  const data = await defHttp.post(
    { url: Api.QueryUrl, params },
    {
      isTransformResponse: false,
    },
  );
  const model = {
    items: data.Data.data,
    total: data.Data.totals,
    items: data.Data.page.data,
    total: data.Data.page.totals,
  };
  return model;
}
src/utils/is.ts
@@ -100,3 +100,29 @@
  const reg = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/;
  return reg.test(path);
}
export function isTime(value: any): value is Date {
  return value instanceof Date && !isNaN(value.getTime());
}
export function isTimeViaConstructor(value: any): boolean {
  return value instanceof Date || value.constructor === Date;
}
export function isTimeViaRegExp(value: any): boolean {
  return /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(value.toString());
}
export function isTimeType(value: string): boolean {
  return !isNaN(Date.parse(value));
}
// // ç¤ºä¾‹
// const time1 = new Date();
// console.log(isTime(time1)); // true
// const time2 = '2023-04-01T12:00:00Z';
// console.log(isTimeViaRegExp(time2)); // true
// const notTime = 'hello world';
// console.log(isTime(notTime)); // false
src/views/components/ItemModal.vue
@@ -55,37 +55,12 @@
      sorter: true,
      width: 180,
    },
    // {
    //   title: t('物料描述'),
    //   dataIndex: 'ITEM_DESC',
    //   resizable:true,
    // },
    // {
    //   title: t('盘点状态',
    //   dataIndex: 'STATUS',
    //   resizable:true,
    // },
    // {
    //   title: t('盘点结果',
    //   dataIndex: 'RESULT',
    //   resizable:true,
    // },
    // {
    //   title: t('WMS数量',
    //   dataIndex: 'QTY',
    //   resizable:true,
    // },
    // {
    //   title: t('ACT_QTY',
    //   dataIndex: 'COUNT_TYPE',
    //   resizable:true,
    // }
  ];
  const emit = defineEmits(['success', 'register']);
  const checkedKeys = ref<Array<string | number>>([]);
  const [registerTable, { reload, getForm }] = useTable({
    title: '物料列表',
    title: '列表信息',
    api: getItemListByPage,
    columns: ItemColumns,
    formConfig: {
src/views/components/NormalModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,137 @@
<template>
  <BasicModal
    width="800px"
    :height="600"
    v-bind="$attrs"
    @register="register"
    :title="title"
    @ok="handleSubmit"
  >
    <!-- <div class="pt-3px pr-3px">
        <BasicForm @register="registerForm" :model="model" />
      </div> -->
    <div>
      <BasicTable @register="registerTable">
        <!-- <template #toolbar>
                  <a-button type="primary" @click="handleCreate"> æ–°å¢žç›˜ç‚¹ </a-button>
                </template> -->
      </BasicTable>
    </div>
  </BasicModal>
</template>
<script lang="ts" setup>
  import { ref, unref } from 'vue';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
  import { BasicTable, BasicColumn, TableAction, useTable } from '/@/components/Table';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { getListByPage } from '/@/api/tigerapi/system';
  const { t } = useI18n();
  const title = ref('');
  const tableName = ref('');
  const rowKey = ref('');
  const schemas = ref([] as FormSchema[]);
  //列表
  const ItemColumns = ref([] as BasicColumn[]);
  const emit = defineEmits(['success', 'register']);
  const checkedKeys = ref<Array<string | number>>([]);
  const [registerTable, { reload, getForm }] = useTable({
    title: '列表信息',
    api: getListByPage,
    searchInfo: { TABLE_NAME: tableName },
    columns: ItemColumns,
    formConfig: {
      labelWidth: 120,
      schemas,
    },
    useSearchForm: true,
    showTableSetting: false,
    rowKey: rowKey,
    rowSelection: {
      selectedRowKeys: checkedKeys,
      type: 'checkbox',
      // getCheckboxProps(record: Recordable) {
      //   // Demo: ç¬¬ä¸€è¡Œï¼ˆid为0)的选择框禁用
      //   if (record.id === '0') {
      //     return { disabled: true };
      //   } else {
      //     return { disabled: false };
      //   }
      // },
      onSelect: onSelect,
      onSelectAll: onSelectAll,
    },
    bordered: true,
    showIndexColumn: false,
    // actionColumn: {
    //   width: 80,
    //   title: '操作',
    //   dataIndex: 'action',
    //   slots: { customRender: 'action' },
    //   fixed: 'right' //undefined,
    // },
  });
  const [register, { setModalProps, closeModal }] = useModalInner((data) => {
    setModalProps({ confirmLoading: false });
    data && onDataReceive(data);
  });
  async function onDataReceive(data) {
    console.log('Data Received', data);
    // æ–¹å¼1;
    // setFieldsValue({
    //   field2: data.data,
    //   field1: data.info,
    // });
    title.value = data?.title;
    schemas.value = data?.schemas;
    ItemColumns.value = data?.ItemColumns;
    tableName.value = data?.tableName;
    rowKey.value = data?.rowKey;
    checkedKeys.value = [];
    getForm().resetFields();
    reload();
  }
  // function handleVisibleChange(v) {
  //   v && props.userData && nextTick(() => onDataReceive(props.userData));
  // }
  async function handleSubmit() {
    try {
      var values = '';
      // checkedKeys.value.forEach(element => {
      //   values+=element;
      // });
      values = checkedKeys.value.join(',');
      closeModal();
      emit('success', {
        isUpdate: unref(false),
        values: { values, id: 0 },
      });
    } finally {
      setModalProps({ confirmLoading: false });
    }
  }
  function onSelect(record, selected) {
    if (selected) {
      checkedKeys.value = [...checkedKeys.value, record[rowKey.value]];
    } else {
      checkedKeys.value = checkedKeys.value.filter((code) => code !== record[rowKey.value]);
    }
  }
  function onSelectAll(selected, selectedRows, changeRows) {
    const changeIds = changeRows.map((item) => item[rowKey.value]);
    if (selected) {
      checkedKeys.value = [...checkedKeys.value, ...changeIds];
    } else {
      checkedKeys.value = checkedKeys.value.filter((code) => {
        return !changeIds.includes(code);
      });
    }
  }
</script>
src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
@@ -15,7 +15,7 @@
          @click="handleSelectItem"
          preIcon="search|svg"
        />
        <ItemModal @register="registerItemAdd" @success="handleItemSuccess" />
        <NormalModal @register="registerItemAdd" @success="handleItemSuccess" />
      </template>
      <template #action="{ record }">
        <TableAction
@@ -70,7 +70,7 @@
  import { BasicTable, useTable, TableAction } from '/@/components/Table';
  import WoDrawer from './WoDrawer.vue';
  import WoModal from './WoModal.vue';
  import ItemModal from '/@/views/components/ItemModal.vue';
  import NormalModal from '/@/views/components/NormalModal.vue';
  import { useDrawer } from '/@/components/Drawer';
  import { columns, searchFormSchema } from './biz_mes_wo.data';
  import { DeleteMesWo } from '/@/api/tigerapi/mes/wo';
@@ -170,8 +170,35 @@
  //点击打开物料列表框
  function handleSelectItem() {
    openItemModal(true, {
      data: 'content',
      info: 'Info',
      title: '物料列表',
      schemas: [
        {
          field: 'ITEM_CODE',
          component: 'Input',
          label: '物料编码',
          colProps: {
            span: 12,
          },
        },
      ],
      ItemColumns: [
        {
          title: t('物料编码'),
          dataIndex: 'ITEM_CODE',
          resizable: true,
          sorter: true,
          width: 200,
        },
        {
          title: t('物料名称'),
          dataIndex: 'ITEM_NAME',
          resizable: true,
          sorter: true,
          width: 180,
        },
      ],
      tableName: 'BAS_ITEM',
      rowKey: 'ITEM_CODE',
    });
  }
src/views/tigerprojects/system/lowcode/normal/basDefectGrp.ts
@@ -1,6 +1,8 @@
import { ActionItem, BasicColumn } from '/@/components/Table';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
const { notification } = useMessage();
/* è‡ªå®šä¹‰æŒ‰é’®æ–¹æ³• */
export function DftGrpRelease(reload: Fn, params: {}) {
@@ -28,3 +30,43 @@
    onClick: () => {},
  },
];
export function dftGrpGetSelectSuccess(d, u) {
  return {
    ITEM_CODE: d.values.values,
  };
}
export function dftGrpOpenSelectItem(openItemModal: Fn) {
  openItemModal(true, {
    title: '物料列表',
    schemas: [
      {
        field: 'ITEM_CODE',
        component: 'Input',
        label: '物料编码',
        colProps: {
          span: 12,
        },
      },
    ],
    ItemColumns: [
      {
        title: t('物料编码'),
        dataIndex: 'ITEM_CODE',
        resizable: true,
        sorter: true,
        width: 200,
      },
      {
        title: t('物料名称'),
        dataIndex: 'ITEM_NAME',
        resizable: true,
        sorter: true,
        width: 180,
      },
    ],
    tableName: 'BAS_ITEM',
    rowKey: 'ITEM_CODE',
  });
}
src/views/tigerprojects/system/lowcode/normal/basReasonGrp.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
import { ActionItem, BasicColumn } from '/@/components/Table';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
const { notification } = useMessage();
/* è‡ªå®šä¹‰æŒ‰é’®æ–¹æ³• */
export function RsGrpRelease(reload: Fn, params: {}) {
  console.log('点击了下发按钮');
  notification.success({
    message: '点击了下发按钮',
    description: `${params.entityName}`,
    duration: 3,
  });
  reload();
}
export const rsGrpactionColumn: BasicColumn = {
  width: 180,
  title: '操作',
  dataIndex: 'action',
  slots: { customRender: 'action' },
  fixed: undefined,
};
export const rsGrpActionItem: ActionItem[] = [
  {
    icon: 'release|svg',
    tooltip: '下发',
    onClick: () => {},
  },
];
export function rsGrpGetSelectSuccess(d, u) {
  return {
    RSNG_CODE: d.values.values,
  };
}
export function rsGrpOpenSelectItem(openItemModal: Fn) {
  openItemModal(true, {
    title: '不良原因组列表',
    schemas: [
      {
        field: 'RSNG_CODE',
        component: 'Input',
        label: '不良原因组代码',
        colProps: {
          span: 12,
        },
      },
    ],
    ItemColumns: [
      {
        title: t('不良原因组代码'),
        dataIndex: 'RSNG_CODE',
        resizable: true,
        sorter: true,
        width: 200,
      },
      {
        title: t('不良原因组名称'),
        dataIndex: 'RSNG_NAME',
        resizable: true,
        sorter: true,
        width: 180,
      },
    ],
    tableName: 'BAS_REASON_GRP',
    rowKey: 'RSNG_CODE',
  });
}
src/views/tigerprojects/system/lowcode/normal/data.ts
@@ -1,6 +1,16 @@
import { DftGrpRelease, dftGrpActionItem, dftGrpactionColumn } from './basDefectGrp';
import {
  DftGrpRelease,
  dftGrpActionItem,
  dftGrpOpenSelectItem,
  dftGrpGetSelectSuccess,
  dftGrpactionColumn,
} from './basDefectGrp';
import { rsGrpGetSelectSuccess, rsGrpOpenSelectItem } from './basReasonGrp';
import { DeleteEntity } from '/@/api/tigerapi/system';
import { ActionItem, BasicColumn } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
export function GetActionsData(params: {}, ...args: Fn[]) {
  let data = [
@@ -18,7 +28,7 @@
      },
    },
  ] as ActionItem[];
  switch (params.entityName) {
  switch (params['entityName']) {
    case 'BAS_DEFECT_GRP':
      const _d = dftGrpActionItem;
      _d[0].onClick = DftGrpRelease.bind(null, args[1], params);
@@ -33,9 +43,9 @@
}
function deleteRecord(fn: Fn, params: {}) {
  console.log(params.record);
  console.log(params['record']);
  //删除
  const apiAction = DeleteEntity(params.record, params.entityName);
  const apiAction = DeleteEntity(params['record'], params['entityName']);
  apiAction.then((action) => {
    if (action.IsSuccessed) {
      fn();
@@ -61,3 +71,67 @@
  }
  return data;
}
/* å¼¹å‡ºé€‰æ‹©æ¡†é€‰æ‹©æˆåŠŸ */
export function GetSelectSuccess(d, u, entityName: string) {
  let data = {};
  switch (entityName) {
    case 'BAS_DEFECT_GRP':
      data = dftGrpGetSelectSuccess(d, u);
      break;
    case 'BAS_REASON_GRP':
      data = rsGrpGetSelectSuccess(d, u);
      break;
    default:
      data = {
        ITEM_CODE: d.values.values,
      };
      break;
  }
  return data;
}
/* æ‰“开弹出选择框 */
export function OpenSelectItem(openItemModal: Fn, entityName: string) {
  switch (entityName) {
    case 'BAS_DEFECT_GRP':
      dftGrpOpenSelectItem(openItemModal);
      break;
    case 'BAS_REASON_GRP':
      rsGrpOpenSelectItem(openItemModal);
      break;
    default:
      openItemModal(true, {
        title: '物料列表',
        schemas: [
          {
            field: 'ITEM_CODE',
            component: 'Input',
            label: '物料编码',
            colProps: {
              span: 12,
            },
          },
        ],
        ItemColumns: [
          {
            title: t('物料编码'),
            dataIndex: 'ITEM_CODE',
            resizable: true,
            sorter: true,
            width: 200,
          },
          {
            title: t('物料名称'),
            dataIndex: 'ITEM_NAME',
            resizable: true,
            sorter: true,
            width: 180,
          },
        ],
        tableName: 'BAS_ITEM',
        rowKey: 'ITEM_CODE',
      });
      break;
  }
}
src/views/tigerprojects/system/lowcode/normal/index.vue
@@ -7,30 +7,46 @@
      <template #action="{ record }">
        <TableAction :actions="createActions(record)" />
      </template>
      <template #form-add="{ field }">
        <a-button
          v-if="field"
          class="mt-1 ml-1"
          size="small"
          @click="handleSelectItem"
          preIcon="search|svg"
        />
        <NormalModal @register="registerItemAdd" @success="handleItemSuccess" />
      </template>
    </BasicTable>
    <normalDrawer @register="registerDrawer" @success="handleSuccess" />
  </div>
</template>
<script lang="ts" setup>
  import { h, onMounted, ref } from 'vue';
  import { h, onMounted, ref, unref } from 'vue';
  import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table';
  import { useDrawer } from '/@/components/Drawer';
  import normalDrawer from './normalDrawer.vue';
  import { getEntity, getListByPage } from '/@/api/tigerapi/system';
  import NormalModal from '/@/views/components/NormalModal.vue';
  import { GetEnum, getEntity, getListByPage } from '/@/api/tigerapi/system';
  import { useGlobSetting } from '/@/hooks/setting';
  import { useRoute } from 'vue-router';
  import { Tag, Tooltip } from 'ant-design-vue';
  import { isNullOrEmpty } from '/@/utils/is';
  import { GetActionColumn, GetActionsData } from './data';
  import { GetActionColumn, GetActionsData, OpenSelectItem, GetSelectSuccess } from './data';
  import { useModal } from '/@/components/Modal';
  import { useLocale } from '/@/locales/useLocale';
  const { getLocale } = useLocale();
  const route = useRoute();
  const objParams = ref(JSON.parse(decodeURI(route.params?.id as string)));
  const entityName = ref(objParams.value.ID);
  const globSetting = useGlobSetting();
  const _columns = ref([]);
  const _searchFormSchema = ref([]);
  const _crudFormSchema = ref([]);
  const [registerItemAdd, { openModal: openItemModal }] = useModal();
  const [registerDrawer, { openDrawer }] = useDrawer();
  const [registerTable, { reload }] = useTable({
  const [registerTable, { getForm, reload }] = useTable({
    title: '列表信息',
    api: getListByPage,
    searchInfo: { TABLE_NAME: objParams.value.ID },
@@ -97,8 +113,49 @@
      sqlcmd: "ASSEMBLY_NAME ='" + objParams.value.ID + "'",
      entityName: 'SYS_LOW_CODE',
    });
    _searchFormSchema.value = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON);
    _crudFormSchema.value = JSON.parse(data.Data.Items[0].FORM_JSON);
    var searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON);
    for (const i in searchForms) {
      if (
        !isNullOrEmpty(searchForms[i].componentProps) &&
        !isNullOrEmpty(searchForms[i].componentProps.api) &&
        searchForms[i].componentProps.api == 'GetEnum'
      ) {
        searchForms[i].componentProps.api = GetEnum;
        searchForms[i].componentProps.params.name = `${objParams.value.ID}+${searchForms[i].field}s`;
        searchForms[i].componentProps.labelField = unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name';
      }
      if (
        !isNullOrEmpty(searchForms[i].componentProps) &&
        !isNullOrEmpty(searchForms[i].componentProps.api) &&
        searchForms[i].componentProps.api == 'getEntity'
      ) {
        searchForms[i].componentProps.api = getEntity;
        searchForms[i].componentProps.resultField = 'Data.Items';
      }
    }
    _searchFormSchema.value = searchForms;
    var _cruds = JSON.parse(data.Data.Items[0].FORM_JSON);
    for (const i in _cruds) {
      if (
        !isNullOrEmpty(_cruds[i].componentProps) &&
        !isNullOrEmpty(_cruds[i].componentProps.api) &&
        _cruds[i].componentProps.api == 'GetEnum'
      ) {
        _cruds[i].componentProps.api = GetEnum;
        _cruds[i].componentProps.params.name = `${objParams.value.ID}+${_cruds[i].field}s`;
        _cruds[i].componentProps.labelField = unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name';
      }
      if (
        !isNullOrEmpty(_cruds[i].componentProps) &&
        !isNullOrEmpty(_cruds[i].componentProps.api) &&
        _cruds[i].componentProps.api == 'getEntity'
      ) {
        _cruds[i].componentProps.api = getEntity;
        _cruds[i].componentProps.resultField = 'Data.Items';
      }
    }
    _crudFormSchema.value = _cruds;
    var objs = JSON.parse(data.Data.Items[0].BASE_FORM_JSON);
    for (const i in objs) {
      if (!isNullOrEmpty(objs[i].customRender)) {
@@ -113,4 +170,14 @@
    }
    _columns.value = objs;
  });
  /* å¼¹å‡ºé€‰æ‹©æ¡†é€‰æ‹©æˆåŠŸåŽäº‹ä»¶ */
  function handleItemSuccess(d, u) {
    getForm().setFieldsValue(GetSelectSuccess(d, u, getForm().getFieldsValue()['0']));
  }
  /* å¼¹å‡ºé€‰æ‹©æ¡† */
  function handleSelectItem() {
    OpenSelectItem(openItemModal, getForm().getFieldsValue()['0']);
  }
</script>
src/views/tigerprojects/system/lowcode/setting/pageDetail.vue
@@ -120,6 +120,9 @@
          <template #[item]="{ model, field }" v-for="item in mainwSwSlots" :key="item">
            <a-switch v-model:checked="model[field]" />
          </template>
          <template #[item]="{ model, field }" v-for="item in mainIaSlots" :key="item">
            <a-input v-model:value="model[field]" />
          </template>
        </BasicForm>
      </div>
    </a-card>
@@ -195,7 +198,7 @@
</template>
<script lang="ts" setup>
  import { BasicForm, useForm } from '/@/components/Form';
  import { onMounted, ref, unref } from 'vue';
  import { nextTick, onMounted, ref, unref } from 'vue';
  import { Card, InputGroup, Select, Input, Switch } from 'ant-design-vue';
  import { ApiSelect } from '/@/components/Form/index';
  import { useRoute, useRouter } from 'vue-router';
@@ -208,7 +211,7 @@
  import { SelectTypes } from 'ant-design-vue/es/select';
  import { useMultipleTabStore } from '/@/store/modules/multipleTab';
  import { useModal } from '/@/components/Modal';
  import { SaveEntity, getEntityPropertieList } from '/@/api/tigerapi/system';
  import { SaveEntity, getEntity, getEntityPropertieList } from '/@/api/tigerapi/system';
  import { EntityPropertie, SYS_LOW_CODE } from '/@/api/tigerapi/model/systemModel';
  import { isNullOrEmpty } from '/@/utils/is';
  import { useUserStore } from '/@/store/modules/user';
@@ -290,6 +293,9 @@
    schemas: mainSchemas,
    showActionButtonGroup: false,
  });
  const SearchEntName = ref('');
  const MainEntName = ref('');
  const CrudEntName = ref('');
  const objInputs = ref({} as { [key: string]: any });
  const mainInputs = ref({} as { [key: string]: any });
  const crudInputs = ref({} as { [key: string]: any });
@@ -304,6 +310,7 @@
  const crudSwSlots = ref([] as string[]);
  const mainsSwSlots = ref([] as string[]);
  const mainwSwSlots = ref([] as string[]);
  const mainIaSlots = ref([] as string[]);
  const crudrSwSlots = ref([] as string[]);
  const searchSelectVals = ref({} as { [key: string]: any });
  const mainSelectVals = ref({} as { [key: string]: any });
@@ -334,17 +341,73 @@
      label: 'Checkbox',
    },
    {
      value: 'TimePicker',
      value: 'RangePicker',
      label: '时间选择器',
    },
    {
      value: 'Switch',
      label: '开关',
    },
    {
      value: 'PoPSelect',
      label: '弹出选择框',
    },
  ]);
  onMounted(async () => {
  onMounted(() => {
    if (unref(objParams.value.Update) == '1') {
      getEntity({
        sqlcmd: "ID ='" + objParams.value.ID + "'",
        entityName: 'SYS_LOW_CODE',
      }).then((data) => {
        var searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON);
        SearchEntName.value = data.Data.Items[0].SEARCH_ASSY_NAME;
        setFieldsValue({ ASSEMBLY_NAME: data.Data.Items[0].SEARCH_ASSY_NAME });
        for (const i in searchForms) {
          if (searchForms[i]['field'] != '0') {
            condAdd();
            setFieldsValue({
              [`${SearchEntName.value}${Number(i) + 1}a`]: searchForms[i]['field'],
              [`InputNumber${Number(i) + 1}`]: searchForms[i]['colProps'].span,
              [`Switch${Number(i) + 1}`]: searchForms[i]['ifShow'],
            });
            objInputs.value[`${SearchEntName.value}${Number(i) + 1}a`] = searchForms[i]['label'];
            searchSelectVals.value[`${SearchEntName.value}${Number(i) + 1}a`] = searchForms[i][
              'comp'
            ]
              ? searchForms[i]['comp']
              : searchForms[i]['component'];
          }
        }
        var crudForms = JSON.parse(data.Data.Items[0].FORM_JSON);
        CrudEntName.value = data.Data.Items[0].CRUD_ASSY_NAME;
        setFieldsValueCrud({ crudAssemblyName: data.Data.Items[0].CRUD_ASSY_NAME });
        for (const i in crudForms) {
          crudCondAdd();
          setFieldsValueCrud({
            [`${CrudEntName.value}${Number(i) + 1}a`]: crudForms[i]['field'],
            [`InputNumber${Number(i) + 1}`]: crudForms[i]['colProps'].span,
            [`Switch${Number(i) + 1}`]: crudForms[i]['show'],
            [`rSwitch${Number(i) + 1}`]: crudForms[i]['required'],
          });
          crudInputs.value[`${CrudEntName.value}${Number(i) + 1}a`] = crudForms[i]['label'];
          crudSelectVals.value[`${CrudEntName.value}${Number(i) + 1}a`] = crudForms[i]['component'];
        }
        var objs = JSON.parse(data.Data.Items[0].BASE_FORM_JSON);
        MainEntName.value = data.Data.Items[0].ASSEMBLY_NAME;
        setFieldsValueMain({ MainAssemblyName: MainEntName.value });
        for (const i in objs) {
          mainCondAdd();
          setFieldsValueMain({
            [`${MainEntName.value}${Number(i) + 1}a`]: objs[i]['dataIndex'],
            [`Switch${Number(i) + 1}`]: objs[i]['ifShow'],
            [`sSwitch${Number(i) + 1}`]: objs[i]['sorter'],
            [`wSwitch${Number(i) + 1}`]: objs[i]['resizable'],
            [`InputTextArea${Number(i) + 1}`]: objs[i]['customRender'],
          });
          mainInputs.value[`${MainEntName.value}${Number(i) + 1}a`] = objs[i]['title'];
        }
      });
    }
  });
  async function submitAll() {
@@ -354,6 +417,7 @@
        crudvalidate(),
        validateMainForm(),
      ]);
      /* æŸ¥è¯¢æ¡ä»¶Json */
      const Keys = Object.getOwnPropertyNames(values);
      var searchjsons = [];
@@ -377,6 +441,20 @@
          _n++;
        }
        if (!isNullOrEmpty(_json) && _n == 6) {
          //如果是弹出选择框
          if (_json['component'] == 'PoPSelect') {
            _json['component'] = 'Input';
            _json['comp'] = 'PoPSelect';
            searchjsons.push(_json);
            _json = {};
            _json['field'] = '0';
            _json['label'] = '1';
            _json['defaultValue'] = '';
            _json['component'] = 'Input';
            _json['colProps'] = { span: 4 };
            _json['ifShow'] = true;
            _json['colSlot'] = 'add';
          }
          searchjsons.push(_json);
          _json = {};
          _n = 0;
@@ -413,7 +491,11 @@
            : (mainvalues[mKeys[k]] as boolean);
          i++;
        }
        if (!isNullOrEmpty(mjson) && i == 5) {
        if (mKeys[k].toString().startsWith('InputTextArea')) {
          mjson['customRender'] = isNullOrEmpty(mainvalues[mKeys[k]]) ? '' : mainvalues[mKeys[k]];
          i++;
        }
        if (!isNullOrEmpty(mjson) && i == 6) {
          mjsons.push(mjson);
          i = 0;
          mjson = {};
@@ -428,19 +510,19 @@
      for (const k in cKeys) {
        console.log(`${k}:${cKeys[k]}`);
        if (cKeys[k].toString().startsWith(getFieldsValueCrud().crudAssemblyName)) {
          cjson['field'] = isNullOrEmpty(crudvalues[mKeys[k]]) ? '' : crudvalues[cKeys[k]];
          cjson['label'] = isNullOrEmpty(crudvalues[mKeys[k]]) ? '' : crudInputs.value[cKeys[k]];
          cjson['field'] = isNullOrEmpty(crudvalues[cKeys[k]]) ? '' : crudvalues[cKeys[k]];
          cjson['label'] = isNullOrEmpty(crudvalues[cKeys[k]]) ? '' : crudInputs.value[cKeys[k]];
          cjson['component'] = crudSelectVals.value[cKeys[k]];
          c = c + 3;
        }
        if (cKeys[k].toString().startsWith('Switch')) {
          cjson['show'] = isNullOrEmpty(crudvalues[mKeys[k]])
          cjson['show'] = isNullOrEmpty(crudvalues[cKeys[k]])
            ? false
            : (crudvalues[cKeys[k]] as boolean);
          c++;
        }
        if (cKeys[k].toString().startsWith('rSwitch')) {
          cjson['required'] = isNullOrEmpty(crudvalues[mKeys[k]])
          cjson['required'] = isNullOrEmpty(crudvalues[cKeys[k]])
            ? false
            : (crudvalues[cKeys[k]] as boolean);
          c++;
@@ -457,6 +539,7 @@
      }
      console.log(JSON.stringify(cjsons));
      var entity: SYS_LOW_CODE = {
        ID: objParams.value.ID,
        CREATE_USER: useUserStore().getUserInfo.userId as string,
        UPDATE_USER: useUserStore().getUserInfo.userId as string,
        SEARCH_FORM_JSON: JSON.stringify(searchjsons),
@@ -486,7 +569,7 @@
  }
  function handleEdit(record: Recordable) {}
  //点击打开物料列表框
  function handleSelecNew() {
    openNewModal(true, {
      data: 'content',
@@ -517,6 +600,7 @@
      Namespace: 'Tiger.Model',
    });
    mainProperties.value = data.items;
    MainEntName.value = d.values.values;
  }
  async function handleNewSuccess(d, u) {
@@ -528,12 +612,19 @@
      Namespace: 'Tiger.Model',
    });
    searchProperties.value = data.items;
    SearchEntName.value = d.values.values;
  }
  function handleCrudSuccess(d, u) {
  async function handleCrudSuccess(d, u) {
    setFieldsValueCrud({
      crudAssemblyName: d.values.values,
    });
    var data = await getEntityPropertieList({
      StartWith: d.values.values,
      Namespace: 'Tiger.Model',
    });
    crudProperties.value = data.items;
    CrudEntName.value = d.values.values;
  }
  function change(value, option, field) {
    console.log(value, option, field);
@@ -557,10 +648,10 @@
    appendSchemaByField(
      [
        {
          field: `${getFieldsValue().ASSEMBLY_NAME}${n.value}a`,
          field: `${SearchEntName.value}${n.value}a`,
          component: 'InputGroup',
          label: '字段' + n.value,
          // required: true,
          //required: true,
          slot: 'fac' + n.value,
          colProps: { span: 14 },
        },
@@ -589,15 +680,15 @@
    );
    searchSlots.value.push('fac' + n.value);
    swSlots.value.push(`sw${n.value}`);
    objInputs.value[`${getFieldsValue().ASSEMBLY_NAME}${n.value}a`] = '';
    searchSelectVals.value[`${getFieldsValue().ASSEMBLY_NAME}${n.value}a`] = '';
    objInputs.value[`${SearchEntName.value}${n.value}a`] = '';
    searchSelectVals.value[`${SearchEntName.value}${n.value}a`] = '';
    console.log(searchSlots.value);
    n.value++;
  }
  function del(field) {
    removeSchemaByField([
      `${getFieldsValue().ASSEMBLY_NAME}${field}a`,
      `${SearchEntName.value}${field}a`,
      `Switch${field}`,
      `InputNumber${field}`,
      `${field}`,
@@ -614,7 +705,7 @@
    appendSchemaByFieldMain(
      [
        {
          field: `${getFieldsValueMain().MainAssemblyName}${m.value}a`,
          field: `${MainEntName.value}${m.value}a`,
          component: 'InputGroup',
          label: '字段' + m.value,
          // required: true,
@@ -646,7 +737,12 @@
          field: `InputTextArea${m.value}`,
          component: 'InputTextArea',
          label: '自定义渲染',
          slot: `mainwIa${m.value}`,
          colProps: { span: 21 },
          componentProps: {
            placeholder: '请编辑渲染代码',
            rows: 4,
          },
        },
        {
          field: `${m.value}`,
@@ -662,15 +758,16 @@
    mainSwSlots.value.push(`mainSw${m.value}`);
    mainsSwSlots.value.push(`mainsSw${m.value}`);
    mainwSwSlots.value.push(`mainwSw${m.value}`);
    mainInputs.value[`${getFieldsValueMain().MainAssemblyName}${m.value}a`] = '';
    mainSelectVals.value[`${getFieldsValueMain().MainAssemblyName}${m.value}a`] = '';
    mainIaSlots.value.push(`mainwIa${m.value}`);
    mainInputs.value[`${MainEntName.value}${m.value}a`] = '';
    mainSelectVals.value[`${MainEntName.value}${m.value}a`] = '';
    console.log(mainSlots.value);
    m.value++;
  }
  function mainDel(field) {
    removeSchemaByFieldMain([
      `${getFieldsValueMain().MainAssemblyName}${field}a`,
      `${MainEntName.value}${field}a`,
      `Switch${field}`,
      `sSwitch${field}`,
      `wSwitch${field}`,
@@ -680,6 +777,7 @@
    mainSwSlots.value.splice(mainSwSlots.value.indexOf(`mainSw${field}`), 1);
    mainsSwSlots.value.splice(mainsSwSlots.value.indexOf(`mainsSw${field}`), 1);
    mainwSwSlots.value.splice(mainwSwSlots.value.indexOf(`mainwSw${field}`), 1);
    mainIaSlots.value.splice(mainIaSlots.value.indexOf(`mainwIa${field}`), 1);
    mainSlots.value.splice(mainSlots.value.indexOf(`mainfac${field}`), 1);
    if (mainSlots.value.length == 0) {
      m.value = 1;
@@ -691,7 +789,7 @@
    appendSchemaByFieldCrud(
      [
        {
          field: `${getFieldsValueCrud().crudAssemblyName}${j.value}a`,
          field: `${CrudEntName.value}${j.value}a`,
          component: 'InputGroup',
          label: '字段' + j.value,
          // required: true,
@@ -731,15 +829,15 @@
    crudSlots.value.push('crudfac' + j.value);
    crudSwSlots.value.push(`crudSw${j.value}`);
    crudrSwSlots.value.push(`crudrSw${j.value}`);
    crudInputs.value[`${getFieldsValueCrud().crudAssemblyName}${j.value}a`] = '';
    crudSelectVals.value[`${getFieldsValueCrud().crudAssemblyName}${j.value}a`] = '';
    crudInputs.value[`${CrudEntName.value}${j.value}a`] = '';
    crudSelectVals.value[`${CrudEntName.value}${j.value}a`] = '';
    console.log(crudSlots.value);
    j.value++;
  }
  function crudDel(field) {
    removeSchemaByFieldCrud([
      `${getFieldsValueCrud().crudAssemblyName}${field}a`,
      `${CrudEntName.value}${field}a`,
      `Switch${field}`,
      `rSwitch${field}`,
      `InputNumber${field}`,
@@ -761,5 +859,6 @@
<style lang="less" scoped>
  .high-form {
    padding-bottom: 48px;
  }
</style>: { values: any[]; }: any: { values: any[]; }: any: { values: any[]; }: any: any: any: any: any: any: any
  }</style
>: { values: any[]; }: any: { values: any[]; }: any: { values: any[]; }: any: any: any: any: any:
any: any