This commit is contained in:
devezhao-mac 2018-12-31 23:38:10 +08:00
parent 099a0cf7de
commit a10a2f5257
16 changed files with 209 additions and 197 deletions

View file

@ -8,9 +8,9 @@
<script src="${baseUrl}/assets/lib/jquery.html5uploader.js"></script>
<script src="${baseUrl}/assets/lib/widget/select2.min.js"></script>
<script src="${baseUrl}/assets/lib/jquery-ui.min.js"></script>
<script src="${baseUrl}/assets/js/rb-base.js"></script>
<script src="${baseUrl}/assets/js/rb-page.js"></script>
<script src="${baseUrl}/assets/lib/react/babel.js"></script>
<script src="${baseUrl}/assets/lib/react/react.development.js"></script>
<script src="${baseUrl}/assets/lib/react/react-dom.development.js"></script>
<script src="${baseUrl}/assets/js/rb-components.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-base.js"></script>
<script src="${baseUrl}/assets/js/rb-page.js"></script>

View file

@ -65,10 +65,6 @@
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/bizuser/dept-tree.js"></script>
<script>
window.__PageConfig = {
type: 'RecordList',
@ -78,6 +74,10 @@ window.__PageConfig = {
advFilter: false
}
</script>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/bizuser/dept-tree.js"></script>
<script type="text/babel">
RbForm.postAfter = function(){
location.reload()

View file

@ -43,9 +43,6 @@
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script>
window.__PageConfig = {
type: 'RecordView',
@ -53,6 +50,9 @@ window.__PageConfig = {
recordId: '${id}'
}
</script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script type="text/babel">
$(document).ready(function(){
if (rb.isAdminUser == false || rb.isAdminVerified == false) $('.view-action').remove()

View file

@ -137,13 +137,13 @@
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/bizuser/roles.js" type="text/babel"></script>
<script>
window.__PageConfig = {
recordId: '${id}'
}
</script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/bizuser/roles.js" type="text/babel"></script>
</body>
</html>

View file

@ -37,9 +37,6 @@
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script>
window.__PageConfig = {
type: 'RecordView',
@ -47,6 +44,9 @@ window.__PageConfig = {
recordId: '${id}'
}
</script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script type="text/babel">
$(document).ready(function(){
if (rb.isAdminUser == false || rb.isAdminVerified == false) $('.view-action').remove()

View file

@ -70,10 +70,6 @@
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/bizuser/dept-tree.js"></script>
<script>
window.__PageConfig = {
type: 'RecordList',
@ -83,6 +79,10 @@ window.__PageConfig = {
advFilter: false
}
</script>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/bizuser/dept-tree.js"></script>
<script type="text/babel">
let formPostType = 1
RbForm.postAfter = function(){

View file

@ -52,10 +52,6 @@
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/bizuser/user-view.jsx" type="text/babel"></script>
<script>
window.__PageConfig = {
type: 'RecordView',
@ -63,5 +59,9 @@ window.__PageConfig = {
recordId: '${id}'
}
</script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms-ext.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/bizuser/user-view.jsx" type="text/babel"></script>
</body>
</html>

View file

@ -104,58 +104,13 @@ a#entityIcon:hover{opacity:0.8}
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script type="text/babel">
let clickIcon = function(icon){
$('#entityIcon').attr('value', icon).find('i').attr('class', 'icon zmdi zmdi-' + icon)
rb.modalHide()
<script>
window.__PageConfig = {
metaId: '${entityMetaId}',
entity: '${entityName}',
nameField: '${nameField}'
}
$(document).ready(function(){
const metaId = '${entityMetaId}'
if (!!!metaId) $('.footer .alert').removeClass('hide')
else $('.footer .J_action').removeClass('hide')
$('.J_tab-${entityName} a').addClass('active')
let _btn = $('.J_save').click(function(){
if (!!!metaId) return
let icon = $val('#entityIcon'),
label = $val('#entityLabel'),
comments = $val('#comments'),
nameField = $val('#nameField')
let _data = { entityLabel:label, comments:comments, nameField:nameField }
if (!!icon) _data.icon = icon
_data = $cleanMap(_data)
if (Object.keys(_data) == 0){ location.reload(); return }
_data.metadata = { entity:'MetaEntity', id:metaId }
_btn.button('loading')
$.post('../entity-update', JSON.stringify(_data), function(res){
if (res.error_code == 0) location.reload()
else rb.notice(res.error_msg, 'danger')
})
})
$('#entityIcon').click(function(){
rb.modal(rb.baseUrl + '/p/commons/search-icon', '选择图标')
})
$.get(rb.baseUrl + '/commons/metadata/fields?entity=${entityName}', function(d){
let rs = d.data.map((item) => {
let unName = item.type == 'REFERENCE' || item.type == 'NTEXT'
return {
id: item.name,
text: item.label,
disabled: unName,
title: unName ? '此字段(类型)不能作为主显字段' : ''
}
})
$('#nameField').select2({
language: 'zh-CN',
placeholder: '选择字段',
data: rs
}).val('${nameField}').trigger('change')
})
})
</script>
<script src="${baseUrl}/assets/js/entity/entity-edit.js"></script>
</body>
</html>

View file

@ -190,113 +190,16 @@
</script>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/lib/widget/bootstrap-slider.min.js"></script>
<script type="text/babel">
$(document).ready(function(){
const metaId = '${fieldMetaId}'
let dt = '${fieldType}'
if (dt.indexOf('(') > -1) dt = dt.match('\\((.+?)\\)')[1]
const extConfigOld = JSON.parse('${fieldExtConfig}' || '{}')
const btn = $('.J_save').click(function(){
if (!!!metaId) return
let label = $val('#fieldLabel'),
comments = $val('#comments'),
nullable = $val('#fieldNullable'),
updatable = $val('#fieldUpdatable')
let _data = { fieldLabel:label, comments:comments, nullable:nullable, updatable:updatable }
_data = $cleanMap(_data)
let extConfig = {}
$('.J_for-' + dt + ' .form-control').each(function(){
let k = $(this).attr('id')
let v = $val(this)
extConfig[k] = v
})
for (let k in extConfig){
if (extConfig[k] != extConfigOld[k]) {
_data['extConfig'] = JSON.stringify(extConfig)
break
}
}
_data = $cleanMap(_data)
if (Object.keys(_data).length == 0){
location.href = '../fields'
return
}
_data.metadata = { entity: 'MetaField', id: metaId || null }
_data = JSON.stringify(_data)
btn.button('loading')
$.post(rb.baseUrl + '/admin/entity/field-update', _data, function(res){
if (res.error_code == 0) location.href = '../fields'
else rb.notice(res.error_msg, 'danger')
})
})
$('#fieldNullable').attr('checked', $('#fieldNullable').data('o') == true)
$('#fieldUpdatable').attr('checked', $('#fieldUpdatable').data('o') == true)
$('.J_for-' + dt).removeClass('hide')
let uploadNumber = [1, 5]
for (let k in extConfigOld) {
if (k == 'uploadNumber'){
uploadNumber = extConfigOld[k].split(',')
uploadNumber[0] = ~~uploadNumber[0]
uploadNumber[1] = ~~uploadNumber[1]
$('.J_minmax b').eq(0).text(uploadNumber[0])
$('.J_minmax b').eq(1).text(uploadNumber[1])
} else $('#' + k).val(extConfigOld[k])
}
$('input.bslider').slider({ value:uploadNumber }).on('change', function(e){
let v = e.value.newValue
$('.J_minmax b').eq(0).text(v[0])
$('.J_minmax b').eq(1).text(v[1])
})
if (dt == 'PICKLIST'){
$.get(rb.baseUrl + '/admin/field/picklist-gets?entity=${entityName}&field=${fieldName}&isAll=false', function(res){
if (res.data.length == 0){
$('#picklist-items li').text('请添加选项'); return
}
$('#picklist-items').empty()
$(res.data).each(function(){
picklistItemRender(this)
})
if (res.data.length > 5) $('#picklist-items').parent().removeClass('autoh')
})
$('.J_picklist-edit').click(function(){
rb.modal(rb.baseUrl + '/admin/p/entity/picklist-config?entity=${entityName}&field=${fieldName}', '配置列表选项')
})
} else if (dt == 'SERIES'){
$('#fieldNullable, #fieldUpdatable').attr('disabled', true)
}
if ('${fieldBuildin}' == 'true') $('.footer .alert').removeClass('hide')
else $('.footer .J_action').removeClass('hide')
$('.J_del').click(function(){
let alertExt = { type: 'danger', confirmText: '删除' }
alertExt.confirm = function(){
$(this.refs['rbalert']).find('.btn').button('loading')
let thatModal = this
$.post(rb.baseUrl + '/admin/entity/field-drop?id=' + metaId, function(res){
if (res.error_code == 0){
thatModal.hide()
rb.notice('字段已删除', 'success')
setTimeout(function(){ location.replace('../fields') }, 1500)
} else rb.notice(res.error_msg, 'danger')
})
}
rb.alert('字段删除后将无法恢复,请务必谨慎操作!确认删除吗?', '删除字段', alertExt)
})
})
const picklistItemRender = function(data){
let item = $('<li class="dd-item" data-key="' + data.id + '"><div class="dd-handle">' + data.text + '</div></li>').appendTo('#picklist-items')
if (data['default'] == true) item.addClass('default').attr('title', '默认项')
<script>
window.__PageConfig = {
metaId: '${fieldMetaId}',
fieldType: '${fieldType}',
extConfig: ${fieldExtConfig} || {},
entityName: '${entityName}',
fieldName: '${fieldName}',
fieldBuildin: ${fieldBuildin} || false,
}
</script>
<script src="${baseUrl}/assets/js/entity/field-edit.js"></script>
</body>
</html>

View file

@ -1,11 +1,9 @@
RbForm.postAfter = function(data){
location.href = rb.baseUrl + '/admin/bizuser/role/' + data.id
}
let role_id
const role_id = window.__PageConfig.recordId
$(document).ready(function(){
role_id = window.__PageConfig.recordId
$('.J_new-role').click(function(){
$('.J_new-role').click(function(){
rb.RbFormModal({ title: '新建角色', entity: 'Role', icon: 'lock' })
})

View file

@ -0,0 +1,52 @@
let clickIcon = function(icon){
$('#entityIcon').attr('value', icon).find('i').attr('class', 'icon zmdi zmdi-' + icon)
rb.modalHide()
}
const wpc = window.__PageConfig
$(document).ready(function(){
if (!!!wpc.metaId) $('.footer .alert').removeClass('hide')
else $('.footer .J_action').removeClass('hide')
$('.J_tab-' + wpc.entity + ' a').addClass('active')
let _btn = $('.J_save').click(function(){
if (!!!wpc.metaId) return
let icon = $val('#entityIcon'),
label = $val('#entityLabel'),
comments = $val('#comments'),
nameField = $val('#nameField')
let _data = { entityLabel:label, comments:comments, nameField:nameField }
if (!!icon) _data.icon = icon
_data = $cleanMap(_data)
if (Object.keys(_data) == 0){ location.reload(); return }
_data.metadata = { entity: 'MetaEntity', id: wpc.metaId }
_btn.button('loading')
$.post('../entity-update', JSON.stringify(_data), function(res){
if (res.error_code == 0) location.reload()
else rb.notice(res.error_msg, 'danger')
})
})
$('#entityIcon').click(function(){
rb.modal(rb.baseUrl + '/p/commons/search-icon', '选择图标')
})
$.get(rb.baseUrl + '/commons/metadata/fields?entity=' + wpc.entity, function(d){
let rs = d.data.map((item) => {
let unName = item.type == 'REFERENCE' || item.type == 'NTEXT'
return {
id: item.name,
text: item.label,
disabled: unName,
title: unName ? '此字段类型不能作为主显字段' : ''
}
})
$('#nameField').select2({
language: 'zh-CN',
placeholder: '选择字段',
data: rs
}).val(wpc.nameField).trigger('change')
})
})

View file

@ -0,0 +1,104 @@
const wpc = window.__PageConfig
$(document).ready(function(){
let dt = wpc.fieldType
if (dt.indexOf('(') > -1) dt = dt.match('\\((.+?)\\)')[1]
const extConfigOld = wpc.extConfig
const btn = $('.J_save').click(function(){
if (!!!wpc.metaId) return
let label = $val('#fieldLabel'),
comments = $val('#comments'),
nullable = $val('#fieldNullable'),
updatable = $val('#fieldUpdatable')
let _data = { fieldLabel:label, comments:comments, nullable:nullable, updatable:updatable }
_data = $cleanMap(_data)
let extConfig = {}
$('.J_for-' + dt + ' .form-control').each(function(){
let k = $(this).attr('id')
let v = $val(this)
extConfig[k] = v
})
for (let k in extConfig){
if (extConfig[k] != extConfigOld[k]) {
_data['extConfig'] = JSON.stringify(extConfig)
break
}
}
_data = $cleanMap(_data)
if (Object.keys(_data).length == 0){
location.href = '../fields'
return
}
_data.metadata = { entity: 'MetaField', id: wpc.metaId }
_data = JSON.stringify(_data)
btn.button('loading')
$.post(rb.baseUrl + '/admin/entity/field-update', _data, function(res){
if (res.error_code == 0) location.href = '../fields'
else rb.notice(res.error_msg, 'danger')
})
})
$('#fieldNullable').attr('checked', $('#fieldNullable').data('o') == true)
$('#fieldUpdatable').attr('checked', $('#fieldUpdatable').data('o') == true)
$('.J_for-' + dt).removeClass('hide')
let uploadNumber = [1, 5]
for (let k in extConfigOld) {
if (k == 'uploadNumber'){
uploadNumber = extConfigOld[k].split(',')
uploadNumber[0] = ~~uploadNumber[0]
uploadNumber[1] = ~~uploadNumber[1]
$('.J_minmax b').eq(0).text(uploadNumber[0])
$('.J_minmax b').eq(1).text(uploadNumber[1])
} else $('#' + k).val(extConfigOld[k])
}
$('input.bslider').slider({ value:uploadNumber }).on('change', function(e){
let v = e.value.newValue
$('.J_minmax b').eq(0).text(v[0])
$('.J_minmax b').eq(1).text(v[1])
})
if (dt == 'PICKLIST'){
$.get(`${rb.baseUrl}/admin/field/picklist-gets?entity=${wpc.entityName}&field=${wpc.fieldName}&isAll=false`, function(res){
if (res.data.length == 0){
$('#picklist-items li').text('请添加选项'); return
}
$('#picklist-items').empty()
$(res.data).each(function(){ picklistItemRender(this) })
if (res.data.length > 5) $('#picklist-items').parent().removeClass('autoh')
})
$('.J_picklist-edit').click(function(){
rb.modal(`${rb.baseUrl}/admin/p/entity/picklist-config?entity=${wpc.entityName}&field=${wpc.fieldName}`, '配置列表选项')
})
} else if (dt == 'SERIES'){
$('#fieldNullable, #fieldUpdatable').attr('disabled', true)
}
if (wpc.fieldBuildin == true) $('.footer .alert').removeClass('hide')
else $('.footer .J_action').removeClass('hide')
$('.J_del').click(function(){
let alertExt = { type: 'danger', confirmText: '删除' }
alertExt.confirm = function(){
$(this.refs['rbalert']).find('.btn').button('loading')
let thatModal = this
$.post(`${rb.baseUrl}/admin/entity/field-drop?id=${wpc.metaId}`, function(res){
if (res.error_code == 0){
thatModal.hide()
rb.notice('字段已删除', 'success')
setTimeout(function(){ location.replace('../fields') }, 1500)
} else rb.notice(res.error_msg, 'danger')
})
}
rb.alert('字段删除后将无法恢复请务必谨慎操作确认删除吗', '删除字段', alertExt)
})
})
const picklistItemRender = function(data){
let item = $('<li class="dd-item" data-key="' + data.id + '"><div class="dd-handle">' + data.text + '</div></li>').appendTo('#picklist-items')
if (data['default'] == true) item.addClass('default').attr('title', '默认项')
}

View file

@ -77,10 +77,6 @@
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-advfilter.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/assign-share.jsx" type="text/babel"></script>
<script>
window.__PageConfig = {
type: 'RecordList',
@ -90,5 +86,9 @@ window.__PageConfig = {
advFilter: true
}
</script>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-advfilter.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/assign-share.jsx" type="text/babel"></script>
</body>
</html>

View file

@ -84,9 +84,6 @@
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/assign-share.jsx" type="text/babel"></script>
<script>
window.__PageConfig = {
type: 'RecordView',
@ -97,5 +94,8 @@ window.__PageConfig = {
recordId: '${id}'
}
</script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/assign-share.jsx" type="text/babel"></script>
</body>
</html>

View file

@ -71,10 +71,6 @@
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-advfilter.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/assign-share.jsx" type="text/babel"></script>
<script>
window.__PageConfig = {
type: 'SlaveList',
@ -84,5 +80,9 @@ window.__PageConfig = {
advFilter: true
}
</script>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-advfilter.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/assign-share.jsx" type="text/babel"></script>
</body>
</html>

View file

@ -57,8 +57,6 @@
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script>
window.__PageConfig = {
type: 'SlaveView',
@ -67,5 +65,7 @@ window.__PageConfig = {
recordId: '${id}'
}
</script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
</body>
</html>