1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 07:04:21 +08:00

fix calculator (#633)

Co-authored-by: Elsio Sanchez <elsiosanche@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-03-07 21:41:51 -04:00 committed by GitHub
parent eb4b746a9a
commit 962655ed5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 35 deletions

View File

@ -48,7 +48,7 @@
<calculator <calculator
v-if="field.isNumericField && !field.isReadOnlyFromLogic" v-if="field.isNumericField && !field.isReadOnlyFromLogic"
:field-attributes="fieldAttributes" :field-attributes="fieldAttributes"
:field-value="field.value" :field-value="recordDataFields"
/> />
</template> </template>

View File

@ -156,33 +156,33 @@ export default {
} }
}, },
changeValue() { changeValue() {
// const newValue = Number(this.valueToDisplay) const newValue = Number(this.valueToDisplay)
// let isSendCallout = true let isSendCallout = true
// const isSendToServer = true const isSendToServer = true
// const isChangedOldValue = false const isChangedOldValue = false
// if (this.fieldAttributes.isAdvancedQuery) { if (this.fieldAttributes.isAdvancedQuery) {
// isSendCallout = false isSendCallout = false
// } }
//
// const sendParameters = { const sendParameters = {
// parentUuid: this.fieldAttributes.parentUuid, parentUuid: this.fieldAttributes.parentUuid,
// containerUuid: this.fieldAttributes.containerUuid, containerUuid: this.fieldAttributes.containerUuid,
// field: this.fieldAttributes, field: this.fieldAttributes,
// panelType: this.fieldAttributes.panelType, panelType: this.fieldAttributes.panelType,
// columnName: this.fieldAttributes.columnName, columnName: this.fieldAttributes.columnName,
// newValue, newValue,
// isAdvancedQuery: this.fieldAttributes.isAdvancedQuery, isAdvancedQuery: this.fieldAttributes.isAdvancedQuery,
// isSendToServer, isSendToServer,
// isSendCallout, isSendCallout,
// isChangedOldValue isChangedOldValue
// } }
// this.$store.dispatch('notifyFieldChange', { this.$store.dispatch('notifyFieldChange', {
// ...sendParameters ...sendParameters
// }) })
// .finally(() => { .finally(() => {
// this.clearVariables() this.clearVariables()
// this.$children[0].visible = false this.$children[0].visible = false
// }) })
}, },
spanMethod({ row, column }) { spanMethod({ row, column }) {
const button = row[column.property] const button = row[column.property]

View File

@ -532,7 +532,8 @@ const actions = {
notifyFieldChange({ dispatch, getters }, { notifyFieldChange({ dispatch, getters }, {
containerUuid, containerUuid,
columnName, columnName,
field field,
newValue
}) { }) {
return new Promise(resolve => { return new Promise(resolve => {
// get field // get field
@ -541,12 +542,16 @@ const actions = {
fieldsList = getters.getFieldsListFromPanel(containerUuid) fieldsList = getters.getFieldsListFromPanel(containerUuid)
field = fieldsList.find(fieldItem => fieldItem.columnName === columnName) field = fieldsList.find(fieldItem => fieldItem.columnName === columnName)
} }
let value
const value = getters.getValueOfField({ if (isEmptyValue(newValue)) {
parentUuid: field.parentUuid, value = getters.getValueOfField({
containerUuid: field.containerUuid, parentUuid: field.parentUuid,
columnName: field.columnName containerUuid: field.containerUuid,
}) columnName: field.columnName
})
} else {
value = newValue
}
// if (!(panelType === 'table' || isAdvancedQuery)) { // if (!(panelType === 'table' || isAdvancedQuery)) {
// if (!['IN', 'NOT_IN'].includes(field.operator)) { // if (!['IN', 'NOT_IN'].includes(field.operator)) {
// value = parsedValueComponent({ // value = parsedValueComponent({