设置添加打印机

This commit is contained in:
2022-11-24 17:55:16 +08:00
parent e0ae9c5daa
commit dc86889653
3 changed files with 35 additions and 1 deletions

View File

@@ -14,14 +14,22 @@
<input type="text" class="setup-input" placeholder="请输入刷新时间" v-model="setTime">
</view>
</view>
<view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label" style="margin-right: 20upx;">打印机选择</view>
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" @click="_submit">确认</button>
<button class="submit-button" @click="_virtualprintType">查询</button>
</view>
</view>
</template>
<script>
import {virtualprintType} from '@/utils/getData2.js'
import NavBar from '@/components/NavBar.vue'
export default {
components: {
@@ -29,16 +37,33 @@
},
data() {
return {
options: [],
index: '',
addrip: this.$store.getters.baseUrl,
setTime: this.$store.getters.setTime / 1000
};
},
created () {
// this._virtualprintType()
},
methods: {
goIn () {
uni.redirectTo({
url: '/pages/login/login'
})
},
/** 选择器 */
selectChange(e) {
this.index = e
},
/** 打印机类型下拉框查询 */
async _virtualprintType () {
let res = await virtualprintType()
this.options = [...res.data]
// if (this.$store.getters.setPrintName !== '') {
// this.index = this.$store.getters.setPrintName
// }
},
_submit () {
if (this.addrip === '') {
uni.showToast({
@@ -55,7 +80,7 @@
return
}
// 存值
this.$store.dispatch('setConfig',{baseUrl: this.addrip, setTime: this.setTime * 1000})
this.$store.dispatch('setConfig',{baseUrl: this.addrip, setTime: this.setTime * 1000, setPrintName: this.index})
uni.redirectTo({
url: '/pages/login/login'
})

View File

@@ -273,4 +273,9 @@ export const customerPrint = (box_no) => request({
data: {
box_no: box_no
}
})
// 1.3打印机类型
export const virtualprintType = () => request({
url:'api/pda/virtual/printType',
data: {}
})

View File

@@ -4,6 +4,7 @@ const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.198:
const state = {
baseUrl: uni.getStorageSync('baseUrl') || baseUrl,
setTime: uni.getStorageSync('setTime') || 5000,
setPrintName: uni.getStorageSync('setPrintName') || '',
loginName: uni.getStorageSync('loginName') ? uni.getStorageSync('loginName') : '',
userInfo: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo') : '',
saveToken: uni.getStorageSync('saveToken') || ''
@@ -11,6 +12,7 @@ const state = {
const getters = {
baseUrl: state => state.baseUrl,
setTime: state => state.setTime,
setPrintName: state => state.setPrintName,
loginName: state => state.loginName,
userInfo: state => state.userInfo,
saveToken: state => state.saveToken
@@ -19,6 +21,7 @@ const actions = {
setConfig ({commit}, res) {
uni.setStorageSync('baseUrl', res.baseUrl)
uni.setStorageSync('setTime', res.setTime)
uni.setStorageSync('setPrintName', res.setPrintName)
commit(types.COM_CONFIG, res)
},
saveLoginName({commit}, res) {
@@ -47,6 +50,7 @@ const mutations = {
[types.COM_CONFIG] (state, res) {
state.baseUrl = res.baseUrl
state.setTime = res.setTime
state.setPrintName = res.setPrintName
},
[types.SAVE_LOGIN_NAME] (state, res) {
state.loginName = res