|
|
|
|
@ -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({});
|
|
|
|
|
|