From 2671015b43bf8ec3597542ce4c48cbcc82931be4 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 15 Jul 2024 15:04:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:?= =?UTF-8?q?=20=E5=A4=8D=E5=88=B6=E4=BA=A7=E5=93=81:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=A4=8D=E5=88=B6=E4=BB=B7=E6=A0=BC;=20?= =?UTF-8?q?=E6=89=80=E6=9C=89=E9=A1=B9=E7=9B=AE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/common.json | 1 + public/locales/en/products.json | 1 + public/locales/zh/common.json | 1 + public/locales/zh/products.json | 1 + src/views/products/Detail/CopyProducts.jsx | 19 +++++++++++------- src/views/products/Manage.jsx | 23 +++++++++++++++++----- 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index b228ae8..f5dd835 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -29,6 +29,7 @@ "sureCancel": "Are you sure to cancel?", "sureDelete":"Are you sure to delete?", "Yes": "Yes", + "No": "No", "Success": "Success", "Failed": "Failed", diff --git a/public/locales/en/products.json b/public/locales/en/products.json index 384e1f5..50bda51 100644 --- a/public/locales/en/products.json +++ b/public/locales/en/products.json @@ -98,6 +98,7 @@ "CopyFormMsg": { "Source": "Source ", "target": "Target ", + "withQuote": "Whether to copy the quotation", "requiredVendor": "Please pick a target vendor", "requiredTypes": "Please select product types", "requiredDept": "Please pick a owner department" diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json index dd6e73e..5c120b0 100644 --- a/public/locales/zh/common.json +++ b/public/locales/zh/common.json @@ -29,6 +29,7 @@ "sureCancel": "确定取消?", "sureDelete":"确定删除?", "Yes": "是", + "No": "否", "Success": "成功", "Failed": "失败", diff --git a/public/locales/zh/products.json b/public/locales/zh/products.json index c8b56a4..2c5ae72 100644 --- a/public/locales/zh/products.json +++ b/public/locales/zh/products.json @@ -98,6 +98,7 @@ "CopyFormMsg": { "Source": "源", "target": "目标", + "withQuote": "是否复制报价", "requiredVendor": "请选择目标供应商", "requiredTypes": "请选择产品类型", "requiredDept": "请选择所属小组" diff --git a/src/views/products/Detail/CopyProducts.jsx b/src/views/products/Detail/CopyProducts.jsx index 14ba6be..af2ed57 100644 --- a/src/views/products/Detail/CopyProducts.jsx +++ b/src/views/products/Detail/CopyProducts.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { App, Form, Modal, DatePicker, Divider } from 'antd'; +import { App, Form, Modal, DatePicker, Divider, Switch } from 'antd'; import { isEmpty, objectMapper } from '@/utils/commons'; import { useTranslation } from 'react-i18next'; @@ -29,7 +29,7 @@ export const CopyProductsForm = ({ action, initialValues, onFormInstanceReady, s const onValuesChange = (changeValues, allValues) => {}; return ( -
+ {action === '#' && } - + {action === '#' && @@ -47,11 +47,15 @@ export const CopyProductsForm = ({ action, initialValues, onFormInstanceReady, s } - + - - current <= dayjs([source.sourceYear, 12, 31])} /> + + + {/* disabledDate={(current) => current <= dayjs([source.sourceYear, 12, 31])} */} + + + ); @@ -69,7 +73,7 @@ const formValuesMapper = (values) => { 'products_types': { key: 'products_types', transform: (value) => { - return Array.isArray(value) ? value.map((ele) => ele.key).join(',') : value ? value.value : ''; + return Array.isArray(value) ? value.map((ele) => ele.key).join(',') : value ? value.value : '-1'; }, }, 'dept': { @@ -78,6 +82,7 @@ const formValuesMapper = (values) => { return Array.isArray(value) ? value.map((ele) => ele.key).join(',') : value ? value.value : ''; }, }, + 'with_quote': { key: 'with_quote', transform: (value) => (value ? 1 : 0) }, }; let dest = {}; const { agency, year, ...omittedValue } = values; diff --git a/src/views/products/Manage.jsx b/src/views/products/Manage.jsx index 71d4466..4b2f2b6 100644 --- a/src/views/products/Manage.jsx +++ b/src/views/products/Manage.jsx @@ -10,6 +10,8 @@ import { useProductsTypes, useProductsAuditStatesMapVal } from '@/hooks/useProdu import useFormStore from '@/stores/Form'; import { objectMapper } from '@/utils/commons'; import CopyProductsFormModal from './Detail/CopyProducts'; +import useAuthStore from '@/stores/Auth'; +import RequireAuth from '@/components/RequireAuth'; dayjs.extend(arraySupport); @@ -63,11 +65,15 @@ function Index() { { title: t('products:Vendor'), key: 'vendor', dataIndex: 'travel_agency_name' }, { title: t('products:CreatedBy'), key: 'poster_by', dataIndex: 'poster_name' }, { title: t('products:CreateDate'), key: 'poster_date', dataIndex: 'poster_date' }, - { title: t('products:AuState'), key: 'audit_state', dataIndex: 'audit_state', + { + title: t('products:AuState'), + key: 'audit_state', + dataIndex: 'audit_state', render: (_, r) => { const stateCls = ` text-${stateMapVal[`${r.audit_state_id}`]?.color} `; return {stateMapVal[`${r.audit_state_id}`]?.label}; - }, }, + }, + }, { title: t('products:AuditedBy'), key: 'audited_by', dataIndex: 'audited_by_name' }, { title: t('products:AuditDate'), key: 'audit_date', dataIndex: 'audit_date' }, { @@ -76,9 +82,15 @@ function Index() { render: (_, r) => ( {t('Edit')} - {t('Audit')} - - + {r.audit_state_id >= 0 ? ( + {t('Audit')} + ) : ( + {t('Audit')} + )} + + {/* */} ), }, @@ -109,6 +121,7 @@ function Index() { {/* 复制弹窗 */}