perf: 删除报价使用 Popconfirm;新报价默认不分人等

main
LiaoYijun 2 months ago
parent 182cec31fc
commit be49d9cd02

@ -13,6 +13,7 @@ import {
DatePicker, DatePicker,
Space, Space,
App, App,
Popconfirm,
Tooltip, Tooltip,
} from "antd"; } from "antd";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -20,7 +21,6 @@ import {
CloseOutlined, CloseOutlined,
StarTwoTone, StarTwoTone,
PlusOutlined, PlusOutlined,
ExclamationCircleFilled,
QuestionCircleOutlined, QuestionCircleOutlined,
} from "@ant-design/icons"; } from "@ant-design/icons";
import { useDatePresets } from "@/hooks/useDatePresets"; import { useDatePresets } from "@/hooks/useDatePresets";
@ -179,7 +179,7 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
const [isBatchSetupModalOpen, setBatchSetupModalOpen] = useState(false); const [isBatchSetupModalOpen, setBatchSetupModalOpen] = useState(false);
const [groupAllSize, setGroupAllSize] = useState(false); const [groupAllSize, setGroupAllSize] = useState(false);
const [groupMaxUnlimit, setGroupMaxUnlimit] = useState(false); const [groupMaxUnlimit, setGroupMaxUnlimit] = useState(false);
const { modal, notification } = App.useApp(); const { notification } = App.useApp();
const [quotationForm] = Form.useForm(); const [quotationForm] = Form.useForm();
const [batchSetupForm] = Form.useForm(); const [batchSetupForm] = Form.useForm();
@ -206,6 +206,7 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
}; };
const onNewQuotation = () => { const onNewQuotation = () => {
setGroupAllSize(false); //
const emptyQuotation = newEmptyQuotation(defaultUseDates); const emptyQuotation = newEmptyQuotation(defaultUseDates);
quotationForm.setFieldsValue(emptyQuotation); quotationForm.setFieldsValue(emptyQuotation);
setQuotationModalOpen(true); setQuotationModalOpen(true);
@ -224,24 +225,6 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
setBatchSetupModalOpen(false); setBatchSetupModalOpen(false);
}; };
const onDeleteQuotation = (quotation) => {
modal.confirm({
title: "请确认",
icon: <ExclamationCircleFilled />,
content: "你要删除这条价格吗?",
onOk() {
deleteQuotation(quotation).catch((ex) => {
notification.error({
message: "Notification",
description: ex.message,
placement: "top",
duration: 4,
});
});
},
});
};
const quotationColumns = [ const quotationColumns = [
// { title: 'id', dataIndex: 'id', width: 40, className: 'italic text-gray-400' }, // test: 0 // { title: 'id', dataIndex: 'id', width: 40, className: 'italic text-gray-400' }, // test: 0
// { title: 'WPI_SN', dataIndex: 'WPI_SN', width: 40, className: 'italic text-gray-400' }, // test: 0 // { title: 'WPI_SN', dataIndex: 'WPI_SN', width: 40, className: 'italic text-gray-400' }, // test: 0
@ -256,10 +239,7 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
title: ( title: (
<> <>
{t("products:unit_name")}{" "} {t("products:unit_name")}{" "}
<Tooltip <Tooltip placement="top" title={t("products:FormTooltip.PriceUnit")}>
placement="top"
title={t("products:FormTooltip.PriceUnit")}
>
<QuestionCircleOutlined className="text-gray-500" /> <QuestionCircleOutlined className="text-gray-500" />
</Tooltip> </Tooltip>
</> </>
@ -282,7 +262,7 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
{t("products:use_dates")}{" "} {t("products:use_dates")}{" "}
<Tooltip <Tooltip
placement="top" placement="top"
styles={{ body: {width: "24rem"} }} styles={{ body: { width: "24rem" } }}
title={t("products:FormTooltip.UseDates")} title={t("products:FormTooltip.UseDates")}
> >
<QuestionCircleOutlined className="text-gray-500" /> <QuestionCircleOutlined className="text-gray-500" />
@ -290,7 +270,6 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
</> </>
), ),
dataIndex: "use_dates", dataIndex: "use_dates",
// width: '6rem',
render: (_, record) => render: (_, record) =>
`${record.use_dates_start}-${record.use_dates_end}`, `${record.use_dates_start}-${record.use_dates_end}`,
}, },
@ -301,25 +280,37 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
dataIndex: "operation", dataIndex: "operation",
width: "10rem", width: "10rem",
render: (_, quotation) => { render: (_, quotation) => {
// const _rowEditable = [-1,3].includes(quotation.audit_state_id);
const _rowEditable = true; // test: 0
return ( return (
<Space> <Space>
<Button <Button
type="link" type="link"
disabled={!_rowEditable}
onClick={() => onQuotationSeleted(quotation)} onClick={() => onQuotationSeleted(quotation)}
> >
{t("Edit")} {t("Edit")}
</Button> </Button>
<Button <Popconfirm
type="link" placement="topRight"
danger icon={<QuestionCircleOutlined style={{ color: "red" }} />}
disabled={!_rowEditable} title="请确认"
onClick={() => onDeleteQuotation(quotation)} description="你要删除这条价格吗?"
onConfirm={() => {
deleteQuotation(quotation).catch((ex) => {
notification.error({
message: "Notification",
description: ex.message,
placement: "top",
duration: 4,
});
});
}}
> >
{t("Delete")} <Button
</Button> type="link"
danger
>
{t("Delete")}
</Button>
</Popconfirm>
</Space> </Space>
); );
}, },

Loading…
Cancel
Save