瀏覽代碼

campo idSagarhpa

OscarGil03 1 年之前
父節點
當前提交
30bd952065
共有 2 個文件被更改,包括 34 次插入10 次删除
  1. 28 10
      src/views/catalogos/productos/ProductoDetalle.jsx
  2. 6 0
      src/views/catalogos/productos/Productos.jsx

+ 28 - 10
src/views/catalogos/productos/ProductoDetalle.jsx

@@ -113,6 +113,13 @@ const ProductoDetalle = () => {
     />
   }
 
+  const handleKeyPress = (event) => {
+    const charCode = event.which ? event.which : event.keyCode;
+    if (charCode < 48 || charCode > 57) {
+      event.preventDefault();
+    }
+  };
+
   return (
     <Form
       layout="vertical"
@@ -125,7 +132,7 @@ const ProductoDetalle = () => {
         <Col span={24}>
           <h2>Información del Producto</h2>
         </Col>
-        <Col md={8} xs={24}>
+        <Col md={8} xs={12}>
           <Form.Item
             label="Nombre"
             name="nombre"
@@ -136,6 +143,17 @@ const ProductoDetalle = () => {
             <Input />
           </Form.Item>
         </Col>
+        <Col md={8} xs={12}>
+          <Form.Item
+            label="ID Sagarhpa"
+            name="idSagarhpa"
+            rules={[
+              commonRules.requerido,
+            ]}
+          >
+            <Input onKeyPress={handleKeyPress} maxLength={10}/>
+          </Form.Item>
+        </Col>
         <Col span={24}>
           <h2>Subproductos:</h2>
         </Col>
@@ -145,15 +163,15 @@ const ProductoDetalle = () => {
               <>
                 {fields.map(({ key, name, ...restField }) => (
                   <Space key={key} style={{ display: 'flex', marginBottom: 8 }} align="baseline">
-                      <Form.Item
-                        {...restField}
-                        name={[name, 'nombre']}
-                        rules={[commonRules.requerido]}
-                        style={{ width: '350px' }}
-                      >
-                        <Input placeholder="Nombre del Subproducto"/>
-                      </Form.Item>
-                      <MinusCircleOutlined onClick={() => remove(name)} />
+                    <Form.Item
+                      {...restField}
+                      name={[name, 'nombre']}
+                      rules={[commonRules.requerido]}
+                      style={{ width: '350px' }}
+                    >
+                      <Input placeholder="Nombre del Subproducto" />
+                    </Form.Item>
+                    <MinusCircleOutlined onClick={() => remove(name)} />
                   </Space>
                 ))}
                 <Form.Item>

+ 6 - 0
src/views/catalogos/productos/Productos.jsx

@@ -127,6 +127,12 @@ const Productos = () => {
       dataIndex: "nombre",
       render: linkText,
     },
+    {
+      title: "ID Sagarhpa",
+      key: "idSagarhpa",
+      dataIndex: "idSagarhpa",
+      render: linkText,
+    },
   ];
 
   return (