领用申请bug修复

This commit is contained in:
hongchao 2025-07-04 11:26:53 +08:00
parent a722518b0e
commit 4a908af19a
3 changed files with 216 additions and 111 deletions

View File

@ -95,7 +95,7 @@
<div class="card">
<div class="select-area">
<uni-row :gutter="24" style="display: flex; align-items: center">
<uni-col :span="10">
<uni-col :span="9">
<view>
<uni-data-select
v-model="typeId"
@ -106,7 +106,7 @@
</uni-data-select>
</view>
</uni-col>
<uni-col :span="10">
<uni-col :span="9">
<view>
<uni-data-select
v-model="typeCode"
@ -117,6 +117,12 @@
</uni-data-select>
</view>
</uni-col>
<uni-col :span="6">
<view>
<button class="btn-cont" @click="submitNum">发起申请</button>
</view>
</uni-col>
</uni-row>
</div>
<div class="table-area">
@ -186,9 +192,9 @@
</div>
</div>
<div class="footer-btn">
<!-- <div class="footer-btn">
<button class="btn-cont" @click="submitNum">发起申请</button>
</div>
</div> -->
</view>
</template>
@ -317,16 +323,16 @@ const fitNumChange = () => {
const getUnit = () => {
// proId.value=e.id;
let obj = {
projectId: proId.value,
projectId: null, enableFilter: true
}
getUnitList(obj)
.then((res) => {
console.log(res)
unitList.value = res.data
// getAgreement()
if (unitId.value && proId.value) {
getAgreement()
}
// if (unitId.value && proId.value) {
// getAgreement()
// }
})
.catch((error) => {
console.log(error)
@ -342,7 +348,8 @@ const getProject = async (e) => {
unitId.value = e?.id || ''
formData.value.unitId = e?.id || ''
let obj = {
unitId: unitId.value,
// unitId: unitId.value,
unitId: null, enableFilter: true
// "isApp":true
}
try {
@ -351,10 +358,10 @@ const getProject = async (e) => {
// proId.value=""
// treeSelect2.value.clearInput();
agreementId.value = ''
if (unitId.value && proId.value) {
await getAgreement()
// getMaType();
}
// if (unitId.value && proId.value) {
// await getAgreement()
// // getMaType();
// }
} catch (error) {
console.log(error)
}
@ -392,7 +399,7 @@ const getConfigChange = (e) => {
maTypeName: item.maTypeName,
unitName: item.unitName,
remark: '',
preNum: item.num,
preNum: item.preNum,
}
// typeList typeId
const exists = typeList.value.some(
@ -570,13 +577,14 @@ const submitNum = async () => {
leaseApplyInfo: {
unitId: unitId.value,
projectId: proId.value,
agreementId: agreementId.value,
// agreementId: agreementId.value,
leasePerson: formData.value.leasePerson,
phone: formData.value.phone,
code: formData.value.code,
standardConfigId: configId.value,
// "applyCode":formData.value.applyCode,
bmFileInfos: bmFileInfos.value,
fitNum: formData.value.fitNum,
},
leaseApplyDetailsList: typeList.value,
}
@ -695,15 +703,15 @@ const onChangeNumber = (item) => {
// console.log(item.num)
// let maxNum = Number(item.num)
// // outboundNum.value
// setTimeout(()=>{
// if(item.unitValue==1){
// item.preNum = Number(String(item.preNum).replace(/[^\d.]/g,''))
// }else{
// item.preNum = Number(String(item.preNum).replace(/[^\d]/g,''))
// }
// if (Number(item.preNum)<= 0) {
// item.preNum = 0;
// }
setTimeout(()=>{
if(item.unitValue==1){
item.preNum = Number(String(item.preNum).replace(/[^\d.]/g,''))
}else{
item.preNum = Number(String(item.preNum).replace(/[^\d]/g,''))
}
if (Number(item.preNum)<= 0) {
item.preNum = 0;
}
// if (Number(item.preNum) > maxNum) {
// uni.showToast({
// title: '',
@ -711,7 +719,7 @@ const onChangeNumber = (item) => {
// })
// item.preNum = maxNum;
// }
// },500)
},500)
}
const changeNum = (row) => {
// console.log('🚀 ~ changeNum ~ row:', row)
@ -757,6 +765,27 @@ const clearConfig = () => {
</script>
<style lang="scss">
.btn-cont {
width: 100%;
height: 48rpx;
line-height: 48rpx;
text-align: center;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
color: #fff;
border-radius: 20rpx;
font-size: 18rpx;
font-weight: 500;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
.accept {
padding: 24rpx;
height: 95vh;
@ -771,14 +800,14 @@ const clearConfig = () => {
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 24rpx;
margin-bottom: 10rpx;
//
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
margin-bottom: 10rpx;
.title {
font-size: 32rpx;
@ -807,6 +836,7 @@ const clearConfig = () => {
}
}
}
//
.uni-group {
display: flex;
@ -831,6 +861,13 @@ const clearConfig = () => {
border-bottom: 2rpx solid #f5f5f5;
}
.uni-forms-item--border
{
margin-bottom: 0;
padding: 1px 0;
border-top: 1px #eee solid;
}
// //
// .table-area {
// margin-top: 24rpx;
@ -871,32 +908,32 @@ const clearConfig = () => {
}
//
.footer-btn {
margin-top: auto;
padding: 32rpx;
background: #fff;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
// .footer-btn {
// margin-top: auto;
// padding: 32rpx;
// background: #fff;
// box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
.btn-cont {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
// .btn-cont {
// width: 100%;
// height: 48rpx;
// line-height: 48rpx;
// text-align: center;
// background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
// color: #fff;
// border-radius: 20rpx;
// font-size: 14rpx;
// font-weight: 300;
// box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
// transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
}
// &:active {
// transform: scale(0.98);
// opacity: 0.9;
// box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
// }
// }
// }
}
//
.upload {

View File

@ -14,13 +14,13 @@
<uni-forms-item label="领用工程" name="proId" required>
<uni-easyinput v-model="formData.leaseProject" disabled />
</uni-forms-item>
<uni-forms-item label="采购申请编号" name="applyCode" required>
<!-- <uni-forms-item label="采购申请编号" name="applyCode" required>
<uni-easyinput
v-model="formData.applyCode"
maxlength="10"
placeholder="请输入采购申请编号"
/>
</uni-forms-item>
</uni-forms-item> -->
<uni-forms-item label="领料人" name="leasePerson" required>
<uni-easyinput
v-model="formData.leasePerson"
@ -70,12 +70,22 @@
</div>
</div>
</uni-forms-item>
<uni-forms-item label="适用班组数" name="fitNum">
<uni-easyinput
v-model="formData.fitNum"
type="number"
placeholder="请输入内容"
maxlength="10"
:clearable="false"
@blur="fitNumChange"
></uni-easyinput>
</uni-forms-item>
</uni-forms>
</div>
<div class="card">
<div class="select-area">
<uni-row :gutter="24" style="display: flex; align-items: center">
<uni-col :span="14">
<uni-col :span="9">
<view>
<eselect
style="width: 100%; height: 90rpx"
@ -87,7 +97,7 @@
></eselect>
</view>
</uni-col>
<uni-col :span="10">
<uni-col :span="9">
<view>
<uni-data-select
v-model="typeCode"
@ -98,6 +108,11 @@
</uni-data-select>
</view>
</uni-col>
<uni-col :span="6">
<view>
<button class="btn-cont" @click="submitNum">保存</button>
</view>
</uni-col>
</uni-row>
</div>
<div class="table-area">
@ -167,9 +182,9 @@
</div>
</div>
<div class="footer-btn">
<!-- <div class="footer-btn">
<button class="btn-cont" @click="submitNum"> </button>
</div>
</div> -->
</view>
</template>
@ -199,8 +214,10 @@ const formData = ref({
leasePerson: '',
phone: '',
configId: '',
applyCode: '',
// applyCode: '',
fitNum: '',
})
const lastFitNum = ref(formData.value.fitNum)
const unitList = ref([])
const proList = ref([])
@ -222,15 +239,15 @@ const flagFile = ref(false)
//
const rules = ref({
applyCode: {
rules: [
{
required: true,
errorMessage: '采购申请编号为必填项',
trigger: 'blur',
},
],
},
// applyCode: {
// rules: [
// {
// required: true,
// errorMessage: '',
// trigger: 'blur',
// },
// ],
// },
leasePerson: {
rules: [
{
@ -281,20 +298,38 @@ const getDetail = async () => {
}
}
//
const fitNumChange = () => {
const newVal = Math.min(5, Math.max(1, parseInt(formData.value.fitNum) || 1))
console.log( '~ fitNumChange ~ newVal:', newVal)
//
const ratio = newVal / lastFitNum.value
//
typeList.value.forEach((item) => {
item.preNum = Math.max(1, Math.floor(Number(item.preNum) * ratio)) // 1
})
// formData.fitNum lastFitNum
formData.value.fitNum = newVal
lastFitNum.value = newVal
}
//
const getUnit = () => {
// proId.value=e.id;
let obj = {
projectId: proId.value,
projectId: null, enableFilter: true
}
getUnitList(obj)
.then((res) => {
console.log(res)
unitList.value = res.data
// getAgreement()
if (unitId.value && proId.value) {
getAgreement()
}
// if (unitId.value && proId.value) {
// getAgreement()
// }
})
.catch((error) => {
console.log(error)
@ -310,7 +345,7 @@ const getProject = async (e) => {
unitId.value = e?.id || ''
formData.value.unitId = e?.id || ''
let obj = {
unitId: unitId.value,
unitId: null, enableFilter: true
// "isApp":true
}
try {
@ -319,10 +354,10 @@ const getProject = async (e) => {
// proId.value=""
// treeSelect2.value.clearInput();
agreementId.value = ''
if (unitId.value && proId.value) {
await getAgreement()
// getMaType();
}
// if (unitId.value && proId.value) {
// await getAgreement()
// // getMaType();
// }
} catch (error) {
console.log(error)
}
@ -425,7 +460,7 @@ const getConfigChange = (e) => {
maTypeName: item.maTypeName,
unitName: item.unitName,
remark: '',
preNum: item.num,
preNum: item.preNum,
}
// typeList typeId
const exists = typeList.value.some(
@ -551,11 +586,12 @@ const submitNum = async () => {
id: formData.value.id,
unitId: formData.value.unitId,
projectId: formData.value.proId,
agreementId: formData.value.agreementId,
// agreementId: formData.value.agreementId,
leasePerson: formData.value.leasePerson,
phone: formData.value.phone,
applyCode: formData.value.applyCode,
// applyCode: formData.value.applyCode,
bmFileInfos: bmFileInfos.value,
fitNum: formData.value.fitNum,
},
leaseApplyDetailsList: typeList.value,
}
@ -667,8 +703,13 @@ const delRow = (index) => {
}
// change
const onChangeNumber = (item) => {
if (item.preNum) {
item.preNum = Math.ceil(String(item.preNum).replace(/[^\d]/g, ''))
if(item.unitValue==1){
item.preNum = Number(String(item.preNum).replace(/[^\d.]/g,''))
}else{
item.preNum = Number(String(item.preNum).replace(/[^\d]/g,''))
}
if (Number(item.preNum)<= 0) {
item.preNum = 0;
}
}
@ -679,6 +720,25 @@ const clearConfig = () => {
</script>
<style lang="scss">
.btn-cont {
width: 100%;
height: 48rpx;
line-height: 48rpx;
text-align: center;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
color: #fff;
border-radius: 20rpx;
font-size: 18rpx;
font-weight: 500;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
.accept {
padding: 24rpx;
height: 95vh;
@ -753,6 +813,13 @@ const clearConfig = () => {
border-bottom: 2rpx solid #f5f5f5;
}
.uni-forms-item--border
{
margin-bottom: 0;
padding: 1px 0;
border-top: 1px #eee solid;
}
// //
// .table-area {
// margin-top: 24rpx;
@ -793,31 +860,31 @@ const clearConfig = () => {
}
//
.footer-btn {
margin: 32rpx;
margin-top: 160rpx;
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
// .footer-btn {
// margin: 32rpx;
// margin-top: 160rpx;
// box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
.btn-cont {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
// .btn-cont {
// width: 100%;
// height: 88rpx;
// line-height: 88rpx;
// text-align: center;
// background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
// color: #fff;
// border-radius: 44rpx;
// font-size: 32rpx;
// font-weight: 600;
// box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
// transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
}
}
// &:active {
// transform: scale(0.98);
// opacity: 0.9;
// box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
// }
// }
// }
}
//
.upload {

View File

@ -241,6 +241,7 @@ onLoad(async(options) => {
// uni.setStorageSync('username', loginForm.username)
// uni.setStorageSync('password', loginForm.password)
uni.setStorageSync('id', res.user.userId)
userId.value = res.user.userId
uni.setStorageSync('deptName', res.user?.dept?.deptName)
uni.setStorageSync('urlPermissions',res.urlPermissions?res.urlPermissions:[])