Browse Source

[Fix][UI Next][V1.0.0-Alpha] Fix the regularly manage multilingual switching issues. (#8718)

3.0.0/version-upgrade
songjianet 3 years ago committed by GitHub
parent
commit
9c162c86c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/timing/index.tsx
  2. 41
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/timing/use-table.ts

9
dolphinscheduler-ui-next/src/views/projects/workflow/definition/timing/index.tsx

@ -18,7 +18,7 @@
import Card from '@/components/card' import Card from '@/components/card'
import { ArrowLeftOutlined } from '@vicons/antd' import { ArrowLeftOutlined } from '@vicons/antd'
import { NButton, NDataTable, NIcon, NPagination } from 'naive-ui' import { NButton, NDataTable, NIcon, NPagination } from 'naive-ui'
import { defineComponent, onMounted, toRefs } from 'vue' import { defineComponent, onMounted, toRefs, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'
@ -29,7 +29,7 @@ import styles from '../index.module.scss'
export default defineComponent({ export default defineComponent({
name: 'WorkflowDefinitionTiming', name: 'WorkflowDefinitionTiming',
setup() { setup() {
const { variables, getTableData } = useTable() const { variables, createColumns, getTableData } = useTable()
const requestData = () => { const requestData = () => {
getTableData({ getTableData({
@ -54,9 +54,14 @@ export default defineComponent({
} }
onMounted(() => { onMounted(() => {
createColumns(variables)
requestData() requestData()
}) })
watch(useI18n().locale, () => {
createColumns(variables)
})
return { return {
requestData, requestData,
handleSearch, handleSearch,

41
dolphinscheduler-ui-next/src/views/projects/workflow/definition/timing/use-table.ts

@ -47,23 +47,36 @@ 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)
})
const createColumns = (variables: any) => {
variables.columns = [
{ {
title: '#', title: '#',
key: 'id', key: 'id',
width: 50, width: 50,
render: (_row, index) => index + 1 render: (row: any, index: number) => index + 1
}, },
{ {
title: t('project.workflow.workflow_name'), title: t('project.workflow.workflow_name'),
key: 'processDefinitionName', key: 'processDefinitionName',
width: 200, width: 200,
render: (_row) => render: (row: any) =>
h( h(
NEllipsis, NEllipsis,
{ style: 'max-width: 200px' }, { style: 'max-width: 200px' },
{ {
default: () => _row.processDefinitionName default: () => row.processDefinitionName
} }
) )
}, },
@ -86,8 +99,8 @@ export function useTable() {
{ {
title: t('project.workflow.status'), title: t('project.workflow.status'),
key: 'releaseState', key: 'releaseState',
render: (_row) => render: (row: any) =>
_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')
}, },
@ -104,7 +117,7 @@ export function useTable() {
key: 'operation', key: 'operation',
fixed: 'right', fixed: 'right',
className: styles.operation, className: styles.operation,
render: (row) => { render: (row: any) => {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
h( h(
@ -196,24 +209,13 @@ export function useTable() {
} }
} }
] ]
}
const handleEdit = (row: any) => { const handleEdit = (row: any) => {
variables.showRef = true variables.showRef = true
variables.row = row variables.row = row
} }
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)
})
const getTableData = (params: ISearchParam) => { const getTableData = (params: ISearchParam) => {
const definitionCode = Number( const definitionCode = Number(
router.currentRoute.value.params.definitionCode router.currentRoute.value.params.definitionCode
@ -266,6 +268,7 @@ export function useTable() {
return { return {
variables, variables,
createColumns,
getTableData getTableData
} }
} }

Loading…
Cancel
Save