广丰卷烟厂数采质量分析系统
ruoyi-plus-soybean/src/views/qm/batch/index.vue
old mode 100644 new mode 100755
@@ -15,7 +15,6 @@
  name: 'BatchList'
});
const appStore = useAppStore();
const { download } = useDownload();
const { hasAuth } = useAuth();
@@ -44,365 +43,365 @@
const { columns, columnChecks, data, getData, getDataByPage, loading, mobilePagination, scrollX } =
  useNaivePaginatedTable({
  api: () => fetchGetBatchList(searchParams.value),
  transform: response => defaultTransform(response),
  onPaginationParamsChange: params => {
    searchParams.value.pageNum = params.page;
    searchParams.value.pageSize = params.pageSize;
  },
  columns: () => [
    {
      type: 'selection',
      align: 'center',
      width: 48
    api: () => fetchGetBatchList(searchParams.value),
    transform: response => defaultTransform(response),
    onPaginationParamsChange: params => {
      searchParams.value.pageNum = params.page;
      searchParams.value.pageSize = params.pageSize;
    },
    {
      key: 'index',
      title: $t('common.index'),
      align: 'center',
      width: 64,
      render: (_, index) => index + 1
    },
    {
      key: 'id',
      title: '编码',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'batchCode',
      title: '批次代码',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'batchName',
      title: '批次名称',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'typ',
      title: '类型',
      align: 'center',
      minWidth: 120,
      render: row => TYP_MAP[row.typ] ?? row.typ
    },
    {
      key: 'eqpCode',
      title: '机台代码',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'matCode',
      title: '牌号',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'judgeCode',
      title: '判定依据代码',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'batchDate',
      title: '批次生成日期',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'isflag',
      title: '使用标志',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'enabled',
      title: '启用标志',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'totalNum',
      title: '到货总量',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'results',
      title: '综合判定',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'approver',
      title: '批准人',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'auditor',
      title: '审核人',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'creater',
      title: '创建人',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'tabDate',
      title: '制表日期',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'verName',
      title: '版本名称',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'verCode',
      title: '版本编号',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'archDate',
      title: '保存期',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'flag',
      title: '反馈MES',
      align: 'center',
      minWidth: 120,
      render: row => FLAG_MAP[String(row.flag)] ?? row.flag
    },
    {
      key: 'toMesDate',
      title: '上传MES时间',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'fromMesDate',
      title: '从MES时间下载',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'deleted',
      title: '删除标志',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'batchDes',
      title: '批次描述',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'category',
      title: '类别',
      align: 'center',
      minWidth: 120,
      render: row => CATEGORY_MAP[String(row.category)] ?? row.category
    },
    {
      key: 'makeno',
      title: '卷制工号',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'shifteqpno',
      title: '班次机号',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'boxno',
      title: '装箱号',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pid',
      title: '父批次号',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'reviewer',
      title: '复核人',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'rvcount',
      title: '复检次数',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'state',
      title: '批次状态',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'reviewTime',
      title: '复核日期',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'auditTime',
      title: '审核日期',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'spec',
      title: '规格',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'approveTime',
      title: '批准时间',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'unit',
      title: '到货单位',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'arrivalTime',
      title: '到货日期',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'storagePlace',
      title: '存放地点',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'checker',
      title: '检验员',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'receiveTime',
      title: '接单日期',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'inspTime',
      title: '报检日期',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'storer',
      title: '仓库保管员',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'isverify',
      title: '是否验证',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'ischk',
      title: '是否检验',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'bak1',
      title: '备用1',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'bak2',
      title: '备用2',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'operate',
      title: $t('common.operate'),
      align: 'center',
      width: 130,
      render: row => {
        const divider = () => {
          if (!hasAuth('qm:batch:edit') || !hasAuth('qm:batch:remove')) {
            return null;
          }
          return <NDivider vertical />;
        };
    columns: () => [
      {
        type: 'selection',
        align: 'center',
        width: 48
      },
      {
        key: 'index',
        title: $t('common.index'),
        align: 'center',
        width: 64,
        render: (_, index) => index + 1
      },
      {
        key: 'id',
        title: '编码',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'batchCode',
        title: '批次代码',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'batchName',
        title: '批次名称',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'typ',
        title: '类型',
        align: 'center',
        minWidth: 120,
        render: row => TYP_MAP[row.typ] ?? row.typ
      },
      {
        key: 'eqpCode',
        title: '机台代码',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'matCode',
        title: '牌号',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'judgeCode',
        title: '判定依据代码',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'batchDate',
        title: '批次生成日期',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'isflag',
        title: '使用标志',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'enabled',
        title: '启用标志',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'totalNum',
        title: '到货总量',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'results',
        title: '综合判定',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'approver',
        title: '批准人',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'auditor',
        title: '审核人',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'creater',
        title: '创建人',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'tabDate',
        title: '制表日期',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'verName',
        title: '版本名称',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'verCode',
        title: '版本编号',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'archDate',
        title: '保存期',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'flag',
        title: '反馈MES',
        align: 'center',
        minWidth: 120,
        render: row => FLAG_MAP[String(row.flag)] ?? row.flag
      },
      {
        key: 'toMesDate',
        title: '上传MES时间',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'fromMesDate',
        title: '从MES时间下载',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'deleted',
        title: '删除标志',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'batchDes',
        title: '批次描述',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'category',
        title: '类别',
        align: 'center',
        minWidth: 120,
        render: row => CATEGORY_MAP[String(row.category)] ?? row.category
      },
      {
        key: 'makeno',
        title: '卷制工号',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'shifteqpno',
        title: '班次机号',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'boxno',
        title: '装箱号',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pid',
        title: '父批次号',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'reviewer',
        title: '复核人',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'rvcount',
        title: '复检次数',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'state',
        title: '批次状态',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'reviewTime',
        title: '复核日期',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'auditTime',
        title: '审核日期',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'spec',
        title: '规格',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'approveTime',
        title: '批准时间',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'unit',
        title: '到货单位',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'arrivalTime',
        title: '到货日期',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'storagePlace',
        title: '存放地点',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'checker',
        title: '检验员',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'receiveTime',
        title: '接单日期',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'inspTime',
        title: '报检日期',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'storer',
        title: '仓库保管员',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'isverify',
        title: '是否验证',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'ischk',
        title: '是否检验',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'bak1',
        title: '备用1',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'bak2',
        title: '备用2',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'operate',
        title: $t('common.operate'),
        align: 'center',
        width: 130,
        render: row => {
          const divider = () => {
            if (!hasAuth('qm:batch:edit') || !hasAuth('qm:batch:remove')) {
              return null;
            }
            return <NDivider vertical />;
          };
        const editBtn = () => {
          if (!hasAuth('qm:batch:edit')) {
            return null;
          }
          const editBtn = () => {
            if (!hasAuth('qm:batch:edit')) {
              return null;
            }
            return (
              <ButtonIcon
                text
                type="primary"
                icon="material-symbols:drive-file-rename-outline-outline"
                tooltipContent={$t('common.edit')}
                onClick={() => edit(row.id)}
              />
            );
          };
          const deleteBtn = () => {
            if (!hasAuth('qm:batch:remove')) {
              return null;
            }
            return (
              <ButtonIcon
                text
                type="error"
                icon="material-symbols:delete-outline"
                tooltipContent={$t('common.delete')}
                popconfirmContent={$t('common.confirmDelete')}
                onPositiveClick={() => handleDelete(row.id)}
              />
            );
          };
          return (
            <ButtonIcon
              text
              type="primary"
              icon="material-symbols:drive-file-rename-outline-outline"
              tooltipContent={$t('common.edit')}
              onClick={() => edit(row.id)}
            />
            <div class="flex-center gap-8px">
              {editBtn()}
              {divider()}
              {deleteBtn()}
            </div>
          );
        };
        const deleteBtn = () => {
          if (!hasAuth('qm:batch:remove')) {
            return null;
          }
          return (
            <ButtonIcon
              text
              type="error"
              icon="material-symbols:delete-outline"
              tooltipContent={$t('common.delete')}
              popconfirmContent={$t('common.confirmDelete')}
              onPositiveClick={() => handleDelete(row.id)}
            />
          );
        };
        return (
          <div class="flex-center gap-8px">
            {editBtn()}
            {divider()}
            {deleteBtn()}
          </div>
        );
        }
      }
    }
  ]
});
    ]
  });
const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted } =
  useTableOperate(data, 'id', getData);