1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +08:00

* correcting price query errors with the barcode (#546)

* add show or hide header
* add show or hide menu
This commit is contained in:
Elsio Sanchez 2020-11-23 22:13:43 -04:00 committed by GitHub
parent d6f52a70e3
commit 486afc8aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 135 additions and 80 deletions

View File

@ -271,6 +271,7 @@ export function requestResource({ resourceUuid }, callBack = {
/** /**
* Get image with uri request * Get image with uri request
* @author EdwinBetanc0urt <EdwinBetanc0urt@oulook.com> * @author EdwinBetanc0urt <EdwinBetanc0urt@oulook.com>
* @author Elsio15 <elsiiosanches@gmail.com>
* @param {string} file * @param {string} file
* @param {number} width * @param {number} width
* @param {number} height * @param {number} height
@ -279,8 +280,8 @@ export function requestResource({ resourceUuid }, callBack = {
*/ */
export function requestImage({ export function requestImage({
file, file,
width = 300, width,
height = 300, height,
operation = 'fit' operation = 'fit'
}) { }) {
const { getImagePath } = require('@/utils/ADempiere/resource.js') const { getImagePath } = require('@/utils/ADempiere/resource.js')

View File

@ -8,7 +8,11 @@ export default [
sequence: 10, sequence: 10,
cssClassName: 'price-inquiry', cssClassName: 'price-inquiry',
inputSize: 'large', inputSize: 'large',
handleActionKeyPerformed: true handleFocusGained: true,
handleFocusLost: true,
handleActionKeyPerformed: true,
isDisplayed: true,
isReadOnly: false
} }
} }
] ]

View File

@ -2,7 +2,6 @@
<div <div
v-if="isLoaded" v-if="isLoaded"
style="height: 100% !important;" style="height: 100% !important;"
@click="focusProductValue"
> >
<el-container style="height: 100% !important;"> <el-container style="height: 100% !important;">
<img <img
@ -91,6 +90,7 @@ export default {
productPrice: {}, productPrice: {},
organizationBackground: '', organizationBackground: '',
currentImageOfProduct: '', currentImageOfProduct: '',
search: 'sad',
unsubscribe: () => {} unsubscribe: () => {}
} }
}, },
@ -127,13 +127,15 @@ export default {
isSetOrg = true isSetOrg = true
imageName = this.organizationImagePath imageName = this.organizationImagePath
} }
// the name of the image plus the height and width of the container is sent
const imageBuffer = await requestImage({ const imageBuffer = await requestImage({
file: imageName file: imageName,
width: 750,
height: 380
}).then(responseImage => { }).then(responseImage => {
const arrayBufferAsImage = buildImageFromArrayBuffer({ const arrayBufferAsImage = buildImageFromArrayBuffer({
arrayBuffer: responseImage arrayBuffer: responseImage
}) })
if (isSetOrg) { if (isSetOrg) {
this.organizationBackground = arrayBufferAsImage this.organizationBackground = arrayBufferAsImage
return arrayBufferAsImage return arrayBufferAsImage
@ -151,8 +153,11 @@ export default {
formatPrice, formatPrice,
subscribeChanges() { subscribeChanges() {
return this.$store.subscribe((mutation, state) => { return this.$store.subscribe((mutation, state) => {
if (mutation.type === 'addActionKeyPerformed' && mutation.payload.columnName === 'ProductValue') { // console.log(mutation.type.length)
if ((mutation.type === 'updateValueOfField' || mutation.type === 'addFocusGained') && mutation.payload.columnName === 'ProductValue') {
// cleans all values except column name 'ProductValue' // cleans all values except column name 'ProductValue'
this.search = mutation.payload.value
if (this.search.length >= 6) {
requestGetProductPrice({ requestGetProductPrice({
searchValue: mutation.payload.value searchValue: mutation.payload.value
}) })
@ -191,13 +196,14 @@ export default {
columnName: 'ProductValue', columnName: 'ProductValue',
value: '' value: ''
}) })
this.search = ''
this.currentImageOfProduct = '' this.currentImageOfProduct = ''
if (this.isEmptyValue(this.productPrice.image)) { if (this.isEmptyValue(this.productPrice.image)) {
this.getImage(this.productPrice.image) this.getImage(this.productPrice.image)
} }
}) })
} }
}
}) })
}, },
getTaxAmount(basePrice, taxRate) { getTaxAmount(basePrice, taxRate) {
@ -227,12 +233,12 @@ export default {
.product-description { .product-description {
color: #32363a; color: #32363a;
font-size: 25px; font-size: 30px;
float: right; float: right;
padding-bottom: 0px; padding-bottom: 0px;
} }
.product-price-base, .product-tax { .product-price-base, .product-tax {
font-size: 35px; font-size: 30px;
float: right; float: right;
} }
.product-price { .product-price {
@ -250,7 +256,7 @@ export default {
} }
.inquiry-product { .inquiry-product {
position: absolute; position: absolute;
right: 5%; right: 20%;
width: 100%; width: 100%;
top: 33%; top: 33%;
.amount { .amount {

View File

@ -202,8 +202,11 @@ export default {
isLoaded: false isLoaded: false
}) })
} }
// the name of the image plus the height and width of the container is sent
requestImage({ requestImage({
file: fileName file: fileName,
width: 300,
height: 300
}).then(responseImage => { }).then(responseImage => {
const arrayBufferAsImage = buildImageFromArrayBuffer({ const arrayBufferAsImage = buildImageFromArrayBuffer({
arrayBuffer: responseImage, arrayBuffer: responseImage,

View File

@ -5,43 +5,42 @@
</template> </template>
<script> <script>
import screenfull from 'screenfull'
export default { export default {
name: 'Screenfull', name: 'Screenfull',
data() { data() {
return { return {
elem: document.documentElement,
isFullscreen: false isFullscreen: false
} }
}, },
mounted() {
this.init()
},
beforeDestroy() {
this.destroy()
},
methods: { methods: {
click() { click() {
if (!screenfull.enabled) { if (this.isFullscreen) {
this.$message({ this.closeFullscreen()
message: 'you browser can not work', this.isFullscreen = true
type: 'warning' return this.isFullscreen
})
return false
} }
screenfull.toggle() this.openFullscreen()
this.isFullscreen = false
return this.isFullscreen
}, },
change() { openFullscreen() {
this.isFullscreen = screenfull.isFullscreen if (this.elem.requestFullscreen) {
}, this.elem.requestFullscreen()
init() { } else if (this.elem.webkitRequestFullscreen) { /* Safari */
if (screenfull.enabled) { this.elem.webkitRequestFullscreen()
screenfull.on('change', this.change) } else if (this.elem.msRequestFullscreen) { /* IE11 */
this.elem.msRequestFullscreen()
} }
}, },
destroy() { closeFullscreen() {
if (screenfull.enabled) { if (document.exitFullscreen) {
screenfull.off('change', this.change) document.exitFullscreen()
} else if (document.webkitExitFullscreen) { /* Safari */
document.webkitExitFullscreen()
} else if (document.msExitFullscreen) { /* IE11 */
document.msExitFullscreen()
} }
} }
} }

View File

@ -23,6 +23,16 @@
<el-switch v-model="fixedHeader" class="drawer-switch" /> <el-switch v-model="fixedHeader" class="drawer-switch" />
</div> </div>
<div class="drawer-item">
<span>Show Header</span>
<el-switch v-model="showNavar" class="drawer-switch" />
</div>
<div class="drawer-item">
<span>Show Menu</span>
<el-switch v-model="showMenu" class="drawer-switch" />
</div>
<div class="drawer-item"> <div class="drawer-item">
<span>{{ $t('settings.sidebarLogo') }}</span> <span>{{ $t('settings.sidebarLogo') }}</span>
<el-switch v-model="sidebarLogo" class="drawer-switch" /> <el-switch v-model="sidebarLogo" class="drawer-switch" />
@ -67,6 +77,28 @@ export default {
}) })
} }
}, },
showNavar: {
get() {
return this.$store.state.settings.showNavar
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showNavar',
value: val
})
}
},
showMenu: {
get() {
return this.$store.state.settings.showMenu
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showMenu',
value: val
})
}
},
tagsView: { tagsView: {
get() { get() {
return this.$store.state.settings.tagsView return this.$store.state.settings.tagsView

View File

@ -1,10 +1,10 @@
<template> <template>
<div :class="classObj" class="app-wrapper"> <div :class="classObj" class="app-wrapper">
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<sidebar class="sidebar-container" /> <sidebar v-show="showMenu" class="sidebar-container" />
<div :class="{hasTagsView:needTagsView}" class="main-container"> <div :class="{hasTagsView:needTagsView}" class="main-container">
<div :class="{'fixed-header':fixedHeader}"> <div :class="{'fixed-header':fixedHeader}">
<navbar /> <navbar v-show="showNavar" />
<tags-view v-if="needTagsView" /> <tags-view v-if="needTagsView" />
</div> </div>
<app-main /> <app-main />
@ -38,7 +38,9 @@ export default {
device: state => state.app.device, device: state => state.app.device,
showSettings: state => state.settings.showSettings, showSettings: state => state.settings.showSettings,
needTagsView: state => state.settings.tagsView, needTagsView: state => state.settings.tagsView,
fixedHeader: state => state.settings.fixedHeader fixedHeader: state => state.settings.fixedHeader,
showNavar: state => state.settings.showNavar,
showMenu: state => state.settings.showMenu
}), }),
classObj() { classObj() {
return { return {

View File

@ -19,6 +19,12 @@ module.exports = {
*/ */
fixedHeader: false, fixedHeader: false,
/**
* @type {boolean} true | false
* @description Whether fix the menu
*/
showNavar: true,
/** /**
* @type {boolean} true | false * @type {boolean} true | false
* @description Whether show the logo in sidebar * @description Whether show the logo in sidebar

View File

@ -1,7 +1,7 @@
import variables from '@/styles/element-variables.scss' import variables from '@/styles/element-variables.scss'
import defaultSettings from '@/settings' import defaultSettings from '@/settings'
const { showSettings, tagsView, fixedHeader, sidebarLogo, supportPinyinSearch, showContextMenu } = defaultSettings const { showSettings, tagsView, fixedHeader, showNavar, sidebarLogo, supportPinyinSearch, showContextMenu } = defaultSettings
const state = { const state = {
theme: variables.theme, theme: variables.theme,
@ -10,7 +10,9 @@ const state = {
fixedHeader, fixedHeader,
sidebarLogo, sidebarLogo,
supportPinyinSearch, supportPinyinSearch,
showContextMenu showContextMenu,
showNavar,
showMenu: true
} }
const mutations = { const mutations = {