From 81bf62fb980a75dac5d609cac5318f2ebe8ece61 Mon Sep 17 00:00:00 2001 From: "gaoxiaolin.gao" Date: Wed, 15 Aug 2018 16:56:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=E9=A1=B9=E7=9B=AE=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=A4=84=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?tag=E6=A0=87=E7=AD=BE=EF=BC=8C=E5=8C=85=E6=8B=ACtag=20=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E5=92=8Ctag=20=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Setting/ProjectMessage/ProjectMessage.js | 53 +++++++- .../Setting/ProjectMessage/ProjectTag.js | 121 ++++++++++++++++++ .../Setting/ProjectMessage/ProjectTag.scss | 18 +++ client/reducer/modules/project.js | 5 +- server/models/project.js | 5 +- 5 files changed, 195 insertions(+), 7 deletions(-) create mode 100644 client/containers/Project/Setting/ProjectMessage/ProjectTag.js create mode 100644 client/containers/Project/Setting/ProjectMessage/ProjectTag.scss diff --git a/client/containers/Project/Setting/ProjectMessage/ProjectMessage.js b/client/containers/Project/Setting/ProjectMessage/ProjectMessage.js index 5d73fb64..3f660309 100755 --- a/client/containers/Project/Setting/ProjectMessage/ProjectMessage.js +++ b/client/containers/Project/Setting/ProjectMessage/ProjectMessage.js @@ -37,6 +37,7 @@ const confirm = Modal.confirm; import { nameLengthLimit, entries, trim } from '../../../../common'; import '../Setting.scss'; import _ from 'underscore'; +import ProjectTag from './ProjectTag.js'; // layout const formItemLayout = { labelCol: { @@ -106,12 +107,19 @@ class ProjectMessage extends Component { const { form, updateProject, projectMsg, groupList } = this.props; form.validateFields((err, values) => { if (!err) { - let assignValue = Object.assign(projectMsg, values); + let { tag } = this.tag.state; + // let tag = this.refs.tag; + tag = tag.filter(val => { + return val.name !== ''; + }); + let assignValue = Object.assign(projectMsg, values, { tag }); + values.protocol = this.state.protocol.split(':')[0]; const group_id = assignValue.group_id; const selectGroup = _.find(groupList, item => { return item._id == group_id; }); + updateProject(assignValue) .then(res => { if (res.payload.data.errcode == 0) { @@ -138,6 +146,10 @@ class ProjectMessage extends Component { }); }; + tagSubmit = tag => { + this.tag = tag; + }; + showConfirm = () => { let that = this; confirm({ @@ -221,8 +233,28 @@ class ProjectMessage extends Component { (location.port !== '' ? ':' + location.port : '') + `/mock/${projectMsg._id}${projectMsg.basepath}+$接口请求路径`; let initFormValues = {}; - const { name, basepath, desc, project_type, group_id, switch_notice, strice, is_json5 } = projectMsg; - initFormValues = { name, basepath, desc, project_type, group_id, switch_notice, strice , is_json5}; + const { + name, + basepath, + desc, + project_type, + group_id, + switch_notice, + strice, + is_json5, + tag + } = projectMsg; + initFormValues = { + name, + basepath, + desc, + project_type, + group_id, + switch_notice, + strice, + is_json5, + tag + }; const colorArr = entries(constants.PROJECT_COLOR); const colorSelector = ( @@ -358,6 +390,21 @@ class ProjectMessage extends Component { ] })(