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

View File

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

View File

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