|
|
@ -17,7 +17,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
import { h, ref, reactive } from 'vue' |
|
|
|
import { h, ref, reactive } from 'vue' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { useRouter, RouterLink } from 'vue-router' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import type { Router } from 'vue-router' |
|
|
|
import type { Router } from 'vue-router' |
|
|
|
import type { TableColumns } from 'naive-ui/es/data-table/src/interface' |
|
|
|
import type { TableColumns } from 'naive-ui/es/data-table/src/interface' |
|
|
|
import { useAsyncState } from '@vueuse/core' |
|
|
|
import { useAsyncState } from '@vueuse/core' |
|
|
@ -38,38 +38,61 @@ 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: {}, |
|
|
|
|
|
|
|
tableData: [], |
|
|
|
|
|
|
|
projectCode: ref(Number(router.currentRoute.value.params.projectCode)), |
|
|
|
|
|
|
|
page: ref(1), |
|
|
|
|
|
|
|
pageSize: ref(10), |
|
|
|
|
|
|
|
searchVal: ref(), |
|
|
|
|
|
|
|
totalPage: ref(1), |
|
|
|
|
|
|
|
showRef: ref(false), |
|
|
|
|
|
|
|
startShowRef: ref(false), |
|
|
|
|
|
|
|
timingShowRef: ref(false), |
|
|
|
|
|
|
|
versionShowRef: ref(false) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const createColumns = (variables: any) => { |
|
|
|
|
|
|
|
variables.columns = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
title: t('project.workflow.id'), |
|
|
|
title: t('project.workflow.id'), |
|
|
|
key: 'id', |
|
|
|
key: 'id', |
|
|
|
width: 50, |
|
|
|
width: 50, |
|
|
|
render: (_row, index) => index + 1 |
|
|
|
render: (row, index) => index + 1 |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
title: t('project.workflow.workflow_name'), |
|
|
|
title: t('project.workflow.workflow_name'), |
|
|
|
key: 'name', |
|
|
|
key: 'name', |
|
|
|
width: 200, |
|
|
|
width: 200, |
|
|
|
render: (_row) => ( |
|
|
|
render: (row) => |
|
|
|
<NEllipsis |
|
|
|
h( |
|
|
|
style={{ |
|
|
|
NEllipsis, |
|
|
|
maxWidth: '200px' |
|
|
|
{ style: 'max-width: 200px; color: #2080f0' }, |
|
|
|
}} |
|
|
|
{ |
|
|
|
> |
|
|
|
default: () => |
|
|
|
<RouterLink |
|
|
|
h( |
|
|
|
to={{ |
|
|
|
'a', |
|
|
|
path: `/projects/${_row.projectCode}/workflow/definitions/${_row.code}` |
|
|
|
{ |
|
|
|
}} |
|
|
|
href: 'javascript:', |
|
|
|
> |
|
|
|
class: styles.links, |
|
|
|
{_row.name} |
|
|
|
onClick: () => |
|
|
|
</RouterLink> |
|
|
|
router.push({ |
|
|
|
</NEllipsis> |
|
|
|
name: 'workflow-definition-detail', |
|
|
|
|
|
|
|
params: { code: row.code } |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
row.name |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
tooltip: () => row.name |
|
|
|
|
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
title: t('project.workflow.status'), |
|
|
|
title: t('project.workflow.status'), |
|
|
|
key: 'releaseState', |
|
|
|
key: 'releaseState', |
|
|
|
render: (_row) => |
|
|
|
render: (row) => |
|
|
|
_row.releaseState === 'ONLINE' |
|
|
|
row.releaseState === 'ONLINE' |
|
|
|
? t('project.workflow.up_line') |
|
|
|
? t('project.workflow.up_line') |
|
|
|
: t('project.workflow.down_line') |
|
|
|
: t('project.workflow.down_line') |
|
|
|
}, |
|
|
|
}, |
|
|
@ -98,8 +121,8 @@ export function useTable() { |
|
|
|
{ |
|
|
|
{ |
|
|
|
title: t('project.workflow.schedule_publish_status'), |
|
|
|
title: t('project.workflow.schedule_publish_status'), |
|
|
|
key: 'scheduleReleaseState', |
|
|
|
key: 'scheduleReleaseState', |
|
|
|
render: (_row) => { |
|
|
|
render: (row) => { |
|
|
|
if (_row.scheduleReleaseState === 'ONLINE') { |
|
|
|
if (row.scheduleReleaseState === 'ONLINE') { |
|
|
|
return h( |
|
|
|
return h( |
|
|
|
NTag, |
|
|
|
NTag, |
|
|
|
{ type: 'success', size: 'small' }, |
|
|
|
{ type: 'success', size: 'small' }, |
|
|
@ -107,7 +130,7 @@ export function useTable() { |
|
|
|
default: () => t('project.workflow.up_line') |
|
|
|
default: () => t('project.workflow.up_line') |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} else if (_row.scheduleReleaseState === 'OFFLINE') { |
|
|
|
} else if (row.scheduleReleaseState === 'OFFLINE') { |
|
|
|
return h( |
|
|
|
return h( |
|
|
|
NTag, |
|
|
|
NTag, |
|
|
|
{ type: 'warning', size: 'small' }, |
|
|
|
{ type: 'warning', size: 'small' }, |
|
|
@ -139,8 +162,8 @@ export function useTable() { |
|
|
|
onGotoTimingManage: () => gotoTimingManage(row) |
|
|
|
onGotoTimingManage: () => gotoTimingManage(row) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] as TableColumns<any> |
|
|
|
|
|
|
|
} |
|
|
|
const startWorkflow = (row: any) => { |
|
|
|
const startWorkflow = (row: any) => { |
|
|
|
variables.startShowRef = true |
|
|
|
variables.startShowRef = true |
|
|
|
variables.row = row |
|
|
|
variables.row = row |
|
|
@ -258,21 +281,6 @@ export function useTable() { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const variables = reactive({ |
|
|
|
|
|
|
|
columns, |
|
|
|
|
|
|
|
row: {}, |
|
|
|
|
|
|
|
tableData: [], |
|
|
|
|
|
|
|
projectCode: ref(Number(router.currentRoute.value.params.projectCode)), |
|
|
|
|
|
|
|
page: ref(1), |
|
|
|
|
|
|
|
pageSize: ref(10), |
|
|
|
|
|
|
|
searchVal: ref(), |
|
|
|
|
|
|
|
totalPage: ref(1), |
|
|
|
|
|
|
|
showRef: ref(false), |
|
|
|
|
|
|
|
startShowRef: ref(false), |
|
|
|
|
|
|
|
timingShowRef: ref(false), |
|
|
|
|
|
|
|
versionShowRef: ref(false) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getTableData = (params: IDefinitionParam) => { |
|
|
|
const getTableData = (params: IDefinitionParam) => { |
|
|
|
const { state } = useAsyncState( |
|
|
|
const { state } = useAsyncState( |
|
|
|
queryListPaging({ ...params }, variables.projectCode).then((res: any) => { |
|
|
|
queryListPaging({ ...params }, variables.projectCode).then((res: any) => { |
|
|
@ -288,6 +296,7 @@ export function useTable() { |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
variables, |
|
|
|
variables, |
|
|
|
|
|
|
|
createColumns, |
|
|
|
getTableData |
|
|
|
getTableData |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |