Ben Lin
2025-03-05 abbc201b41a1a25a19ccf7cff8df633dadcf5d88
src/views/tigerprojects/system/lowcode/entityts/BAS_LABEL_VAR.ts
@@ -4,7 +4,7 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-08-03 14:09:58
 * @LastEditTime: 2024-10-22 11:40:44
 */
import { Tag, Tooltip } from 'ant-design-vue';
@@ -26,8 +26,7 @@
  BasLabelTempInput,
} from '/@/api/tigerapi/model/mesModel';
import { useUserStore } from '/@/store/modules/user';
import { uploadApi } from '/@/api/sys/upload';
import { useWebSocketStore } from '/@/store/modules/websocket';
import { cloneDeep } from 'lodash-es';
const { getLocale } = useLocale();
@@ -168,7 +167,7 @@
          component: 'Input',
          isexist: 'N',
          show: true,
          required: true,
          // required: true,
          colProps: {
            span: 7,
          },
@@ -348,6 +347,15 @@
    GetNewRow: (type: string) => {
      let values = {};
      switch (type) {
        case 'BAS_LABEL_VAR':
          values = {
            VAR_NAME: '',
            VAR_TYPE: '',
            VAR_VALUE: '',
            BARCODE_RULE: '',
            REMARK: '',
          };
          break;
        case 'BAS_LABEL_VAR_WO':
          values = newRow;
          break;
@@ -382,7 +390,7 @@
    GetBaseCards: (type: string) => {
      return [
        {
          name: 'BaseForm',
          name: 'BaseForm', //第一个卡片名称必需是BaseForm
          slots: [],
          preIcons: {},
          title: '模板信息',
@@ -399,10 +407,10 @@
        {
          BAS_LABEL_VAR: useDrawer(),
        },
        { BAS_LABEL_VAR_WO: useDrawer() },
        // { BAS_LABEL_VAR_WO: useDrawer() },
      ];
    },
     /**
    /**
     * @description: 获取表格use列表
     * @param {string} type
     * @param {array} args
@@ -429,13 +437,13 @@
          // rowSelection: {
          //   type: 'radio', //'checkbox'
          // },
          // actionColumn: {
          //   width: 130,
          //   title: '操作',
          //   dataIndex: 'action',
          //   slots: { customRender: 'action' },
          //   fixed: 'right',
          // }, //自定义操作列
          actionColumn: {
            width: 130,
            title: '操作',
            dataIndex: 'action',
            slots: { customRender: 'action' },
            fixed: 'right',
          }, //自定义操作列
        }),
        BAS_LABEL_VAR_WO: useTable({
          title: '列表信息',
@@ -548,8 +556,8 @@
          PROD_CODE: label.PROD_CODE,
          REMARK: '',
        } as unknown as BAS_LABEL_TEMP,
        LabelVars: {} as unknown as BAS_LABEL_VAR[],
        LabelVarWos: {} as unknown as BAS_LABEL_VAR_WO[],
        LabelVars: [] as unknown as BAS_LABEL_VAR[],
        LabelVarWos: [] as unknown as BAS_LABEL_VAR_WO[],
      };
      drawers.forEach((d) => {
        let where = `${d['code']} = '${keyFieldValues.value[d['code']]}'`;
@@ -718,6 +726,27 @@
        }
      });
    },
    /**
     * @desc 保存方法
     */
    SaveRow: (param: CustModalParams) => {
      return new Promise((resolve, reject) => {
        try {
          param.data.value[param.cType] = param.data.value[param.cType].map((d) => {
            if (d.ID == param.values['ID']) {
              d.VAR_NAME = param.values['VAR_NAME'];
              d.VAR_TYPE = param.values['VAR_TYPE'];
              d.VAR_VALUE = param.values['VAR_VALUE'];
              d.BARCODE_RULE = param.values['BARCODE_RULE'];
              d.REMARK = param.values['REMARK'];
            }
            return d;
          });
        } catch {
          reject(false);
        }
      });
    },
  };
  let columns: BasicColumn[] = [];
@@ -740,13 +769,14 @@
        title: '变量名称',
        ifShow: true,
        sorter: true,
        editRow: true,
        resizable: true,
        customRender: () => {},
      },
      {
        dataIndex: 'VAR_TYPE',
        title: '变量类型',
        edit: true,
        editRow: true,
        editRule: true,
        ifShow: true,
        sorter: true,
@@ -760,7 +790,11 @@
            labelField: unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name',
            valueField: 'Value',
            onChange: (e, v) => {
              if (e == 1) {
              if (e == 1 || e == 4) {
                const where =
                  e == 1
                    ? { TABLE_NAME: 'BAS_LABEL_PV', VAR_TYPE: 0 }
                    : { TABLE_NAME: 'BAS_LABEL_PV', VAR_TYPE: 1 };
                emit('opencust', {
                  data: column.record,
                  name: 'BAS_LABEL_VAR',
@@ -794,7 +828,7 @@
                    ],
                    tableName: 'BAS_LABEL_PV',
                    rowKey: 'VAR_CODE',
                    searchInfo: { TABLE_NAME: 'BAS_LABEL_PV' },
                    searchInfo: where,
                  },
                });
              }
@@ -821,6 +855,10 @@
              text = '自定义变量';
              color = '#bfbfbf';
              break;
            case 4:
              text = '条码生成';
              color = '#b442df';
              break;
          }
          return h(Tooltip, { title: text }, () => h(Tag, { color: color }, () => text));
        },
@@ -834,7 +872,7 @@
            {
              dataIndex: 'VAR_VALUE',
              title: '变量值',
              edit: true,
              editRow: true,
              // editable: true,
              editRule: true,
              ifShow: (column) => true,
@@ -842,9 +880,29 @@
              resizable: true,
            },
            {
              dataIndex: 'BARCODE_RULE',
              title: '条码生成规则',
              ifShow: true,
              editRow: true,
              editRule: true,
              sorter: true,
              resizable: true,
              editComponent: 'ApiSelect',
              editComponentProps: (column) => {
                return {
                  api: getEntity,
                  params: { entityName: 'BAS_CODE_RULE', sqlcmd: ' 1=1 ' },
                  resultField: 'Data.Items',
                  labelField: 'RULE_NAME',
                  valueField: 'RULE_CODE',
                };
              },
            },
            {
              dataIndex: 'REMARK',
              title: '备注',
              ifShow: true,
              editRow: true,
              sorter: true,
              resizable: true,
            },