Commit b81b7213 by LJM

BUG

parent de3ab8c6
<template>
<view class="repairPrint">
<view class="search-box row bothSide verCenter">
<view class="search-box row bothSide verCenter" style="margin-bottom: 22rpx;">
<view class="sn row rowCenter verCenter">
<picker @change="bindPickerChange" v-model="id" data-type_id="id" :value="index" :range="labelStyles" range-key="name">
<picker @change="bindPickerChange" :value="index" :range="labelStyles" range-key="name">
<view class="row verCenter">
<view class="uni-input">{{ labelStyles[index].name }}</view>
<view class="uni-arrow"></view>
......@@ -12,16 +12,51 @@
<view class="search-bar row bothSide verCenter">
<view class="row verCenter">
<text class="iconfont icon-juxing1"></text>
<input class="uni-input" v-model="formParams.sn" placeholder="请输入号码" placeholder-style="color:#919399" />
<input class="uni-input" v-model="formParams.sn" placeholder="请输入入库批次号" placeholder-style="color:#919399" @input="handleInput(1, formParams.sn)" />
</view>
<text class="iconfont icon-a-juxing11" @click="clearInput(1)" v-if="input_flag"></text>
</view>
</view>
<view class="search-box row bothSide verCenter" v-if="formParams.type == 5" style="margin-bottom: 22rpx;">
<view class="sn row rowCenter verCenter">
<view>
<view class="row verCenter"><view class="uni-input">数量</view></view>
</view>
<text class="iconfont icon-a-juxing11"></text>
</view>
<view class="search-bar row bothSide verCenter">
<view class="row verCenter">
<text class="iconfont icon-juxing1"></text>
<input class="uni-input" v-model="formParams.print_num" placeholder="数量" placeholder-style="color:#919399" />
<input class="uni-input" type="number" v-model="formParams.print_num" placeholder="请输入数量" placeholder-style="color:#919399" @input="handleInput(2, formParams.print_num)" />
</view>
<text class="iconfont icon-a-juxing11"></text>
<text class="iconfont icon-a-juxing11" @click="clearInput(2)" v-if="input_flag_num"></text>
</view>
</view>
<view class="search-box row bothSide verCenter" style="margin-bottom: 22rpx;">
<view class="sn row rowCenter verCenter">
<view>
<view class="row verCenter"><view class="uni-input">目标设备</view></view>
</view>
</view>
<view class="search-bar row bothSide verCenter">
<view class="row verCenter">
<text class="iconfont icon-juxing1"></text>
<input class="uni-input" type="number" v-model="formParams.target_device" placeholder="请输入目标设备" placeholder-style="color:#919399" />
</view>
<text class="iconfont icon-a-juxing11" v-if="false"></text>
</view>
</view>
<view class="search-box row bothSide verCenter" style="margin-bottom: 22rpx;">
<view class="sn row rowCenter verCenter">
<view>
<view class="row verCenter"><view class="uni-input">目标打印机</view></view>
</view>
</view>
<view class="search-bar row bothSide verCenter">
<view class="row verCenter">
<text class="iconfont icon-juxing1"></text>
<input class="uni-input" type="number" v-model="formParams.target_printer" placeholder="请输入目标打印机" placeholder-style="color:#919399" />
</view>
<text class="iconfont icon-a-juxing11" v-if="false"></text>
</view>
</view>
<view class="fix-btn row rowCenter verCenter" @click="latePrint()">打印</view>
......@@ -30,11 +65,13 @@
<script>
import { API } from '@/util/api.js';
import { getLocalIpAddress } from '@/util/util.js';
import debounce from 'lodash/debounce';
export default {
data() {
return {
input_flag: false,
input_flag_num: false,
index: 0,
labelStyles: [
{
......@@ -60,19 +97,47 @@ export default {
],
formParams: {
sn: '',
origin_device_ip: '',
print_num: '',
type: ''
origin_device_ip: '', //获取设备内网IP
target_device: '', //目标设备
target_printer: '', //模板打印机
print_num: '', //打印数量
type: 5 //库位 1;库区 2;区域 3; 容器 4;入库 5 默认5
}
};
},
onLoad(options) {
this.formParams.type = this.labelStyles[0].id;
},
methods: {
/**
* 清空数据
*/
clearInput(type) {
if (type == 1) {
this.formParams.sn = '';
this.input_flag = false;
} else if (type == 2) {
this.formParams.print_num = '';
this.input_flag_num = false;
}
},
/**
* 单号搜索
* @param {Object} event
*/
handleInput: debounce(function(type, val) {
if (val) {
if (type == 1) {
this.input_flag = true;
} else if (type == 2) {
this.input_flag_num = true;
}
} else {
if (type == 1) {
this.input_flag = false;
} else if (type == 2) {
this.input_flag_num = false;
}
}
}, 500),
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
console.log('picker发送选择改变,id为', this.labelStyles[e.detail.value].id);
this.index = e.detail.value;
this.formParams.type = this.labelStyles[e.detail.value].id;
},
......@@ -80,19 +145,36 @@ export default {
* 打印
*/
latePrint() {
this.formParams.origin_device_ip = getLocalIpAddress() || '';
console.log('origin_device_ip', this.formParams.origin_device_ip);
if (!this.formParams.sn) {
uni.showToast({
title: '输入入库批次号',
icon: 'error'
});
return false;
}
if (this.formParams.type == 5) {
if (!this.formParams.print_num) {
uni.showToast({
title: '请输入数量',
icon: 'error'
});
return false;
}
}
this.request(API.latePrint, 'POST', this.formParams, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '正在补打...',
icon: 'success'
uni.showLoading({
title: '正在打印中,请检查打印机'
});
setTimeout(() => {
uni.hideLoading();
}, 5000);
} else {
uni.showToast({
title: res.msg,
icon: 'error'
uni.showModal({
itle: '提示',
content: res.msg,
showCancel: false
});
}
});
......
......@@ -168,7 +168,8 @@ export default {
searchParams: {
stock_in_sn: '', //入库单号
tracking_no: '', //物流单号
stock_in_with_stock_in_items_inhouse: '' //入仓单号
stock_in_with_stock_in_items_inhouse: '', //入仓单号
container_id: '' //容器
},
formParams: {
container_id: '',
......@@ -270,7 +271,7 @@ export default {
* 获取列表数据
*/
getData() {
this.request(API.waitTallyReceiveList, 'POST', { page: this.page, limit: this.limit, stock_in_sn: 'S-ASN202304170001' }, false).then(res => {
this.request(API.waitTallyReceiveList, 'POST', { page: this.page, limit: this.limit, stock_in_sn: '' }, false).then(res => {
if (res.code === 0) {
this.list = res.data.list;
this.filter_list = createArray(this.list.length, false);
......
......@@ -54,25 +54,6 @@ const request = (url = '', type = 'GET', param = {}, Loading) => {
});
}
/**
* 获取本机局域网IP
*/
const getLocalIpAddress = () => {
uni.getConnectedWifi({
success: res => {
console.log('获取到 WiFi 信息:', res)
const ipRegex = /\d+\.\d+\.\d+\.\d+/
const ipAddress = res.ipAddress.match(ipRegex)[0]
console.log('当前 WiFi ip 地址:', ipAddress)
return ipAddress
},
fail: err => {
console.log('获取 WiFi 信息失败:', err)
return ''
}
})
}
/**
* 平台判断
......@@ -102,6 +83,5 @@ const createArray = (length, value) => {
module.exports = {
request,
getPlatform,
createArray,
getLocalIpAddress,
createArray
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment