zjj
7 天以前 4e598442cb2935463762ee143e103c02d14f55d9
#优化asn单编辑页面
1个文件已修改
67 ■■■■ 已修改文件
rsf-admin/src/page/orders/asnOrder/AsnOrderModal.jsx 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/orders/asnOrder/AsnOrderModal.jsx
@@ -104,6 +104,7 @@
            ...prevData,
            [name]: value
        }));
        console.log(formData);
    };
    const resetData = () => {
@@ -181,7 +182,7 @@
            setFormData(res.data.data)
        } else {
            notify(res.data.msg);
        }
        }
    }
    const requestGetBody = async () => {
@@ -203,7 +204,7 @@
    }
    return (
        <>
        <>
            <Dialog
                open={open}
                onClose={handleClose}
@@ -212,7 +213,7 @@
                fullWidth
                disableRestoreFocus
                maxWidth="lg"   // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
            >
            >
                <DialogTitle id="form-dialog-title" sx={{
                    position: 'sticky',
                    top: 0,
@@ -226,7 +227,7 @@
                </DialogTitle>
                <DialogContent sx={{ mt: 2 }}>
                    <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
                        <Form>
                        <Form defaultValues={formData}>
                            <Grid container spacing={2}>
                                <Grid item md={3}>
                                    <DictSelect
@@ -335,19 +336,33 @@
    return (
        <Select
        value={params.value}
        onChange={(e) =>
          params.api.setEditCellValue({
            id: params.id,
            field: params.field,
            value: e.target.value,
          })
        onChange={(e) =>{
            params.api.setEditCellValue({
                id: params.id,
                field: params.field,
                value: e.target.value,
              })
              // 找到选中的供应商记录
          const selectedSupplier = formData.find(supplier => supplier.name === e.target.value);
          // 如果找到对应的供应商记录,同时更新splrCode字段
          if (selectedSupplier) {
            params.api.setEditCellValue({
              id: params.id,
              field: 'splrCode',
              value: selectedSupplier.id,
            });
          }
        }
        }
        fullWidth
        autoFocus
      >        
          {formData.map(e => {
            return(
                <MenuItem value={e.name} children={e.name} />
                <MenuItem value={e.name} children={e.name} key={e.id} />
            );
              
          })}
@@ -379,19 +394,31 @@
    return (
        <Select
        value={params.value}
        onChange={(e) =>
          params.api.setEditCellValue({
            id: params.id,
            field: params.field,
            value: e.target.value,
          })
        onChange={(e) =>{
            params.api.setEditCellValue({
                id: params.id,
                field: params.field,
                value: e.target.value,
              })
              const selectedSupplier = formData.find(supplier => supplier.id === e.target.value);
              // 如果找到对应的供应商记录,同时更新splrCode字段
              if (selectedSupplier) {
                params.api.setEditCellValue({
                  id: params.id,
                  field: 'splrName',
                  value: selectedSupplier.name,
                });
              }
        }
        }
        fullWidth
        autoFocus
      >        
          {formData.map(e => {
            return(
                <MenuItem value={e.id} children={e.name} />
                <MenuItem value={e.id} children={e.name} key={e.id} />
            );
              
          })}