未验证 提交 aea00250 编写于 作者: L labbomb 提交者: GitHub

[Feature][UI Next]Added loading state to all tables (#9215)

* Added loading state to all tables

* Delete useless variables
上级 0841ccac
...@@ -19,7 +19,6 @@ import { defineComponent, PropType } from 'vue' ...@@ -19,7 +19,6 @@ import { defineComponent, PropType } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { NDataTable } from 'naive-ui' import { NDataTable } from 'naive-ui'
import Modal from '@/components/modal' import Modal from '@/components/modal'
import styles from '../index.module.scss'
import { TableColumns } from 'naive-ui/es/data-table/src/interface' import { TableColumns } from 'naive-ui/es/data-table/src/interface'
const props = { const props = {
...@@ -94,7 +93,6 @@ export default defineComponent({ ...@@ -94,7 +93,6 @@ export default defineComponent({
data={this.ruleInputEntryList} data={this.ruleInputEntryList}
striped striped
size={'small'} size={'small'}
class={styles.table}
/> />
</Modal> </Modal>
) )
......
...@@ -100,7 +100,8 @@ const TaskResult = defineComponent({ ...@@ -100,7 +100,8 @@ const TaskResult = defineComponent({
onCancel, onCancel,
onConfirm, onConfirm,
viewRuleEntry, viewRuleEntry,
ruleEntryData ruleEntryData,
loadingRef
} = this } = this
const { columns } = useTable(viewRuleEntry) const { columns } = useTable(viewRuleEntry)
...@@ -127,7 +128,7 @@ const TaskResult = defineComponent({ ...@@ -127,7 +128,7 @@ const TaskResult = defineComponent({
</NSpace> </NSpace>
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable columns={columns} data={this.tableData} /> <NDataTable loading={loadingRef} columns={columns} data={this.tableData} />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination
v-model:page={this.page} v-model:page={this.page}
......
...@@ -35,7 +35,8 @@ export function useTable(viewRuleEntry = (unusedRuleJson: string): void => {}) { ...@@ -35,7 +35,8 @@ export function useTable(viewRuleEntry = (unusedRuleJson: string): void => {}) {
pageSize: ref(10), pageSize: ref(10),
state: ref(null), state: ref(null),
searchVal: ref(null), searchVal: ref(null),
totalPage: ref(1) totalPage: ref(1),
loadingRef: ref(false)
}) })
const columns: TableColumns<any> = [ const columns: TableColumns<any> = [
...@@ -97,6 +98,8 @@ export function useTable(viewRuleEntry = (unusedRuleJson: string): void => {}) { ...@@ -97,6 +98,8 @@ export function useTable(viewRuleEntry = (unusedRuleJson: string): void => {}) {
] ]
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const data = { const data = {
pageSize: params.pageSize, pageSize: params.pageSize,
pageNo: params.pageNo, pageNo: params.pageNo,
...@@ -129,12 +132,15 @@ export function useTable(viewRuleEntry = (unusedRuleJson: string): void => {}) { ...@@ -129,12 +132,15 @@ export function useTable(viewRuleEntry = (unusedRuleJson: string): void => {}) {
'yyyy-MM-dd HH:mm:ss' 'yyyy-MM-dd HH:mm:ss'
) )
return { return {
...item, ...item,
ruleName: ruleNameLocale, ruleName: ruleNameLocale,
ruleTypeName: ruleTypeName ruleTypeName: ruleTypeName
} }
}) as any }) as any
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -77,7 +77,7 @@ const TaskResult = defineComponent({ ...@@ -77,7 +77,7 @@ const TaskResult = defineComponent({
} }
}, },
render() { render() {
const { t, requestTableData, onUpdatePageSize, onSearch } = this const { t, requestTableData, onUpdatePageSize, onSearch, loadingRef } = this
return ( return (
<> <>
...@@ -156,6 +156,7 @@ const TaskResult = defineComponent({ ...@@ -156,6 +156,7 @@ const TaskResult = defineComponent({
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
scrollX={this.tableWidth} scrollX={this.tableWidth}
......
...@@ -44,7 +44,8 @@ export function useTable() { ...@@ -44,7 +44,8 @@ export function useTable() {
state: ref(null), state: ref(null),
searchVal: ref(null), searchVal: ref(null),
datePickerRange: ref(null), datePickerRange: ref(null),
totalPage: ref(1) totalPage: ref(1),
loadingRef: ref(false)
}) })
const createColumns = (variables: any) => { const createColumns = (variables: any) => {
...@@ -191,6 +192,8 @@ export function useTable() { ...@@ -191,6 +192,8 @@ export function useTable() {
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const data = { const data = {
pageSize: params.pageSize, pageSize: params.pageSize,
pageNo: params.pageNo, pageNo: params.pageNo,
...@@ -212,6 +215,8 @@ export function useTable() { ...@@ -212,6 +215,8 @@ export function useTable() {
...item ...item
} }
}) as any }) as any
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -36,6 +36,10 @@ const props = { ...@@ -36,6 +36,10 @@ const props = {
chartData: { chartData: {
type: Array as PropType<Array<StateChartData>>, type: Array as PropType<Array<StateChartData>>,
default: () => [] default: () => []
},
loadingRef: {
type: Boolean as PropType<boolean>,
default: false
} }
} }
...@@ -51,9 +55,8 @@ const StateCard = defineComponent({ ...@@ -51,9 +55,8 @@ const StateCard = defineComponent({
return { onUpdateDatePickerValue } return { onUpdateDatePickerValue }
}, },
render() { render() {
const { title, date, tableData, chartData, onUpdateDatePickerValue } = this const { title, date, tableData, chartData, onUpdateDatePickerValue, loadingRef } = this
const { columnsRef } = useTable() const { columnsRef } = useTable()
return ( return (
<Card title={title}> <Card title={title}>
{{ {{
...@@ -63,6 +66,7 @@ const StateCard = defineComponent({ ...@@ -63,6 +66,7 @@ const StateCard = defineComponent({
<NGi> <NGi>
{tableData && ( {tableData && (
<NDataTable <NDataTable
loading={loadingRef}
columns={columnsRef} columns={columnsRef}
data={tableData} data={tableData}
striped striped
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { defineComponent, onMounted, ref, watch } from 'vue' import { defineComponent, onMounted, ref, toRefs, watch } from 'vue'
import { NGrid, NGi } from 'naive-ui' import { NGrid, NGi } from 'naive-ui'
import { startOfToday, getTime } from 'date-fns' import { startOfToday, getTime } from 'date-fns'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
...@@ -31,8 +31,8 @@ export default defineComponent({ ...@@ -31,8 +31,8 @@ export default defineComponent({
const dateRef = ref([getTime(startOfToday()), Date.now()]) const dateRef = ref([getTime(startOfToday()), Date.now()])
const taskStateRef = ref() const taskStateRef = ref()
const processStateRef = ref() const processStateRef = ref()
const { getTaskState } = useTaskState() const { getTaskState, taskVariables } = useTaskState()
const { getProcessState } = useProcessState() const { getProcessState, processVariables } = useProcessState()
const initData = () => { const initData = () => {
taskStateRef.value = getTaskState(dateRef.value) taskStateRef.value = getTaskState(dateRef.value)
...@@ -62,11 +62,13 @@ export default defineComponent({ ...@@ -62,11 +62,13 @@ export default defineComponent({
handleTaskDate, handleTaskDate,
handleProcessDate, handleProcessDate,
taskStateRef, taskStateRef,
processStateRef processStateRef,
...toRefs(taskVariables),
...toRefs(processVariables),
} }
}, },
render() { render() {
const { t, dateRef, handleTaskDate, handleProcessDate } = this const { t, dateRef, handleTaskDate, handleProcessDate, taskLoadingRef, processLoadingRef } = this
return ( return (
<div> <div>
...@@ -78,6 +80,7 @@ export default defineComponent({ ...@@ -78,6 +80,7 @@ export default defineComponent({
tableData={this.taskStateRef?.value.table} tableData={this.taskStateRef?.value.table}
chartData={this.taskStateRef?.value.chart} chartData={this.taskStateRef?.value.chart}
onUpdateDatePickerValue={handleTaskDate} onUpdateDatePickerValue={handleTaskDate}
loadingRef={taskLoadingRef}
/> />
</NGi> </NGi>
<NGi> <NGi>
...@@ -87,6 +90,7 @@ export default defineComponent({ ...@@ -87,6 +90,7 @@ export default defineComponent({
tableData={this.processStateRef?.value.table} tableData={this.processStateRef?.value.table}
chartData={this.processStateRef?.value.chart} chartData={this.processStateRef?.value.chart}
onUpdateDatePickerValue={handleProcessDate} onUpdateDatePickerValue={handleProcessDate}
loadingRef={processLoadingRef}
/> />
</NGi> </NGi>
</NGrid> </NGrid>
......
...@@ -22,11 +22,17 @@ import { toLower } from 'lodash' ...@@ -22,11 +22,17 @@ import { toLower } from 'lodash'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import type { TaskStateRes } from '@/service/modules/projects-analysis/types' import type { TaskStateRes } from '@/service/modules/projects-analysis/types'
import type { StateData } from './types' import type { StateData } from './types'
import { reactive, ref } from 'vue'
export function useProcessState() { export function useProcessState() {
const { t } = useI18n() const { t } = useI18n()
const processVariables = reactive({
processLoadingRef: ref(false)
})
const getProcessState = (date: Array<number>) => { const getProcessState = (date: Array<number>) => {
if (processVariables.processLoadingRef) return
processVariables.processLoadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
countProcessInstanceState({ countProcessInstanceState({
startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'), startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'),
...@@ -46,14 +52,15 @@ export function useProcessState() { ...@@ -46,14 +52,15 @@ export function useProcessState() {
name: t('home.' + toLower(item.taskStateType)) name: t('home.' + toLower(item.taskStateType))
} }
}) })
processVariables.processLoadingRef = false
return { table, chart } return { table, chart }
}), }),
{ table: [], chart: [] } { table: [], chart: [] }
) )
return state return state
} }
return { getProcessState } return { getProcessState, processVariables }
} }
...@@ -22,11 +22,17 @@ import { useI18n } from 'vue-i18n' ...@@ -22,11 +22,17 @@ import { useI18n } from 'vue-i18n'
import { countTaskState } from '@/service/modules/projects-analysis' import { countTaskState } from '@/service/modules/projects-analysis'
import type { TaskStateRes } from '@/service/modules/projects-analysis/types' import type { TaskStateRes } from '@/service/modules/projects-analysis/types'
import type { StateData } from './types' import type { StateData } from './types'
import { reactive, ref } from 'vue'
export function useTaskState() { export function useTaskState() {
const { t } = useI18n() const { t } = useI18n()
const taskVariables = reactive({
taskLoadingRef: ref(false)
})
const getTaskState = (date: Array<any>) => { const getTaskState = (date: Array<any>) => {
if (taskVariables.taskLoadingRef) return
taskVariables.taskLoadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
countTaskState({ countTaskState({
startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'), startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'),
...@@ -46,6 +52,7 @@ export function useTaskState() { ...@@ -46,6 +52,7 @@ export function useTaskState() {
name: t('home.' + toLower(item.taskStateType)) name: t('home.' + toLower(item.taskStateType))
} }
}) })
taskVariables.taskLoadingRef = false
return { table, chart } return { table, chart }
}), }),
...@@ -55,5 +62,5 @@ export function useTaskState() { ...@@ -55,5 +62,5 @@ export function useTaskState() {
return state return state
} }
return { getTaskState } return { getTaskState, taskVariables }
} }
...@@ -77,7 +77,7 @@ const AuditLog = defineComponent({ ...@@ -77,7 +77,7 @@ const AuditLog = defineComponent({
} }
}, },
render() { render() {
const { t, requestTableData, onUpdatePageSize, onSearch } = this const { t, requestTableData, onUpdatePageSize, onSearch, loadingRef } = this
return ( return (
<> <>
...@@ -139,7 +139,7 @@ const AuditLog = defineComponent({ ...@@ -139,7 +139,7 @@ const AuditLog = defineComponent({
</NSpace> </NSpace>
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable columns={this.columns} data={this.tableData} /> <NDataTable loading={loadingRef} columns={this.columns} data={this.tableData} />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination
v-model:page={this.page} v-model:page={this.page}
......
...@@ -35,7 +35,8 @@ export function useTable() { ...@@ -35,7 +35,8 @@ export function useTable() {
operationType: ref(null), operationType: ref(null),
userName: ref(null), userName: ref(null),
datePickerRange: ref(null), datePickerRange: ref(null),
totalPage: ref(1) totalPage: ref(1),
loadingRef: ref(false)
}) })
const createColumns = (variables: any) => { const createColumns = (variables: any) => {
...@@ -69,6 +70,8 @@ export function useTable() { ...@@ -69,6 +70,8 @@ export function useTable() {
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const data = { const data = {
pageSize: params.pageSize, pageSize: params.pageSize,
pageNo: params.pageNo, pageNo: params.pageNo,
...@@ -90,6 +93,7 @@ export function useTable() { ...@@ -90,6 +93,7 @@ export function useTable() {
...item ...item
} }
}) as any }) as any
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -91,7 +91,7 @@ const list = defineComponent({ ...@@ -91,7 +91,7 @@ const list = defineComponent({
} }
}, },
render() { render() {
const { t } = this const { t, loadingRef } = this
return ( return (
<div> <div>
<NCard> <NCard>
...@@ -124,6 +124,7 @@ const list = defineComponent({ ...@@ -124,6 +124,7 @@ const list = defineComponent({
class={styles['table-card']} class={styles['table-card']}
> >
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
scrollX={this.tableWidth} scrollX={this.tableWidth}
......
...@@ -218,10 +218,13 @@ export function useTable() { ...@@ -218,10 +218,13 @@ export function useTable() {
totalPage: ref(1), totalPage: ref(1),
showModalRef: ref(false), showModalRef: ref(false),
statusRef: ref(0), statusRef: ref(0),
row: {} row: {},
loadingRef: ref(false)
}) })
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryProjectListPaging(params).then((res: ProjectRes) => { queryProjectListPaging(params).then((res: ProjectRes) => {
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
...@@ -238,6 +241,7 @@ export function useTable() { ...@@ -238,6 +241,7 @@ export function useTable() {
...item ...item
} }
}) as any }) as any
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -36,6 +36,10 @@ const props = { ...@@ -36,6 +36,10 @@ const props = {
chartData: { chartData: {
type: Array as PropType<Array<StateChartData>>, type: Array as PropType<Array<StateChartData>>,
default: () => [] default: () => []
},
loadingRef: {
type: Boolean as PropType<boolean>,
default: false
} }
} }
...@@ -51,9 +55,8 @@ const StateCard = defineComponent({ ...@@ -51,9 +55,8 @@ const StateCard = defineComponent({
return { onUpdateDatePickerValue } return { onUpdateDatePickerValue }
}, },
render() { render() {
const { title, date, tableData, chartData, onUpdateDatePickerValue } = this const { title, date, tableData, chartData, onUpdateDatePickerValue, loadingRef } = this
const { columnsRef } = useTable() const { columnsRef } = useTable()
return ( return (
<Card title={title}> <Card title={title}>
{{ {{
...@@ -63,6 +66,7 @@ const StateCard = defineComponent({ ...@@ -63,6 +66,7 @@ const StateCard = defineComponent({
<NGi> <NGi>
{tableData && ( {tableData && (
<NDataTable <NDataTable
loading={loadingRef}
columns={columnsRef} columns={columnsRef}
data={tableData} data={tableData}
striped striped
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { defineComponent, onMounted, ref, watch } from 'vue' import { defineComponent, onMounted, ref, toRefs, watch } from 'vue'
import { NGrid, NGi } from 'naive-ui' import { NGrid, NGi } from 'naive-ui'
import { startOfToday, getTime } from 'date-fns' import { startOfToday, getTime } from 'date-fns'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
...@@ -31,8 +31,8 @@ const workflowMonitor = defineComponent({ ...@@ -31,8 +31,8 @@ const workflowMonitor = defineComponent({
const dateRef = ref([getTime(startOfToday()), Date.now()]) const dateRef = ref([getTime(startOfToday()), Date.now()])
const taskStateRef = ref() const taskStateRef = ref()
const processStateRef = ref() const processStateRef = ref()
const { getTaskState } = useTaskState() const { getTaskState, taskVariables } = useTaskState()
const { getProcessState } = useProcessState() const { getProcessState, processVariables } = useProcessState()
const handleTaskDate = (val: any) => { const handleTaskDate = (val: any) => {
taskStateRef.value = getTaskState(val) taskStateRef.value = getTaskState(val)
...@@ -62,11 +62,13 @@ const workflowMonitor = defineComponent({ ...@@ -62,11 +62,13 @@ const workflowMonitor = defineComponent({
handleTaskDate, handleTaskDate,
handleProcessDate, handleProcessDate,
taskStateRef, taskStateRef,
processStateRef processStateRef,
...toRefs(taskVariables),
...toRefs(processVariables),
} }
}, },
render() { render() {
const { t, dateRef, handleTaskDate, handleProcessDate } = this const { t, dateRef, handleTaskDate, handleProcessDate, taskLoadingRef, processLoadingRef } = this
return ( return (
<div> <div>
...@@ -78,6 +80,7 @@ const workflowMonitor = defineComponent({ ...@@ -78,6 +80,7 @@ const workflowMonitor = defineComponent({
tableData={this.taskStateRef?.value.table} tableData={this.taskStateRef?.value.table}
chartData={this.taskStateRef?.value.chart} chartData={this.taskStateRef?.value.chart}
onUpdateDatePickerValue={handleTaskDate} onUpdateDatePickerValue={handleTaskDate}
loadingRef={taskLoadingRef}
/> />
</NGi> </NGi>
<NGi> <NGi>
...@@ -87,6 +90,7 @@ const workflowMonitor = defineComponent({ ...@@ -87,6 +90,7 @@ const workflowMonitor = defineComponent({
tableData={this.processStateRef?.value.table} tableData={this.processStateRef?.value.table}
chartData={this.processStateRef?.value.chart} chartData={this.processStateRef?.value.chart}
onUpdateDatePickerValue={handleProcessDate} onUpdateDatePickerValue={handleProcessDate}
loadingRef={processLoadingRef}
/> />
</NGi> </NGi>
</NGrid> </NGrid>
......
...@@ -23,12 +23,18 @@ import { toLower } from 'lodash' ...@@ -23,12 +23,18 @@ import { toLower } from 'lodash'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import type { TaskStateRes } from '@/service/modules/projects-analysis/types' import type { TaskStateRes } from '@/service/modules/projects-analysis/types'
import type { StateData } from './types' import type { StateData } from './types'
import { reactive, ref } from 'vue'
export function useProcessState() { export function useProcessState() {
const route = useRoute() const route = useRoute()
const { t } = useI18n() const { t } = useI18n()
const processVariables = reactive({
processLoadingRef: ref(false)
})
const getProcessState = (date: Array<number>) => { const getProcessState = (date: Array<number>) => {
if (processVariables.processLoadingRef) return
processVariables.processLoadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
countProcessInstanceState({ countProcessInstanceState({
startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'), startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'),
...@@ -48,6 +54,7 @@ export function useProcessState() { ...@@ -48,6 +54,7 @@ export function useProcessState() {
name: t('home.' + toLower(item.taskStateType)) name: t('home.' + toLower(item.taskStateType))
} }
}) })
processVariables.processLoadingRef = false
return { table, chart } return { table, chart }
}), }),
...@@ -57,5 +64,5 @@ export function useProcessState() { ...@@ -57,5 +64,5 @@ export function useProcessState() {
return state return state
} }
return { getProcessState } return { getProcessState, processVariables }
} }
...@@ -23,12 +23,18 @@ import { useI18n } from 'vue-i18n' ...@@ -23,12 +23,18 @@ import { useI18n } from 'vue-i18n'
import { countTaskState } from '@/service/modules/projects-analysis' import { countTaskState } from '@/service/modules/projects-analysis'
import type { TaskStateRes } from '@/service/modules/projects-analysis/types' import type { TaskStateRes } from '@/service/modules/projects-analysis/types'
import type { StateData } from './types' import type { StateData } from './types'
import { reactive, ref } from 'vue'
export function useTaskState() { export function useTaskState() {
const route = useRoute() const route = useRoute()
const { t } = useI18n() const { t } = useI18n()
const taskVariables = reactive({
taskLoadingRef: ref(false)
})
const getTaskState = (date: Array<number>) => { const getTaskState = (date: Array<number>) => {
if (taskVariables.taskLoadingRef) return
taskVariables.taskLoadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
countTaskState({ countTaskState({
startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'), startDate: !date ? '' : format(date[0], 'yyyy-MM-dd HH:mm:ss'),
...@@ -48,6 +54,7 @@ export function useTaskState() { ...@@ -48,6 +54,7 @@ export function useTaskState() {
name: t('home.' + toLower(item.taskStateType)) name: t('home.' + toLower(item.taskStateType))
} }
}) })
taskVariables.taskLoadingRef = false
return { table, chart } return { table, chart }
}), }),
...@@ -57,5 +64,5 @@ export function useTaskState() { ...@@ -57,5 +64,5 @@ export function useTaskState() {
return state return state
} }
return { getTaskState } return { getTaskState, taskVariables }
} }
...@@ -158,7 +158,8 @@ export function useVersion() { ...@@ -158,7 +158,8 @@ export function useVersion() {
taskVersion: ref(null), taskVersion: ref(null),
taskCode: ref(null), taskCode: ref(null),
refreshTaskDefinition: ref(false), refreshTaskDefinition: ref(false),
row: {} row: {},
loadingRef: ref(false)
}) })
const handleSwitchVersion = (row: TaskDefinitionVersionItem) => { const handleSwitchVersion = (row: TaskDefinitionVersionItem) => {
...@@ -182,6 +183,8 @@ export function useVersion() { ...@@ -182,6 +183,8 @@ export function useVersion() {
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryTaskVersions( queryTaskVersions(
{ ...params }, { ...params },
...@@ -194,6 +197,7 @@ export function useVersion() { ...@@ -194,6 +197,7 @@ export function useVersion() {
} }
}) as any }) as any
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -77,7 +77,7 @@ const VersionModal = defineComponent({ ...@@ -77,7 +77,7 @@ const VersionModal = defineComponent({
return { t, ...toRefs(variables), requestData, onConfirm } return { t, ...toRefs(variables), requestData, onConfirm }
}, },
render() { render() {
const { t, requestData, onConfirm, show } = this const { t, requestData, onConfirm, show, loadingRef } = this
return ( return (
<Modal <Modal
...@@ -86,7 +86,7 @@ const VersionModal = defineComponent({ ...@@ -86,7 +86,7 @@ const VersionModal = defineComponent({
cancelShow={false} cancelShow={false}
onConfirm={onConfirm} onConfirm={onConfirm}
> >
<NDataTable columns={this.columns} data={this.tableData} /> <NDataTable loading={loadingRef} columns={this.columns} data={this.tableData} />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination
v-model:page={this.page} v-model:page={this.page}
......
...@@ -114,7 +114,7 @@ const TaskDefinition = defineComponent({ ...@@ -114,7 +114,7 @@ const TaskDefinition = defineComponent({
} }
}, },
render() { render() {
const { t, onSearch, requestData, onUpdatePageSize, onRefresh, onCreate } = const { t, onSearch, requestData, onUpdatePageSize, onRefresh, onCreate, loadingRef } =
this this
return ( return (
...@@ -163,6 +163,7 @@ const TaskDefinition = defineComponent({ ...@@ -163,6 +163,7 @@ const TaskDefinition = defineComponent({
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
scrollX={this.tableWidth} scrollX={this.tableWidth}
......
...@@ -266,7 +266,8 @@ export function useTable(onEdit: Function) { ...@@ -266,7 +266,8 @@ export function useTable(onEdit: Function) {
taskType: ref(null), taskType: ref(null),
showVersionModalRef: ref(false), showVersionModalRef: ref(false),
showMoveModalRef: ref(false), showMoveModalRef: ref(false),
row: {} row: {},
loadingRef: ref(false)
}) })
const handleDelete = (row: any) => { const handleDelete = (row: any) => {
...@@ -285,6 +286,8 @@ export function useTable(onEdit: Function) { ...@@ -285,6 +286,8 @@ export function useTable(onEdit: Function) {
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryTaskDefinitionListPaging({ ...params }, { projectCode }).then( queryTaskDefinitionListPaging({ ...params }, { projectCode }).then(
(res: TaskDefinitionRes) => { (res: TaskDefinitionRes) => {
...@@ -302,6 +305,7 @@ export function useTable(onEdit: Function) { ...@@ -302,6 +305,7 @@ export function useTable(onEdit: Function) {
} }
}) as any }) as any
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
} }
), ),
{} {}
......
...@@ -86,7 +86,7 @@ const TaskInstance = defineComponent({ ...@@ -86,7 +86,7 @@ const TaskInstance = defineComponent({
} }
}, },
render() { render() {
const { t, requestTableData, onUpdatePageSize, onSearch, onConfirmModal } = const { t, requestTableData, onUpdatePageSize, onSearch, onConfirmModal, loadingRef } =
this this
return ( return (
...@@ -183,6 +183,7 @@ const TaskInstance = defineComponent({ ...@@ -183,6 +183,7 @@ const TaskInstance = defineComponent({
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
scrollX={this.tableWidth} scrollX={this.tableWidth}
......
...@@ -62,7 +62,8 @@ export function useTable() { ...@@ -62,7 +62,8 @@ export function useTable() {
processInstanceName: ref(null), processInstanceName: ref(null),
totalPage: ref(1), totalPage: ref(1),
showModalRef: ref(false), showModalRef: ref(false),
row: {} row: {},
loadingRef: ref(false)
}) })
const createColumns = (variables: any) => { const createColumns = (variables: any) => {
...@@ -268,6 +269,8 @@ export function useTable() { ...@@ -268,6 +269,8 @@ export function useTable() {
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const data = { const data = {
pageSize: params.pageSize, pageSize: params.pageSize,
pageNo: params.pageNo, pageNo: params.pageNo,
...@@ -306,6 +309,7 @@ export function useTable() { ...@@ -306,6 +309,7 @@ export function useTable() {
} }
}) as any }) as any
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
} }
), ),
{} {}
......
...@@ -152,10 +152,13 @@ export function useTable( ...@@ -152,10 +152,13 @@ export function useTable(
page: ref(1), page: ref(1),
totalPage: ref(1), totalPage: ref(1),
pageSize: ref(10), pageSize: ref(10),
projectCode: ref(Number(router.currentRoute.value.params.projectCode)) projectCode: ref(Number(router.currentRoute.value.params.projectCode)),
loadingRef: ref(false)
}) })
const getTableData = (row: any) => { const getTableData = (row: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
variables.row = row variables.row = row
queryVersions( queryVersions(
{ {
...@@ -168,6 +171,7 @@ export function useTable( ...@@ -168,6 +171,7 @@ export function useTable(
variables.tableData = res.totalList.map((item: any) => ({ ...item })) variables.tableData = res.totalList.map((item: any) => ({ ...item }))
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
}) })
} }
......
...@@ -80,7 +80,7 @@ export default defineComponent({ ...@@ -80,7 +80,7 @@ export default defineComponent({
render() { render() {
const { t } = useI18n() const { t } = useI18n()
const { requestData } = this const { requestData, loadingRef } = this
return ( return (
<Modal <Modal
...@@ -90,6 +90,7 @@ export default defineComponent({ ...@@ -90,6 +90,7 @@ export default defineComponent({
onConfirm={this.hideModal} onConfirm={this.hideModal}
> >
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
striped striped
......
...@@ -112,6 +112,7 @@ export default defineComponent({ ...@@ -112,6 +112,7 @@ export default defineComponent({
}, },
render() { render() {
const { t } = useI18n() const { t } = useI18n()
const { loadingRef } = this
return ( return (
<div class={styles.content}> <div class={styles.content}>
...@@ -150,6 +151,7 @@ export default defineComponent({ ...@@ -150,6 +151,7 @@ export default defineComponent({
</Card> </Card>
<Card title={t('project.workflow.workflow_definition')}> <Card title={t('project.workflow.workflow_definition')}>
<NDataTable <NDataTable
loading={loadingRef}
rowKey={(row) => row.code} rowKey={(row) => row.code}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
......
...@@ -73,6 +73,7 @@ export default defineComponent({ ...@@ -73,6 +73,7 @@ export default defineComponent({
render() { render() {
const { t } = useI18n() const { t } = useI18n()
const router: Router = useRouter() const router: Router = useRouter()
const { loadingRef } = this
return ( return (
<div class={styles.content}> <div class={styles.content}>
...@@ -87,6 +88,7 @@ export default defineComponent({ ...@@ -87,6 +88,7 @@ export default defineComponent({
</Card> </Card>
<Card title={t('project.workflow.cron_manage')}> <Card title={t('project.workflow.cron_manage')}>
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
striped striped
......
...@@ -55,7 +55,8 @@ export function useTable() { ...@@ -55,7 +55,8 @@ export function useTable() {
pageSize: ref(10), pageSize: ref(10),
searchVal: ref(), searchVal: ref(),
totalPage: ref(1), totalPage: ref(1),
showRef: ref(false) showRef: ref(false),
loadingRef: ref(false)
}) })
const renderTime = (time: string, timeZone: string) => { const renderTime = (time: string, timeZone: string) => {
...@@ -243,6 +244,8 @@ export function useTable() { ...@@ -243,6 +244,8 @@ export function useTable() {
} }
const getTableData = (params: ISearchParam) => { const getTableData = (params: ISearchParam) => {
if (variables.loadingRef) return
variables.loadingRef = true
const definitionCode = Number( const definitionCode = Number(
router.currentRoute.value.params.definitionCode router.currentRoute.value.params.definitionCode
) )
...@@ -254,6 +257,7 @@ export function useTable() { ...@@ -254,6 +257,7 @@ export function useTable() {
variables.tableData = res.totalList.map((item: any) => { variables.tableData = res.totalList.map((item: any) => {
return { ...item } return { ...item }
}) })
variables.loadingRef = false
}) })
} }
......
...@@ -60,7 +60,8 @@ export function useTable() { ...@@ -60,7 +60,8 @@ export function useTable() {
startShowRef: ref(false), startShowRef: ref(false),
timingShowRef: ref(false), timingShowRef: ref(false),
versionShowRef: ref(false), versionShowRef: ref(false),
copyShowRef: ref(false) copyShowRef: ref(false),
loadingRef: ref(false)
}) })
const createColumns = (variables: any) => { const createColumns = (variables: any) => {
...@@ -337,12 +338,15 @@ export function useTable() { ...@@ -337,12 +338,15 @@ export function useTable() {
} }
const getTableData = (params: IDefinitionParam) => { const getTableData = (params: IDefinitionParam) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryListPaging({ ...params }, variables.projectCode).then((res: any) => { queryListPaging({ ...params }, variables.projectCode).then((res: any) => {
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.tableData = res.totalList.map((item: any) => { variables.tableData = res.totalList.map((item: any) => {
return { ...item } return { ...item }
}) })
variables.loadingRef = false
}), }),
{ total: 0, table: [] } { total: 0, table: [] }
) )
......
...@@ -89,6 +89,7 @@ export default defineComponent({ ...@@ -89,6 +89,7 @@ export default defineComponent({
}, },
render() { render() {
const { t } = useI18n() const { t } = useI18n()
const { loadingRef } = this
return ( return (
<div class={styles.content}> <div class={styles.content}>
...@@ -99,6 +100,7 @@ export default defineComponent({ ...@@ -99,6 +100,7 @@ export default defineComponent({
</Card> </Card>
<Card title={t('project.workflow.workflow_instance')}> <Card title={t('project.workflow.workflow_instance')}>
<NDataTable <NDataTable
loading={loadingRef}
rowKey={(row) => row.id} rowKey={(row) => row.id}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
......
...@@ -61,7 +61,8 @@ export function useTable() { ...@@ -61,7 +61,8 @@ export function useTable() {
stateType: ref(), stateType: ref(),
startDate: ref(), startDate: ref(),
endDate: ref(), endDate: ref(),
projectCode: ref(Number(router.currentRoute.value.params.projectCode)) projectCode: ref(Number(router.currentRoute.value.params.projectCode)),
loadingRef: ref(false)
}) })
const createColumns = (variables: any) => { const createColumns = (variables: any) => {
...@@ -236,6 +237,8 @@ export function useTable() { ...@@ -236,6 +237,8 @@ export function useTable() {
} }
const getTableData = () => { const getTableData = () => {
if (variables.loadingRef) return
variables.loadingRef = true
const params = { const params = {
pageNo: variables.page, pageNo: variables.page,
pageSize: variables.pageSize, pageSize: variables.pageSize,
...@@ -252,6 +255,7 @@ export function useTable() { ...@@ -252,6 +255,7 @@ export function useTable() {
variables.tableData = res.totalList.map((item: any) => { variables.tableData = res.totalList.map((item: any) => {
return { ...item } return { ...item }
}) })
variables.loadingRef = false
} }
) )
} }
......
...@@ -136,7 +136,8 @@ const taskGroupOption = defineComponent({ ...@@ -136,7 +136,8 @@ const taskGroupOption = defineComponent({
resetTableData, resetTableData,
onUpdatePageSize, onUpdatePageSize,
updateItem, updateItem,
onSearch onSearch,
loadingRef
} = this } = this
const { columns } = useTable(updateItem, resetTableData) const { columns } = useTable(updateItem, resetTableData)
...@@ -176,6 +177,7 @@ const taskGroupOption = defineComponent({ ...@@ -176,6 +177,7 @@ const taskGroupOption = defineComponent({
> >
<div> <div>
<NDataTable <NDataTable
loading={loadingRef}
columns={columns} columns={columns}
size={'small'} size={'small'}
data={this.tableData} data={this.tableData}
......
...@@ -118,10 +118,13 @@ export function useTable( ...@@ -118,10 +118,13 @@ export function useTable(
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),
name: ref(null), name: ref(null),
totalPage: ref(1) totalPage: ref(1),
loadingRef: ref(false)
}) })
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
Promise.all([queryTaskGroupListPaging(params), queryAllProjectList()]).then( Promise.all([queryTaskGroupListPaging(params), queryAllProjectList()]).then(
(values: any[]) => { (values: any[]) => {
variables.totalPage = values[0].totalPage variables.totalPage = values[0].totalPage
...@@ -149,6 +152,7 @@ export function useTable( ...@@ -149,6 +152,7 @@ export function useTable(
} }
} }
) )
variables.loadingRef = false
} }
) )
} }
......
...@@ -150,7 +150,8 @@ const taskGroupQueue = defineComponent({ ...@@ -150,7 +150,8 @@ const taskGroupQueue = defineComponent({
onSearch, onSearch,
showModalRef, showModalRef,
updateItemData, updateItemData,
taskGroupOptions taskGroupOptions,
loadingRef
} = this } = this
const { columns } = useTable(updatePriority, resetTableData) const { columns } = useTable(updatePriority, resetTableData)
...@@ -192,6 +193,7 @@ const taskGroupQueue = defineComponent({ ...@@ -192,6 +193,7 @@ const taskGroupQueue = defineComponent({
> >
<div> <div>
<NDataTable <NDataTable
loading={loadingRef}
columns={columns} columns={columns}
size={'small'} size={'small'}
data={this.tableData} data={this.tableData}
......
...@@ -121,10 +121,13 @@ export function useTable( ...@@ -121,10 +121,13 @@ export function useTable(
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),
groupId: ref(3), groupId: ref(3),
totalPage: ref(1) totalPage: ref(1),
loadingRef: ref(false)
}) })
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const taskGroupSearchParams = { const taskGroupSearchParams = {
pageNo: 1, pageNo: 1,
pageSize: 2147483647 pageSize: 2147483647
...@@ -159,6 +162,7 @@ export function useTable( ...@@ -159,6 +162,7 @@ export function useTable(
} }
} }
) )
variables.loadingRef = false
}) })
} }
......
...@@ -88,6 +88,7 @@ export default defineComponent({ ...@@ -88,6 +88,7 @@ export default defineComponent({
}, },
render() { render() {
const { t } = useI18n() const { t } = useI18n()
const { loadingRef } = this
return ( return (
<div class={styles.content}> <div class={styles.content}>
...@@ -123,6 +124,7 @@ export default defineComponent({ ...@@ -123,6 +124,7 @@ export default defineComponent({
</Card> </Card>
<Card title={t('resource.function.udf_function')}> <Card title={t('resource.function.udf_function')}>
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
striped striped
......
...@@ -48,7 +48,8 @@ export function useTable() { ...@@ -48,7 +48,8 @@ export function useTable() {
pageSize: ref(10), pageSize: ref(10),
searchVal: ref(), searchVal: ref(),
totalPage: ref(1), totalPage: ref(1),
showRef: ref(false) showRef: ref(false),
loadingRef: ref(false)
}) })
const createColumns = (variables: any) => { const createColumns = (variables: any) => {
...@@ -162,12 +163,15 @@ export function useTable() { ...@@ -162,12 +163,15 @@ export function useTable() {
} }
const getTableData = (params: IUdfFunctionParam) => { const getTableData = (params: IUdfFunctionParam) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryUdfFuncListPaging({ ...params }).then((res: any) => { queryUdfFuncListPaging({ ...params }).then((res: any) => {
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.tableData = res.totalList.map((item: any) => { variables.tableData = res.totalList.map((item: any) => {
return { ...item } return { ...item }
}) })
variables.loadingRef = false
}), }),
{ total: 0, table: [] } { total: 0, table: [] }
) )
......
...@@ -109,6 +109,7 @@ export default defineComponent({ ...@@ -109,6 +109,7 @@ export default defineComponent({
}, },
render() { render() {
const { t } = useI18n() const { t } = useI18n()
const { loadingRef } = this
return ( return (
<div class={styles.content}> <div class={styles.content}>
...@@ -155,6 +156,7 @@ export default defineComponent({ ...@@ -155,6 +156,7 @@ export default defineComponent({
default: () => ( default: () => (
<div> <div>
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
striped striped
......
...@@ -66,7 +66,8 @@ export function useTable() { ...@@ -66,7 +66,8 @@ export function useTable() {
searchVal: ref(), searchVal: ref(),
totalPage: ref(1), totalPage: ref(1),
folderShowRef: ref(false), folderShowRef: ref(false),
uploadShowRef: ref(false) uploadShowRef: ref(false),
loadingRef: ref(false)
}) })
const createColumns = (variables: any) => { const createColumns = (variables: any) => {
...@@ -224,6 +225,8 @@ export function useTable() { ...@@ -224,6 +225,8 @@ export function useTable() {
} }
const getTableData = (params: IUdfResourceParam) => { const getTableData = (params: IUdfResourceParam) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryResourceListPaging({ ...params, type: 'UDF' }).then((res: any) => { queryResourceListPaging({ ...params, type: 'UDF' }).then((res: any) => {
const breadList = const breadList =
...@@ -237,6 +240,7 @@ export function useTable() { ...@@ -237,6 +240,7 @@ export function useTable() {
variables.tableData = res.totalList.map((item: any) => { variables.tableData = res.totalList.map((item: any) => {
return { ...item } return { ...item }
}) })
variables.loadingRef = false
}), }),
{ total: 0, table: [] } { total: 0, table: [] }
) )
......
...@@ -97,7 +97,8 @@ const alarmGroupManage = defineComponent({ ...@@ -97,7 +97,8 @@ const alarmGroupManage = defineComponent({
onCancelModal, onCancelModal,
onConfirmModal, onConfirmModal,
handleModalChange, handleModalChange,
onSearch onSearch,
loadingRef
} = this } = this
return ( return (
...@@ -129,7 +130,7 @@ const alarmGroupManage = defineComponent({ ...@@ -129,7 +130,7 @@ const alarmGroupManage = defineComponent({
</div> </div>
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable columns={this.columns} data={this.tableData} /> <NDataTable loading={loadingRef} columns={this.columns} data={this.tableData} />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination
v-model:page={this.page} v-model:page={this.page}
......
...@@ -139,7 +139,8 @@ export function useTable() { ...@@ -139,7 +139,8 @@ export function useTable() {
totalPage: ref(1), totalPage: ref(1),
showModalRef: ref(false), showModalRef: ref(false),
statusRef: ref(0), statusRef: ref(0),
row: {} row: {},
loadingRef: ref(false)
}) })
const handleDelete = (row: any) => { const handleDelete = (row: any) => {
...@@ -156,6 +157,8 @@ export function useTable() { ...@@ -156,6 +157,8 @@ export function useTable() {
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryAlertGroupListPaging({ ...params }).then((res: AlarmGroupRes) => { queryAlertGroupListPaging({ ...params }).then((res: AlarmGroupRes) => {
variables.tableData = res.totalList.map((item, unused) => { variables.tableData = res.totalList.map((item, unused) => {
...@@ -172,6 +175,7 @@ export function useTable() { ...@@ -172,6 +175,7 @@ export function useTable() {
} }
}) as any }) as any
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -97,7 +97,8 @@ const environmentManage = defineComponent({ ...@@ -97,7 +97,8 @@ const environmentManage = defineComponent({
onCancelModal, onCancelModal,
onConfirmModal, onConfirmModal,
handleModalChange, handleModalChange,
onSearch onSearch,
loadingRef
} = this } = this
return ( return (
...@@ -135,6 +136,7 @@ const environmentManage = defineComponent({ ...@@ -135,6 +136,7 @@ const environmentManage = defineComponent({
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable <NDataTable
loading={loadingRef}
row-class-name='items' row-class-name='items'
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
......
...@@ -181,7 +181,8 @@ export function useTable() { ...@@ -181,7 +181,8 @@ export function useTable() {
totalPage: ref(1), totalPage: ref(1),
showModalRef: ref(false), showModalRef: ref(false),
statusRef: ref(0), statusRef: ref(0),
row: {} row: {},
loadingRef: ref(false)
}) })
const handleDelete = (row: any) => { const handleDelete = (row: any) => {
...@@ -198,6 +199,8 @@ export function useTable() { ...@@ -198,6 +199,8 @@ export function useTable() {
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryEnvironmentListPaging({ ...params }).then((res: EnvironmentRes) => { queryEnvironmentListPaging({ ...params }).then((res: EnvironmentRes) => {
variables.tableData = res.totalList.map((item, unused) => { variables.tableData = res.totalList.map((item, unused) => {
...@@ -214,6 +217,7 @@ export function useTable() { ...@@ -214,6 +217,7 @@ export function useTable() {
} }
}) as any }) as any
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -98,7 +98,8 @@ const k8sNamespaceManage = defineComponent({ ...@@ -98,7 +98,8 @@ const k8sNamespaceManage = defineComponent({
onCancelModal, onCancelModal,
onConfirmModal, onConfirmModal,
handleModalChange, handleModalChange,
onSearch onSearch,
loadingRef
} = this } = this
return ( return (
...@@ -131,6 +132,7 @@ const k8sNamespaceManage = defineComponent({ ...@@ -131,6 +132,7 @@ const k8sNamespaceManage = defineComponent({
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
scrollX={this.tableWidth} scrollX={this.tableWidth}
......
...@@ -190,10 +190,13 @@ export function useTable() { ...@@ -190,10 +190,13 @@ export function useTable() {
totalPage: ref(1), totalPage: ref(1),
showModalRef: ref(false), showModalRef: ref(false),
statusRef: ref(0), statusRef: ref(0),
row: {} row: {},
loadingRef: ref(false)
}) })
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryNamespaceListPaging({ ...params }).then((res: NamespaceListRes) => { queryNamespaceListPaging({ ...params }).then((res: NamespaceListRes) => {
variables.tableData = res.totalList.map((item, unused) => { variables.tableData = res.totalList.map((item, unused) => {
...@@ -210,6 +213,7 @@ export function useTable() { ...@@ -210,6 +213,7 @@ export function useTable() {
} }
}) as any }) as any
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -91,7 +91,7 @@ const tenementManage = defineComponent({ ...@@ -91,7 +91,7 @@ const tenementManage = defineComponent({
} }
}, },
render() { render() {
const { t } = this const { t, loadingRef } = this
return ( return (
<div class={styles.container}> <div class={styles.container}>
<NCard> <NCard>
...@@ -124,6 +124,7 @@ const tenementManage = defineComponent({ ...@@ -124,6 +124,7 @@ const tenementManage = defineComponent({
class={styles['table-card']} class={styles['table-card']}
> >
<NDataTable <NDataTable
loading={loadingRef}
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
row-class-name='items' row-class-name='items'
......
...@@ -172,10 +172,13 @@ export function useTable() { ...@@ -172,10 +172,13 @@ export function useTable() {
totalPage: ref(1), totalPage: ref(1),
showModalRef: ref(false), showModalRef: ref(false),
statusRef: ref(0), statusRef: ref(0),
row: {} row: {},
loadingRef: ref(false)
}) })
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryTenantListPaging({ ...params }).then((res: any) => { queryTenantListPaging({ ...params }).then((res: any) => {
variables.tableData = res.totalList.map((item: any, unused: number) => { variables.tableData = res.totalList.map((item: any, unused: number) => {
...@@ -184,9 +187,10 @@ export function useTable() { ...@@ -184,9 +187,10 @@ export function useTable() {
} }
}) })
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
}), }),
{} {}
) )
return state return state
} }
......
...@@ -97,7 +97,8 @@ const tokenManage = defineComponent({ ...@@ -97,7 +97,8 @@ const tokenManage = defineComponent({
onCancelModal, onCancelModal,
onConfirmModal, onConfirmModal,
handleModalChange, handleModalChange,
onSearch onSearch,
loadingRef
} = this } = this
return ( return (
...@@ -135,6 +136,7 @@ const tokenManage = defineComponent({ ...@@ -135,6 +136,7 @@ const tokenManage = defineComponent({
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable <NDataTable
loading={loadingRef}
row-class-name='items' row-class-name='items'
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
......
...@@ -144,7 +144,8 @@ export function useTable() { ...@@ -144,7 +144,8 @@ export function useTable() {
totalPage: ref(1), totalPage: ref(1),
showModalRef: ref(false), showModalRef: ref(false),
statusRef: ref(0), statusRef: ref(0),
row: {} row: {},
loadingRef: ref(false)
}) })
const handleDelete = (row: any) => { const handleDelete = (row: any) => {
...@@ -161,6 +162,8 @@ export function useTable() { ...@@ -161,6 +162,8 @@ export function useTable() {
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryAccessTokenList({ ...params }).then((res: TokenRes) => { queryAccessTokenList({ ...params }).then((res: TokenRes) => {
variables.tableData = res.totalList.map((item, unused) => { variables.tableData = res.totalList.map((item, unused) => {
...@@ -181,6 +184,7 @@ export function useTable() { ...@@ -181,6 +184,7 @@ export function useTable() {
} }
}) as any }) as any
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -98,7 +98,8 @@ const workerGroupManage = defineComponent({ ...@@ -98,7 +98,8 @@ const workerGroupManage = defineComponent({
onCancelModal, onCancelModal,
onConfirmModal, onConfirmModal,
handleModalChange, handleModalChange,
onSearch onSearch,
loadingRef
} = this } = this
return ( return (
...@@ -136,6 +137,7 @@ const workerGroupManage = defineComponent({ ...@@ -136,6 +137,7 @@ const workerGroupManage = defineComponent({
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable <NDataTable
loading={loadingRef}
row-class-name='items' row-class-name='items'
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
......
...@@ -160,7 +160,8 @@ export function useTable() { ...@@ -160,7 +160,8 @@ export function useTable() {
totalPage: ref(1), totalPage: ref(1),
showModalRef: ref(false), showModalRef: ref(false),
statusRef: ref(0), statusRef: ref(0),
row: {} row: {},
loadingRef: ref(false)
}) })
const handleDelete = (row: any) => { const handleDelete = (row: any) => {
...@@ -177,6 +178,8 @@ export function useTable() { ...@@ -177,6 +178,8 @@ export function useTable() {
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryAllWorkerGroupsPaging({ ...params }).then((res: WorkerGroupRes) => { queryAllWorkerGroupsPaging({ ...params }).then((res: WorkerGroupRes) => {
variables.tableData = res.totalList.map((item, unused) => { variables.tableData = res.totalList.map((item, unused) => {
...@@ -185,6 +188,7 @@ export function useTable() { ...@@ -185,6 +188,7 @@ export function useTable() {
} }
}) as any }) as any
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
}), }),
{} {}
) )
......
...@@ -98,7 +98,8 @@ const yarnQueueManage = defineComponent({ ...@@ -98,7 +98,8 @@ const yarnQueueManage = defineComponent({
onCancelModal, onCancelModal,
onConfirmModal, onConfirmModal,
handleModalChange, handleModalChange,
onSearch onSearch,
loadingRef
} = this } = this
return ( return (
...@@ -136,6 +137,7 @@ const yarnQueueManage = defineComponent({ ...@@ -136,6 +137,7 @@ const yarnQueueManage = defineComponent({
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable <NDataTable
loading={loadingRef}
row-class-name='items' row-class-name='items'
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
......
...@@ -98,10 +98,13 @@ export function useTable() { ...@@ -98,10 +98,13 @@ export function useTable() {
totalPage: ref(1), totalPage: ref(1),
showModalRef: ref(false), showModalRef: ref(false),
statusRef: ref(0), statusRef: ref(0),
row: {} row: {},
loadingRef: ref(false)
}) })
const getTableData = (params: any) => { const getTableData = (params: any) => {
if (variables.loadingRef) return
variables.loadingRef = true
const { state } = useAsyncState( const { state } = useAsyncState(
queryQueueListPaging({ ...params }).then((res: QueueRes) => { queryQueueListPaging({ ...params }).then((res: QueueRes) => {
variables.tableData = res.totalList.map((item, unused) => { variables.tableData = res.totalList.map((item, unused) => {
...@@ -110,6 +113,7 @@ export function useTable() { ...@@ -110,6 +113,7 @@ export function useTable() {
} }
}) as any }) as any
variables.totalPage = res.totalPage variables.totalPage = res.totalPage
variables.loadingRef = false
}), }),
{} {}
) )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册