| | |
| | | .then((res) => { |
| | | if (res?.data?.code === 200 && res?.data?.data?.records) { |
| | | setContainerTypeOptions(res.data.data.records.map((item) => ({ |
| | | id: item.id, |
| | | value: item.value, |
| | | label: item.label ?? item.value ?? item.id, |
| | | }))); |
| | | } |
| | |
| | | type: common.type, |
| | | useStatus: common.useStatus || undefined, |
| | | areaIds: common.areaIds, |
| | | containerTypes: common.containerTypes, |
| | | inAble: common.inAble, |
| | | outAble: common.outAble, |
| | | containerTypes: (common.containerTypes || []).map((v) => Number(v)), |
| | | inAble: Number(common.inAble), |
| | | outAble: Number(common.outAble), |
| | | }; |
| | | try { |
| | | const res = await request.post('/basStation/save', body); |
| | |
| | | onChange={(e) => setCommon((c) => ({ ...c, containerTypes: e.target.value }))} |
| | | renderValue={(selected) => |
| | | (selected || []) |
| | | .map((id) => containerTypeOptions.find((c) => c.id === id)?.label ?? id) |
| | | .map((val) => containerTypeOptions.find((c) => c.value === val)?.label ?? val) |
| | | .join(', ') |
| | | } |
| | | > |
| | | {containerTypeOptions.map((opt) => ( |
| | | <MenuItem key={opt.id} value={opt.id}> |
| | | <MenuItem key={opt.value} value={opt.value}> |
| | | {opt.label} |
| | | </MenuItem> |
| | | ))} |