import React from 'react'; import { Icon, Button, Input, Spin, Table, message, Select, Modal, DatePicker, Cascader, Transfer, InputNumber } from 'antd'; import { techFieldList, technicalSourceList } from '../../dataDic.js'; import { getTechField, getTechnicalSource } from '../../tools.js'; import './activity.less'; import moment from 'moment'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; const ActivityDesc = React.createClass({ getInitialState() { return { visible: false, loading: false, targetKeys: [], selectedKeys: [] }; }, handleOk() { this.setState({ loading: true, }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/techservice/cognizance/activity", data: { id: this.props.data.id, activityName: this.state.activityName, activityNumber: this.state.activityNumber, startDateFormattedDate: this.state.startDateFormattedDate, endDateFormattedDate: this.state.endDateFormattedDate, technicalField1: this.state.techField[0], technicalField2: this.state.techField[1], technicalField3: this.state.techField[2], technicalSource: this.state.technicalSource, intellectualPropertyNumber: this.state.targetKeys.join(","), budget: this.state.budget, firstYearExpenditure: this.state.firstYearExpenditure, secondYearExpenditure: this.state.secondYearExpenditure, thirdYearExpenditure: this.state.thirdYearExpenditure, implement: this.state.implement, technologyInnovation: this.state.technologyInnovation, achievement: this.state.achievement }, success: function (data) { if (data.data) { this.setState({ id: this.props.data.id, activityName: this.state.activityName, activityNumber: this.state.activityNumber, startDateFormattedDate: this.state.startDateFormattedDate, endDateFormattedDate: this.state.endDateFormattedDate, techField: this.state.techField, technicalSource: this.state.technicalSource, intellectualPropertyNumber: this.state.targetKeys, budget: this.state.budget, firstYearExpenditure: this.state.firstYearExpenditure, secondYearExpenditure: this.state.secondYearExpenditure, thirdYearExpenditure: this.state.thirdYearExpenditure, implement: this.state.implement, technologyInnovation: this.state.technologyInnovation, achievement: this.state.achievement }); } else if (data.error.length && data.error[0].message) { message.warning(data.error[0].message); } }.bind(this), }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); this.setState({ loading: false, visible: false }); this.props.closeDesc(false); } else { message.warning(data.error[0].message); this.setState({ loading: false }); }; }.bind(this)); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeDesc(false); }, componentWillReceiveProps(nextProps) { this.state.visible = nextProps.showDesc; if (nextProps.data) { this.state.activityName = nextProps.data.activityName; this.state.activityNumber = nextProps.data.activityNumber; this.state.startDateFormattedDate = nextProps.data.startDateFormattedDate; this.state.endDateFormattedDate = nextProps.data.endDateFormattedDate; this.state.techField = nextProps.data.techField; this.state.technicalSource = nextProps.data.technicalSource; this.state.targetKeys = nextProps.data.intellectualPropertyNumber; this.state.budget = nextProps.data.budget; this.state.firstYearExpenditure = nextProps.data.firstYearExpenditure; this.state.secondYearExpenditure = nextProps.data.secondYearExpenditure; this.state.thirdYearExpenditure = nextProps.data.thirdYearExpenditure; this.state.implement = nextProps.data.implement; this.state.technologyInnovation = nextProps.data.technologyInnovation; this.state.achievement = nextProps.data.achievement; this.state.mockData = nextProps.data.mockData; }; }, intellectualChange(nextTargetKeys, direction, moveKeys) { this.setState({ targetKeys: nextTargetKeys }); }, intellectualSelectChange(sourceSelectedKeys, targetSelectedKeys) { this.setState({ selectedKeys: [...sourceSelectedKeys, ...targetSelectedKeys] }); }, render() { if (this.props.data) { return (
保存, ]} className="admin-desc-content">

研发活动编号:

{ this.setState({ activityNumber: e.target.value }); }} />

研发活动名称:

{ this.setState({ activityName: e.target.value }); }} />

开始日期:

{ this.setState({ startDateFormattedDate: dataString }); }} />

结束日期:

{ this.setState({ endDateFormattedDate: dataString }); }} />

技术领域:

{ this.setState({ techField: value }); console.log(value) }} placeholder="Please select" showSearch />,

技术来源:

知识产权编号:

`${item.name}-${item.key}`} />

研发经费总预算(万元):

{ this.setState({ budget: e }); }} />

研发经费近三年总支出(万元):

总计(万元):
其中(第一年): { this.setState({ firstYearExpenditure: e }); }} />
其中(第二年): { this.setState({ secondYearExpenditure: e }); }} />
其中(第三年): { this.setState({ thirdYearExpenditure: e }); }} />

目的及组织实施方式(限400字):

{ if (e.target.value.length > 400) { return; } this.setState({ implement: e.target.value }); }} />

核心技术及创新点(限400字):

{ if (e.target.value.length > 400) { return; } this.setState({ technologyInnovation: e.target.value }); }} />

取得的阶段性成果(限400字):

{ if (e.target.value.length > 400) { return; } this.setState({ achievement: e.target.value }); }} />
); } else { return
} }, }); const Activity = React.createClass({ loadData(pageNo) { this.state.data = []; this.setState({ loading: true }); $.when($.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/techservice/cognizance/activityList", data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, activityNumber: this.state.activityNumber, activityName: this.state.activityName, startDate: this.state.startDate, endDate: this.state.endDate } }), $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/techservice/cognizance/intellectualList", data: { pageNo: pageNo || 1, pageSize: 99, } })).done((data1, data2) => { let data = data1[0]; let intellectualList = data2[0]; if (data.error.length || !data.data || !data.data.list) { message.warning(data.error[0].message); return; }; if (intellectualList.error.length || !intellectualList.data || !intellectualList.data.list) { message.warning(intellectualList.error[0].message); return; }; let theArr = []; for (let i = 0; i < intellectualList.data.list.length; i++) { theArr.push({ key: intellectualList.data.list[i].intellectualPropertyNumber, name: intellectualList.data.list[i].intellectualPropertyName }); }; this.state.mockData = theArr; for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; this.state.data.push({ key: i, id: thisdata.id, uid: thisdata.uid, activityNumber: thisdata.activityNumber, activityName: thisdata.activityName, startDate: thisdata.startDate, endDate: thisdata.endDate, mockData: this.state.mockData, techField: [Number(thisdata.technicalField1), Number(thisdata.technicalField2), Number(thisdata.technicalField3)], technicalField: getTechField(thisdata.technicalField1, thisdata.technicalField2, thisdata.technicalField3), technicalField1: thisdata.technicalField1, technicalField2: thisdata.technicalField2, technicalField3: thisdata.technicalField3, technicalSource: String(thisdata.technicalSource), intellectualPropertyNumber: thisdata.intellectualPropertyNumber ? thisdata.intellectualPropertyNumber.split(",") : [], budget: thisdata.budget, firstYearExpenditure: thisdata.firstYearExpenditure, secondYearExpenditure: thisdata.secondYearExpenditure, thirdYearExpenditure: thisdata.thirdYearExpenditure, implement: thisdata.implement, technologyInnovation: thisdata.technologyInnovation, achievement: thisdata.achievement, internalLaborCost: thisdata.internalLaborCost, internalDirectCost: thisdata.internalDirectCost, internalDepreciationCost: thisdata.internalDepreciationCost, internalAmortizationCost: thisdata.internalAmortizationCost, internalDesignCost: thisdata.internalDesignCost, internalEquipmentCost: thisdata.internalEquipmentCost, internalOtherCost: thisdata.internalOtherCost, externalTotalCost: thisdata.externalTotalCost, externalAbroadCost: thisdata.externalAbroadCost, enterpriseFiller: thisdata.enterpriseFiller, signDate: thisdata.signDate, sortNumber: thisdata.sortNumber, startDateFormattedDate: thisdata.startDateFormattedDate, endDateFormattedDate: thisdata.endDateFormattedDate }); }; this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ dataSource: this.state.data, pagination: this.state.pagination }); }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { mockData: [], selectedRowKeys: [], selectedRows: [], loading: false, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, columns: [ { title: '研发活动编号', dataIndex: 'activityNumber', key: 'activityNumber' }, { title: '研发活动名称', dataIndex: 'activityName', key: 'activityName' }, { title: '技术领域', dataIndex: 'technicalField', key: 'technicalField' }, { title: '技术来源', dataIndex: 'technicalSource', key: 'technicalSource', render: (text) => { return getTechnicalSource(text) } }, { title: '知识产权编号', dataIndex: 'intellectualPropertyNumber', key: 'intellectualPropertyNumber' }, { title: '开始时间', dataIndex: 'startDateFormattedDate', key: 'startDateFormattedDate' }, { title: '结束时间', dataIndex: 'endDateFormattedDate', key: 'endDateFormattedDate' } ], dataSource: [] }; }, componentWillMount() { this.loadData(); }, tableRowClick(record, index) { this.state.RowData = record; this.setState({ showDesc: true }); }, delectRow() { 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({ selectedRowKeys: [], loading: deletedIds.length > 0 }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/techservice/cognizance/deleteActivity", data: { ids: deletedIds } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); this.setState({ loading: false, }); } else { message.warning(data.error[0].message); }; this.loadData(); }.bind(this)); }, closeDesc(e) { this.state.showDesc = e; this.loadData(); }, search() { this.loadData(); }, reset() { this.state.activityName = undefined; this.state.activityNumber = undefined; this.loadData(); }, render() { const rowSelection = { selectedRowKeys: this.state.selectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRows: selectedRows, selectedRowKeys: selectedRowKeys }); } }; const hasSelected = this.state.selectedRowKeys.length > 0; return (
企业研究开发活动情况表
{ this.setState({ activityName: e.target.value }); }} /> { this.setState({ activityNumber: e.target.value }); }} />

); } }); export default Activity;