1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +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
v-if="field.isNumericField && !field.isReadOnlyFromLogic"
:field-attributes="fieldAttributes"
:field-value="field.value"
:field-value="recordDataFields"
/>
</template>

View File

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

View File

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