fix: 1.类型拍戏报错

2.分页数据错误
     3.全部消息取消默认状态排序
     4.数据集同步消息跳转路由修改
This commit is contained in:
fit2cloud-chenyw 2021-07-22 16:59:34 +08:00
parent e2051479bd
commit aaf9f958a0
9 changed files with 94 additions and 30 deletions

View File

@ -52,7 +52,7 @@
order by ${orderByClause}
</if>
<if test="orderByClause == null">
order by sm.status asc
order by sm.create_time desc
</if>
</select>

View File

@ -15,9 +15,15 @@ import io.dataease.controller.message.dto.SettingTreeNode;
import io.dataease.service.message.SysMsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Api(tags = "系统:消息管理")
@RequestMapping("/api/sys_msg")
@ -31,8 +37,13 @@ public class MsgController {
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<MsgGridDto>> messages(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody MsgRequest msgRequest) {
Long userId = AuthUtils.getUser().getUserId();
List<Long> typeIds = null;
if (ObjectUtils.isNotEmpty(msgRequest.getType())){
List<SysMsgType> sysMsgTypes = sysMsgService.queryMsgTypes();
typeIds = sysMsgTypes.stream().filter(sysMsgType -> msgRequest.getType() == sysMsgType.getPid()).map(SysMsgType::getMsgTypeId).collect(Collectors.toList());
}
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
Pager<List<MsgGridDto>> listPager = PageUtils.setPageInfo(page, sysMsgService.queryGrid(userId, msgRequest));
Pager<List<MsgGridDto>> listPager = PageUtils.setPageInfo(page, sysMsgService.queryGrid(userId, msgRequest, typeIds));
return listPager;
}

View File

@ -67,7 +67,7 @@ public class SysMsgService {
return sysMsgs;
}
public List<MsgGridDto> queryGrid(Long userId, MsgRequest msgRequest) {
public List<MsgGridDto> queryGrid(Long userId, MsgRequest msgRequest, List<Long> typeIds) {
String orderClause = " create_time desc";
SysMsgExample example = new SysMsgExample();
SysMsgExample.Criteria criteria = example.createCriteria();
@ -79,13 +79,16 @@ public class SysMsgService {
orderClause = String.join(", ", orders);
}
if (ObjectUtils.isNotEmpty(msgRequest.getType())) {
/*if (ObjectUtils.isNotEmpty(msgRequest.getType())) {
SysMsgTypeExample sysMsgTypeExample = new SysMsgTypeExample();
sysMsgTypeExample.createCriteria().andPidEqualTo(msgRequest.getType());
List<SysMsgType> sysMsgTypes = sysMsgTypeMapper.selectByExample(sysMsgTypeExample);
List<Long> typeIds = sysMsgTypes.stream().map(SysMsgType::getMsgTypeId).collect(Collectors.toList());
criteria.andTypeIdIn(typeIds);
}*/
if (CollectionUtils.isNotEmpty(typeIds)){
criteria.andTypeIdIn(typeIds);
}
if (ObjectUtils.isNotEmpty(msgRequest.getStatus())) {

View File

@ -26,7 +26,7 @@ import AddExcel from './add/AddExcel'
import AddCustom from './add/AddCustom'
import FieldEdit from './data/FieldEdit'
import { removeClass } from '@/utils'
import bus from '@/utils/bus'
// import bus from '@/utils/bus'
export default {
name: 'DataSet',
components: { DeMainContainer, DeContainer, DeAsideContainer, Group, DataHome, ViewTable, AddDB, AddSQL, AddExcel, AddCustom },
@ -39,9 +39,9 @@ export default {
},
mounted() {
removeClass(document.body, 'showRightPanel')
bus.$on('to-msg-dataset', params => {
this.toMsgShare(params)
})
// bus.$on('to-msg-dataset', params => {
// this.toMsgShare(params)
// })
},
created() {
this.$store.dispatch('app/toggleSideBarHide', true)

View File

@ -36,7 +36,7 @@
</template>
</el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
<el-table-column prop="typeId" sortable="custom" :label="$t('webmsg.type')" width="140">
<template slot-scope="scope">
<span>{{ getTypeName(scope.row.typeId) }}</span>
</template>
@ -101,7 +101,7 @@ export default {
}
if (this.orderConditions.length === 0) {
param.orders = [' status asc ', 'create_time desc ']
param.orders = ['create_time desc ']
} else {
param.orders = formatOrders(this.orderConditions)
}
@ -139,6 +139,9 @@ export default {
if (prop === 'createTime') {
prop = 'create_time'
}
if (prop === 'typeId') {
prop = 'type_id'
}
addOrder({ field: prop, value: order }, this.orderConditions)
this.search()
}

View File

@ -42,7 +42,7 @@
</template>
</el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
<el-table-column prop="typeId" sortable="custom" :label="$t('webmsg.type')" width="140">
<template slot-scope="scope">
<span>{{ getTypeName(scope.row.typeId) }}</span>
</template>
@ -139,6 +139,9 @@ export default {
if (prop === 'readTime') {
prop = 'read_time'
}
if (prop === 'typeId') {
prop = 'type_id'
}
addOrder({ field: prop, value: order }, this.orderConditions)
this.search()
}

View File

@ -45,7 +45,7 @@
</template>
</el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
<el-table-column prop="typeId" sortable="custom" :label="$t('webmsg.type')" width="140">
<template slot-scope="scope">
<span>{{ getTypeName(scope.row.typeId) }}</span>
</template>
@ -168,6 +168,9 @@ export default {
if (prop === 'createTime') {
prop = 'create_time'
}
if (prop === 'typeId') {
prop = 'type_id'
}
addOrder({ field: prop, value: order }, this.orderConditions)
this.search()
}

View File

@ -2,7 +2,7 @@
<el-col>
<el-row style="margin-top: 10px;">
<complex-table :data="data" :columns="columns" local-key="datasetTaskRecord" :search-config="searchConfig" :pagination-config="paginationConfig" @select="select" @search="search" @sort-change="sortChange">
<el-table-column prop="name" :label="$t('dataset.task_name')"/>
<el-table-column prop="name" :label="$t('dataset.task_name')" />
<el-table-column prop="startTime" :label="$t('dataset.start_time')">
<template slot-scope="scope">
<span>{{ scope.row.startTime | timestampFormatDate }}</span>
@ -49,14 +49,13 @@ import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { post} from '@/api/dataset/dataset'
import { post } from '@/api/dataset/dataset'
import cron from '@/components/cron/cron'
import TableSelector from '@/views/chart/view/TableSelector'
export default {
name: 'TaskRecord',
components: { ComplexTable, LayoutContent, cron, TableSelector},
components: { ComplexTable, LayoutContent, cron, TableSelector },
data() {
return {
header: '',
@ -73,7 +72,7 @@ export default {
quickPlaceholder: this.$t('dataset.task.search_by_name'),
components: [
{ field: 'dataset_table_task.name', label: this.$t('dataset.task.name'), component: 'DeComplexInput' },
{ field: 'dataset_table_task_log.status', label: this.$t('commons.status'), component: 'FuComplexSelect', options: [{ label: this.$t('dataset.completed'), value: 'Completed' }, { label: this.$t('dataset.underway'), value: 'Underway' }, { label: this.$t('dataset.error'), value: 'Error' }], multiple: false}
{ field: 'dataset_table_task_log.status', label: this.$t('commons.status'), component: 'FuComplexSelect', options: [{ label: this.$t('dataset.completed'), value: 'Completed' }, { label: this.$t('dataset.underway'), value: 'Underway' }, { label: this.$t('dataset.error'), value: 'Error' }], multiple: false }
]
},
paginationConfig: {
@ -103,18 +102,30 @@ export default {
error_massage: ''
}
},
computed: {
},
created() {
this.search()
this.timer = setInterval(() => {
this.search(this.last_condition, false)
}, 5000)
},
computed: {
},
beforeDestroy() {
clearInterval(this.timer)
},
methods: {
msg2Current(routerParam) {
const taskId = routerParam.taskId
// console.log(taskId)
const current_condition = {
'dataset_table_task.id': {
field: 'dataset_table_task.id',
operator: 'eq',
value: taskId
}
}
this.search(current_condition)
},
sortChange({ column, prop, order }) {
this.orderConditions = []
if (!order) {

View File

@ -6,8 +6,8 @@
<el-tab-pane :label="$t('dataset.task.list')" name="DatasetTaskList">
<dataset-task-list />
</el-tab-pane>
<el-tab-pane :label="$t('dataset.task.record')" name="TaskRecord">
<task-record />
<el-tab-pane :label="$t('dataset.task.record')" name="TaskRecord">
<task-record ref="task_record" />
</el-tab-pane>
</el-tabs>
</el-row>
@ -18,21 +18,51 @@
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import UnionView from "@/views/dataset/data/UnionView";
import UpdateInfo from "@/views/dataset/data/UpdateInfo";
import DatasetTaskList from "@/views/system/task/DatasetTaskList";
import TaskRecord from "@/views/system/task/TaskRecord";
import TabDataPreview from "@/views/dataset/data/TabDataPreview";
import DatasetTableData from "@/views/dataset/common/DatasetTableData";
import UnionView from '@/views/dataset/data/UnionView'
import UpdateInfo from '@/views/dataset/data/UpdateInfo'
import DatasetTaskList from '@/views/system/task/DatasetTaskList'
import TaskRecord from '@/views/system/task/TaskRecord'
import TabDataPreview from '@/views/dataset/data/TabDataPreview'
import DatasetTableData from '@/views/dataset/common/DatasetTableData'
import bus from '@/utils/bus'
export default {
components: {DatasetTableData, LayoutContent, ComplexTable,UnionView, UpdateInfo, TabDataPreview, DatasetTaskList, TaskRecord},
components: { DatasetTableData, LayoutContent, ComplexTable, UnionView, UpdateInfo, TabDataPreview, DatasetTaskList, TaskRecord },
data() {
return {
tabActive: 'DatasetTaskList',
tabActive: 'DatasetTaskList'
}
},
mounted() {
bus.$on('to-msg-dataset', params => {
this.toMsgShare(params)
})
},
created() {
const routerParam = this.$router.currentRoute.params
this.toMsgShare(routerParam)
},
methods: {
toMsgShare(routerParam) {
if (routerParam !== null && routerParam.msgNotification) {
const panelShareTypeIds = [4, 5, 6]
//
if (panelShareTypeIds.includes(routerParam.msgType)) { //
if (routerParam.sourceParam) {
try {
const msgParam = JSON.parse(routerParam.sourceParam)
this.param = msgParam.tableId
this.tabActive = 'TaskRecord'
this.$nextTick(() => {
this.$refs.task_record && this.$refs.task_record.msg2Current && this.$refs.task_record.msg2Current(routerParam.sourceParam)
})
} catch (error) {
console.error(error)
}
}
}
}
}
}
}