request 请求服务组件(异步调用)
function request(compId, args, succfun, errfun) {
$.ajax({
url: `/gdpaas/jscomp/run.htm?_p_=${compId}`,
type: 'POST',
data: {
compId,
params: JSON.stringify(args)
},
dataType: 'json',
success: function(response) {
if (response?.code === 0 && succfun) {
succfun(response.data)
} else if (response?.code === 1 && errfun) {
errfun(response.data)
} else {
console.log(response)
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.log('Error:', textStatus, errorThrown)
},
})
}
isLogin
function isLogin (login, _else) {
$.ajax({
url: '/gdpaas/home/isLogin.htm',
type: 'POST',
dataType: 'json',
success: (response) => {
if (response && response.code === 0) {
let user = response?.data?.user
if (user) {
console.log('已登录!')
if (login) {
login(user)
}
} else {
console.log('未登录!')
if (_else) {
_else()
}
}
} else {
console.log('验证登录失败!')
}
},
})
}
列表行数据
let rows = detailTable.getSelectRows()
if (!rows || rows.length === 0) {
gUtil.error('请选择需要的数据!')
return
}
let rows = mainTable.getSelectRows()
if (!rows || rows.length != 1) {
gUtil.error('请选择1条需要的数据!')
return
}
let row = rows[0]
let {MID, TIMEMD5} = row
if () {
gUtil.error('')
return
}
子页主数据查询失败处理
if (!data) {
gUtil.alert('数据已变更,请刷新重试!', () => {
gUtil.closeCurTabWin(false, () => {
self.parentPage.mainTable.load()
})
}, "提示", 2)
return
}
element_openSubWin
function element_openSubWin(value, pageId, params, openType, isClone, title) {
function click_openSubWin() {
gUtil.openSubWin(pageId, params, openType, isClone, title);
}
const span = document.createElement('span')
span.title = value
span.textContent = value
span.style.cursor = 'pointer'
span.style.color = '#0986f3'
span.addEventListener('click', click_openSubWin)
return span
}