文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 1912ce2e by 李景熙

Merge remote-tracking branch 'origin/develop' into develop

parents 4325cc43 d6995e80
......@@ -8,7 +8,7 @@
发布时间:{{task.date|formatDate}}
</el-col>
<el-col offset="11" span="5">
<el-button type="primary" plain>提交标注</el-button>
<el-button type="primary" plain @click="finsihTask">提交标注</el-button>
<el-button plain @click="giveUpTask">放弃任务</el-button>
</el-col>
</el-row></p>
......@@ -101,7 +101,7 @@ export default {
type: 'info',
message: '任务已放弃标注'
});
this.$router.push({ path: "/ongoingtask" });
this.$router.push({ path: "/ongoing" });
}
else{
this.$message({
......@@ -117,6 +117,33 @@ export default {
message: '已取消放弃任务'
});
});
},
finsihTask(){
// 判断分片完成度是否都为100%
console.log("piece")
console.log(piece)
// this.axios({
// method:'post',
// url:'task/finsihTask',
// params:{
// userId:this.$store.state.userInfo.userId,
// taskId:this.task.id
// }
// }).then(res=>{
// if(res.code == 1){
// this.$message({
// type:'info',
// message:"完成任务"
// })
// this.$router.push({ path: "/ongoing" });
// }
// else{
// this.$message({
// type:'info',
// message:"提交任务失败"
// })
// }
// })
}
}
}
......
<<<<<<< HEAD
<template>
<div class="pieces-table-container">
<el-table
ref="multipleTable"
style="width: 100%"
default-expand-all
:data="tableData"
:row-class-name="tableRowClassName"
@selection-change="selectionChange"
>
<el-table-column v-if="showSelection" type="selection" :selectable="selectable" width="55"></el-table-column>
<el-table-column prop="id" label="分片id" width="120"></el-table-column>
<el-table-column prop="type" label="文件类别" width="120"></el-table-column>
<el-table-column prop="fileNum" label="文件数量" width="120"></el-table-column>
<el-table-column prop="template" label="模板/说明" :width="showProgress ? 240 : ''"></el-table-column>
<el-table-column v-if="showProgress" label="进度">
<template slot-scope="props">
<el-progress :percentage="percentage(props.row)" style="width:150px"></el-progress>
</template>
</el-table-column>
<el-table-column type="expand">
<template slot-scope="props">
<div class="fileList" v-loading="!map[props.row.id]">
<div class="file" v-for="item in map[props.row.id]" :key="item.id">
<i class="el-icon-document"></i>
<span class="file-name">{{item.name}}</span>{{item.size}}
<slot name='option' :file='item' :piece='props.row'></slot>
</div>
</div>
</template>
</el-table-column>
</el-table>
<el-button v-if="showSelection" v-loading="loading" type="primary" style="margin-top:20px" @click="complete">完成选择</el-button>
</div>
</template>
<script>
import '@/mock/api.js'
export default {
name: 'pieces-table',
props: {
taskId: Number, // 接收任务的id
isCheck: { // showProgess为false时忽略此属性,为true时,是审核页面,为false标注页面
type: Boolean,
default: false
},
showSelection: {
type: Boolean,
default: false
},
showProgress: {
type: Boolean,
default: false
},
withExecutor: {
type: Boolean,
default: false
}
},
data () {
return {
tableData: [],
multipleSelection: [],
map: {},
loading: false
}
},
computed: {
userId () { return this.$store.state.userInfo.userId }
},
/*
没有userId返回所有,有userId返回user所选的,我的任务和已完成任务需要有userId
isCheck表明是审核页发出的请求,多返回totalNum属性
*/
async beforeMount () {
// 拉取分片信息
var params = { taskId: this.taskId }, self = this
if (this.isCheck) params.isCheck = true
if (this.withExecutor) params.userId = this.userId
var res = await this.axios.get('/slice/getPieces', { params })
this.tableData = res.data
// 拉取文件信息
res.data.forEach(piece => { self.getFiles(piece.id) })
},
methods: {
selectionChange (val) {
this.multipleSelection = val
},
selectable (row, index) {
return true
},
complete () {
// todo 未登录选择分片
if (this.loading) return
if (this.multipleSelection.length === 0) {
// 提示未选择分片
this.$alert('请选择分片', '提示', {
confirmButtonText: '确定',
type: 'warning'
})
} else {
var selected = this.multipleSelection.map((item) => { return item.id })
var userId = this.userId, self = this; this.loading = true
this.axios.post('/slice/selectPieces', {
userId,
selected
}).then((res) => {
self.loading = false
if (res.code === 1) {
self.$message({ message: '选择成功', type: 'success' })
self.$router.push('/ongoing')
} else {
console.log(res)
self.$message.error(res.message)
}
})
}
},
getFiles (pieceId) {
var params = { pieceId }
if (this.withExecutor) params.executor = this.userId
var self = this
this.axios.get('/file/getFiles', {
params
}).then(res => {
self.$set(self.map, pieceId, res.data.map((item) => {
item.size = self.unitTransform(item.size) // 单位转换
return item
}))
})
},
unitTransform (n) { // 单位转换
var unit = ['B', 'KB', 'MB', 'GB'], i = 0
while (n >= 1024 && i < 3) {
n /= 1024
i++
}
return n.toFixed(2) + unit[i]
},
tableRowClassName ({row}) {
if (row.type === '图片') {
return 'image-row'
} else if (row.type === '图层') {
return 'coverage-row'
} else {
return 'text-row'
}
},
percentage (piece) {
var self = this
if (piece.fileNum === 0 || piece.totalNum === 0) return 100
return Math.floor(piece.completedNum / (self.isCheck ? piece.totalNum : piece.fileNum) * 100)
}
}
}
</script>
<style>
.el-table .image-row {
background: oldlace;
}
.el-table .coverage-row {
background: #fef0f0;
}
.el-table .text-row {
background: #ecf5ff;
}
</style>
<style lang="scss" scopde>
.file{
position: relative;
height: 40px;
line-height: 40px;
.file-name{
display: inline-block;
min-width: 240px;
}
.el-button{
float: right;
margin-top: 5px;
margin-left: 10px;
}
}
.el-loading-spinner{
transform: scale(0.5);
}
</style>
=======
<template>
<div class="pieces-table-container">
<el-table
......@@ -188,3 +380,4 @@ export default {
transform: scale(0.5);
}
</style>
>>>>>>> deb97ea6d64cbf5fb4d2d09302f70996e638e63b
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