Эх сурвалжийг харах

feat: 新增采购清单根据项目编号模糊搜索

ZhaoJun 1 жил өмнө
parent
commit
f9d26b65f6
1 өөрчлөгдсөн 41 нэмэгдсэн , 19 устгасан
  1. 41 19
      src/pages/List/List.js

+ 41 - 19
src/pages/List/List.js

@@ -1,6 +1,6 @@
-import React, { useState, useEffect, useRef } from 'react';
-import { Button, Divider, Form, Input, message, Modal, Select, Table } from 'antd';
-import { connect } from 'dva';
+import React, {useState, useEffect, useRef} from 'react';
+import {Button, Divider, Form, Input, message, Modal, Select, Table} from 'antd';
+import {connect} from 'dva';
 import router from 'umi/router';
 import FlowModal from '../Detail/FlowModal';
 import {
@@ -10,13 +10,14 @@ import {
   queryDelPurchaseExcel,
   queryRecordSheet,
 } from '@/services/boom';
-import { getToken } from '@/utils/utils';
+import {getToken} from '@/utils/utils';
 import ClassifyModal from './ClassifyModal';
 import VersionModal from './VersionModal';
+
 let token = getToken();
 
 function List(props) {
-  const { excel, loading, project, dispatch, typeOptions, userList, versionList } = props;
+  const {excel, loading, project, dispatch, typeOptions, userList, versionList} = props;
   const [flowVisible, setFlowVisible] = useState(false);
   const [version, setVersion] = useState({});
   const [versionVisible, setVersionVisible] = useState(false);
@@ -57,11 +58,12 @@ function List(props) {
             onClick={async () => {
               try {
                 setClassifyLoading(true);
-                const data = await queryBindClassify({ project_id: record.project_id }); //record.project_id
+                const data = await queryBindClassify({project_id: record.project_id}); //record.project_id
                 setClassifyLoading(false);
-                setData({ project_id: record.project_id, classify: data });
+                setData({project_id: record.project_id, classify: data});
                 setVisible(true);
-              } catch (error) {}
+              } catch (error) {
+              }
             }}
           >
             分类权限
@@ -72,7 +74,7 @@ function List(props) {
               localStorage.excelId = record.id;
               setLoading2(true);
               try {
-                const data = await queryBoomFlowDetail({ id: record.template_id });
+                const data = await queryBoomFlowDetail({id: record.template_id});
                 setFlowDetail(data);
                 setVersion(record);
                 setFlowVisible(true);
@@ -82,7 +84,8 @@ function List(props) {
                     project_id: record.project_id,
                   },
                 });
-              } catch (error) {}
+              } catch (error) {
+              }
               setLoading2(false);
               // router.push(`/home/detail/${record.project_id}/${record.template_id}`);
             }}
@@ -103,7 +106,7 @@ function List(props) {
     },
   ];
   const queryList = filter => {
-    filter = { ...filterRes.current, ...filter };
+    filter = {...filterRes.current, ...filter};
     dispatch({
       type: 'list/queryProjectRecord',
       payload: {
@@ -139,6 +142,7 @@ function List(props) {
   }, []);
 
   const changeVersion = item => {
+    console.log('***', item)
     if (typeof item == 'object') {
       localStorage.excelItem = JSON.stringify(item);
     }
@@ -152,7 +156,7 @@ function List(props) {
 
   const onCommit = async (values, callback) => {
     setCommitLoading(true);
-    let sheets = await queryRecordSheet({ gridKey: version.id, 'JWT-TOKEN': token });
+    let sheets = await queryRecordSheet({gridKey: version.id, 'JWT-TOKEN': token});
 
     let params = {
       ...values,
@@ -163,7 +167,7 @@ function List(props) {
       payload: params,
       callback: async newVersion => {
         // 更新flow流程图
-        const data = await queryBoomFlowDetail({ id: newVersion.template_id });
+        const data = await queryBoomFlowDetail({id: newVersion.template_id});
         console.log(data);
         setFlowDetail(data);
         setCommitLoading(false);
@@ -186,7 +190,7 @@ function List(props) {
         const res = await queryDelPurchaseExcel(data);
         if (res.code == 200) {
           message.success('删除成功');
-          const data = await queryBoomFlowDetail({ id: version.template_id });
+          const data = await queryBoomFlowDetail({id: version.template_id});
           console.log(data);
           setFlowDetail(data);
         }
@@ -199,15 +203,18 @@ function List(props) {
       <Form
         form={form}
         layout="inline"
-        style={{ marginBottom: 20 }}
-        onFinish={filter => queryList({ ...filter, currentPage: 1 })}
+        style={{marginBottom: 20}}
+        onFinish={filter => queryList({...filter, currentPage: 1})}
       >
         <Form.Item label="流程名称" name="name">
-          <Input />
+          <Input/>
+        </Form.Item>
+        <Form.Item label="项目编号" name="project_full_code">
+          <Input/>
         </Form.Item>
         <Form.Item label="所属项目" name="project_id">
           <Select
-            style={{ width: 200 }}
+            style={{width: 200}}
             showSearch
             allowClear
             options={project.list.map(item => ({
@@ -219,6 +226,21 @@ function List(props) {
             }
           ></Select>
         </Form.Item>
+        {/* 字段确定后展开 */}
+        {/* <Form.Item label="项目经理" name="project_id"> */}
+        {/*   <Select */}
+        {/*     style={{width: 200}} */}
+        {/*     showSearch */}
+        {/*     allowClear */}
+        {/*     options={project.list.map(item => ({ */}
+        {/*       label: item.project_name, */}
+        {/*       value: item.id, */}
+        {/*     }))} */}
+        {/*     filterOption={(input, option) => */}
+        {/*       (option?.label ?? '').toLowerCase().includes(input.toLowerCase()) */}
+        {/*     } */}
+        {/*   ></Select> */}
+        {/* </Form.Item> */}
         <Form.Item>
           <Button htmlType="submit" type="primary">
             查询
@@ -267,7 +289,7 @@ function List(props) {
   );
 }
 
-export default connect(({ list, loading, user }) => ({
+export default connect(({list, loading, user}) => ({
   excel: list.excel,
   versionList: list.versionList,
   project: list.project,