From 64dc7c32e965b4c24fc8a60d5847356a4c6a963c Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Mon, 27 Feb 2023 14:18:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=AE=A1=E7=90=86=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BB=93=E6=9E=84=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/organization/user.js | 1 + api/app/lib/models/user.js | 9 +++++ script/1.0.3/schema/7.update_user.sql | 1 + .../organization/components/userModal.js | 36 +++++++++++++++++-- .../sections/organization/containers/user.js | 24 ++++++++++--- 5 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 script/1.0.3/schema/7.update_user.sql diff --git a/api/app/lib/controllers/organization/user.js b/api/app/lib/controllers/organization/user.js index 8aaf88b..da397a4 100644 --- a/api/app/lib/controllers/organization/user.js +++ b/api/app/lib/controllers/organization/user.js @@ -235,6 +235,7 @@ async function creatUser(ctx, next) { delete: false, phone: data.phone, post: data.post, + structure:data.structure }) ctx.status = 204; diff --git a/api/app/lib/models/user.js b/api/app/lib/models/user.js index 3ea7040..9d7999a 100644 --- a/api/app/lib/models/user.js +++ b/api/app/lib/models/user.js @@ -95,6 +95,15 @@ module.exports = dc => { primaryKey: false, field: "post", autoIncrement: false + }, + structure: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "结构物", + primaryKey: false, + field: "structure", + autoIncrement: false } }, { tableName: "user", diff --git a/script/1.0.3/schema/7.update_user.sql b/script/1.0.3/schema/7.update_user.sql new file mode 100644 index 0000000..ec5bd1c --- /dev/null +++ b/script/1.0.3/schema/7.update_user.sql @@ -0,0 +1 @@ +ALTER TABLE "user" ADD structure VARCHAR(40); \ No newline at end of file diff --git a/web/client/src/sections/organization/components/userModal.js b/web/client/src/sections/organization/components/userModal.js index 73a082a..4988b85 100644 --- a/web/client/src/sections/organization/components/userModal.js +++ b/web/client/src/sections/organization/components/userModal.js @@ -4,7 +4,7 @@ import { Spin, Card, Modal, TreeSelect, message } from 'antd'; import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; const UserModal = (props) => { - const { visible, modalType, depData, onVisibleChange, onConfirm, editData } = props + const { visible, modalType, depData, onVisibleChange, onConfirm, editData ,tableList} = props const reg_tel = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/; const onFinish = (values) => { if (onConfirm) { @@ -105,7 +105,35 @@ const UserModal = (props) => { /> - { + + }} + fieldProps={{ + fieldNames: { + label: 'title', + }, + treeDefaultExpandAll: false, + }} + rules={[{ required: true, message: '请选择结构物' }]} + request={async () => { + console.log(tableList); + const opts = tableList?.map(i=>({title:i.name,value:i.id})) + return opts + }} + expandedKeys={["title"]} + /> + { { type: 'email', message: '请输入正确格式的邮箱' }, ]} /> + + + {modalType == 'edit' ? null : { ]} />} + { const user = JSON.parse(sessionStorage.getItem('user')); - - const { dispatch, loading, depMessage, depUser, clientHeight } = props; + const [tableList, settableList] = useState([]) + const { dispatch, loading, depMessage, depUser, clientHeight,actions } = props; // 部门 const [deptModalVisible, setDeptModalVisible] = useState(false); const [deptModalType, setDeptModalType] = useState(); const [deptModalRecord, setDeptModalRecord] = useState(); - + const { projectRegime } = actions // 成员 const [modalVisible, setModalVisible] = useState(false); const [modalType, setModalType] = useState(); @@ -29,8 +29,20 @@ const UserManage = (props) => { useEffect(() => { dispatch(getDepMessage()) + projectList() }, []) + const projectList = (obj) => { + + dispatch(projectRegime.getProjectList()).then(res => { + // console.log(res) + if (res.success) { + settableList(res.payload.data?.rows) + // setLimits(res.payload.data?.count) + } + }) + } + useEffect(() => { if (depMessage.length) { setDepSelectedKeys([depMessage[0].id]) @@ -197,7 +209,7 @@ const UserManage = (props) => { } - +console.log(tableList,'tableList') return (
@@ -304,6 +316,7 @@ const UserManage = (props) => { modalType={modalType} onConfirm={onConfirm} editData={modalRecord} + tableList={tableList} /> : '' } @@ -325,7 +338,8 @@ function mapStateToProps(state) { clientHeight: global.clientHeight, loading: depMessage.isRequesting, depMessage: depMessage.data || [], - depUser: depUser.data || [] + depUser: depUser.data || [], + actions: global.actions }; }