Merge branch 'develop'
This commit is contained in:
commit
ac93e7d981
2 changed files with 41 additions and 7 deletions
|
|
@ -2,6 +2,7 @@
|
|||
// NOTE: Library
|
||||
import { computed, onMounted, reactive, watch, ref } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
// NOTE: Components
|
||||
import StatCardComponent from 'src/components/StatCardComponent.vue';
|
||||
|
|
@ -23,9 +24,10 @@ import { useTaskOrderStore } from 'src/stores/task-order';
|
|||
import { useTaskOrderForm } from './form';
|
||||
import useFlowStore from 'src/stores/flow';
|
||||
import { pageTabs, column, pageTabsReceive } from './constants';
|
||||
import { isRoleInclude } from 'src/stores/utils';
|
||||
import { dialogWarningClose, isRoleInclude } from 'src/stores/utils';
|
||||
import { PaginationResult } from 'src/types';
|
||||
|
||||
const { t } = useI18n();
|
||||
const taskOrderFormStore = useTaskOrderForm();
|
||||
const navigatorStore = useNavigator();
|
||||
const flowStore = useFlowStore();
|
||||
|
|
@ -42,7 +44,6 @@ const pageState = reactive({
|
|||
gridView: false,
|
||||
total: 0,
|
||||
isMessenger: isRoleInclude(['messenger']),
|
||||
|
||||
receiveDialog: false,
|
||||
isReceiveScan: false,
|
||||
});
|
||||
|
|
@ -92,6 +93,10 @@ async function triggerTaskOrder(opts: {
|
|||
window.location.origin,
|
||||
);
|
||||
|
||||
if (pageState.currentTab === 'Pending') {
|
||||
url.searchParams.append('edit', String(opts.statusDialog === 'edit'));
|
||||
}
|
||||
|
||||
window.open(url.toString(), '_blank');
|
||||
}
|
||||
|
||||
|
|
@ -101,6 +106,8 @@ async function triggerTaskReceive(opts: {
|
|||
}) {
|
||||
const url = new URL(`/task-order/${opts.id}`, window.location.origin);
|
||||
|
||||
url.searchParams.append('edit', String(opts.statusDialog === 'edit'));
|
||||
|
||||
window.open(url.toString(), '_blank');
|
||||
}
|
||||
|
||||
|
|
@ -116,8 +123,18 @@ function openReceiveDialog(scan?: boolean) {
|
|||
pageState.receiveDialog = true;
|
||||
}
|
||||
|
||||
async function deleteTaskOrder() {
|
||||
console.log('delete');
|
||||
async function deleteTaskOrder(id: string) {
|
||||
dialogWarningClose(t, {
|
||||
message: t('dialog.message.confirmDelete'),
|
||||
actionText: t('dialog.action.ok'),
|
||||
action: async () => {
|
||||
const res = await taskOrderStore.deleteTaskOrder(id);
|
||||
if (!!res) {
|
||||
fetchTaskOrderList();
|
||||
}
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
@ -445,8 +462,14 @@ watch(
|
|||
: triggerTaskOrder({ statusDialog: 'info', id: v.id });
|
||||
}
|
||||
"
|
||||
@edit="console.log('edit')"
|
||||
@delete="deleteTaskOrder"
|
||||
@edit="
|
||||
(v) => {
|
||||
pageState.isMessenger
|
||||
? triggerTaskReceive({ statusDialog: 'edit', id: v.id })
|
||||
: triggerTaskOrder({ statusDialog: 'edit', id: v.id });
|
||||
}
|
||||
"
|
||||
@delete="(v) => deleteTaskOrder(v.id)"
|
||||
/>
|
||||
</article>
|
||||
|
||||
|
|
|
|||
|
|
@ -447,8 +447,19 @@ onMounted(async () => {
|
|||
state.value.mode = 'create';
|
||||
}
|
||||
|
||||
if (route.query['edit'] === 'true') {
|
||||
state.value.mode = 'edit';
|
||||
|
||||
router.push({
|
||||
path: route.path,
|
||||
});
|
||||
}
|
||||
|
||||
if (currentId !== undefined && typeof currentId === 'string') {
|
||||
await taskOrderFormStore.assignFormData(currentId);
|
||||
await taskOrderFormStore.assignFormData(
|
||||
currentId,
|
||||
state.value.mode === 'edit' ? 'edit' : 'info',
|
||||
);
|
||||
await fetchStatus();
|
||||
|
||||
if (fullTaskOrder.value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue