perf: 公共链接ticket机制页面优化

This commit is contained in:
fit2cloud-chenyw 2024-03-22 17:16:02 +08:00
parent 07640c4bf7
commit 760b4cf812
19 changed files with 469 additions and 73 deletions

View File

@ -71,6 +71,10 @@ public class IndexController {
if (StringUtils.isNotEmpty(fromLink)) { if (StringUtils.isNotEmpty(fromLink)) {
url = url + "&fromLink=" + fromLink; url = url + "&fromLink=" + fromLink;
} }
String ticket = request.getParameter("ticket");
if (StringUtils.isNotEmpty(ticket)) {
url = url + "&ticket=" + ticket;
}
response.sendRedirect(url); response.sendRedirect(url);
} catch (IOException e) { } catch (IOException e) {
LogUtil.error(e.getMessage()); LogUtil.error(e.getMessage());

View File

@ -84,4 +84,8 @@ public interface LinkApi {
@ApiOperation("删除ticket") @ApiOperation("删除ticket")
@PostMapping("/delTicket") @PostMapping("/delTicket")
void deleteTicket(@RequestBody TicketDelRequest request); void deleteTicket(@RequestBody TicketDelRequest request);
@ApiOperation("切换是否必填ticket")
@PostMapping("/enableTicket")
void switchRequire(@RequestBody TicketSwitchRequest request);
} }

View File

@ -9,9 +9,11 @@ import io.dataease.controller.panel.api.LinkApi;
import io.dataease.controller.request.chart.ChartExtRequest; import io.dataease.controller.request.chart.ChartExtRequest;
import io.dataease.controller.request.panel.link.*; import io.dataease.controller.request.panel.link.*;
import io.dataease.dto.panel.link.GenerateDto; import io.dataease.dto.panel.link.GenerateDto;
import io.dataease.dto.panel.link.TicketDto;
import io.dataease.dto.panel.link.ValidateDto; import io.dataease.dto.panel.link.ValidateDto;
import io.dataease.plugins.common.base.domain.PanelGroupWithBLOBs; import io.dataease.plugins.common.base.domain.PanelGroupWithBLOBs;
import io.dataease.plugins.common.base.domain.PanelLink; import io.dataease.plugins.common.base.domain.PanelLink;
import io.dataease.plugins.common.base.domain.PanelLinkMapping;
import io.dataease.plugins.common.base.domain.PanelLinkTicket; import io.dataease.plugins.common.base.domain.PanelLinkTicket;
import io.dataease.service.chart.ChartViewService; import io.dataease.service.chart.ChartViewService;
import io.dataease.service.panel.PanelLinkService; import io.dataease.service.panel.PanelLinkService;
@ -95,7 +97,8 @@ public class LinkServer implements LinkApi {
dto.setValid(false); dto.setValid(false);
return dto; return dto;
} }
String mappingUuid = panelLinkService.getMappingUuid(one); PanelLinkMapping mapping = panelLinkService.getMapping(one);
String mappingUuid = mapping.getUuid();
if (!StringUtils.equals(uuid, mappingUuid)) { if (!StringUtils.equals(uuid, mappingUuid)) {
dto.setValid(false); dto.setValid(false);
return dto; return dto;
@ -104,6 +107,10 @@ public class LinkServer implements LinkApi {
dto.setEnablePwd(one.getEnablePwd()); dto.setEnablePwd(one.getEnablePwd());
dto.setPassPwd(panelLinkService.validateHeads(one)); dto.setPassPwd(panelLinkService.validateHeads(one));
dto.setExpire(panelLinkService.isExpire(one)); dto.setExpire(panelLinkService.isExpire(one));
String ticketText = request.getTicket();
TicketDto ticketDto = panelLinkService.validateTicket(ticketText, mapping);
dto.setTicket(ticketDto);
return dto; return dto;
} }
@ -158,4 +165,9 @@ public class LinkServer implements LinkApi {
public void deleteTicket(TicketDelRequest request) { public void deleteTicket(TicketDelRequest request) {
panelLinkService.deleteTicket(request); panelLinkService.deleteTicket(request);
} }
@Override
public void switchRequire(TicketSwitchRequest request) {
panelLinkService.switchRequire(request);
}
} }

View File

@ -9,4 +9,5 @@ public class LinkValidateRequest implements Serializable {
private String link; private String link;
private String user; private String user;
private String ticket;
} }

View File

@ -0,0 +1,13 @@
package io.dataease.controller.request.panel.link;
import lombok.Data;
import java.io.Serializable;
@Data
public class TicketSwitchRequest implements Serializable {
private String resourceId;
private Boolean require = false;
}

View File

@ -0,0 +1,15 @@
package io.dataease.dto.panel.link;
import lombok.Data;
import java.io.Serializable;
@Data
public class TicketDto implements Serializable {
private boolean ticketValid;
private boolean ticketExp;
private String args;
}

View File

@ -19,4 +19,6 @@ public class ValidateDto {
private String resourceId; private String resourceId;
@ApiModelProperty("用户ID") @ApiModelProperty("用户ID")
private String userId; private String userId;
private TicketDto ticket;
} }

View File

@ -11,6 +11,7 @@ import io.dataease.commons.utils.ServletUtils;
import io.dataease.controller.request.panel.link.*; import io.dataease.controller.request.panel.link.*;
import io.dataease.dto.panel.PanelGroupDTO; import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.dto.panel.link.GenerateDto; import io.dataease.dto.panel.link.GenerateDto;
import io.dataease.dto.panel.link.TicketDto;
import io.dataease.ext.ExtPanelGroupMapper; import io.dataease.ext.ExtPanelGroupMapper;
import io.dataease.ext.ExtPanelLinkMapper; import io.dataease.ext.ExtPanelLinkMapper;
import io.dataease.plugins.common.base.domain.*; import io.dataease.plugins.common.base.domain.*;
@ -128,13 +129,13 @@ public class PanelLinkService {
} }
} }
public String getMappingUuid(PanelLink link) { public PanelLinkMapping getMapping(PanelLink link) {
String resourceId = link.getResourceId(); String resourceId = link.getResourceId();
Long userId = link.getUserId(); Long userId = link.getUserId();
PanelLinkMappingExample example = new PanelLinkMappingExample(); PanelLinkMappingExample example = new PanelLinkMappingExample();
example.createCriteria().andResourceIdEqualTo(resourceId).andUserIdEqualTo(userId); example.createCriteria().andResourceIdEqualTo(resourceId).andUserIdEqualTo(userId);
List<PanelLinkMapping> mappings = panelLinkMappingMapper.selectByExample(example); List<PanelLinkMapping> mappings = panelLinkMappingMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(mappings)) return mappings.get(0).getUuid(); if (CollectionUtils.isNotEmpty(mappings)) return mappings.get(0);
return null; return null;
} }
@ -291,8 +292,12 @@ public class PanelLinkService {
PanelLinkTicketExample example = new PanelLinkTicketExample(); PanelLinkTicketExample example = new PanelLinkTicketExample();
example.createCriteria().andTicketEqualTo(ticket); example.createCriteria().andTicketEqualTo(ticket);
if (creator.isGenerateNew()) { if (creator.isGenerateNew()) {
ticketEntity.setAccessTime(null);
ticketEntity.setTicket(CodingUtil.shortUuid()); ticketEntity.setTicket(CodingUtil.shortUuid());
} }
ticketEntity.setArgs(creator.getArgs());
ticketEntity.setExp(creator.getExp());
ticketEntity.setUuid(creator.getUuid());
panelLinkTicketMapper.updateByExample(ticketEntity, example); panelLinkTicketMapper.updateByExample(ticketEntity, example);
return ticketEntity.getTicket(); return ticketEntity.getTicket();
} }
@ -317,7 +322,15 @@ public class PanelLinkService {
panelLinkTicketMapper.deleteByExample(example); panelLinkTicketMapper.deleteByExample(example);
} }
public void switchRequire(TicketSwitchRequest request) {
String resourceId = request.getResourceId();
Boolean require = request.getRequire();
PanelLinkMappingExample example = new PanelLinkMappingExample();
example.createCriteria().andResourceIdEqualTo(resourceId).andUserIdEqualTo(AuthUtils.getUser().getUserId());
PanelLinkMapping mapping = new PanelLinkMapping();
mapping.setRequireTicket(require);
panelLinkMappingMapper.updateByExampleSelective(mapping, example);
}
public PanelLinkTicket getByTicket(String ticket) { public PanelLinkTicket getByTicket(String ticket) {
PanelLinkTicketExample example = new PanelLinkTicketExample(); PanelLinkTicketExample example = new PanelLinkTicketExample();
@ -354,4 +367,37 @@ public class PanelLinkService {
PanelLink one = findOne(resourceId, userId); PanelLink one = findOne(resourceId, userId);
return convertDto(one, uuid, mapping.getRequireTicket()).getUri(); return convertDto(one, uuid, mapping.getRequireTicket()).getUri();
} }
public TicketDto validateTicket(String ticket, PanelLinkMapping mapping) {
String uuid = mapping.getUuid();
TicketDto ticketDto = new TicketDto();
if (StringUtils.isBlank(ticket)) {
ticketDto.setTicketValid(!mapping.getRequireTicket());
return ticketDto;
}
PanelLinkTicketExample example = new PanelLinkTicketExample();
example.createCriteria().andTicketEqualTo(ticket).andUuidEqualTo(uuid);
List<PanelLinkTicket> tickets = panelLinkTicketMapper.selectByExample(example);
if (CollectionUtils.isEmpty(tickets)) {
ticketDto.setTicketValid(false);
return ticketDto;
}
PanelLinkTicket linkTicket = tickets.get(0);
ticketDto.setTicketValid(true);
ticketDto.setArgs(linkTicket.getArgs());
Long accessTime = linkTicket.getAccessTime();
long now = System.currentTimeMillis();
if (ObjectUtils.isEmpty(accessTime)) {
accessTime = now;
ticketDto.setTicketExp(false);
linkTicket.setAccessTime(accessTime);
panelLinkTicketMapper.updateByPrimaryKey(linkTicket);
return ticketDto;
}
Long exp = linkTicket.getExp();
long expTime = exp * 60L * 1000L;
long time = now - accessTime;
ticketDto.setTicketExp(time > expTime);
return ticketDto;
}
} }

View File

@ -9,6 +9,7 @@ CREATE TABLE `panel_link_ticket`
`ticket` varchar(255) NOT NULL, `ticket` varchar(255) NOT NULL,
`exp` bigint DEFAULT NULL, `exp` bigint DEFAULT NULL,
`args` varchar(255) DEFAULT NULL, `args` varchar(255) DEFAULT NULL,
`access_time` bigint DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 1; AUTO_INCREMENT = 1;

View File

@ -34,6 +34,7 @@
const terminal = getQueryVariable('terminal') const terminal = getQueryVariable('terminal')
const attachParams = getQueryVariable('attachParams') const attachParams = getQueryVariable('attachParams')
const fromLink = getQueryVariable('fromLink') const fromLink = getQueryVariable('fromLink')
const ticket = getQueryVariable('ticket')
const baseUrl = window.location.pathname.replace('link.html', '') const baseUrl = window.location.pathname.replace('link.html', '')
let url = baseUrl + "#/delink?link=" + encodeURIComponent(link) let url = baseUrl + "#/delink?link=" + encodeURIComponent(link)
if (terminal) { if (terminal) {
@ -48,6 +49,9 @@
if (fromLink) { if (fromLink) {
url += '&fromLink=' + fromLink url += '&fromLink=' + fromLink
} }
if (ticket) {
url += '&ticket=' + ticket
}
window.location.href = url window.location.href = url
</script> </script>

View File

@ -50,6 +50,14 @@ export function switchEnablePwd(data) {
}) })
} }
export function switchEnableTicket(data) {
return request({
url: 'api/link/enableTicket',
method: 'post',
data
})
}
export function viewLinkLog(data) { export function viewLinkLog(data) {
return request({ return request({
url: 'api/link/viewLog', url: 'api/link/viewLog',

View File

@ -127,19 +127,37 @@
class="ticket" class="ticket"
> >
<div class="ticket-model"> <div class="ticket-model">
<el-checkbox v-model="requireTicket" /> <el-checkbox
v-model="requireTicket"
@change="requireTicketChange"
/>
<span>ticket必选</span> <span>ticket必选</span>
<el-tooltip
class="item"
effect="dark"
content="选择后原始公共链接无效必须携带ticket参数"
placement="top"
>
<span class="check-tips"><i class="el-icon-warning" /></span>
</el-tooltip>
</div> </div>
<div <div
class="ticket-table" class="ticket-table"
> >
<div class="add-ticket"> <div class="add-ticket">
<el-tooltip
class="item"
effect="dark"
content="创建"
placement="top"
>
<span> <span>
<i <i
class="el-icon-circle-plus-outline" class="el-icon-circle-plus-outline"
@click="addRow()" @click="addRow()"
/> />
</span> </span>
</el-tooltip>
</div> </div>
<el-table <el-table
:data="tableData" :data="tableData"
@ -149,51 +167,83 @@
<el-table-column <el-table-column
prop="ticket" prop="ticket"
label="ticket" label="ticket"
width="120" width="100"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<div class="ticket-row"> <div class="ticket-row">
<span>{{ scope.row.ticket }}</span> <span>{{ scope.row.ticket }}</span>
<el-tooltip
class="item"
effect="dark"
content="刷新ticket"
placement="top"
>
<span class="refresh-i"> <span class="refresh-i">
<i <i
class="el-icon-refresh" class="el-icon-refresh"
@click="refreshTicket(scope.row)" @click="refreshTicket(scope.row)"
/> />
</span> </span>
</el-tooltip>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="exp" prop="exp"
label="有效期(分钟)" label="有效期"
width="100" width="100"
> >
<template slot="header">
<span>有效期</span>
<el-tooltip
class="item"
effect="dark"
content="单位: 分钟,范围: [0-1440],0代表无期限自首次使用ticket访问开始"
placement="top"
>
<span class="check-tips"><i class="el-icon-warning" /></span>
</el-tooltip>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
:ref="setExpRef(scope.$index)"
v-model="scope.row.exp" v-model="scope.row.exp"
type="number" type="number"
placeholder="请输入内容" placeholder="请输入内容"
min="0"
max="1440"
size="mini" size="mini"
@change="val => validateExp(val, scope.$index)"
/> />
<span v-else> <span v-else>
{{ scope.row.exp }} {{ scope.row.exp }}
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="args">
prop="args" <template slot="header">
label="参数" <span>参数</span>
<el-tooltip
class="item"
effect="dark"
content="最大长度200配合仪表板外部参数使用必须是json格式例如: {&quot;arg1&quot;: &quot;value1&quot;}"
placement="top"
> >
<span class="check-tips"><i class="el-icon-warning" /></span>
</el-tooltip>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.isEdit"
:ref="setArgRef(scope.$index)"
v-model="scope.row.args" v-model="scope.row.args"
type="text" type="text"
placeholder="请输入内容" placeholder="请输入内容"
maxlength="100" maxlength="200"
size="mini" size="mini"
@change="val => validateArgs(val, scope.$index)"
/> />
<span v-else> <span v-else>
{{ scope.row.args }} {{ scope.row.args }}
@ -206,12 +256,25 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<div class="ticket-op"> <div class="ticket-op">
<el-tooltip
class="item"
effect="dark"
content="删除"
placement="top"
>
<span> <span>
<i <i
class="el-icon-delete" class="el-icon-delete"
@click="deleteTicket(scope.row, scope.$idnex)" @click="deleteTicket(scope.row, scope.$idnex)"
/> />
</span> </span>
</el-tooltip>
<el-tooltip
class="item"
effect="dark"
:content="scope.row.isEdit ? '保存' : '编辑'"
placement="top"
>
<span> <span>
<i <i
v-if="!scope.row.isEdit" v-if="!scope.row.isEdit"
@ -221,9 +284,10 @@
<i <i
v-else v-else
class="el-icon-circle-check" class="el-icon-circle-check"
@click="saveRow(scope.row)" @click="saveRow(scope.row, scope.$index)"
/> />
</span> </span>
</el-tooltip>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -241,6 +305,7 @@ import {
setPwd, setPwd,
switchValid, switchValid,
switchEnablePwd, switchEnablePwd,
switchEnableTicket,
shortUrl, shortUrl,
setOverTime setOverTime
} from '@/api/link' } from '@/api/link'
@ -326,13 +391,70 @@ export default {
this.currentGenerate() this.currentGenerate()
}, },
methods: { methods: {
setExpRef(index) {
return `expRef-${index}`
},
setArgRef(index) {
return `argRef-${index}`
},
validateExp(val, index) {
const refName = this.setExpRef(index)
const e = this.$refs[refName].$refs.input
if (val === null || val === '' || typeof val === 'undefined') {
this.tableData[index]['exp'] = 0
return true
}
if (val > 1440 || val < 0) {
e.style.color = 'red'
e.style.borderColor = 'red'
return false
} else {
e.style.color = null
e.style.borderColor = null
return true
}
},
validateArgs(val, index) {
const refName = this.setArgRef(index)
const e = this.$refs[refName].$refs.input
if (val === null || val === '' || typeof val === 'undefined') {
return true
}
try {
JSON.parse(val)
e.style.color = null
e.style.borderColor = null
const child = this.$refs[refName].$el.querySelector('.error-msg')
if (child) {
this.$refs[refName].$el.removeChild(child)
}
return true
} catch (error) {
e.style.color = 'red'
e.style.borderColor = 'red'
const child = this.$refs[refName].$el.querySelector('.error-msg')
if (!child) {
const errorDom = document.createElement('div')
errorDom.className = 'error-msg'
errorDom.innerText = '格式错误'
this.$refs[refName].$el.appendChild(errorDom)
}
return false
}
},
requireTicketChange(val) {
const param = {
resourceId: this.resourceId,
require: val
}
switchEnableTicket(param)
},
refreshTicket(row) { refreshTicket(row) {
const param = JSON.parse(JSON.stringify(row)) const param = JSON.parse(JSON.stringify(row))
param['generateNew'] = true param['generateNew'] = true
saveTicketApi(param).then(res => { saveTicketApi(param).then(res => {
row.ticket = res.data row.ticket = res.data
}) })
console.log(row.ticket)
}, },
deleteTicket(row, index) { deleteTicket(row, index) {
const param = { ticket: row.ticket } const param = { ticket: row.ticket }
@ -343,8 +465,8 @@ export default {
editRow(row) { editRow(row) {
row.isEdit = true row.isEdit = true
}, },
saveRow(row) { saveRow(row, index) {
saveTicketApi(row).then(res => { this.validateExp(row.exp, index) && this.validateArgs(row.args, index) && saveTicketApi(row).then(() => {
row.isEdit = false row.isEdit = false
}) })
}, },
@ -368,11 +490,13 @@ export default {
enablePwd, enablePwd,
pwd, pwd,
uri, uri,
overTime overTime,
requireTicket
} = res.data } = res.data
this.valid = valid this.valid = valid
this.form.enablePwd = enablePwd this.form.enablePwd = enablePwd
this.form.uri = uri ? (this.origin + uri) : uri this.form.uri = uri ? (this.origin + uri) : uri
this.requireTicket = requireTicket
// //
pwd && (this.form.pwd = pwd) pwd && (this.form.pwd = pwd)
@ -535,10 +659,14 @@ export default {
.ticket { .ticket {
padding: 0 20px !important; padding: 0 20px !important;
.ticket-model { .ticket-model {
padding: 8px 10px; display: flex;
padding: 8px 0px 8px 10px;
label { label {
margin-right: 8px; margin-right: 8px;
} }
.check-tips {
margin: 0 16px 0 4px;
}
} }
.ticket-table { .ticket-table {
padding: 10px 0 10px 8px; padding: 10px 0 10px 8px;
@ -565,6 +693,13 @@ export default {
} }
} }
} }
::v-deep .error-msg {
color: red;
position: fixed;
z-index: 9;
font-size: 10px;
height: 10px;
}
} }
} }
@ -602,10 +737,9 @@ export default {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.refresh-i { .refresh-i {
margin-left: 5px; height: 17px;
height: 16px;
width: 16px; width: 16px;
line-height: 16px; line-height: 13px;
padding: 2px; padding: 2px;
&:hover { &:hover {
background-color: rgba(51, 112, 255, .1); background-color: rgba(51, 112, 255, .1);

View File

@ -14,12 +14,17 @@
v-if="showIndex===2" v-if="showIndex===2"
:resource-id="resourceId" :resource-id="resourceId"
:user="userId" :user="userId"
:ticket-args="ticketArgs"
/> />
<link-expire <link-expire
v-if="showIndex===3" v-if="showIndex===3"
:resource-id="resourceId" :resource-id="resourceId"
:user="userId" :user="userId"
/> />
<ticket-error
v-if="showIndex === 4 || showIndex === 5"
:show-index="showIndex"
/>
</div> </div>
</template> </template>
<script> <script>
@ -29,9 +34,10 @@ import LinkView from './view'
import LinkError from './error' import LinkError from './error'
import LinkPwd from './pwd' import LinkPwd from './pwd'
import LinkExpire from './overtime' import LinkExpire from './overtime'
import TicketError from './ticket'
export default { export default {
components: { components: {
LinkError, LinkPwd, LinkView, LinkExpire LinkError, LinkPwd, LinkView, LinkExpire, TicketError
}, },
data() { data() {
@ -41,7 +47,9 @@ export default {
PARAMKEY: 'link', PARAMKEY: 'link',
link: null, link: null,
user: null, user: null,
showIndex: -1 showIndex: -1,
ticket: null,
ticketArgs: null
} }
}, },
created() { created() {
@ -53,6 +61,7 @@ export default {
this.$store.commit('setPublicLinkStatus', true) this.$store.commit('setPublicLinkStatus', true)
this.link = this.$route.query.link this.link = this.$route.query.link
this.user = this.$route.query.user this.user = this.$route.query.user
this.ticket = this.$route.query.ticket
if (!this.link) { if (!this.link) {
this.link = getQueryVariable(this.PARAMKEY) this.link = getQueryVariable(this.PARAMKEY)
} }
@ -64,10 +73,16 @@ export default {
return return
} }
const params = this.user ? { link: encodeURIComponent(this.link), user: encodeURIComponent(this.user) } : { link: encodeURIComponent(this.link) } const params = this.user ? { link: encodeURIComponent(this.link), user: encodeURIComponent(this.user) } : { link: encodeURIComponent(this.link) }
if (this.ticket) {
params['ticket'] = this.ticket
}
this.ticketArgs = null
validate(params).then(res => { validate(params).then(res => {
const { resourceId, valid, enablePwd, passPwd, expire, userId } = res.data const { resourceId, valid, enablePwd, passPwd, expire, userId } = res.data
const ticketDto = res.data.ticket
this.resourceId = resourceId this.resourceId = resourceId
this.userId = userId this.userId = userId
this.ticketArgs = ticketDto?.args
// //
if (!valid || !resourceId) { if (!valid || !resourceId) {
this.showError() this.showError()
@ -84,6 +99,15 @@ export default {
return return
} }
if (!ticketDto?.ticketValid) {
this.showTicketError()
return
}
if (ticketDto?.ticketExp) {
this.showTicketExpire()
return
}
this.showView() this.showView()
}).catch(() => { }).catch(() => {
this.showError() this.showError()
@ -107,6 +131,12 @@ export default {
}, },
showExpire() { showExpire() {
this.showIndex = 3 this.showIndex = 3
},
showTicketError() {
this.showIndex = 4
},
showTicketExpire() {
this.showIndex = 5
} }
} }
} }

View File

@ -0,0 +1,21 @@
<template>
<el-empty :description="showIndex === 4 ? errorTips : expTips" />
</template>
<script>
export default {
name: 'TicketError',
props: {
showIndex: {
type: Number,
default: 4
}
},
data() {
return {
errorTips: 'ticket参数错误',
expTips: 'ticket已过期'
}
}
}
</script>

View File

@ -39,6 +39,10 @@ export default {
user: { user: {
type: String, type: String,
default: null default: null
},
ticketArgs: {
type: String,
default: null
} }
}, },
data() { data() {
@ -125,10 +129,27 @@ export default {
tempParam && loadingCount++ tempParam && loadingCount++
attachParamsEncode && loadingCount++ attachParamsEncode && loadingCount++
if (attachParamsEncode) { let argsObject = null
const args = this.ticketArgs
try { try {
console.log(args)
argsObject = JSON.parse(this.ticketArgs)
} catch (error) {
console.error(error)
}
const hasArgs = argsObject && Object.keys(argsObject)
if (attachParamsEncode || hasArgs) {
try {
let attachParam = null
if (attachParamsEncode) {
const Base64 = require('js-base64').Base64 const Base64 = require('js-base64').Base64
const attachParam = JSON.parse(decodeURIComponent(Base64.decode(attachParamsEncode))) attachParam = JSON.parse(decodeURIComponent(Base64.decode(attachParamsEncode)))
}
if (hasArgs) {
attachParam = Object.assign({}, attachParam, argsObject)
}
const hasAttachParam = attachParam && Object.keys(attachParam)
if (hasAttachParam) {
getOuterParamsInfo(this.resourceId).then(rsp => { getOuterParamsInfo(this.resourceId).then(rsp => {
if (--loadingCount === 0) { if (--loadingCount === 0) {
this.show = true this.show = true
@ -136,6 +157,7 @@ export default {
this.$store.commit('setNowPanelOuterParamsInfo', rsp.data) this.$store.commit('setNowPanelOuterParamsInfo', rsp.data)
this.$store.commit('addOuterParamsFilter', attachParam) this.$store.commit('addOuterParamsFilter', attachParam)
}) })
}
} catch (e) { } catch (e) {
if (--loadingCount === 0) { if (--loadingCount === 0) {
this.show = true this.show = true

View File

@ -15,5 +15,7 @@ public class PanelLinkTicket implements Serializable {
private String args; private String args;
private Long accessTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -433,6 +433,66 @@ public class PanelLinkTicketExample {
addCriterion("args not between", value1, value2, "args"); addCriterion("args not between", value1, value2, "args");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andAccessTimeIsNull() {
addCriterion("access_time is null");
return (Criteria) this;
}
public Criteria andAccessTimeIsNotNull() {
addCriterion("access_time is not null");
return (Criteria) this;
}
public Criteria andAccessTimeEqualTo(Long value) {
addCriterion("access_time =", value, "accessTime");
return (Criteria) this;
}
public Criteria andAccessTimeNotEqualTo(Long value) {
addCriterion("access_time <>", value, "accessTime");
return (Criteria) this;
}
public Criteria andAccessTimeGreaterThan(Long value) {
addCriterion("access_time >", value, "accessTime");
return (Criteria) this;
}
public Criteria andAccessTimeGreaterThanOrEqualTo(Long value) {
addCriterion("access_time >=", value, "accessTime");
return (Criteria) this;
}
public Criteria andAccessTimeLessThan(Long value) {
addCriterion("access_time <", value, "accessTime");
return (Criteria) this;
}
public Criteria andAccessTimeLessThanOrEqualTo(Long value) {
addCriterion("access_time <=", value, "accessTime");
return (Criteria) this;
}
public Criteria andAccessTimeIn(List<Long> values) {
addCriterion("access_time in", values, "accessTime");
return (Criteria) this;
}
public Criteria andAccessTimeNotIn(List<Long> values) {
addCriterion("access_time not in", values, "accessTime");
return (Criteria) this;
}
public Criteria andAccessTimeBetween(Long value1, Long value2) {
addCriterion("access_time between", value1, value2, "accessTime");
return (Criteria) this;
}
public Criteria andAccessTimeNotBetween(Long value1, Long value2) {
addCriterion("access_time not between", value1, value2, "accessTime");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -7,6 +7,7 @@
<result column="ticket" jdbcType="VARCHAR" property="ticket" /> <result column="ticket" jdbcType="VARCHAR" property="ticket" />
<result column="exp" jdbcType="BIGINT" property="exp" /> <result column="exp" jdbcType="BIGINT" property="exp" />
<result column="args" jdbcType="VARCHAR" property="args" /> <result column="args" jdbcType="VARCHAR" property="args" />
<result column="access_time" jdbcType="BIGINT" property="accessTime" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -67,7 +68,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, uuid, ticket, `exp`, args id, uuid, ticket, `exp`, args, access_time
</sql> </sql>
<select id="selectByExample" parameterType="io.dataease.plugins.common.base.domain.PanelLinkTicketExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.dataease.plugins.common.base.domain.PanelLinkTicketExample" resultMap="BaseResultMap">
select select
@ -101,9 +102,11 @@
</delete> </delete>
<insert id="insert" parameterType="io.dataease.plugins.common.base.domain.PanelLinkTicket"> <insert id="insert" parameterType="io.dataease.plugins.common.base.domain.PanelLinkTicket">
insert into panel_link_ticket (id, uuid, ticket, insert into panel_link_ticket (id, uuid, ticket,
`exp`, args) `exp`, args, access_time
)
values (#{id,jdbcType=BIGINT}, #{uuid,jdbcType=VARCHAR}, #{ticket,jdbcType=VARCHAR}, values (#{id,jdbcType=BIGINT}, #{uuid,jdbcType=VARCHAR}, #{ticket,jdbcType=VARCHAR},
#{exp,jdbcType=BIGINT}, #{args,jdbcType=VARCHAR}) #{exp,jdbcType=BIGINT}, #{args,jdbcType=VARCHAR}, #{accessTime,jdbcType=BIGINT}
)
</insert> </insert>
<insert id="insertSelective" parameterType="io.dataease.plugins.common.base.domain.PanelLinkTicket"> <insert id="insertSelective" parameterType="io.dataease.plugins.common.base.domain.PanelLinkTicket">
insert into panel_link_ticket insert into panel_link_ticket
@ -123,6 +126,9 @@
<if test="args != null"> <if test="args != null">
args, args,
</if> </if>
<if test="accessTime != null">
access_time,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -140,6 +146,9 @@
<if test="args != null"> <if test="args != null">
#{args,jdbcType=VARCHAR}, #{args,jdbcType=VARCHAR},
</if> </if>
<if test="accessTime != null">
#{accessTime,jdbcType=BIGINT},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.dataease.plugins.common.base.domain.PanelLinkTicketExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.dataease.plugins.common.base.domain.PanelLinkTicketExample" resultType="java.lang.Long">
@ -166,6 +175,9 @@
<if test="record.args != null"> <if test="record.args != null">
args = #{record.args,jdbcType=VARCHAR}, args = #{record.args,jdbcType=VARCHAR},
</if> </if>
<if test="record.accessTime != null">
access_time = #{record.accessTime,jdbcType=BIGINT},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -177,7 +189,8 @@
uuid = #{record.uuid,jdbcType=VARCHAR}, uuid = #{record.uuid,jdbcType=VARCHAR},
ticket = #{record.ticket,jdbcType=VARCHAR}, ticket = #{record.ticket,jdbcType=VARCHAR},
`exp` = #{record.exp,jdbcType=BIGINT}, `exp` = #{record.exp,jdbcType=BIGINT},
args = #{record.args,jdbcType=VARCHAR} args = #{record.args,jdbcType=VARCHAR},
access_time = #{record.accessTime,jdbcType=BIGINT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -197,6 +210,9 @@
<if test="args != null"> <if test="args != null">
args = #{args,jdbcType=VARCHAR}, args = #{args,jdbcType=VARCHAR},
</if> </if>
<if test="accessTime != null">
access_time = #{accessTime,jdbcType=BIGINT},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
@ -205,7 +221,8 @@
set uuid = #{uuid,jdbcType=VARCHAR}, set uuid = #{uuid,jdbcType=VARCHAR},
ticket = #{ticket,jdbcType=VARCHAR}, ticket = #{ticket,jdbcType=VARCHAR},
`exp` = #{exp,jdbcType=BIGINT}, `exp` = #{exp,jdbcType=BIGINT},
args = #{args,jdbcType=VARCHAR} args = #{args,jdbcType=VARCHAR},
access_time = #{accessTime,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>

View File

@ -63,7 +63,7 @@
<table tableName="chart_view"> <table tableName="panel_link_ticket">
</table> </table>