diff --git a/src/components/button/index.ts b/src/components/button/index.ts
index d9b59582..9f3367ef 100644
--- a/src/components/button/index.ts
+++ b/src/components/button/index.ts
@@ -14,3 +14,4 @@ export { default as PrintButton } from './PrintButton.vue';
export { default as StateButton } from './StateButton.vue';
export { default as NextButton } from './NextButton.vue';
export { default as ImportButton } from './ImportButton.vue';
+export { default as PasteButton } from './PasteButton.vue';
diff --git a/src/components/shared/KebabAction.vue b/src/components/shared/KebabAction.vue
index 4dd095db..7bea6b36 100644
--- a/src/components/shared/KebabAction.vue
+++ b/src/components/shared/KebabAction.vue
@@ -16,6 +16,7 @@ const props = withDefaults(
useUpload?: boolean;
useCancel?: boolean;
useRejectCancel?: boolean;
+ useCopy?: boolean;
disableCancel?: boolean;
disableDelete?: boolean;
}>(),
@@ -31,6 +32,7 @@ defineEmits<{
(e: 'link'): void;
(e: 'upload'): void;
(e: 'delete'): void;
+ (e: 'copy'): void;
(e: 'cancel'): void;
(e: 'rejectCancel'): void;
(e: 'changeStatus'): void;
@@ -172,6 +174,27 @@ watch(
+ $emit('copy')"
+ >
+
+
+ {{ $t('general.copy') }}
+
+
+
();
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(
"
/>
{
+ 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"
/>
+ paste()"
+ />