2022-06-01 16:33:54 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<el-table
|
2022-06-08 15:31:41 +08:00
|
|
|
|
id="reportTable"
|
2022-06-01 16:33:54 +08:00
|
|
|
|
ref="dataTable"
|
|
|
|
|
|
:data="tableData"
|
|
|
|
|
|
:height="height"
|
2022-06-08 18:32:52 +08:00
|
|
|
|
:expand-row-keys="expandedIds"
|
|
|
|
|
|
row-key="id"
|
2022-07-05 11:43:43 +08:00
|
|
|
|
v-loading="toolsLoading"
|
2022-06-01 16:33:54 +08:00
|
|
|
|
border
|
2022-06-08 15:31:41 +08:00
|
|
|
|
tooltip-effect="light"
|
2022-06-01 16:33:54 +08:00
|
|
|
|
@header-dragend="dragend"
|
|
|
|
|
|
@sort-change="tableDataSort"
|
2022-06-06 17:37:01 +08:00
|
|
|
|
@expand-change="dropExpandChange"
|
2022-06-01 16:33:54 +08:00
|
|
|
|
@selection-change="selectionChange"
|
|
|
|
|
|
>
|
2022-06-08 15:31:41 +08:00
|
|
|
|
<el-table-column type="expand" width="30">
|
2022-06-01 16:33:54 +08:00
|
|
|
|
<template #default="props">
|
2022-06-06 17:37:01 +08:00
|
|
|
|
<div class="down">
|
|
|
|
|
|
<loading :loading="loadingDown"></loading>
|
|
|
|
|
|
<div class="block drop-down-time">
|
|
|
|
|
|
<el-date-picker
|
2022-06-09 13:52:57 +08:00
|
|
|
|
v-model="timeRange"
|
2022-06-06 17:37:01 +08:00
|
|
|
|
size="small"
|
|
|
|
|
|
:format="format"
|
2022-06-16 15:50:40 +08:00
|
|
|
|
:clearable="false"
|
2022-06-06 17:37:01 +08:00
|
|
|
|
type="datetimerange"
|
|
|
|
|
|
range-separator="To"
|
2022-06-08 15:31:41 +08:00
|
|
|
|
:start-placeholder="$t('detections.startTime')"
|
|
|
|
|
|
:end-placeholder="$t('detections.endTime')"
|
|
|
|
|
|
@change="datePickerChange(props.row)"
|
2022-06-06 17:37:01 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="expand">
|
2022-06-10 15:02:24 +08:00
|
|
|
|
<chart-no-data v-if="downDataList.length === 0 && !loadingDown"></chart-no-data>
|
2022-06-06 17:37:01 +08:00
|
|
|
|
<div class="expand-cell" v-for="(item, index) in downDataList" :key="index">
|
|
|
|
|
|
<div class="expand-right">
|
|
|
|
|
|
<div class="demo-progress">
|
2022-07-12 19:06:31 +08:00
|
|
|
|
<el-progress :stroke-width="10" type="circle" :percentage="computePercent(item)" :color="computePercent(item) === 'Failed' ? '#D8A6A6' : (computePercent(item) === 100 ? '#21bf9a' : '#50b3ef')">
|
2022-06-08 15:31:41 +08:00
|
|
|
|
<template #default="{ percentage }">
|
2022-07-12 19:06:31 +08:00
|
|
|
|
<span style="font-size: 0.875rem;" v-if="percentage !== 'Failed'">{{ percentage + '%' }}</span>
|
|
|
|
|
|
<span style="font-size: 0.875rem;color: #C14843" v-else>{{percentage}}</span>
|
2022-06-08 15:31:41 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-progress>
|
2022-06-01 16:33:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-06-06 17:37:01 +08:00
|
|
|
|
<div class="expand-left">
|
|
|
|
|
|
<div class="expand-name"><i class="cn-icon cn-icon-user"></i>{{ username }}</div>
|
|
|
|
|
|
<div class="expand-time">
|
|
|
|
|
|
<div>{{ $t('report.creationTime') }}</div>
|
|
|
|
|
|
<div>{{dateFormatByAppearance(item.ctime)}}</div>
|
2022-06-01 16:33:54 +08:00
|
|
|
|
</div>
|
2022-06-06 17:37:01 +08:00
|
|
|
|
<div class="expand-icon">
|
2022-07-12 19:06:31 +08:00
|
|
|
|
<div class="table-operation-item--no-border" :class="{'table-operation-item--disabled': computePercent(item) === 'Failed' || computePercent(item) < 100}" @click="reportOperation(['download', item])">
|
2022-06-06 17:37:01 +08:00
|
|
|
|
<loading :loading="loadingTableId === item.id"></loading>
|
|
|
|
|
|
<svg class="icon" aria-hidden="true" :class="{'table-operation-all-loading': loadingTableId}">
|
|
|
|
|
|
<use xlink:href="#cn-icon-download2"></use>
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
</div>
|
2022-07-12 19:06:31 +08:00
|
|
|
|
<div class="table-operation-item--no-border" :class="{'table-operation-item--disabled': computePercent(item) === 'Failed' || computePercent(item) < 100}" @click="reportOperation(['preview', item])">
|
2022-06-06 17:37:01 +08:00
|
|
|
|
<loading :loading="loadingPreviewId === item.id"></loading>
|
|
|
|
|
|
<svg class="icon" aria-hidden="true" :class="{'table-operation-all-loading': loadingPreviewId}">
|
|
|
|
|
|
<use xlink:href="#cn-icon-preview"></use>
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="table-operation-item--no-border" @click="downDeleteQueryChange(item, props)">
|
|
|
|
|
|
<svg class="icon" aria-hidden="true">
|
|
|
|
|
|
<use xlink:href="#cn-icon-shanchu"></use>
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
</div>
|
2022-06-01 16:33:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2022-06-06 17:37:01 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="cn-detection__footer">
|
|
|
|
|
|
<chart-detection-pagination
|
|
|
|
|
|
ref="pagination"
|
|
|
|
|
|
:page-obj="pageObj"
|
|
|
|
|
|
@pageJump="pageJump"
|
|
|
|
|
|
></chart-detection-pagination>
|
|
|
|
|
|
</div>
|
2022-06-01 16:33:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
type="selection"
|
2022-06-08 15:31:41 +08:00
|
|
|
|
width="30">
|
2022-06-01 16:33:54 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
v-for="(item, index) in customTableTitles"
|
|
|
|
|
|
:key="`col-${index}`"
|
|
|
|
|
|
:fixed="item.fixed"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:min-width="`${item.minWidth}`"
|
|
|
|
|
|
:prop="item.prop"
|
|
|
|
|
|
:resizable="true"
|
2022-06-08 15:31:41 +08:00
|
|
|
|
:show-overflow-tooltip="item.prop === 'timePlan'"
|
2022-06-01 16:33:54 +08:00
|
|
|
|
:sort-orders="['ascending', 'descending']"
|
|
|
|
|
|
:sortable="item.sortable"
|
|
|
|
|
|
:width="`${item.width}`"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<span class="data-column__span">{{item.label}}</span>
|
|
|
|
|
|
<div class="col-resize-area"></div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #default="scope" :column="item">
|
2022-06-06 17:37:01 +08:00
|
|
|
|
<span v-if="item.prop === 'timeLimit'">
|
2022-06-08 15:31:41 +08:00
|
|
|
|
{{handleTimeRange(scope.row)}}
|
2022-06-01 16:33:54 +08:00
|
|
|
|
</span>
|
2022-07-05 11:43:43 +08:00
|
|
|
|
<span v-else-if="item.prop === 'categoryId'">
|
|
|
|
|
|
<span v-for="item in categoryList">
|
|
|
|
|
|
<span v-if="scope.row.categoryId === item.id">{{item.name}}</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</span>
|
2022-06-08 15:31:41 +08:00
|
|
|
|
<span v-else-if="item.prop === 'timePlan'">
|
2022-06-18 16:06:08 +08:00
|
|
|
|
<template v-if="scope.row.config.isScheduler === 0">
|
|
|
|
|
|
{{$t('report.always')}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="scope.row.config.isScheduler === 1">
|
|
|
|
|
|
<el-popover
|
|
|
|
|
|
placement="right-start"
|
|
|
|
|
|
:width="270"
|
|
|
|
|
|
trigger="hover"
|
|
|
|
|
|
class="my-table"
|
2022-06-20 15:29:26 +08:00
|
|
|
|
@show="handleConfig(scope.row)"
|
2022-06-18 16:06:08 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #reference>
|
|
|
|
|
|
<span>
|
|
|
|
|
|
<template v-if="scope.row.config.schedulerConfig.type === 'day'">
|
|
|
|
|
|
{{$t('report.daily')}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="scope.row.config.schedulerConfig.type === 'week'">
|
|
|
|
|
|
{{$t('report.weekly')}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="scope.row.config.schedulerConfig.type === 'month'">
|
|
|
|
|
|
{{$t('report.monthly')}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="scope.row.config.schedulerConfig.type === ''">
|
|
|
|
|
|
{{$t('report.oneTime')}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
-
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
2022-06-18 17:01:06 +08:00
|
|
|
|
<el-row class="margin-l-10 margin-t-20">
|
2022-06-18 16:06:08 +08:00
|
|
|
|
<el-col :span="8" class="tooltip-column-name">{{$t("report.period")}}</el-col>
|
2022-06-20 15:29:26 +08:00
|
|
|
|
<el-col :span="16">{{configPeriod}}</el-col>
|
2022-06-18 16:06:08 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row class="margin-l-10">
|
|
|
|
|
|
<el-col :span="8" class="tooltip-column-name">{{$t("report.custom")}}</el-col>
|
2022-06-20 15:29:26 +08:00
|
|
|
|
<el-col :span="16">{{configCustom}}</el-col>
|
2022-06-18 16:06:08 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row class="margin-l-10">
|
|
|
|
|
|
<el-col :span="8" class="tooltip-column-name">{{$t("report.startTime")}}</el-col>
|
2022-07-06 15:27:18 +08:00
|
|
|
|
<el-col :span="16">{{dateFormatByAppearance(scope.row.schedulerStart) || '-'}}</el-col>
|
2022-06-18 16:06:08 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row class="margin-l-10">
|
|
|
|
|
|
<el-col :span="8" class="tooltip-column-name" >{{$t("report.endTime")}}</el-col>
|
2022-07-06 15:27:18 +08:00
|
|
|
|
<el-col :span="16">{{dateFormatByAppearance(scope.row.schedulerEnd) || '-'}}</el-col>
|
2022-06-18 16:06:08 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
-
|
|
|
|
|
|
</template>
|
2022-06-01 16:33:54 +08:00
|
|
|
|
</span>
|
2022-06-08 15:31:41 +08:00
|
|
|
|
<span v-else-if="item.prop === 'userName'">
|
|
|
|
|
|
{{(scope.row.sysUser && scope.row.sysUser.name) || '-'}}
|
|
|
|
|
|
</span>
|
2022-06-22 16:42:35 +08:00
|
|
|
|
<span v-else-if="item.prop === 'lastTime'">
|
2022-06-08 15:31:41 +08:00
|
|
|
|
{{scope.row.lastTime ? dateFormatByAppearance(scope.row.lastTime) : '-'}}
|
|
|
|
|
|
</span>
|
2022-06-09 16:01:47 +08:00
|
|
|
|
<span v-else-if="item.prop === 'total'">
|
|
|
|
|
|
{{scope.row[item.prop] || 0}}
|
|
|
|
|
|
</span>
|
2022-06-08 15:31:41 +08:00
|
|
|
|
<span v-else>{{scope.row[item.prop] || '-'}}</span>
|
2022-06-01 16:33:54 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
:resizable="false"
|
|
|
|
|
|
:width="operationWidth"
|
|
|
|
|
|
fixed="right">
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<div class="table-operation-title">{{$t('overall.option')}}</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #default="scope">
|
2022-06-06 17:37:01 +08:00
|
|
|
|
<div class="table-operation-items">
|
2022-06-01 16:33:54 +08:00
|
|
|
|
<button class="table-operation-item" @click="tableOperation(['edit', scope.row])"><i class="cn-icon cn-icon-bianji"></i></button>
|
|
|
|
|
|
<button class="table-operation-item" @click="tableOperation(['delete', scope.row])"><i class="cn-icon cn-icon-shanchu"></i></button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<div class="table-operation-all">
|
|
|
|
|
|
<el-checkbox v-model="checkboxAll" @change="selectAll(tableData)"></el-checkbox>
|
|
|
|
|
|
<div class="table-operation-all-span">
|
|
|
|
|
|
<span>{{ $t('overall.all') }}</span>
|
2022-06-29 14:41:31 +08:00
|
|
|
|
<div class="table-operation-back-down" :class="{'table-operation-all-checkbox': batchDow, 'table-operation-all-loading': loading}" @click="checkboxIds.id ? tableOperation(['delete', checkboxIds]) : ''">
|
2022-06-01 16:33:54 +08:00
|
|
|
|
<loading :loading="loading"></loading>
|
|
|
|
|
|
<span>{{$t('report.batchDeletion')}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import table from '@/mixins/table'
|
|
|
|
|
|
import Loading from '@/components/common/Loading'
|
2022-06-06 17:37:01 +08:00
|
|
|
|
import { del, get } from '@/utils/http'
|
|
|
|
|
|
import { api } from '@/utils/api'
|
2022-06-18 16:06:08 +08:00
|
|
|
|
import { storageKey, report } from '@/utils/constants'
|
2022-06-06 17:37:01 +08:00
|
|
|
|
import { ref } from 'vue'
|
2022-06-09 19:31:35 +08:00
|
|
|
|
import { dateFormatToUTC, getNowTime } from '@/utils/date-util'
|
2022-06-06 17:37:01 +08:00
|
|
|
|
import chartDetectionPagination from '@/views/charts/charts/chartDetectionPagination'
|
2022-06-09 19:31:35 +08:00
|
|
|
|
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
2022-06-01 16:33:54 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'builtinReportTable',
|
|
|
|
|
|
mixins: [table],
|
|
|
|
|
|
components: {
|
2022-06-09 19:31:35 +08:00
|
|
|
|
ChartNoData,
|
2022-06-06 17:37:01 +08:00
|
|
|
|
Loading,
|
|
|
|
|
|
chartDetectionPagination
|
2022-06-01 16:33:54 +08:00
|
|
|
|
},
|
2022-07-05 11:43:43 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
categoryList: Array,
|
|
|
|
|
|
toolsLoading: Boolean
|
|
|
|
|
|
},
|
2022-06-06 17:37:01 +08:00
|
|
|
|
inject: ['reload'],
|
2022-06-01 16:33:54 +08:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2022-06-06 17:37:01 +08:00
|
|
|
|
format: localStorage.getItem(storageKey.dateFormat),
|
|
|
|
|
|
username: localStorage.getItem(storageKey.username),
|
2022-06-01 16:33:54 +08:00
|
|
|
|
tableTitle: [ // 原始table列
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'ID',
|
|
|
|
|
|
prop: 'id',
|
2022-06-06 17:37:01 +08:00
|
|
|
|
show: true,
|
2022-07-05 11:43:43 +08:00
|
|
|
|
width: 50
|
2022-06-01 16:33:54 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('config.user.name'),
|
|
|
|
|
|
prop: 'name',
|
|
|
|
|
|
show: true,
|
2022-06-08 15:31:41 +08:00
|
|
|
|
minWidth: 200,
|
2022-06-01 16:33:54 +08:00
|
|
|
|
sortable: 'custom'
|
|
|
|
|
|
}, {
|
2022-07-05 16:16:31 +08:00
|
|
|
|
label: this.$t('report.categoryType'),
|
|
|
|
|
|
prop: 'categoryId',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
minWidth: 180
|
|
|
|
|
|
}, {
|
2022-06-01 16:33:54 +08:00
|
|
|
|
label: this.$t('report.timeLimit'),
|
|
|
|
|
|
prop: 'timeLimit',
|
2022-06-08 15:31:41 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
minWidth: 110
|
2022-06-01 16:33:54 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('report.timePlan'),
|
2022-06-08 15:31:41 +08:00
|
|
|
|
prop: 'timePlan',
|
2022-06-01 16:33:54 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
minWidth: 110
|
|
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('report.operationUserName'),
|
2022-06-06 17:37:01 +08:00
|
|
|
|
prop: 'userName',
|
|
|
|
|
|
show: true,
|
2022-06-08 15:31:41 +08:00
|
|
|
|
minWidth: 70
|
2022-06-01 16:33:54 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: this.$t('report.resultCount'),
|
2022-06-08 15:31:41 +08:00
|
|
|
|
prop: 'total',
|
2022-06-01 16:33:54 +08:00
|
|
|
|
show: true,
|
2022-06-08 15:31:41 +08:00
|
|
|
|
minWidth: 50
|
2022-06-08 18:32:52 +08:00
|
|
|
|
}, {
|
2022-06-01 16:33:54 +08:00
|
|
|
|
label: this.$t('report.lastExecutionTime'),
|
2022-06-08 15:31:41 +08:00
|
|
|
|
prop: 'lastTime',
|
2022-06-01 16:33:54 +08:00
|
|
|
|
show: true,
|
2022-06-08 15:31:41 +08:00
|
|
|
|
width: 170,
|
2022-06-01 16:33:54 +08:00
|
|
|
|
sortable: 'custom'
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
checkboxAll: false,
|
2022-06-16 16:02:17 +08:00
|
|
|
|
checkboxIds: {},
|
2022-06-01 16:33:54 +08:00
|
|
|
|
batchDow: false,
|
|
|
|
|
|
builtinId: '',
|
|
|
|
|
|
indeterminate: false,
|
|
|
|
|
|
loading: false,
|
2022-06-06 17:37:01 +08:00
|
|
|
|
loadingDown: false,
|
2022-06-01 16:33:54 +08:00
|
|
|
|
loadingTableId: '',
|
|
|
|
|
|
loadingPreviewId: '',
|
2022-06-06 17:37:01 +08:00
|
|
|
|
downDataList: [],
|
|
|
|
|
|
pageObj: {
|
|
|
|
|
|
pageNo: 1,
|
2022-06-08 15:31:41 +08:00
|
|
|
|
pageSize: 20,
|
2022-06-06 17:37:01 +08:00
|
|
|
|
total: 0,
|
|
|
|
|
|
resetPageNo: true
|
2022-06-08 15:31:41 +08:00
|
|
|
|
},
|
2022-06-16 15:50:40 +08:00
|
|
|
|
expandedIds: [],
|
2022-06-18 16:06:08 +08:00
|
|
|
|
interval: null,
|
|
|
|
|
|
typeMappings: [
|
|
|
|
|
|
{ key: 'day', value: this.$t('report.daily') },
|
|
|
|
|
|
{ key: 'week', value: this.$t('report.weekly') },
|
|
|
|
|
|
{ key: 'month', value: this.$t('report.monthly') },
|
|
|
|
|
|
{ key: '', value: this.$t('report.oneTime') }
|
|
|
|
|
|
],
|
|
|
|
|
|
typeUnitMappings: [
|
2022-06-18 16:37:16 +08:00
|
|
|
|
{ key: 'day', value: this.$t('report.days') },
|
2022-06-18 16:06:08 +08:00
|
|
|
|
{ key: 'week', value: this.$t('report.week') },
|
2022-06-18 16:37:16 +08:00
|
|
|
|
{ key: 'month', value: this.$t('report.months') }
|
2022-06-18 16:06:08 +08:00
|
|
|
|
],
|
|
|
|
|
|
scheduleTypeList: report.scheduleTypeList,
|
|
|
|
|
|
weekdayList: report.weekdayList,
|
|
|
|
|
|
monthList: report.monthList,
|
2022-06-20 15:29:26 +08:00
|
|
|
|
weekOptions: report.weekOptions,
|
|
|
|
|
|
configPeriod: '',
|
|
|
|
|
|
configCustom: ''
|
2022-06-08 15:31:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
handleTimeRange () {
|
|
|
|
|
|
return function (row) {
|
|
|
|
|
|
let str = ''
|
|
|
|
|
|
if (row.config && row.config.timeConfig && row.config.timeConfig.type) {
|
|
|
|
|
|
str += row.config.timeConfig.type
|
2022-06-09 13:52:57 +08:00
|
|
|
|
if (['today', 'yesterday', 'this', 'customize'].indexOf(row.config.timeConfig.type) === -1 && row.config.timeConfig.offset) {
|
2022-06-08 15:31:41 +08:00
|
|
|
|
str += ` ${row.config.timeConfig.offset} ${row.config.timeConfig.unit}`
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return str
|
2022-06-06 17:37:01 +08:00
|
|
|
|
}
|
2022-06-09 14:04:15 +08:00
|
|
|
|
},
|
|
|
|
|
|
computePercent () {
|
|
|
|
|
|
return function (item) {
|
2022-07-12 19:06:31 +08:00
|
|
|
|
if (item.state === 2) {
|
|
|
|
|
|
return 'Failed'
|
|
|
|
|
|
}
|
2022-06-09 14:04:15 +08:00
|
|
|
|
if (item.percent === 1) {
|
2022-07-12 19:06:31 +08:00
|
|
|
|
if (localStorage.getItem(storageKey.s3Enable) == 1) {
|
|
|
|
|
|
if (item.state === 1 && item.upload === 1) {
|
|
|
|
|
|
return 100
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return 99.99
|
|
|
|
|
|
}
|
2022-06-09 14:04:15 +08:00
|
|
|
|
} else {
|
2022-07-12 19:06:31 +08:00
|
|
|
|
if (item.state === 1) {
|
|
|
|
|
|
return 100
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return 99.99
|
|
|
|
|
|
}
|
2022-06-09 14:04:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return parseFloat(item.percent * 100).toFixed(2)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-01 16:33:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getJobStatus (report) {
|
|
|
|
|
|
if (report.state === 1 && report.upload === 1) {
|
|
|
|
|
|
return this.$t('overall.completed')
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return this.$t('overall.inProgress')
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-06-09 13:52:57 +08:00
|
|
|
|
reportOperation (arr) {
|
|
|
|
|
|
if (arr[1].percent === 1) {
|
|
|
|
|
|
this.tableOperation(arr)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-06-01 16:33:54 +08:00
|
|
|
|
selectionChange (objs) {
|
|
|
|
|
|
this.$emit('selectionChange', objs)
|
2022-06-16 16:02:17 +08:00
|
|
|
|
this.checkboxIds.id = objs.map(item => { return item.id }).join(',')
|
2022-06-01 16:33:54 +08:00
|
|
|
|
this.checkboxAll = objs.length > 0 || objs.length === this.tableData.length
|
|
|
|
|
|
this.batchDow = objs.length > 0
|
|
|
|
|
|
},
|
|
|
|
|
|
selectAll (objs) {
|
|
|
|
|
|
if (objs) {
|
|
|
|
|
|
objs.forEach(item => {
|
|
|
|
|
|
this.$refs.dataTable.toggleAllSelection(item)
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$refs.dataTable.clearSelection()
|
|
|
|
|
|
}
|
2022-06-06 17:37:01 +08:00
|
|
|
|
},
|
2022-06-08 15:31:41 +08:00
|
|
|
|
dropExpandChange (row, expandedRows) {
|
|
|
|
|
|
this.expandedIds = []
|
2022-06-22 10:53:09 +08:00
|
|
|
|
clearInterval(this.interval)
|
2022-06-08 15:31:41 +08:00
|
|
|
|
if (expandedRows.length > 0 && row) {
|
|
|
|
|
|
this.expandedIds.push(row.id)
|
|
|
|
|
|
this.datePickerChange(row)
|
2022-06-06 17:37:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-06-08 15:31:41 +08:00
|
|
|
|
datePickerChange (row) {
|
2022-06-16 15:50:40 +08:00
|
|
|
|
this.pageObj.pageNo = 1
|
2022-06-08 15:31:41 +08:00
|
|
|
|
const param = {
|
|
|
|
|
|
tempId: row.id,
|
2022-06-09 13:52:57 +08:00
|
|
|
|
startTime: dateFormatToUTC(this.timeRange[0]),
|
|
|
|
|
|
endTime: dateFormatToUTC(this.timeRange[1]),
|
2022-06-08 15:31:41 +08:00
|
|
|
|
...this.pageObj
|
2022-06-06 17:37:01 +08:00
|
|
|
|
}
|
2022-06-08 15:31:41 +08:00
|
|
|
|
this.dropDownQueryChange(param)
|
2022-06-06 17:37:01 +08:00
|
|
|
|
},
|
2022-06-08 15:31:41 +08:00
|
|
|
|
dropDownQueryChange (param) {
|
2022-06-06 17:37:01 +08:00
|
|
|
|
this.loadingDown = true
|
2022-06-08 15:31:41 +08:00
|
|
|
|
this.downDataList = []
|
|
|
|
|
|
get(api.reportJob, param).then(res => {
|
2022-06-06 17:37:01 +08:00
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
this.downDataList = res.data.list
|
2022-06-08 15:31:41 +08:00
|
|
|
|
this.pageObj.total = res.data.total
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.$refs.dataTable.doLayout()
|
|
|
|
|
|
})
|
2022-06-06 17:37:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.loadingDown = false
|
2022-07-05 11:43:43 +08:00
|
|
|
|
const showInterval = this.downDataList.find(item => item.percent !== 1 && item.state !== 2)
|
2022-06-16 15:50:40 +08:00
|
|
|
|
if (this.downDataList && showInterval) {
|
|
|
|
|
|
this.intervalChange(param)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
dataConversionProcessing (param) {
|
|
|
|
|
|
get(api.reportJob, param).then(res => {
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
this.downDataList = res.data.list
|
|
|
|
|
|
this.pageObj.total = res.data.total
|
|
|
|
|
|
}
|
2022-06-06 17:37:01 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
downDeleteQueryChange (row, props) {
|
|
|
|
|
|
this.$confirm(this.$t('tip.confirmDelete'), {
|
|
|
|
|
|
confirmButtonText: this.$t('tip.yes'),
|
|
|
|
|
|
cancelButtonText: this.$t('tip.no'),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
del(api.reportJob + '?ids=' + row.id).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.delFlag = true
|
|
|
|
|
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
|
|
|
|
|
|
this.dropDownQueryChange({ tempId: props.row.id })
|
2022-06-09 16:01:47 +08:00
|
|
|
|
this.$emit('reload')
|
2022-06-06 17:37:01 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
pageJump (val) {
|
2022-06-08 18:32:52 +08:00
|
|
|
|
this.pageObj.pageNo = val
|
|
|
|
|
|
if (this.expandedIds.length > 0) {
|
|
|
|
|
|
this.datePickerChange({ id: this.expandedIds[0] })
|
|
|
|
|
|
}
|
2022-06-16 15:50:40 +08:00
|
|
|
|
},
|
|
|
|
|
|
intervalChange (param) {
|
2022-06-18 16:06:08 +08:00
|
|
|
|
clearInterval(this.interval)
|
2022-06-16 15:50:40 +08:00
|
|
|
|
this.interval = setInterval(() => {
|
|
|
|
|
|
this.dataConversionProcessing(param)
|
|
|
|
|
|
}, 10000)
|
2022-06-18 16:06:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
handleConfigArray (array, list) {
|
|
|
|
|
|
const group = []
|
|
|
|
|
|
array.forEach(item => {
|
|
|
|
|
|
const matchItem = list.find(m => m.value === item)
|
|
|
|
|
|
if (matchItem) {
|
|
|
|
|
|
group.push(this.$t(matchItem.name))
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
return group.toString()
|
2022-06-20 15:29:26 +08:00
|
|
|
|
},
|
|
|
|
|
|
handleConfig (row) {
|
|
|
|
|
|
this.handleConfigPeriod(row)
|
|
|
|
|
|
this.handleConfigCustom(row)
|
|
|
|
|
|
},
|
|
|
|
|
|
handleConfigPeriod (row) {
|
|
|
|
|
|
let str = ''
|
|
|
|
|
|
if (row.config && row.config.schedulerConfig) {
|
|
|
|
|
|
const type = row.config.schedulerConfig.type
|
|
|
|
|
|
if (type === '') {
|
|
|
|
|
|
str = this.$t('report.oneTime')
|
|
|
|
|
|
} else { // isRepeat=1 每天,每周,每月
|
|
|
|
|
|
const period = this.typeMappings.find(m => m.key === type)
|
|
|
|
|
|
const interval = row.config.schedulerConfig.interval
|
|
|
|
|
|
const months = row.config.schedulerConfig.months
|
|
|
|
|
|
if (interval > 1) {
|
|
|
|
|
|
const unit = this.typeUnitMappings.find(m => m.key === type)
|
|
|
|
|
|
if (unit) {
|
|
|
|
|
|
str = this.$t('report.every') + ' ' + interval + ' ' + unit.value
|
|
|
|
|
|
} else {
|
|
|
|
|
|
str = '-'
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (interval === 1) {
|
|
|
|
|
|
if (type === this.scheduleTypeList[2].value) { // 月
|
|
|
|
|
|
if (this.$_.isEmpty(months)) { // 空代表循环
|
|
|
|
|
|
str = period.value
|
|
|
|
|
|
} else { // 非空代表不循环
|
|
|
|
|
|
str = this.handleConfigArray(months, this.monthList)// X月,Y月
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (period) {
|
|
|
|
|
|
str = period.value
|
|
|
|
|
|
} else {
|
|
|
|
|
|
str = '-'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.configPeriod = str
|
|
|
|
|
|
},
|
|
|
|
|
|
handleConfigCustom (row) {
|
|
|
|
|
|
let str = ''
|
|
|
|
|
|
if (row.config && row.config.schedulerConfig) {
|
|
|
|
|
|
const type = row.config.schedulerConfig.type
|
|
|
|
|
|
if (type === '') { // 单次
|
|
|
|
|
|
str = '-'
|
|
|
|
|
|
} else { // 每日,每周,每月
|
|
|
|
|
|
const period = this.typeMappings.find(m => m.key === type)
|
|
|
|
|
|
if (type === this.scheduleTypeList[0].value) { // 日
|
|
|
|
|
|
str = '-'
|
|
|
|
|
|
} else if (type === this.scheduleTypeList[1].value) { // 周
|
|
|
|
|
|
const weekDates = row.config.schedulerConfig.weekDates
|
|
|
|
|
|
str = this.handleConfigArray(weekDates, this.weekdayList)
|
|
|
|
|
|
} else if (type === this.scheduleTypeList[2].value) { // 月
|
|
|
|
|
|
const monthDates = row.config.schedulerConfig.monthDates// 日期
|
|
|
|
|
|
const monthWeekDates = row.config.schedulerConfig.monthWeekDates// 哪几周
|
|
|
|
|
|
const weekDates = row.config.schedulerConfig.weekDates// 周几
|
|
|
|
|
|
if (!this.$_.isEmpty(monthDates)) {
|
|
|
|
|
|
str = this.$t('report.date') + '-' + monthDates
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (!this.$_.isEmpty(monthWeekDates)) {
|
|
|
|
|
|
str += this.$t('report.week') + '-' + this.handleConfigArray(monthWeekDates, this.weekOptions)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!this.$_.isEmpty(weekDates)) {
|
|
|
|
|
|
str += ' ' + this.handleConfigArray(weekDates, this.weekdayList)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
str = '-'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.configCustom = str
|
2022-06-06 17:37:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-06-16 15:50:40 +08:00
|
|
|
|
beforeUnmount () {
|
|
|
|
|
|
clearInterval(this.interval)
|
|
|
|
|
|
},
|
2022-06-06 17:37:01 +08:00
|
|
|
|
setup () {
|
2022-06-09 13:52:57 +08:00
|
|
|
|
const { startTime, endTime } = getNowTime(60 * 24 * 30)
|
|
|
|
|
|
const timeRange = ref([startTime, endTime])
|
2022-06-06 17:37:01 +08:00
|
|
|
|
return {
|
2022-06-09 13:52:57 +08:00
|
|
|
|
timeRange
|
2022-06-01 16:33:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|