Parcourir la source

fix: 提示key warning

ZhaoJun il y a 1 an
Parent
commit
2b14c2ffc5

+ 12 - 7
src/pages/TaskManage/Detail/TaskDetail/TaskDetail.tsx

@@ -54,12 +54,10 @@ function TaskDetail(props: IPropsType) {
     {
       title: '详情',
       dataIndex: 'detail',
+      key: 'key',
       render: (value, record) => {
         return (
-          <div
-            key={value.key}
-            style={{ display: 'flex', alignItems: 'center' }}
-          >
+          <div style={{ display: 'flex', alignItems: 'center' }}>
             <div style={{ width: value.image === '' ? '100%' : '200px' }}>
               {value.text}
             </div>
@@ -135,7 +133,13 @@ function TaskDetail(props: IPropsType) {
                 <div className={styles.leftInfo}>
                   <Row style={{ marginBottom: '15px' }}>
                     <Col className={styles.fontS24} span={12}>
-                      工单编号:{record.Id || '-'}
+                      {/*// @ts-ignore*/}
+                      工单类型:
+                      {record.RecordType === 1
+                        ? '工艺'
+                        : record.RecordType === 2
+                        ? '维修'
+                        : '保养'}
                     </Col>
                     <Col className={styles.fontS24} span={12}>
                       时间:{record.CreateTime || '-'}
@@ -219,13 +223,13 @@ function TaskDetail(props: IPropsType) {
             img: base64ToImageUrl(res[i].event_bg),
           });
         }
-        const dataSource = mandateChild.map((item) => {
+        const dataSource = mandateChild.map((item, index) => {
           const img = images.find((i) => i.id === item.ExtendId);
           return {
             detail: {
               text: item.Title + item.Content,
               image: img !== undefined ? img.img : '',
-              key: item.ExtendId,
+              key: item.Title + index + item.Content,
             },
           };
         });
@@ -293,6 +297,7 @@ function TaskDetail(props: IPropsType) {
             <Col className={styles.fontS24} span={20}>
               {/*{mandateDetail?.Detail}*/}
               <Table
+                rowKey="key"
                 columns={columnDef}
                 dataSource={mandateTable}
                 pagination={false}

+ 1 - 1
src/pages/TaskManage/Detail/TaskDetail/taskDetail.types.ts

@@ -11,5 +11,5 @@ export interface IMandateChildTypes {
 }
 
 export interface IColumn {
-  detail: {text: string, image: string, key: number};
+  detail: {text: string, image: string, key: string};
 }