|  | @@ -1,5 +1,5 @@
 | 
											
												
													
														|  | -import React, { useState, useEffect } from 'react';
 |  | 
 | 
											
												
													
														|  | -import { message, Modal, Table } from 'antd';
 |  | 
 | 
											
												
													
														|  | 
 |  | +import React, { useState, useEffect, useRef } from 'react';
 | 
											
												
													
														|  | 
 |  | +import { Button, Divider, Form, Input, message, Modal, Select, Table } from 'antd';
 | 
											
												
													
														|  |  import { connect } from 'dva';
 |  |  import { connect } from 'dva';
 | 
											
												
													
														|  |  import router from 'umi/router';
 |  |  import router from 'umi/router';
 | 
											
												
													
														|  |  import FlowModal from '../Detail/FlowModal';
 |  |  import FlowModal from '../Detail/FlowModal';
 | 
											
										
											
												
													
														|  | @@ -12,6 +12,8 @@ import {
 | 
											
												
													
														|  |  } from '@/services/boom';
 |  |  } from '@/services/boom';
 | 
											
												
													
														|  |  import { getToken } from '@/utils/utils';
 |  |  import { getToken } from '@/utils/utils';
 | 
											
												
													
														|  |  import ClassifyModal from './ClassifyModal';
 |  |  import ClassifyModal from './ClassifyModal';
 | 
											
												
													
														|  | 
 |  | +import VersionModal from './VersionModal';
 | 
											
												
													
														|  | 
 |  | +let token = getToken();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  function List(props) {
 |  |  function List(props) {
 | 
											
												
													
														|  |    const { excel, loading, project, dispatch, typeOptions, userList, versionList } = props;
 |  |    const { excel, loading, project, dispatch, typeOptions, userList, versionList } = props;
 | 
											
										
											
												
													
														|  | @@ -26,56 +28,47 @@ function List(props) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    const [data, setData] = useState([]);
 |  |    const [data, setData] = useState([]);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -  let token = getToken();
 |  | 
 | 
											
												
													
														|  | 
 |  | +  const [form] = Form.useForm();
 | 
											
												
													
														|  | 
 |  | +  const filterRes = useRef({});
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    const columns = [
 |  |    const columns = [
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  |        title: '流程名称',
 |  |        title: '流程名称',
 | 
											
												
													
														|  | -      width: '35%',
 |  | 
 | 
											
												
													
														|  | -      render: item => item.version_name || item.name,
 |  | 
 | 
											
												
													
														|  | 
 |  | +      dataIndex: 'name',
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +      title: '模板名称',
 | 
											
												
													
														|  | 
 |  | +      dataIndex: 'version_name',
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  | -    // {
 |  | 
 | 
											
												
													
														|  | -    //   title: '所属项目',
 |  | 
 | 
											
												
													
														|  | -    //   width: '35%',
 |  | 
 | 
											
												
													
														|  | -    //   render: item => {
 |  | 
 | 
											
												
													
														|  | -    //     if (!item.is_parent) return '';
 |  | 
 | 
											
												
													
														|  | -    //     return project.list.find(p => p.ID == item.project_id)?.Name;
 |  | 
 | 
											
												
													
														|  | -    //   },
 |  | 
 | 
											
												
													
														|  | -    // },
 |  | 
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  |        title: '所属项目',
 |  |        title: '所属项目',
 | 
											
												
													
														|  | -      width: '35%',
 |  | 
 | 
											
												
													
														|  | -      render: item => {
 |  | 
 | 
											
												
													
														|  | -        if (!item.is_parent) return '';
 |  | 
 | 
											
												
													
														|  | -        let p = project.list.find(p => p.id == item.project_id);
 |  | 
 | 
											
												
													
														|  | 
 |  | +      dataIndex: 'project_id',
 | 
											
												
													
														|  | 
 |  | +      render: project_id => {
 | 
											
												
													
														|  | 
 |  | +        let p = project.list.find(p => p.id == project_id);
 | 
											
												
													
														|  |          if (p) return `${p.project_name}(${p.project_full_code})`;
 |  |          if (p) return `${p.project_name}(${p.project_full_code})`;
 | 
											
												
													
														|  |        },
 |  |        },
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  |        title: '操作',
 |  |        title: '操作',
 | 
											
												
													
														|  | -      render: record => {
 |  | 
 | 
											
												
													
														|  | -        if (record.is_parent) {
 |  | 
 | 
											
												
													
														|  | -          return (
 |  | 
 | 
											
												
													
														|  | -            <a
 |  | 
 | 
											
												
													
														|  | -              onClick={async () => {
 |  | 
 | 
											
												
													
														|  | -                try {
 |  | 
 | 
											
												
													
														|  | -                  setClassifyLoading(true);
 |  | 
 | 
											
												
													
														|  | -                  const data = await queryBindClassify({ project_id: record.project_id }); //record.project_id
 |  | 
 | 
											
												
													
														|  | -                  setClassifyLoading(false);
 |  | 
 | 
											
												
													
														|  | -                  setData({ project_id: record.project_id, classify: data });
 |  | 
 | 
											
												
													
														|  | -                  setVisible(true);
 |  | 
 | 
											
												
													
														|  | -                } catch (error) {}
 |  | 
 | 
											
												
													
														|  | -              }}
 |  | 
 | 
											
												
													
														|  | -            >
 |  | 
 | 
											
												
													
														|  | -              编辑
 |  | 
 | 
											
												
													
														|  | -            </a>
 |  | 
 | 
											
												
													
														|  | -          );
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -        return (
 |  | 
 | 
											
												
													
														|  | 
 |  | +      render: record => (
 | 
											
												
													
														|  | 
 |  | +        <>
 | 
											
												
													
														|  | 
 |  | +          <a
 | 
											
												
													
														|  | 
 |  | +            onClick={async () => {
 | 
											
												
													
														|  | 
 |  | +              try {
 | 
											
												
													
														|  | 
 |  | +                setClassifyLoading(true);
 | 
											
												
													
														|  | 
 |  | +                const data = await queryBindClassify({ project_id: record.project_id }); //record.project_id
 | 
											
												
													
														|  | 
 |  | +                setClassifyLoading(false);
 | 
											
												
													
														|  | 
 |  | +                setData({ project_id: record.project_id, classify: data });
 | 
											
												
													
														|  | 
 |  | +                setVisible(true);
 | 
											
												
													
														|  | 
 |  | +              } catch (error) {}
 | 
											
												
													
														|  | 
 |  | +            }}
 | 
											
												
													
														|  | 
 |  | +          >
 | 
											
												
													
														|  | 
 |  | +            分类权限
 | 
											
												
													
														|  | 
 |  | +          </a>
 | 
											
												
													
														|  | 
 |  | +          <Divider type="vertical"></Divider>
 | 
											
												
													
														|  |            <a
 |  |            <a
 | 
											
												
													
														|  |              onClick={async () => {
 |  |              onClick={async () => {
 | 
											
												
													
														|  |                localStorage.excelId = record.id;
 |  |                localStorage.excelId = record.id;
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |                setLoading2(true);
 |  |                setLoading2(true);
 | 
											
												
													
														|  |                try {
 |  |                try {
 | 
											
												
													
														|  |                  const data = await queryBoomFlowDetail({ id: record.template_id });
 |  |                  const data = await queryBoomFlowDetail({ id: record.template_id });
 | 
											
										
											
												
													
														|  | @@ -93,19 +86,28 @@ function List(props) {
 | 
											
												
													
														|  |                // router.push(`/home/detail/${record.project_id}/${record.template_id}`);
 |  |                // router.push(`/home/detail/${record.project_id}/${record.template_id}`);
 | 
											
												
													
														|  |              }}
 |  |              }}
 | 
											
												
													
														|  |            >
 |  |            >
 | 
											
												
													
														|  | -            查看
 |  | 
 | 
											
												
													
														|  | 
 |  | +            全部清单
 | 
											
												
													
														|  |            </a>
 |  |            </a>
 | 
											
												
													
														|  | -        );
 |  | 
 | 
											
												
													
														|  | -      },
 |  | 
 | 
											
												
													
														|  | 
 |  | +          <Divider type="vertical"></Divider>
 | 
											
												
													
														|  | 
 |  | +          <a
 | 
											
												
													
														|  | 
 |  | +            onClick={() => {
 | 
											
												
													
														|  | 
 |  | +              setVersion(record);
 | 
											
												
													
														|  | 
 |  | +              setVersionVisible(true);
 | 
											
												
													
														|  | 
 |  | +            }}
 | 
											
												
													
														|  | 
 |  | +          >
 | 
											
												
													
														|  | 
 |  | +            最新清单
 | 
											
												
													
														|  | 
 |  | +          </a>
 | 
											
												
													
														|  | 
 |  | +        </>
 | 
											
												
													
														|  | 
 |  | +      ),
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  |    ];
 |  |    ];
 | 
											
												
													
														|  | -  const queryList = page => {
 |  | 
 | 
											
												
													
														|  | -    console.log(page);
 |  | 
 | 
											
												
													
														|  | 
 |  | +  const queryList = filter => {
 | 
											
												
													
														|  | 
 |  | +    filter = { ...filterRes.current, ...filter };
 | 
											
												
													
														|  |      dispatch({
 |  |      dispatch({
 | 
											
												
													
														|  |        type: 'list/queryProjectRecord',
 |  |        type: 'list/queryProjectRecord',
 | 
											
												
													
														|  |        payload: {
 |  |        payload: {
 | 
											
												
													
														|  | -        ...page,
 |  | 
 | 
											
												
													
														|  | -        currentPage: page.current,
 |  | 
 | 
											
												
													
														|  | 
 |  | +        ...filter,
 | 
											
												
													
														|  | 
 |  | +        currentPage: filter.current,
 | 
											
												
													
														|  |        },
 |  |        },
 | 
											
												
													
														|  |      });
 |  |      });
 | 
											
												
													
														|  |    };
 |  |    };
 | 
											
										
											
												
													
														|  | @@ -192,6 +194,35 @@ function List(props) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    return (
 |  |    return (
 | 
											
												
													
														|  |      <div>
 |  |      <div>
 | 
											
												
													
														|  | 
 |  | +      <Form
 | 
											
												
													
														|  | 
 |  | +        form={form}
 | 
											
												
													
														|  | 
 |  | +        layout="inline"
 | 
											
												
													
														|  | 
 |  | +        style={{ marginBottom: 20 }}
 | 
											
												
													
														|  | 
 |  | +        onFinish={filter => queryList({ ...filter, currentPage: 1 })}
 | 
											
												
													
														|  | 
 |  | +      >
 | 
											
												
													
														|  | 
 |  | +        <Form.Item label="流程名称" name="name">
 | 
											
												
													
														|  | 
 |  | +          <Input />
 | 
											
												
													
														|  | 
 |  | +        </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">
 | 
											
												
													
														|  | 
 |  | +            查询
 | 
											
												
													
														|  | 
 |  | +          </Button>
 | 
											
												
													
														|  | 
 |  | +        </Form.Item>
 | 
											
												
													
														|  | 
 |  | +      </Form>
 | 
											
												
													
														|  |        <Table
 |  |        <Table
 | 
											
												
													
														|  |          loading={loading || loading2}
 |  |          loading={loading || loading2}
 | 
											
												
													
														|  |          rowKey="id"
 |  |          rowKey="id"
 | 
											
										
											
												
													
														|  | @@ -213,6 +244,15 @@ function List(props) {
 | 
											
												
													
														|  |          commitLoading={commitLoading}
 |  |          commitLoading={commitLoading}
 | 
											
												
													
														|  |          onDelVersion={onDelVersion}
 |  |          onDelVersion={onDelVersion}
 | 
											
												
													
														|  |        />
 |  |        />
 | 
											
												
													
														|  | 
 |  | +      <VersionModal
 | 
											
												
													
														|  | 
 |  | +        userList={userList}
 | 
											
												
													
														|  | 
 |  | +        typeOptions={typeOptions}
 | 
											
												
													
														|  | 
 |  | +        versionList={versionList}
 | 
											
												
													
														|  | 
 |  | +        visible={versionVisible}
 | 
											
												
													
														|  | 
 |  | +        project_id={version.project_id}
 | 
											
												
													
														|  | 
 |  | +        onChangeVersion={version => changeVersion(version)}
 | 
											
												
													
														|  | 
 |  | +        onClose={() => setVersionVisible(false)}
 | 
											
												
													
														|  | 
 |  | +      />
 | 
											
												
													
														|  |        <ClassifyModal
 |  |        <ClassifyModal
 | 
											
												
													
														|  |          loading={classifyLoading}
 |  |          loading={classifyLoading}
 | 
											
												
													
														|  |          visible={visible}
 |  |          visible={visible}
 |