liting2017 6 年 前
コミット
349499cfcf
共有3 個のファイルを変更した50 個の追加28 個の削除を含む
  1. 19 6
      js/component/account/achievement/techAchievement.jsx
  2. 12 15
      js/component/account/business/businessProject.jsx
  3. 19 7
      js/component/account/demand/techDemand.jsx

+ 19 - 6
js/component/account/achievement/techAchievement.jsx

@@ -120,7 +120,6 @@ const DemandList = React.createClass({
                     render:(text,recard) => {
                         return  <div className="btnRight">
                                    {recard.auditStatus!='1'&&recard.auditStatus!='2'&&<Button type="primary" style={{ background: "#3fcf9e", border: "none", color: "#fff" }} onClick={(e)=>{e.stopPropagation(),this.submission(recard)}}>提交审核</Button>}
-                                  <Button type="danger"  onClick={(e)=>{e.stopPropagation();this.delectRow(recard)}}>删除</Button>
                                    {recard.auditStatus!='1'&&recard.auditStatus=='2'&&<Button type="success" onClick={(e)=>{ e.stopPropagation(),this.updateFun(recard)}}>刷新发布</Button>}
                                    {recard.auditStatus!='1'&&recard.auditStatus=='2'&&<Button type="danger" onClick={(e)=>{e.stopPropagation(),this.revokeFun(recard)}}>撤销发布</Button>}
                                 </div>
@@ -225,18 +224,24 @@ const DemandList = React.createClass({
         });
     },
     delectRow(recard) {
+        let deletedIds =[];
+        for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
+            let rowItem = this.state.selectedRows[idx];
+            if (rowItem.id) {
+                deletedIds.push(rowItem.id);
+            }
+        }
         this.setState({
-            loading:true
-        })
-        let idArr=[];
-        idArr.push(recard.id)
+            selectedRowKeys: [],
+            loading: deletedIds.length > 0
+        });
         $.ajax({
             method: "POST",
             dataType: "json",
             crossDomain: false,
             url: globalConfig.context + "/api/user/achievement/delete",
             data: {
-                ids: idArr
+                ids: deletedIds
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -291,6 +296,7 @@ const DemandList = React.createClass({
                 });
             }
         };
+        const hasSelected = this.state.selectedRowKeys.length > 0;
         const { RangePicker } = DatePicker;
         return (
             <div className="user-content" >
@@ -324,6 +330,13 @@ const DemandList = React.createClass({
                     </Select>    
                     <Button type="primary" onClick={this.search}>搜索</Button>
                     <Button onClick={this.reset}>重置</Button>
+                    <Button
+                        type="danger"
+                        disabled={!hasSelected}
+                        onClick={this.delectRow}
+                    >
+                        删除<Icon type="minus" />
+                    </Button>
                     <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
                     <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
                         <span>发布时间 :</span>

+ 12 - 15
js/component/account/business/businessProject.jsx

@@ -538,7 +538,11 @@ const BusinessProject = Form.create()(
 					} else {
 						message.warning(data.error[0].message);
 					}
-					this.loadData(this.state.page);
+					if(this.state.pagination.total%10==1){
+						this.loadData((this.state.page)-1);
+					}else{
+						this.loadData(this.state.page);
+					}
 				}.bind(this)
 			);
 		},
@@ -633,20 +637,13 @@ const BusinessProject = Form.create()(
 							<Button onClick={this.reset} style={{ marginRight: '10px' }}>
 								重置
 							</Button>
-							<Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
-								<Button
-									style={{
-										background: '#ea0862',
-										border: 'none',
-										color: '#fff',
-										marginRight: '10px',
-										marginLeft: '10px'
-									}}
-									disabled={!hasSelected}
-								>
-									删除<Icon type="minus" />
-								</Button>
-							</Popconfirm>
+							<Button
+								type="danger"
+								onClick={this.delectRow}
+								disabled={!hasSelected}
+							>
+								删除<Icon type="minus" />
+							</Button>
 						</div>
 						<div className="patent-table">
 							<Spin spinning={this.state.loading}>

+ 19 - 7
js/component/account/demand/techDemand.jsx

@@ -1,5 +1,5 @@
 import React from 'react';
-import { Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal } from 'antd';
+import { Icon, Button, Input, Select, Spin, Popconfirm,Table, Switch, message, DatePicker, Modal } from 'antd';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 import moment from 'moment';
@@ -136,7 +136,6 @@ const DemandList = React.createClass({
                     render:(text,recard) => {
                         return  <div className="btnRight">
                                    {recard.auditStatus!='1'&&recard.auditStatus!='2'&&<Button type="primary" style={{ background: "#3fcf9e", border: "none", color: "#fff" }} onClick={(e)=>{e.stopPropagation(),this.submission(recard)}}>提交审核</Button>}
-                                   <Button type="danger"  onClick={(e)=>{e.stopPropagation();this.delectRow(recard)}}>删除</Button>
                                    {recard.auditStatus!='1'&&recard.auditStatus=='2'&&<Button type="success" onClick={(e)=>{ e.stopPropagation(),this.updateFun(recard)}}>刷新发布</Button>}
                                    {recard.auditStatus!='1'&&recard.auditStatus=='2'&&<Button type="danger" onClick={(e)=>{e.stopPropagation(),this.revokeFun(recard)}}>撤销发布</Button>}
                                 </div>
@@ -243,18 +242,24 @@ const DemandList = React.createClass({
         });
     },
     delectRow(recard) {
+        let deletedIds =[];
+        for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
+            let rowItem = this.state.selectedRows[idx];
+            if (rowItem.id) {
+                deletedIds.push(rowItem.id);
+            }
+        }
         this.setState({
-            loading:true
-        })
-        let idArr=[];
-        idArr.push(recard.id);
+            selectedRowKeys: [],
+            loading: deletedIds.length > 0
+        });
         $.ajax({
             method: "POST",
             dataType: "json",
             crossDomain: false,
             url: globalConfig.context + "/api/user/demand/delete",
             data: {
-                ids: idArr
+                ids: deletedIds
             }
         }).done(function (data) {
             if (!data.error.length) {
@@ -323,6 +328,13 @@ const DemandList = React.createClass({
                         onChange={(e) => { this.setState({ name: e.target.value }); }} />
                     <Button type="primary" onClick={this.search}>搜索</Button>
                     <Button onClick={this.reset}>重置</Button>
+                    <Button
+                        type="danger"
+                        disabled={!hasSelected}
+                        onClick={this.delectRow}
+                    >
+                        删除<Icon type="minus" />
+                    </Button>
                     <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
                     <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
                         <span>发布时间 :</span>