打印服务

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; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.flexcol {
flex-direction: column;
}
.flexstart { .flexstart {
align-items: flex-start !important; align-items: flex-start !important;
} }

View File

@@ -10,14 +10,14 @@
</view> </view>
<view class="zd_wrapper"> <view class="zd_wrapper">
<view class="input-wrap"> <view class="input-wrap">
<view class="input-label">刷新时间(s)</view> <view class="input-label">打印地址</view>
<input type="text" class="setup-input" placeholder="请输入刷新时间" v-model="setTime"> <input type="text" class="setup-input" placeholder="请输入打印地址" v-model="printip">
</view> </view>
</view> </view>
<view class="zd_wrapper"> <view class="zd_wrapper">
<view class="input-wrap"> <view class="input-wrap">
<view class="input-label" style="margin-right: 20upx;">客户标签打印</view> <view class="input-label">刷新时间(s)</view>
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select> <input type="text" class="setup-input" placeholder="请输入刷新时间" v-model="setTime">
</view> </view>
</view> </view>
</view> </view>
@@ -29,7 +29,6 @@
</template> </template>
<script> <script>
import {virtualprintType} from '@/utils/getData2.js'
import NavBar from '@/components/NavBar.vue' import NavBar from '@/components/NavBar.vue'
export default { export default {
components: { components: {
@@ -37,37 +36,28 @@
}, },
data() { data() {
return { return {
options: [],
index: '',
addrip: this.$store.getters.baseUrl, addrip: this.$store.getters.baseUrl,
printip: this.$store.getters.printUrl,
setTime: this.$store.getters.setTime / 1000 setTime: this.$store.getters.setTime / 1000
}; };
}, },
created () {
// this._virtualprintType()
},
methods: { methods: {
goIn () { goIn () {
uni.redirectTo({ uni.redirectTo({
url: '/pages/login/login' 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 () { _submit () {
if (this.addrip === '') { if (this.addrip === '') {
uni.showToast({ uni.showToast({
title: '服务器地址', title: '请填写服务器地址',
icon: 'none'
})
return
}
if (this.printip === '') {
uni.showToast({
title: '请填写打印地址',
icon: 'none' icon: 'none'
}) })
return return
@@ -80,7 +70,7 @@
return 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({ uni.redirectTo({
url: '/pages/login/login' url: '/pages/login/login'
}) })

View File

@@ -71,15 +71,16 @@
</view> </view>
</view> </view>
<view class="submit-bar_new"> <view class="submit-bar_new">
<view class="zd-col-7"> <view class="zd-col-4">
<view class="zd-row jcflexstart"> <view class="zd-row flexcol">
<view class="iconfont icon_unchecked" :class="{'icon_checked': isV}" @tap="isVirtual">&#xe66b;</view> <view class="iconfont icon_unchecked mgb10" :class="{'icon_checked': isV}" @tap="isVirtual">&#xe66b;</view>
<view class="filter_input_wraper_inn_text">是否配盘</view> <view class="filter_input_wraper_inn_text">是否配盘</view>
</view> </view>
</view> </view>
<button class="zd-col-4 submit-button_new" @tap="clearUp">清空</button> <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-5 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': 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>
</view> </view>
</template> </template>
@@ -87,7 +88,7 @@
<script> <script>
import NavBar from '@/components/NavBar.vue' import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.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 { export default {
components: { components: {
NavBar, NavBar,
@@ -108,7 +109,9 @@
isV: false, isV: false,
disabled1: false, disabled1: false,
disabled2: false, disabled2: false,
checkArr: [] disabled3: false,
checkArr: [],
printActive: false
}; };
}, },
created () { created () {
@@ -179,7 +182,6 @@
let res = await groupManual(this.index1, this.val1, this.index2, this.val4, this.val5, this.val3, this.isV) let res = await groupManual(this.index1, this.val1, this.index2, this.val4, this.val5, this.val3, this.isV)
this.disabled1 = false this.disabled1 = false
this.checkArr = [] this.checkArr = []
this.clearUp()
this._queryVehicleGroup() this._queryVehicleGroup()
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
@@ -206,7 +208,7 @@
let res = await groupLink(arr) let res = await groupLink(arr)
this.disabled2 = false this.disabled2 = false
this.checkArr = [] this.checkArr = []
this.clearUp() this.printActive = true
this._queryVehicleGroup() this._queryVehicleGroup()
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
@@ -222,7 +224,22 @@
this.val1 = '' this.val1 = ''
this.val2 = '' this.val2 = ''
this.val3 = '' this.val3 = ''
this.printActive = false
this.$store.dispatch('setPublicObj', '') 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

@@ -247,3 +247,10 @@ export const groupLink = (arr) => request({
url:'api/pda/group/link', url:'api/pda/group/link',
data: arr 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' 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 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 = { const state = {
baseUrl: uni.getStorageSync('baseUrl') || baseUrl, baseUrl: uni.getStorageSync('baseUrl') || baseUrl,
printUrl: uni.getStorageSync('printUrl') || printUrl,
setTime: uni.getStorageSync('setTime') || 5000, setTime: uni.getStorageSync('setTime') || 5000,
setPrintName: uni.getStorageSync('setPrintName') || '',
loginName: uni.getStorageSync('loginName') ? uni.getStorageSync('loginName') : '', loginName: uni.getStorageSync('loginName') ? uni.getStorageSync('loginName') : '',
userInfo: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo') : '', userInfo: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo') : '',
saveToken: uni.getStorageSync('saveToken') || '' saveToken: uni.getStorageSync('saveToken') || ''
} }
const getters = { const getters = {
baseUrl: state => state.baseUrl, baseUrl: state => state.baseUrl,
printUrl: state => state.printUrl,
setTime: state => state.setTime, setTime: state => state.setTime,
setPrintName: state => state.setPrintName,
loginName: state => state.loginName, loginName: state => state.loginName,
userInfo: state => state.userInfo, userInfo: state => state.userInfo,
saveToken: state => state.saveToken saveToken: state => state.saveToken
@@ -20,8 +21,8 @@ const getters = {
const actions = { const actions = {
setConfig ({commit}, res) { setConfig ({commit}, res) {
uni.setStorageSync('baseUrl', res.baseUrl) uni.setStorageSync('baseUrl', res.baseUrl)
uni.setStorageSync('printUrl', res.printUrl)
uni.setStorageSync('setTime', res.setTime) uni.setStorageSync('setTime', res.setTime)
uni.setStorageSync('setPrintName', res.setPrintName)
commit(types.COM_CONFIG, res) commit(types.COM_CONFIG, res)
}, },
saveLoginName({commit}, res) { saveLoginName({commit}, res) {
@@ -49,8 +50,8 @@ const actions = {
const mutations = { const mutations = {
[types.COM_CONFIG] (state, res) { [types.COM_CONFIG] (state, res) {
state.baseUrl = res.baseUrl state.baseUrl = res.baseUrl
state.printUrl = res.printUrl
state.setTime = res.setTime state.setTime = res.setTime
state.setPrintName = res.setPrintName
}, },
[types.SAVE_LOGIN_NAME] (state, res) { [types.SAVE_LOGIN_NAME] (state, res) {
state.loginName = res state.loginName = res