songjianet
3 years ago
committed by
GitHub
11 changed files with 650 additions and 7 deletions
@ -0,0 +1,42 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
import type { Component } from 'vue' |
||||||
|
import utils from '@/utils' |
||||||
|
|
||||||
|
// All TSX files under the views folder automatically generate mapping relationship
|
||||||
|
const modules = import.meta.glob('/src/views/**/**.tsx') |
||||||
|
const components: { [key: string]: Component } = utils.mapping(modules) |
||||||
|
|
||||||
|
export default { |
||||||
|
path: '/data-quality', |
||||||
|
name: 'data-quality', |
||||||
|
meta: { title: 'data-quality' }, |
||||||
|
redirect: { name: 'task-result' }, |
||||||
|
component: () => import('@/layouts/content'), |
||||||
|
children: [ |
||||||
|
{ |
||||||
|
path: '/data-quality/task-result', |
||||||
|
name: 'task-result', |
||||||
|
component: components['data-quality-task-result'], |
||||||
|
meta: { |
||||||
|
title: '数据质量-task-result', |
||||||
|
showSide: true |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
import { axios } from '@/service/service' |
||||||
|
import type { RuleListReq, ResultListReq } from './types' |
||||||
|
|
||||||
|
export function queryRuleListPaging(params: RuleListReq): any { |
||||||
|
return axios({ |
||||||
|
url: '/data-quality/rule/page', |
||||||
|
method: 'get', |
||||||
|
params |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export function queryExecuteResultListPaging(params: ResultListReq): any { |
||||||
|
return axios({ |
||||||
|
url: '/data-quality/result/page', |
||||||
|
method: 'get', |
||||||
|
params |
||||||
|
}) |
||||||
|
} |
@ -0,0 +1,74 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
interface ListReq { |
||||||
|
pageNo: number |
||||||
|
pageSize: number |
||||||
|
searchVal?: string |
||||||
|
} |
||||||
|
|
||||||
|
interface RuleListReq extends ListReq { |
||||||
|
endDate?: string |
||||||
|
startDate?: string |
||||||
|
ruleType?: string |
||||||
|
} |
||||||
|
|
||||||
|
interface ResultListReq extends ListReq { |
||||||
|
endDate?: string |
||||||
|
startDate?: string |
||||||
|
ruleType?: string |
||||||
|
state?: string |
||||||
|
} |
||||||
|
|
||||||
|
interface ResultItem { |
||||||
|
id: number |
||||||
|
processDefinitionId: number |
||||||
|
processDefinitionName: string |
||||||
|
processDefinitionCode: number |
||||||
|
processInstanceId: number |
||||||
|
processInstanceName: string |
||||||
|
projectCode: number |
||||||
|
taskInstanceId: number |
||||||
|
taskName: string |
||||||
|
ruleType: number |
||||||
|
ruleName: string |
||||||
|
statisticsValue: number |
||||||
|
comparisonValue: number |
||||||
|
comparisonType: number |
||||||
|
comparisonTypeName: string |
||||||
|
checkType: number |
||||||
|
threshold: number |
||||||
|
operator: number |
||||||
|
failureStrategy: number |
||||||
|
userId: number |
||||||
|
userName: string |
||||||
|
state: number |
||||||
|
errorOutputPath: string |
||||||
|
createTime: string |
||||||
|
updateTime: string |
||||||
|
} |
||||||
|
|
||||||
|
interface ResultListRes { |
||||||
|
totalList: ResultItem[] |
||||||
|
total: number |
||||||
|
totalPage: number |
||||||
|
pageSize: number |
||||||
|
currentPage: number |
||||||
|
start: number |
||||||
|
} |
||||||
|
|
||||||
|
export { RuleListReq, ResultListReq, ResultItem, ResultListRes } |
@ -0,0 +1,26 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
.table-card { |
||||||
|
margin-top: 8px; |
||||||
|
|
||||||
|
.pagination { |
||||||
|
margin-top: 20px; |
||||||
|
display: flex; |
||||||
|
justify-content: center; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,177 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
import { defineComponent, onMounted, toRefs, watch } from 'vue' |
||||||
|
import { |
||||||
|
NSpace, |
||||||
|
NInput, |
||||||
|
NSelect, |
||||||
|
NDatePicker, |
||||||
|
NButton, |
||||||
|
NIcon, |
||||||
|
NDataTable, |
||||||
|
NPagination, |
||||||
|
NCard |
||||||
|
} from 'naive-ui' |
||||||
|
import { SearchOutlined } from '@vicons/antd' |
||||||
|
import { useTable } from './use-table' |
||||||
|
import { useI18n } from 'vue-i18n' |
||||||
|
import Card from '@/components/card' |
||||||
|
import styles from './index.module.scss' |
||||||
|
|
||||||
|
const TaskResult = defineComponent({ |
||||||
|
name: 'task-result', |
||||||
|
setup() { |
||||||
|
const { t, variables, getTableData, createColumns } = useTable() |
||||||
|
|
||||||
|
const requestTableData = () => { |
||||||
|
getTableData({ |
||||||
|
pageSize: variables.pageSize, |
||||||
|
pageNo: variables.page, |
||||||
|
ruleType: variables.ruleType, |
||||||
|
state: variables.state, |
||||||
|
searchVal: variables.searchVal, |
||||||
|
datePickerRange: variables.datePickerRange |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
const onUpdatePageSize = () => { |
||||||
|
variables.page = 1 |
||||||
|
requestTableData() |
||||||
|
} |
||||||
|
|
||||||
|
const onSearch = () => { |
||||||
|
variables.page = 1 |
||||||
|
requestTableData() |
||||||
|
} |
||||||
|
|
||||||
|
onMounted(() => { |
||||||
|
createColumns(variables) |
||||||
|
requestTableData() |
||||||
|
}) |
||||||
|
|
||||||
|
watch(useI18n().locale, () => { |
||||||
|
createColumns(variables) |
||||||
|
}) |
||||||
|
|
||||||
|
return { |
||||||
|
t, |
||||||
|
...toRefs(variables), |
||||||
|
requestTableData, |
||||||
|
onUpdatePageSize, |
||||||
|
onSearch |
||||||
|
} |
||||||
|
}, |
||||||
|
render() { |
||||||
|
const { t, requestTableData, onUpdatePageSize, onSearch } = this |
||||||
|
|
||||||
|
return ( |
||||||
|
<> |
||||||
|
<NCard> |
||||||
|
<NSpace justify='end'> |
||||||
|
<NInput |
||||||
|
v-model={[this.searchVal, 'value']} |
||||||
|
size='small' |
||||||
|
placeholder={t('data_quality.task_result.task_name')} |
||||||
|
clearable |
||||||
|
/> |
||||||
|
<NSelect |
||||||
|
v-model={[this.ruleType, 'value']} |
||||||
|
size='small' |
||||||
|
options={[ |
||||||
|
{ |
||||||
|
value: 0, |
||||||
|
label: t('data_quality.task_result.single_table') |
||||||
|
}, |
||||||
|
{ |
||||||
|
value: 1, |
||||||
|
label: t('data_quality.task_result.single_table_custom_sql') |
||||||
|
}, |
||||||
|
{ |
||||||
|
value: 2, |
||||||
|
label: t('data_quality.task_result.multi_table_accuracy') |
||||||
|
}, |
||||||
|
{ |
||||||
|
value: 3, |
||||||
|
label: t('data_quality.task_result.multi_table_comparison') |
||||||
|
} |
||||||
|
]} |
||||||
|
placeholder={t('data_quality.task_result.rule_type')} |
||||||
|
style={{ width: '180px' }} |
||||||
|
clearable |
||||||
|
/> |
||||||
|
<NSelect |
||||||
|
v-model={[this.state, 'value']} |
||||||
|
size='small' |
||||||
|
options={[ |
||||||
|
{ |
||||||
|
value: 0, |
||||||
|
label: t('data_quality.task_result.undone') |
||||||
|
}, |
||||||
|
{ |
||||||
|
value: 1, |
||||||
|
label: t('data_quality.task_result.success') |
||||||
|
}, |
||||||
|
{ |
||||||
|
value: 2, |
||||||
|
label: t('data_quality.task_result.failure') |
||||||
|
} |
||||||
|
]} |
||||||
|
placeholder={t('data_quality.task_result.state')} |
||||||
|
style={{ width: '180px' }} |
||||||
|
clearable |
||||||
|
/> |
||||||
|
<NDatePicker |
||||||
|
v-model={[this.datePickerRange, 'value']} |
||||||
|
type='datetimerange' |
||||||
|
size='small' |
||||||
|
start-placeholder={t('monitor.audit_log.start_time')} |
||||||
|
end-placeholder={t('monitor.audit_log.end_time')} |
||||||
|
clearable |
||||||
|
/> |
||||||
|
<NButton size='small' type='primary' onClick={onSearch}> |
||||||
|
{{ |
||||||
|
icon: () => ( |
||||||
|
<NIcon> |
||||||
|
<SearchOutlined /> |
||||||
|
</NIcon> |
||||||
|
) |
||||||
|
}} |
||||||
|
</NButton> |
||||||
|
</NSpace> |
||||||
|
</NCard> |
||||||
|
<Card class={styles['table-card']}> |
||||||
|
<NDataTable columns={this.columns} data={this.tableData} /> |
||||||
|
<div class={styles.pagination}> |
||||||
|
<NPagination |
||||||
|
v-model:page={this.page} |
||||||
|
v-model:page-size={this.pageSize} |
||||||
|
page-count={this.totalPage} |
||||||
|
show-size-picker |
||||||
|
page-sizes={[10, 30, 50]} |
||||||
|
show-quick-jumper |
||||||
|
onUpdatePage={requestTableData} |
||||||
|
onUpdatePageSize={onUpdatePageSize} |
||||||
|
/> |
||||||
|
</div> |
||||||
|
</Card> |
||||||
|
</> |
||||||
|
) |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
export default TaskResult |
@ -0,0 +1,201 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
import { useI18n } from 'vue-i18n' |
||||||
|
import { reactive, ref } from 'vue' |
||||||
|
import { useAsyncState } from '@vueuse/core' |
||||||
|
import { queryExecuteResultListPaging } from '@/service/modules/data-quality' |
||||||
|
import { format } from 'date-fns' |
||||||
|
import type { |
||||||
|
ResultItem, |
||||||
|
ResultListRes |
||||||
|
} from '@/service/modules/data-quality/types' |
||||||
|
|
||||||
|
export function useTable() { |
||||||
|
const { t } = useI18n() |
||||||
|
|
||||||
|
const variables = reactive({ |
||||||
|
columns: [], |
||||||
|
tableData: [], |
||||||
|
page: ref(1), |
||||||
|
pageSize: ref(10), |
||||||
|
ruleType: ref(null), |
||||||
|
state: ref(null), |
||||||
|
searchVal: ref(null), |
||||||
|
datePickerRange: ref(null), |
||||||
|
totalPage: ref(1) |
||||||
|
}) |
||||||
|
|
||||||
|
const createColumns = (variables: any) => { |
||||||
|
variables.columns = [ |
||||||
|
{ |
||||||
|
title: '#', |
||||||
|
key: 'index' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.task_name'), |
||||||
|
key: 'userName' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.workflow_instance'), |
||||||
|
key: 'processInstanceName' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.rule_type'), |
||||||
|
key: 'ruleType', |
||||||
|
render: (row: ResultItem) => { |
||||||
|
if (row.ruleType === 0) { |
||||||
|
return t('data_quality.task_result.single_table') |
||||||
|
} else if (row.ruleType === 1) { |
||||||
|
return t('data_quality.task_result.single_table_custom_sql') |
||||||
|
} else if (row.ruleType === 2) { |
||||||
|
return t('data_quality.task_result.multi_table_accuracy') |
||||||
|
} else if (row.ruleType === 3) { |
||||||
|
return t('data_quality.task_result.multi_table_comparison') |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.rule_name'), |
||||||
|
key: 'ruleName' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.state'), |
||||||
|
key: 'state', |
||||||
|
render: (row: ResultItem) => { |
||||||
|
if (row.state === 0) { |
||||||
|
return t('data_quality.task_result.undone') |
||||||
|
} else if (row.state === 1) { |
||||||
|
return t('data_quality.task_result.success') |
||||||
|
} else if (row.state === 2) { |
||||||
|
return t('data_quality.task_result.failure') |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.actual_value'), |
||||||
|
key: 'statisticsValue' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.excepted_value'), |
||||||
|
key: 'comparisonValue' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.check_type'), |
||||||
|
key: 'checkType', |
||||||
|
render: (row: ResultItem) => { |
||||||
|
if (row.checkType === 0) { |
||||||
|
return t('data_quality.task_result.expected_and_actual') |
||||||
|
} else if (row.checkType === 1) { |
||||||
|
return t('data_quality.task_result.actual_and_expected') |
||||||
|
} else if (row.checkType === 2) { |
||||||
|
return t('data_quality.task_result.actual_or_expected') |
||||||
|
} else if (row.checkType === 3) { |
||||||
|
return t('data_quality.task_result.expected_and_actual_or_expected') |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.operator'), |
||||||
|
key: 'operator', |
||||||
|
render: (row: ResultItem) => { |
||||||
|
if (row.operator === 0) { |
||||||
|
return '=' |
||||||
|
} else if (row.operator === 1) { |
||||||
|
return '<' |
||||||
|
} else if (row.operator === 2) { |
||||||
|
return '<=' |
||||||
|
} else if (row.operator === 3) { |
||||||
|
return '>' |
||||||
|
} else if (row.operator === 4) { |
||||||
|
return '>=' |
||||||
|
} else if (row.operator === 5) { |
||||||
|
return '!=' |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.threshold'), |
||||||
|
key: 'threshold' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.failure_strategy'), |
||||||
|
key: 'failureStrategy' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.excepted_value_type'), |
||||||
|
key: 'comparisonTypeName' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.error_output_path'), |
||||||
|
key: 'errorOutputPath', |
||||||
|
render: (row: ResultItem) => { |
||||||
|
return row.errorOutputPath ? row : '-' |
||||||
|
} |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.username'), |
||||||
|
key: 'userName' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.create_time'), |
||||||
|
key: 'createTime' |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: t('data_quality.task_result.update_time'), |
||||||
|
key: 'updateTime' |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
|
|
||||||
|
const getTableData = (params: any) => { |
||||||
|
const data = { |
||||||
|
pageSize: params.pageSize, |
||||||
|
pageNo: params.pageNo, |
||||||
|
ruleType: params.ruleType, |
||||||
|
state: params.state, |
||||||
|
searchVal: params.searchVal, |
||||||
|
startDate: params.datePickerRange |
||||||
|
? format(new Date(params.datePickerRange[0]), 'yyyy-MM-dd HH:mm:ss') |
||||||
|
: '', |
||||||
|
endDate: params.datePickerRange |
||||||
|
? format(new Date(params.datePickerRange[1]), 'yyyy-MM-dd HH:mm:ss') |
||||||
|
: '' |
||||||
|
} |
||||||
|
|
||||||
|
const { state } = useAsyncState( |
||||||
|
queryExecuteResultListPaging(data).then((res: ResultListRes) => { |
||||||
|
variables.tableData = res.totalList.map((item, index) => { |
||||||
|
return { |
||||||
|
index: index + 1, |
||||||
|
...item |
||||||
|
} |
||||||
|
}) as any |
||||||
|
}), |
||||||
|
{} |
||||||
|
) |
||||||
|
|
||||||
|
return state |
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
t, |
||||||
|
variables, |
||||||
|
getTableData, |
||||||
|
createColumns |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue