|
|
@ -35,7 +35,19 @@ export function useTable( |
|
|
|
const { t } = useI18n() |
|
|
|
const { t } = useI18n() |
|
|
|
const router: Router = useRouter() |
|
|
|
const router: Router = useRouter() |
|
|
|
|
|
|
|
|
|
|
|
const columns: TableColumns<any> = [ |
|
|
|
const variables = reactive({ |
|
|
|
|
|
|
|
columns: [], |
|
|
|
|
|
|
|
row: {} as any, |
|
|
|
|
|
|
|
tableData: [], |
|
|
|
|
|
|
|
page: ref(1), |
|
|
|
|
|
|
|
totalPage: ref(1), |
|
|
|
|
|
|
|
pageSize: ref(10), |
|
|
|
|
|
|
|
projectCode: ref(Number(router.currentRoute.value.params.projectCode)), |
|
|
|
|
|
|
|
loadingRef: ref(false) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const createColumns = (variables: any) => { |
|
|
|
|
|
|
|
variables.columns = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
title: '#', |
|
|
|
title: '#', |
|
|
|
key: 'id', |
|
|
|
key: 'id', |
|
|
@ -143,18 +155,8 @@ export function useTable( |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] as TableColumns<any> |
|
|
|
|
|
|
|
} |
|
|
|
const variables = reactive({ |
|
|
|
|
|
|
|
columns, |
|
|
|
|
|
|
|
row: {} as any, |
|
|
|
|
|
|
|
tableData: [], |
|
|
|
|
|
|
|
page: ref(1), |
|
|
|
|
|
|
|
totalPage: ref(1), |
|
|
|
|
|
|
|
pageSize: ref(10), |
|
|
|
|
|
|
|
projectCode: ref(Number(router.currentRoute.value.params.projectCode)), |
|
|
|
|
|
|
|
loadingRef: ref(false) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getTableData = (row: any) => { |
|
|
|
const getTableData = (row: any) => { |
|
|
|
if (variables.loadingRef) return |
|
|
|
if (variables.loadingRef) return |
|
|
@ -178,9 +180,9 @@ export function useTable( |
|
|
|
const handleSwitchVersion = (version: number) => { |
|
|
|
const handleSwitchVersion = (version: number) => { |
|
|
|
switchVersion(variables.projectCode, variables.row.code, version).then( |
|
|
|
switchVersion(variables.projectCode, variables.row.code, version).then( |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
|
|
|
|
variables.row.version = version |
|
|
|
window.$message.success(t('project.workflow.success')) |
|
|
|
window.$message.success(t('project.workflow.success')) |
|
|
|
ctx.emit('updateList') |
|
|
|
ctx.emit('updateList') |
|
|
|
getTableData(variables.row) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -190,6 +192,9 @@ export function useTable( |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
window.$message.success(t('project.workflow.success')) |
|
|
|
window.$message.success(t('project.workflow.success')) |
|
|
|
ctx.emit('updateList') |
|
|
|
ctx.emit('updateList') |
|
|
|
|
|
|
|
if (variables.tableData.length === 1 && variables.page > 1) { |
|
|
|
|
|
|
|
variables.page -= 1 |
|
|
|
|
|
|
|
} |
|
|
|
getTableData(variables.row) |
|
|
|
getTableData(variables.row) |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
@ -197,6 +202,7 @@ export function useTable( |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
variables, |
|
|
|
variables, |
|
|
|
|
|
|
|
createColumns, |
|
|
|
getTableData |
|
|
|
getTableData |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|