This commit is contained in:
parent
82f48a4b80
commit
1d5f77f3a6
5 changed files with 118 additions and 1 deletions
|
|
@ -33,6 +33,7 @@ import {
|
|||
SaveButton,
|
||||
UndoButton,
|
||||
ToggleButton,
|
||||
PasteButton,
|
||||
} from 'components/button';
|
||||
import TableProduct from 'src/components/04_product-service/TableProduct.vue';
|
||||
import PaginationPageSize from 'src/components/PaginationPageSize.vue';
|
||||
|
|
@ -40,7 +41,7 @@ import PaginationPageSize from 'src/components/PaginationPageSize.vue';
|
|||
import useFlowStore from 'stores/flow';
|
||||
|
||||
import { dateFormat } from 'src/utils/datetime';
|
||||
import { formatNumberDecimal, isRoleInclude } from 'stores/utils';
|
||||
import { formatNumberDecimal, isRoleInclude, notify } from 'stores/utils';
|
||||
const { getWorkflowTemplate } = useWorkflowTemplate();
|
||||
|
||||
import { Status } from 'stores/types';
|
||||
|
|
@ -67,6 +68,7 @@ import {
|
|||
} from 'src/stores/workflow-template/types';
|
||||
import { useWorkflowTemplate } from 'src/stores/workflow-template';
|
||||
import { deepEquals } from 'src/utils/arr';
|
||||
import { toRaw } from 'vue';
|
||||
|
||||
const flowStore = useFlowStore();
|
||||
const navigatorStore = useNavigator();
|
||||
|
|
@ -98,6 +100,10 @@ const {
|
|||
deleteWork,
|
||||
} = productServiceStore;
|
||||
|
||||
const currentCopy = ref<{
|
||||
id: string | undefined;
|
||||
type: 'service' | 'product';
|
||||
}>();
|
||||
const { workNameItems } = storeToRefs(productServiceStore);
|
||||
const allStat = ref<{ mode: string; count: number }[]>([]);
|
||||
const stat = ref<
|
||||
|
|
@ -1831,6 +1837,67 @@ function handleSubmitSameWorkflow() {
|
|||
);
|
||||
}
|
||||
|
||||
async function paste() {
|
||||
if (
|
||||
!!currentCopy.value &&
|
||||
currentCopy.value.type === 'service' &&
|
||||
!!currentCopy.value.id
|
||||
)
|
||||
dialogWarningClose(t, {
|
||||
message: t('dialog.message.warningPaste'),
|
||||
action: async () => {
|
||||
const res = await fetchListServiceById(currentCopy.value.id);
|
||||
if (res) {
|
||||
formService.value = {
|
||||
code: res.code,
|
||||
name: res.name,
|
||||
detail: res.detail,
|
||||
attributes: res.attributes,
|
||||
work: res.work.map((v) => ({
|
||||
id: v.id,
|
||||
name: v.name,
|
||||
attributes: v.attributes,
|
||||
product: v.productOnWork.map((productOnWorkItem) => ({
|
||||
id: productOnWorkItem.product.id,
|
||||
installmentNo: productOnWorkItem.installmentNo,
|
||||
stepCount: productOnWorkItem.stepCount,
|
||||
})),
|
||||
})),
|
||||
status: res.status,
|
||||
productGroupId: res.productGroupId,
|
||||
selectedImage: res.selectedImage,
|
||||
installments: res.installments,
|
||||
};
|
||||
|
||||
workItems.value = res.work.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
attributes: item.attributes,
|
||||
product: item.productOnWork.map((productOnWorkItem) => {
|
||||
return {
|
||||
...productOnWorkItem.product,
|
||||
nameEn: productOnWorkItem.product.name,
|
||||
installmentNo: productOnWorkItem.installmentNo,
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
else {
|
||||
dialog({
|
||||
color: 'warning',
|
||||
icon: 'mdi-alert',
|
||||
title: t('form.warning.title'),
|
||||
actionText: t('dialog.action.ok'),
|
||||
message: t('dialog.message.warningCopyEmpty'),
|
||||
action: async () => {},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formService.value.attributes.workflowId,
|
||||
async (a, b) => {
|
||||
|
|
@ -3127,8 +3194,18 @@ watch(
|
|||
"
|
||||
/>
|
||||
<KebabAction
|
||||
:use-copy="productAndServiceTab === 'service'"
|
||||
:status="props.row.status"
|
||||
:id-name="props.row.name"
|
||||
@copy="
|
||||
() => {
|
||||
notify('create', $t('dialog.message.copy'));
|
||||
currentCopy = {
|
||||
id: props.row.id,
|
||||
type: productAndServiceTab,
|
||||
};
|
||||
}
|
||||
"
|
||||
@view="
|
||||
async () => {
|
||||
if (props.row.type === 'product') {
|
||||
|
|
@ -4422,6 +4499,11 @@ watch(
|
|||
@click="serviceTreeView = false"
|
||||
/>
|
||||
</div>
|
||||
<PasteButton
|
||||
id="btn-info-basic-paste"
|
||||
icon-only
|
||||
@click="() => paste()"
|
||||
/>
|
||||
<SaveButton id="btn-info-basic-save" icon-only type="submit" />
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue