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

Commit 85e7b74d by Wang Yuhang

修改接口文档关于获取分片和获取标注者,完善审核功能,以及文件标注状态的提示

parent 7e8e48d6
......@@ -5,17 +5,23 @@
<p>发布者:{{task.creator}}</p>
<p>发布时间:{{task.date|formatDate}}</p>
<el-divider></el-divider>
<pieces-table :task-id="task.id" showProgress>
<pieces-table :task-id="task.id" showProgress isCheck>
<template v-slot:option="slotProps">
<el-button
type="primary"
size="mini"
plain
@click="doOption(slotProps.file,slotProps.type)"
<el-button type="primary" size="mini" plain
@click="doOption(slotProps.file,slotProps.type,slotProps.pieceId)"
>审核</el-button>
</template>
</pieces-table>
</div>
<el-dialog title="已标注列表" :visible.sync="dialogVisible" width="350px" lock-scroll
@open="getExecutors" @opened="loading=false">
<ul v-loading="loading">
<li v-for="item in executors" :key="item.id">
<span>{{item.nickname}}</span>
<el-button type="primary" size="mini" plain @click="goto(item)">待审核</el-button>
</li>
</ul>
</el-dialog>
</div>
</template>
......@@ -29,16 +35,42 @@ export default {
data () {
return {
task: null,
isCheck: '1'
isCheck: '1',
dialogVisible: false,
executors: [],
file: undefined,
type: undefined,
pieceId: undefined,
loading: false
}
},
beforeMount () {
this.task = JSON.parse(decodeURIComponent(this.$route.params.task))
},
methods: {
doOption (file, type) {
var params = { file: encodeURIComponent(JSON.stringify(file)) }
var self = this
doOption (file, type, pieceId) {
// 打开模态框
this.file = file; this.type = type; this.pieceId = pieceId
this.dialogVisible = true
},
getExecutors () {
this.loading = true
var self = this, params = {
pieceId: this.pieceId,
fileId: this.file.id
}
this.axios.get('/file/getExecutors', {
params
}).then(res => {
self.executors = res.data
})
},
goto (executor) {
var {file, type} = this, self = this
var params = {
file: encodeURIComponent(JSON.stringify(file)),
executor: encodeURIComponent(JSON.stringify(executor))
}
function goto (path) {
self.$router.push({ name: path, params })
}
......@@ -63,5 +95,23 @@ export default {
text-align: left;
padding: 30px 20px 30px 20px;
}
ul{
padding:0 20px 0 20px;
max-height: 400px;
overflow-y: auto;
&::-webkit-scrollbar{
width: 5px;
}
&::-webkit-scrollbar-thumb{
background-color: #E4E7ED;
border-radius: 3px;
}
li{
list-style: none;
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
}
}
</style>
......@@ -5,12 +5,9 @@
<p>发布者:{{task.creator}}</p>
<p>发布时间:{{task.date|formatDate}}</p>
<el-divider></el-divider>
<pieces-table :task-id="task.id" :userId="$store.state.userInfo.userId" showProgress>
<pieces-table :task-id="task.id" showProgress>
<template v-slot:option="slotProps">
<el-button
type="primary"
size="mini"
plain
<el-button type="primary" size="mini" plain
@click="doOption(slotProps.file,slotProps.type)"
>标注</el-button>
</template>
......@@ -20,65 +17,62 @@
</template>
<script>
import PiecesTable from "./PiecesTable"
import PiecesTable from './PiecesTable'
export default {
name: "on-going-task-detail",
name: 'on-going-task-detail',
components: {
PiecesTable
},
data() {
data () {
return {
task: null
};
}
},
beforeMount() {
beforeMount () {
this.task = JSON.parse(decodeURIComponent(this.$route.params.task))
},
methods: {
doOption(file, type) {
doOption (file, type) {
var params = {
file: encodeURIComponent(JSON.stringify(file)),
task: encodeURIComponent(JSON.stringify(this.task))
};
var self = this;
function goto(path) {
}
var self = this
function goto (path) {
self.$router.push({ name: path, params })
}
switch (type) {
case "文本":
case '文本':
if (
file.url
.split("")
.split('')
.reverse()
.join("")
.join('')
.substring(0, 4)
.split("")
.split('')
.reverse()
.join("") == "xlsx"
)
goto("table")
else if (
.join('') == 'xlsx'
) { goto('table') } else if (
file.url
.split("")
.split('')
.reverse()
.join("")
.join('')
.substring(0, 3)
.split("")
.split('')
.reverse()
.join("") == "txt"
)
goto("SelectText")
.join('') == 'txt'
) { goto('SelectText') }
break
case "图片":
goto("image");
case '图片':
goto('image')
break
case "图层":
goto("layer");
case '图层':
goto('layer')
}
}
}
};
}
</script>
<style lang="scss" scoped>
......
......@@ -24,7 +24,8 @@
<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' :type='props.row.type'></slot>
<slot v-if="!item.state" name='option' :file='item' :type='props.row.type' :pieceId='props.row.id'></slot>
<i v-else class="el-icon-success"></i>
</div>
</div>
</template>
......@@ -40,7 +41,10 @@ export default {
name: 'pieces-table',
props: {
taskId: Number, // 接收任务的id
userId: Number, // 用户Id,如果有这个会拉取该用户选择的分片
isCheck: { // showProgess为false时忽略此属性,为true时,是审核页面,为false标注页面
type: Boolean,
default: false
},
showSelection: {
type: Boolean,
default: false
......@@ -58,11 +62,13 @@ export default {
loading: false
}
},
computed: {
userId () { return this.$store.state.userInfo.userId }
},
beforeMount () {
// 拉取分片信息
var self = this
var params = { taskId: this.taskId }
if (this.userId) { params.userId = this.userId }
var self = this, params = { taskId: this.taskId }
if (this.showProgress && !this.isCheck) { params.userId = this.userId }
this.axios.get('/slice/getPieces', { params }).then(res => { self.tableData = res.data })
},
methods: {
......@@ -70,6 +76,7 @@ export default {
this.multipleSelection = val
},
complete () {
// todo 未登录选择分片
if (this.loading) return
if (this.multipleSelection.length === 0) {
// 提示未选择分片
......@@ -79,8 +86,7 @@ export default {
})
} else {
var selected = this.multipleSelection.map((item) => { return item.id })
var userId = this.$store.state.userInfo.userId
var self = this; this.loading = true
var userId = this.userId, self = this; this.loading = true
this.axios.post('/slice/selectPieces', {
userId,
......@@ -97,41 +103,45 @@ export default {
})
}
},
tableRowClassName ({row}) {
if (row.type === '图片') {
return 'image-row'
} else if (row.type === '图层') {
return 'coverage-row'
} else {
return 'text-row'
}
},
percentage (fileNum, completedNum) {
return Math.floor(completedNum / fileNum * 100)
},
expandChange (row, expandedRows) {
var pieceId = row.id
expandChange (row, expandedRows) { // expandedRows是一个数组里面是展开的行
// 已获取分片的任务列表
if (this.map[pieceId]) return
if (this.map[row.id]) return
// 未获取
this.getFiles(row.id)
},
getFiles (pieceId) {
var params = { pieceId }
if (this.showProgress && !this.isCheck) params.executor = this.userId
var self = this
this.axios.get('/file/getFiles', {
params: { pieceId }
params
}).then(res => {
// 单位转换
self.$set(self.map, pieceId, res.data.map((item) => {
item.size = self.unitTransform(item.size)
item.size = self.unitTransform(item.size) // 单位转换
return item
}))
})
},
unitTransform: function (n) { // 单位转换
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 (fileNum, completedNum) {
if (!completedNum) return 0
return Math.floor(completedNum / fileNum * 100)
}
}
}
......
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