perf: 调整信息和价格编辑权限

main
LiaoYijun 4 months ago
parent 0f89b11d34
commit bb641e7a4b

@ -83,11 +83,11 @@ VALUES ('所有火车票功能', '/train-ticket/all', 'train-ticket')
-- 价格管理
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('管理产品', '/products/*', 'products')
VALUES ('管理产品(供应商列表)', '/products/*', 'products')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('新增产品', '/products/new', 'products')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('审核信息', '/products/info/audit', 'products')
-- INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
-- VALUES ('审核信息', '/products/info/audit', 'products')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])
VALUES ('录入信息', '/products/info/put', 'products')
INSERT INTO [dbo].[auth_resource] ([res_name] ,[res_pattern], [res_category])

@ -53,7 +53,7 @@ export const PERM_TRAIN_TICKET = '/train-ticket/all'
// 价格管理
export const PERM_PRODUCTS_MANAGEMENT = '/products/*'; // 管理
export const PERM_PRODUCTS_NEW = '/products/new'; // 新增产品
export const PERM_PRODUCTS_INFO_AUDIT = '/products/info/audit'; // 信息.审核 @deprecated
// export const PERM_PRODUCTS_INFO_AUDIT = '/products/info/audit'; // 信息.审核 @deprecated
export const PERM_PRODUCTS_INFO_PUT = '/products/info/put'; // 信息.录入
export const PERM_PRODUCTS_OFFER_AUDIT = '/products/offer/audit'; // 价格.审核
export const PERM_PRODUCTS_OFFER_PUT = '/products/offer/put'; // 价格.录入

@ -56,7 +56,7 @@ import PickYear from './views/products/PickYear'
import { PERM_ACCOUNT_MANAGEMENT, PERM_ROLE_NEW,
PERM_TRAIN_TICKET, PERM_AIR_TICKET, PERM_PRODUCTS_MANAGEMENT, PERM_PRODUCTS_OFFER_PUT,
PERM_RESERVATION_ALL, PERM_FEEDBACK_ALL, PERM_INVOICE_ALL, PERM_REPORT_ALL, PERM_REVIEW_ALL
PERM_RESERVATION_ALL, PERM_FEEDBACK_ALL, PERM_INVOICE_ALL, PERM_REPORT_ALL, PERM_REVIEW_ALL, PERM_PRODUCTS_INFO_PUT
} from '@/config'
import './i18n'
@ -107,10 +107,10 @@ const initRouter = async () => {
//
{ path: "products",element: <RequireAuth subject={PERM_PRODUCTS_MANAGEMENT} result={true}><ProductsManage /></RequireAuth>},
{ path: "products/:travel_agency_id/:use_year/:audit_state/audit",element:<RequireAuth subject={PERM_PRODUCTS_MANAGEMENT} result={true}><ProductsAudit /></RequireAuth>},
{ path: "products/:travel_agency_id/:use_year/:audit_state/edit",element:<RequireAuth subject={PERM_PRODUCTS_OFFER_PUT} result={true}><ProductsDetail /></RequireAuth>},
{ path: "products/:travel_agency_id/:use_year/:audit_state/edit",element:<RequireAuth subject={PERM_PRODUCTS_INFO_PUT} result={true}><ProductsDetail /></RequireAuth>},
{ path: "products/audit",element:<RequireAuth subject={PERM_PRODUCTS_OFFER_PUT} result={true}><ProductsAudit /></RequireAuth>},
{ path: "products/edit",element:<RequireAuth subject={PERM_PRODUCTS_OFFER_PUT} result={true}><ProductsDetail /></RequireAuth>},
{ path: "products/pick-year",element: <RequireAuth subject={PERM_PRODUCTS_OFFER_PUT} result={true}><PickYear /></RequireAuth>},
{ path: "products/edit",element:<RequireAuth subject={PERM_PRODUCTS_INFO_PUT} result={true}><ProductsDetail /></RequireAuth>},
{ path: "products/pick-year",element: <RequireAuth subject={PERM_PRODUCTS_INFO_PUT} result={true}><PickYear /></RequireAuth>},
//
]
},

@ -22,11 +22,13 @@ import {
StarTwoTone,
PlusOutlined,
QuestionCircleOutlined,
PushpinTwoTone
} from "@ant-design/icons";
import { useDatePresets } from "@/hooks/useDatePresets";
import dayjs from "dayjs";
import useProductsStore from "@/stores/Products/Index";
import useAuthStore from '@/stores/Auth'
import PriceCompactInput from "@/views/products/Detail/PriceCompactInput";
import { formatGroupSize } from "@/hooks/useProductsSets";
@ -57,6 +59,10 @@ const generateDefinitionValue = (year) => ({
const ProductInfoQuotation = ({ editable, ...props }) => {
const { onChange } = props;
const [isPermitted, currentUser] = useAuthStore(
(state) => [state.isPermitted, state.currentUser])
const { t } = useTranslation();
const [
@ -280,43 +286,47 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
dataIndex: "operation",
width: "10rem",
render: (_, quotation) => {
return (
<Space>
<Button
type="link"
onClick={() => onQuotationSeleted(quotation)}
>
{t("Edit")}
</Button>
<Popconfirm
placement="topRight"
icon={<QuestionCircleOutlined style={{ color: "red" }} />}
title="请确认"
description="你要删除这条价格吗?"
onConfirm={() => {
deleteQuotation(quotation)
.then((res) => {
triggerChange(res);
})
.catch((ex) => {
notification.error({
message: "Notification",
description: ex.message,
placement: "top",
duration: 4,
});
});
}}
>
if (editable) {
return (
<Space>
<Button
type="link"
danger
onClick={() => onQuotationSeleted(quotation)}
>
{t("Delete")}
{t("Edit")}
</Button>
</Popconfirm>
</Space>
);
<Popconfirm
placement="topRight"
icon={<QuestionCircleOutlined style={{ color: "red" }} />}
title="请确认"
description="你要删除这条价格吗?"
onConfirm={() => {
deleteQuotation(quotation)
.then((res) => {
triggerChange(res);
})
.catch((ex) => {
notification.error({
message: "Notification",
description: ex.message,
placement: "top",
duration: 4,
});
});
}}
>
<Button
type="link"
danger
>
{t("Delete")}
</Button>
</Popconfirm>
</Space>
);
} else {
(<Button type='text'><PushpinTwoTone twoToneColor="#c0192a" /></Button>)
}
},
},
];

Loading…
Cancel
Save