|
@@ -1,12 +1,10 @@
|
|
|
import React from 'react';
|
|
|
-import { Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker } from 'antd';
|
|
|
+import { Icon, Button, Input, Select, Spin, Table, message, DatePicker } from 'antd';
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
import moment from 'moment';
|
|
|
import NewDesc from '@/administration/messagePush/messageDesc';
|
|
|
import '@/account/demand/techDemand.less';
|
|
|
import '@/administration/news/news.less';
|
|
|
-import { } from '@/dataDic.js';
|
|
|
-import {getReleaseStateList, } from '@/tools.js';
|
|
|
|
|
|
const DemandList = React.createClass({
|
|
|
loadData(pageNo) {
|
|
@@ -20,12 +18,14 @@ const DemandList = React.createClass({
|
|
|
method: "get",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
- url: globalConfig.context + "/api/admin/news/list",
|
|
|
+ url: globalConfig.context + "/api/admin/message/getMessageList",
|
|
|
data: {
|
|
|
pageNo: pageNo || 1,
|
|
|
pageSize: this.state.pagination.pageSize,
|
|
|
title: this.state.nameSearch, //需求名称
|
|
|
-
|
|
|
+ isSend:this.state.auditStatusSearch,
|
|
|
+ sendStartTime: this.state.releaseDate[0],
|
|
|
+ sendEndTime: this.state.releaseDate[1],
|
|
|
},
|
|
|
success: function (data) {
|
|
|
let theArr = [];
|
|
@@ -36,22 +36,24 @@ const DemandList = React.createClass({
|
|
|
} else {
|
|
|
for (let i = 0; i < data.data.list.length; i++) {
|
|
|
let thisdata = data.data.list[i];
|
|
|
+
|
|
|
theArr.push({
|
|
|
key: i,
|
|
|
id: thisdata.id,
|
|
|
title: thisdata.title,
|
|
|
- author:thisdata.author,
|
|
|
- source: thisdata.source,
|
|
|
- auditStatus: thisdata.auditStatus, //审核状态
|
|
|
- releaseDate:thisdata.releaseDate?(new Date(thisdata.releaseDate)).toLocaleString():''
|
|
|
+ isSend:thisdata.isSend,
|
|
|
+ admin:thisdata.admin?thisdata.admin:'管理员',
|
|
|
+ body: thisdata.body,
|
|
|
+ createTime:thisdata.createTime?(new Date(thisdata.createTime)).toLocaleString():'',
|
|
|
+ releaseDate:thisdata.sendTime?(new Date(thisdata.sendTime)).toLocaleString():''
|
|
|
});
|
|
|
};
|
|
|
};
|
|
|
this.state.pagination.current = data.data.pageNo;
|
|
|
this.state.pagination.total = data.data.totalCount;
|
|
|
if(data.data&&data.data.list&&!data.data.list.length){
|
|
|
- this.state.pagination.current=0
|
|
|
- this.state.pagination.total=0
|
|
|
+ this.state.pagination.current=0;
|
|
|
+ this.state.pagination.total=0;
|
|
|
};
|
|
|
this.setState({
|
|
|
dataSource: theArr,
|
|
@@ -85,21 +87,16 @@ const DemandList = React.createClass({
|
|
|
}
|
|
|
},
|
|
|
columns: [
|
|
|
- {
|
|
|
- title: '消息编号',
|
|
|
+ {
|
|
|
+ title: '消息标题',
|
|
|
dataIndex: 'title',
|
|
|
key: 'title',
|
|
|
- }, {
|
|
|
- title: '消息标题',
|
|
|
- dataIndex: 'author',
|
|
|
- key: 'author',
|
|
|
- render:text=>{return <span>管理员</span>}
|
|
|
},
|
|
|
{
|
|
|
title: '消息内容',
|
|
|
- dataIndex: 'auditStatus',
|
|
|
- key: 'auditStatus',
|
|
|
- render: text => { text&&text.length>16?text.toString(16)+'...':text}
|
|
|
+ dataIndex: 'body',
|
|
|
+ key: 'body',
|
|
|
+ render: text => { return text&&text.length>16?text.substr(0,16)+'...':text}
|
|
|
},
|
|
|
{
|
|
|
title: '创建人',
|
|
@@ -108,13 +105,13 @@ const DemandList = React.createClass({
|
|
|
},
|
|
|
{
|
|
|
title: '创建时间',
|
|
|
- dataIndex: 'releaseDate',
|
|
|
- key: 'releaseDate'
|
|
|
+ dataIndex: 'createTime',
|
|
|
+ key: 'createTime'
|
|
|
},
|
|
|
{
|
|
|
title: '推送时间',
|
|
|
- dataIndex: 'releaseDate1',
|
|
|
- key: 'releaseDate1'
|
|
|
+ dataIndex: 'releaseDate',
|
|
|
+ key: 'releaseDate'
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
@@ -122,8 +119,8 @@ const DemandList = React.createClass({
|
|
|
key: 'caozuo',
|
|
|
render:(text,recard) => {
|
|
|
return <div className="btnRight">
|
|
|
- {recard.auditStatus?<Button type="primary" style={{ background: "#3fcf9e", border: "none", color: "#fff" }} onClick={(e)=>{e.stopPropagation(),this.submission(recard)}}>推送</Button>:''}
|
|
|
- {recard.auditStatus?<Button type="danger" style={{ margin:10 }} onClick={(e)=>{e.stopPropagation(),this.del(recard)}}>删除</Button>:''}
|
|
|
+ {!recard.isSend?<Button type="primary" style={{ background: "#3fcf9e", border: "none", color: "#fff" }} onClick={(e)=>{e.stopPropagation();this.submission(recard)}}>推送</Button>:''}
|
|
|
+ {!recard.isSend?<Button type="danger" style={{ margin:10 }} onClick={(e)=>{e.stopPropagation(),this.del(recard)}}>删除</Button>:''}
|
|
|
</div>
|
|
|
}
|
|
|
}
|
|
@@ -135,21 +132,19 @@ const DemandList = React.createClass({
|
|
|
//发布
|
|
|
submission(record){
|
|
|
this.setState({
|
|
|
- showDesc:false,
|
|
|
loading:true
|
|
|
});
|
|
|
$.ajax({
|
|
|
- method: "POST",
|
|
|
+ method: "get",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
- url: globalConfig.context + "/api/admin/news/updateStatus",
|
|
|
+ url: globalConfig.context + "/api/admin/message/sendMessage",
|
|
|
data: {
|
|
|
- id:record.id,
|
|
|
- auditStatus:2
|
|
|
+ messageId:record.id,
|
|
|
}
|
|
|
}).done(function (data) {
|
|
|
if (!data.error.length) {
|
|
|
- message.success('发布成功.');
|
|
|
+ message.success('推送成功.');
|
|
|
this.setState({
|
|
|
loading: false,
|
|
|
});
|
|
@@ -176,9 +171,15 @@ const DemandList = React.createClass({
|
|
|
method: "POST",
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
- url: globalConfig.context + "/api/admin/news/deleteById",
|
|
|
+ url: globalConfig.context + "/api/admin/message/updMessageById",
|
|
|
data: {
|
|
|
- id: recard.id
|
|
|
+ id: recard.id,
|
|
|
+ title: recard.title,
|
|
|
+ subject:0, //消息类别 0-系统消息
|
|
|
+ isDraft:1, //是否草稿 0-否 1-是
|
|
|
+ deleteSign:1, //删除标识 0-否 ,1-是
|
|
|
+ isSend:0, //是否发送0-否 1-是
|
|
|
+ body:recard.body
|
|
|
}
|
|
|
}).done(function (data) {
|
|
|
if (!data.error.length) {
|
|
@@ -213,9 +214,7 @@ const DemandList = React.createClass({
|
|
|
},
|
|
|
reset() {
|
|
|
this.state.nameSearch = '';
|
|
|
- this.state.typeSearch=undefined;
|
|
|
this.state.releaseDate = [];
|
|
|
- this.state.dataCategorySearch = undefined;
|
|
|
this.state.auditStatusSearch = undefined;
|
|
|
this.loadData();
|
|
|
},
|
|
@@ -252,7 +251,7 @@ const DemandList = React.createClass({
|
|
|
value={this.state.auditStatusSearch}
|
|
|
onChange={(e) => { this.setState({ auditStatusSearch: e }) }}>
|
|
|
<Select.Option value="0" >草稿</Select.Option>
|
|
|
- <Select.Option value="2" >已发布</Select.Option>
|
|
|
+ <Select.Option value="1" >已推送</Select.Option>
|
|
|
</Select>
|
|
|
<span>推送时间 : </span>
|
|
|
<RangePicker
|
|
@@ -262,7 +261,6 @@ const DemandList = React.createClass({
|
|
|
onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
|
|
|
<Button type="primary" onClick={this.search}>搜索</Button>
|
|
|
<Button onClick={this.reset}>重置</Button>
|
|
|
- <Button type="danger" disabled={!hasSelect} onClick={(e)=>{this.delectRow()}}>删除</Button>
|
|
|
</div>
|
|
|
<div className="patent-table">
|
|
|
<Spin spinning={this.state.loading}>
|