打印服务

This commit is contained in:
2024-02-20 10:43:17 +08:00
parent f82c4c18b3
commit db5fe78ac3
5 changed files with 55 additions and 37 deletions

View File

@@ -41,6 +41,9 @@ input[type="button"], input[type="submit"], input[type="search"], input[type="re
text-overflow: ellipsis;
white-space: nowrap;
}
.flexcol {
flex-direction: column;
}
.flexstart {
align-items: flex-start !important;
}

View File

@@ -10,14 +10,14 @@
</view>
<view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label">刷新时间(s)</view>
<input type="text" class="setup-input" placeholder="请输入刷新时间" v-model="setTime">
<view class="input-label">打印地址</view>
<input type="text" class="setup-input" placeholder="请输入打印地址" v-model="printip">
</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 class="input-label">刷新时间(s)</view>
<input type="text" class="setup-input" placeholder="请输入刷新时间" v-model="setTime">
</view>
</view>
</view>
@@ -29,7 +29,6 @@
</template>
<script>
import {virtualprintType} from '@/utils/getData2.js'
import NavBar from '@/components/NavBar.vue'
export default {
components: {
@@ -37,37 +36,28 @@
},
data() {
return {
options: [],
index: '',
addrip: this.$store.getters.baseUrl,
printip: this.$store.getters.printUrl,
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.addrip)
this.options = [...res.data]
// if (this.$store.getters.setPrintName !== '') {
// this.index = this.$store.getters.setPrintName
// }
},
_submit () {
if (this.addrip === '') {
uni.showToast({
title: '服务器地址',
title: '请填写服务器地址',
icon: 'none'
})
return
}
if (this.printip === '') {
uni.showToast({
title: '请填写打印地址',
icon: 'none'
})
return
@@ -80,7 +70,7 @@
return
}
// 存值
this.$store.dispatch('setConfig',{baseUrl: this.addrip, setTime: this.setTime * 1000, setPrintName: this.index})
this.$store.dispatch('setConfig',{baseUrl: this.addrip, printUrl: this.printip,setTime: this.setTime * 1000})
uni.redirectTo({
url: '/pages/login/login'
})

View File

@@ -71,15 +71,16 @@
</view>
</view>
<view class="submit-bar_new">
<view class="zd-col-7">
<view class="zd-row jcflexstart">
<view class="iconfont icon_unchecked" :class="{'icon_checked': isV}" @tap="isVirtual">&#xe66b;</view>
<view class="zd-col-4">
<view class="zd-row flexcol">
<view class="iconfont icon_unchecked mgb10" :class="{'icon_checked': isV}" @tap="isVirtual">&#xe66b;</view>
<view class="filter_input_wraper_inn_text">是否配盘</view>
</view>
</view>
<button class="zd-col-4 submit-button_new" @tap="clearUp">清空</button>
<button class="zd-col-6 submit-button_new" :class="{'btn-disabled': !index1 || !val1 || !val3 || !index2 || !$store.getters.publicObj}" :disabled="disabled1" @tap="_groupManual">开始组盘</button>
<button class="zd-col-6 submit-button_new" :class="{'btn-disabled': checkArr.length === 0}" :disabled="disabled2" @tap="_groupLink">开始配盘</button>
<button class="zd-col-5 submit-button_new" :class="{'btn-disabled': !index1 || !val1 || !val3 || !index2 || !$store.getters.publicObj}" :disabled="disabled1" @tap="_groupManual">开始组盘</button>
<button class="zd-col-5 submit-button_new" :class="{'btn-disabled': checkArr.length === 0}" :disabled="disabled2" @tap="_groupLink">开始配盘</button>
<button class="zd-col-4 submit-button_new" :class="{'btn-disabled': !val1 || (isV === true && printActive === false)}" :disabled="disabled3" @tap="_pdaPrintf">打印</button>
</view>
</view>
</template>
@@ -87,7 +88,7 @@
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryPoints, getVehicleType, queryVehicleGroup, groupManual, groupLink} from '@/utils/getData2.js'
import {queryPoints, getVehicleType, queryVehicleGroup, groupManual, groupLink, pdaPrintf} from '@/utils/getData2.js'
export default {
components: {
NavBar,
@@ -108,7 +109,9 @@
isV: false,
disabled1: false,
disabled2: false,
checkArr: []
disabled3: false,
checkArr: [],
printActive: false
};
},
created () {
@@ -179,7 +182,6 @@
let res = await groupManual(this.index1, this.val1, this.index2, this.val4, this.val5, this.val3, this.isV)
this.disabled1 = false
this.checkArr = []
this.clearUp()
this._queryVehicleGroup()
uni.showToast({
title: res.message,
@@ -206,7 +208,7 @@
let res = await groupLink(arr)
this.disabled2 = false
this.checkArr = []
this.clearUp()
this.printActive = true
this._queryVehicleGroup()
uni.showToast({
title: res.message,
@@ -222,7 +224,22 @@
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.printActive = false
this.$store.dispatch('setPublicObj', '')
},
/** 打印 */
async _pdaPrintf () {
this.disabled3 = true
if (!this.val1 || (this.isV === true && this.printActive === false)) {
this.disabled3 = false
return
}
try {
let res = await pdaPrintf(this.val1)
this.disabled3 = false
} catch (e) {
this.disabled3 = false
}
}
}
}

View File

@@ -246,4 +246,11 @@ export const groupManual = (vtype, vcode, pcode, mid, mcode, qty, isl) => reques
export const groupLink = (arr) => request({
url:'api/pda/group/link',
data: arr
})
// 打印标签
export const pdaPrintf = (code) => request({
url:'api/pda/printf',
data: {
vehicle_code: code
}
})

View File

@@ -1,18 +1,19 @@
import * as types from '../types'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://10.1.3.90:8010' : 'http://10.1.3.90:8010'
const printUrl = process.env.NODE_ENV === 'development' ? 'http://10.1.3.90:8010' : 'http://10.1.3.90:8010'
const state = {
baseUrl: uni.getStorageSync('baseUrl') || baseUrl,
printUrl: uni.getStorageSync('printUrl') || printUrl,
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') || ''
}
const getters = {
baseUrl: state => state.baseUrl,
printUrl: state => state.printUrl,
setTime: state => state.setTime,
setPrintName: state => state.setPrintName,
loginName: state => state.loginName,
userInfo: state => state.userInfo,
saveToken: state => state.saveToken
@@ -20,8 +21,8 @@ const getters = {
const actions = {
setConfig ({commit}, res) {
uni.setStorageSync('baseUrl', res.baseUrl)
uni.setStorageSync('printUrl', res.printUrl)
uni.setStorageSync('setTime', res.setTime)
uni.setStorageSync('setPrintName', res.setPrintName)
commit(types.COM_CONFIG, res)
},
saveLoginName({commit}, res) {
@@ -49,8 +50,8 @@ const actions = {
const mutations = {
[types.COM_CONFIG] (state, res) {
state.baseUrl = res.baseUrl
state.printUrl = res.printUrl
state.setTime = res.setTime
state.setPrintName = res.setPrintName
},
[types.SAVE_LOGIN_NAME] (state, res) {
state.loginName = res