resultProcess.vue 4.84 KB
<route lang="yaml">
  name: resultProcess
</route>

<script lang="ts" setup name="resultProcess">
import TableTools from "@/components/Tools/table_tools.vue";
import { commonPageConfig } from '@/components/PageNav/index';
import { TableColumnWidth } from "@/utils/enum";
import {
  dataSourceTypeList,
  getAnonTaskList,
  deleteAnonTask,
} from '@/api/modules/dataAnonymization';
import { useValidator } from '@/hooks/useValidator';

const router = useRouter()
const { proxy } = getCurrentInstance() as any;
const { required } = useValidator();

const searchItemList = ref([{
  type: "input",
  label: "",
  field: "taskName",
  default: "",
  placeholder: "任务名称",
  clearable: true,
}, {
  type: "select",
  label: "",
  field: "dataSource",
  default: null,
  options: dataSourceTypeList,
  placeholder: "数据来源",
  clearable: true,
  filterable: true,
}])

/** 分页及搜索传参信息配置。 */
const page = ref({
  ...commonPageConfig,
  taskName: '',
  dataSource: null
});

const tableInfo = ref({
  id: 'data-file-table',
  fields: [
    { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
    { label: "任务名称", field: "taskName", width: 160 },
    {
      label: "数据来源", field: "dataSource", width: 100, getName: (scope) => {
        return scope.row.dataSource && dataSourceTypeList.find(f => f.value == scope.row.dataSource)?.label || '--';
      }
    },
    { label: "任务状态", field: "sensitiveIdentifyTaskStatus", width: TableColumnWidth.STATE, align: 'center', type: "tag" },
    { label: "导出时间", field: "exportTime", width: TableColumnWidth.DATETIME },
    { label: "修改人", field: "updateUserName", width: TableColumnWidth.USERNAME },
    { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
  ],
  data: [],
  page: {
    type: "normal",
    rows: 0,
    ...page.value,
  },
  loading: false,
  actionInfo: {
    label: "操作",
    type: "btn",
    width: 180,
    fixed: 'right',
    btns: (scope) => {
      return [ {
        label: "编辑", value: "edit", disabled: scope.row.status == 'R', click: (scope) => {
        
        }
      }, {
        label: '查看数据', value: 'view', disabled: scope.row.status != 'Y', click: (scope) => {
          // router.push({
          //   name: 'sensitiveIdentifyConfig',
          //   query: {
          //     guid: scope.row.guid,
          //     execGuid: scope.row.execGuid,
          //     taskName: scope.row.taskName
          //   }
          // });
        }
      }, {
        label: "删除", value: "delete", disabled: scope.row.status == 'R', click: (scope) => {
          proxy.$openMessageBox("此操作将永久删除, 是否继续?", () => {
            let guids = [scope.row.guid];
            deleteAnonTask(guids).then((res: any) => {
              if (res?.code == proxy.$passCode) {
                getTableData();
                proxy.$ElMessage({
                  type: "success",
                  message: "删除成功",
                });
              } else {
                proxy.$ElMessage({
                  type: "error",
                  message: res.msg,
                });
              }
            });
          })
        }
      }]
    }
  }
})

const toSearch = (val: any, clear: boolean = false) => {
  if (clear) {
    searchItemList.value.map((item) => (item.default = ""));
    page.value.taskName = '';
    page.value.dataSource = null;
  } else {
    page.value.taskName = val.taskName;
    page.value.dataSource = val.dataSource;
  }
  getTableData();
};

const getTableData = () => {
  tableInfo.value.loading = true
  getAnonTaskList({
    pageIndex: page.value.curr,
    pageSize: page.value.limit,
    taskName: page.value.taskName,
    dataSource: page.value.dataSource
  }).then((res: any) => {
    if (res?.code == proxy.$passCode) {
      const data = res.data || {};
      tableInfo.value.data = data.records?.map(d => {
        d.sensitiveIdentifyTaskStatus = d.status;
        return d;
      }) || []
      tableInfo.value.page.limit = data.pageSize
      tableInfo.value.page.curr = data.pageIndex
      tableInfo.value.page.rows = data.totalRows
    } else {
      proxy.$ElMessage({
        type: 'error',
        message: res.msg,
      })
    }
    tableInfo.value.loading = false
  })
};

const tablePageChange = (info) => {
  page.value.curr = Number(info.curr);
  page.value.limit = Number(info.limit);
  getTableData();
};

const handleCreate = () => {
  router.push({
    name: 'anonTaskCreate'
  });
}

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

</script>

<template>
  <div class="container_wrap">
   匿名化处理
  </div>
</template>

<style lang="scss" scoped>
.table_tool_wrap {
  width: 100%;
  height: 84px !important;
  padding: 0 8px;

  .tools_btns {
    padding: 0px 0 0;
  }
}

.table_panel_wrap {
  width: 100%;
  height: calc(100% - 84px);
  padding: 0px 8px 0;
}
</style>