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

Commit 1f0a43a8 by 李严凡

Merge branch 'develop' of https://gitlab.redhtc.com/Berlincen/DA-Platform into develop

parents 128238eb 8fa8e105
......@@ -22,16 +22,21 @@
</template>
<script>
const indexs = new Set(['/taskhall', '/ongoing', '/releasetask', '/completed',
'/check', '/publishtask', '/userhome', '/'])
export default {
name: 'nav-header',
data () {
return {
activeIndex: '/taskhall'
}
},
computed: {
userType () {
return this.$store.state.userInfo && this.$store.state.userInfo.identity === 1
},
activeIndex () {
return this.$store.state.activeIndex
}
},
watch: {
......@@ -39,7 +44,7 @@ export default {
'$route' (to, from) {
var index = to.fullPath.indexOf('/', 1)
var toPath = to.fullPath.substring(0, index === -1 ? to.fullPath.length : index + 1)
this.activeIndex = toPath
if (indexs.has(toPath)) { this.$store.commit('setActiveIndex', toPath) }
}
},
methods: {
......
......@@ -2,11 +2,11 @@
<div class="pieces-table-container">
<el-table
ref="multipleTable"
:data="tableData"
style="width: 100%"
default-expand-all
:data="tableData"
:row-class-name="tableRowClassName"
@selection-change="selectionChange"
@expand-change="expandChange"
>
<el-table-column v-if="showSelection" type="selection" width="55"></el-table-column>
<el-table-column prop="id" label="分片id" width="120"></el-table-column>
......@@ -68,12 +68,15 @@ export default {
computed: {
userId () { return this.$store.state.userInfo.userId }
},
beforeMount () {
async beforeMount () {
// 拉取分片信息
var self = this, params = { taskId: this.taskId }
var params = { taskId: this.taskId }, self = this
if (this.isCheck) params.isCheck = true
if (this.withExecutor) params.userId = this.userId
this.axios.get('/slice/getPieces', { params }).then(res => { self.tableData = res.data })
var res = await this.axios.get('/slice/getPieces', { params })
this.tableData = res.data
// 拉取文件信息
res.data.forEach(piece => { self.getFiles(piece.id) })
},
methods: {
selectionChange (val) {
......@@ -107,12 +110,6 @@ export default {
})
}
},
expandChange (row, expandedRows) { // expandedRows是一个数组里面是展开的行
// 已获取分片的任务列表
if (this.map[row.id]) return
// 未获取
this.getFiles(row.id)
},
getFiles (pieceId) {
var params = { pieceId }
if (this.withExecutor) params.executor = this.userId
......
......@@ -7,27 +7,16 @@ Vue.use(Vuex)
export default new Vuex.Store({
state: {
userInfo: null
// imageData: null,
// layerData: null
userInfo: null,
activeIndex: '/taskhall'
},
mutations: {
setUserInfo (state, userInfo) {
state.userInfo = userInfo
},
setActiveIndex (state, activeIndex) {
state.activeIndex = activeIndex
}
// setImageData (state, imageData) {
// state.imageData = imageData
// },
// clearImageData (state) {
// state.imageData = null
// },
// setLayerData (state, layerData) {
// state.layerData = layerData
// },
// clearlayerData (state) {
// state.layerData = null
// }
},
actions: {
},
......
......@@ -47,6 +47,7 @@ def find_data(id):
else:
return Result(1, "find success", data.url)
# 根据数据id寻找slice_id
def find_slice_id(id):
try:
......@@ -56,6 +57,7 @@ def find_slice_id(id):
else:
return Result(1, "find success", data.slice_id)
# 查找某分片下的文件(用于查看某分片下的文件信息)
def find_data_by_slice(slice_id):
try:
......@@ -79,7 +81,7 @@ def find_data_by_slice(slice_id):
return Result(1, "find success", list)
# 查找某分片下的文件同时返回文件是否已被标注(用于查看分片下的文件信息)
# 查找某分片下的文件同时返回文件是否已被标注(用于查看我的任务分片下的文件信息)
def find_data_by_slice_state(slice_id, executor):
try:
find = Data.select(Data.data_id, Data.name, Data.size, Data.url).where(
......
......@@ -54,7 +54,7 @@ def set_grade(user_id, slice_id, data_id, score):
return Result(1, "grade success", {})
# 查找Relation中与用户id 任务id相关的分片列表
# 查找Relation中与用户id 任务id相关的分片列表(待审核)
def find_slice_by_task(taskid, user_id):
try:
slice_list = Relation.select(Relation.slice_id).where(Relation.user_id == user_id, Relation.flag == 1)
......
......@@ -71,6 +71,7 @@ def delete_slice_by_task(task_id):
return Result(1, "delete success", {})
# 查找待审核的分片
def find_slice_by_check(task_id):
try:
find = Slice.select(Slice.task_id, Slice.slice_id, Slice.document_number, Slice.type, Slice.model_id, Slice.illustration).where(
......@@ -108,7 +109,7 @@ def find_slice_by_check(task_id):
return Result(1, "find success", list)
# 查找某任务下的分片(用于在分片列表中显示)
# 查找某任务下的分片(用于在任务大厅分片列表中显示)
def find_slice_by_task(task_id):
try:
find = Slice.select(Slice.slice_id, Slice.document_number, Slice.type, Slice.model_id, Slice.illustration).where(
......@@ -142,7 +143,7 @@ def find_slice_by_task(task_id):
return Result(1, "find success", list)
# 查找某任务下用户选择的分片(用于在分片列表中显示)
# 查找某任务下用户选择的分片(用于在我的任务分片列表中显示)
def find_slice_by_task_user(task_id, user_id):
try:
slice_list = Relation.find_slice_by_executor(user_id)
......@@ -278,6 +279,7 @@ def find_task_by_slice(slice_id):
else:
return s.task_id
# 通过sliceid查找type
def find_type_by_slice(slice_id):
try:
......@@ -287,6 +289,7 @@ def find_type_by_slice(slice_id):
else:
return s.type
# 通过一个sliceid数组查找taskid
def find_task_by_slicelist(slice_list):
try:
......
......@@ -28,7 +28,7 @@ class Task(Model):
database = mysql
# 新建任务
# 创建任务的函数(参数:发布任务者id、任务名称;返回值:若创建成功返回任务id)
def create_task(publish_id, task_name):
try:
task = Task(publish_id=publish_id, task_name=task_name)
......@@ -39,19 +39,8 @@ def create_task(publish_id, task_name):
return Result(1, "create success", task.task_id, 0)
# 判断该用户是否完成该任务
def judge_completed(taskid, user_id):
ret = Slice.find_slice_by_judge(taskid, user_id)
list = ret.data
for item in list:
completedNum = item['completedNum']
totalNum = item['totalNum']
if completedNum != totalNum:
return 0
return 1
# 根据任务名称查找任务(任务大厅搜索功能)
# 参数:任务关键词、任务数组的范围
def find_task_by_name(task_name, start, num):
try:
find = Task.select(Task.task_id, Task.task_name, Task.publish_id, Task.publish_time).where(
......@@ -183,6 +172,18 @@ def find_task_completed(executor, start, num):
return Result(1, "find success", list, math.ceil(len(find) / num))
# 判断该用户是否完成该任务
def judge_completed(taskid, user_id):
ret = Slice.find_slice_by_judge(taskid, user_id)
list = ret.data
for item in list:
completedNum = item['completedNum']
totalNum = item['totalNum']
if completedNum != totalNum:
return 0
return 1
# 寻找标注者选择的任务(从Relation表中找到用户id标注的分片,再利用分片表获取任务列表)
def find_task_my_task(executor, start, num):
try:
......@@ -210,7 +211,7 @@ def find_task_my_task(executor, start, num):
return Result(1, "find success", list, math.ceil(len(find) / num))
# 删除任务
# 根据id删除任务
def delete_task(task_id):
try:
Task.delete().where(Task.task_id == task_id).execute()
......
......@@ -31,7 +31,7 @@ def get_image():
# 保存图片标注结果
@image.route("/image/saveImage", methods=["POST"])
def save_image():
data = json.loads(request.data)
data = json.loads(request.data.decode('utf-8'))
image_list = data['imageList']
ret = Image.saveImage(image_list)
res = {
......@@ -61,7 +61,7 @@ def get_layer():
# 保存图层标注结果
@image.route("/layer/saveLayer", methods=["POST"])
def save_layer():
data = json.loads(request.data)
data = json.loads(request.data.decode('utf-8'))
layer_info = data['layerInfo']
landmark_info = None
if 'landmarkInfo' in data:
......
......@@ -9,15 +9,15 @@ task = Blueprint("task", __name__, url_prefix="/api/task")
# 各个界面获取任务列表的接口
@task.route("/getTasks", methods=["GET"])
def get_tasks():
pagesize = int(request.args['pageSize'])
currentpage = int(request.args['currentPage'])
keyword = request.args.get('keyword')
executor = request.args.get('executor')
creator = request.args.get('creator')
state = request.args.get('state')
pagesize = int(request.args['pageSize']) # 任务列表单页可容纳最大任务数
currentpage = int(request.args['currentPage']) # 任务列表当前页数
keyword = request.args.get('keyword') # 搜索任务时的搜索关键词
executor = request.args.get('executor') # 任务标注者id
creator = request.args.get('creator') # 任务发布者id
state = request.args.get('state') # 任务状态:已完成、待审核等
# get函数用于可选参数,在未接收到参数时返回空值
if keyword:
ret = Task.find_task_by_name(keyword, pagesize*(currentpage-1), pagesize)
ret = Task.find_task_by_name(keyword, pagesize * (currentpage - 1), pagesize)
elif creator:
if state:
ret = Task.find_task_check(creator, pagesize * (currentpage - 1), pagesize)
......@@ -29,7 +29,7 @@ def get_tasks():
else:
ret = Task.find_task_my_task(executor, pagesize * (currentpage - 1), pagesize)
else:
ret = Task.find_task(pagesize*(currentpage-1), pagesize)
ret = Task.find_task(pagesize * (currentpage - 1), pagesize)
res = {
'code': ret.code,
'message': ret.message,
......
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