增加小数类型出库
This commit is contained in:
parent
62c4993570
commit
b31cb9aa72
|
|
@ -70,32 +70,43 @@ onMounted(async () => {
|
|||
} catch (error) {
|
||||
console.log(error)
|
||||
uni.hideLoading()
|
||||
showToast('登录失败')
|
||||
// showToast('登录失败')
|
||||
// 弹框提示:
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '登录失败, 请退出后重新登录',
|
||||
showCancel: false,
|
||||
confirmText: '确定',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 登录按钮
|
||||
const onHandleLogin = async () => {
|
||||
const res = await appLoginAPI(loginForm)
|
||||
if (res.code === 200) {
|
||||
// 1. 获取 token 并存储
|
||||
memberStore.setToken(res.data.access_token)
|
||||
// 2 . 获取用户信息并存储
|
||||
const result = await getUserInfoAPI()
|
||||
console.log("xxxxxxxxxx",result)
|
||||
memberStore.setUserInfo(result.user)
|
||||
uni.showToast({ title: '登录成功!', icon: 'none' })
|
||||
uni.setStorageSync('username', loginForm.username)
|
||||
uni.setStorageSync('password', loginForm.password)
|
||||
uni.setStorageSync('id', result.user.userId)
|
||||
uni.setStorageSync('deptName', result.user?.dept?.deptName)
|
||||
uni.setStorageSync('urlPermissions',result.urlPermissions?result.urlPermissions:[])
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}, 500)
|
||||
try {
|
||||
const res = await appLoginAPI(loginForm)
|
||||
if (res.code === 200) {
|
||||
// 1. 获取 token 并存储
|
||||
memberStore.setToken(res.data.access_token)
|
||||
// 2 . 获取用户信息并存储
|
||||
const result = await getUserInfoAPI()
|
||||
console.log("xxxxxxxxxx",result)
|
||||
memberStore.setUserInfo(result.user)
|
||||
uni.showToast({ title: '登录成功!', icon: 'none' })
|
||||
uni.setStorageSync('username', loginForm.username)
|
||||
uni.setStorageSync('password', loginForm.password)
|
||||
uni.setStorageSync('id', result.user.userId)
|
||||
uni.setStorageSync('deptName', result.user?.dept?.deptName)
|
||||
uni.setStorageSync('urlPermissions',result.urlPermissions?result.urlPermissions:[])
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ onHandleLogin ~ error:', error)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
v-model="item.preNum"
|
||||
placeholder="请输入数量"
|
||||
type="number"
|
||||
@blur="checkPerNum(item)"
|
||||
@change="checkPerNum(item)"
|
||||
></uni-easyinput>
|
||||
<!-- 编码 -->
|
||||
<span v-else style="color: #409eff" @click="getCode(item)">{{
|
||||
|
|
@ -308,16 +308,21 @@ const checkPhone = (rule, value, callback) => {
|
|||
|
||||
// 检查数量
|
||||
const checkPerNum = (item) => {
|
||||
// 大于1的正整数 正则校验
|
||||
if (!/^[1-9]\d*$/.test(item.preNum)) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入正确的数量',
|
||||
})
|
||||
// 重置为1
|
||||
item.preNum = 1
|
||||
return false
|
||||
if (item.unitValue == 1) {
|
||||
item.preNum = Number(String(item.preNum).replace(/[^\d.]/g, ''))
|
||||
} else {
|
||||
item.preNum = Number(String(item.preNum).replace(/[^\d]/g, ''))
|
||||
}
|
||||
// 大于1的正整数 正则校验
|
||||
// if (!/^[1-9]\d*$/.test(item.preNum)) {
|
||||
// uni.showToast({
|
||||
// icon: 'none',
|
||||
// title: '请输入正确的数量',
|
||||
// })
|
||||
// // 重置为1
|
||||
// item.preNum = 1
|
||||
// return false
|
||||
// }
|
||||
}
|
||||
// 选择班组
|
||||
const changeTeamd = (e) => {
|
||||
|
|
@ -352,7 +357,7 @@ const changeEquipment = (e) => {
|
|||
|
||||
// 从 equipmentList.value 中获取点击id的上一级的 typeName
|
||||
const equipment = findEquipmentById(equipmentList.value, e.parentId)
|
||||
tableData.value.push({
|
||||
tableData.value.unshift({
|
||||
...JSON.parse(JSON.stringify(e)),
|
||||
maTypeName: equipment.typeName,
|
||||
preNum: e.manageType == '1' ? 1 : 0, // 如果是数量设备,默认退料数为1
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
v-model="item.preNum"
|
||||
placeholder="请输入数量"
|
||||
type="number"
|
||||
@blur="checkPerNum(item)"
|
||||
@change="checkPerNum(item)"
|
||||
></uni-easyinput>
|
||||
<!-- 编码 -->
|
||||
<span v-else style="color: #409eff" @click="getCode(item)">{{
|
||||
|
|
@ -387,15 +387,20 @@ const checkPhone = (rule, value, callback) => {
|
|||
// 检查数量
|
||||
const checkPerNum = (item) => {
|
||||
// 大于1的正整数 正则校验
|
||||
if (!/^[1-9]\d*$/.test(item.preNum)) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入正确的数量',
|
||||
})
|
||||
// 重置为1
|
||||
item.preNum = 1
|
||||
return false
|
||||
if (item.unitValue == 1) {
|
||||
item.preNum = Number(String(item.preNum).replace(/[^\d.]/g, ''))
|
||||
} else {
|
||||
item.preNum = Number(String(item.preNum).replace(/[^\d]/g, ''))
|
||||
}
|
||||
// if (!/^[1-9]\d*$/.test(item.preNum)) {
|
||||
// uni.showToast({
|
||||
// icon: 'none',
|
||||
// title: '请输入正确的数量',
|
||||
// })
|
||||
// // 重置为1
|
||||
// item.preNum = 1
|
||||
// return false
|
||||
// }
|
||||
if (opts.value.isOut) {
|
||||
if (item.preNum > item.storageNum) {
|
||||
uni.showToast({
|
||||
|
|
@ -448,7 +453,7 @@ const changeEquipment = (e) => {
|
|||
|
||||
// 从 equipmentList.value 中获取点击id的上一级的 typeName
|
||||
const equipment = findEquipmentById(equipmentList.value, e.parentId)
|
||||
tableData.value.push({
|
||||
tableData.value.unshift({
|
||||
...JSON.parse(JSON.stringify(e)),
|
||||
storageNum: e.num,
|
||||
maTypeName: equipment.typeName,
|
||||
|
|
|
|||
|
|
@ -66,11 +66,15 @@ export const http = (options) => {
|
|||
// 2. 401 表示token过期 去往登录页重新登录
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: `${res.data.msg}`,
|
||||
title: `${res.data.msg || '账号已过期,请重新登录'}`,
|
||||
})
|
||||
const memberStore = useMemberStore()
|
||||
memberStore.clearUserInfo()
|
||||
memberStore.clearToken()
|
||||
uni.removeStorageSync('idCard')
|
||||
uni.removeStorageSync('id')
|
||||
uni.removeStorageSync('deptName')
|
||||
uni.removeStorageSync('urlPermissions')
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
if (!currentPage.route.includes('login')) {
|
||||
|
|
@ -82,7 +86,7 @@ export const http = (options) => {
|
|||
} else if (res.data && res.data.code === 500) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: `${res.data.msg}`,
|
||||
title: `${res.data.msg || '请求失败'}`,
|
||||
})
|
||||
reject(res)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue