import React from 'react'; import ReactDom from 'react-dom'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import './content.less'; import { Form, Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload, Popconfirm, AutoComplete, Tabs } from 'antd'; import {patternOrganization,conditionOrganization,client,stick} from '../../dataDic.js'; import {getPattern,getAchievementCategory,getboutique,getClient,getStick} from '../../tools.js'; import {ChooseList} from "../order/orderNew/chooseList"; const TabPane = Tabs.TabPane; const Organization=Form.create()(React.createClass({ loadData(pageNo) { this.state.data = []; this.setState({ loading: true, }); let nameText=this.state.SuperArr; let superText=(this.state.superId)?nameText[parseInt(this.state.superId)].id:undefined; let nameTexts=this.state.SuperArrs; let superTexts=(this.state.publishPage)?nameTexts[parseInt(this.state.publishPage)].id:undefined; $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/achievement/listPublish', data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, ownerName:this.state.ownerName, //成果所有人 name: this.state.name, //成果名称 publishPlatform:superText,//发布子平台 publishClient:this.state.publishClient,//发布客户端 publishPage:superTexts,//发布页面 ifTop:this.state.ifTop,//是否置顶 }, success: function (data) { let theArr = []; if (!data.data || !data.data.list) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; theArr.push({ key: i, id: thisdata.id,//发布成果ID achievementId:thisdata.achievementId,//成果ID publishPlatform:thisdata.publishPlatform,//发布子平台ID platformName:thisdata.platformName,//发布子平台ID publishClient:thisdata.publishClient.toString(),//发布客户端 publishPage:thisdata.publishPage,//发布页面 publishPageName:thisdata.publishPageName,//发布页面 ifTop:thisdata.ifTop.toString(),//是否置顶 topNumber:thisdata.topNumber,//置顶编号 showNumber:thisdata.showNumber,//显示编号 publisher:thisdata.publisher,//发布人ID publishTime:thisdata.publishTime,//发布时间 serialNumber:thisdata.serialNumber,//成果编号 name:thisdata.name,//成果名称 userName:thisdata.userName,//成果所有人 publisherName:thisdata.publisherName,//发布人名称 publishTimeFormattedDate:thisdata.publishTimeFormattedDate,//发布时间 }); }; this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ dataSource: theArr, ispage: data.data.pageNo, pagination: this.state.pagination }); }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, loadDatas(pageNo, apiUrl) { this.state.data = []; if(this.state.serialNumber&&isNaN(this.state.serialNumber)){ message.warning('请输入正确的编号格式'); return false; } this.setState({ loading: true, ispage:pageNo, }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/achievement/orgList', data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, auditStatus:3,//名称 serialNumber: this.state.serialNumber, //编号 name: this.state.name, keyword: this.state.keyword, // 关键词 releaseDateStartDate: this.state.releaseDate[0], releaseDateEndDate: this.state.releaseDate[1], releaseStatus: this.state.releaseStatus ? Number(this.state.releaseStatus) : undefined, //是否发布(0--未发布,1--已发布) boutique:this.state.boutique, hot:this.state.hot, createDateStartDate: this.state.releaseDateS[0], createDateEndDate: this.state.releaseDateS[1], }, success: function (data) { let theArr = []; if (!data.data || !data.data.list) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; theArr.push({ key: thisdata.id, id: thisdata.id, serialNumber: thisdata.serialNumber, dataCategory: thisdata.dataCategory, name: thisdata.name, keyword: thisdata.keyword, theName: thisdata.username || thisdata.ownerName, category: thisdata.category, ownerName: thisdata.username ? thisdata.username : thisdata.ownerName, ownerType: thisdata.ownerType, ownerMobile: thisdata.ownerMobile, status: thisdata.status, releaseDate: thisdata.releaseDate, releaseDateFormattedDate: thisdata.releaseDateFormattedDate, auditStatus: thisdata.auditStatus, boutique: thisdata.boutique, hot: thisdata.hot, releaseStatus: thisdata.releaseStatus, techBrokerId:thisdata.techBrokerId, createTimeFormattedDate: thisdata.createTimeFormattedDate, remark:thisdata.remark, ispage:pageNo, }); }; this.state.paginations.current = data.data.pageNo; this.state.paginations.total = data.data.totalCount; }; this.setState({ dataSourcesli: theArr, paginations: this.state.paginations }); }.bind(this), }).always(function () { this.setState({ loading: false, visible: true }); }.bind(this)); }, getInitialState() { return { searchMore: true, selectedRowKeys: [], selectedRowKeysli:[], selectedRows: [], releaseDate: [], releaseDateS: [], loading: false, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, paginations: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadDatas(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, columns: [ { title: '成果编号', dataIndex: 'serialNumber', key: 'serialNumber', }, { title: '成果名称', dataIndex: 'name', key: 'name', }, { title: '客户名称', dataIndex: 'userName', key: 'userName', }, { title: '发布子平台', dataIndex: 'platformName', key: 'platformName', },{ title: '发布客户端', dataIndex: 'publishClient', key: 'publishClient', render: text => { return getClient(text) } }, { title: '发布页面', dataIndex: 'publishPageName', key: 'publishPageName', },{ title: '是否置顶', dataIndex: 'ifTop', key: 'ifTop', render: text => { return getStick(text) } }, { title: '展示序号', dataIndex: 'showNumber', key: 'showNumber', }, { title: '置顶序号', dataIndex: 'topNumber', key: 'topNumber', }, { title: '发布人', dataIndex: 'publisherName', key: 'publisherName', }, { title: '发布时间', dataIndex: 'publishTimeFormattedDate', key: 'publishTimeFormattedDate', }, { title: '操作', dataIndex: 'ee', key: 'ee', render: (text, record, index) => { return
{this.examine(record)}} okText="确认" cancelText="取消">
} } ], dataSource: [], searchTime: [,], column: [ { title: '编号', dataIndex: 'serialNumber', key: 'serialNumber', }, { title: '名称', dataIndex: 'name', key: 'name', }, { title: '关键字', dataIndex: 'keyword', key: 'keyword', }, { title: '类型', dataIndex: 'category', key: 'category', render: text => { return getAchievementCategory(text); } }, { title: '录入人', dataIndex: 'techBrokerId', key: 'techBrokerId', }, { title: '是否精品', dataIndex: 'boutique', key: 'boutique', render: text => { return getboutique(text) } }, { title: '发布时间', dataIndex: 'releaseDateFormattedDate', key: 'releaseDateFormattedDate', },{ title: '录入时间', dataIndex: 'createTimeFormattedDate', key: 'createTimeFormattedDate', } ], dataSourcesli: [], searchTime: [,] }; }, componentWillMount() { this.selectSuperIds(); }, examine(record) { this.setState({ selectedRowKeys: [], }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/achievement/deletePublish', data: { id:record.id, } }).done(function (data) { if (!data.error.length) { message.success('操作成功'); this.setState({ loading: false, }); } else { message.warning(data.error[0].message); }; this.loadData(this.state.ispage); }.bind(this)); }, //获取发布子平台 selectSuperId() { this.state.data = [] $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/achievement/getBranchInformation", data:{ }, success: function (data) { let theArr = []; let thedata=data.data; if (!thedata) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thedata = {}; }; var contactIds=[]; for(var i=0;i{theData.platformName} ); }; this.setState({ SuperArr:thedata, contactsOption: theArr, orderStatusOptions:data.data, }); }.bind(this), }).always(function () { this.loadData(); this.setState({ loading: false }); }.bind(this)); }, //获取发布页面 selectSuperIds() { this.state.data = [] $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/achievement/getPublishPage", data:{ }, success: function (data) { let theArr = []; let thedata=data.data; if (!thedata) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thedata = {}; }; var contactIds=[]; for(var i=0;i{theData.name} ); }; this.setState({ SuperArrs:thedata, contactsOptions: theArr, orderStatusOptions:data.data, }); }.bind(this), }).always(function () { this.selectSuperId(); this.setState({ loading: false }); }.bind(this)); }, //编辑部门,保存 edithandleSubmit(e){ e.preventDefault(); if(!this.state.editifTop){ message.warning('请确认是否置顶'); return false; } let topNumbers=(this.state.edittopNumber==9999999)?undefined:this.state.edittopNumber; topNumbers=topNumbers?topNumbers:undefined; if(this.state.editifTop==0){ if(!topNumbers){ message.warning('请输入置顶序号'); return false; } let b=this.state.edittopNumber.toString().split(''); for(var i=0;i { if (!err) { this.setState({ loading: true }); //上级组织字典 let nameText=this.state.SuperArr; let superText=nameText[parseInt(this.state.publishPlatform)].id; let nameTexts=this.state.SuperArrs; let superTexts=nameTexts[parseInt(this.state.publishPage)].id; $.ajax({ method: "post", dataType: "json", crossDomain: false, url:globalConfig.context + '/api/admin/achievement/addAchievementPublish', data:{ achievementId:this.state.selectedRowKeysli?this.state.selectedRowKeysli.join(","):undefined,//成果ID publishPlatform:superText,//发布平台 publishClient:this.state.publishClient,//发布客户端 publishPage:superTexts, //发布页面 ifTop:this.state.ifTop,//是否置顶 topNumber:this.state.topNumber,//置顶序号 showNumber:this.state.showNumber,//展示序号 } }).done(function (data) { this.setState({ loading: false }); if (!data.error.length) { message.success('保存成功!'); this.handleCancel(); this.reset(); } else { message.warning(data.error[0].message); } }.bind(this)); } }); }, //主管初始加载(自动补全) supervisor(e){ $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/organization/selectName", data:{ name:e }, success: function (data) { let thedata=data.data; if (!thedata) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thedata = {}; }; this.setState({ customerArr:thedata, }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, //上级主管输入框失去焦点是判断客户是否存在 selectAuto(value,options){ this.setState({ managerIdOrganization:value }) }, //失去焦点时 blurChange(e){ // let theType=''; // let contactLists=this.state.customerArr||[]; // if (e) { // contactLists.map(function (item) { // if (item.name == e.toString()) { // theType = item.id; // } // }); // } this.setState({ theTypes:e }) }, //值改变时请求客户名称 httpChange(e){ if(e.length>=2){ this.supervisor(e); } this.setState({ managerIdOrganization:e }) }, addClick() { this.state.name = undefined;//成果名称清零 this.state.publishPlatform = undefined;//发布子平台清零 this.state.publishClient = undefined;//发布客户端清零 this.state.publishPage = undefined;//发布页面清零 this.state.ifTop = undefined;//是否置顶清零 this.state.topNumber = undefined;//置顶序号清零 this.state.showNumber = undefined;//展示序号清零 this.state.selectedRowKeysli=undefined;//选定的成果ID清零 this.state.RowData = {}; this.selectSuperId(); this.loadDatas(); }, editClick() { this.state.RowData = {}; this.setState({ editvisible: true }); }, handleCancel() { this.setState({ visible: false }) }, edithandleCancel() { this.setState({ editvisible: false }) }, search() { this.loadData(); }, searchs() { this.loadDatas(); }, //把搜索的部分置零 reset() { this.state.ownerName= undefined;//成果所有人清零 this.state.name = undefined;//成果名称清零 this.state.superId = undefined;//发布子平台清零 this.state.publishClient = undefined;//发布客户端清零 this.state.publishPage = undefined;//发布页面清零 this.state.ifTop = undefined;//是否置顶清零 this.selectSuperId(); }, resets() { this.state.serialNumber = undefined; this.state.name = undefined; this.state.keyword = undefined; this.state.category = undefined; this.state.ownerType = undefined; this.state.releaseStatus = undefined; this.state.auditStatus = undefined; this.state.searchName = undefined; this.state.releaseDate = []; this.state.releaseDateS = []; this.state.boutique = ''; this.state.hot='' ; this.loadDatas(); }, changeList(arr) { const newArr = []; this.state.columns.forEach(item => { arr.forEach(val => { if (val === item.title) { newArr.push(item); } }); }); this.setState({ changeList: newArr }); }, searchSwitch() { this.setState({ searchMore: !this.state.searchMore }); }, render() { const FormItem = Form.Item const rowSelection = { selectedRowKeys: this.state.selectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRows: selectedRows.slice(-1), selectedRowKeys: selectedRowKeys.slice(-1) }); }, onSelect: (recordt, selected, selectedRows) => { this.setState({ recordt:recordt.id }) }, }; const rowSelections = { selectedRowKeysli: this.state.selectedRowKeysli, onChange: (selectedRowKeysli, selectedRows) => { this.setState({ selectedRows: selectedRows, selectedRowKeysli: selectedRowKeysli }); }, onSelect: (recordt, selected, selectedRows) => { this.setState({ recordt:recordt.id }) }, }; const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 14 }, }; const { getFieldDecorator } = this.props.form; const hasSelected = this.state.selectedRowKeys.length > 0; const { RangePicker } = DatePicker; const dataSources=this.state.customerArr || []; const options = dataSources.map((group,index) => ) return (
{ this.setState({ name: e.target.value }); }} /> { this.setState({ ownerName: e.target.value }); }} /> 更多搜索
{this.setState({topNumber:e.target.value})}}/> {this.setState({showNumber:e.target.value})}}/>
{ this.setState({ serialNumber: e.target.value }); }} /> { this.setState({ name: e.target.value }); }} /> { this.setState({ keyword: e.target.value }); }} /> 是否精品 : { this.setState({ boutique: e.target.value }) }}> 精品 非精品 发布时间 : { this.setState({ releaseDate: dataString }); }} /> 录入时间 : { this.setState({ releaseDateS: dataString }); }} />
{this.setState({edittopNumber:e.target.value})}}/> {this.setState({editshowNumber:e.target.value})}}/>
{this.state.editserialNumber} {this.state.edituserName}
{this.state.editname}
); } })); export default Organization;