|
|
|
@ -16,7 +16,6 @@ class TPMDataset extends Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props)
|
|
|
|
|
this.state = {
|
|
|
|
|
datas: [0, 1, 2, 3, 4, 5],
|
|
|
|
|
value: undefined,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
@ -80,10 +79,15 @@ class TPMDataset extends Component {
|
|
|
|
|
datalist:[],
|
|
|
|
|
data_sets_count:0,
|
|
|
|
|
selectedRowKeysdata:[],
|
|
|
|
|
loadingstate:false,
|
|
|
|
|
checked: false,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
this.setState({
|
|
|
|
|
loadingstate:true,
|
|
|
|
|
})
|
|
|
|
|
this.getdatas()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -98,18 +102,20 @@ class TPMDataset extends Component {
|
|
|
|
|
datas.push(i);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
selectedRowKeysdata:mydata,
|
|
|
|
|
selectedRowKeys: datas,
|
|
|
|
|
checked:true,
|
|
|
|
|
})
|
|
|
|
|
// console.log(mydata);
|
|
|
|
|
// console.log(datas);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({
|
|
|
|
|
selectedRowKeysdata:[],
|
|
|
|
|
selectedRowKeys: [],
|
|
|
|
|
checked:false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -143,11 +149,26 @@ class TPMDataset extends Component {
|
|
|
|
|
collaboratorList: response.data,
|
|
|
|
|
data_sets_count:response.data.data_sets_count,
|
|
|
|
|
datalist:datalists,
|
|
|
|
|
selectedRowKeysdata:[],
|
|
|
|
|
selectedRowKeys: [],
|
|
|
|
|
checked:false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
loadingstate:false,
|
|
|
|
|
})
|
|
|
|
|
}, 500)
|
|
|
|
|
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
loadingstate:false,
|
|
|
|
|
})
|
|
|
|
|
}, 500)
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -181,34 +202,39 @@ class TPMDataset extends Component {
|
|
|
|
|
collaboratorList: response.data,
|
|
|
|
|
data_sets_count:response.data.data_sets_count,
|
|
|
|
|
datalist:datalists,
|
|
|
|
|
selectedRowKeysdata:[],
|
|
|
|
|
selectedRowKeys: [],
|
|
|
|
|
checked:false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
loadingstate:false,
|
|
|
|
|
})
|
|
|
|
|
}, 500)
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
loadingstate:false,
|
|
|
|
|
})
|
|
|
|
|
}, 500)
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showModal = (id, status) => {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleOk = (id, editid) => {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleCancel = (e) => {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
paginationonChanges = (pageNumber) => {
|
|
|
|
|
// //console.log('Page: ');
|
|
|
|
|
this.setState({
|
|
|
|
|
page: pageNumber,
|
|
|
|
|
loadingstate:true,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.getdatastwo(pageNumber,10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onSelectChange = (selectedRowKeys, selectedRows) => {
|
|
|
|
|
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
|
|
|
|
|
this.setState(
|
|
|
|
@ -241,22 +267,33 @@ class TPMDataset extends Component {
|
|
|
|
|
let {fileList} = this.state;
|
|
|
|
|
|
|
|
|
|
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
|
|
|
|
|
console.log("handleChange1");
|
|
|
|
|
console.log("handleChange1fileLists");
|
|
|
|
|
// if(fileList.length===0){
|
|
|
|
|
let fileLists = info.fileList;
|
|
|
|
|
// console.log(fileLists);
|
|
|
|
|
this.setState({
|
|
|
|
|
// fileList:appendFileSizeToUploadFileAll(fileList),
|
|
|
|
|
fileList: fileLists,
|
|
|
|
|
deleteisnot: false
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if(info.file.status === 'done'){
|
|
|
|
|
//done 成功就会调用这个方法
|
|
|
|
|
this.getdatas();
|
|
|
|
|
// }
|
|
|
|
|
// this.props.showNotification(`上传文件成功`);
|
|
|
|
|
|
|
|
|
|
}else if(info.file.status === 'removed'){
|
|
|
|
|
// this.props.showNotification(`上传文件失败`);
|
|
|
|
|
|
|
|
|
|
}else if(info.file.status === 'uploading'){
|
|
|
|
|
// this.props.showNotification(`正在上传文件中`);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onAttachmentRemove = (file) => {
|
|
|
|
|
debugger
|
|
|
|
|
// debugger
|
|
|
|
|
if(!file.percent || file.percent == 100){
|
|
|
|
|
confirm({
|
|
|
|
|
title: '确定要删除这个附件吗?',
|
|
|
|
@ -277,28 +314,46 @@ class TPMDataset extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
deleteRemovedata(){
|
|
|
|
|
debugger
|
|
|
|
|
console.log("删除");
|
|
|
|
|
console.log(this.state.selectedRowKeysdata);
|
|
|
|
|
const url = `/attachments/destroy_files.json`;
|
|
|
|
|
axios.delete(url, {
|
|
|
|
|
id:this.state.selectedRowKeysdata,
|
|
|
|
|
})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response.data) {
|
|
|
|
|
const { status } = response.data;
|
|
|
|
|
if (status == 0) {
|
|
|
|
|
this.props.showNotification(`删除成功`);
|
|
|
|
|
this.getdatas()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
if(this.state.selectedRowKeysdata===undefined || this.state.selectedRowKeysdata===null ||this.state.selectedRowKeysdata.length===0){
|
|
|
|
|
|
|
|
|
|
this.props.showNotification(`请选择要删除的文件`);
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
confirm({
|
|
|
|
|
title: '确定要删除文件吗?',
|
|
|
|
|
okText: '确定',
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
// content: 'Some descriptions',
|
|
|
|
|
onOk: () => {
|
|
|
|
|
const url = `/attachments/destroy_files.json`;
|
|
|
|
|
axios.delete(url,
|
|
|
|
|
{ params: {
|
|
|
|
|
id:this.state.selectedRowKeysdata,
|
|
|
|
|
}}
|
|
|
|
|
)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response.data) {
|
|
|
|
|
const { status } = response.data;
|
|
|
|
|
if (status == 0) {
|
|
|
|
|
this.props.showNotification(`删除成功`);
|
|
|
|
|
|
|
|
|
|
this.getdatas()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onCancel() {
|
|
|
|
|
console.log('Cancel');
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
deleteAttachment = (file) => {
|
|
|
|
|
console.log(file);
|
|
|
|
|
// console.log(file);
|
|
|
|
|
let id=file.response ==undefined ? file.id : file.response.id
|
|
|
|
|
const url = `/attachements/destroy_files.json`
|
|
|
|
|
axios.delete(url, {
|
|
|
|
@ -332,7 +387,7 @@ class TPMDataset extends Component {
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const {tpmLoading, shixun, user, match} = this.props;
|
|
|
|
|
const {columns, datas, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count} = this.state;
|
|
|
|
|
const {columns, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count,loadingstate} = this.state;
|
|
|
|
|
const rowSelection = {
|
|
|
|
|
selectedRowKeys,
|
|
|
|
|
onChange: this.onSelectChange,
|
|
|
|
@ -371,7 +426,6 @@ class TPMDataset extends Component {
|
|
|
|
|
message: '提示',
|
|
|
|
|
description:
|
|
|
|
|
'文件大小必须小于50MB',
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
@ -385,8 +439,6 @@ class TPMDataset extends Component {
|
|
|
|
|
file:file
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("handleChange2");
|
|
|
|
|
return isLt150M;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
@ -407,7 +459,7 @@ class TPMDataset extends Component {
|
|
|
|
|
<div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}>
|
|
|
|
|
<div className="sortinxdirection">
|
|
|
|
|
<div className="tpmwidth">
|
|
|
|
|
<Checkbox onChange={this.mysonChange}>全选</Checkbox>
|
|
|
|
|
<Checkbox checked={this.state.checked} onChange={this.mysonChange}>全选</Checkbox>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="tpmwidth xaxisreverseorder">
|
|
|
|
|
<style>
|
|
|
|
@ -506,6 +558,8 @@ class TPMDataset extends Component {
|
|
|
|
|
className="mysjysltable4"
|
|
|
|
|
rowSelection={rowSelection}
|
|
|
|
|
rowClassName={this.rowClassName}
|
|
|
|
|
loading={loadingstate}
|
|
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|