songjianet
3 years ago
committed by
GitHub
13 changed files with 327 additions and 132 deletions
@ -0,0 +1,58 @@
|
||||
/* |
||||
* 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, PropType } from 'vue' |
||||
import { useProcessDefinition } from './use-process-definition' |
||||
import BarChart from '@/components/chart/modules/Bar' |
||||
import Card from '@/components/card' |
||||
|
||||
const props = { |
||||
title: { |
||||
type: String as PropType<string>, |
||||
}, |
||||
} |
||||
|
||||
const DefinitionCard = defineComponent({ |
||||
name: 'DefinitionCard', |
||||
props, |
||||
setup() { |
||||
const { getProcessDefinition } = useProcessDefinition() |
||||
const processDefinition = getProcessDefinition() |
||||
|
||||
return { processDefinition } |
||||
}, |
||||
render() { |
||||
const { title, processDefinition } = this |
||||
|
||||
return ( |
||||
<Card title={title}> |
||||
{{ |
||||
default: () => |
||||
processDefinition.xAxisData.length > 0 && |
||||
processDefinition.seriesData.length > 0 && ( |
||||
<BarChart |
||||
xAxisData={processDefinition.xAxisData} |
||||
seriesData={processDefinition.seriesData} |
||||
/> |
||||
), |
||||
}} |
||||
</Card> |
||||
) |
||||
}, |
||||
}) |
||||
|
||||
export default DefinitionCard |
@ -0,0 +1,83 @@
|
||||
/* |
||||
* 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, PropType } from 'vue' |
||||
import { useTable } from './use-table' |
||||
import styles from '@/views/home/index.module.scss' |
||||
import PieChart from '@/components/chart/modules/Pie' |
||||
import { NDataTable, NDatePicker } from 'naive-ui' |
||||
import Card from '@/components/card' |
||||
|
||||
const props = { |
||||
title: { |
||||
type: String as PropType<string>, |
||||
}, |
||||
date: { |
||||
type: Array as PropType<Array<any>>, |
||||
}, |
||||
tableData: { |
||||
type: [Array, Boolean] as PropType<Array<any> | false>, |
||||
}, |
||||
} |
||||
|
||||
const StateCard = defineComponent({ |
||||
name: 'StateCard', |
||||
props, |
||||
emits: ['updateDatePickerValue'], |
||||
setup(props, ctx) { |
||||
const onUpdateDatePickerValue = (val: any) => { |
||||
ctx.emit('updateDatePickerValue', val) |
||||
} |
||||
|
||||
return { onUpdateDatePickerValue } |
||||
}, |
||||
render() { |
||||
const { title, date, tableData, onUpdateDatePickerValue } = this |
||||
const { columnsRef } = useTable() |
||||
|
||||
return ( |
||||
<Card title={title}> |
||||
{{ |
||||
default: () => ( |
||||
<div class={styles['card-table']}> |
||||
<PieChart /> |
||||
{tableData && ( |
||||
<NDataTable |
||||
columns={columnsRef} |
||||
data={tableData} |
||||
striped |
||||
size={'small'} |
||||
/> |
||||
)} |
||||
</div> |
||||
), |
||||
'header-extra': () => ( |
||||
<NDatePicker |
||||
default-value={date} |
||||
onUpdateValue={onUpdateDatePickerValue} |
||||
size='small' |
||||
type='datetimerange' |
||||
clearable |
||||
/> |
||||
), |
||||
}} |
||||
</Card> |
||||
) |
||||
}, |
||||
}) |
||||
|
||||
export default StateCard |
@ -0,0 +1,29 @@
|
||||
/* |
||||
* 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 ChartData { |
||||
xAxisData: Array<string> |
||||
seriesData: Array<number> |
||||
} |
||||
|
||||
interface TaskStateTableData { |
||||
id: number |
||||
number: number |
||||
state: string |
||||
} |
||||
|
||||
export { ChartData, TaskStateTableData } |
Loading…
Reference in new issue