indicate new row (#338)
* indicate new row * add focus in field text * minimal changes. * delete unused method. * scrollTop to new record table children * minimal changes * change color of new cell Co-authored-by: Edwin Betancourt <EdwinBetanc0urt@hotmail.com>pull/3759/head
parent
c13741c5c7
commit
4c507aa82a
|
@ -149,6 +149,7 @@
|
||||||
element-loading-spinner="el-icon-loading"
|
element-loading-spinner="el-icon-loading"
|
||||||
cell-class-name="datatable-max-cell-height"
|
cell-class-name="datatable-max-cell-height"
|
||||||
:show-summary="getterPanel.isShowedTotals"
|
:show-summary="getterPanel.isShowedTotals"
|
||||||
|
:row-class-name="tableRowClassName"
|
||||||
:summary-method="getSummaries"
|
:summary-method="getSummaries"
|
||||||
@row-click="handleRowClick"
|
@row-click="handleRowClick"
|
||||||
@row-dblclick="handleRowDblClick"
|
@row-dblclick="handleRowDblClick"
|
||||||
|
@ -715,6 +716,12 @@ export default {
|
||||||
callOffNewRecord() {
|
callOffNewRecord() {
|
||||||
this.getterDataRecords.shift()
|
this.getterDataRecords.shift()
|
||||||
},
|
},
|
||||||
|
tableRowClassName({ row, rowIndex }) {
|
||||||
|
if (row.isNew) {
|
||||||
|
return 'warning-row'
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
},
|
||||||
addNewRow() {
|
addNewRow() {
|
||||||
if (this.getterNewRecords <= 0) {
|
if (this.getterNewRecords <= 0) {
|
||||||
this.$store.dispatch('addNewRow', {
|
this.$store.dispatch('addNewRow', {
|
||||||
|
@ -724,6 +731,7 @@ export default {
|
||||||
isEdit: true,
|
isEdit: true,
|
||||||
isSendServer: false
|
isSendServer: false
|
||||||
})
|
})
|
||||||
|
this.$refs.multipleTable.$refs.bodyWrapper.scrollTop = 0
|
||||||
} else {
|
} else {
|
||||||
const fieldsEmpty = this.$store.getters.getFieldListEmptyMandatory({
|
const fieldsEmpty = this.$store.getters.getFieldListEmptyMandatory({
|
||||||
containerUuid: this.containerUuid
|
containerUuid: this.containerUuid
|
||||||
|
@ -734,6 +742,20 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async setFocus() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const fieldFocus = this.fieldList.find(itemField => {
|
||||||
|
if (this.$refs.hasOwnProperty(itemField.columnName)) {
|
||||||
|
if (fieldIsDisplayed(itemField) && !itemField.isReadOnly && itemField.isUpdateable) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$refs[fieldFocus.columnName][0].focusField()
|
||||||
|
resolve()
|
||||||
|
return
|
||||||
|
})
|
||||||
|
},
|
||||||
async getList() {
|
async getList() {
|
||||||
this.oldgetDataDetail = this.getterDataRecords.map(v => v.id)
|
this.oldgetDataDetail = this.getterDataRecords.map(v => v.id)
|
||||||
this.newgetDataDetail = this.oldgetDataDetail.slice()
|
this.newgetDataDetail = this.oldgetDataDetail.slice()
|
||||||
|
@ -1042,6 +1064,13 @@ export default {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
|
.el-table .warning-row {
|
||||||
|
background: rgba(104, 245, 203, 0.712);
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table .success-row {
|
||||||
|
background: #f0f9eb;
|
||||||
|
}
|
||||||
.el-table > .cell {
|
.el-table > .cell {
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
|
@ -22,6 +22,7 @@ export const fieldMixin = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
/*
|
||||||
getterValue() {
|
getterValue() {
|
||||||
const field = this.$store.getters.getFieldFromColumnName({
|
const field = this.$store.getters.getFieldFromColumnName({
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
|
@ -33,15 +34,14 @@ export const fieldMixin = {
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
isDisabled() {
|
isDisabled() {
|
||||||
return Boolean(this.metadata.readonly || this.metadata.disabled)
|
return Boolean(this.metadata.readonly || this.metadata.disabled)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
activeFocus() {
|
activeFocus() {
|
||||||
if (this.metadata.isUpdateable) {
|
this.$refs[this.metadata.columnName].focus()
|
||||||
this.$refs[this.metadata.columnName].focus()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Overwrite component method if necessary
|
* Overwrite component method if necessary
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
:maxlength="maxLength"
|
:maxlength="maxLength"
|
||||||
:show-password="Boolean(metadata.isEncrypted)"
|
:show-password="Boolean(metadata.isEncrypted)"
|
||||||
|
:autofocus="metadata.inTable"
|
||||||
@change="preHandleChange"
|
@change="preHandleChange"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -420,9 +420,9 @@ export default {
|
||||||
})
|
})
|
||||||
return Boolean(field)
|
return Boolean(field)
|
||||||
},
|
},
|
||||||
focus(columnName) {
|
focusField() {
|
||||||
if (this.isDisplayed() && this.isMandatory() && !this.isReadOnly()) {
|
if (this.isDisplayed() && this.isMandatory() && !this.isReadOnly()) {
|
||||||
this.$refs[columnName].activeFocus(columnName)
|
this.$refs[this.field.columnName].activeFocus()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
redirect({ window, columnName, value }) {
|
redirect({ window, columnName, value }) {
|
||||||
|
|
|
@ -664,23 +664,21 @@ export default {
|
||||||
this.setTagsViewTitle(uuidRecord)
|
this.setTagsViewTitle(uuidRecord)
|
||||||
this.setFocus()
|
this.setFocus()
|
||||||
},
|
},
|
||||||
setFocus() {
|
async setFocus() {
|
||||||
let isFocusEnabled = false
|
return new Promise(resolve => {
|
||||||
this.getterFieldList.forEach(fieldItem => {
|
const fieldFocus = this.getterFieldList.find(itemField => {
|
||||||
if (!isFocusEnabled) {
|
if (this.$refs.hasOwnProperty(itemField.columnName)) {
|
||||||
if (this.isFocusable(fieldItem) && this.$refs.hasOwnProperty(fieldItem.columnName)) {
|
if (fieldIsDisplayed(itemField) && !itemField.isReadOnly && itemField.isUpdateable) {
|
||||||
this.$refs[fieldItem.columnName][0].focus(fieldItem.columnName)
|
return true
|
||||||
isFocusEnabled = true
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
if (fieldFocus) {
|
||||||
|
this.$refs[fieldFocus.columnName][0].focusField()
|
||||||
}
|
}
|
||||||
|
resolve()
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
},
|
|
||||||
isFocusable(field) {
|
|
||||||
if (fieldIsDisplayed(field) && !field.isReadOnly && field.isUpdateable) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue