Ben Lin
2024-07-30 cc88111d61a350a4d24cf339b526d4357f934ddf
src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_TEMP.ts
@@ -4,10 +4,13 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-07-03 08:52:24
 * @LastEditTime: 2024-07-29 23:38:12
 */
import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
import { ActionItem, BasicColumn } from '/@/components/Table';
import { useWebSocketStore } from '/@/store/modules/websocket';
import { buildUUID } from '/@/utils/uuid';
function _default() {
  const ActionColumn: BasicColumn = {
@@ -27,9 +30,39 @@
     * @description: 获取新增按钮的行为
     * @return {*}
     */
    CreateAction: (fnName: string) => {
    CreateAction: (type: string) => {
      return {
        action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面)
        action: 'go', //drawer(打开左侧抽屉框) | go(跳转到新的页面) | edit(如果是表格可编辑页面就是自定义方法)
        url: 'BAS_LABEL_VAR/High',
        params: {
          CODE: '0',
          ID: buildUUID(),
          Name: 'BAS_LABEL_VAR', //实体名
          Title: '新增模板', //标题
          pCode: 'LABEL_CODE', //主信息关键字段CODE
          IsID: true, //是否带过去侧边框的是ID,false就是CODE,true是ID
          colSlots: ['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'],
          drawers: [
            {
              name: 'BAS_LABEL_VAR', //实体名
              code: 'LABEL_ID', //传递过去高级表单页面的关键字段名
              type: 'one', //one-表示需要code的一个值,默认是这个
              keyName: 'BAS_LABEL_VAR', //关键表名(实体名)
              order: 'VAR_NAME', //排序
              showTbButton: false, //是否显示工具栏按钮
              FnName: '', //自定义方法名
            },
            {
              name: 'BAS_LABEL_VAR_WO', //实体名
              code: 'LABEL_ID', //传递过去高级表单页面的关键字段名
              type: 'one', //all-表示需要code的所有的值
              keyName: 'BAS_LABEL_VAR_WO', //关键表名(实体名)
              order: '',
              showTbButton: true, //是否显示工具栏按钮
              FnName: 'AddRow', //自定义方法名
            },
          ], //drawers是右边弹出增改侧框的名字列表,及按钮的执行方法
        },
      };
    },
    /**
@@ -37,16 +70,30 @@
     * @return {*}
     */
    ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
      return [
        ...data,
        ...[
          {
            icon: 'clarity:info-standard-line',
            tooltip: '模板变量',
            onClick: goDetail.bind(null, args[5], params),
          },
        ],
      ];
      data.map((x) => {
        if (x.name == 'Edit') {
          x.onClick = goDetail.bind(null, args[5], params);
          x.tooltip = '模板变量';
        }
      });
      return data;
    },
    GetUseForm: () => {
      return {};
    },
    /**
     * @description: 自定义方法
     * @param {string} type
     * @param {array} args
     * @return {*}
     */
    CustFunc: (param: CustModalParams) => {
      const webSocketStore = useWebSocketStore();
      if (webSocketStore.GetSocketState == 1) {
        webSocketStore.sendMessage(
          `wsSubStrings ${param.values['ID']}_#_${param.values['TEMP_PATH']}`,
        );
      }
    },
  };
@@ -59,20 +106,47 @@
   */
  function goDetail(go: Fn, params: Recordable) {
    const id = {
      ID: params['record'].ID,
      CODE: params['record']['LABEL_CODE'],
      ID: params['record']['ID'],
      Name: 'BAS_LABEL_VAR',
      firstTabName: '标签模板变量',
      secondTabName: '', //'标签过程变量',
      firstTitle: '模板变量',
      secondTitle: '', //'过程变量',
      pageTitle: '标签模板变量', //详情页面标题
      contentStr: '这里是标签模板变量管理页面,可以管理标签的模板变量或者打印过程中的变量',
      detailName: `模板[${params['record'].LABEL_NAME}]`,
      keyFieldValues: { LABEL_ID: params['record'].ID },
      colSlots: ['BAS_LABEL_PV1add'],
      SessionName: 'BAS_LABEL_VAR_update',
      Title: `编辑模板${params['record']['LABEL_CODE']}的变量`,
      pCode: 'LABEL_CODE',
      IsID: true,
      colSlots: ['BAS_LABEL_VAR1add', 'BAS_LABEL_VAR2add'],
      drawers: [
        {
          name: 'BAS_LABEL_VAR',
          code: 'LABEL_ID',
          type: 'one',
          keyName: 'BAS_LABEL_VAR',
          order: 'VAR_NAME',
          showTbButton: false,
          FnName: '',
        },
        {
          name: 'BAS_LABEL_VAR_WO',
          code: 'LABEL_ID',
          type: 'one',
          keyName: 'BAS_LABEL_VAR_WO',
          order: '',
          showTbButton: true,
          FnName: 'AddRow',
        },
      ], //drawers是右边弹出增改侧框的名字列表
    };
    go(`/BAS_LABEL_VAR/${encodeURI(JSON.stringify(id))}`);
    // const webSocketStore = useWebSocketStore();
    // if (webSocketStore.GetSocketState == 1) {
    //   webSocketStore.sendMessage(
    //     `wsSubStrings 1d441e20c43a469286319de9b0df5d7b_#_http://localhost:8800/files/10位唯一ID.btw`,
    //   );
    // }
    // 将对象转换为JSON字符串并保存到sessionStorage
    sessionStorage.removeItem(`${id.SessionName}_params`);
    sessionStorage.setItem(`${id.SessionName}_params`, encodeURI(JSON.stringify(id)));
    go(
      `/BAS_LABEL_VAR/High/${encodeURI(JSON.stringify({ sName: id.SessionName, Name: id.Name }))}`,
    );
  }
  return [methods, ActionColumn];