This commit is contained in:
parent
82f48a4b80
commit
1d5f77f3a6
5 changed files with 118 additions and 1 deletions
|
|
@ -14,3 +14,4 @@ export { default as PrintButton } from './PrintButton.vue';
|
||||||
export { default as StateButton } from './StateButton.vue';
|
export { default as StateButton } from './StateButton.vue';
|
||||||
export { default as NextButton } from './NextButton.vue';
|
export { default as NextButton } from './NextButton.vue';
|
||||||
export { default as ImportButton } from './ImportButton.vue';
|
export { default as ImportButton } from './ImportButton.vue';
|
||||||
|
export { default as PasteButton } from './PasteButton.vue';
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ const props = withDefaults(
|
||||||
useUpload?: boolean;
|
useUpload?: boolean;
|
||||||
useCancel?: boolean;
|
useCancel?: boolean;
|
||||||
useRejectCancel?: boolean;
|
useRejectCancel?: boolean;
|
||||||
|
useCopy?: boolean;
|
||||||
disableCancel?: boolean;
|
disableCancel?: boolean;
|
||||||
disableDelete?: boolean;
|
disableDelete?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
|
|
@ -31,6 +32,7 @@ defineEmits<{
|
||||||
(e: 'link'): void;
|
(e: 'link'): void;
|
||||||
(e: 'upload'): void;
|
(e: 'upload'): void;
|
||||||
(e: 'delete'): void;
|
(e: 'delete'): void;
|
||||||
|
(e: 'copy'): void;
|
||||||
(e: 'cancel'): void;
|
(e: 'cancel'): void;
|
||||||
(e: 'rejectCancel'): void;
|
(e: 'rejectCancel'): void;
|
||||||
(e: 'changeStatus'): void;
|
(e: 'changeStatus'): void;
|
||||||
|
|
@ -172,6 +174,27 @@ watch(
|
||||||
</span>
|
</span>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
|
<q-item
|
||||||
|
v-if="useCopy"
|
||||||
|
v-close-popup
|
||||||
|
dense
|
||||||
|
clickable
|
||||||
|
class="row q-py-sm"
|
||||||
|
style="white-space: nowrap"
|
||||||
|
:id="`btn-kebab-copy-${idName}`"
|
||||||
|
@click.stop="() => $emit('copy')"
|
||||||
|
>
|
||||||
|
<q-icon
|
||||||
|
size="xs"
|
||||||
|
class="col-3"
|
||||||
|
name="mdi-content-copy"
|
||||||
|
style="color: hsl(var(--teal-5-hsl))"
|
||||||
|
/>
|
||||||
|
<span class="col-9 q-px-md flex items-center">
|
||||||
|
{{ $t('general.copy') }}
|
||||||
|
</span>
|
||||||
|
</q-item>
|
||||||
|
|
||||||
<q-item
|
<q-item
|
||||||
v-if="useCancel"
|
v-if="useCancel"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,8 @@ export default {
|
||||||
draw: 'Draw',
|
draw: 'Draw',
|
||||||
newUpload: 'New Upload',
|
newUpload: 'New Upload',
|
||||||
nativeLanguage: '{msg} Native Language',
|
nativeLanguage: '{msg} Native Language',
|
||||||
|
copy: 'Copy',
|
||||||
|
paste: 'Paste',
|
||||||
},
|
},
|
||||||
|
|
||||||
menu: {
|
menu: {
|
||||||
|
|
@ -1060,6 +1062,10 @@ export default {
|
||||||
confirmDebitNoteAccept: 'Confirm acceptance of the debit note.',
|
confirmDebitNoteAccept: 'Confirm acceptance of the debit note.',
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
|
copy: 'Copy',
|
||||||
|
warningPaste:
|
||||||
|
'Do you want to replace the data with the newly copied information?',
|
||||||
|
warningCopyEmpty: 'You have not copied any data yet',
|
||||||
quotationAccept: 'Once accepted, no further modifications can be made',
|
quotationAccept: 'Once accepted, no further modifications can be made',
|
||||||
beingUse: '"{msg}" is being used.',
|
beingUse: '"{msg}" is being used.',
|
||||||
incompleteDataEntry: 'Incomplete data entry on {tap} page',
|
incompleteDataEntry: 'Incomplete data entry on {tap} page',
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,8 @@ export default {
|
||||||
draw: 'วาด',
|
draw: 'วาด',
|
||||||
newUpload: 'อัปโหลดใหม่',
|
newUpload: 'อัปโหลดใหม่',
|
||||||
nativeLanguage: '{msg} ภาษาต้นทาง',
|
nativeLanguage: '{msg} ภาษาต้นทาง',
|
||||||
|
copy: 'คัดลอก',
|
||||||
|
paste: 'วาง',
|
||||||
},
|
},
|
||||||
|
|
||||||
menu: {
|
menu: {
|
||||||
|
|
@ -1051,6 +1053,9 @@ export default {
|
||||||
confirmDebitNoteAccept: 'ยืนยันการตอบรับใบเพิ่มหนี้',
|
confirmDebitNoteAccept: 'ยืนยันการตอบรับใบเพิ่มหนี้',
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
|
copy: 'คัดลอก',
|
||||||
|
warningPaste: 'คุณต้องการที่จะเเทนที่ข้อมูลที่คัดลอกมาใหม่ใช่หรือไม่',
|
||||||
|
warningCopyEmpty: 'คุณยังไม่ได้คัดลอกข้อมูล',
|
||||||
quotationAccept: 'เมื่อตอบรับเเล้วจะไม่สามารถแก้ไขได้อีก',
|
quotationAccept: 'เมื่อตอบรับเเล้วจะไม่สามารถแก้ไขได้อีก',
|
||||||
beingUse: '"{msg}" มีการใช้งานอยู่',
|
beingUse: '"{msg}" มีการใช้งานอยู่',
|
||||||
incompleteDataEntry: 'กรอกข้อมูลไม่ครบในหน้า {tap}',
|
incompleteDataEntry: 'กรอกข้อมูลไม่ครบในหน้า {tap}',
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import {
|
||||||
SaveButton,
|
SaveButton,
|
||||||
UndoButton,
|
UndoButton,
|
||||||
ToggleButton,
|
ToggleButton,
|
||||||
|
PasteButton,
|
||||||
} from 'components/button';
|
} from 'components/button';
|
||||||
import TableProduct from 'src/components/04_product-service/TableProduct.vue';
|
import TableProduct from 'src/components/04_product-service/TableProduct.vue';
|
||||||
import PaginationPageSize from 'src/components/PaginationPageSize.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 useFlowStore from 'stores/flow';
|
||||||
|
|
||||||
import { dateFormat } from 'src/utils/datetime';
|
import { dateFormat } from 'src/utils/datetime';
|
||||||
import { formatNumberDecimal, isRoleInclude } from 'stores/utils';
|
import { formatNumberDecimal, isRoleInclude, notify } from 'stores/utils';
|
||||||
const { getWorkflowTemplate } = useWorkflowTemplate();
|
const { getWorkflowTemplate } = useWorkflowTemplate();
|
||||||
|
|
||||||
import { Status } from 'stores/types';
|
import { Status } from 'stores/types';
|
||||||
|
|
@ -67,6 +68,7 @@ import {
|
||||||
} from 'src/stores/workflow-template/types';
|
} from 'src/stores/workflow-template/types';
|
||||||
import { useWorkflowTemplate } from 'src/stores/workflow-template';
|
import { useWorkflowTemplate } from 'src/stores/workflow-template';
|
||||||
import { deepEquals } from 'src/utils/arr';
|
import { deepEquals } from 'src/utils/arr';
|
||||||
|
import { toRaw } from 'vue';
|
||||||
|
|
||||||
const flowStore = useFlowStore();
|
const flowStore = useFlowStore();
|
||||||
const navigatorStore = useNavigator();
|
const navigatorStore = useNavigator();
|
||||||
|
|
@ -98,6 +100,10 @@ const {
|
||||||
deleteWork,
|
deleteWork,
|
||||||
} = productServiceStore;
|
} = productServiceStore;
|
||||||
|
|
||||||
|
const currentCopy = ref<{
|
||||||
|
id: string | undefined;
|
||||||
|
type: 'service' | 'product';
|
||||||
|
}>();
|
||||||
const { workNameItems } = storeToRefs(productServiceStore);
|
const { workNameItems } = storeToRefs(productServiceStore);
|
||||||
const allStat = ref<{ mode: string; count: number }[]>([]);
|
const allStat = ref<{ mode: string; count: number }[]>([]);
|
||||||
const stat = ref<
|
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(
|
watch(
|
||||||
() => formService.value.attributes.workflowId,
|
() => formService.value.attributes.workflowId,
|
||||||
async (a, b) => {
|
async (a, b) => {
|
||||||
|
|
@ -3127,8 +3194,18 @@ watch(
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<KebabAction
|
<KebabAction
|
||||||
|
:use-copy="productAndServiceTab === 'service'"
|
||||||
:status="props.row.status"
|
:status="props.row.status"
|
||||||
:id-name="props.row.name"
|
:id-name="props.row.name"
|
||||||
|
@copy="
|
||||||
|
() => {
|
||||||
|
notify('create', $t('dialog.message.copy'));
|
||||||
|
currentCopy = {
|
||||||
|
id: props.row.id,
|
||||||
|
type: productAndServiceTab,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
"
|
||||||
@view="
|
@view="
|
||||||
async () => {
|
async () => {
|
||||||
if (props.row.type === 'product') {
|
if (props.row.type === 'product') {
|
||||||
|
|
@ -4422,6 +4499,11 @@ watch(
|
||||||
@click="serviceTreeView = false"
|
@click="serviceTreeView = false"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<PasteButton
|
||||||
|
id="btn-info-basic-paste"
|
||||||
|
icon-only
|
||||||
|
@click="() => paste()"
|
||||||
|
/>
|
||||||
<SaveButton id="btn-info-basic-save" icon-only type="submit" />
|
<SaveButton id="btn-info-basic-save" icon-only type="submit" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue