广丰卷烟厂数采质量分析系统
ruoyi-plus-soybean/src/views/md/shift/index.vue
old mode 100644 new mode 100755
@@ -15,7 +15,6 @@
  name: 'ShiftList'
});
const appStore = useAppStore();
const { download } = useDownload();
const { hasAuth } = useAuth();
@@ -31,158 +30,158 @@
const { columns, columnChecks, data, getData, getDataByPage, loading, mobilePagination, scrollX } =
  useNaivePaginatedTable({
  api: () => fetchGetShiftList(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: () => fetchGetShiftList(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: 'ud',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'wsId',
      title: '车间外键',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'code',
      title: '编码',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'name',
      title: '名称',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'stim',
      title: '班次开始时间',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'etim',
      title: '班次结束时间',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'seq',
      title: '排序',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'enable',
      title: '启用',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'del',
      title: '删除',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'createUserName',
      title: '创建用户',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'createUserTime',
      title: '创建时间',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'updateUserName',
      title: '更新用户',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'updateUserTime',
      title: '更新时间',
      align: 'center',
      minWidth: 120
    },
    {
      key: 'operate',
      title: $t('common.operate'),
      align: 'center',
      width: 130,
      render: row => {
        const divider = () => {
          if (!hasAuth('md:shift:edit') || !hasAuth('md:shift: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: 'id',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'wsId',
        title: '车间外键',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'code',
        title: '编码',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'name',
        title: '名称',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'stim',
        title: '班次开始时间',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'etim',
        title: '班次结束时间',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'seq',
        title: '排序',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'enable',
        title: '启用',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'del',
        title: '删除',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'createUserName',
        title: '创建用户',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'createUserTime',
        title: '创建时间',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'updateUserName',
        title: '更新用户',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'updateUserTime',
        title: '更新时间',
        align: 'center',
        minWidth: 120
      },
      {
        key: 'operate',
        title: $t('common.operate'),
        align: 'center',
        width: 130,
        render: row => {
          const divider = () => {
            if (!hasAuth('md:shift:edit') || !hasAuth('md:shift:remove')) {
              return null;
            }
            return <NDivider vertical />;
          };
        const editBtn = () => {
          if (!hasAuth('md:shift:edit')) {
            return null;
          }
          const editBtn = () => {
            if (!hasAuth('md:shift: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('md:shift: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('md:shift: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);