perf: 产品管理: 调整信息和价格编辑权限

main
Lei OT 4 months ago
parent bb641e7a4b
commit c9d2f88b41

@ -27,25 +27,25 @@ const ProductInfo = ({ ...props }) => {
const [infoEditable, setInfoEditable] = useState(false);
const [priceEditable, setPriceEditable] = useState(false);
useEffect(() => {
const topPerm = isPermitted(PERM_PRODUCTS_MANAGEMENT); //
const isInternal = isPermitted(PERM_PRODUCTS_MANAGEMENT); // : // topPerm
const hasHT = (editingProduct?.info?.htid || 0) > 0;
// const hasAuditPer = isPermitted(PERM_PRODUCTS_OFFER_AUDIT);
const hasEditPer = isPermitted(PERM_PRODUCTS_INFO_PUT) || isPermitted(PERM_PRODUCTS_NEW); // || isPermitted(PERM_PRODUCTS_OFFER_PUT);
setEditablePerm(topPerm || hasEditPer);
setEditablePerm(hasEditPer); // topPerm ||
// setEditable(topPerm || (hasAuditPer ? true : (!hasHT && hasEditPer)));
// setEditable(true); // debug: 0
// console.log('editable', hasAuditPer, (notAudit && hasEditPer));
setInfoEditable(topPerm || (!hasHT && hasEditPer));
setInfoEditable((isInternal && hasEditPer) || (!hasHT && hasEditPer));
const _priceEditable = [-1, 3].includes(activeAgency?.audit_state_id) || isEmpty(editingProduct?.info?.id);
const hasPricePer = isPermitted(PERM_PRODUCTS_OFFER_PUT);
// setPriceEditable(topPerm || (_priceEditable && hasPricePer));
setPriceEditable(topPerm || (hasPricePer));
setPriceEditable((hasPricePer)); // topPerm ||
// setPriceEditable(true); // debug: 0
const showExtras = topPerm && hasHT; // !isEmpty(editingProduct) &&
const showExtras = isInternal && hasHT; // !isEmpty(editingProduct) &&
setExtrasVisible(showExtras);
setLgcEdits({});

Loading…
Cancel
Save