|
@@ -9,8 +9,9 @@ import {
|
|
|
Popover,
|
|
|
Input,
|
|
|
Checkbox,
|
|
|
+ message,
|
|
|
} from 'antd';
|
|
|
-import moment from 'moment';
|
|
|
+import dayjs from 'dayjs';
|
|
|
import styles from './List.less';
|
|
|
import ApprovalModal from './ApprovalModal';
|
|
|
import DetailModal from './DetailModal';
|
|
@@ -20,21 +21,34 @@ import QualityOperateModal from './QualityOperateModal';
|
|
|
import BudgetModal from './BudgetModal';
|
|
|
import ModifyManagerModal from './ModifyManagerModal';
|
|
|
import { connect } from 'dva';
|
|
|
-import { useRequest, useModel } from '@umijs/max';
|
|
|
+import FirmModal from './ManufacturerModal';
|
|
|
+import { queryCreaterList, saveMfr } from '@/services/manufacturer';
|
|
|
+import ProjectRecordModal from './ProjectRecordModal';
|
|
|
+import { useModel } from '@umijs/max';
|
|
|
|
|
|
const { Option } = Select;
|
|
|
-//状态
|
|
|
-const STATUS = [
|
|
|
+//项目阶段
|
|
|
+export const STATUS = [
|
|
|
{ value: 0, label: '售前' },
|
|
|
- { value: 1, label: '转执行' },
|
|
|
- { value: 2, label: '转运营' },
|
|
|
- { value: 3, label: '转质保' },
|
|
|
+ { value: 1, label: '执行' },
|
|
|
+ { value: 2, label: '运营' },
|
|
|
+ { value: 3, label: '质保' },
|
|
|
+];
|
|
|
+//现阶段状态
|
|
|
+export const SUB_STATUS = [
|
|
|
+ { value: 1, label: '初步交流' },
|
|
|
+ { value: 2, label: '预算和方式' },
|
|
|
+ { value: 3, label: '招标' },
|
|
|
+ { value: 4, label: '中标' },
|
|
|
+ { value: 11, label: '执行' },
|
|
|
+ { value: 21, label: '运营' },
|
|
|
+ { value: 31, label: '质保' },
|
|
|
+ { value: 41, label: '失败' },
|
|
|
+ { value: 42, label: '放弃' },
|
|
|
+ { value: 43, label: '关闭' },
|
|
|
];
|
|
|
|
|
|
function List(props) {
|
|
|
- const {
|
|
|
- initialState: { user },
|
|
|
- } = useModel('@@initialState');
|
|
|
const {
|
|
|
industryList,
|
|
|
typeList,
|
|
@@ -45,7 +59,10 @@ function List(props) {
|
|
|
depUserTree,
|
|
|
member,
|
|
|
budget,
|
|
|
+ supplierList,
|
|
|
} = props;
|
|
|
+ const { initialState } = useModel('@@initialState');
|
|
|
+ const currentUser = initialState?.user || {};
|
|
|
const [form] = Form.useForm();
|
|
|
const [addVisible, setAddVisible] = useState(false);
|
|
|
const [detailVisible, setDetailVisible] = useState(false);
|
|
@@ -57,6 +74,10 @@ function List(props) {
|
|
|
const [currentItem, setCurrentItem] = useState({});
|
|
|
const [qualityOperate, setQualityOperate] = useState(0);
|
|
|
const [modifyManagerVisible, setModifyManagerVisible] = useState(false);
|
|
|
+ const [addFirmVisible, setAddFirmVisible] = useState(false);
|
|
|
+ const [recordVisible, setRecordVisible] = useState(false);
|
|
|
+ const [isEdit, setIsEdit] = useState(false);
|
|
|
+
|
|
|
const columns = [
|
|
|
{
|
|
|
title: '项目编号',
|
|
@@ -67,52 +88,63 @@ function List(props) {
|
|
|
dataIndex: 'project_name',
|
|
|
},
|
|
|
{
|
|
|
- title: '分类',
|
|
|
- dataIndex: 'TypeInfo',
|
|
|
- render: (TypeInfo) =>
|
|
|
- TypeInfo ? `${TypeInfo.name}(${TypeInfo.code})` : '-',
|
|
|
- },
|
|
|
- /*
|
|
|
- {
|
|
|
- title: '名称',
|
|
|
- dataIndex: 'name',
|
|
|
+ title: '客户',
|
|
|
+ dataIndex: 'supplier_name',
|
|
|
},
|
|
|
{
|
|
|
- title: '行业',
|
|
|
- dataIndex: 'IndustryInfo',
|
|
|
- render: IndustryInfo => `${IndustryInfo.name}(${IndustryInfo.code})`,
|
|
|
+ title: '工艺',
|
|
|
+ dataIndex: 'process_info',
|
|
|
+ render: (info) => {
|
|
|
+ let str = '';
|
|
|
+ if (info) {
|
|
|
+ const data = JSON.parse(info) || [];
|
|
|
+ const list = data.map((item) => item.type);
|
|
|
+ str = list.join('+');
|
|
|
+ }
|
|
|
+ return str;
|
|
|
+ },
|
|
|
},
|
|
|
+ // {
|
|
|
+ // title: '规模',
|
|
|
+ // dataIndex: 'process_info',
|
|
|
+ // render: info => {
|
|
|
+ // let str = '';
|
|
|
+ // if (info) {
|
|
|
+ // const data = JSON.parse(info) || [];
|
|
|
+ // console.log('-----------------', data);
|
|
|
+ // const list = data.map(item => item.scale);
|
|
|
+ // str = list.join('+');
|
|
|
+ // }
|
|
|
+ // return str;
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+
|
|
|
{
|
|
|
- title: '所在地',
|
|
|
- dataIndex: 'location',
|
|
|
- render: (location, record) => `${location}(${record.location_code})`,
|
|
|
+ title: '项目种类',
|
|
|
+ dataIndex: 'TypeInfo',
|
|
|
+ render: (TypeInfo) =>
|
|
|
+ TypeInfo ? `${TypeInfo.name}(${TypeInfo.code})` : '-',
|
|
|
},
|
|
|
{
|
|
|
- title: '期数',
|
|
|
- dataIndex: 'version',
|
|
|
- render: version => `${version}期`,
|
|
|
+ title: '项目阶段',
|
|
|
+ dataIndex: 'project_status',
|
|
|
+ render: (project_status) =>
|
|
|
+ STATUS.find((item) => item.value == project_status)?.label || '-',
|
|
|
},
|
|
|
- */
|
|
|
{
|
|
|
- title: '流程',
|
|
|
- dataIndex: ['FlowInfo', 'name'],
|
|
|
+ title: '现阶段状态',
|
|
|
+ dataIndex: 'status',
|
|
|
+ render: (status) =>
|
|
|
+ SUB_STATUS.find((item) => item.value == status)?.label || '-',
|
|
|
},
|
|
|
{
|
|
|
- title: '状态',
|
|
|
- dataIndex: 'project_status',
|
|
|
- render: (project_status) => {
|
|
|
- // return project_status === 0 ? <>售前</> : <>转执行</>;
|
|
|
- //若添加其他状态则启用以下switch case:
|
|
|
- switch (project_status) {
|
|
|
- case 0:
|
|
|
- return <>售前</>;
|
|
|
- case 1:
|
|
|
- return <>转执行</>;
|
|
|
- case 2:
|
|
|
- return <>转运营</>;
|
|
|
- case 3:
|
|
|
- return <>转质保</>;
|
|
|
- }
|
|
|
+ title: '现阶段状态时间(天)',
|
|
|
+ dataIndex: 'current_status_start ',
|
|
|
+ align: 'center',
|
|
|
+ render: (time) => {
|
|
|
+ const date = dayjs(new Date());
|
|
|
+ const daysDiff = date.diff(time, 'days');
|
|
|
+ return daysDiff;
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -153,7 +185,7 @@ function List(props) {
|
|
|
{
|
|
|
title: '创建时间',
|
|
|
dataIndex: 'c_time',
|
|
|
- render: (c_time) => moment(c_time).format('YYYY.MM.DD'),
|
|
|
+ render: (c_time) => dayjs(c_time).format('YYYY.MM.DD'),
|
|
|
},
|
|
|
{
|
|
|
title: '执行经理',
|
|
@@ -210,10 +242,10 @@ function List(props) {
|
|
|
<Form.Item label="项目编号" name="projectCode">
|
|
|
<Input style={{ width: 200 }} />
|
|
|
</Form.Item>
|
|
|
- <Form.Item label="状态" name="projectStatus">
|
|
|
+ <Form.Item label="项目阶段" name="projectStatus">
|
|
|
<Select
|
|
|
showSearch
|
|
|
- style={{ width: 120 }}
|
|
|
+ style={{ width: 160 }}
|
|
|
filterOption={(input, option) =>
|
|
|
option.props.children
|
|
|
.toLowerCase()
|
|
@@ -226,6 +258,22 @@ function List(props) {
|
|
|
))}
|
|
|
</Select>
|
|
|
</Form.Item>
|
|
|
+ <Form.Item label="现阶段状态" name="projectStatus">
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ style={{ width: 160 }}
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ option.props.children
|
|
|
+ .toLowerCase()
|
|
|
+ .indexOf(input.toLowerCase()) >= 0
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <Option value={null}>全部</Option>
|
|
|
+ {SUB_STATUS.map((item) => (
|
|
|
+ <Option key={item.value}>{item.label}</Option>
|
|
|
+ ))}
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
<Form.Item>
|
|
|
<Button type="primary" loading={loading} onClick={handleSearch}>
|
|
|
查询
|
|
@@ -249,7 +297,10 @@ function List(props) {
|
|
|
callback: () => setAddVisible(false),
|
|
|
});
|
|
|
}
|
|
|
+ // 刷新table
|
|
|
+ queryList({ current: 1 });
|
|
|
};
|
|
|
+
|
|
|
const onDelete = (item) => {
|
|
|
Modal.confirm({
|
|
|
title: '删除',
|
|
@@ -265,6 +316,7 @@ function List(props) {
|
|
|
},
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
const onSubmitAuth = (item) => {
|
|
|
Modal.confirm({
|
|
|
title: '提交审核',
|
|
@@ -283,6 +335,7 @@ function List(props) {
|
|
|
},
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
const queryList = (page) => {
|
|
|
dispatch({
|
|
|
type: 'approval/queryApproval',
|
|
@@ -301,41 +354,54 @@ function List(props) {
|
|
|
}
|
|
|
};
|
|
|
let detailBtn = (
|
|
|
- <a
|
|
|
- onClick={() => {
|
|
|
- setCurrentItem(record);
|
|
|
- setDetailVisible(true);
|
|
|
- }}
|
|
|
- >
|
|
|
- 项目详情
|
|
|
- </a>
|
|
|
- );
|
|
|
- let memberBtn = (
|
|
|
- <a
|
|
|
- onClick={() => {
|
|
|
- setCurrentItem(record);
|
|
|
- setMemberVisible(true);
|
|
|
- }}
|
|
|
- >
|
|
|
- 成员管理
|
|
|
- </a>
|
|
|
- );
|
|
|
- let executionBtn = (
|
|
|
- <a
|
|
|
- onClick={() => {
|
|
|
- setCurrentItem(record);
|
|
|
- setExecutionVisible(true);
|
|
|
- }}
|
|
|
- >
|
|
|
- 转执行
|
|
|
- </a>
|
|
|
+ <>
|
|
|
+ <a
|
|
|
+ onClick={() => {
|
|
|
+ setCurrentItem(record);
|
|
|
+ setRecordVisible(true);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 项目日志
|
|
|
+ </a>
|
|
|
+ <Divider type="vertical" />
|
|
|
+ <a
|
|
|
+ onClick={() => {
|
|
|
+ setCurrentItem(record);
|
|
|
+ setDetailVisible(true);
|
|
|
+ setIsEdit(false);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 项目详情
|
|
|
+ </a>
|
|
|
+ </>
|
|
|
);
|
|
|
+ // let memberBtn = (
|
|
|
+ // <a
|
|
|
+ // onClick={() => {
|
|
|
+ // setCurrentItem(record);
|
|
|
+ // setMemberVisible(true);
|
|
|
+ // }}
|
|
|
+ // >
|
|
|
+ // 成员管理
|
|
|
+ // </a>
|
|
|
+ // );
|
|
|
+ // let executionBtn = (
|
|
|
+ // <a
|
|
|
+ // onClick={() => {
|
|
|
+ // setCurrentItem(record);
|
|
|
+ // setExecutionVisible(true);
|
|
|
+ // }}
|
|
|
+ // >
|
|
|
+ // 转执行
|
|
|
+ // </a>
|
|
|
+ // );
|
|
|
let editBtn = (
|
|
|
<>
|
|
|
<a
|
|
|
onClick={() => {
|
|
|
setCurrentItem(record);
|
|
|
setAddVisible(true);
|
|
|
+ setIsEdit(true);
|
|
|
}}
|
|
|
>
|
|
|
编辑
|
|
@@ -358,6 +424,17 @@ function List(props) {
|
|
|
</a>
|
|
|
</>
|
|
|
);
|
|
|
+ let projectEditBtn = (
|
|
|
+ <a
|
|
|
+ onClick={() => {
|
|
|
+ setIsEdit(true);
|
|
|
+ setCurrentItem(record);
|
|
|
+ setDetailVisible(true);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 项目编辑
|
|
|
+ </a>
|
|
|
+ );
|
|
|
let statusBtn = (
|
|
|
<>
|
|
|
<a
|
|
@@ -376,7 +453,7 @@ function List(props) {
|
|
|
>
|
|
|
设置人日预算
|
|
|
</a>
|
|
|
- <Divider type="vertical" />
|
|
|
+ {/* <Divider type="vertical" />
|
|
|
<a
|
|
|
onClick={() => {
|
|
|
setCurrentItem(record);
|
|
@@ -395,101 +472,105 @@ function List(props) {
|
|
|
}}
|
|
|
>
|
|
|
转运营
|
|
|
- </a>
|
|
|
+ </a> */}
|
|
|
</>
|
|
|
);
|
|
|
let { audit_status, project_status, type_id } = record;
|
|
|
//权限审核
|
|
|
- let canEdit = () => {
|
|
|
- if (user.IsSuper) return true;
|
|
|
+ let getEditStatus = () => {
|
|
|
+ if (currentUser.IsSuper) return true;
|
|
|
switch (audit_status) {
|
|
|
case 0:
|
|
|
- return user.ID == record.author;
|
|
|
+ return currentUser.ID == record.author;
|
|
|
case 1:
|
|
|
return false;
|
|
|
case 2:
|
|
|
- if (project_status == 0) return user.ID == record.author;
|
|
|
- if (project_status == 1) return user.ID == record.LeaderId;
|
|
|
+ if (project_status == 0) return currentUser.ID == record.author;
|
|
|
+ if (project_status == 1) return currentUser.ID == record.LeaderId;
|
|
|
return false;
|
|
|
case 3:
|
|
|
switch (project_status) {
|
|
|
case 0:
|
|
|
- return user.ID == record.author;
|
|
|
+ return currentUser.ID == record.author;
|
|
|
case 1:
|
|
|
- return user.ID == record.LeaderId;
|
|
|
+ return currentUser.ID == record.LeaderId;
|
|
|
case 2:
|
|
|
return (
|
|
|
- user.ID == record.LeaderId || user.ID == record.opt_manager_id
|
|
|
+ currentUser.ID == record.LeaderId ||
|
|
|
+ currentUser.ID == record.opt_manager_id
|
|
|
);
|
|
|
case 3:
|
|
|
return (
|
|
|
- user.ID == record.LeaderId || user.ID == record.wty_manager_id
|
|
|
+ currentUser.ID == record.LeaderId ||
|
|
|
+ currentUser.ID == record.wty_manager_id
|
|
|
);
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
};
|
|
|
let toReturn = [];
|
|
|
+ const canEdit = getEditStatus();
|
|
|
dividerPush(detailBtn, toReturn);
|
|
|
switch (audit_status) {
|
|
|
//未提交
|
|
|
case 0:
|
|
|
- canEdit() && dividerPush(editBtn, toReturn);
|
|
|
+ canEdit && dividerPush(editBtn, toReturn);
|
|
|
break;
|
|
|
//审核中
|
|
|
case 1:
|
|
|
break;
|
|
|
//审核拒绝
|
|
|
case 2:
|
|
|
- if (project_status == 0 && canEdit()) dividerPush(editBtn, toReturn);
|
|
|
- else if (project_status == 1 && canEdit()) {
|
|
|
- dividerPush(memberBtn, toReturn);
|
|
|
+ if (project_status == 0 && canEdit) dividerPush(editBtn, toReturn);
|
|
|
+ else if (project_status == 1 && canEdit) {
|
|
|
+ // dividerPush(memberBtn, toReturn);
|
|
|
dividerPush(statusBtn, toReturn);
|
|
|
}
|
|
|
break;
|
|
|
//审核通过
|
|
|
case 3:
|
|
|
+ canEdit && dividerPush(projectEditBtn, toReturn);
|
|
|
switch (project_status) {
|
|
|
//售前
|
|
|
case 0:
|
|
|
- if (canEdit()) {
|
|
|
- dividerPush(memberBtn, toReturn);
|
|
|
- dividerPush(executionBtn, toReturn);
|
|
|
+ if (canEdit) {
|
|
|
+ // dividerPush(memberBtn, toReturn);
|
|
|
+ // dividerPush(executionBtn, toReturn);
|
|
|
}
|
|
|
break;
|
|
|
//转执行
|
|
|
case 1:
|
|
|
- if (canEdit()) {
|
|
|
- dividerPush(memberBtn, toReturn);
|
|
|
+ if (canEdit) {
|
|
|
+ // dividerPush(memberBtn, toReturn);
|
|
|
dividerPush(statusBtn, toReturn);
|
|
|
}
|
|
|
break;
|
|
|
//转运营
|
|
|
case 2:
|
|
|
- canEdit() && dividerPush(memberBtn, toReturn);
|
|
|
+ // canEdit && dividerPush(memberBtn, toReturn);
|
|
|
break;
|
|
|
//转质保
|
|
|
case 3:
|
|
|
- canEdit() && dividerPush(memberBtn, toReturn);
|
|
|
+ // canEdit && dividerPush(memberBtn, toReturn);
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
- let modifyManager = (
|
|
|
- <a
|
|
|
- onClick={() => {
|
|
|
- setCurrentItem(record);
|
|
|
- setModifyManagerVisible(true);
|
|
|
- }}
|
|
|
- >
|
|
|
- 修改项目经理
|
|
|
- </a>
|
|
|
- );
|
|
|
- if (
|
|
|
- (project_status === 0 || project_status === 1) &&
|
|
|
- (user.Permission['func-01-point-pm-list-change'] || user.IsSuper)
|
|
|
- )
|
|
|
- dividerPush(modifyManager, toReturn);
|
|
|
+ // let modifyManager = (
|
|
|
+ // <a
|
|
|
+ // onClick={() => {
|
|
|
+ // setCurrentItem(record);
|
|
|
+ // setModifyManagerVisible(true);
|
|
|
+ // }}
|
|
|
+ // >
|
|
|
+ // 修改项目经理
|
|
|
+ // </a>
|
|
|
+ // );
|
|
|
+ // if (
|
|
|
+ // (project_status === 0 || project_status === 1) &&
|
|
|
+ // (permission['func-01-point-pm-list-change'] || currentUser.IsSuper)
|
|
|
+ // )
|
|
|
+ // dividerPush(modifyManager, toReturn);
|
|
|
return toReturn;
|
|
|
};
|
|
|
|
|
@@ -509,8 +590,29 @@ function List(props) {
|
|
|
dispatch({
|
|
|
type: 'approval/fetchDepV2',
|
|
|
});
|
|
|
+ dispatch({
|
|
|
+ type: 'approval/querySupplierList',
|
|
|
+ payload: { project_id: 1, is_super: true, page_size: 999 },
|
|
|
+ });
|
|
|
}, []);
|
|
|
|
|
|
+ const handlerSaveFirm = async (fieldsValue) => {
|
|
|
+ const res = await saveMfr({
|
|
|
+ ...fieldsValue,
|
|
|
+ project_id: 1,
|
|
|
+ created_by: currentUser?.CName,
|
|
|
+ });
|
|
|
+ if (res.code == 200) {
|
|
|
+ message.success('新增成功');
|
|
|
+ setAddFirmVisible(false);
|
|
|
+ dispatch({
|
|
|
+ type: 'approval/querySupplierList',
|
|
|
+ payload: { project_id: 1, is_super: true, page_size: 999 },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(res);
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<div>
|
|
|
{renderSearch()}
|
|
@@ -536,7 +638,8 @@ function List(props) {
|
|
|
onChange={queryList}
|
|
|
/>
|
|
|
<ApprovalModal
|
|
|
- currentUser={user}
|
|
|
+ supplierList={supplierList}
|
|
|
+ currentUser={currentUser}
|
|
|
depUserTree={depUserTree}
|
|
|
loading={loading}
|
|
|
industryList={industryList}
|
|
@@ -547,13 +650,17 @@ function List(props) {
|
|
|
data={currentItem}
|
|
|
total={data.pagination.total}
|
|
|
onClose={() => setAddVisible(false)}
|
|
|
+ onAddFirm={() => setAddFirmVisible(true)}
|
|
|
/>
|
|
|
<DetailModal
|
|
|
+ depUserTree={depUserTree}
|
|
|
industryList={industryList}
|
|
|
flowList={flowList}
|
|
|
typeList={typeList}
|
|
|
visible={detailVisible}
|
|
|
data={currentItem}
|
|
|
+ isEdit={isEdit}
|
|
|
+ currentUser={currentUser}
|
|
|
onClose={() => setDetailVisible(false)}
|
|
|
/>
|
|
|
<ExecutionModal
|
|
@@ -564,14 +671,6 @@ function List(props) {
|
|
|
onOk={() => setExecutionVisible(false)}
|
|
|
onClose={() => setExecutionVisible(false)}
|
|
|
/>
|
|
|
- <MemberModal
|
|
|
- depUserTree={depUserTree}
|
|
|
- loading={loading}
|
|
|
- visible={memberVisible}
|
|
|
- onClose={() => setMemberVisible(false)}
|
|
|
- currentItem={currentItem}
|
|
|
- dataSource={member}
|
|
|
- />
|
|
|
<QualityOperateModal
|
|
|
depUserTree={depUserTree}
|
|
|
loading={loading}
|
|
@@ -598,6 +697,17 @@ function List(props) {
|
|
|
dataSource={member}
|
|
|
onOk={() => setModifyManagerVisible(false)}
|
|
|
/>
|
|
|
+ <FirmModal
|
|
|
+ visible={addFirmVisible}
|
|
|
+ onCancel={() => setAddFirmVisible(false)}
|
|
|
+ onOk={handlerSaveFirm}
|
|
|
+ />
|
|
|
+ <ProjectRecordModal
|
|
|
+ depUserTree={depUserTree}
|
|
|
+ currentItem={currentItem}
|
|
|
+ visible={recordVisible}
|
|
|
+ onClose={() => setRecordVisible(false)}
|
|
|
+ />
|
|
|
</div>
|
|
|
);
|
|
|
}
|
|
@@ -607,8 +717,11 @@ export default connect(({ approval, user, loading }) => ({
|
|
|
typeList: approval.typeList,
|
|
|
flowList: approval.flowList,
|
|
|
industryList: approval.industryList,
|
|
|
+ currentUser: user.currentUser,
|
|
|
+ // permission: user.currentUser.Permission,
|
|
|
loading: loading.models.approval,
|
|
|
depUserTree: approval.depUserTree,
|
|
|
member: approval.member,
|
|
|
budget: approval.budget,
|
|
|
+ supplierList: approval.supplierList,
|
|
|
}))(List);
|