mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 23:20:12 +08:00
print label from table (#560)
* print label from table * minimal changes * correcting currency conversion errors * remove switch * minimal change
This commit is contained in:
parent
d63ef5aeb6
commit
0b9e4e7df4
@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<product-info-list />
|
<product-info-list
|
||||||
|
:report-asociated="process"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -10,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
import ProductInfoList from './productList'
|
import ProductInfoList from './productList'
|
||||||
import fieldMixin from '@/components/ADempiere/Field/mixin/mixinField.js'
|
import fieldMixin from '@/components/ADempiere/Field/mixin/mixinField.js'
|
||||||
|
import staticReportRoutes from '@/utils/ADempiere/constants/zoomReport'
|
||||||
import {
|
import {
|
||||||
formatPrice,
|
formatPrice,
|
||||||
formatQuantity
|
formatQuantity
|
||||||
@ -25,7 +28,8 @@ export default {
|
|||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
timeOut: null
|
timeOut: null,
|
||||||
|
process: staticReportRoutes
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -49,6 +53,9 @@ export default {
|
|||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
},
|
},
|
||||||
|
currentPos() {
|
||||||
|
return this.$store.getters.getCurrentPOS
|
||||||
|
},
|
||||||
keyShortcuts() {
|
keyShortcuts() {
|
||||||
return {
|
return {
|
||||||
refreshList: ['f5'],
|
refreshList: ['f5'],
|
||||||
@ -56,8 +63,16 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
// beforeMount() {
|
||||||
|
// if (this.isEmptyValue(this.currentPos)) {
|
||||||
|
// this.$store.dispatch('listPointOfSalesFromServer')
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
created() {
|
||||||
|
// if (this.isEmptyValue(this.currentPos)) {
|
||||||
this.$store.dispatch('listPointOfSalesFromServer')
|
this.$store.dispatch('listPointOfSalesFromServer')
|
||||||
|
this.findProcess(this.process)
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatPrice,
|
formatPrice,
|
||||||
@ -132,6 +147,13 @@ export default {
|
|||||||
// TODO: Verify with 'value' or 'searchValue' attribute
|
// TODO: Verify with 'value' or 'searchValue' attribute
|
||||||
value: valueProduct
|
value: valueProduct
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
findProcess(procces) {
|
||||||
|
// if (this.isEmptyValue(this.currentPos)) {
|
||||||
|
procces.forEach(report => {
|
||||||
|
this.$store.dispatch('getProcessFromServer', { containerUuid: report.uuid })
|
||||||
|
})
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
:metadata-field="field"
|
:metadata-field="field"
|
||||||
/>
|
/>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
ref="singleTable"
|
ref="singleTable"
|
||||||
v-loading="!productPrice.isLoaded"
|
v-loading="!productPrice.isLoaded"
|
||||||
@ -54,7 +53,7 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
:label="$t('form.productInfo.quantityOnHand')"
|
:label="$t('form.productInfo.quantityOnHand')"
|
||||||
align="right"
|
align="right"
|
||||||
width="200"
|
width="100"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ formatQuantity(scope.row.quantityOnHand) }}
|
{{ formatQuantity(scope.row.quantityOnHand) }}
|
||||||
@ -63,7 +62,6 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
:label="$t('form.productInfo.price')"
|
:label="$t('form.productInfo.price')"
|
||||||
align="right"
|
align="right"
|
||||||
width="200"
|
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ formatPrice(scope.row.priceStandard, scope.row.currency.iSOCode) }}
|
{{ formatPrice(scope.row.priceStandard, scope.row.currency.iSOCode) }}
|
||||||
@ -72,7 +70,7 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
:label="$t('form.productInfo.taxAmount')"
|
:label="$t('form.productInfo.taxAmount')"
|
||||||
align="right"
|
align="right"
|
||||||
width="150"
|
width="200"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ formatPrice(getTaxAmount(scope.row.priceStandard, scope.row.taxRate.rate), scope.row.currency.iSOCode) }}
|
{{ formatPrice(getTaxAmount(scope.row.priceStandard, scope.row.taxRate.rate), scope.row.currency.iSOCode) }}
|
||||||
@ -87,6 +85,28 @@
|
|||||||
{{ formatPrice(getTaxAmount(scope.row.priceStandard, scope.row.taxRate.rate) + scope.row.priceStandard, scope.row.currency.iSOCode) }}
|
{{ formatPrice(getTaxAmount(scope.row.priceStandard, scope.row.taxRate.rate) + scope.row.priceStandard, scope.row.currency.iSOCode) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label=""
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-dropdown trigger="click">
|
||||||
|
<span class="el-dropdown-link">
|
||||||
|
{{ $t('form.pos.tableProduct.options') }}
|
||||||
|
<i class="el-icon-arrow-down el-icon--right" />
|
||||||
|
</span>
|
||||||
|
<el-dropdown-menu slot="dropdown" style="padding-bottom: 0px;">
|
||||||
|
<span v-show="!isEmptyValue(process)">
|
||||||
|
<el-dropdown-item v-for="(report, key) in process" :key="key" icon="el-icon-document">
|
||||||
|
<span @click="associatedprocesses(scope.row.product.id, report)">
|
||||||
|
{{ report.name }}
|
||||||
|
</span>
|
||||||
|
</el-dropdown-item>
|
||||||
|
</span>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<custom-pagination
|
<custom-pagination
|
||||||
:total="productPrice.recordCount"
|
:total="productPrice.recordCount"
|
||||||
@ -127,6 +147,12 @@ export default {
|
|||||||
popoverName: {
|
popoverName: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'isShowPopoverField'
|
default: 'isShowPopoverField'
|
||||||
|
},
|
||||||
|
reportAsociated: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -135,7 +161,8 @@ export default {
|
|||||||
resource: {},
|
resource: {},
|
||||||
fieldsList: fieldsListProductPrice,
|
fieldsList: fieldsListProductPrice,
|
||||||
isCustomForm: true,
|
isCustomForm: true,
|
||||||
timeOut: null
|
timeOut: null,
|
||||||
|
indexTable: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -160,13 +187,38 @@ export default {
|
|||||||
},
|
},
|
||||||
shortsKey() {
|
shortsKey() {
|
||||||
return {
|
return {
|
||||||
closeProductList: ['esc'],
|
options: ['enter'],
|
||||||
refreshList: ['enter']
|
up: ['arrowup'],
|
||||||
|
down: ['arrowdown']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isReadyFromGetData() {
|
isReadyFromGetData() {
|
||||||
const { isLoaded, isReload } = this.productPrice
|
const { isLoaded, isReload } = this.productPrice
|
||||||
return (!isLoaded || isReload) // && this.isShowProductsPriceList
|
return (!isLoaded || isReload) // && this.isShowProductsPriceList
|
||||||
|
},
|
||||||
|
listPrice() {
|
||||||
|
const pos = this.$store.getters.getCurrentPOS
|
||||||
|
if (!this.isEmptyValue(pos)) {
|
||||||
|
return pos.priceList.id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
},
|
||||||
|
process() {
|
||||||
|
if (!this.isEmptyValue(this.reportAsociated)) {
|
||||||
|
const process = this.reportAsociated.map(element => {
|
||||||
|
const findProcess = this.$store.getters.getProcess(element.uuid)
|
||||||
|
if (!this.isEmptyValue(findProcess)) {
|
||||||
|
return {
|
||||||
|
...element,
|
||||||
|
name: findProcess.name,
|
||||||
|
id: findProcess.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
})
|
||||||
|
return process
|
||||||
|
}
|
||||||
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -174,6 +226,9 @@ export default {
|
|||||||
if (isToLoad) {
|
if (isToLoad) {
|
||||||
this.loadProductsPricesList()
|
this.loadProductsPricesList()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
indexTable(value) {
|
||||||
|
this.setCurrent(this.listWithPrice[value])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -206,6 +261,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleCurrentChange(val) {
|
handleCurrentChange(val) {
|
||||||
this.currentRow = val
|
this.currentRow = val
|
||||||
|
this.findPosition(val)
|
||||||
this.setCurrent(this.currentRow)
|
this.setCurrent(this.currentRow)
|
||||||
},
|
},
|
||||||
keyAction(event) {
|
keyAction(event) {
|
||||||
@ -224,6 +280,19 @@ export default {
|
|||||||
isShowed: false
|
isShowed: false
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
|
case 'down':
|
||||||
|
if (this.indexTable < (this.listWithPrice.length - 1)) {
|
||||||
|
this.indexTable++
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'up':
|
||||||
|
if (this.indexTable > 0) {
|
||||||
|
this.indexTable--
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'options':
|
||||||
|
this.$store.commit('setIsReloadProductPrice')
|
||||||
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadProductsPricesList() {
|
loadProductsPricesList() {
|
||||||
@ -259,6 +328,23 @@ export default {
|
|||||||
}
|
}
|
||||||
return (basePrice * taxRate) / 100
|
return (basePrice * taxRate) / 100
|
||||||
},
|
},
|
||||||
|
associatedprocesses(product, report) {
|
||||||
|
report.parametersList.push({ columnName: 'M_Product_ID', value: product }, { columnName: 'M_PriceList_ID', value: this.listPrice })
|
||||||
|
this.$store.dispatch('processOption', {
|
||||||
|
action: report,
|
||||||
|
parametersList: report.parametersList,
|
||||||
|
reportFormat: 'pdf',
|
||||||
|
routeToDelete: this.$route
|
||||||
|
})
|
||||||
|
},
|
||||||
|
findPosition(current) {
|
||||||
|
const arrow = this.listWithPrice.findIndex(element => {
|
||||||
|
if (element.product.id === current.product.id) {
|
||||||
|
return element
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.indexTable = arrow
|
||||||
|
},
|
||||||
subscribeChanges() {
|
subscribeChanges() {
|
||||||
return this.$store.subscribe((mutation, state) => {
|
return this.$store.subscribe((mutation, state) => {
|
||||||
// if (!this.isEmptyValue(this.listWithPrice)) {
|
// if (!this.isEmptyValue(this.listWithPrice)) {
|
||||||
@ -270,7 +356,9 @@ export default {
|
|||||||
clearTimeout(this.timeOut)
|
clearTimeout(this.timeOut)
|
||||||
this.timeOut = setTimeout(() => {
|
this.timeOut = setTimeout(() => {
|
||||||
this.$store.dispatch('updateSearch', mutation.payload.value)
|
this.$store.dispatch('updateSearch', mutation.payload.value)
|
||||||
this.$store.commit('setIsReloadProductPrice')
|
if (this.productPrice.isLoaded) {
|
||||||
|
this.$store.commit('setIsReloadProductPrice')
|
||||||
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -414,12 +414,14 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
currencyUuid(value) {
|
currencyUuid(value) {
|
||||||
this.$store.dispatch('conversionDivideRate', {
|
if (!this.isEmptyValue(value)) {
|
||||||
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
|
this.$store.dispatch('conversionDivideRate', {
|
||||||
currencyFromUuid: this.currencyPoint.uuid,
|
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
|
||||||
currencyToUuid: value,
|
currencyFromUuid: this.currencyPoint.uuid,
|
||||||
conversionDate: this.currentOrder.dateOrdered
|
currencyToUuid: value,
|
||||||
})
|
conversionDate: this.currentOrder.dateOrdered
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
convertAllPayment(value) {
|
convertAllPayment(value) {
|
||||||
if (!this.isEmptyValue(value)) {
|
if (!this.isEmptyValue(value)) {
|
||||||
@ -428,12 +430,16 @@ export default {
|
|||||||
this.allPayCurrency = this.pay
|
this.allPayCurrency = this.pay
|
||||||
},
|
},
|
||||||
converCurrency(value) {
|
converCurrency(value) {
|
||||||
this.$store.dispatch('conversionMultiplyRate', {
|
if (!this.isEmptyValue(value)) {
|
||||||
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
|
this.$store.dispatch('conversionMultiplyRate', {
|
||||||
currencyFromUuid: this.currencyPoint.uuid,
|
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
|
||||||
currencyToUuid: value,
|
currencyFromUuid: this.currencyPoint.uuid,
|
||||||
conversionDate: this.currentOrder.dateOrdered
|
currencyToUuid: value,
|
||||||
})
|
conversionDate: this.currentOrder.dateOrdered
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$store.commit('currencyMultiplyRate', 1)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
isLoaded(value) {
|
isLoaded(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
@ -234,7 +234,27 @@
|
|||||||
<p class="total"> {{ $t('form.pos.order.subTotal') }}:<b class="order-info">{{ formatPrice(order.totalLines, currencyPoint.iSOCode) }}</b></p>
|
<p class="total"> {{ $t('form.pos.order.subTotal') }}:<b class="order-info">{{ formatPrice(order.totalLines, currencyPoint.iSOCode) }}</b></p>
|
||||||
<p class="total"> {{ $t('form.pos.order.discount') }}:<b class="order-info">{{ formatPrice(0, currencyPoint.iSOCode) }}</b> </p>
|
<p class="total"> {{ $t('form.pos.order.discount') }}:<b class="order-info">{{ formatPrice(0, currencyPoint.iSOCode) }}</b> </p>
|
||||||
<p class="total"> {{ $t('form.pos.order.tax') }}:<b style="float: right;">{{ getOrderTax(currencyPoint.iSOCode) }}</b> </p>
|
<p class="total"> {{ $t('form.pos.order.tax') }}:<b style="float: right;">{{ getOrderTax(currencyPoint.iSOCode) }}</b> </p>
|
||||||
<p class="total"><b>{{ $t('form.pos.order.total') }}:</b><b style="float: right;">{{ formatPrice(order.grandTotal, currencyPoint.iSOCode) }}</b></p>
|
<p class="total">
|
||||||
|
<b>
|
||||||
|
{{ $t('form.pos.order.total') }}:
|
||||||
|
</b>
|
||||||
|
<b style="float: right;">
|
||||||
|
<el-popover
|
||||||
|
placement="top-start"
|
||||||
|
trigger="click"
|
||||||
|
>
|
||||||
|
<convert-amount
|
||||||
|
:convert="multiplyRate"
|
||||||
|
:amount="order.grandTotal"
|
||||||
|
:currency="currencyPoint"
|
||||||
|
/>
|
||||||
|
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;">
|
||||||
|
{{ formatPrice(order.grandTotal, currencyPoint.iSOCode) }}
|
||||||
|
</el-button>
|
||||||
|
</el-popover>
|
||||||
|
<!-- {{ formatPrice(order.grandTotal, currencyPoint.iSOCode) }} -->
|
||||||
|
</b>
|
||||||
|
</p>
|
||||||
</span>
|
</span>
|
||||||
<span style="float: right;padding-right: 40px;">
|
<span style="float: right;padding-right: 40px;">
|
||||||
<p class="total">{{ $t('form.pos.order.order') }}: <b class="order-info">{{ order.documentNo }}</b></p>
|
<p class="total">{{ $t('form.pos.order.order') }}: <b class="order-info">{{ order.documentNo }}</b></p>
|
||||||
@ -288,12 +308,14 @@ import fieldsListOrder from './fieldsListOrder.js'
|
|||||||
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
|
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
|
||||||
import BusinessPartner from '@/components/ADempiere/Form/VPOS/BusinessPartner'
|
import BusinessPartner from '@/components/ADempiere/Form/VPOS/BusinessPartner'
|
||||||
import ProductInfo from '@/components/ADempiere/Form/VPOS/ProductInfo'
|
import ProductInfo from '@/components/ADempiere/Form/VPOS/ProductInfo'
|
||||||
|
import convertAmount from '@/components/ADempiere/Form/VPOS/Collection/convertAmount/index'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Order',
|
name: 'Order',
|
||||||
components: {
|
components: {
|
||||||
BusinessPartner,
|
BusinessPartner,
|
||||||
ProductInfo
|
ProductInfo,
|
||||||
|
convertAmount
|
||||||
},
|
},
|
||||||
mixins: [
|
mixins: [
|
||||||
formMixin,
|
formMixin,
|
||||||
@ -368,6 +390,49 @@ export default {
|
|||||||
iSOCode: '',
|
iSOCode: '',
|
||||||
curSymbol: ''
|
curSymbol: ''
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
multiplyRate() {
|
||||||
|
return this.$store.getters.getMultiplyRate
|
||||||
|
},
|
||||||
|
converCurrency() {
|
||||||
|
return this.$store.getters.getValueOfField({
|
||||||
|
containerUuid: 'Collection-Convert-Amount',
|
||||||
|
columnName: 'C_Currency_ID_UUID'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
currencyUuid() {
|
||||||
|
return this.$store.getters.getValueOfField({
|
||||||
|
containerUuid: this.containerUuid,
|
||||||
|
columnName: 'C_Currency_ID_UUID'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
displayeTypeCurrency() {
|
||||||
|
return this.$store.getters.getValueOfField({
|
||||||
|
containerUuid: this.containerUuid,
|
||||||
|
columnName: 'DisplayColumn_C_Currency_ID'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
currencyUuid(value) {
|
||||||
|
if (!this.isEmptyValue(value)) {
|
||||||
|
this.$store.dispatch('conversionDivideRate', {
|
||||||
|
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
|
||||||
|
currencyFromUuid: this.currencyPoint.uuid,
|
||||||
|
currencyToUuid: value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
converCurrency(value) {
|
||||||
|
if (!this.isEmptyValue(value)) {
|
||||||
|
this.$store.dispatch('conversionMultiplyRate', {
|
||||||
|
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
|
||||||
|
currencyFromUuid: this.currencyPoint.uuid,
|
||||||
|
currencyToUuid: value
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$store.commit('currencyMultiplyRate', 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -528,7 +593,12 @@ export default {
|
|||||||
color: #333;
|
color: #333;
|
||||||
line-height: 10px;
|
line-height: 10px;
|
||||||
}
|
}
|
||||||
|
.el-button--text {
|
||||||
|
border-color: transparent;
|
||||||
|
color: #1890ff;
|
||||||
|
background: transparent;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
.el-aside {
|
.el-aside {
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
@ -77,31 +77,28 @@ const collection = {
|
|||||||
conversionMultiplyRate({ commit }, {
|
conversionMultiplyRate({ commit }, {
|
||||||
conversionTypeUuid,
|
conversionTypeUuid,
|
||||||
currencyFromUuid,
|
currencyFromUuid,
|
||||||
currencyToUuid,
|
currencyToUuid
|
||||||
conversionDate
|
// conversionDate
|
||||||
}) {
|
}) {
|
||||||
return Promise(resolve => {
|
requestGetConversionRate({
|
||||||
requestGetConversionRate({
|
conversionTypeUuid,
|
||||||
conversionTypeUuid,
|
currencyFromUuid,
|
||||||
currencyFromUuid,
|
currencyToUuid
|
||||||
currencyToUuid,
|
// conversionDate
|
||||||
conversionDate
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
const multiplyRate = isEmptyValue(response.multiplyRate) ? 1 : response.multiplyRate
|
|
||||||
|
|
||||||
commit('currencyMultiplyRate', multiplyRate)
|
|
||||||
resolve(multiplyRate)
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.warn(`conversionMultiplyRate: ${error.message}. Code: ${error.code}.`)
|
|
||||||
showMessage({
|
|
||||||
type: 'error',
|
|
||||||
message: error.message,
|
|
||||||
showClose: true
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
.then(response => {
|
||||||
|
const multiplyRate = isEmptyValue(response.multiplyRate) ? 1 : response.multiplyRate
|
||||||
|
|
||||||
|
commit('currencyMultiplyRate', multiplyRate)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.warn(`conversionMultiplyRate: ${error.message}. Code: ${error.code}.`)
|
||||||
|
showMessage({
|
||||||
|
type: 'error',
|
||||||
|
message: error.message,
|
||||||
|
showClose: true
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
changeMultiplyRate({ commit }, params) {
|
changeMultiplyRate({ commit }, params) {
|
||||||
commit('currencyMultiplyRate', params)
|
commit('currencyMultiplyRate', params)
|
||||||
|
@ -49,7 +49,6 @@ const pointOfSales = {
|
|||||||
*/
|
*/
|
||||||
listPointOfSalesFromServer({ commit, getters, dispatch }, posToSet = null) {
|
listPointOfSalesFromServer({ commit, getters, dispatch }, posToSet = null) {
|
||||||
const userUuid = getters['user/getUserUuid']
|
const userUuid = getters['user/getUserUuid']
|
||||||
|
|
||||||
requestListPointOfSales({
|
requestListPointOfSales({
|
||||||
userUuid
|
userUuid
|
||||||
})
|
})
|
||||||
|
@ -114,7 +114,7 @@ const processControl = {
|
|||||||
containerUuid,
|
containerUuid,
|
||||||
panelType,
|
panelType,
|
||||||
action,
|
action,
|
||||||
parametersList = [],
|
parametersList,
|
||||||
reportFormat,
|
reportFormat,
|
||||||
isProcessTableSelection,
|
isProcessTableSelection,
|
||||||
isActionDocument,
|
isActionDocument,
|
||||||
@ -660,6 +660,236 @@ const processControl = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
processOption({ commit, dispatch, getters, rootGetters }, {
|
||||||
|
parentUuid,
|
||||||
|
containerUuid,
|
||||||
|
panelType,
|
||||||
|
action,
|
||||||
|
parametersList = [],
|
||||||
|
reportFormat,
|
||||||
|
menuParentUuid,
|
||||||
|
routeToDelete
|
||||||
|
}) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
// get info metadata process
|
||||||
|
const processDefinition = rootGetters.getProcess(action.uuid)
|
||||||
|
const reportType = reportFormat
|
||||||
|
|
||||||
|
const isSession = !isEmptyValue(getToken())
|
||||||
|
let procesingMessage = {
|
||||||
|
close: () => false
|
||||||
|
}
|
||||||
|
if (isSession) {
|
||||||
|
procesingMessage = showNotification({
|
||||||
|
title: language.t('notifications.processing'),
|
||||||
|
message: processDefinition.name,
|
||||||
|
summary: processDefinition.description,
|
||||||
|
type: 'info'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const timeInitialized = (new Date()).getTime()
|
||||||
|
let processResult = {
|
||||||
|
// panel attributes from where it was executed
|
||||||
|
parentUuid,
|
||||||
|
containerUuid,
|
||||||
|
panelType,
|
||||||
|
lastRun: timeInitialized,
|
||||||
|
parametersList,
|
||||||
|
logs: [],
|
||||||
|
isError: false,
|
||||||
|
isProcessing: true,
|
||||||
|
summary: '',
|
||||||
|
resultTableName: '',
|
||||||
|
output: {
|
||||||
|
uuid: '',
|
||||||
|
name: '',
|
||||||
|
description: '',
|
||||||
|
fileName: '',
|
||||||
|
output: '',
|
||||||
|
outputStream: '',
|
||||||
|
reportType: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Run process on server and wait for it for notify
|
||||||
|
// uuid of process
|
||||||
|
processResult = {
|
||||||
|
...processResult,
|
||||||
|
menuParentUuid,
|
||||||
|
processIdPath: routeToDelete.path,
|
||||||
|
printFormatUuid: '',
|
||||||
|
// process attributes
|
||||||
|
action: processDefinition.name,
|
||||||
|
name: processDefinition.name,
|
||||||
|
description: processDefinition.description,
|
||||||
|
instanceUuid: '',
|
||||||
|
processUuid: processDefinition.uuid,
|
||||||
|
processId: processDefinition.id,
|
||||||
|
processName: processDefinition.processName,
|
||||||
|
parameters: parametersList,
|
||||||
|
isReport: processDefinition.isReport
|
||||||
|
}
|
||||||
|
commit('addInExecution', processResult)
|
||||||
|
requestRunProcess({
|
||||||
|
uuid: processDefinition.uuid,
|
||||||
|
id: processDefinition.id,
|
||||||
|
reportType,
|
||||||
|
parametersList
|
||||||
|
})
|
||||||
|
.then(runProcessResponse => {
|
||||||
|
const { instanceUuid, output } = runProcessResponse
|
||||||
|
let logList = []
|
||||||
|
if (!isEmptyValue(runProcessResponse.logsList)) {
|
||||||
|
logList = runProcessResponse.logsList
|
||||||
|
}
|
||||||
|
|
||||||
|
let link = {
|
||||||
|
href: undefined,
|
||||||
|
download: undefined
|
||||||
|
}
|
||||||
|
if ((runProcessResponse.isReport || processDefinition.isReport) && output.outputStream) {
|
||||||
|
const reportObject = Object.values(output.outputStream)
|
||||||
|
const blob = new Blob([Uint8Array.from(reportObject)], {
|
||||||
|
type: output.mimeType
|
||||||
|
})
|
||||||
|
link = document.createElement('a')
|
||||||
|
link.href = window.URL.createObjectURL(blob)
|
||||||
|
link.download = output.fileName
|
||||||
|
if (reportType !== 'pdf' && reportType !== 'html') {
|
||||||
|
link.click()
|
||||||
|
}
|
||||||
|
const contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid)
|
||||||
|
// Report views List to context menu
|
||||||
|
const reportViewList = {
|
||||||
|
name: language.t('views.reportView'),
|
||||||
|
type: 'summary',
|
||||||
|
action: '',
|
||||||
|
childs: [],
|
||||||
|
option: 'reportView'
|
||||||
|
}
|
||||||
|
reportViewList.childs = getters.getReportViewList(processResult.processUuid)
|
||||||
|
if (reportViewList && !reportViewList.childs.length) {
|
||||||
|
dispatch('getReportViewsFromServer', {
|
||||||
|
processUuid: processResult.processUuid,
|
||||||
|
instanceUuid,
|
||||||
|
processId: processDefinition.id,
|
||||||
|
tableName: output.tableName,
|
||||||
|
printFormatUuid: output.printFormatUuid,
|
||||||
|
reportViewUuid: output.reportViewUuid
|
||||||
|
})
|
||||||
|
.then(responseReportView => {
|
||||||
|
reportViewList.childs = responseReportView
|
||||||
|
if (reportViewList.childs.length) {
|
||||||
|
// Get contextMenu metadata and concat print report views with contextMenu actions
|
||||||
|
contextMenuMetadata.actions.push(reportViewList)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print formats to context menu
|
||||||
|
const printFormatList = {
|
||||||
|
name: language.t('views.printFormat'),
|
||||||
|
type: 'summary',
|
||||||
|
action: '',
|
||||||
|
childs: [],
|
||||||
|
option: 'printFormat'
|
||||||
|
}
|
||||||
|
printFormatList.childs = rootGetters.getPrintFormatList(processResult.processUuid)
|
||||||
|
if (printFormatList && !printFormatList.childs.length) {
|
||||||
|
dispatch('getListPrintFormats', {
|
||||||
|
processUuid: processResult.processUuid,
|
||||||
|
instanceUuid,
|
||||||
|
processId: processDefinition.id,
|
||||||
|
tableName: output.tableName,
|
||||||
|
printFormatUuid: output.printFormatUuid,
|
||||||
|
reportViewUuid: output.reportViewUuid
|
||||||
|
})
|
||||||
|
.then(printFormarResponse => {
|
||||||
|
printFormatList.childs = printFormarResponse
|
||||||
|
if (printFormatList.childs.length) {
|
||||||
|
// Get contextMenu metadata and concat print Format List with contextMenu actions
|
||||||
|
contextMenuMetadata.actions.push(printFormatList)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
const index = contextMenuMetadata.actions.findIndex(action => action.option === 'printFormat')
|
||||||
|
if (index !== -1) {
|
||||||
|
contextMenuMetadata.actions[index] = printFormatList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drill Tables to context menu
|
||||||
|
const drillTablesList = {
|
||||||
|
name: language.t('views.drillTable'),
|
||||||
|
type: 'summary',
|
||||||
|
action: '',
|
||||||
|
childs: [],
|
||||||
|
option: 'drillTable'
|
||||||
|
}
|
||||||
|
if (!isEmptyValue(output.tableName)) {
|
||||||
|
drillTablesList.childs = rootGetters.getDrillTablesList(processResult.processUuid)
|
||||||
|
if (drillTablesList && isEmptyValue(drillTablesList.childs)) {
|
||||||
|
dispatch('getDrillTablesFromServer', {
|
||||||
|
processUuid: processResult.processUuid,
|
||||||
|
instanceUuid,
|
||||||
|
processId: processDefinition.id,
|
||||||
|
tableName: output.tableName,
|
||||||
|
printFormatUuid: output.printFormatUuid,
|
||||||
|
reportViewUuid: output.reportViewUuid
|
||||||
|
})
|
||||||
|
.then(drillTablesResponse => {
|
||||||
|
drillTablesList.childs = drillTablesResponse
|
||||||
|
if (drillTablesList.childs.length) {
|
||||||
|
// Get contextMenu metadata and concat print Format List with contextMenu actions
|
||||||
|
contextMenuMetadata.actions.push(drillTablesList)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// assign new attributes
|
||||||
|
Object.assign(processResult, {
|
||||||
|
...runProcessResponse,
|
||||||
|
url: link.href,
|
||||||
|
download: link.download,
|
||||||
|
logs: logList,
|
||||||
|
output
|
||||||
|
})
|
||||||
|
resolve(processResult)
|
||||||
|
if (!isEmptyValue(processResult.output)) {
|
||||||
|
dispatch('setReportTypeToShareLink', processResult.output.reportType)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
Object.assign(processResult, {
|
||||||
|
isError: true,
|
||||||
|
message: error.message,
|
||||||
|
isProcessing: false
|
||||||
|
})
|
||||||
|
console.warn(`Error running the process ${error.message}. Code: ${error.code}.`)
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
commit('addNotificationProcess', processResult)
|
||||||
|
dispatch('finishProcess', {
|
||||||
|
processOutput: processResult,
|
||||||
|
procesingMessage
|
||||||
|
})
|
||||||
|
|
||||||
|
commit('deleteInExecution', {
|
||||||
|
containerUuid
|
||||||
|
})
|
||||||
|
|
||||||
|
dispatch('setProcessTable', {
|
||||||
|
valueRecord: 0,
|
||||||
|
tableName: '',
|
||||||
|
processTable: false
|
||||||
|
})
|
||||||
|
dispatch('setProcessSelect', {
|
||||||
|
finish: true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
// Supported to process selection
|
// Supported to process selection
|
||||||
selectionProcess({ commit, state, dispatch, getters, rootGetters }, {
|
selectionProcess({ commit, state, dispatch, getters, rootGetters }, {
|
||||||
parentUuid,
|
parentUuid,
|
||||||
@ -946,7 +1176,7 @@ const processControl = {
|
|||||||
}
|
}
|
||||||
if (processOutput.isReport && !processOutput.isError) {
|
if (processOutput.isReport && !processOutput.isError) {
|
||||||
// open report viewer with report response
|
// open report viewer with report response
|
||||||
let menuParentUuid = routeToDelete.params.menuParentUuid
|
let menuParentUuid = isEmptyValue(routeToDelete) ? '' : routeToDelete.params.menuParentUuid
|
||||||
if (isEmptyValue(menuParentUuid)) {
|
if (isEmptyValue(menuParentUuid)) {
|
||||||
menuParentUuid = processOutput.menuParentUuid
|
menuParentUuid = processOutput.menuParentUuid
|
||||||
}
|
}
|
||||||
|
15
src/utils/ADempiere/constants/zoomReport.js
Normal file
15
src/utils/ADempiere/constants/zoomReport.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
const today = new Date()
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
uuid: '92b9a696-adba-4409-a200-7df0ba74cb63',
|
||||||
|
action: 'processOption',
|
||||||
|
tabChild: undefined,
|
||||||
|
parametersList: [{ columnName: 'ValidFrom', value: today }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uuid: '78b249ee-613e-4241-a2c1-00243fa36470',
|
||||||
|
action: 'processOption',
|
||||||
|
tabChild: undefined,
|
||||||
|
parametersList: [{ columnName: 'ValidFrom', value: today }, { columnName: 'MustBeStocked', value: false }]
|
||||||
|
}
|
||||||
|
]
|
@ -108,7 +108,6 @@ export default {
|
|||||||
return this.formMetadata.name || this.$route.meta.title
|
return this.formMetadata.name || this.$route.meta.title
|
||||||
},
|
},
|
||||||
fromFileName() {
|
fromFileName() {
|
||||||
console.log(this.$route)
|
|
||||||
return this.formMetadata.fileName || this.$route.meta.title
|
return this.formMetadata.fileName || this.$route.meta.title
|
||||||
},
|
},
|
||||||
getterForm() {
|
getterForm() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user