1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-13 07:04:21 +08:00
Leonel Matos 618a24d22f
Add calculator component to numeric references (#349)
* add calc component

* change display values to top

* Update version for gRPC data client

* redefine styles and enter key press event

* Revert "Merge branch 'develop' of https://github.com/erpcya/adempiere-vue into develop"

This reverts commit eaa9477d2b52e87962b7610fda7944fc944460a6.

* Revert "Merge branch 'develop' of https://github.com/erpcya/adempiere-vue into develop"

This reverts commit eaa9477d2b52e87962b7610fda7944fc944460a6.

* add mathematical operation directly from field

* add value to math operation in real time

* minor changes

* minor changes

* validate input values

* redefine logics

Co-authored-by: Edwin Betancourt <EdwinBetanc0urt@hotmail.com>
Co-authored-by: Yamel Senih <ysenih@erpya.com>
2020-02-28 02:21:51 -04:00

142 lines
3.8 KiB
Vue

<template>
<el-popover
v-if="(field.columnName === 'DocStatus') && (!isEmptyValue(processOrderUuid))"
placement="right"
width="400"
trigger="click"
:disabled="withoutRecord"
>
<el-select
v-model="valueActionDocument"
@change="documentActionChange"
@visible-change="listActionDocument"
>
<el-option
v-for="(item, key) in listDocumentActions"
:key="key"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-tag
v-if="isEmptyValue(valueActionDocument)"
:type="tagStatus(field.value)"
>
{{ field.displayColumn }}
</el-tag>
<el-tag
v-else
:type="tagStatus(valueActionDocument)"
>
{{ labelDocumentActions }}
</el-tag>
<p v-if="isEmptyValue(valueActionDocument)"> {{ field.description }} </p>
<p v-else> {{ descriptionDocumentActions }} </p>
<el-button
slot="reference"
type="text"
icon="el-icon-set-up"
/>
</el-popover>
</template>
<script>
export default {
name: 'FieldDocumentStatus',
props: {
field: {
type: Object,
required: true
}
},
data() {
return {
valueActionDocument: ''
}
},
computed: {
withoutRecord() {
// TODO: Validate with record attribute
if (this.isEmptyValue(this.$route.query.action) ||
['create-new', 'reference', 'advancedQuery', 'criteria'].includes(this.$route.query.action)) {
return true
}
return false
},
documentActions() {
return this.$store.getters.getListDocumentActions
},
listDocumentActions() {
return this.documentActions.documentActionsList
},
labelDocumentActions() {
const found = this.listDocumentActions.find(element => {
if (element.value === this.valueActionDocument) {
return element
}
})
if (this.isEmptyValue(found)) {
return this.valueActionDocument
}
return found.name
},
descriptionDocumentActions() {
const found = this.listDocumentActions.find(element => {
if (element.value === this.valueActionDocument) {
return element
}
})
if (this.isEmptyValue(found)) {
return this.valueActionDocument
}
return found.description
},
processOrderUuid() {
return this.$store.getters.getOrders
}
},
methods: {
listActionDocument(isShowList) {
if (isShowList) {
if (!this.withoutRecord && this.$route.query.action !== this.documentActions.recordUuid) {
this.$store.dispatch('listDocumentActionStatus', {
recordUuid: this.$route.query.action,
recordId: this.$route.params.recordId
})
}
}
},
documentActionChange(value) {
this.$store.dispatch('notifyFieldChange', {
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
columnName: 'DocAction',
isSendToServer: true,
newValue: value
})
const actionProcess = this.$store.getters.getOrders
this.$store.dispatch('startProcess', {
action: {
uuid: actionProcess.uuid,
id: actionProcess.id,
name: actionProcess.name
}, // process metadata
tableName: this.$route.params.tableName,
recordId: this.$route.params.recordId,
recordUuid: this.$route.query.action,
parametersList: [{
columnName: 'DocStatus',
value: this.valueActionDocument
}],
isActionDocument: true,
parentUuid: this.parentUuid,
panelType: this.panelType,
containerUuid: this.containerUuid// determinate if get table name and record id (window) or selection (browser)
})
this.valueActionDocument = ''
}
}
}
</script>