analysisLog.vue 2.94 KB
<route lang="yaml">
  name: analysisLog
</route>

<script lang="ts" setup name="analysisLog">
import { ref } from "vue";
import { useRouter, useRoute } from "vue-router";
import Table from "@/components/Table/index.vue";
import { getWordLogList } from "@/api/modules/dataQualityWord";
import { ElMessage } from "element-plus";

const { proxy } = getCurrentInstance() as any;

const router = useRouter();
const route = useRoute();
const guid = route.query.guid;
const wordName = route.query.name;

const page = ref({
  limit: 50,
  curr: 1,
  sizes: [
    { label: "10", value: 10 },
    { label: "50", value: 50 },
    { label: "100", value: 100 },
    { label: "150", value: 150 },
    { label: "200", value: 200 },
  ],
});
const tableInfo = ref({
  id: "word-log-table",
  loading: false,
  fields: [
    { label: "报告名称", field: "analysisReportName", width: 230 },
    {
      label: "方案类型", field: "analysisReportType", width: 100, getName: (scope) => {
        let planType = scope.row.analysisReportType;
        return planType == 1 ? '表' : (planType == 2 ? '数据库' : (planType == 4 ? '数据同步' : '分组'));
      }
    },
    { label: "报告对象", field: "qualityModelName", width: 180, },
    { label: "质量评分", field: "qualityScore", width: 100, align: "right" },
    { label: "最后执行时间", field: "execTime", width: 180, },
    { label: "执行状态", field: "execResult", type: "tag", width: 120, align: "center" },
  ],
  data: [],
  page: {
    type: "normal",
    rows: 0,
    ...page.value,
  },
  actionInfo: {
    label: "操作",
    type: "btn",
    width: 100,
    fixed: 'right',
    btns: (scope) => {
      return [{ label: "查看报告", value: "reportView", disabled: scope.row['execResult'] != 'Y' }];
    }
  }
});

const getTableData = () => {
  tableInfo.value.loading = true;
  getWordLogList({ pageIndex: page.value.curr, pageSize: page.value.limit, reportGuid: guid }).then((res: any) => {
    tableInfo.value.loading = false;
    if (res.code == proxy.$passCode) {
      const data = res.data || {}
      tableInfo.value.data = data.records || []
      tableInfo.value.page.limit = data.pageSize
      tableInfo.value.page.curr = data.pageIndex
      tableInfo.value.page.rows = data.totalRows
    } else {
      ElMessage.error(res.msg);
    }
  })
};

const tableBtnClick = (scope, btn) => {
  const type = btn.value;
  const row = scope.row;
  if (type == 'reportView') {
    router.push({
      name: 'analysisReport',
      query: {
        planGuid: row.planGuid,
        reportExecGuid: row.guid,
        name: wordName
      }
    });
  }
};

onBeforeMount(() => {
  getTableData();
});

</script>

<template>
  <div class="container_wrap">
    <div class="table_panel_wrap">
      <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" />
    </div>
  </div>
</template>

<style lang="scss" scoped>
.container_wrap {
  padding: 0;

  .table_panel_wrap {
    height: 100%;
    padding: 16px 16px 0;
  }
}
</style>