forked from github/dataease
Merge branch 'dev' into pr@dev_dataset_source
This commit is contained in:
commit
3c00869a82
@ -166,17 +166,17 @@ public class ChartViewController {
|
||||
|
||||
@ApiIgnore
|
||||
@ApiOperation("获取字段值")
|
||||
@PostMapping("/getFieldData/{id}/{panelId}/{fieldId}")
|
||||
public List<String> getFieldData(@PathVariable String id, @PathVariable String panelId, @PathVariable String fieldId,
|
||||
@PostMapping("/getFieldData/{id}/{panelId}/{fieldId}/{fieldType}")
|
||||
public List<String> getFieldData(@PathVariable String id, @PathVariable String panelId, @PathVariable String fieldId, @PathVariable String fieldType,
|
||||
@RequestBody ChartExtRequest requestList) throws Exception {
|
||||
return chartViewService.getFieldData(id, requestList, false, fieldId);
|
||||
return chartViewService.getFieldData(id, requestList, false, fieldId, fieldType);
|
||||
}
|
||||
|
||||
@ApiIgnore
|
||||
@ApiOperation("更新视图属性")
|
||||
@PostMapping("/viewPropsSave/{panelId}")
|
||||
public void viewPropsSave(@PathVariable String panelId, @RequestBody ChartViewWithBLOBs chartViewWithBLOBs) {
|
||||
chartViewService.viewPropsSave(chartViewWithBLOBs);
|
||||
public void viewPropsSave(@PathVariable String panelId, @RequestBody ChartViewWithBLOBs chartViewWithBLOBs) {
|
||||
chartViewService.viewPropsSave(chartViewWithBLOBs);
|
||||
}
|
||||
|
||||
@ApiOperation("查询仪表板下视图选项")
|
||||
|
@ -3,6 +3,7 @@ package io.dataease.controller.sys;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.plugins.common.base.domain.SysMsgChannel;
|
||||
import io.dataease.plugins.common.base.domain.SysMsgSetting;
|
||||
import io.dataease.plugins.common.base.domain.SysMsgType;
|
||||
@ -19,9 +20,11 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
||||
@ -34,17 +37,20 @@ public class MsgController {
|
||||
@Resource
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
@Resource
|
||||
private AuthUserService authUserService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(paramType="path", name = "goPage", value = "页码", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(paramType="path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "msgRequest", value = "查询条件", required = true)
|
||||
@ApiImplicitParam(paramType = "path", name = "goPage", value = "页码", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "msgRequest", value = "查询条件", required = true)
|
||||
})
|
||||
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())){
|
||||
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());
|
||||
}
|
||||
@ -56,9 +62,10 @@ public class MsgController {
|
||||
|
||||
@ApiOperation("查询未读数量")
|
||||
@PostMapping("/unReadCount")
|
||||
public Long unReadCount() {;
|
||||
public Long unReadCount() {
|
||||
;
|
||||
Long userId = null;
|
||||
if(null == AuthUtils.getUser() || (userId = AuthUtils.getUser().getUserId()) == null) {
|
||||
if (null == AuthUtils.getUser() || (userId = AuthUtils.getUser().getUserId()) == null) {
|
||||
throw new RuntimeException("缺少用户ID");
|
||||
}
|
||||
return sysMsgService.queryCount(userId);
|
||||
@ -66,7 +73,7 @@ public class MsgController {
|
||||
|
||||
@ApiOperation("设置已读")
|
||||
@PostMapping("/setReaded/{msgId}")
|
||||
@ApiImplicitParam(paramType="path", name = "msgId", value = "消息ID", required = true, dataType = "Long")
|
||||
@ApiImplicitParam(paramType = "path", name = "msgId", value = "消息ID", required = true, dataType = "Long")
|
||||
public void setReaded(@PathVariable Long msgId) {
|
||||
sysMsgService.setReaded(msgId);
|
||||
}
|
||||
@ -109,7 +116,21 @@ public class MsgController {
|
||||
@ApiOperation("查询渠道")
|
||||
@PostMapping("/channelList")
|
||||
public List<SysMsgChannel> channelList() {
|
||||
return sysMsgService.channelList();
|
||||
List<SysMsgChannel> sysMsgChannels = sysMsgService.channelList();
|
||||
if (ObjectUtils.isEmpty(sysMsgChannels)) return sysMsgChannels;
|
||||
return sysMsgChannels.stream().filter(channel -> {
|
||||
Long msgChannelId = channel.getMsgChannelId();
|
||||
if (msgChannelId == 3L) {
|
||||
return authUserService.supportWecom();
|
||||
}
|
||||
if (msgChannelId == 4L) {
|
||||
return authUserService.supportDingtalk();
|
||||
}
|
||||
if (msgChannelId == 5L) {
|
||||
return authUserService.supportLark();
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@ApiOperation("查询订阅")
|
||||
|
@ -29,6 +29,7 @@ import io.dataease.plugins.xpack.wecom.dto.entity.WecomMsgResult;
|
||||
import io.dataease.plugins.xpack.wecom.service.WecomXpackService;
|
||||
import io.dataease.service.chart.ViewExportExcel;
|
||||
import io.dataease.service.system.EmailService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.quartz.*;
|
||||
@ -152,6 +153,7 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
public void sendReport(GlobalTaskInstance taskInstance, XpackEmailTemplateDTO emailTemplateDTO, SysUserEntity user) {
|
||||
|
||||
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
|
||||
AuthUserServiceImpl userService = SpringContextUtil.getBean(AuthUserServiceImpl.class);
|
||||
try {
|
||||
XpackEmailTaskRequest taskForm = emailXpackService.taskForm(taskInstance.getTaskId());
|
||||
if (ObjectUtils.isEmpty(taskForm) || CronUtils.taskExpire(taskForm.getEndTime())) {
|
||||
@ -168,6 +170,21 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
LogUtil.info("picture of " + url + " is finished");
|
||||
// 下面继续执行发送邮件的
|
||||
String recipients = emailTemplateDTO.getRecipients();
|
||||
String reciUsers = emailTemplateDTO.getReciUsers();
|
||||
List<String> reciLists = null;
|
||||
if (StringUtils.isNotBlank(reciUsers)) {
|
||||
String emailUsers = Arrays.stream(reciUsers.split(",")).map(userService::getUserByName).filter(tempUser -> StringUtils.isNotBlank(tempUser.getEmail())).map(SysUserEntity::getEmail).collect(Collectors.joining(","));
|
||||
if (StringUtils.isNotBlank(emailUsers)) {
|
||||
if (StringUtils.isNotBlank(recipients)) {
|
||||
recipients += "," + emailUsers;
|
||||
} else {
|
||||
recipients = emailUsers;
|
||||
}
|
||||
}
|
||||
reciLists = Arrays.stream(reciUsers.split(",")).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
byte[] content = emailTemplateDTO.getContent();
|
||||
EmailService emailService = SpringContextUtil.getBean(EmailService.class);
|
||||
|
||||
@ -194,38 +211,61 @@ public class EmailTaskHandler extends TaskHandler implements Job {
|
||||
channels = Arrays.stream(recisetting.split(",")).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<String> reciLists = Arrays.stream(recipients.split(",")).collect(Collectors.toList());
|
||||
|
||||
for (int i = 0; i < channels.size(); i++) {
|
||||
String channel = channels.get(i);
|
||||
switch (channel) {
|
||||
case "email" :
|
||||
if (StringUtils.isNotBlank(recipients))
|
||||
emailService.sendWithImageAndFiles(recipients, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
break;
|
||||
case "wecom" :
|
||||
if (SpringContextUtil.getBean(AuthUserService.class).supportWecom()) {
|
||||
WecomXpackService wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
|
||||
WecomMsgResult wecomMsgResult = wecomXpackService.pushOaMsg(reciLists, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
if (wecomMsgResult.getErrcode() != 0) {
|
||||
DEException.throwException(wecomMsgResult.getErrmsg());
|
||||
|
||||
List<String> wecomUsers = reciLists.stream().filter(reci -> {
|
||||
SysUserEntity userBySub = userService.getUserBySub(reci, 4);
|
||||
return ObjectUtils.isNotEmpty(userBySub);
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(wecomUsers)) {
|
||||
WecomXpackService wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
|
||||
WecomMsgResult wecomMsgResult = wecomXpackService.pushOaMsg(wecomUsers, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
if (wecomMsgResult.getErrcode() != 0) {
|
||||
DEException.throwException(wecomMsgResult.getErrmsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case "dingtalk" :
|
||||
if (SpringContextUtil.getBean(AuthUserService.class).supportDingtalk()) {
|
||||
DingtalkXpackService dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
|
||||
DingtalkMsgResult dingtalkMsgResult = dingtalkXpackService.pushOaMsg(reciLists, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
if (dingtalkMsgResult.getErrcode() != 0) {
|
||||
DEException.throwException(dingtalkMsgResult.getErrmsg());
|
||||
List<String> dingTalkUsers = reciLists.stream().filter(reci -> {
|
||||
SysUserEntity userBySub = userService.getUserBySub(reci, 5);
|
||||
return ObjectUtils.isNotEmpty(userBySub);
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(dingTalkUsers)) {
|
||||
DingtalkXpackService dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
|
||||
DingtalkMsgResult dingtalkMsgResult = dingtalkXpackService.pushOaMsg(dingTalkUsers, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
if (dingtalkMsgResult.getErrcode() != 0) {
|
||||
DEException.throwException(dingtalkMsgResult.getErrmsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case "lark" :
|
||||
if (SpringContextUtil.getBean(AuthUserService.class).supportLark()) {
|
||||
LarkXpackService larkXpackService = SpringContextUtil.getBean(LarkXpackService.class);
|
||||
LarkMsgResult larkMsgResult = larkXpackService.pushOaMsg(reciLists, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
if (larkMsgResult.getCode() != 0) {
|
||||
DEException.throwException(larkMsgResult.getMsg());
|
||||
List<String> larkUsers = reciLists.stream().filter(reci -> {
|
||||
SysUserEntity userBySub = userService.getUserBySub(reci, 6);
|
||||
return ObjectUtils.isNotEmpty(userBySub);
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(larkUsers)) {
|
||||
LarkXpackService larkXpackService = SpringContextUtil.getBean(LarkXpackService.class);
|
||||
LarkMsgResult larkMsgResult = larkXpackService.pushOaMsg(larkUsers, emailTemplateDTO.getTitle(), contentStr, bytes, files);
|
||||
if (larkMsgResult.getCode() != 0) {
|
||||
DEException.throwException(larkMsgResult.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -48,6 +48,7 @@ public class XDingtalkServer {
|
||||
DingtalkXpackService dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
|
||||
return dingtalkXpackService.info();
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequiresPermissions("sysparam:read")
|
||||
@PostMapping("/save")
|
||||
@ -55,16 +56,18 @@ public class XDingtalkServer {
|
||||
DingtalkXpackService dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
|
||||
dingtalkXpackService.save(settings);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/testConn")
|
||||
public void testConn(@RequestBody DingtalkInfo dingtalkInfo) {
|
||||
DingtalkXpackService dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
|
||||
try {
|
||||
dingtalkXpackService.testConn(dingtalkInfo);
|
||||
}catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/getQrParam")
|
||||
public DingQrResult getQrParam() {
|
||||
@ -92,7 +95,7 @@ public class XDingtalkServer {
|
||||
String unionid = dingUserEntity.getUnionid();
|
||||
SysUserEntity sysUserEntity = authUserService.getUserBySub(unionid, 5);
|
||||
if (null == sysUserEntity) {
|
||||
String email = StringUtils.isNotBlank(dingUserEntity.getOrg_email()) ? dingUserEntity.getOrg_email() : StringUtils.isNotBlank(dingUserEntity.getEmail()) ? dingUserEntity.getEmail() : "demo@dingtalk.work";
|
||||
String email = StringUtils.isNotBlank(dingUserEntity.getOrg_email()) ? dingUserEntity.getOrg_email() : StringUtils.isNotBlank(dingUserEntity.getEmail()) ? dingUserEntity.getEmail() : (username + "@dingtalk.work");
|
||||
sysUserService.validateExistUser(username, dingUserEntity.getName(), email);
|
||||
sysUserService.saveDingtalkCUser(dingUserEntity, email);
|
||||
sysUserEntity = authUserService.getUserBySub(unionid, 5);
|
||||
|
@ -96,7 +96,7 @@ public class XLarkServer {
|
||||
String sub = larkUserInfo.getSub();
|
||||
SysUserEntity sysUserEntity = authUserService.getUserBySub(sub, 6);
|
||||
if (null == sysUserEntity) {
|
||||
String email = StringUtils.isNotBlank(larkUserInfo.getEmail()) ? larkUserInfo.getEmail() : "demo@lark.work";
|
||||
String email = StringUtils.isNotBlank(larkUserInfo.getEmail()) ? larkUserInfo.getEmail() : (username + "@lark.work");
|
||||
sysUserService.validateExistUser(username, larkUserInfo.getName(), email);
|
||||
sysUserService.saveLarkCUser(larkUserInfo, email);
|
||||
sysUserEntity = authUserService.getUserBySub(sub, 6);
|
||||
|
@ -49,6 +49,7 @@ public class XWecomServer {
|
||||
WecomXpackService wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
|
||||
return wecomXpackService.info();
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequiresPermissions("sysparam:read")
|
||||
@PostMapping("/save")
|
||||
@ -56,16 +57,18 @@ public class XWecomServer {
|
||||
WecomXpackService wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
|
||||
wecomXpackService.save(settings);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/testConn")
|
||||
public void testConn(@RequestBody WecomInfo wecomInfo) {
|
||||
WecomXpackService wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
|
||||
try {
|
||||
wecomXpackService.testConn(wecomInfo);
|
||||
}catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/getQrParam")
|
||||
public BaseQrResult getQrParam() {
|
||||
@ -96,7 +99,7 @@ public class XWecomServer {
|
||||
SysUserEntity sysUserEntity = authUserService.getUserBySub(userId, 4);
|
||||
if (null == sysUserEntity) {
|
||||
Object emailObj = ObjectUtils.isEmpty(userMap.get("biz_mail")) ? userMap.get("email") : userMap.get("biz_mail");
|
||||
String email = ObjectUtils.isEmpty(emailObj) ? "demo@wecom.work" : emailObj.toString();
|
||||
String email = ObjectUtils.isEmpty(emailObj) ? (userId + "@wecom.work") : emailObj.toString();
|
||||
sysUserService.validateExistUser(userId, userMap.get("name").toString(), email);
|
||||
sysUserService.saveWecomCUser(userMap, userId, email);
|
||||
sysUserEntity = authUserService.getUserBySub(userId, 4);
|
||||
|
@ -966,7 +966,14 @@ public class ChartViewService {
|
||||
}
|
||||
}
|
||||
// 自定义排序
|
||||
data = resultCustomSort(xAxis, data);
|
||||
if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
List<ChartViewFieldDTO> list = new ArrayList<>();
|
||||
list.addAll(xAxis);
|
||||
list.addAll(extStack);
|
||||
data = resultCustomSort(list, data);
|
||||
} else {
|
||||
data = resultCustomSort(xAxis, data);
|
||||
}
|
||||
// 同比/环比计算,通过对比类型和数据设置,计算出对应指标的结果,然后替换结果data数组中的对应元素
|
||||
// 如果因维度变化(如时间字段缺失,时间字段的展示格式变化)导致无法计算结果的,则结果data数组中的对应元素全置为null
|
||||
// 根据不同图表类型,获得需要替换的指标index array
|
||||
@ -1485,21 +1492,27 @@ public class ChartViewService {
|
||||
extChartViewMapper.initPanelChartViewCache(panelId);
|
||||
}
|
||||
|
||||
public List<String> getFieldData(String id, ChartExtRequest requestList, boolean cache, String fieldId) throws Exception {
|
||||
public List<String> getFieldData(String id, ChartExtRequest requestList, boolean cache, String fieldId, String fieldType) throws Exception {
|
||||
ChartViewDTO view = getOne(id, requestList.getQueryFrom());
|
||||
List<String[]> sqlData = sqlData(view, requestList, cache, fieldId);
|
||||
List<ChartViewFieldDTO> xAxis = gson.fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
List<ChartViewFieldDTO> fieldList = new ArrayList<>();
|
||||
if (StringUtils.equalsIgnoreCase(fieldType, "xAxis")) {
|
||||
fieldList = gson.fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
} else if (StringUtils.equalsIgnoreCase(fieldType, "extStack")) {
|
||||
fieldList = gson.fromJson(view.getExtStack(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
}.getType());
|
||||
}
|
||||
DatasetTableField field = dataSetTableFieldsService.get(fieldId);
|
||||
|
||||
List<String> res = new ArrayList<>();
|
||||
if (ObjectUtils.isNotEmpty(field) && xAxis.size() > 0) {
|
||||
if (ObjectUtils.isNotEmpty(field) && fieldList.size() > 0) {
|
||||
// 找到对应维度
|
||||
ChartViewFieldDTO chartViewFieldDTO = null;
|
||||
int index = 0;
|
||||
int getIndex = 0;
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO item = xAxis.get(i);
|
||||
for (int i = 0; i < fieldList.size(); i++) {
|
||||
ChartViewFieldDTO item = fieldList.get(i);
|
||||
if (StringUtils.equalsIgnoreCase(item.getSort(), "custom_sort")) {// 此处与已有的自定义字段对比
|
||||
chartViewFieldDTO = item;
|
||||
index = i;
|
||||
@ -1508,7 +1521,7 @@ public class ChartViewService {
|
||||
getIndex = i;
|
||||
}
|
||||
}
|
||||
List<String[]> sortResult = resultCustomSort(xAxis, sqlData);
|
||||
List<String[]> sortResult = resultCustomSort(fieldList, sqlData);
|
||||
if (ObjectUtils.isNotEmpty(chartViewFieldDTO) && (getIndex >= index)) {
|
||||
// 获取自定义值与data对应列的结果
|
||||
List<String[]> strings = customSort(Optional.ofNullable(chartViewFieldDTO.getCustomSort()).orElse(new ArrayList<>()), sortResult, index);
|
||||
|
@ -64,3 +64,7 @@ ALTER TABLE `sys_task_email`
|
||||
ADD COLUMN `recisetting` varchar(255) NULL COMMENT '消息渠道' AFTER `view_ids`,
|
||||
ADD COLUMN `conditions` longtext NULL COMMENT '仪表板条件' AFTER `recisetting`;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE `sys_task_email`
|
||||
ADD COLUMN `reci_users` varchar(255) NULL COMMENT '接收人账号' AFTER `conditions`;
|
@ -33,6 +33,10 @@ export default {
|
||||
field: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
fieldType: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -55,7 +59,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
post('/chart/view/getFieldData/' + this.chart.id + '/' + this.panelInfo.id + '/' + this.field.id, {}).then(response => {
|
||||
post('/chart/view/getFieldData/' + this.chart.id + '/' + this.panelInfo.id + '/' + this.field.id + '/' + this.fieldType, {}).then(response => {
|
||||
this.sortList = response.data
|
||||
})
|
||||
},
|
||||
|
@ -94,6 +94,7 @@
|
||||
<el-dropdown-item :command="beforeSort('none')">{{ $t('chart.none') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeSort('asc')">{{ $t('chart.asc') }}</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeSort('desc')">{{ $t('chart.desc') }}</el-dropdown-item>
|
||||
<el-dropdown-item v-show="!item.chartId && (item.deType === 0 || item.deType === 5)" :command="beforeSort('custom_sort')">{{ $t('chart.custom_sort') }}...</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-dropdown-item>
|
||||
@ -181,8 +182,18 @@ export default {
|
||||
}
|
||||
},
|
||||
sort(param) {
|
||||
this.item.sort = param.type
|
||||
this.$emit('onItemChange', this.item)
|
||||
if (param.type === 'custom_sort') {
|
||||
const item = {
|
||||
index: this.index,
|
||||
sort: param.type
|
||||
}
|
||||
this.$emit('onItemCustomSort', item)
|
||||
} else {
|
||||
this.item.index = this.index
|
||||
this.item.sort = param.type
|
||||
this.item.customSort = []
|
||||
this.$emit('onItemChange', this.item)
|
||||
}
|
||||
},
|
||||
beforeSort(type) {
|
||||
return {
|
||||
|
@ -603,6 +603,7 @@
|
||||
:quota-data="quota"
|
||||
@onItemChange="stackItemChange"
|
||||
@onItemRemove="stackItemRemove"
|
||||
@onItemCustomSort="stackItemCustomSort"
|
||||
/>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
@ -1074,7 +1075,7 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!--自定义排序-->
|
||||
<!--xAxis自定义排序-->
|
||||
<el-dialog
|
||||
v-if="showCustomSort"
|
||||
v-dialogDrag
|
||||
@ -1084,13 +1085,30 @@
|
||||
width="500px"
|
||||
class="dialog-css"
|
||||
>
|
||||
<custom-sort-edit :chart="chart" :field="customSortField" @onSortChange="customSortChange" />
|
||||
<custom-sort-edit :chart="chart" field-type="xAxis" :field="customSortField" @onSortChange="customSortChange" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeCustomSort">{{ $t('chart.cancel') }}</el-button>
|
||||
<el-button type="primary" size="mini" @click="saveCustomSort">{{ $t('chart.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!--extStack自定义排序-->
|
||||
<el-dialog
|
||||
v-if="showStackCustomSort"
|
||||
v-dialogDrag
|
||||
:title="$t('chart.custom_sort')"
|
||||
:visible="showStackCustomSort"
|
||||
:show-close="false"
|
||||
width="500px"
|
||||
class="dialog-css"
|
||||
>
|
||||
<custom-sort-edit :chart="chart" field-type="extStack" :field="customSortField" @onSortChange="customSortChange" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeStackCustomSort">{{ $t('chart.cancel') }}</el-button>
|
||||
<el-button type="primary" size="mini" @click="saveStackCustomSort">{{ $t('chart.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!--视图计算字段弹框-->
|
||||
<el-dialog
|
||||
v-if="editChartCalcField"
|
||||
@ -1332,7 +1350,8 @@ export default {
|
||||
editChartCalcField: false,
|
||||
fieldShow: false,
|
||||
tabActive: 'data',
|
||||
currentAreaCode: ''
|
||||
currentAreaCode: '',
|
||||
showStackCustomSort: false
|
||||
|
||||
}
|
||||
},
|
||||
@ -1573,9 +1592,7 @@ export default {
|
||||
this.view.resultCount = '1000'
|
||||
}
|
||||
if (switchType) {
|
||||
this.view.senior.threshold = {
|
||||
tableThreshold: []
|
||||
}
|
||||
this.view.senior.threshold = {}
|
||||
}
|
||||
if (switchType && (this.view.type === 'table-info' || this.chart.type === 'table-info') && this.view.xaxis.length > 0) {
|
||||
this.$message({
|
||||
@ -2440,6 +2457,11 @@ export default {
|
||||
this.view.extStack.splice(item.index, 1)
|
||||
this.calcData(true)
|
||||
},
|
||||
stackItemCustomSort(item) {
|
||||
this.customSortField = this.view.extStack[item.index]
|
||||
this.stackCustomSort()
|
||||
},
|
||||
|
||||
drillItemChange(item) {
|
||||
this.calcData(true)
|
||||
},
|
||||
@ -2692,11 +2714,6 @@ export default {
|
||||
},
|
||||
saveCustomSort() {
|
||||
this.view.xaxis.forEach(ele => {
|
||||
// 先将所有自定义排序的维度设置为none,再对当前维度赋值
|
||||
// if (ele.sort === 'custom_sort') {
|
||||
// ele.sort = 'none'
|
||||
// ele.customSort = []
|
||||
// }
|
||||
if (ele.id === this.customSortField.id) {
|
||||
ele.sort = 'custom_sort'
|
||||
ele.customSort = this.customSortList
|
||||
@ -2706,6 +2723,23 @@ export default {
|
||||
this.calcData(true)
|
||||
},
|
||||
|
||||
stackCustomSort() {
|
||||
this.showStackCustomSort = true
|
||||
},
|
||||
closeStackCustomSort() {
|
||||
this.showStackCustomSort = false
|
||||
},
|
||||
saveStackCustomSort() {
|
||||
this.view.extStack.forEach(ele => {
|
||||
if (ele.id === this.customSortField.id) {
|
||||
ele.sort = 'custom_sort'
|
||||
ele.customSort = this.customSortList
|
||||
}
|
||||
})
|
||||
this.closeStackCustomSort()
|
||||
this.calcData(true)
|
||||
},
|
||||
|
||||
fieldEdit(param) {
|
||||
switch (param.type) {
|
||||
case 'ds':
|
||||
|
Loading…
Reference in New Issue
Block a user