From 15d2f40e5dcdaa3b7a9f05c508aea461990bf80b Mon Sep 17 00:00:00 2001 From: Gloomy Date: Mon, 18 Aug 2025 21:09:07 +0000 Subject: [PATCH] update two-step ui --- webUI/src/utils/approvalUtils.js | 4 +-- webUI/src/views/acc/sell/list.vue | 4 +-- .../src/views/acc/storeroom/io/ticketList.vue | 31 ++----------------- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/webUI/src/utils/approvalUtils.js b/webUI/src/utils/approvalUtils.js index fa7a469..58d9fa9 100644 --- a/webUI/src/utils/approvalUtils.js +++ b/webUI/src/utils/approvalUtils.js @@ -124,7 +124,7 @@ export function getApprovalStatusText(document) { if (document.approved === false) { return 'رد شده'; } - return 'نامشخص'; + return 'تایید شده'; } /** @@ -142,5 +142,5 @@ export function getApprovalStatusColor(document) { if (document.approved === false) { return 'error'; } - return 'grey'; + return 'success'; } diff --git a/webUI/src/views/acc/sell/list.vue b/webUI/src/views/acc/sell/list.vue index 239d1dd..99717eb 100755 --- a/webUI/src/views/acc/sell/list.vue +++ b/webUI/src/views/acc/sell/list.vue @@ -619,7 +619,7 @@ export default defineComponent({ if (item.isPreview) return 'در انتظار تایید'; if (item.isApproved) return 'تایید شده'; - return 'نامشخص'; + return 'تایید شده'; }, // نمایش رنگ وضعیت تأیید getApprovalStatusColor(item) { @@ -627,7 +627,7 @@ export default defineComponent({ if (item.isPreview) return 'warning'; if (item.isApproved) return 'success'; - return 'default'; + return 'success'; }, // بررسی اینکه آیا دکمه تأیید باید نمایش داده شود canShowApprovalButton(item) { diff --git a/webUI/src/views/acc/storeroom/io/ticketList.vue b/webUI/src/views/acc/storeroom/io/ticketList.vue index b3bdfd4..9d989e4 100755 --- a/webUI/src/views/acc/storeroom/io/ticketList.vue +++ b/webUI/src/views/acc/storeroom/io/ticketList.vue @@ -364,7 +364,6 @@ interface Header { visible: boolean; } -// Refs const loading = ref(false); const inputItems = ref([]); const outputItems = ref([]); @@ -386,7 +385,6 @@ const business = ref({ }); const currentUser = ref({ email: '', owner: false }); -// دیالوگ‌ها const deleteDialog = ref({ show: false, type: null as 'input' | 'output' | 'transfer' | 'waste' | null, @@ -399,7 +397,6 @@ const snackbar = ref({ color: 'primary' }); -// تعریف همه ستون‌ها const allHeaders = ref([ { title: "عملیات", key: "operation", align: 'center' as const, sortable: false, width: 100, visible: true }, { title: "شماره", key: "code", align: 'center' as const, sortable: true, width: 100, visible: true }, @@ -411,10 +408,8 @@ const allHeaders = ref([ { title: "توضیحات", key: "des", align: 'center' as const, sortable: true, width: 200, visible: true }, ]); -// ستون‌های قابل نمایش const visibleHeaders = computed(() => { return allHeaders.value.filter((header: Header) => { - // اگر ستون‌های تأیید هستند، باید دو مرحله‌ای فعال باشد if ((header.key === 'approvalStatus' || header.key === 'approvedBy') && !business.value.requireTwoStepApproval) { return false; } @@ -422,12 +417,10 @@ const visibleHeaders = computed(() => { }) as any; }); -// بررسی نمایش ستون const isColumnVisible = (key: string) => { const header = allHeaders.value.find((header: Header) => header.key === key); if (!header) return false; - // اگر ستون‌های تأیید هستند، باید دو مرحله‌ای فعال باشد if ((key === 'approvalStatus' || key === 'approvedBy') && !business.value.requireTwoStepApproval) { return false; } @@ -435,10 +428,8 @@ const isColumnVisible = (key: string) => { return header.visible; }; -// کلید ذخیره‌سازی در localStorage const LOCAL_STORAGE_KEY = 'hesabix_storeroom_tickets_table_columns'; -// لود تنظیمات ستون‌ها const loadColumnSettings = () => { const savedSettings = localStorage.getItem(LOCAL_STORAGE_KEY); if (savedSettings) { @@ -449,7 +440,6 @@ const loadColumnSettings = () => { } }; -// ذخیره تنظیمات ستون‌ها const updateColumnVisibility = () => { const visibleColumns = allHeaders.value .filter(header => header.visible) @@ -457,13 +447,11 @@ const updateColumnVisibility = () => { localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(visibleColumns)); }; -// تابع فرمت‌کننده اعداد const formatNumber = (value: string | number) => { if (!value) return '0'; return Number(value).toLocaleString('fa-IR'); }; -// فهرست‌های نمایشی بر اساس ساب-تب و دو مرحله‌ای const displayInputItems = computed(() => { if (!business.value.requireTwoStepApproval) return inputItems.value; return inputSubTab.value === 'pending' @@ -492,7 +480,6 @@ const displayWasteItems = computed(() => { : wasteItems.value.filter(i => i.approved); }); -// بارگذاری اطلاعات بیزنس const loadBusinessInfo = async () => { try { const response = await axios.get('/api/business/get/info/' + localStorage.getItem('activeBid')); @@ -503,7 +490,6 @@ const loadBusinessInfo = async () => { } }; -// بارگذاری اطلاعات کاربر فعلی const loadCurrentUser = async () => { try { const response = await axios.post('/api/business/get/user/permissions'); @@ -514,7 +500,6 @@ const loadCurrentUser = async () => { } }; -// بارگذاری داده‌ها const loadData = async () => { loading.value = true; try { @@ -540,25 +525,19 @@ const loadData = async () => { } }; -// بررسی اینکه آیا دکمه تأیید باید نمایش داده شود const canShowApprovalButton = (item: Ticket) => { if (!business.value.requireTwoStepApproval) return false; - // اگر سند قبلاً تأیید شده، دکمه تأیید نمایش داده نشود if (item?.approved) return false; - // مدیر کسب و کار همیشه می‌تواند تأیید کند - // یا کاربر تأییدکننده انبار return business.value.warehouseApprover === currentUser.value.email || currentUser.value.owner === true; }; -// تایید حواله const approveTicket = async (code: string) => { try { loading.value = true; await axios.post(`/api/approval/approve/storeroom/${code}`); - // به‌روزرسانی داده‌ها await loadData(); snackbar.value = { show: true, message: 'حواله تایید شد', color: 'success' }; @@ -569,25 +548,22 @@ const approveTicket = async (code: string) => { } }; -// نمایش متن وضعیت تأیید const getApprovalStatusText = (item: Ticket) => { if (!business.value.requireTwoStepApproval) return 'تایید دو مرحله‌ای غیرفعال'; if (item?.preview) return 'در انتظار تایید'; if (item?.approved) return 'تایید شده'; - return 'نامشخص'; + return 'تایید شده'; }; -// نمایش رنگ وضعیت تأیید const getApprovalStatusColor = (item: Ticket) => { if (!business.value.requireTwoStepApproval) return 'default'; if (item?.preview) return 'warning'; if (item?.approved) return 'success'; - return 'default'; + return 'success'; }; -// حذف حواله const deleteTicket = (type: 'input' | 'output' | 'transfer' | 'waste', code: string) => { deleteDialog.value = { show: true, @@ -596,7 +572,6 @@ const deleteTicket = (type: 'input' | 'output' | 'transfer' | 'waste', code: str }; }; -// تأیید حذف const confirmDelete = async () => { if (!deleteDialog.value?.type || !deleteDialog.value?.code) return; @@ -639,7 +614,6 @@ const confirmDelete = async () => { } }; -// مانت کامپوننت onMounted(() => { loadColumnSettings(); loadBusinessInfo(); @@ -655,7 +629,6 @@ onMounted(() => { overflow-x: auto; } -/* استایل برای وسط‌چین کردن همه سلول‌های جدول */ :deep(.v-data-table-header th) { text-align: center !important; }