Browse Source

修改文章管理bug

yu_ber 4 years ago
parent
commit
daad03dc39

+ 1 - 1
UI/doc/bird-grid.md

@@ -1,4 +1,4 @@
-# bird-grid
+#  
 
 bird-grid是一个简化业务系统增删改查的全自动表格组件。组件内部处理数据加载、分页、排序、查询、新增、编辑等一系列操作。让业务表格开发变得异常简单。
 

+ 4 - 0
UI/src/components/Grid/BirdGrid.js

@@ -721,6 +721,8 @@ class BirdGrid extends React.Component {
   }
 
   filterChange(index) {
+    // console.log(index,this.state.filterRules,'this.state.filterRules');
+    this.props.handleChange && this.props.handleChange(this.state.filterRules);
     return (rule)=>{
       let rules = this.state.filterRules;
       rules[index] = rule;
@@ -742,8 +744,10 @@ class BirdGrid extends React.Component {
         }
         console.log(queryColumns);
         this.setState({columns:columns,queryColumns:queryColumns});
+      
       }
     }
+   
   }
 
   addFilter() {

+ 1 - 0
UI/src/components/Grid/BirdGridFilter.js

@@ -127,6 +127,7 @@ class BirdGridFilter extends PureComponent {
     }
     
     this.props.onChange && this.props.onChange(rule);
+    console.log(this.props,'运行了');
   }
 
   //非级联的两重多选框事件

+ 1 - 1
UI/src/components/Grid/BirdGridQuery.js

@@ -71,8 +71,8 @@ class BirdGridQuery extends React.Component {
       oprator: operator
     });
   }
-
   onValueChange(value) {
+   
     this.setState({
       value: value
     });

+ 73 - 52
UI/src/pages/ArticleContentManage/index.js

@@ -26,9 +26,9 @@ class ArticleManage extends React.Component {
       editorState: BraftEditor.createEditorState('<p>亮剑集团!</b></p>'), // 设置编辑器初始内容
       outputHTML: '<p></p>',
       typeItem: [
-        { label: "全局置顶", typographicTypeId: "1", disabled: false },
-        { label: "科室置顶", typographicTypeId: "2", disabled: false },
-        { label: "分类置顶", typographicTypeId: "3", disabled: false },
+        { label: "全局置顶",value:"3", typographicTypeId: "3", disabled: false },
+        { label: "科室置顶",value:"2",typographicTypeId: "2", disabled: false },
+        { label: "分类置顶",value:"1",typographicTypeId: "1", disabled: false },
       ],  // 置顶类型
       checkStateDataBase: [
         { label: "未通过", value: "0", disabled: false },
@@ -84,6 +84,10 @@ class ArticleManage extends React.Component {
     request({
       url: config.WXMpAPI + "/wx/content/column/queryAllColumns",
       method: "post",
+      data:{
+        pageIndex:1,    
+        pageSize:50
+      }
     }).then((data) => {
       this.setState({
         queryAllColumns: data.items
@@ -97,6 +101,19 @@ class ArticleManage extends React.Component {
     this.isLivinig = false
     // setTimeout(this.setEditorContentAsync, 200)
   }
+  onChangeGrid = ( key) =>{
+     const _Id = key[0]
+     if(_Id.field == "article_column_id"){
+      this.getContentUpdate( _Id.value );
+     }
+  }
+  updateChange = (e)=>{
+    this.setState({
+      articleTitle:e.target.value
+    }, () => {
+
+    })
+  }
   handleChangeText = (editorState) => {
     this.setState({
       editorState: editorState,
@@ -106,7 +123,6 @@ class ArticleManage extends React.Component {
     })
   }
   setEditorContentAsync = () => {
-    console.log('执行了的Async');
     this.isLivinig && this.setState({
       editorState: BraftEditor.createEditorState(this.state.articleContent)
     })
@@ -129,13 +145,12 @@ class ArticleManage extends React.Component {
     });
   }
   onPreview = (Preview) => {
-    console.log(Preview);
+
   }
   removeImg = (imgSrc) => {
-    console.log(imgSrc);
+
   }
   handleChange = (handle) => {
-    console.log(handle,'handle.fileList[0].response.path');
     this.setState({
       handImgPath: handle.fileList[0] && handle.fileList[0].response ? handle.fileList[0].response.path : "",
       headImgList: handle.fileList
@@ -151,12 +166,14 @@ class ArticleManage extends React.Component {
       const { typeItem } = this.state
       if (returned.articlePhotoaddress) {
         var imgUrlMini = returned.articlePhotoaddress;
+        console.log(imgUrlMini,'默认的');
         if (imgUrlMini) {
           let SsoToken = util.auth.getToken();
           let imgSeperator = "?";
           if (imgUrlMini.indexOf("?") !== -1) imgSeperator = "&";
           if (imgUrlMini.indexOf("&") !== -1) imgSeperator = "&";
           imgUrlMini = imgUrlMini.indexOf('Sso-Token') > -1 ? imgUrlMini : imgUrlMini + imgSeperator + 'Sso-Token=' + SsoToken;
+          console.log(imgUrlMini,'no默认的');
         }
         let list = []
         let obj = {}
@@ -171,7 +188,6 @@ class ArticleManage extends React.Component {
           headImgList:[],
         })
       }
- 
       var typographicTypeList = []
       var checkedList = returned.typographicTypeList
       for (let i = 0; i < checkedList.length; i++) {
@@ -188,13 +204,12 @@ class ArticleManage extends React.Component {
         articleTitle: returned.articleTitle, //  标题
         articleEditorId: returned.articleAuthorId,// 作者
         articleCardinalnumber: returned.articleCardinalnumber, //  基数
-        // headImgList:obj,  // 图片地址
-        typographicTypeList: typographicTypeList, // 置顶设置
         articleSummary: returned.articleSummary,  // 摘要
         selectLableKeys: returned.tagTypeList, // 标签
         selectDepartment: returned.departmentList,  //  科室
         selectCategory: returned.classificationList, // 分类
         articleContent: returned.articleContent, // 分类
+        typographicTypeList: typographicTypeList, // 置顶设置
         visible: true,
       }, () => {
           console.log(this.state.defaultName,'defaultName');
@@ -306,7 +321,6 @@ class ArticleManage extends React.Component {
       setTimeout(() => this.refs.grid.reload(), 3000);
     } else {
       const value = this.refs.myInput;
-      console.log(value);
       this.setState({
 
       })
@@ -329,7 +343,6 @@ class ArticleManage extends React.Component {
       }
     }
     data.typographicTypeList = hicTypeList
-    console.log(data, 'date-wrapper');
     this.props.dispatch({ type: 'ContentManage/goodsTheShelves', payload: { data } });
     this.setState({
       Topping: false,
@@ -337,7 +350,6 @@ class ArticleManage extends React.Component {
     setTimeout(() => this.refs.grid.reload(), 3000);
   }
   onChangeCheckbox = checkedList => {
-    console.log(checkedList, '选中的');
     const { typeItem } = this.state
     var selectTypeLable = []
     for (let i = 0; i < checkedList.length; i++) {
@@ -354,7 +366,7 @@ class ArticleManage extends React.Component {
   handleChangeColumn = (val) => {
     for (let i = 0; i < this.state.queryAllColumns.length; i++) {
       if (this.state.queryAllColumns[i].columnName == val) {
-        console.log(this.state.queryAllColumns[i]);
+       console.log(this.state.queryAllColumns[i].columnId,'uk-icon-ioxhost');
         this.setState({
           tagId: this.state.queryAllColumns[i].columnId,
         });
@@ -378,7 +390,6 @@ class ArticleManage extends React.Component {
             }
           }
         }
-        console.log(this.state.handImgPath,'this.state.handImgPath');
 
         let hicColumn = {} //  栏目ID
         hicColumn.columnId = this.state.tagId
@@ -387,7 +398,7 @@ class ArticleManage extends React.Component {
         parame.articleTitle = values.title;
         parame.articleId = this.state.articleId,
         parame.articleStatus = index;  // 文章状态(0为保存,1为保存并发布,-1下架)
-        parame.articleAuthorId = 4;   // 作者ID
+        // parame.articleAuthorId = 4;   // 作者ID
         parame.articleSummary = values.content
         parame.articlePhotoaddress = this.state.handImgPath
         parame.articleCardinalnumber = Number(values.read)
@@ -412,11 +423,13 @@ class ArticleManage extends React.Component {
       },
       filterRules: [
         {
-          field: "column_id",
+          // field: "column_id",
+          field: "classification_column_id",
           operate: "equal",
           value: that.state.tagId
         }
       ],
+
       pageSize: 10,
       checkable: true,
       actions: [{
@@ -424,6 +437,8 @@ class ArticleManage extends React.Component {
         onClick: (id, data) => {
           if(data.length==0){
             message.error("请勾选分类");
+          } else {
+            message.success("保存成功");
           }
           let selectArr = []
           data.map(val => {
@@ -440,8 +455,9 @@ class ArticleManage extends React.Component {
       ],
       columns: [
         { title: "分类ID", data: "classificationId", type: "text", query: false },
-        { title: "关键词", data: "column_id", type: "text", editor: {}, query: true, hide: true },
-        { title: "分类名称", data: "classificationDescription", type: "text", query: false },
+        // { title: "关键词", data: "column_id", type: "text", editor: {}, query: true, hide: true },
+        { title: "分类名称", data: "classificationName", type: "text", query: false },
+        // { title: "分类名称", data: "classificationDescription", type: "text", query: false },
       ],
     };
     return gridOption
@@ -461,7 +477,8 @@ class ArticleManage extends React.Component {
         onClick: (id, data) => {
           if(data.length==0){
             message.error("请勾选科室");
-            return
+          } else {
+            message.success("保存成功");
           }
           let selectArr = []
           data.map(val => {
@@ -498,9 +515,9 @@ class ArticleManage extends React.Component {
         name: "标签保存",
         onClick: (id, preservation) => {
           if(preservation.length==0){
-            console.log(preservation.length,'loader___1O6A9');
             message.error("请勾选标签");
-            return
+          } else {
+            message.success("保存成功");
           }
           let selectArr = []
           preservation.map(val => {
@@ -528,29 +545,40 @@ class ArticleManage extends React.Component {
     };
     return gridOption
   }
-  // 获取栏目
-  getColumnInformation = () => {
-    let that = this;
-    var baseDate = []
+   getContentUpdate =( id )=>{
     let parme = {
       "filters": [
         {
           "field": "column_id",
           "operate": "equal",
-          "value": 2
+          "value":id
         }
       ]
     }
-    request({
-      url: config.WXMpAPI + "/wx/content/column/queryAllColumns",
+      request({
+      url: config.WXMpAPI + "/wx/content/classification/queryAllClassificationsSelection",
       method: "post",
-      data: parme
+      data:parme
     }).then((data) => {
-
+        this.refs.grid.props.gridOption.columns[3].source.data = data
+        this.refs.grid.state.columns[3].source.data = data
     }).catch((error) => {
 
     });
 
+    // const data = [
+    //   { label:"时间2",value:1},
+    //   { label:"时间1",value:12},
+    //   { label:"时间2",value:123},
+    //   { label:"时间3",value:1234},
+    // ]
+    // this.refs.grid.props.gridOption.columns[3].source.data = data
+  }
+  // 获取栏目
+  getColumnInformation = () => {
+    let that = this;
+    var baseDate = []
+   
     let gridOption = {
       title: "权限资源",
       title: "关键词",
@@ -559,9 +587,6 @@ class ArticleManage extends React.Component {
       },
       pageSize: 10,
       checkable: true,
-      afterQuery: function (resultout, filters) {
-
-      },
       actions: [{
         name: '添加文章', onClick: function () {
           that.setState({
@@ -583,6 +608,7 @@ class ArticleManage extends React.Component {
             articleId: "",
             outputHTML:""
           })
+          that.props.form.resetFields();
           that.showModal('visible')
         }
       }
@@ -599,24 +625,24 @@ class ArticleManage extends React.Component {
         },
         {
           title: "文章分类", data: "classification_id", type: "dropdown",
-          source: { data: baseDate }, query: true, hide: true,ieditor: {ap: 'hide', ep: 'hide'}
+          source: { data: [] }, query: true, hide: true
           // source: { url: WXMpAPI + "/wx/content/column/queryAllColumns"  }, query: true, hide: true
         },
         {
-          title: "置顶类型", data: "typographic_type_id", type: "text",
+          title: "置顶类型", data: "typographic_type_id", type: "dropdown",
           source: { data: that.state.typeItem }, query: true, hide: true
         },
         {
-          title: "发布状态", data: "article_status", type: "text",
+          title: "发布状态", data: "article_status", type: "dropdown",
           source: { data: that.state.releaseStatus }, query: true, hide: true
         },
-        { title: "关键词", data: "", type: "text", query: true, hide: true },
+        { title: "标题", data: "article_title", type: "text", query: true, hide: true },
 
 
         
         { title: "标题", data: "articleTitle", type: "text", query: false },
         { title: "作者", data: "articleAuthorId", type: "text", query: false },
-        { title: "创建时间", data: "articleCreatedate", type: "text", query: false },
+        { title: "创建时间", data: "articleCreateDate", type: "text", query: false },
         { title: "真实浏览量", data: "articleRealpageviews", type: "text", query: false },
         {
           title: "状态", data: "articleStatus", type: "number", query: false,
@@ -634,6 +660,7 @@ class ArticleManage extends React.Component {
                   dynamicTitle: "编辑文章",
                   articleId:data.articleId,
                 })
+                that.props.form.resetFields();
                 console.log(data);
                 that.editMation(data.articleId);
                 setTimeout(that.setEditorContentAsync,1000)
@@ -670,7 +697,6 @@ class ArticleManage extends React.Component {
             },
             {
               name: '链接', onClick: function (data) {
-                console.log(data);
                 if (data.articleLinkAddress) {
                   that.setState({
                     httpModal: true,
@@ -828,14 +854,17 @@ class ArticleManage extends React.Component {
                   </Select>
                 )}
               </Form.Item>
+
               <Form.Item label="标题">
                 {getFieldDecorator('title', {
                   initialValue: this.state.articleTitle || "",
                   rules: [{ required: true, message: '请填写标题!' }],
                 })(
-                  <Input key={ this.state.articleTitle }/>
+                  <Input/>
+                  // <Input onChange={(e)=>this.updateChange(e)}/>
                 )}
               </Form.Item>
+
               <Form.Item label="封面图片">
                 <Upload
                   listType="picture-card"
@@ -844,7 +873,7 @@ class ArticleManage extends React.Component {
                   onPreview={file => this.onPreview(file)}// 预览
                   onRemove={file => this.removeImg("headImgList")}
                   onChange={result => this.handleChange(result, "headImgList")}
-                  action={WXMpAPI + "/wx/file/upload"}
+                  action={WXMpAPI + "/wx/content/upload "}
                 >
                   {this.state.headImgList.length >= 1 ? null : uploadButton}
                 </Upload>
@@ -875,12 +904,6 @@ class ArticleManage extends React.Component {
                     onChange={(e) => this.onChangeCheckbox(e)}
                   />
                 )}
-
-                {/* <CheckboxGroup
-                  options={plainOptions}
-                  value={this.state.typographicTypeList}
-                  onChange={(e) => this.onChangeCheckbox(e)}
-                /> */}
               </Form.Item>
               <Form.Item label="标签">
                 <div>
@@ -897,7 +920,7 @@ class ArticleManage extends React.Component {
                   initialValue: this.state.articleSummary || "",
                   rules: [{ required: true, message: '请填写摘要!' }],
                 })(
-                  <Mentions rows="3" placeholder="You can use @ to ref user here"></Mentions>
+                  <Mentions rows="3" value={this.state.articleSummary} placeholder="You can use @ to ref user here"></Mentions>
                 )}
               </Form.Item>
               <Form.Item label="选择科室">
@@ -921,8 +944,6 @@ class ArticleManage extends React.Component {
                   <Button type="Dashed" size={80} style={{ width: '80px', fontSize: "30px", display: "flex", alignItems: "center", justifyContent: "center" }} onClick={() => this.showChildren('category')} ><Icon type='plus' style={{ fontSize: '20px' }} /></Button>
                 </div>
               </Form.Item>
-
-
               <Form.Item label="">
                 <div style={{ width: "600px", display: "flex" }}>
                   <Button type="primary" size={80} htmlType="submit" onClick={(e) => this.handleSubmit(e, 1)} style={{ marginLeft: "100px", marginRight: "30px", width: '120px' }}>保存并发布</Button>
@@ -936,7 +957,7 @@ class ArticleManage extends React.Component {
             />
           </div>
         </Modal>
-        <BirdGrid gridOption={this.getColumnInformation()} ref="grid" />
+        <BirdGrid handleChange={(key,value)=>this.onChangeGrid(key,value) } gridOption={ this.getColumnInformation()} ref="grid" />
       </div>
     )
   }

+ 70 - 0
UI/src/pages/contentManage/cateManage.css

@@ -0,0 +1,70 @@
+:global {
+  /* 重写antd默认布局样式 
+.ant-layout {
+  .ant-layout-header {
+    height: auto;
+    line-height: normal;
+    padding: 0;
+    background: #fff;
+    overflow: hidden;
+  }
+
+  .ant-layout-content {
+    position: relative;
+    min-height: auto; // override antd min-height: 0;
+    // overflow: auto;
+  }
+
+  .ant-layout-footer {
+    text-align: center;
+    width: 100%;
+    background-color: #fff;
+    padding: 10px;
+  }
+}*/
+}
+:global .message_item {
+  width: 80%;
+  display: flex;
+  flex-flow: row nowrap;
+  justify-content: space-between;
+  align-items: center;
+  margin: 1rem auto;
+}
+:global .message_item input,
+:global .message_item TextArea {
+  width: 70%;
+}
+:global .flex {
+  display: flex;
+  height: 100%;
+  position: relative;
+}
+:global .flex-column {
+  flex-direction: column;
+}
+:global .flex-auto {
+  flex: auto;
+  position: relative;
+  height: 100%;
+}
+:global .flex-auto-hidden {
+  flex: auto;
+  position: relative;
+  height: 100%;
+  overflow: hidden;
+}
+:global .flex-none {
+  flex: none;
+  position: relative;
+}
+:global .abs {
+  position: absolute;
+}
+:global .abs-full {
+  position: absolute;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+}

+ 121 - 18
UI/src/pages/contentManage/cateManage.js

@@ -3,11 +3,11 @@ import { BirdTreeGrid, BirdGrid } from 'components/Grid';
 import { config, request, permission, util } from 'utils'
 import { message, Modal, Button, Input } from 'antd';
 const { TextArea } = Input;
-import AutoForm from 'components/Grid/BirdGridForm';
-const { APIV3, WXMpAPI } = config;
+const { APIV3, WXMpAPI,APIV4 } = config;
 import styles from './cateManage.less';
 import { connect } from 'dva'
 import { routerRedux } from 'dva/router'
+// import config from 'utils/config'
 class BirdGridPermissionPage extends React.Component {
   constructor(props) {
     super(props)
@@ -26,13 +26,21 @@ class BirdGridPermissionPage extends React.Component {
   };
 
   handleOk = () => {
-    this.setState({ loading: true });
-    setTimeout(() => {
-      this.setState({ loading: false, visible: false });
-    }, 50);
+    let self = this
+    if (this.state.columnName == null || this.state.columnName == '') {
+      message.error("栏目名称不能为空")
+      return;
+  }
+
+  this.setState({
+    loading: false,
+    visible: false,
+  }, () => {
+
     let formData = {}
     formData.columnName = this.state.columnName
     formData.columnDescription = this.state.columnDescription
+
     request({
       url: WXMpAPI + "/wx/content/column/addColumn",
       method: "post",
@@ -40,15 +48,38 @@ class BirdGridPermissionPage extends React.Component {
     }).then(function (res) {
       if (res.success == 1) {
         message.success('操作成功!');
-        // self.setState({
-        //   keywordModelVisible: false,
-        // });
-        // self.refs.grid.query();
+        self.refs.grid.reload();
+   
       } else {
         message.error(res.message);
       }
     });
+  })
+
+    // this.setState({ loading: true });
+    // setTimeout(() => {
+    //   this.setState({ loading: false, visible: false });
+    // }, 50);
 
+    // let formData = {}
+    // formData.columnName = this.state.columnName
+    // formData.columnDescription = this.state.columnDescription
+    // request({
+    //   url: WXMpAPI + "/wx/content/column/addColumn",
+    //   method: "post",
+    //   data: formData
+    // }).then(function (res) {
+    //   if (res.success == 1) {
+    //     message.success('操作成功!');
+    //     // self.setState({
+    //     //   keywordModelVisible: false,
+    //     // });
+    //     self.refs.grid.query();
+    //   } else {
+    //     message.error(res.message);
+    //   }
+    // });
+    
   };
   changeLinkValue1 = (e) => {
     let value = e.target.value;
@@ -84,6 +115,33 @@ class BirdGridPermissionPage extends React.Component {
   }
   render() {
     let self = this
+
+  //   let gridOption = {
+  //     title: "栏目列表",
+  //     pageSize: 10,
+  //     checkable: false,
+  //     url: {
+  //       read: WXMpAPI + "/wx/content/column/queryAllColumns",
+  //         // read: APIV3Auth + "/ums/resource/query",
+  //         // add: APIV3Auth + "/ums/resource/addResource",
+  //         // edit: APIV3Auth + "/ums/resource/update",
+  //     },
+  //     afterSave: function(){
+  //         console.log(self.refs.gridResource)
+  //     },
+  //     columns: [
+  //         { title: "接口编码", data: "columnId", type: "text", query: false },
+  //         { title: "接口名称", data: "columnName", type: "text", hide: false, editor: {},query: true },
+  //         {
+  //             title: "接口类型", data: "columnDescription", type: "dropdown",
+  //             editor: {},
+  //             // source: { url: APIV3Auth + '/ums/resourceType/selectAllAsJson' },
+  //             query: true
+  //         },
+  //     ]
+  // };
+
+
     let gridOption = {
       title: "表格示例",
       url: {
@@ -103,30 +161,75 @@ class BirdGridPermissionPage extends React.Component {
       }],
       columns: [
         { title: "编码", data: "columnId", type: "number" },
-        { title: "栏目名称", data: "columnName", type: "text", editor: {}, query: true },
-        { title: "栏目描述", data: "columnDescription", type: "text", editor: {}, query: true },
+        { title: "栏目名称", data: "columnName", type: "text", editor: {}},
+        { title: "栏目描述", data: "columnDescription", type: "text", editor: {}},
         {
           title: "操作选项", type: "command", actions: [{
             name: '栏目管理',
+
             onClick: (data) => {
               this.props.dispatch({
                 type: 'app/updateState', payload: {
-                  menuPath: [{id:"310_panelchange_",name:"内容管理"}]
+                  menuPath: [{id:"310_panelchange_",name:"新增商品"}]
                 }
               });
               self.props.dispatch(routerRedux.push({
                 pathname: '/contentManage/columnManage',
-                query: { columnId: data.columnId},
+                query: { columnId: data.columnId,columnName:data.columnName},
               })
               );
+
             }
           }]
         }
       ]
     };
-    return <div>
-      <div onClick={this.onClick}></div>
-      <BirdGrid gridOption={gridOption} />
+    
+  //   let gridOption = {
+  //     title: "表格示例",
+  //     url: {
+  //         // read: APIV4 + "/userPointLog/logs",
+  //         read: APIV4 + "/pointGrowthRule/ruleCondition",
+  //         // add: "/japi/pointGrowthRule/rule",
+  //         // edit: "/test/edit",
+  //         // delete: "/japi/pointGrowthRule/deleteRule"
+  //     },
+  //     pageSize: 8,
+  //     checkable: false,
+  //     //actions: [{ name: '外部按钮', color: 'error', onClick: function () { } }],
+  //     columns: [
+  //       { title: "编码", data: "id", type: "number" },
+  //       { title: "栏目名称", data: "terminalName", type: "text", editor: {}},
+  //       { title: "栏目描述", data: "terminalCode", type: "text", editor: {}},
+
+  //         // { title: "编号", data: "id", type: "text", editor: {} },
+  //         // { title: "平台名称", data: "terminalName", type: "dropdown", editor: {}, source: { data: this.state.originTypeDatabase } },
+  //         // { title: "平台编号", data: "terminalCode", type: "text", editor: {} },
+  //         {
+  //           title: "操作选项", type: "command", actions: [{
+  //             name: '栏目管理',
+  
+  //             onClick: (data) => {
+  //               this.props.dispatch({
+  //                 type: 'app/updateState', payload: {
+  //                   menuPath: [{id:"310_panelchange_",name:"新增商品"}]
+  //                 }
+  //               });
+  //               self.props.dispatch(routerRedux.push({
+  //                 pathname: '/contentManage/columnManage',
+  //                 query: { columnId: data.columnId,columnName:data.columnName},
+  
+  //               })
+  //               );
+  
+  //             }
+  //           }]
+  //         }
+  //     ]
+  // };
+
+    return <div className="index">
+      <BirdGrid gridOption={gridOption} ref="grid"/>
       <Modal
         visible={this.state.visible}
         onOk={this.handleOk}
@@ -134,7 +237,7 @@ class BirdGridPermissionPage extends React.Component {
         onCancel={this.handleCancel}
       >
         <div className="message_item">
-          <span>栏目名称</span><Input value={self.state.columnName} onChange={(e) => this.changeLinkValue1(e)} />
+          <span>栏目名称</span><Input maxLength={10} value={self.state.columnName} onChange={(e) => this.changeLinkValue1(e)} />
         </div>
         <div className="message_item">
           <span>栏目描述</span><TextArea value={self.state.columnDescription} onChange={(e) => this.changeLinkValue2(e)} />

+ 1 - 1
UI/src/pages/contentManage/columnManage.css

@@ -44,7 +44,7 @@
   width: 98%;
   margin: 0 auto;
   background-color: #fff;
-  padding-bottom: 20px ;
+  padding: 20px 0 20px 10px;
 }
 :global .columnManage hr {
   margin: 20px 0;

+ 147 - 45
UI/src/pages/contentManage/columnManage.js

@@ -9,18 +9,19 @@ import AutoForm from 'components/Grid/BirdGridForm';
 const { SubMenu } = Menu;
 const { APIV3, WXMpAPI } = config
 import styles from './columnManage.less';
-import $ from "jquery"
 
 const uploadButton = (
     <div>
         <Icon type='plus' />
     </div>
 );
+
 class BirdGridPermissionPage extends React.Component {
     constructor(props) {
         super(props)
         this.state = {
             columnId: "",
+            columnName:"",
             saveId: [],
             loading: false,
             visible: false, //分类管理
@@ -33,7 +34,7 @@ class BirdGridPermissionPage extends React.Component {
             addshow: [{ display: false, active: false }],
             Carouselshowitem: [{ display: true, active: true }, { display: false, active: false }, { display: false, active: false }, { display: false, active: false }, { display: false, active: false }, { display: false, active: false }, { display: false, active: false }, { display: false, active: false }, { display: false, active: false }],
             Carouseaddtiem: [{ display: false, active: false }],
-            addCarouseitem: { rotationGraphColumnId: 1, rotationGraphAddress: "fdfdwvbw", rotationGraphName: "轮播图4", rotationGraphUrl: "bvwv" },//添加轮播
+            addCarouseitem: { rotationGraphColumnId: 1, rotationGraphAddress:"", rotationGraphName: "轮播图标题", rotationGraphUrl: "跳转url" , headAddSliceImgList:[]},//添加轮播
             search_Department: '',//查询科室
             classficName: "",//分类管理弹窗
             classficDescription: "",//分类管理弹窗
@@ -54,7 +55,9 @@ class BirdGridPermissionPage extends React.Component {
             visiblewarn: false,
             visiblefloor: false,
             headImgList:[],
-            handImgPath:null
+            handImgPath:null,
+            ColumnMS:"",
+            labelChecked:true,
         }
     }
 
@@ -116,21 +119,54 @@ class BirdGridPermissionPage extends React.Component {
             data: list
         }).then(function (getListRes) {
             if (getListRes.success == 1) {
-
-                // getListRes.items.forEach((item,index)=>{
-                //     return self.state.headImgList = self.state.headImgList.push(item.rotationGraphAddress)
-                // // return   console.log(item.rotationGraphAddress);
-                // })
                 self.setState({
                     Menudata: getListRes.items,
-                    // headImgList:self.state.headImgList
                 })
+                if(getListRes.items.length>=0){
+                    self.state.Carouselshowitem.forEach((item, index) => {
+                        return item.display = false
+                    })
+                    self.state.Carouseaddtiem.forEach((item, index) => {
+                        return item.display = true
+                    })
+                    self.setState({
+                        Carouselshowitem: self.state.Carouselshowitem,
+                        Carouseaddtiem: self.state.Carouseaddtiem
+                    })
+                }
+            }
+        });
+
+    
+    }
+
+    //编辑项目描述
+    editColumn=()=>{
+
+         let list = {
+                "columnId":this.state.columnId,
+                "columnDescription": this.state.ColumnMS
+            }            
+
+        request({
+            url: WXMpAPI + '/wx/content/column/editColumn',
+            method: "post",
+            data: list
+        }).then(function (getListRes) {
+            if (getListRes.success == 1) {
+
+               message.success("编辑成功")
+
             }
         });
+
     }
+
     componentWillReceiveProps(props) {
-        // console.log(props);
-        this.setState({ columnId: props.location.query.columnId });
+        var id = props.location.query.columnId
+        var name = props.location.query.columnName
+        this.setState({ columnId: id,columnName:name});
+        console.log(props);
     }
     //切换模块
     changetabactive = (key) => {
@@ -145,13 +181,7 @@ class BirdGridPermissionPage extends React.Component {
     }
 
     switchmenu(index) {
-        // this.refs.ele.style.display = "block"
-
-        // var ele = document.getElementsByClassName("slide_manage")
-        // for (var i = 0; i < ele.length; i++) {
-        //     ele[i].style.display = "none"
-        // }
-        // ele[key].style.display = "block"
+     
 
         this.state.Carouselshowitem.map(item => {
             item.active = false
@@ -181,6 +211,12 @@ class BirdGridPermissionPage extends React.Component {
         this.setState({
             departmentState: true,
         });
+        if(this.state.departmentState){
+            this.setState({
+                saveId:[]
+            })
+        }
+        console.log(this.state.saveId);
         // console.log(document.getElementsByClassName('departments'));
         // document.getElementsByClassName('BirdGrid__action___28SRF').style.color = 'orange'
 
@@ -291,6 +327,7 @@ class BirdGridPermissionPage extends React.Component {
     //勾选添加科室
     departmentOk = () => {
         let list = this.state.saveId
+        console.log(list);
         request({
             url: WXMpAPI + '/wx/content/department/addDepartment',
             method: "post",
@@ -298,6 +335,8 @@ class BirdGridPermissionPage extends React.Component {
         }).then(function (getListRes) {
             if (getListRes.success == 1) {
                 message.success('添加成功');
+            }else{
+                message.error(getListRes.message)
             }
         });
 
@@ -591,7 +630,68 @@ class BirdGridPermissionPage extends React.Component {
             handImgPath: handle.fileList[0] && handle.fileList[0].response ? handle.fileList[0].response.path : "",
             headImgList: handle.fileList
           })
+    }
+    editColumnMS=(e)=>{
+        let value = e.target.value
+        this.setState({
+            ColumnMS:value
+        })
+    }
+    //保存添加轮播
+    saveaddSliceitem=(e)=>{
+        
+        let {rotationGraphColumnId,rotationGraphAddress,rotationGraphName,rotationGraphUrl} = this.state.addCarouseitem
+
+        let list = {
+                rotationGraphColumnId:this.state.columnId,
+             	rotationGraphAddress: rotationGraphAddress,
+                rotationGraphName: rotationGraphName,
+                rotationGraphUrl: rotationGraphUrl
+            }    
+
+        console.log(list);
 
+        // request({
+        //     url: WXMpAPI + '/wx/content/ rotationGraph/addRotationGraph',
+        //     method: "post",
+        //     data: list
+        // }).then(function (getListRes) {
+        //     if (getListRes.success == 1) {
+        //        message.success("添加成功")
+        //     }
+        // });
+    }
+
+    handleAddSliceChange=(handle)=>{
+
+        this.state.addCarouseitem.rotationGraphAddress= handle.fileList[0] && handle.fileList[0].thumbUrl 
+        this.state.addCarouseitem.headAddSliceImgList= handle.fileList
+        this.setState({
+            addCarouseitem: this.state.addCarouseitem,
+          })
+
+    }
+    removeAddSliceImg=()=>{
+        this.state.addCarouseitem.headAddSliceImgList.splice(0,1)
+
+        this.setState({
+            addCarouseitem: this.state.addCarouseitem,
+          })
+
+          console.log(this.state.addCarouseitem.headAddSliceImgList);
+
+    }
+    checkedType=(event)=>{
+        if (event.target.checked) {
+            this.setState({
+              labelChecked: true
+            })
+          } else {
+            this.setState({
+              labelChecked: false
+            })
+          }
+      
     }
     render() {
         let self = this
@@ -677,10 +777,6 @@ class BirdGridPermissionPage extends React.Component {
                 // delete: "/test/delete"
             },
             checkable: false,
-            // dataSource: [
-            //     { id: 1, title: "xiaohong" },
-            //     { id: 2, title: "xiaobai" },
-            // ],
             pageSize: 10,
             filterRules: [
                 { "field": "department_name", "operate": "contains", "value": self.state.search_Department }
@@ -690,16 +786,20 @@ class BirdGridPermissionPage extends React.Component {
                 { title: "科室名称", data: "departmentName", type: "text", editor: {} },
                 {
                     title: "操作", type: "command", actions: [{
-                        name: <Checkbox ></Checkbox>,
+                        name: <Checkbox onClick={(e)=>{this.checkedType(e)}}></Checkbox>,
                         onClick: (data) => {
-                            let saveId = this.state.saveId
-                            let columnId = this.state.columnId
-                            let arrid = { "columnId": columnId, "departmentId": data.departmentId }
-                            saveId.push(arrid)
 
+                            if(self.state.labelChecked){
+                            let saveId =  self.state.saveId
+                            let columnId =  self.state.columnId
+                            let arrid = { "columnId": columnId, "departmentId": data.departmentId }
+                            saveId.push(arrid) 
+                            }
+                            
                         }
                     }]
                 }
+
             ]
         };
         let searchtext = {
@@ -812,19 +912,18 @@ class BirdGridPermissionPage extends React.Component {
 
         return (
             <div className="columnManage">
-                <h2>常见药品知识</h2>
+                <h2>{self.state.columnName}</h2>
                 <div className="describe">
-                    <div>目描述</div>
+                    <div>目描述</div>
                     <div className="describe_text">
-                        <TextArea rows={5} />
+                        <TextArea rows={5}  value={this.state.ColumnMS} onChange={(e)=>this.editColumnMS(e)}/>
                     </div>
-                    <Button type="primary">保存</Button>
+                    <Button type="primary" onClick={this.editColumn}>保存</Button>
                 </div>
                 <Divider />
                 <Tabs activeKey={self.state.ActiveKey}
                     onChange={(key) => {
                         this.changetabactive(key)
-
                     }} >
                     <TabPane tab="推荐科室" key="1">
                         <p>内容首页推荐的7个科室。拖拽下面科室可进行排序。点击右上角删除按钮,可移出推荐展示。</p>
@@ -844,6 +943,8 @@ class BirdGridPermissionPage extends React.Component {
 
                                     {/* <div className={this.state.show[1].active ? "active" : ""} onClick={() => this.switchflooritem(1)}>2</div>
                                     <div className={this.state.show[2].active ? "active" : ""} onClick={() => this.switchflooritem(2)}>3</div> */}
+                                
+
                                 </div>
                                 <Button type="primary" onClick={this.addflooritem}>添加</Button>
                             </div>
@@ -990,19 +1091,25 @@ class BirdGridPermissionPage extends React.Component {
                                     <div className="floor_1">
                                         <div className="slide_cont">
                                             <div className="text">封面</div>
-                                            <Upload {...fileProps}>
-                                                <Button>
-                                                    +
-                                                </Button>
-                                            </Upload>
+                                            <Upload listType="picture-card"
+                                                            fileList={ this.state.addCarouseitem.headAddSliceImgList}
+                                                            showUploadList={{ showPreviewIcon: true }}
+                                                            onPreview={file => this.onPreview(file)}// 预览
+                                                            onRemove={file => this.removeAddSliceImg("headImgList")}
+                                                            onChange={result => this.handleAddSliceChange(result, "headImgList")}
+                                                            action={WXMpAPI + "/wx/file/upload"}
+                                                        >
+                                                            { this.state.addCarouseitem.headAddSliceImgList.length >= 1 ? null : uploadButton}
+                                                        </Upload>
+
 
                                         </div>
                                         <p>请上传 670*156 尺寸的图片</p>
                                     </div>
 
-                                    <div className="slide_message"><span className="text">标题</span><Input placeholder="轮播图标题" value={this.state.addCarouseitem.rotationGraphName} onChange={(e) => this.addCarouseName(e)} /></div>
-                                    <div className="slide_message"><span className="text">链接</span><Input placeholder="轮播图标题" value={this.state.addCarouseitem.rotationGraphUrl} onChange={(e) => this.addCarouseUrl(e)} /></div>
-                                    <Button type="primary">保存</Button>
+                                    <div className="slide_message"><span className="text">标题</span><Input value={this.state.addCarouseitem.rotationGraphName} onChange={(e) => this.addCarouseName(e)} /></div>
+                                    <div className="slide_message"><span className="text">链接</span><Input  value={this.state.addCarouseitem.rotationGraphUrl} onChange={(e) => this.addCarouseUrl(e)} /></div>
+                                    <Button type="primary" onClick={this.saveaddSliceitem}>保存</Button>
                                 </div>
                                 <div className="del_item" onClick={this.del_slideItem}>X</div>
                             </div>
@@ -1073,16 +1180,11 @@ class BirdGridPermissionPage extends React.Component {
                     <div className="departments">
                         <div className="header_search">
                             <Search enterButton="搜索" size="large" onSearch={value => this.search_Department(value)} />
-                            {/* <Input  value={self.state.search_Department} />
-                            <Button type="primary" onClick={(e) => this.search_Department(e)}>搜索</Button> */}
                         </div>
                         <BirdGrid gridOption={departments_alert} />
                     </div>
-                    {/* <MyBirdGrid gridOption={departments_alert} /> */}
                 </Modal>
                 {/* 推荐科室 */}
-                {/* <BirdGrid gridOption={gridOption} /> */}
-
                 <Modal title="删除提醒" visible={this.state.visiblewarn} onOk={this.handlewarnOk} onCancel={() => { this.setState({ visiblewarn: false }) }}>
                     <p>删除后无法恢复。是否确认删除当前楼层</p>
                 </Modal>

+ 1 - 1
UI/src/pages/contentManage/columnManage.less

@@ -21,7 +21,7 @@
     width: 98%;
     margin: 0 auto;
     background-color: #fff;
-    padding-bottom:20px ;
+    padding:20px 0 20px 10px;
     hr{
       margin: 20px 0;
     }