产品管理: 管理: 编辑title

perf/export-docx
Lei OT 11 months ago
parent 3040ca6220
commit 86d0d175d3

@ -101,7 +101,7 @@ export const useProductsAuditStatesMapVal = (value) => {
export const useProductsTypesFieldsets = (type) => { export const useProductsTypesFieldsets = (type) => {
const [isPermitted] = useAuthStore((state) => [state.isPermitted]); const [isPermitted] = useAuthStore((state) => [state.isPermitted]);
const infoDefault = [['city'], ['title']]; const infoDefault = [['city'], ['title']];
const infoAdmin = ['code', 'remarks', 'dept']; // 'display_to_c' const infoAdmin = ['title', 'code', 'remarks', 'dept']; // 'display_to_c'
const infoDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['display_to_c'] : []; const infoDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['display_to_c'] : [];
const infoRecDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['recommends_rate'] : []; const infoRecDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['recommends_rate'] : [];
const infoTypesMap = { const infoTypesMap = {

@ -50,17 +50,16 @@ const ProductInfo = ({ ...props }) => {
// "lastedit_changed": "", // "lastedit_changed": "",
}; };
/** lgc_details */ /** lgc_details */
const copyFields = pick(editingProduct.info, ['title', 'product_type_id']); const copyFields = pick(editingProduct.info, ['product_type_id']); // 'title',
const readyToSubInfo = { ...copyNewProduct.info, ...values.info, ...copyFields, type: copyFields.product_type_id, ...poster }; const readyToSubInfo = { ...copyNewProduct.info, ...editingProduct.info, ...values.info, ...copyFields, type: copyFields.product_type_id, ...poster };
// console.log('onSave', editingProduct.info, readyToSubInfo); // console.log('onSave', editingProduct.info, readyToSubInfo);
const prevLgcDetailsMapped = editingProduct.lgc_details.reduce((r, c) => ({ ...r, [c.lgc]: { ...c, description: c.descriptions } }), {}); // todo: description const prevLgcDetailsMapped = editingProduct.lgc_details.reduce((r, c) => ({ ...r, [c.lgc]: { ...c, description: c.descriptions } }), {}); // todo: description
const mergedLgc = { ...prevLgcDetailsMapped, ...values.lgc_details_mapped }; const mergedLgc = { ...prevLgcDetailsMapped, ...values.lgc_details_mapped };
/** quotation */ /** quotation */
// todo:
const prevQuotationMapped = editingProduct.quotation.reduce((r, c) => ({ ...r, [c.id]: { ...c, unit: c.unit_id, audit_state: c.audit_state_id } }), {}); const prevQuotationMapped = editingProduct.quotation.reduce((r, c) => ({ ...r, [c.id]: { ...c, unit: c.unit_id, audit_state: c.audit_state_id } }), {});
const mergedQ = { ...prevQuotationMapped, ...(values.quotation || []) }; const mergedQ = { ...prevQuotationMapped, ...(values.quotation || []) };
console.log(values); // console.log(values);
// return false; // debug: 0 // return false; // debug: 0
/** 提交保存 */ /** 提交保存 */
setLoading(true); setLoading(true);

@ -123,9 +123,9 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show
<Form.Item hidden name={'id'} label={'ID'}> <Form.Item hidden name={'id'} label={'ID'}>
<Input /> <Input />
</Form.Item> </Form.Item>
<Form.Item hidden name={'title'} label={'title'}> {/* <Form.Item hidden name={'title'} label={'title'}>
<Input /> <Input />
</Form.Item> </Form.Item> */}
{editable && ( {editable && (
<Form.Item> <Form.Item>
<div className='flex justify-around'> <div className='flex justify-around'>
@ -173,6 +173,14 @@ function getFields(props) {
}; };
let baseChildren = []; let baseChildren = [];
baseChildren = [ baseChildren = [
item(
'title',
99,
<Form.Item name='title' label={t('Title')} {...fieldProps.title} rules={[{ required: true }]}>
<Input allowClear {...fieldComProps.title} {...styleProps} {...editableProps('title')} />
</Form.Item>,
fieldProps?.title?.col || midCol
),
item( item(
'code', 'code',
99, 99,

Loading…
Cancel
Save