fix: old work name select (#53)
This commit is contained in:
parent
ef61354e67
commit
eef8547683
1 changed files with 28 additions and 23 deletions
|
|
@ -20,8 +20,8 @@ const productServiceStore = useProductServiceStore();
|
||||||
const optionStore = useOptionStore();
|
const optionStore = useOptionStore();
|
||||||
const workflowStore = useWorkflowTemplate();
|
const workflowStore = useWorkflowTemplate();
|
||||||
|
|
||||||
// const { fetchListOfWork } = productServiceStore;
|
const { fetchListOfWork } = productServiceStore;
|
||||||
const { splitPay } = storeToRefs(productServiceStore);
|
const { splitPay, workNameItems } = storeToRefs(productServiceStore);
|
||||||
|
|
||||||
const { getWorkflowTemplateList } = workflowStore;
|
const { getWorkflowTemplateList } = workflowStore;
|
||||||
const { data: workflowData } = storeToRefs(workflowStore);
|
const { data: workflowData } = storeToRefs(workflowStore);
|
||||||
|
|
@ -57,7 +57,7 @@ const productItems = defineModel<(Product & { nameEn: string })[]>(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// const refMenu = ref();
|
const refMenu = ref();
|
||||||
|
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
(e: 'moveWorkUp'): void;
|
(e: 'moveWorkUp'): void;
|
||||||
|
|
@ -72,24 +72,10 @@ defineEmits<{
|
||||||
(e: 'workProperties'): void;
|
(e: 'workProperties'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// watch(
|
|
||||||
// () => workNameItems.value,
|
|
||||||
// (c, o) => {
|
|
||||||
// const list = c.map((v: { name: string }) => v.name);
|
|
||||||
// const oldList = o.map((v: { name: string }) => v.name);
|
|
||||||
// const index = oldList.indexOf(workName.value);
|
|
||||||
|
|
||||||
// if (list[index] !== oldList[index] && !list.includes(workName.value)) {
|
|
||||||
// if (list.length - 1 === index - 1) workName.value = list[index - 1];
|
|
||||||
// else workName.value = list[index];
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
|
|
||||||
function mapFlowName(id: string): string {
|
function mapFlowName(id: string): string {
|
||||||
if (!id) return workName.value || '';
|
if (!id) return workName.value || '';
|
||||||
const targetFlow = workflowData.value.find((w) => w.id === id);
|
const targetFlow = workflowData.value.find((w) => w.id === id);
|
||||||
workName.value = targetFlow?.name;
|
// workName.value = targetFlow?.name;
|
||||||
return targetFlow?.name || attributes.value.workflowName || '';
|
return targetFlow?.name || attributes.value.workflowName || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,6 +139,23 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => workNameItems.value,
|
||||||
|
(c, o) => {
|
||||||
|
const list = c.map((v: { name: string }) => v.name);
|
||||||
|
const oldList = o.map((v: { name: string }) => v.name);
|
||||||
|
const index = oldList.indexOf(workName.value || '');
|
||||||
|
|
||||||
|
if (
|
||||||
|
list[index] !== oldList[index] &&
|
||||||
|
!list.includes(workName.value || '')
|
||||||
|
) {
|
||||||
|
if (list.length - 1 === index - 1) workName.value = list[index - 1];
|
||||||
|
else workName.value = list[index];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => attributes.value.workflowId,
|
() => attributes.value.workflowId,
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -203,7 +206,7 @@ watch(
|
||||||
style="color: hsl(var(--text-mute-2))"
|
style="color: hsl(var(--text-mute-2))"
|
||||||
@click.stop="$emit('moveWorkDown')"
|
@click.stop="$emit('moveWorkDown')"
|
||||||
/>
|
/>
|
||||||
<!-- <div
|
<div
|
||||||
:for="`select-work-name-${index + 1}`"
|
:for="`select-work-name-${index + 1}`"
|
||||||
class="col q-py-sm q-px-md"
|
class="col q-py-sm q-px-md"
|
||||||
style="background-color: var(--surface-1); z-index: 2"
|
style="background-color: var(--surface-1); z-index: 2"
|
||||||
|
|
@ -272,8 +275,8 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-menu>
|
</q-menu>
|
||||||
</div> -->
|
</div>
|
||||||
<SelectInput
|
<!-- <SelectInput
|
||||||
:readonly
|
:readonly
|
||||||
incremental
|
incremental
|
||||||
:model-value="mapFlowName(attributes.workflowId)"
|
:model-value="mapFlowName(attributes.workflowId)"
|
||||||
|
|
@ -293,7 +296,7 @@ watch(
|
||||||
}}:
|
}}:
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</SelectInput>
|
</SelectInput> -->
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="!readonly"
|
v-if="!readonly"
|
||||||
id="btn-delete-work"
|
id="btn-delete-work"
|
||||||
|
|
@ -664,6 +667,7 @@ watch(
|
||||||
|
|
||||||
<span
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
|
attributes.workflowId &&
|
||||||
attributes.stepProperties?.every(
|
attributes.stepProperties?.every(
|
||||||
(s) => s.attributes.length === 0,
|
(s) => s.attributes.length === 0,
|
||||||
)
|
)
|
||||||
|
|
@ -700,7 +704,8 @@ watch(
|
||||||
<div>
|
<div>
|
||||||
{{ $t('productService.service.totalProductWork') }}
|
{{ $t('productService.service.totalProductWork') }}
|
||||||
<span class="app-text-muted-2">
|
<span class="app-text-muted-2">
|
||||||
{{ mapFlowName(attributes.workflowId) }}
|
<!-- {{ mapFlowName(attributes.workflowId) }} -->
|
||||||
|
{{ workName }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue