新增三个页面

This commit is contained in:
2025-08-05 20:28:09 +08:00
parent fd5b9d30f6
commit 9ca4b509c1
11 changed files with 503 additions and 3 deletions

135
components/NumberInput.vue Normal file
View File

@@ -0,0 +1,135 @@
<template>
<input
type="number"
:value="displayValue"
@input="handleInput"
@blur="handleBlur"
:class="inputClass"
/>
</template>
<script>
export default {
name: "NumberInput",
props: {
value: [Number, String],
inputClass: {
type: String,
default: ''
},
// 输入模式integer(纯整数), decimal(纯小数), mixed(混合)
mode: {
type: String,
default: "mixed",
validator: (v) => ["integer", "decimal", "mixed"].includes(v),
},
// 小数位数限制
decimalLength: {
type: Number,
default: 2,
},
// 最小值
min: {
type: Number,
default: 0,
},
// 最大值
max: {
type: Number,
default: Infinity,
},
},
data() {
return {
displayValue: this.value?.toString() || "",
};
},
watch: {
value(newVal) {
this.displayValue = newVal?.toString() || "";
},
},
methods: {
handleInput(e) {
let value = e.detail.value;
// 1. 过滤非法字符
let filtered = value.replace(/[^\d.]/g, "");
// 2. 处理多余的小数点
if (this.mode === "integer") {
filtered = filtered.replace(/\./g, ""); // 整数模式删除所有小数点
} else {
const firstDotIndex = filtered.indexOf(".");
if (firstDotIndex !== -1) {
// 只保留第一个小数点
filtered =
filtered.substring(0, firstDotIndex + 1) +
filtered.substring(firstDotIndex + 1).replace(/\./g, "");
}
}
// 3. 处理前导0
if (filtered.startsWith("0") && filtered.length > 1 && !filtered.startsWith("0.")) {
filtered = filtered.replace(/^0+/, "0").replace(/^0([^.])/, "$1");
}
// 4. 处理开头的小数点
if (filtered.startsWith(".")) {
if (this.mode === "integer") {
filtered = "";
} else {
filtered = "0" + filtered;
}
}
this.displayValue = filtered;
},
handleBlur() {
let value = this.displayValue;
// 空值处理
if (value === "" || value === ".") {
this.$emit("input", "");
return;
}
// 处理结尾的小数点
if (value.endsWith(".")) {
value = value.slice(0, -1);
}
// 转换为数字
const numValue = Number(value);
// 小数位数处理
let processedValue = value;
if (this.mode !== "integer" && value.includes(".")) {
const parts = value.split(".");
if (parts[1].length > this.decimalLength) {
processedValue = `${parts[0]}.${parts[1].slice(0, this.decimalLength)}`;
}
}
// 范围校验
let finalNum = Number(processedValue);
if (finalNum < this.min) finalNum = this.min;
if (finalNum > this.max) finalNum = this.max;
// 更新值
this.displayValue = finalNum.toString();
this.$emit("input", finalNum);
},
},
};
</script>
<style scoped>
.number-input {
border: 1px solid #ddd;
padding: 8px 12px;
border-radius: 4px;
font-size: 14px;
}
</style>

View File

@@ -80,6 +80,30 @@
}
}
,{
"path" : "pages/task/sgzp",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/task/ktprk",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/task/ktpck",
"style" :
{
"navigationStyle": "custom"
}
}
],
"globalStyle": {
// "pageOrientation": "landscape",

View File

@@ -38,7 +38,10 @@
{title: '盘点确认', icon: 'RF3', path: '/pages/task/pdqr'},
{title: '点位操作', icon: 'RF4', path: '/pages/task/dwcz'},
{title: '定点作业', icon: 'RF5', path: '/pages/task/ddzy'},
{title: '任务管理', icon: 'RF6', path: '/pages/task/rwgl'}
{title: '任务管理', icon: 'RF6', path: '/pages/task/rwgl'},
{title: '手工组盘', icon: 'RF8', path: '/pages/task/sgzp'},
{title: '空托盘入库', icon: 'RF9', path: '/pages/task/ktprk'},
{title: '空托盘出库', icon: 'RF10', path: '/pages/task/ktpck'}
],
show: false,
secM: []

81
pages/task/ktpck.vue Normal file
View File

@@ -0,0 +1,81 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<!-- 空托盘出库 -->
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">点位编码</span>
</view>
<view class="zd-col-18 filter_select">
<search-box
v-model="val1"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-8">
<span class="filter_label">监区</span>
</view>
<view class="zd-col-16 filter_select">
<uni-data-select v-model="index" :localdata="options"></uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
<button class="zd-col-15 button-primary" :class="{'button-info': !val1 || !index}" :disabled="disabled" @tap="_empVehicleOut">出库确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {empVehicleOut} from '@/utils/getData.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
index: '',
options: [{value: '00', text: '金属托盘'}, {value: '01', text: '小料架'}, {value: '02', text: '大料架(短边)'}, {value: '03', text: '大料架(长边)'}],
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
methods: {
clearUp () {
this.val1 = ''
this.index = ''
this.disabled = false
},
async _empVehicleOut () {
this.disabled = true
if (!this.val1 || !this.index) {
this.disabled = false
return
}
try {
let res = await empVehicleOut(this.val1, this.index)
this.disabled = false
uni.showToast({
title: res.message,
icon: 'none'
})
this.clearUp()
} catch (e) {
this.disabled = false
}
}
}
}
</script>

82
pages/task/ktprk.vue Normal file
View File

@@ -0,0 +1,82 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<!-- 空托盘入库 -->
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">点位编码</span>
</view>
<view class="zd-col-18 filter_select">
<search-box
v-model="val1"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-18 filter_select">
<search-box
v-model="val2"
/>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
<button class="zd-col-15 button-primary" :class="{'button-info': !val1 || !val2}" :disabled="disabled" @tap="_empVehicleIn">入库确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {empVehicleIn} from '@/utils/getData.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
val2: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
methods: {
clearUp () {
this.val1 = ''
this.val2 = ''
this.disabled = false
},
async _empVehicleIn () {
this.disabled = true
if (!this.val1 || !this.val2) {
this.disabled = false
return
}
try {
let res = await empVehicleIn(this.val1, this.val2)
this.disabled = false
uni.showToast({
title: res.message,
icon: 'none'
})
this.clearUp()
} catch (e) {
this.disabled = false
}
}
}
}
</script>

View File

@@ -13,7 +13,7 @@
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">载具码</span>
<span class="filter_label">载具</span>
</view>
<view class="zd-col-18 filter_select">
<search-box

149
pages/task/sgzp.vue Normal file
View File

@@ -0,0 +1,149 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<!-- 手工组盘 -->
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-18 filter_select">
<search-box
v-model="vcode"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">物料编码</span>
</view>
<view class="zd-col-13 filter_select">
<input type="text" class="filter_input" v-model="code">
</view>
<button class="mini-btn" type="primary" size="mini" style="margin-right: 0" @tap="_getMaterCode">查询</button>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-6">
<span class="filter_label">物料名称</span>
</view>
<view class="zd-col-18 filter_select">
<input type="text" class="filter_input" v-model="initData.material_name" disabled>
</view>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-6">
<span class="filter_label">物料规格</span>
</view>
<view class="zd-col-18 filter_select">
<input type="text" class="filter_input" v-model="initData.material_spec" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">批次</span>
</view>
<view class="zd-col-18 filter_select">
<input type="text" class="filter_input" v-model="pcsn">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">数量</span>
</view>
<view class="zd-col-18 filter_select">
<NumberInput
v-model="qty"
input-class="filter_input"
mode="mixed"
:decimalLength="6"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-8">
<span class="filter_label">监区</span>
</view>
<view class="zd-col-16 filter_select">
<uni-data-select v-model="index" :localdata="options"></uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
<button class="zd-col-15 button-primary" :class="{'button-info': !vcode || !code || JSON.stringify(initData) === '{}' || !pcsn || !qty || !index}" :disabled="disabled" @tap="_groupPlateTwo">组盘确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import NumberInput from '@/components/NumberInput.vue'
import {getMaterCode, groupPlateTwo} from '@/utils/getData.js'
export default {
components: {
NavBar,
SearchBox,
NumberInput
},
data() {
return {
title: '',
vcode: '',
code: null,
initData: {},
pcsn: null,
qty: null,
index: '',
options: Array.from({length: 14}, (_, i) => i + 1).filter(num => num !== 8 && num !== 13).map(num => ({value: `A${num}`,text: `A${num}`})),
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
methods: {
async _getMaterCode () {
this.initData = {}
try {
let res = await getMaterCode(this.code)
if (res && res.data) {
this.initData = res.data
}
} catch (e) {
this.initData = {}
}
},
clearUp () {
this.code = ''
this.vcode = ''
this.initData = {}
this.pcsn = null
this.qty = null
this.index = null
this.disabled = false
},
// 组盘确认
async _groupPlateTwo () {
this.disabled = true
if (!this.vcode || !this.code || JSON.stringify(this.initData) === '{}' || !this.pcsn || !this.qty || !this.index) {
this.disabled = false
return
}
try {
const obj = Object.assign({}, this.initData, {storagevehicle_code: this.vcode, material_code: this.code, pcsn: this.pcsn, qty: this.qty, prison_area: this.index})
let res = await groupPlateTwo(obj)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>

BIN
static/image/menu/RF10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
static/image/menu/RF8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
static/image/menu/RF9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -125,4 +125,30 @@ export const againTask = (obj) => request({
export const forceConfirm = (obj) => request({
url:'api/pda/schTask/forceConfirm',
data: obj
})
})
// 手工组盘
export const getMaterCode = (code) => request({
url:'api/pda/iosIn/getMaterCode',
data: {material_code: code}
})
export const groupPlateTwo = (scode, mcode, mname, spec, pcsn, qty, area) => request({
url:'api/pda/iosIn/groupPlateTwo',
data: {
storagevehicle_code: scode,
material_code: mcode,
material_name: mname,
material_spec: spec,
pcsn: pcsn,
qty: qty,
prison_area: area
}
})
// 空托盘入库出库
export const empVehicleIn = (code, scode) => request({
url:'api/pda/empVehicle/in',
data: {point_code: code, storagevehicle_code: scode}
})
export const empVehicleOut = (code, type) => request({
url:'api/pda/empVehicle/out',
data: {point_code: code, storagevehicle_type: type}
})