|
|
@ -29,7 +29,9 @@ import { |
|
|
|
import { Router, useRouter } from 'vue-router' |
|
|
|
import { Router, useRouter } from 'vue-router' |
|
|
|
import type { |
|
|
|
import type { |
|
|
|
IJsonItem, |
|
|
|
IJsonItem, |
|
|
|
IDependpendItem, |
|
|
|
IDependentItem, |
|
|
|
|
|
|
|
IDependentItemOptions, |
|
|
|
|
|
|
|
IDependTaskOptions, |
|
|
|
IDependTask, |
|
|
|
IDependTask, |
|
|
|
ITaskState, |
|
|
|
ITaskState, |
|
|
|
IDateType |
|
|
|
IDateType |
|
|
@ -49,6 +51,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
const taskCache = {} as { |
|
|
|
const taskCache = {} as { |
|
|
|
[key: number]: { label: string; value: number }[] |
|
|
|
[key: number]: { label: string; value: number }[] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const selectOptions = ref([] as IDependTaskOptions[]) |
|
|
|
|
|
|
|
|
|
|
|
const CYCLE_LIST = [ |
|
|
|
const CYCLE_LIST = [ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -236,25 +239,30 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
watch( |
|
|
|
watch( |
|
|
|
() => model.dependTaskList, |
|
|
|
() => model.dependTaskList, |
|
|
|
(value) => { |
|
|
|
(value) => { |
|
|
|
value.forEach((item: IDependTask) => { |
|
|
|
selectOptions.value = [] |
|
|
|
|
|
|
|
value.forEach((item: IDependTask, taskIndex: number) => { |
|
|
|
if (!item.dependItemList?.length) return |
|
|
|
if (!item.dependItemList?.length) return |
|
|
|
|
|
|
|
|
|
|
|
item.dependItemList?.forEach(async (dependItem: IDependpendItem) => { |
|
|
|
const itemListOptions = ref([] as IDependentItemOptions[]) |
|
|
|
|
|
|
|
item.dependItemList?.forEach(async (dependItem: IDependentItem, itemIndex: number) => { |
|
|
|
|
|
|
|
itemListOptions.value[itemIndex] = {} |
|
|
|
if (dependItem.projectCode) { |
|
|
|
if (dependItem.projectCode) { |
|
|
|
dependItem.definitionCodeOptions = await getProcessList( |
|
|
|
itemListOptions.value[itemIndex].definitionCodeOptions = await getProcessList( |
|
|
|
dependItem.projectCode |
|
|
|
dependItem.projectCode |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
if (dependItem.projectCode && dependItem.definitionCode) { |
|
|
|
if (dependItem.projectCode && dependItem.definitionCode) { |
|
|
|
dependItem.depTaskCodeOptions = await getTaskList( |
|
|
|
itemListOptions.value[itemIndex].depTaskCodeOptions = await getTaskList( |
|
|
|
dependItem.projectCode, |
|
|
|
dependItem.projectCode, |
|
|
|
dependItem.definitionCode |
|
|
|
dependItem.definitionCode |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
if (dependItem.cycle) { |
|
|
|
if (dependItem.cycle) { |
|
|
|
dependItem.dateOptions = DATE_LIST[dependItem.cycle] |
|
|
|
itemListOptions.value[itemIndex].dateOptions = DATE_LIST[dependItem.cycle] |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
selectOptions.value[taskIndex] = {} as IDependTaskOptions |
|
|
|
|
|
|
|
selectOptions.value[taskIndex].dependItemList = itemListOptions.value |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
@ -277,7 +285,13 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
filterable: true, |
|
|
|
filterable: true, |
|
|
|
onUpdateValue: async (projectCode: number) => { |
|
|
|
onUpdateValue: async (projectCode: number) => { |
|
|
|
const item = model.dependTaskList[i].dependItemList[j] |
|
|
|
const item = model.dependTaskList[i].dependItemList[j] |
|
|
|
item.definitionCodeOptions = await getProcessList(projectCode) |
|
|
|
const options = selectOptions?.value[i] || {} |
|
|
|
|
|
|
|
const itemListOptions = options?.dependItemList || [] |
|
|
|
|
|
|
|
const itemOptions = {} as IDependentItemOptions |
|
|
|
|
|
|
|
itemOptions.definitionCodeOptions = await getProcessList(projectCode) |
|
|
|
|
|
|
|
itemListOptions[j] = itemOptions |
|
|
|
|
|
|
|
options.dependItemList = itemListOptions |
|
|
|
|
|
|
|
selectOptions.value[i] = options |
|
|
|
item.depTaskCode = null |
|
|
|
item.depTaskCode = null |
|
|
|
item.definitionCode = null |
|
|
|
item.definitionCode = null |
|
|
|
} |
|
|
|
} |
|
|
@ -303,15 +317,14 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
filterable: true, |
|
|
|
filterable: true, |
|
|
|
onUpdateValue: async (processCode: number) => { |
|
|
|
onUpdateValue: async (processCode: number) => { |
|
|
|
const item = model.dependTaskList[i].dependItemList[j] |
|
|
|
const item = model.dependTaskList[i].dependItemList[j] |
|
|
|
item.depTaskCodeOptions = await getTaskList( |
|
|
|
selectOptions.value[i].dependItemList[j].depTaskCodeOptions = await getTaskList( |
|
|
|
item.projectCode, |
|
|
|
item.projectCode, |
|
|
|
processCode |
|
|
|
processCode |
|
|
|
) |
|
|
|
) |
|
|
|
item.depTaskCode = 0 |
|
|
|
item.depTaskCode = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
options: |
|
|
|
options: selectOptions.value[i]?.dependItemList[j] |
|
|
|
model.dependTaskList[i]?.dependItemList[j] |
|
|
|
|
|
|
|
?.definitionCodeOptions || [], |
|
|
|
?.definitionCodeOptions || [], |
|
|
|
path: `dependTaskList.${i}.dependItemList.${j}.definitionCode`, |
|
|
|
path: `dependTaskList.${i}.dependItemList.${j}.definitionCode`, |
|
|
|
rule: { |
|
|
|
rule: { |
|
|
@ -333,7 +346,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
filterable: true |
|
|
|
filterable: true |
|
|
|
}, |
|
|
|
}, |
|
|
|
options: |
|
|
|
options: |
|
|
|
model.dependTaskList[i]?.dependItemList[j]?.depTaskCodeOptions || |
|
|
|
selectOptions.value[i]?.dependItemList[j]?.depTaskCodeOptions || |
|
|
|
[], |
|
|
|
[], |
|
|
|
path: `dependTaskList.${i}.dependItemList.${j}.depTaskCode`, |
|
|
|
path: `dependTaskList.${i}.dependItemList.${j}.depTaskCode`, |
|
|
|
rule: { |
|
|
|
rule: { |
|
|
@ -353,7 +366,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
name: t('project.node.cycle_time'), |
|
|
|
name: t('project.node.cycle_time'), |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
onUpdateValue: (value: IDateType) => { |
|
|
|
onUpdateValue: (value: IDateType) => { |
|
|
|
model.dependTaskList[i].dependItemList[j].dateOptions = |
|
|
|
selectOptions.value[i].dependItemList[j].dateOptions = |
|
|
|
DATE_LIST[value] |
|
|
|
DATE_LIST[value] |
|
|
|
model.dependTaskList[i].dependItemList[j].dateValue = null |
|
|
|
model.dependTaskList[i].dependItemList[j].dateValue = null |
|
|
|
} |
|
|
|
} |
|
|
@ -376,7 +389,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { |
|
|
|
span: 10, |
|
|
|
span: 10, |
|
|
|
name: ' ', |
|
|
|
name: ' ', |
|
|
|
options: |
|
|
|
options: |
|
|
|
model.dependTaskList[i]?.dependItemList[j]?.dateOptions || [], |
|
|
|
selectOptions.value[i]?.dependItemList[j]?.dateOptions || [], |
|
|
|
path: `dependTaskList.${i}.dependItemList.${j}.dateValue`, |
|
|
|
path: `dependTaskList.${i}.dependItemList.${j}.dateValue`, |
|
|
|
rule: { |
|
|
|
rule: { |
|
|
|
trigger: ['input', 'blur'], |
|
|
|
trigger: ['input', 'blur'], |
|
|
|