Commit 9fd879ea by zhangleyuan

feat:解决合并代码后的冲突

parents 382f2c1c a7764920
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-12-12 11:57:10 * @Date: 2020-12-12 11:57:10
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-02-28 13:47:38 * @LastEditTime: 2021-03-05 17:20:29
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -85,3 +85,6 @@ export function videoWatchInfo(params: object) { ...@@ -85,3 +85,6 @@ export function videoWatchInfo(params: object) {
export function videoScheduleBasePage(params: object) { export function videoScheduleBasePage(params: object) {
return Service.Hades("public/hades/videoScheduleBasePage", params); return Service.Hades("public/hades/videoScheduleBasePage", params);
} }
export function relatedCourseToPlan(params: object) {
return Service.Hades("public/hades/relatedCourseToPlan", params);
}
\ No newline at end of file
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
* @LastEditors: wufan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-01-11 19:38:50 * @LastEditTime: 2021-03-08 11:47:58
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -68,3 +68,9 @@ export function delCourseCategory(params: object) { ...@@ -68,3 +68,9 @@ export function delCourseCategory(params: object) {
export function getStoreUserBasicPage(params: object) { export function getStoreUserBasicPage(params: object) {
return Service.Hades("public/hades/getStoreUserBasicPage", params); return Service.Hades("public/hades/getStoreUserBasicPage", params);
} }
export function updateStoreMessage(params: object) {
return Service.Hades("public/hades/updateStoreMessage", params);
}
export function getStoreDetail(params: object) {
return Service.Hades("public/hades/getStoreDetail", params);
}
\ No newline at end of file
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-02-28 15:15:37 * @LastEditTime: 2021-03-05 17:20:56
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import { import {
fetchLecturerData, fetchUserData, exportStudentCourseData, exportPlayBackCourseData, fetchPlaybackList, createLiveCloudCourse, getLiveCloudCoursePage, fetchLecturerData, fetchUserData, exportStudentCourseData, exportPlayBackCourseData, fetchPlaybackList, createLiveCloudCourse, getLiveCloudCoursePage,
getLiveCloudCourseDetail, updateLiveCloudCourse, turnOnOrOffLiveCloudCourse, delLiveCloudCourse, changeVideoShelfState, createVideoSchedule, delVideoSchedule, getLiveCloudCourseDetail, updateLiveCloudCourse, turnOnOrOffLiveCloudCourse, delLiveCloudCourse, changeVideoShelfState, createVideoSchedule, delVideoSchedule,
editVideoSchedule, userWatchInfo, videoSchedulePage, videoScheduleDetail, videoWatchInfo, getQrcode,getLiveCloudCourseBasePage,videoScheduleBasePage editVideoSchedule, userWatchInfo, videoSchedulePage, videoScheduleDetail, videoWatchInfo, getQrcode,getLiveCloudCourseBasePage,videoScheduleBasePage,relatedCourseToPlan
} from '@/data-source/course/request-api'; } from '@/data-source/course/request-api';
export default class courseService { export default class courseService {
...@@ -91,4 +91,7 @@ export default class courseService { ...@@ -91,4 +91,7 @@ export default class courseService {
static videoScheduleBasePage(params: any){ static videoScheduleBasePage(params: any){
return videoScheduleBasePage(params); return videoScheduleBasePage(params);
} }
static relatedCourseToPlan(params: any){
return relatedCourseToPlan(params);
}
} }
\ No newline at end of file
/*
* @Author: zhangleyuan
* @Date: 2021-01-19 11:27:56
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-03-08 10:36:04
* @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
export const storeRoleEnum = { export const storeRoleEnum = {
"0": "店铺管理员", "0": "店铺管理员",
"1": "管理员", "1": "管理员",
"2": "普通讲师" "2": "普通讲师"
}; };
export const industryList = ["IT服务","制造业","批发/零售","生活服务","文化/体育/娱乐业","建筑/房地产","教育","运输/物流/仓储","医疗","政府","金融","能源/采矿","农林渔牧","其他行业"];
export const childIndustryList = {
"IT服务":["计算机软件/硬件/信息服务","互联网和相关服务","其他"],
"制造业":["机械/电子","服装/纺织","汽车","金属制品","家具/家纺","重工制造","家电/数码","橡胶/塑料","日用品/化妆品","化学原料制品","文教/工美/体育/娱乐用品","烟酒/茶","非金属矿物","其他"],
"批发/零售":["批发","零售","超市/便利店/百货商场","进出口","其他"],
"生活服务":["餐饮","居民服务","租赁和商务服务","酒店/住宿","其他"],
"文化/体育/娱乐业":["文化/体育","娱乐/旅游","新闻传媒","其他"],
"建筑/房地产":["建筑业","建材装修","房地产","其他"],
"教育":["学前教育","初中等教育","高等教育","培训机构","其他"],
"运输/物流/仓储":["物流/仓储","道路/铁路运输","邮政/快递","航空运输","水上运输","其他"],
"医疗":["医院/医疗机构","医疗器械","医药制造","医药流通","其他"],
"政府":["党政机关","国家权利/行政机构","检察院/法院/公安","民政/人社/交通/卫生","发改委/经信委/商务局/统计局","国土/规划","税务/海关/工商/环保/物价/药品","政协/民主党派","地方政府","其他"],
"金融":["保险","银行","证券/投资/基金","其他"],
"能源/采矿":["电力/热力/燃气/水供应业","石油/天然气","煤炭","有色金属","钢铁","其他"],
"农林渔牧":["农林渔牧"],
"其他行业":["科学研究和技术服务业","社会组织","水利和环境管理","国际组织","其他"]
}
\ No newline at end of file
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-23 16:54:10 * @LastEditTime: 2021-03-08 11:48:43
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import { getEmployeeList, getUserList, getStoreDecorationList, getStoreRole, addEmployee, editEmployee, deleteEmployee, getCourseCatalogList, getAllSonCategory, addCourseCategory, delCourseCategory, editCourseCategory, deleteStoreDecorationList, addStoreBanner, editStoreBanner, moveBannerSequence,getStoreUserBasicPage} from '@/data-source/store/request-apis'; import { getEmployeeList, getUserList, getStoreDecorationList, getStoreRole, addEmployee, editEmployee, deleteEmployee, getCourseCatalogList,
getAllSonCategory, addCourseCategory, delCourseCategory, editCourseCategory, deleteStoreDecorationList, addStoreBanner, editStoreBanner,
moveBannerSequence,getStoreUserBasicPage,updateStoreMessage,getStoreDetail} from '@/data-source/store/request-apis';
export default class StoreService { export default class StoreService {
// 获取员工列表 // 获取员工列表
...@@ -81,5 +83,10 @@ export default class StoreService { ...@@ -81,5 +83,10 @@ export default class StoreService {
static delCourseCategory(params: any) { static delCourseCategory(params: any) {
return delCourseCategory(params); return delCourseCategory(params);
} }
static updateStoreMessage(params: any) {
return updateStoreMessage(params);
}
static getStoreDetail(params: any) {
return getStoreDetail(params);
}
} }
\ No newline at end of file
...@@ -15,7 +15,7 @@ import DownloadLiveModal from '@/components/DownloadLiveModal'; ...@@ -15,7 +15,7 @@ import DownloadLiveModal from '@/components/DownloadLiveModal';
import ManageCoursewareModal from '../modal/ManageCoursewareModal'; import ManageCoursewareModal from '../modal/ManageCoursewareModal';
import ShareLiveModal from '../modal/ShareLiveModal'; import ShareLiveModal from '../modal/ShareLiveModal';
import RelatedPlanModal from '../modal/RelatedPlanModal';
import './LiveCourseList.less'; import './LiveCourseList.less';
import { QuestionCircleOutlined } from '@ant-design/icons'; import { QuestionCircleOutlined } from '@ant-design/icons';
...@@ -57,7 +57,8 @@ class LiveCourseList extends React.Component { ...@@ -57,7 +57,8 @@ class LiveCourseList extends React.Component {
columns: [], columns: [],
openDownloadModal:false, openDownloadModal:false,
url:'', url:'',
RelatedPlanModalVisible:false RelatedPlanModalVisible:false,
selectPlanList:{}
} }
} }
componentWillMount(){ componentWillMount(){
...@@ -661,14 +662,49 @@ class LiveCourseList extends React.Component { ...@@ -661,14 +662,49 @@ class LiveCourseList extends React.Component {
} }
window.open(htmlUrl); window.open(htmlUrl);
} }
handleRelatedModalShow = (item) handleRelatedModalShow = (item)=>{
const selectPlanList = {};
if(item.relatedPlanList){
item.relatedPlanList.map((item,index)=>{
selectPlanList[item.planId] = {}
selectPlanList[item.planId].planId = item.planId;
selectPlanList[item.planId].taskBaseVOList = [{taskId:item.taskId}];
return item
})
}
this.setState({
RelatedPlanModalVisible:true,
selectCourseId:item.liveCourseId,
selectPlanList:selectPlanList
})
}
closeRelatedPlanModalVisible = ()=>{
this.setState({
RelatedPlanModalVisible:false
})
}
onChangeSelectPlanList = (selectPlanList)=>{
this.setState({
selectPlanList:selectPlanList
})
}
onConfirmSelectPlanList = ()=>{
this.setState({
RelatedPlanModalVisible:false
},()=>{this.props.onChange();})
}
render() { render() {
const { total, query, courseList, loading} = this.props; const { total, query, courseList, loading} = this.props;
const { current, size } = query; const { current, size } = query;
const { openDownloadModal, const { openDownloadModal,
downloadUrl, url, columns, downloadUrl, url, columns,
openCoursewareModal, openCoursewareModal,
editData editData,
RelatedPlanModalVisible,
selectCourseId,
selectPlanList
} = this.state; } = this.state;
const { match } = this.props; const { match } = this.props;
...@@ -720,10 +756,15 @@ class LiveCourseList extends React.Component { ...@@ -720,10 +756,15 @@ class LiveCourseList extends React.Component {
/> />
)} )}
{ RelatedPlanModalVisible && { RelatedPlanModalVisible &&
<RelatedPlanModal/> <RelatedPlanModal
onClose={this.closeRelatedPlanModalVisible}
visible={RelatedPlanModalVisible}
selectCourseId={selectCourseId}
selectPlanList={selectPlanList}
onChange={this.onChangeSelectPlanList}
onConfirm={this.onConfirmSelectPlanList}
/>
} }
<iframe src={url} style={{ display: "none" }} /> <iframe src={url} style={{ display: "none" }} />
<Route path={`${match.url}/live-course-data`} component={DataList} /> <Route path={`${match.url}/live-course-data`} component={DataList} />
</div> </div>
......
import React from 'react'; import React from 'react';
import {Table, Modal,Input} from 'antd'; import {Table, Modal,Input} from 'antd';
import { PageControl } from "@/components"; import { PageControl } from "@/components";
import PlanService from '@/domains/plan-domain/planService' import CourseService from "@/domains/course-domain/CourseService";
import PlanService from "@/domains/plan-domain/planService";
import User from '@/common/js/user' import User from '@/common/js/user'
import './SelectOperatorModal.less'; import './RelatedPlanModal.less';
import _ from "underscore"; import _ from "underscore";
const { Search } = Input; const { Search } = Input;
class RelatedPlanModal extends React.Component { class RelatedPlanModal extends React.Component {
...@@ -16,12 +17,13 @@ class RelatedPlanModal extends React.Component { ...@@ -16,12 +17,13 @@ class RelatedPlanModal extends React.Component {
current: 1, current: 1,
}, },
totalCount:0, totalCount:0,
selectPlanList:{},
}; };
} }
componentDidMount() { componentDidMount() {
this.handleFetchDataList(); this.handleFetchDataList();
} }
// 获取培训计划列表 // 获取培训计划列表
handleFetchDataList = () => { handleFetchDataList = () => {
const {query,size,totalCount} = this.state const {query,size,totalCount} = this.state
...@@ -40,6 +42,7 @@ class RelatedPlanModal extends React.Component { ...@@ -40,6 +42,7 @@ class RelatedPlanModal extends React.Component {
}); });
} }
handleChangePlanName = (value)=>{ handleChangePlanName = (value)=>{
const {query} = this.state;
query.planName = value; query.planName = value;
query.current = 1; query.current = 1;
this.setState({ this.setState({
...@@ -88,9 +91,53 @@ class RelatedPlanModal extends React.Component { ...@@ -88,9 +91,53 @@ class RelatedPlanModal extends React.Component {
]; ];
return columns; return columns;
} }
selectPlanList = (record,selected,planId) =>{
const { selectPlanList } = this.props;
let _selectPlanList = {...selectPlanList};
if (selected) {
if(!_selectPlanList[planId]){
_selectPlanList[planId] = {}
}
_selectPlanList[planId].taskBaseVOList = [];
_selectPlanList[planId].planId = planId;
_selectPlanList[planId].taskBaseVOList.push(record);
} else {
if(!_selectPlanList[planId]){
_selectPlanList[planId] = {}
}
_selectPlanList[planId].taskBaseVOList = [];
_selectPlanList[planId].planId = planId;
}
this.props.onChange(_selectPlanList);
// this.setState({selectPlanList:_selectPlanList});
}
handleSelectPlanListData(selectPlanList){
let _selectPlanList = [];
for(let key in selectPlanList ){
let item = {};
if(selectPlanList[key].taskBaseVOList){
item.planId = selectPlanList[key].planId;
item.taskId = selectPlanList[key].taskBaseVOList[0].taskId;
}
_selectPlanList.push(item)
}
return _selectPlanList;
}
confirmRelatedPlan =()=>{
const {selectPlanList } = this.props;
const params = {
courseId:this.props.selectCourseId,
relatedPlanList:this.handleSelectPlanListData(selectPlanList),
storeId:User.getStoreId(),
}
CourseService.relatedCourseToPlan(params).then((res) => {
this.props.onConfirm();
});
}
render() { render() {
const { size,dataSource,totalCount,query,selectOperatorList} = this.state; const { size,dataSource,totalCount,query} = this.state;
const { visible } = this.props; const { visible,selectPlanList} = this.props;
return ( return (
<Modal <Modal
title="关联培训计划" title="关联培训计划"
...@@ -100,11 +147,21 @@ class RelatedPlanModal extends React.Component { ...@@ -100,11 +147,21 @@ class RelatedPlanModal extends React.Component {
className="related-plan-modal" className="related-plan-modal"
closable={true} closable={true}
width={800} width={800}
onOk={() => this.props.onSelect(selectOperatorList) } onOk={() => this.confirmRelatedPlan() }
closeIcon={<span className="icon iconfont modal-close-icon">&#xe6ef;</span>} closeIcon={<span className="icon iconfont modal-close-icon">&#xe6ef;</span>}
> >
<div className="search-container"> <div className="search-container">
<Search placeholder="搜索培训计划名称" style={{ width: 200 }} onChange={(e) => { this.handleChangePlanName(e.target.value)}} onSearch={ () => { this.handleFetchDataList()}} /> <Search placeholder="搜索培训计划名称"
style={{ width: 207 }}
onChange={(e) => { this.handleChangePlanName(e.target.value)}}
onSearch={ () => { this.handleFetchDataList()}}
enterButton={<span className="icon iconfont">&#xe832;</span>}
/>
</div>
<div className="select-container">
<span className="icon iconfont tip">&#xe6f2;</span>
<span className="text">已选择个任务</span>
<span className="clear">清空</span>
</div> </div>
<div> <div>
<Table <Table
...@@ -113,19 +170,41 @@ class RelatedPlanModal extends React.Component { ...@@ -113,19 +170,41 @@ class RelatedPlanModal extends React.Component {
dataSource={dataSource} dataSource={dataSource}
columns={this.parsePlanColumns()} columns={this.parsePlanColumns()}
pagination={false} pagination={false}
expandedRowRender={(record,index) => { expandedRowRender={(_record,index) => {
if(!record.taskBaseVOList){ if(!_record.taskBaseVOList){
return return
} }
if (record.taskBaseVOList.length !== 0 ){ if (_record.taskBaseVOList.length !== 0 ){
const selectPlan = selectPlanList[_record.planId]
let taskBaseVOList = [];
if(selectPlan){
taskBaseVOList = selectPlan.taskBaseVOList;
}
console.log('taskBaseVOList',taskBaseVOList);
return <div> return <div>
<Table <Table
rowKey={record => record.taskId}
pagination={false} pagination={false}
dataSource={record.taskBaseVOList} dataSource={_record.taskBaseVOList}
columns={this.parseTaskColumns(index)} columns={this.parseTaskColumns(index)}
className="child-table" className="child-table"
rowSelection={{ rowSelection={{
type: 'checkbox' type: 'checkbox',
selectedRowKeys: _.pluck(taskBaseVOList, 'taskId'),
onSelect: (record, selected) => {
this.selectPlanList(record,selected,_record.planId);
},
onSelectAll: (selected, _selectedRows, changeRows) => {
// let _list = [];
// if (selected) {
// _list = _.uniq(selectVideo.concat(changeRows), false, (item) => item.id);
// } else {
// _list = _.reject(selectVideo, (item) => _.find(changeRows, (data) => data.id === item.id));
// }
// this.setState({selectVideo:_list});
},
}} }}
/> />
</div> </div>
......
.related-plan-modal{
.search-container{
margin-bottom:16px;
}
.select-container{
margin-bottom:12px;
background: #FFF4DD;
border-radius: 4px;
padding:6px 16px;
width: 207px;
height: 32px;
.tip{
font-size:14px;
color:#FF9D14;
margin-right:8px;
}
.text{
font-size:14px;
color:#666;
margin-right:30px;
}
.clear{
color:#5289FA;
font-size:14px;
}
}
.plan-table{
.taskName{
color:#666666;
font-size:14px;
}
.task-learn-percentage{
color:#666666;
font-size:14px;
}
.course-info{
margin-left:57px;
.course-type{
font-size:11px;
color:#666666;
padding:1px 8px;
border: 1px solid #999999;
margin-right:4px;
border-radius: 2px;
}
.course-name{
color:#666666;
font-size:14px;
margin-right:8px;
}
.tip{
font-size:14px;
color:#FF4F4F;
margin-right:2px;
}
.course-state{
color:#999;
font-size:14px;
}
}
.ant-table-content{
border:1px solid #e8e8e8;
tr{
td{
border:none;
}
.child-table{
.ant-table-content{
border:none;
thead{
display:none;
}
tbody tr td{
border-bottom:none;
}
}
}
}
.odd-row{
background:transparent;
td{
background: #FFF;
}
& + .ant-table-expanded-row{
background:transparent;
td{
background: #FFF;
}
}
&:hover{
& + .ant-table-expanded-row{
background:transparent;
td{
background: #F3f6fa !important;
}
}
}
}
.even-row{
background:transparent;
td{
background: #FAFAFA;
}
& + .ant-table-expanded-row{
background:transparent;
td{
background: #FAFAFA;
}
}
&:hover{
& + .ant-table-expanded-row{
background:transparent;
td{
background: #F3f6fa !important;
}
}
}
}
}
}
}
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-05 10:12:45 * @Date: 2020-08-05 10:12:45
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-02-01 16:34:11 * @LastEditTime: 2021-03-08 15:07:16
* @Description: 视频课-列表模块 * @Description: 视频课-列表模块
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -17,21 +17,23 @@ import { appId, shareUrl, LIVE_SHARE } from '@/domains/course-domain/constants'; ...@@ -17,21 +17,23 @@ import { appId, shareUrl, LIVE_SHARE } from '@/domains/course-domain/constants';
import ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal'; import ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal';
import WatchDataModal from '../modal/WatchDataModal' import WatchDataModal from '../modal/WatchDataModal'
import CourseService from "@/domains/course-domain/CourseService"; import CourseService from "@/domains/course-domain/CourseService";
import RelatedPlanModal from '../../modal/RelatedPlanModal';
import User from '@/common/js/user' import User from '@/common/js/user'
import './VideoCourseList.less'; import './VideoCourseList.less';
const ENV = process.env.DEPLOY_ENV || 'dev'; const ENV = process.env.DEPLOY_ENV || 'dev';
const userRole = User.getUserRole();
class VideoCourseList extends React.Component { class VideoCourseList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
id: '', // 视频课ID id: '', // 视频课ID
studentIds:[] studentIds:[],
RelatedPlanModalVisible:false,
selectPlanList:{}
} }
} }
...@@ -166,6 +168,25 @@ class VideoCourseList extends React.Component { ...@@ -166,6 +168,25 @@ class VideoCourseList extends React.Component {
} }
}, },
{ {
title: '关联项',
width: 200,
key: "planList",
dataIndex: "planList",
render: (val, record) => {
return (
<span>
{ record.relatedPlanList ?
record.relatedPlanList.map((item,index)=>{
return <span>{item.planName} { (index < record.relatedPlanList.length-1)&&(<span></span>)} </span>
})
:
<span></span>
}
</span>
)
}
},
{
title: '操作', title: '操作',
key: 'operate', key: 'operate',
dataIndex: 'operate', dataIndex: 'operate',
...@@ -200,6 +221,12 @@ class VideoCourseList extends React.Component { ...@@ -200,6 +221,12 @@ class VideoCourseList extends React.Component {
renderMoreOperate = (item) => { renderMoreOperate = (item) => {
return ( return (
<div className="live-course-more-menu"> <div className="live-course-more-menu">
{ (userRole === "CloudManager" || userRole === "StoreManager") &&
<div
className="operate__item"
onClick={()=>this.handleRelatedModalShow(item)}
>关联培训计划</div>
}
<div <div
className="operate__item" className="operate__item"
onClick={() => { onClick={() => {
...@@ -237,6 +264,7 @@ class VideoCourseList extends React.Component { ...@@ -237,6 +264,7 @@ class VideoCourseList extends React.Component {
} }
}) })
} }
// 删除视频课 // 删除视频课
handleDeleteVideoCourse = (scheduleId) => { handleDeleteVideoCourse = (scheduleId) => {
Modal.confirm({ Modal.confirm({
...@@ -314,12 +342,42 @@ class VideoCourseList extends React.Component { ...@@ -314,12 +342,42 @@ class VideoCourseList extends React.Component {
}; };
this.props.onChange(_query); this.props.onChange(_query);
} }
handleRelatedModalShow = (item)=>{
const selectPlanList = {};
if(item.relatedPlanList){
item.relatedPlanList.map((item,index)=>{
selectPlanList[item.planId] = {}
selectPlanList[item.planId].planId = item.planId;
selectPlanList[item.planId].taskBaseVOList = [{taskId:item.taskId}];
return item
})
}
this.setState({
RelatedPlanModalVisible:true,
selectCourseId:item.id,
selectPlanList:selectPlanList
})
}
closeRelatedPlanModalVisible = ()=>{
this.setState({
RelatedPlanModalVisible:false
})
}
onChangeSelectPlanList = (selectPlanList)=>{
this.setState({
selectPlanList:selectPlanList
})
}
onConfirmSelectPlanList = ()=>{
this.setState({
RelatedPlanModalVisible:false
},()=>{this.props.onChange();})
}
render() { render() {
const { dataSource = [], totalCount, query } = this.props; const { dataSource = [], totalCount, query } = this.props;
const { current, size } = query; const { current, size } = query;
const {RelatedPlanModalVisible,selectPlanList,selectCourseId} = this.state;
return ( return (
<div className="video-course-list"> <div className="video-course-list">
<Table <Table
...@@ -344,6 +402,16 @@ class VideoCourseList extends React.Component { ...@@ -344,6 +402,16 @@ class VideoCourseList extends React.Component {
}} }}
/> />
</div> </div>
{ RelatedPlanModalVisible &&
<RelatedPlanModal
onClose={this.closeRelatedPlanModalVisible}
visible={RelatedPlanModalVisible}
selectCourseId={selectCourseId}
selectPlanList={selectPlanList}
onChange={this.onChangeSelectPlanList}
onConfirm={this.onConfirmSelectPlanList}
/>
}
{ this.state.shareLiveModal } { this.state.shareLiveModal }
{ this.state.watchDataModal } { this.state.watchDataModal }
</div> </div>
......
...@@ -212,7 +212,12 @@ function AddPlan() { ...@@ -212,7 +212,12 @@ function AddPlan() {
</div> </div>
<div className="basic-info__wrap"> <div className="basic-info__wrap">
<div className="title">培训任务</div> <div className="title">培训任务</div>
{ (type==='edit' && taskList.length>0) &&
<TrainingTask data={taskList} onChange={handleChangeTaskInfo} /> <TrainingTask data={taskList} onChange={handleChangeTaskInfo} />
}
{ type==='add' &&
<TrainingTask data={taskList} onChange={handleChangeTaskInfo} />
}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -21,23 +21,31 @@ const DragHandle = sortableHandle(() => ( ...@@ -21,23 +21,31 @@ const DragHandle = sortableHandle(() => (
<span>移动</span> <span>移动</span>
</span> </span>
)); ));
const SortableItem = sortableElement(props => <tr {...props} />); const SortableItem = sortableElement(props => <tr {...props}/>);
const SortableContainer = sortableContainer(props => <tbody {...props} />); const SortableContainer = sortableContainer(props => <tbody {...props} />);
class TrainingTask extends React.Component { class TrainingTask extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
dataSource:[], dataSource:this.props.data,
selectedTaskIndex:0, selectedTaskIndex:0,
relatedCourseModalVisible:false relatedCourseModalVisible:false
}; };
} }
componentDidMount(){ componentWillMount(){
// if (this.props.data) {
// const newData = [...this.props.data];
// this.setState({
// dataSource:newData,
// })
// }
}
console.log('data',this.props.data); componentWillReceiveProps(nextProps) {
} }
parseTaskColumns = ()=>{ parseTaskColumns = ()=>{
const columns = [ const columns = [
{ {
...@@ -65,7 +73,6 @@ class TrainingTask extends React.Component { ...@@ -65,7 +73,6 @@ class TrainingTask extends React.Component {
<span>{val}</span> <span>{val}</span>
} }
</div> </div>
) )
} }
...@@ -81,7 +88,7 @@ class TrainingTask extends React.Component { ...@@ -81,7 +88,7 @@ class TrainingTask extends React.Component {
<DragHandle /> <DragHandle />
<span className="operate__item"> <span className="operate__item">
<span className="icon iconfont">&#xe6f5;</span> <span className="icon iconfont">&#xe6f5;</span>
<span onClick={(e)=>{const { data }= this.props; record.type="input";this.props.onChange(data);}}>重命名</span> <span onClick={(e)=>{const { dataSource }= this.state; record.type="input";this.setState({dataSource})}}>重命名</span>
</span> </span>
<span className="operate__item" onClick={()=>{this.handleDeleteTask(index)}} > <span className="operate__item" onClick={()=>{this.handleDeleteTask(index)}} >
<span className="icon iconfont">&#xe6f6;</span> <span className="icon iconfont">&#xe6f6;</span>
...@@ -134,7 +141,7 @@ class TrainingTask extends React.Component { ...@@ -134,7 +141,7 @@ class TrainingTask extends React.Component {
<DragHandle /> <DragHandle />
<span className="operate__item"> <span className="operate__item">
<span className="icon iconfont">&#xe6f5;</span> <span className="icon iconfont">&#xe6f5;</span>
<span onClick={(e)=>{const { data } = this.props; record.type="input";this.props.onChange(data);}}>重命名</span> <span onClick={(e)=>{const { dataSource } = this.state; record.type="input";this.setState({dataSource})}}>重命名</span>
</span> </span>
<span className="operate__item" onClick={()=>{this.handleDeleteCourse(parentIndex,index)}}> <span className="operate__item" onClick={()=>{this.handleDeleteCourse(parentIndex,index)}}>
<span className="icon iconfont">&#xe6f6;</span> <span className="icon iconfont">&#xe6f6;</span>
...@@ -148,88 +155,107 @@ class TrainingTask extends React.Component { ...@@ -148,88 +155,107 @@ class TrainingTask extends React.Component {
return coursecolumns return coursecolumns
} }
// onSortEnd = ({ oldIndex, newIndex }) => { onSortEnd = ({ oldIndex, newIndex }) => {
// const { dataSource } = this.state; const { dataSource } = this.state;
// if (oldIndex !== newIndex) {
// const newData = arrayMove([].concat(dataSource), oldIndex, newIndex).filter(el => !!el); console.log("oldIndex",oldIndex);
// console.log('Sorted items: ', newData); console.log("newIndex",newIndex);
// this.setState({ dataSource: newData });
// } if (oldIndex !== newIndex) {
// }; const newData = arrayMove([].concat(dataSource), oldIndex, newIndex).filter(el => !!el);
this.setState({ dataSource: newData });
}
};
// DraggableContainer = props => ( DraggableContainer = props => (
// <SortableContainer <SortableContainer
// useDragHandle useDragHandle
// disableAutoscroll disableAutoscroll
// helperClass="row-dragging" helperClass="row-dragging"
// onSortEnd={this.onSortEnd} onSortEnd={this.onSortEnd}
// {...props} {...props}
// /> />
// ); );
// DraggableBodyRow = ({ className, style, ...restProps }) => { DraggableBodyRow = ({ className, style, ...restProps }) => {
// const { dataSource } = this.state; const { dataSource } = this.state;
// // function findIndex base on Table rowKey props and should always be a right array index // function findIndex base on Table rowKey props and should always be a right array index
// const index = dataSource.findIndex(x => x.index === restProps['data-row-key']); const index = dataSource.findIndex(x => x.index === restProps['data-row-key']);
// return <SortableItem className={className} index={index} {...restProps} style={style}/>; return <SortableItem className={className} index={index} {...restProps} style={style}/>;
// }; };
addTask = () => { addTask = () => {
const { data } = this.props; const { dataSource } = this.state;
const taskObj={ const taskObj={
taskName: '', taskName: '',
index:data.length, index:dataSource.length,
type:'input', type:'input',
courseList:[ courseList:[
] ]
} }
const newData = [...data,taskObj]; const newData = [...dataSource,taskObj];
this.props.onChange(newData); this.setState({
dataSource:newData
},()=>{this.props.onChange(newData);})
} }
handleRenameTaskName = (e,record) => { handleRenameTaskName = (e,record) => {
const { value } = e.target; const { value } = e.target;
const { data } = this.props; const { dataSource } = this.state;
record.taskName = value; record.taskName = value;
this.props.onChange(data); this.setState({
dataSource,
},()=>{this.props.onChange(dataSource);})
} }
handleTaskNameBlur = (e,record)=>{ handleTaskNameBlur = (e,record)=>{
const { value } = e.target; const { value } = e.target;
const {data}= this.props; const { dataSource }= this.state;
if(value){ if(value){
record.type="text"; record.type="text";
this.props.onChange(data); this.setState({
dataSource,
},()=>{this.props.onChange(dataSource);})
} }
} }
handleRenameCourseName = (e,record) => { handleRenameCourseName = (e,record) => {
const { value } = e.target; const { value } = e.target;
const { data } = this.props; const { dataSource } = this.state;
record.courseName = value; record.courseName = value;
this.props.onChange(data); this.setState({
dataSource,
},()=>{this.props.onChange(dataSource);})
} }
handleCourseNameBlur = (e,record)=>{ handleCourseNameBlur = (e,record)=>{
const { value } = e.target; const { value } = e.target;
const { data }= this.props; const { dataSource }= this.state;
if(value){ if(value){
record.type="text"; record.type="text";
this.setState({data}); this.setState({
dataSource,
},()=>{this.props.onChange(dataSource);})
} }
} }
handleDeleteTask = (index)=>{ handleDeleteTask = (index)=>{
const {data}= this.props; const {dataSource}= this.state;
const newData=[...data]; const newData=[...dataSource];
newData.splice(index,1); newData.splice(index,1);
this.props.onChange(newData); this.setState({
dataSource:newData,
},()=>{this.props.onChange(newData);})
} }
handleDeleteCourse = (parentIndex,index)=>{ handleDeleteCourse = (parentIndex,index)=>{
const {data}= this.props; const {dataSource}= this.state;
const newData=[...data]; const newData=[...dataSource];
const selectData = [...newData[parentIndex].courseList] const selectData = [...newData[parentIndex].courseList]
selectData.splice(index,1) selectData.splice(index,1)
newData[parentIndex].courseList= selectData; newData[parentIndex].courseList= selectData;
this.props.onChange(newData); this.setState({
dataSource:newData,
},()=>{this.props.onChange(newData);})
} }
showRelatedCourseModal = (index)=>{ showRelatedCourseModal = (index)=>{
...@@ -245,13 +271,14 @@ class TrainingTask extends React.Component { ...@@ -245,13 +271,14 @@ class TrainingTask extends React.Component {
} }
confirmSelectCourse = (selectList) =>{ confirmSelectCourse = (selectList) =>{
const {selectedTaskIndex}= this.state; const {selectedTaskIndex}= this.state;
const { data } = this.props const { dataSource } = this.state
const newData=[...data]; const newData=[...dataSource];
const selectData = [...newData[selectedTaskIndex].courseList] const selectData = [...newData[selectedTaskIndex].courseList]
const _selectData =[...selectData,...selectList]; const _selectData =[...selectData,...selectList];
newData[selectedTaskIndex].courseList= _selectData; newData[selectedTaskIndex].courseList= _selectData;
this.setState({ this.setState({
relatedCourseModalVisible:false, relatedCourseModalVisible:false,
dataSource:newData,
},()=>{ },()=>{
this.props.onChange(newData); this.props.onChange(newData);
}) })
...@@ -259,12 +286,15 @@ class TrainingTask extends React.Component { ...@@ -259,12 +286,15 @@ class TrainingTask extends React.Component {
render() { render() {
const { dataSource,selectedTaskIndex,relatedCourseModalVisible} = this.state; const { dataSource,selectedTaskIndex,relatedCourseModalVisible} = this.state;
console.log("dataSource",dataSource);
const { data } = this.props; const { data } = this.props;
return ( return (
<div className="training-task"> <div className="training-task">
<Table <Table
pagination={false} pagination={false}
dataSource={data} dataSource={dataSource}
columns={this.parseTaskColumns()} columns={this.parseTaskColumns()}
rowKey="index" rowKey="index"
expandedRowRender={(record,index) => { expandedRowRender={(record,index) => {
...@@ -274,7 +304,7 @@ class TrainingTask extends React.Component { ...@@ -274,7 +304,7 @@ class TrainingTask extends React.Component {
pagination={false} pagination={false}
dataSource={record.courseList} dataSource={record.courseList}
columns={this.parseCoursecolumns(index)} columns={this.parseCoursecolumns(index)}
rowKey="index" // rowKey="index"
// components={{ // components={{
// body: { // body: {
// wrapper: this.DraggableContainer, // wrapper: this.DraggableContainer,
...@@ -287,20 +317,19 @@ class TrainingTask extends React.Component { ...@@ -287,20 +317,19 @@ class TrainingTask extends React.Component {
}else{ }else{
return <div><Button onClick={()=>{this.showRelatedCourseModal(index)}}><span>+</span><span>关联课程</span></Button></div>; return <div><Button onClick={()=>{this.showRelatedCourseModal(index)}}><span>+</span><span>关联课程</span></Button></div>;
} }
}} }}
// components={{ components={{
// body: { body: {
// wrapper: this.DraggableContainer, wrapper: this.DraggableContainer,
// row: this.DraggableBodyRow, row: this.DraggableBodyRow,
// }, },
// }} }}
/> />
<div><Button onClick={()=>this.addTask()}><span>+</span><span>添加任务</span></Button></div> <div><Button onClick={()=>this.addTask()}><span>+</span><span>添加任务</span></Button></div>
{ relatedCourseModalVisible && { relatedCourseModalVisible &&
<RelatedCourseModal <RelatedCourseModal
selectedTaskIndex={selectedTaskIndex} selectedTaskIndex={selectedTaskIndex}
data={data} data={dataSource}
visible={relatedCourseModalVisible} visible={relatedCourseModalVisible}
onClose={this.closeRelatedCourseModal} onClose={this.closeRelatedCourseModal}
onSelect={this.confirmSelectCourse} onSelect={this.confirmSelectCourse}
......
...@@ -340,7 +340,6 @@ class SelectOperatorModal extends React.Component { ...@@ -340,7 +340,6 @@ class SelectOperatorModal extends React.Component {
onSelect: (record, selected) => { onSelect: (record, selected) => {
this.selectVideoList(record, selected); this.selectVideoList(record, selected);
}, },
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = []; let _list = [];
if (selected) { if (selected) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment