广丰卷烟厂数采质量分析系统
ruoyi-plus-soybean/src/views/analy/feed-match/index.vue
@@ -15,7 +15,6 @@
  name: 'FeedMatchList'
});
const appStore = useAppStore();
const { download } = useDownload();
const { hasAuth } = useAuth();
@@ -25,247 +24,248 @@
  pageSize: 10,
  time: null,
  key: null,
  shift: null,
  params: {}
});
const { columns, columnChecks, data, getData, getDataByPage, loading, mobilePagination, scrollX } =
  useNaivePaginatedTable({
  api: () => fetchGetFeedMatchList(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: () => fetchGetFeedMatchList(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: 'time',
      title: '时间戳',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'key',
      title: '班次+机台',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'dacUpTime',
      title: '数据更新时间',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'fs11',
      title: '1#喂丝机对应的第一个储丝柜',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'fs12',
      title: '1#喂丝机对应的第二个储丝柜',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'fs21',
      title: '2#喂丝机对应的第一个储丝柜',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'fs22',
      title: '2#喂丝机对应的第二个储丝柜',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'fs31',
      title: '3#喂丝机对应的第一个储丝柜',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'fs32',
      title: '3#喂丝机对应的第二个储丝柜',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'fs41',
      title: '4#喂丝机对应的第一个储丝柜',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'fs42',
      title: '4#喂丝机对应的第二个储丝柜',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe01',
      title: '1#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe02',
      title: '2#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe03',
      title: '3#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe04',
      title: '4#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe05',
      title: '5#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe06',
      title: '6#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe07',
      title: '7#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe08',
      title: '8#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe09',
      title: '9#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe10',
      title: '10#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe11',
      title: '11#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'pipe12',
      title: '12#机组对应的喂丝机和管道',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'wsjState',
      title: '喂丝机状态 1-连接 0-断开',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'shift',
      title: '班次',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'equNo',
      title: '机台',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'remark',
      title: '备注',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'operate',
      title: $t('common.operate'),
      align: 'center',
      width: 130,
      render: row => {
        const divider = () => {
          if (!hasAuth('analy:feedMatch:edit') || !hasAuth('analy:feedMatch: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: 'time',
        title: '时间戳',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'key',
        title: '班次+机台',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'dacUpTime',
        title: '数据更新时间',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'fs11',
        title: '1#喂丝机对应的第一个储丝柜',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'fs12',
        title: '1#喂丝机对应的第二个储丝柜',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'fs21',
        title: '2#喂丝机对应的第一个储丝柜',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'fs22',
        title: '2#喂丝机对应的第二个储丝柜',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'fs31',
        title: '3#喂丝机对应的第一个储丝柜',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'fs32',
        title: '3#喂丝机对应的第二个储丝柜',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'fs41',
        title: '4#喂丝机对应的第一个储丝柜',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'fs42',
        title: '4#喂丝机对应的第二个储丝柜',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe01',
        title: '1#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe02',
        title: '2#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe03',
        title: '3#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe04',
        title: '4#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe05',
        title: '5#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe06',
        title: '6#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe07',
        title: '7#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe08',
        title: '8#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe09',
        title: '9#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe10',
        title: '10#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe11',
        title: '11#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'pipe12',
        title: '12#机组对应的喂丝机和管道',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'wsjState',
        title: '喂丝机状态 1-连接 0-断开',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'shift',
        title: '班次',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'equNo',
        title: '机台',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'remark',
        title: '备注',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'operate',
        title: $t('common.operate'),
        align: 'center',
        width: 130,
        render: row => {
          const divider = () => {
            if (!hasAuth('analy:feedMatch:edit') || !hasAuth('analy:feedMatch:remove')) {
              return null;
            }
            return <NDivider vertical />;
          };
        const editBtn = () => {
          if (!hasAuth('analy:feedMatch:edit')) {
            return null;
          }
          const editBtn = () => {
            if (!hasAuth('analy:feedMatch:edit')) {
              return null;
            }
            return (
              <ButtonIcon
                text
                type="primary"
                icon="material-symbols:drive-file-rename-outline-outline"
                tooltipContent={$t('common.edit')}
                onClick={() => edit(row.time)}
              />
            );
          };
          const deleteBtn = () => {
            if (!hasAuth('analy:feedMatch:remove')) {
              return null;
            }
            return (
              <ButtonIcon
                text
                type="error"
                icon="material-symbols:delete-outline"
                tooltipContent={$t('common.delete')}
                popconfirmContent={$t('common.confirmDelete')}
                onPositiveClick={() => handleDelete(row.time)}
              />
            );
          };
          return (
            <ButtonIcon
              text
              type="primary"
              icon="material-symbols:drive-file-rename-outline-outline"
              tooltipContent={$t('common.edit')}
              onClick={() => edit(row.time)}
            />
            <div class="flex-center gap-8px">
              {editBtn()}
              {divider()}
              {deleteBtn()}
            </div>
          );
        };
        const deleteBtn = () => {
          if (!hasAuth('analy:feedMatch:remove')) {
            return null;
          }
          return (
            <ButtonIcon
              text
              type="error"
              icon="material-symbols:delete-outline"
              tooltipContent={$t('common.delete')}
              popconfirmContent={$t('common.confirmDelete')}
              onPositiveClick={() => handleDelete(row.time)}
            />
          );
        };
        return (
          <div class="flex-center gap-8px">
            {editBtn()}
            {divider()}
            {deleteBtn()}
          </div>
        );
        }
      }
    }
  ]
});
    ]
  });
const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted } =
  useTableOperate(data, 'time', getData);