From a08754bf05655e70be4e5d850011349596ff0f4e Mon Sep 17 00:00:00 2001 From: FangfangZhao Date: Mon, 29 Oct 2018 00:57:27 +0800 Subject: [PATCH] some opt --- src/main/webapp/assets/css/rb-page.css | 9 ++++++++- src/main/webapp/assets/js/assign-share.jsx | 12 +++++------- src/main/webapp/assets/js/rb-forms.jsx | 9 ++++----- src/main/webapp/assets/js/rb-list.jsx | 10 +++++----- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/main/webapp/assets/css/rb-page.css b/src/main/webapp/assets/css/rb-page.css index 059ef2868..9f7b42625 100644 --- a/src/main/webapp/assets/css/rb-page.css +++ b/src/main/webapp/assets/css/rb-page.css @@ -494,6 +494,13 @@ a { text-overflow: ellipsis; } +.data-list .table thead th>div>span{ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + display: block; +} + .data-list .table thead th>div>i { position: absolute; height: 20px; @@ -502,7 +509,7 @@ a { } .data-list .table thead th>div>i.split { - width: 8px; + width: 10px; border-right: 2px dotted #aaa; cursor: e-resize; } diff --git a/src/main/webapp/assets/js/assign-share.jsx b/src/main/webapp/assets/js/assign-share.jsx index a5eab3b51..b8ce91164 100644 --- a/src/main/webapp/assets/js/assign-share.jsx +++ b/src/main/webapp/assets/js/assign-share.jsx @@ -61,7 +61,6 @@ class TheBothDialog extends React.Component { language: 'zh-CN', placeholder: '选择用户', width: '100%', - minimumInputLength: 1, allowClear: true, ajax: { url: rb.baseUrl + '/commons/search', @@ -79,7 +78,6 @@ class TheBothDialog extends React.Component { return { results: rs } } } - }).on('change.select2', function(e){ }) this.show() } @@ -110,18 +108,18 @@ class TheBothDialog extends React.Component { post() { let to = $(this.refs['toUser']).val() - if (!to || to.length < 1) { rb.notice('请选择' + this.opType + '给谁'); return } + if (!!!to) { rb.notice('请选择' + this.opType + '给谁'); return } let cas = $(this.refs['cascades']).val() || [] let that = this - let btns = $(this.refs['actions']).find('.btn').button('loading') - $.post(`${rb.baseUrl}/app/entity/record-${this.state.type}?id=${this.state.ids.join(',')}&cascades=${cas.join(',')}&to=${to.join(',')}`, function(res){ + let btns = $(this.refs['actions']).find('.btn-primary').button('loading') + $.post(`${rb.baseUrl}/app/entity/record-${this.state.type}?id=${this.state.ids.join(',')}&cascades=${cas.join(',')}&to=${to}`, function(res){ if (res.error_code == 0){ that.hide() rb.notice('已成功' + that.opType + ' ' + (res.data.assigned || res.data.shared) + ' 条记录', 'success') - if (RbListPage) RbListPage._RbList.reload() - if (RbViewPage) location.reload() + if (window.RbListPage) RbListPage._RbList.reload() + if (window.RbViewPage) location.reload() } else { rb.notice(res.error_msg || ('操作失败,请稍后重试'), 'danger') diff --git a/src/main/webapp/assets/js/rb-forms.jsx b/src/main/webapp/assets/js/rb-forms.jsx index e7bfe4f5b..69eafdae1 100644 --- a/src/main/webapp/assets/js/rb-forms.jsx +++ b/src/main/webapp/assets/js/rb-forms.jsx @@ -27,8 +27,7 @@ class RbFormModal extends React.Component { ) } componentDidMount() { - this.show() - if (!!!this.state.id) this.getFormModel() + this.showAfter({}, true) } // 渲染表单 @@ -36,7 +35,7 @@ class RbFormModal extends React.Component { let that = this const entity = this.state.entity const id = this.state.id || '' - $.get(rb.baseUrl + '/app/' + entity + '/form-model?entity=' + entity + '&id=' + id, function(res){ + $.get(`${rb.baseUrl}/app/${entity}/form-model?id=${id}`, function(res){ let elements = res.data.elements const FORM = {elements.map((item) => { @@ -53,7 +52,7 @@ class RbFormModal extends React.Component { state = state || {} let that = this if (state.id != this.state.id || state.entity != this.state.entity) { - state = { ...state, isDestroy: true, formComponent: null, inLoad: true } + state = { ...state, isDestroy: true, formComponent: null, inLoad: true, id: state.id, entity: state.entity } this.setState(state, function(){ that.showAfter({ ...state, isDestroy: false }, true) }) @@ -74,7 +73,7 @@ class RbFormModal extends React.Component { hide(destroy) { $(this.refs['rbmodal']).modal('hide') let state = { isDestroy: false } - if (destroy === true) state = { ...state, isDestroy: true, id: null } + if (destroy === true) state = { ...state, isDestroy: true } this.setState(state) } } diff --git a/src/main/webapp/assets/js/rb-list.jsx b/src/main/webapp/assets/js/rb-list.jsx index af7150859..da3dcb27c 100644 --- a/src/main/webapp/assets/js/rb-list.jsx +++ b/src/main/webapp/assets/js/rb-list.jsx @@ -10,7 +10,7 @@ class RbList extends React.Component { let fields = props.config.fields for (let i = 0; i < fields.length; i++){ let cw = $storage.get(this.__columnWidthKey + fields[i].field) - if (!!cw && ~~cw > 40) fields[i].width = ~~cw + if (!!cw && ~~cw >= 48) fields[i].width = ~~cw if (sort[0] == fields[i].field) fields[i].sort = sort[1] } props.config.fields = null @@ -38,10 +38,10 @@ class RbList extends React.Component {
{this.state.fields.map((item, index) =>{ - let columnWidth = (item.width || that.__defaultColumnWidth) + 'px' - let styles = { width: columnWidth } + let cWidth = (item.width || that.__defaultColumnWidth) + let styles = { width: cWidth + 'px' } let sortClazz = item.sort || '' - return (
{item.label}
) + return (
{item.label}
) })} @@ -75,7 +75,7 @@ class RbList extends React.Component { scroller.find('th .split').draggable({ containment: '.rb-datatable-body', axis: 'x', helper: 'clone', stop: function(event, ui){ let field = $(event.target).data('field') let left = ui.position.left - 2 - if (left < 40) left = 40 // min + if (left < 48) left = 48 // min let fields = that.state.fields for (let i = 0; i < fields.length; i++){ if (fields[i].field == field){