|
@@ -65,10 +65,17 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu, lookFlag }: Props) {
|
|
|
|
|
|
const getInfoInAPIFu = useCallback(async (id: number) => {
|
|
|
const res = await getGoodsInfoByIdAPI(id);
|
|
|
- FormBoxRef.current?.setFieldsValue(res.data.entity);
|
|
|
- setCover(res.data.entity.thumb);
|
|
|
+ const dataRes = res.data.entity;
|
|
|
+ FormBoxRef.current?.setFieldsValue({
|
|
|
+ ...dataRes,
|
|
|
+ dictTexture: dataRes.dictTexture ? dataRes.dictTexture : null,
|
|
|
+ dictAge: dataRes.dictAge ? dataRes.dictAge : null,
|
|
|
+ dictLevel: dataRes.dictLevel ? dataRes.dictLevel : null,
|
|
|
+ dictSource: dataRes.dictSource ? dataRes.dictSource : null,
|
|
|
+ });
|
|
|
+ setCover(dataRes.thumb);
|
|
|
|
|
|
- if (res.data.entity.type) setTypeCheck(res.data.entity.type.split(","));
|
|
|
+ if (dataRes.type) setTypeCheck(dataRes.type.split(","));
|
|
|
|
|
|
const data: FileListType[] = res.data.file;
|
|
|
const obj = {
|
|
@@ -85,7 +92,7 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu, lookFlag }: Props) {
|
|
|
});
|
|
|
setFileImgList(fileImgListTemp);
|
|
|
setFileList(obj);
|
|
|
- setDirCode(res.data.entity.dirCode);
|
|
|
+ setDirCode(dataRes.dirCode);
|
|
|
}, []);
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -380,7 +387,7 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu, lookFlag }: Props) {
|
|
|
// rules={[{ required: true, message: "请选择类别!" }]}
|
|
|
>
|
|
|
<Select
|
|
|
- placeholder="请选择"
|
|
|
+ placeholder={lookFlag ? "(空)" : "请选择"}
|
|
|
style={{ width: 400 }}
|
|
|
options={dictList["texture"].slice(1)}
|
|
|
/>
|
|
@@ -392,7 +399,7 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu, lookFlag }: Props) {
|
|
|
// rules={[{ required: true, message: "请选择年代!" }]}
|
|
|
>
|
|
|
<Select
|
|
|
- placeholder="请选择"
|
|
|
+ placeholder={lookFlag ? "(空)" : "请选择"}
|
|
|
style={{ width: 400 }}
|
|
|
options={dictList["age"].slice(1)}
|
|
|
/>
|
|
@@ -404,7 +411,7 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu, lookFlag }: Props) {
|
|
|
// rules={[{ required: true, message: "请选择级别!" }]}
|
|
|
>
|
|
|
<Select
|
|
|
- placeholder="请选择"
|
|
|
+ placeholder={lookFlag ? "(空)" : "请选择"}
|
|
|
style={{ width: 400 }}
|
|
|
options={dictList["level"].slice(1)}
|
|
|
/>
|
|
@@ -416,7 +423,7 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu, lookFlag }: Props) {
|
|
|
// rules={[{ required: true, message: "请选择来源!" }]}
|
|
|
>
|
|
|
<Select
|
|
|
- placeholder="请选择"
|
|
|
+ placeholder={lookFlag ? "(空)" : "请选择"}
|
|
|
style={{ width: 400 }}
|
|
|
options={dictList["source"].slice(1)}
|
|
|
/>
|