|
|
@ -15,18 +15,32 @@ |
|
|
|
* limitations under the License. |
|
|
|
* limitations under the License. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
import { ref, onMounted, watch } from 'vue' |
|
|
|
import { ref, onMounted, watch, h } from 'vue' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
|
|
|
|
import { NIcon } from 'naive-ui' |
|
|
|
import { useRelationCustomParams, useDependentTimeout } from '.' |
|
|
|
import { useRelationCustomParams, useDependentTimeout } from '.' |
|
|
|
|
|
|
|
import { useTaskNodeStore } from '@/store/project/task-node' |
|
|
|
import { queryAllProjectList } from '@/service/modules/projects' |
|
|
|
import { queryAllProjectList } from '@/service/modules/projects' |
|
|
|
|
|
|
|
import { tasksState } from '@/utils/common' |
|
|
|
import { |
|
|
|
import { |
|
|
|
queryProcessDefinitionList, |
|
|
|
queryProcessDefinitionList, |
|
|
|
getTasksByDefinitionList |
|
|
|
getTasksByDefinitionList |
|
|
|
} from '@/service/modules/process-definition' |
|
|
|
} from '@/service/modules/process-definition' |
|
|
|
import type { IJsonItem, IDependpendItem, IDependTask } from '../types' |
|
|
|
import { Router, useRouter } from 'vue-router' |
|
|
|
|
|
|
|
import type { |
|
|
|
|
|
|
|
IJsonItem, |
|
|
|
|
|
|
|
IDependpendItem, |
|
|
|
|
|
|
|
IDependTask, |
|
|
|
|
|
|
|
ITaskState |
|
|
|
|
|
|
|
} from '../types' |
|
|
|
|
|
|
|
|
|
|
|
export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
const { t } = useI18n() |
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
const router: Router = useRouter() |
|
|
|
|
|
|
|
const nodeStore = useTaskNodeStore() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dependentResult = nodeStore.getDependentResult |
|
|
|
|
|
|
|
const TasksStateConfig = tasksState(t) |
|
|
|
const projectList = ref([] as { label: string; value: number }[]) |
|
|
|
const projectList = ref([] as { label: string; value: number }[]) |
|
|
|
const processCache = {} as { |
|
|
|
const processCache = {} as { |
|
|
|
[key: number]: { label: string; value: number }[] |
|
|
|
[key: number]: { label: string; value: number }[] |
|
|
@ -199,6 +213,21 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
return taskList |
|
|
|
return taskList |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const renderState = (item: { |
|
|
|
|
|
|
|
definitionCode: number |
|
|
|
|
|
|
|
depTaskCode: number |
|
|
|
|
|
|
|
cycle: string |
|
|
|
|
|
|
|
dateValue: string |
|
|
|
|
|
|
|
}) => { |
|
|
|
|
|
|
|
if (!item || router.currentRoute.value.name !== 'workflow-instance-detail') |
|
|
|
|
|
|
|
return null |
|
|
|
|
|
|
|
const key = `${item.definitionCode}-${item.depTaskCode}-${item.cycle}-${item.dateValue}` |
|
|
|
|
|
|
|
const state: ITaskState = dependentResult[key] || 'WAITING_THREAD' |
|
|
|
|
|
|
|
return h(NIcon, { size: 24, color: TasksStateConfig[state].color }, () => |
|
|
|
|
|
|
|
h(TasksStateConfig[state].icon) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
getProjectList() |
|
|
|
getProjectList() |
|
|
|
}) |
|
|
|
}) |
|
|
@ -306,6 +335,13 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
name: ' ', |
|
|
|
name: ' ', |
|
|
|
options: |
|
|
|
options: |
|
|
|
model.dependTaskList[i]?.dependItemList[j]?.dateOptions || [] |
|
|
|
model.dependTaskList[i]?.dependItemList[j]?.dateOptions || [] |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
(j = 0) => ({ |
|
|
|
|
|
|
|
type: 'custom', |
|
|
|
|
|
|
|
field: 'state', |
|
|
|
|
|
|
|
span: 2, |
|
|
|
|
|
|
|
name: ' ', |
|
|
|
|
|
|
|
widget: renderState(model.dependTaskList[i]?.dependItemList[j]) |
|
|
|
}) |
|
|
|
}) |
|
|
|
] |
|
|
|
] |
|
|
|
}), |
|
|
|
}), |
|
|
|