This commit is contained in:
FangfangZhao 2018-10-29 00:57:27 +08:00
parent 30d30ea625
commit a08754bf05
4 changed files with 22 additions and 18 deletions

View file

@ -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;
}

View file

@ -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')

View file

@ -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 = <RbForm entity={entity} id={id} $$$parent={that}>
{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)
}
}

View file

@ -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 {
<div><label className="custom-control custom-control-sm custom-checkbox"><input className="custom-control-input" type="checkbox" checked={this.state.checkedAll} onClick={this.toggleAllRow} /><span className="custom-control-label"></span></label></div>
</th>
{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 (<th key={'column-' + item.field} style={styles} className="sortable unselect" onClick={this.fieldSort.bind(this, item.field)}><div style={styles}>{item.label}<i className={'zmdi ' + sortClazz}></i><i className="split" data-field={item.field}></i></div></th>)
return (<th key={'column-' + item.field} style={styles} className="sortable unselect" onClick={this.fieldSort.bind(this, item.field)}><div style={styles}><span style={{ width: (cWidth-8) + 'px' }}>{item.label}</span><i className={'zmdi ' + sortClazz}></i><i className="split" data-field={item.field}></i></div></th>)
})}
<th className="column-empty"></th>
</tr>
@ -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){