diff --git a/web/client/assets/排队项目.xlsx b/web/client/assets/排队项目.xlsx new file mode 100644 index 0000000..52e7852 Binary files /dev/null and b/web/client/assets/排队项目.xlsx differ diff --git a/web/client/src/sections/article/containers/index.js b/web/client/src/sections/article/containers/index.js index 3363efd..23eceac 100644 --- a/web/client/src/sections/article/containers/index.js +++ b/web/client/src/sections/article/containers/index.js @@ -111,7 +111,7 @@ export const Default = (props) => { key: "direction", hideInTable: true, dataIndex: "direction", - order: 6, + renderFormItem: (item, { type, defaultRender, ...rest }, form) => { return ( ); }, + },{ + key: "direction", + hideInTable: true, + dataIndex: "direction", + renderFormItem: (item, { type, defaultRender, ...rest }, form) => { + return ( + + + + ); + }, }, ]; const handleCancel = () => { @@ -168,6 +188,20 @@ export const Default = (props) => { } }); }; + //一键删除 + const confirm = (record) => { + const query = { + table_name: "test_project", + delete_all:'1' + }; + dispatch(delCancel(query)).then((res) => { + if (res.success) { + // 刷新 + // tableActionRef.current.reload(); + handleCancel(); + } + }); + }; //编辑 const editor = (record) => { setVisible(true); @@ -190,13 +224,14 @@ export const Default = (props) => { setCounts(res.payload.data.projects); return { ...res, - total: res.payload.data ? res.payload.data.total : 0, + // total: res.payload.data ? res.payload.data.total : 0, }; }} rowKey="id" pagination={{ showSizeChanger: true, }} + /> ({}); export default connect(mapStateToProps)(Default); - -const data = [ - { name: "yongchu", age: "18", 任务1: "v1", 计划1: "time1" }, - { name: "yongchu", age: "18", 任务1: "v1", 计划1: "time1" }, - { name: "yongchu", age: "18", 任务1: "v1", 计划1: "time1" }, - { name: "大王", age: "18", 任务1: "v1", 计划1: "time1" }, - { name: "大王", age: "18", 任务1: "v1", 计划1: "time1" }, -]; diff --git a/web/client/src/sections/homePage/actions/profile.js b/web/client/src/sections/homePage/actions/profile.js index 5bd8588..f7506ab 100644 --- a/web/client/src/sections/homePage/actions/profile.js +++ b/web/client/src/sections/homePage/actions/profile.js @@ -107,11 +107,12 @@ export function getProject() { }); } -export function getPeople() { +export function getPeople(query) { return (dispatch) => basicAction({ type: "post", dispatch: dispatch, + data:query, actionType: "PEOPLE", url: ApiTable.peopleUrl, msg: { option: "获取人员情况" }, @@ -134,7 +135,20 @@ export function getWait() { }, }); } - +export function postKeySearch(query) { + return (dispatch) => + basicAction({ + type: "post", + dispatch: dispatch, + data:query, + actionType: "PEOPLE", + url: ApiTable.postKeySearch, + msg: { option: "获取人员情况" }, + reducer: { + name: "people", + }, + }); +} export default { // getProfile, // editProfile, diff --git a/web/client/src/sections/homePage/containers/index.js b/web/client/src/sections/homePage/containers/index.js index a94decf..cf56ff4 100644 --- a/web/client/src/sections/homePage/containers/index.js +++ b/web/client/src/sections/homePage/containers/index.js @@ -1,13 +1,14 @@ /* eslint-disable react-hooks/exhaustive-deps */ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect,useRef } from "react"; import { connect } from "react-redux"; import { Spin, Tabs, Table } from "antd"; import classnames from "classnames/bind"; import styles from "./index.less"; import { push } from "react-router-redux"; import moment from "moment"; -import { getProject, getPeople, getWait } from "../actions/profile"; +import { getProject, getPeople, getWait,postKeySearch } from "../actions/profile"; import { Scroller } from "$components"; +import ProTable from "@ant-design/pro-table"; const CX = classnames.bind(styles); const topImg = "/assets/images/top.png"; @@ -15,16 +16,19 @@ const pointImg = "/assets/images/point.png"; function Management(props) { const { dispatch, user } = props - + const height = document.body.clientHeight + const width=document.body.clientWidth const [dataSource, setDataSource] = useState([]) - + const [name, setName] = useState()//名字查询 + const [ajob, setAjob] = useState()//岗位查询 const [projectData, setProjectData] = useState([]) const [peopleData, setPeopleData] = useState([]) const [waitData, setWaitData] = useState([]) - + const [counts,setCounts]=useState() + const ref = useRef(); useEffect(() => { dispatch(getProject()).then((res) => { - setProjectData(res.payload.data.projects) + setProjectData(res?.payload.data?.projects) }) dispatch(getPeople()).then((res) => { setPeopleData(res.payload.data.projects) @@ -54,8 +58,16 @@ function Management(props) { dataIndex: 'build_time', key: 'build_time', align: 'center', + defaultSortOrder: 'ascend', + sorter: { + compare: (a, b) => { + const one = moment(a.build_time).format('YYYYMMDD') + const two=moment(b.build_time).format('YYYYMMDD') + return one - two + }, + }, render: (dom, record) => { - return moment(record.build_time).format('YYYY-MM-DD') + return <>{moment(record.build_time).format('YYYY-MM-DD')=='1999-01-01'?'待定':moment(record.build_time).format('YYYY-MM-DD')} }, }, { @@ -73,33 +85,77 @@ function Management(props) { key: 'progress', align: 'center' }, + { + title: '状态', + dataIndex: 'deferred_payment', + key: 'deferred_payment', + align: 'center', + render: (dom, record) => { + const current = new Date() + return <> + {(record.progress == '研发中' && Number(moment(current).format('YYYYMMDD')) > Number(moment(record.build_time).format('YYYYMMDD')))&&moment(record.build_time).format('YYYY-MM-DD')!=='1999-01-01'||(record.progress == '测试中' && Number(moment(current).format('YYYYMMDD')) > Number(moment(record.publish_time).format('YYYYMMDD')))&&moment(record.build_time).format('YYYY-MM-DD')!=='1999-01-01'?
已延期
:
未延期
} + + }, + }, ]; const peopleCol = [ { - title: "人员姓名", - dataIndex: "name_people", - key: "name_people", - hideInSearch: true, + title: '人员姓名', + dataIndex: 'name_people', + key: 'name_people', + ellipsis: true, + width: 300, render: (dom, record) => { return record.name_people; }, - }, - { - title: "岗位", - key: "post_people", - dataIndex: "post_people", - hideInSearch: true, + fieldProps: { + onChange: (value, cs) => { + setName(value.target.value); + }, + placeholder: '请输入人员名称进行搜索', + getPopupContainer: (triggerNode) => triggerNode.parentNode, + }, + }, { + title: '岗位', + key: 'post_people', + dataIndex: 'post_people', + valueType: "select", + initialValue: null, + fieldProps: { + onChange: (value, cs) => { + console.log(value) + setAjob(value); + }, + options: [ + { + label: "全部岗位", + value: null, + }, + { + label: "研发", + value: '研发', + }, + { + label: "测试", + value: '测试', + }, + { + label: "UI", + value: 'UI', + }, + ], + }, render: (dom, record) => { return record.post_people; }, - }, + }, { title: "周一", key: "md", dataIndex: "md", hideInSearch: true, - width:220, + render: (dom, record) => { return
{record.md=='undefined'?'--' :record.md}
; }, @@ -109,7 +165,7 @@ function Management(props) { key: "td", dataIndex: "td", hideInSearch: true, - width:220, + render: (dom, record) => { return
{record.td=='undefined'?'--' :record.td}
; }, @@ -119,7 +175,7 @@ function Management(props) { key: "wd", dataIndex: "wd", hideInSearch: true, - width:220, + render: (dom, record) => { return
{record.wd=='undefined'?'--' :record.wd}
; }, @@ -129,7 +185,7 @@ function Management(props) { key: "thd ", dataIndex: "thd ", hideInSearch: true, - width:220, + render: (dom, record) => { return
{record.thd=='undefined'?'--' :record.thd}
; }, @@ -139,7 +195,7 @@ function Management(props) { key: "fd", dataIndex: "fd", hideInSearch: true, - width:220, + render: (dom, record) => { return
{record.fd=='undefined'?'--' :record.fd}
; }, @@ -196,33 +252,64 @@ function Management(props) { }, ]; + return ( <> -
+ +
-
-
+
+
本周在研项目
/Research project this week
- +
-
+
待研发项目
/Project to be developed
-
+
-
+
人员情况
/Information on Personnel
{/* */} -
+ { + + if (name || ajob) { + const query = { + value1:name, + value2:ajob, + } + const res = await dispatch(postKeySearch(query)); + setPeopleData(res?.payload.data.projects); + return { + ...res, + // total: res.payload.data.data ? res.payload.data.total : 0, + }; + } else { + const res = await dispatch(getPeople()); + console.log(res) + setPeopleData(res?.payload.data.projects); + return { + ...res, + // total: res.payload.data.data ? res.payload.data.total : 0, + }; + } + + }} + onReset={(v) => { + setName(null) + setAjob(null) + }} + /> {/* */} diff --git a/web/client/src/sections/homePage/containers/index.less b/web/client/src/sections/homePage/containers/index.less index b7a2005..2f847bc 100644 --- a/web/client/src/sections/homePage/containers/index.less +++ b/web/client/src/sections/homePage/containers/index.less @@ -119,18 +119,21 @@ &-main { display: flex; - width: 80%; + width: 90%; margin: 0 auto; + height: 40vh; justify-content: space-between; &-box { width: 49%; - min-height: 200px; - max-height: 800px; - overflow-y: auto; + // min-height: 200px; + // max-height: 800px; + // overflow-y: auto; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5); text-align: left; padding: 5px; - +.ant-pro-card-body{ + padding: 0px 24px 0 24px !important; +} &-point { width: 14px; height: 14px; diff --git a/web/client/src/sections/personnel/containers/index.js b/web/client/src/sections/personnel/containers/index.js index fd74bc4..2ba6572 100644 --- a/web/client/src/sections/personnel/containers/index.js +++ b/web/client/src/sections/personnel/containers/index.js @@ -137,6 +137,7 @@ export const Default = (props) => { dataIndex: "direction", order: 6, renderFormItem: (item, { type, defaultRender, ...rest }, form) => { + return ( ); }, + },{ + key: "direction", + hideInTable: true, + dataIndex: "direction", + renderFormItem: (record, { type, defaultRender, ...rest }, form) => { + console.log(record) + return ( + + + + + ); + }, }, ]; const handleCancel = () => { @@ -197,6 +222,20 @@ export const Default = (props) => { } }); }; + //一键删除 + const confirm = (record) => { + const query = { + table_name: "test_people", + delete_all:'1' + }; + dispatch(delCancel(query)).then((res) => { + if (res.success) { + // 刷新 + // tableActionRef.current.reload(); + handleCancel(); + } + }); + }; //编辑 const editor = (record) => { setVisible(true); diff --git a/web/client/src/sections/wait/components/import_model.js b/web/client/src/sections/wait/components/import_model.js new file mode 100644 index 0000000..a672a0f --- /dev/null +++ b/web/client/src/sections/wait/components/import_model.js @@ -0,0 +1,162 @@ +/* + * @description : + * @Date : 2021-04-07 14:39:33 + * @FilePath : \web\client\src\sections\user\components\userManagement\importUser.js + * @useStrict : use strict + */ + +"use strict"; +import React, { useState } from "react"; +import { connect } from "react-redux"; +import { Button, Input, Card, Modal, Upload, message } from "antd"; +import { Request } from "@peace/utils"; +import request from "superagent"; +import XLSX from "xlsx"; +import { postInWait } from "../actions/article"; + +//TODO 下载模板和上传文件读取 +const ImportUser = (props) => { + const { user, dispatch, handleCancel, params, editData } = props; + const [msg, setMsg] = useState(""); + const [loading, setLoading] = useState(""); + const [postData, setPostData] = useState([]); + + const confirm = () => { + handleCancel + if (postData.length) { + console.log(postData) + setLoading(true); + dispatch(postInWait(postData)).then((res) => { + console.log(res) + + if (res.success) { + message.success("上传成功"); + handleCancel() + } + setLoading(false); + }); + } else { + message.warn("没有数据可以提交,请上传数据文件"); + } + }; + + return ( + { + setMsg(""); + setLoading(false); + setPostData([]); + handleCancel(); + }} + destroyOnClose + > + {/* */} + + + +
下载模板后填写完整后上传
+
+ { + setMsg(""); + setPostData([]); + const extNames = file.name.split("."); + let isDAE = false; + if (extNames.length > 0) { + let fileType = extNames[extNames.length - 1].toLowerCase(); + isDAE = ["xlsx", "xls"].some((f) => f == fileType); + } + if (!isDAE) { + setMsg(`只能上传 ${["xlsx", "xls"].join()} 格式的文件!`); + return false; + } + }, + onChange(info) {}, + customRequest: async (data) => { + const { file, onSuccess, onError } = data; + + const reader = new FileReader(); // 使用 FileReader 读取数据 + reader.onload = function (e) { + // 数据读取完成后的回调函数 + const data = new Uint8Array(e.target.result); + const workbook = XLSX.read(data, { type: "array" }); // workbook 是 xlsx 解析 excel 后返回的对象 + + const firstSheetName = workbook.SheetNames[0]; // 获取第一个 sheet 的名字 + const worksheet = workbook.Sheets[firstSheetName]; // 获取第一个 sheet 的内容 + const res = XLSX.utils.sheet_to_json(worksheet); // 使用 utils 里的方法转换内容为便于使用的数组 + const error = (msg) => { + setMsg(msg); + onError({ message: msg }); + }; + if (res.length > 1000) { + error("一次性上传数据行数应小于1000行,请分批上传"); + return; + } + if (!res.length) { + error("请填写至少一行数据"); + return; + } + let postData = []; + + for (let i = 0; i < res.length; i++) { + let d = res[i]; + let name_project = String(d["项目"]).trim(); + + let from_project = String(d["需求来源"]).trim(); + let contacts = String(d["对接人"]).trim(); + let consum_time = String(d["评估工时"]).trim(); + let progress = String(d["处理进度"]).trim(); + let o_name_project='' + if (!name_project || !from_project || !consum_time || !contacts||!progress) { + error(`第${i + 1} 行有空值,请填写后重新上传`); + return; + } + + + postData.push({ + name_project, + from_project,contacts,consum_time,progress + }); + } + if (postData.length) { + setPostData(postData); + } + let msg = "文件解析完成,点击确定按钮上传保存!"; + setMsg(msg); + onSuccess({ message: msg }); + }; + reader.readAsArrayBuffer(file); // 读取数据 + }, + }} + > + + +
+ {msg} +
+
+ ); +}; + +function mapStateToProps(state) { + const { auth, customizeList } = state; + return { + user: auth.user, + }; +} + +export default connect(mapStateToProps)(ImportUser); diff --git a/web/client/src/sections/wait/components/modeal.js b/web/client/src/sections/wait/components/modeal.js index fb209f8..3435bc4 100644 --- a/web/client/src/sections/wait/components/modeal.js +++ b/web/client/src/sections/wait/components/modeal.js @@ -4,7 +4,6 @@ import dayjs from 'dayjs'; function modeal(props) { const [form] = Form.useForm(); const { visible, handleOk, handleCancel, editData ,setEditData,setState} = props - console.log(editData) useEffect(() => { if (editData && visible) { form.setFieldsValue({ diff --git a/web/client/src/sections/wait/containers/index.js b/web/client/src/sections/wait/containers/index.js index 06fc68f..23a591e 100644 --- a/web/client/src/sections/wait/containers/index.js +++ b/web/client/src/sections/wait/containers/index.js @@ -8,13 +8,14 @@ import moment from "moment"; import { push } from "react-router-redux"; import { Scroller } from "$components"; import ProjectModeal from "../components/modeal"; - +import ImportModeal from "../components/import_model"; export const Default = (props) => { const { dispatch } = props; const [state, setState] = useState(false); //状态 const [counts, setCounts] = useState(); //数据 const [visible, setVisible] = useState(false); //弹窗 const [editData, setEditData] = useState(); //数据 + const [importVisible, setImportVisible] = useState(false); //弹窗 const tableActionRef = useRef(); const columns = [ @@ -90,7 +91,6 @@ export const Default = (props) => { key: "direction", hideInTable: true, dataIndex: "direction", - order: 6, renderFormItem: (item, { type, defaultRender, ...rest }, form) => { return ( + ); + }, + },{ + key: "direction", + hideInTable: true, + dataIndex: "direction", + renderFormItem: (item, { type, defaultRender, ...rest }, form) => { + return ( + + + + ); + }, + }, ]; const handleCancel = () => { tableActionRef.current.reload(); @@ -143,7 +181,10 @@ export const Default = (props) => { } }); }; - + const importHandleCancel = () => { + tableActionRef.current.reload(); + setImportVisible(false); + }; //删除资讯 const delDataList = (record) => { const query = { @@ -159,6 +200,20 @@ export const Default = (props) => { } }); }; + //一键删除 + const confirm = (record) => { + const query = { + table_name: "test_waiting", + delete_all:'1' + }; + dispatch(delCancel(query)).then((res) => { + if (res.success) { + // 刷新 + // tableActionRef.current.reload(); + handleCancel(); + } + }); + }; //编辑 const editor = (record) => { if (record) { @@ -201,6 +256,10 @@ export const Default = (props) => { setState={setState} > + ); }; diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 957e728..a196f4e 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -12,7 +12,9 @@ export const ApiTable = { delCancel: 'deleteDB', //删除信息 //下载项目模板 - getDownProject:'downProject' + getDownProject: 'downProject', + //查询人员信息 + postKeySearch:'keySearch' }; export const RouteTable = {