增加小数类型出库

This commit is contained in:
bb_pan 2025-07-11 10:17:13 +08:00
parent 62c4993570
commit b31cb9aa72
4 changed files with 68 additions and 43 deletions

View File

@ -70,13 +70,21 @@ onMounted(async () => {
} catch (error) { } catch (error) {
console.log(error) console.log(error)
uni.hideLoading() uni.hideLoading()
showToast('登录失败') // showToast('')
// :
uni.showModal({
title: '提示',
content: '登录失败, 请退出后重新登录',
showCancel: false,
confirmText: '确定',
})
} }
} }
}) })
// //
const onHandleLogin = async () => { const onHandleLogin = async () => {
try {
const res = await appLoginAPI(loginForm) const res = await appLoginAPI(loginForm)
if (res.code === 200) { if (res.code === 200) {
// 1. token // 1. token
@ -97,6 +105,9 @@ const onHandleLogin = async () => {
}) })
}, 500) }, 500)
} }
} catch (error) {
console.log('🚀 ~ onHandleLogin ~ error:', error)
}
} }
</script> </script>

View File

@ -98,7 +98,7 @@
v-model="item.preNum" v-model="item.preNum"
placeholder="请输入数量" placeholder="请输入数量"
type="number" type="number"
@blur="checkPerNum(item)" @change="checkPerNum(item)"
></uni-easyinput> ></uni-easyinput>
<!-- 编码 --> <!-- 编码 -->
<span v-else style="color: #409eff" @click="getCode(item)">{{ <span v-else style="color: #409eff" @click="getCode(item)">{{
@ -308,16 +308,21 @@ const checkPhone = (rule, value, callback) => {
// //
const checkPerNum = (item) => { const checkPerNum = (item) => {
// 1 if (item.unitValue == 1) {
if (!/^[1-9]\d*$/.test(item.preNum)) { item.preNum = Number(String(item.preNum).replace(/[^\d.]/g, ''))
uni.showToast({ } else {
icon: 'none', item.preNum = Number(String(item.preNum).replace(/[^\d]/g, ''))
title: '请输入正确的数量',
})
// 1
item.preNum = 1
return false
} }
// 1
// if (!/^[1-9]\d*$/.test(item.preNum)) {
// uni.showToast({
// icon: 'none',
// title: '',
// })
// // 1
// item.preNum = 1
// return false
// }
} }
// //
const changeTeamd = (e) => { const changeTeamd = (e) => {
@ -352,7 +357,7 @@ const changeEquipment = (e) => {
// equipmentList.value id typeName // equipmentList.value id typeName
const equipment = findEquipmentById(equipmentList.value, e.parentId) const equipment = findEquipmentById(equipmentList.value, e.parentId)
tableData.value.push({ tableData.value.unshift({
...JSON.parse(JSON.stringify(e)), ...JSON.parse(JSON.stringify(e)),
maTypeName: equipment.typeName, maTypeName: equipment.typeName,
preNum: e.manageType == '1' ? 1 : 0, // 退1 preNum: e.manageType == '1' ? 1 : 0, // 退1

View File

@ -111,7 +111,7 @@
v-model="item.preNum" v-model="item.preNum"
placeholder="请输入数量" placeholder="请输入数量"
type="number" type="number"
@blur="checkPerNum(item)" @change="checkPerNum(item)"
></uni-easyinput> ></uni-easyinput>
<!-- 编码 --> <!-- 编码 -->
<span v-else style="color: #409eff" @click="getCode(item)">{{ <span v-else style="color: #409eff" @click="getCode(item)">{{
@ -387,15 +387,20 @@ const checkPhone = (rule, value, callback) => {
// //
const checkPerNum = (item) => { const checkPerNum = (item) => {
// 1 // 1
if (!/^[1-9]\d*$/.test(item.preNum)) { if (item.unitValue == 1) {
uni.showToast({ item.preNum = Number(String(item.preNum).replace(/[^\d.]/g, ''))
icon: 'none', } else {
title: '请输入正确的数量', item.preNum = Number(String(item.preNum).replace(/[^\d]/g, ''))
})
// 1
item.preNum = 1
return false
} }
// if (!/^[1-9]\d*$/.test(item.preNum)) {
// uni.showToast({
// icon: 'none',
// title: '',
// })
// // 1
// item.preNum = 1
// return false
// }
if (opts.value.isOut) { if (opts.value.isOut) {
if (item.preNum > item.storageNum) { if (item.preNum > item.storageNum) {
uni.showToast({ uni.showToast({
@ -448,7 +453,7 @@ const changeEquipment = (e) => {
// equipmentList.value id typeName // equipmentList.value id typeName
const equipment = findEquipmentById(equipmentList.value, e.parentId) const equipment = findEquipmentById(equipmentList.value, e.parentId)
tableData.value.push({ tableData.value.unshift({
...JSON.parse(JSON.stringify(e)), ...JSON.parse(JSON.stringify(e)),
storageNum: e.num, storageNum: e.num,
maTypeName: equipment.typeName, maTypeName: equipment.typeName,

View File

@ -66,11 +66,15 @@ export const http = (options) => {
// 2. 401 表示token过期 去往登录页重新登录 // 2. 401 表示token过期 去往登录页重新登录
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: `${res.data.msg}`, title: `${res.data.msg || '账号已过期,请重新登录'}`,
}) })
const memberStore = useMemberStore() const memberStore = useMemberStore()
memberStore.clearUserInfo() memberStore.clearUserInfo()
memberStore.clearToken() memberStore.clearToken()
uni.removeStorageSync('idCard')
uni.removeStorageSync('id')
uni.removeStorageSync('deptName')
uni.removeStorageSync('urlPermissions')
const pages = getCurrentPages() const pages = getCurrentPages()
const currentPage = pages[pages.length - 1] const currentPage = pages[pages.length - 1]
if (!currentPage.route.includes('login')) { if (!currentPage.route.includes('login')) {
@ -82,7 +86,7 @@ export const http = (options) => {
} else if (res.data && res.data.code === 500) { } else if (res.data && res.data.code === 500) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: `${res.data.msg}`, title: `${res.data.msg || '请求失败'}`,
}) })
reject(res) reject(res)
} else { } else {