mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-07 18:25:45 +08:00
Support for the Read Weight form (From Scale) (#945)
* Support Get Weight * changing the position of the buttons Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
5a5f32d934
commit
fec1832f42
@ -36,5 +36,8 @@
|
||||
},
|
||||
"match": {
|
||||
"endpoint": "/form/addons/match"
|
||||
},
|
||||
"Weight": {
|
||||
"endpoint": "/form/addons/weight"
|
||||
}
|
||||
}
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -17884,9 +17884,15 @@
|
||||
}
|
||||
},
|
||||
"vue-loader-v16": {
|
||||
<<<<<<< HEAD
|
||||
"version": "npm:vue-loader@16.4.1",
|
||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.4.1.tgz",
|
||||
"integrity": "sha512-nL1bDhfMAZgTVmVkOXQaK/WJa9zFDLM9vKHbh5uGv6HeH1TmZrXMWUEVhUrACT38XPhXM4Awtjj25EvhChEgXw==",
|
||||
=======
|
||||
"version": "npm:vue-loader@16.5.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.5.0.tgz",
|
||||
"integrity": "sha512-WXh+7AgFxGTgb5QAkQtFeUcHNIEq3PGVQ8WskY5ZiFbWBkOwcCPRs4w/2tVyTbh2q6TVRlO3xfvIukUtjsu62A==",
|
||||
>>>>>>> develop
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
|
44
src/api/ADempiere/form/weight.js
Normal file
44
src/api/ADempiere/form/weight.js
Normal file
@ -0,0 +1,44 @@
|
||||
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
|
||||
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
|
||||
// Contributor(s): Yamel Senih ysenih@erpya.com www.erpya.com
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import { request } from '@/utils/ADempiere/request'
|
||||
import { config } from '@/utils/ADempiere/config'
|
||||
|
||||
// Get Weight
|
||||
export function getWeight({
|
||||
idScale
|
||||
}) {
|
||||
return request({
|
||||
url: `${config.Weight.endpoint}/weight`,
|
||||
method: 'get',
|
||||
params: {
|
||||
id_scale: idScale
|
||||
}
|
||||
})
|
||||
.then(weightResponse => {
|
||||
return weightResponse
|
||||
})
|
||||
}
|
||||
// List Scale
|
||||
export function getListScale() {
|
||||
return request({
|
||||
url: `${config.Weight.endpoint}/scale`,
|
||||
method: 'get'
|
||||
})
|
||||
.then(scaleResponse => {
|
||||
return scaleResponse
|
||||
})
|
||||
}
|
169
src/components/ADempiere/Form/VGetWeight/index.vue
Normal file
169
src/components/ADempiere/Form/VGetWeight/index.vue
Normal file
@ -0,0 +1,169 @@
|
||||
<!--
|
||||
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
|
||||
Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
|
||||
Contributor(s): Edwin Betancourt edwinBetanc0urt@hotmail.com www.erpya.com
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https:www.gnu.org/licenses/>.
|
||||
-->
|
||||
<template>
|
||||
<el-card shadow="always" class="box-card">
|
||||
<el-container>
|
||||
<el-header class="header">
|
||||
<el-container :class="'container-number' + isMobile">
|
||||
<el-aside :class="'aside' + isMobile">
|
||||
<h1 class="title">
|
||||
{{
|
||||
$t('form.weight')
|
||||
}}
|
||||
</h1> <br>
|
||||
</el-aside>
|
||||
<el-main class="main">
|
||||
<el-row style="height: 100%; border: 1px solid #eee;">
|
||||
<el-col :span="24" style="height: 100%">
|
||||
<p class="weight">
|
||||
{{
|
||||
weight
|
||||
}}
|
||||
</p>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-header>
|
||||
<el-main class="main">
|
||||
<template v-if="!isEmptyValue(scales)">
|
||||
<el-button
|
||||
v-for="(scale, key) in scales"
|
||||
:key="key"
|
||||
type="primary"
|
||||
plain
|
||||
class="button-scale"
|
||||
@click="selectScale(scale)"
|
||||
>
|
||||
{{ scale.name }}
|
||||
</el-button>
|
||||
</template>
|
||||
<el-button type="primary" icon="el-icon-check" class="button-action" />
|
||||
<el-button type="danger" icon="el-icon-close" class="button-action" />
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getListScale, getWeight } from '@/api/ADempiere/form/weight.js'
|
||||
|
||||
export default {
|
||||
name: 'VGetWeight',
|
||||
data() {
|
||||
return {
|
||||
weight: 0,
|
||||
scales: [],
|
||||
currentScale: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
device() {
|
||||
return this.$store.state.app.device
|
||||
},
|
||||
isMobile() {
|
||||
if (this.device === 'mobile') {
|
||||
return '-mobile'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getLlistScale()
|
||||
if (!this.isEmptyValue(this.currentScale)) {
|
||||
this.selectScale(this.currentScale)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getListScale,
|
||||
getWeight,
|
||||
getLlistScale() {
|
||||
console.log('getLlistScale')
|
||||
this.getListScale()
|
||||
.then(response => {
|
||||
this.scales = response
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting listScale: ${error.message}. Code: ${error.code}.`)
|
||||
})
|
||||
},
|
||||
selectScale(scale) {
|
||||
console.log('selectScale')
|
||||
this.getWeight({
|
||||
idScale: scale.id
|
||||
})
|
||||
.then(scale => {
|
||||
this.weight = scale.weight
|
||||
this.currentScale = scale
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn(`Error getting getWeight: ${error.message}. Code: ${error.code}.`)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.header {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
height: -webkit-fill-available !important;
|
||||
display: contents;
|
||||
}
|
||||
.main {
|
||||
padding: 0px;
|
||||
overflow: hidden;
|
||||
display: inline-table;
|
||||
}
|
||||
aside {
|
||||
background: white;
|
||||
width: 20%;
|
||||
overflow: hidden;
|
||||
height: 130% !important;
|
||||
}
|
||||
.aside-mobile {
|
||||
background: white;
|
||||
width: 64%!important;
|
||||
overflow: hidden;
|
||||
height: 65% !important;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
.weight {
|
||||
font-size: 140px;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
line-height: 100%;
|
||||
}
|
||||
.button-action {
|
||||
float: right;
|
||||
}
|
||||
.button-scale {
|
||||
float: left;
|
||||
}
|
||||
.container-number-mobile {
|
||||
display: contents
|
||||
}
|
||||
.title {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
margin-top: 15%;
|
||||
font-size: 5em;
|
||||
}
|
||||
</style>
|
@ -63,6 +63,9 @@ export default {
|
||||
case 'VPOS':
|
||||
form = import('@/components/ADempiere/Form/VPOS')
|
||||
break
|
||||
case 'VGetWeight':
|
||||
form = import('@/components/ADempiere/Form/VGetWeight')
|
||||
break
|
||||
default:
|
||||
form = import('@/views/ADempiere/Unsupported')
|
||||
break
|
||||
|
@ -611,6 +611,7 @@ export default {
|
||||
table: {
|
||||
nrDocument: 'Nr Document'
|
||||
}
|
||||
}
|
||||
},
|
||||
weight: 'Weight'
|
||||
}
|
||||
}
|
||||
|
@ -593,6 +593,7 @@ export default {
|
||||
table: {
|
||||
nrDocument: 'Nr Docuemnto'
|
||||
}
|
||||
}
|
||||
},
|
||||
weight: 'Peso'
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@
|
||||
>
|
||||
<el-button
|
||||
type="text"
|
||||
style="float: right"
|
||||
style="float: right; z-index: 5"
|
||||
:circle="true"
|
||||
icon="el-icon-arrow-up"
|
||||
@click="changeDisplatedTitle"
|
||||
|
Loading…
x
Reference in New Issue
Block a user