Merge branch 'master' of http://192.168.30.2:3000/bonus/bonus-material-app
This commit is contained in:
commit
c2d716bb99
|
|
@ -1,7 +1,13 @@
|
|||
<template>
|
||||
<view class="accept page-common">
|
||||
<div class="card">
|
||||
<uni-forms :model="formData" ref="form" label-width="200rpx" :rule="rules.value" :border="true" >
|
||||
<uni-forms
|
||||
:model="formData"
|
||||
ref="form"
|
||||
label-width="200rpx"
|
||||
:rule="rules.value"
|
||||
:border="true"
|
||||
>
|
||||
<uni-forms-item label="领用单位" name="unitId" required>
|
||||
<eselect
|
||||
style="width: 100%; height: 90rpx"
|
||||
|
|
@ -22,16 +28,24 @@
|
|||
@clear="clearPro"
|
||||
></eselect>
|
||||
</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 label="领料人" name="leasePerson" required>
|
||||
<uni-easyinput v-model="formData.leasePerson" maxlength="10" placeholder="请输入领料人" />
|
||||
<uni-easyinput
|
||||
v-model="formData.leasePerson"
|
||||
maxlength="10"
|
||||
placeholder="请输入领料人"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="联系电话" name="phone" required>
|
||||
<uni-easyinput v-model="formData.phone" maxlength="11" placeholder="请输入联系电话" />
|
||||
<uni-easyinput
|
||||
v-model="formData.phone"
|
||||
maxlength="11"
|
||||
placeholder="请输入联系电话"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="标准配置" name="configId" >
|
||||
<uni-forms-item label="标准配置" name="configId">
|
||||
<eselect
|
||||
style="width: 100%; height: 90rpx"
|
||||
v-model="formData.configId"
|
||||
|
|
@ -41,20 +55,41 @@
|
|||
@clear="clearConfig"
|
||||
></eselect>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="附件" label-width="100rpx" v-if="flagFile">
|
||||
<div class="upload-wrapper" style="display: flex; flex-wrap: wrap;">
|
||||
<!-- 上传按钮,仅当上传图片数量少于 3 张时显示 -->
|
||||
<div class="upload" @click="uploadImg" v-if="bmFileInfos.length < 3">+</div>
|
||||
<!-- 动态展示已上传的图片 -->
|
||||
<div class="upload" @click="uploadImg" v-for="(img, index) in bmFileInfos" :key="index">
|
||||
<div class="image-container">
|
||||
<image :src="img.urlTemp" style="width: 160rpx;height: 160rpx;" mode=""></image>
|
||||
<!-- 删除 logo,这里用一个 span 模拟,可替换为实际的 logo 图片 -->
|
||||
<span class="delete-logo" @click.stop="deleteImg(index)">×</span>
|
||||
<uni-forms-item label="附件" label-width="100rpx" v-if="flagFile">
|
||||
<div class="upload-wrapper" style="display: flex; flex-wrap: wrap">
|
||||
<!-- 上传按钮,仅当上传图片数量少于 3 张时显示 -->
|
||||
<div class="upload" @click="uploadImg" v-if="bmFileInfos.length < 3">+</div>
|
||||
<!-- 动态展示已上传的图片 -->
|
||||
<div
|
||||
class="upload"
|
||||
@click="uploadImg"
|
||||
v-for="(img, index) in bmFileInfos"
|
||||
:key="index"
|
||||
>
|
||||
<div class="image-container">
|
||||
<image
|
||||
:src="img.urlTemp"
|
||||
style="width: 160rpx; height: 160rpx"
|
||||
mode=""
|
||||
></image>
|
||||
<!-- 删除 logo,这里用一个 span 模拟,可替换为实际的 logo 图片 -->
|
||||
<span class="delete-logo" @click.stop="deleteImg(index)"
|
||||
>×</span
|
||||
>
|
||||
</div>
|
||||
</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>
|
||||
</div>
|
||||
<div class="card">
|
||||
|
|
@ -62,17 +97,23 @@
|
|||
<uni-row :gutter="24" style="display: flex; align-items: center">
|
||||
<uni-col :span="10">
|
||||
<view>
|
||||
<uni-data-select v-model="typeId"
|
||||
<uni-data-select
|
||||
v-model="typeId"
|
||||
placeholder="请选择物资类型"
|
||||
:localdata="maTypeSelectList" @change="getMaCode" >
|
||||
:localdata="maTypeSelectList"
|
||||
@change="getMaCode"
|
||||
>
|
||||
</uni-data-select>
|
||||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="10">
|
||||
<view>
|
||||
<uni-data-select v-model="typeCode"
|
||||
<uni-data-select
|
||||
v-model="typeCode"
|
||||
placeholder="请选择规格型号"
|
||||
:localdata="maCodeSelectList" @change="selectMaCode" >
|
||||
:localdata="maCodeSelectList"
|
||||
@change="selectMaCode"
|
||||
>
|
||||
</uni-data-select>
|
||||
</view>
|
||||
</uni-col>
|
||||
|
|
@ -82,43 +123,61 @@
|
|||
<uni-table border stripe emptyText="暂无更多数据">
|
||||
<!-- 表头行 -->
|
||||
<uni-tr>
|
||||
<uni-th width="100px" style="font-size: 24rpx;" align="center">类型名称</uni-th>
|
||||
<uni-th width="100px" style="font-size: 24rpx;" align="center">规格型号</uni-th>
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">计量单位</uni-th>
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">预领数量</uni-th>
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">备注</uni-th>
|
||||
<uni-th width="70px" style="font-size: 24rpx;" align="center">操作</uni-th>
|
||||
<uni-th width="100px" style="font-size: 24rpx" align="center"
|
||||
>类型名称</uni-th
|
||||
>
|
||||
<uni-th width="100px" style="font-size: 24rpx" align="center"
|
||||
>规格型号</uni-th
|
||||
>
|
||||
<uni-th width="90px" style="font-size: 24rpx" align="center"
|
||||
>计量单位</uni-th
|
||||
>
|
||||
<uni-th width="90px" style="font-size: 24rpx" align="center"
|
||||
>预领数量</uni-th
|
||||
>
|
||||
<uni-th width="90px" style="font-size: 24rpx" align="center">备注</uni-th>
|
||||
<uni-th width="70px" style="font-size: 24rpx" align="center">操作</uni-th>
|
||||
</uni-tr>
|
||||
<!-- 表格数据行 -->
|
||||
<uni-tr v-for="(item,index) in typeList" :key="item.id">
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">{{item.maTypeName}}</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">{{item.typeName}}</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">{{item.unitName}}</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<uni-easyinput
|
||||
placeholder="预领数量"
|
||||
v-model="item.preNum"
|
||||
type="number"
|
||||
:clearable="false"
|
||||
<uni-tr v-for="(item, index) in typeList" :key="item.id">
|
||||
<uni-td style="font-size: 24rpx; text-align: center">{{
|
||||
item.maTypeName
|
||||
}}</uni-td>
|
||||
<uni-td style="font-size: 24rpx; text-align: center">{{
|
||||
item.typeName
|
||||
}}</uni-td>
|
||||
<uni-td style="font-size: 24rpx; text-align: center">{{
|
||||
item.unitName
|
||||
}}</uni-td>
|
||||
<uni-td style="font-size: 24rpx; text-align: center">
|
||||
<uni-easyinput
|
||||
placeholder="预领数量"
|
||||
v-model="item.preNum"
|
||||
type="number"
|
||||
:clearable="false"
|
||||
@input="onChangeNumber(item)"
|
||||
:styles="{width: '100rpx'}"
|
||||
:styles="{ width: '100rpx' }"
|
||||
/>
|
||||
</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<uni-easyinput
|
||||
placeholder="备注"
|
||||
v-model="item.remark"
|
||||
:clearable="false"
|
||||
:styles="{width: '100rpx'}"
|
||||
<uni-td style="font-size: 24rpx; text-align: center">
|
||||
<uni-easyinput
|
||||
placeholder="备注"
|
||||
v-model="item.remark"
|
||||
:clearable="false"
|
||||
:styles="{ width: '100rpx' }"
|
||||
/>
|
||||
</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<uni-td style="font-size: 24rpx; text-align: center">
|
||||
<view class="uni-group">
|
||||
<!-- <view class="action-btn" @click="uploadImg(item)">
|
||||
<uni-icons type="camera" size="20" style="color: #3784fb;"/>
|
||||
</view> -->
|
||||
<view class="action-btn delete" @click="delRow(index)">
|
||||
<uni-icons type="trash-filled" size="20" style="color: red;margin-left:10px;"/>
|
||||
<uni-icons
|
||||
type="trash-filled"
|
||||
size="20"
|
||||
style="color: red; margin-left: 10px"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</uni-td>
|
||||
|
|
@ -133,25 +192,36 @@
|
|||
</view>
|
||||
</template>
|
||||
|
||||
<script setup >
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import eselect from '@/components/tree-select/eselect.vue'
|
||||
import { onLoad,onReady } from '@dcloudio/uni-app'
|
||||
import { getUnitList,getProjectList,getConfigList,getLevelThreeType,insertApp,getAgreementInfoById,getListsByConfigId,getTypeDataList,leaseTask,getLeaseCode } from '../../services/back.js';
|
||||
const taskInfo = ref({})
|
||||
import { onLoad, onReady } from '@dcloudio/uni-app'
|
||||
import {
|
||||
getUnitList,
|
||||
getProjectList,
|
||||
getConfigList,
|
||||
getLevelThreeType,
|
||||
insertApp,
|
||||
getAgreementInfoById,
|
||||
getListsByConfigId,
|
||||
getTypeDataList,
|
||||
leaseTask,
|
||||
getLeaseCode,
|
||||
} from '../../services/back.js'
|
||||
const taskInfo = ref({})
|
||||
const treeSelect = ref(null)
|
||||
const treeSelect2 = ref(null)
|
||||
const formData = ref({
|
||||
value: {
|
||||
unitId: '',
|
||||
proId: '',
|
||||
leasePerson: '',
|
||||
phone: '',
|
||||
configId: '',
|
||||
// applyCode: '',
|
||||
code:''
|
||||
}
|
||||
unitId: '',
|
||||
proId: '',
|
||||
leasePerson: '',
|
||||
phone: '',
|
||||
configId: '',
|
||||
// applyCode: '',
|
||||
code: '',
|
||||
fitNum: 1, // 适用班组数
|
||||
})
|
||||
const lastFitNum = ref(formData.value.fitNum)
|
||||
|
||||
const unitList = ref([])
|
||||
const proList = ref([])
|
||||
|
|
@ -162,16 +232,15 @@ const configId = ref('')
|
|||
const agreementId = ref('')
|
||||
|
||||
const maTypeSelectList = ref([])
|
||||
const typeId = ref("")//类型
|
||||
const typeId = ref('') //类型
|
||||
const maCodeSelectList = ref([])
|
||||
const typeCode = ref("")//规格型号
|
||||
const typeList = ref([])
|
||||
const bmFileInfos = ref([])//图片数组
|
||||
const typeCode = ref('') //规格型号
|
||||
const typeList = ref([])
|
||||
const bmFileInfos = ref([]) //图片数组
|
||||
// 定义 form 引用
|
||||
const form = ref(null)
|
||||
const flagFile = ref(false)
|
||||
|
||||
|
||||
// 定义表单验证规则
|
||||
const rules = ref({
|
||||
unitId: {
|
||||
|
|
@ -179,18 +248,18 @@ const rules = ref({
|
|||
{
|
||||
required: true,
|
||||
errorMessage: '领用单位为必填项',
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
},
|
||||
proId: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: '领用工程为必填项',
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
},
|
||||
// applyCode: {
|
||||
// rules: [
|
||||
|
|
@ -199,33 +268,50 @@ const rules = ref({
|
|||
// errorMessage: '采购申请编号为必填项',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ]
|
||||
// ]
|
||||
// },
|
||||
leasePerson: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: '领料人为必填项',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
phone: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: '联系电话为必填项',
|
||||
trigger: 'blur'
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
errorMessage: '请输入正确的手机号码',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
errorMessage: '请输入正确的手机号码',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
// 适用班组数
|
||||
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 = () => {
|
||||
|
|
@ -249,7 +335,7 @@ const getUnit = () => {
|
|||
//工程
|
||||
const getProject = async (e) => {
|
||||
flagFile.value = false
|
||||
if (e.typeKey == 'fbs') {
|
||||
if (e && e.typeKey == 'fbs') {
|
||||
flagFile.value = true
|
||||
}
|
||||
console.log('🚀 ~ getProject ~ e:', e)
|
||||
|
|
@ -260,32 +346,32 @@ const getProject = async (e) => {
|
|||
// "isApp":true
|
||||
}
|
||||
try {
|
||||
const res = await getProjectList(obj);
|
||||
proList.value = res.data;
|
||||
const res = await getProjectList(obj)
|
||||
proList.value = res.data
|
||||
// proId.value=""
|
||||
// treeSelect2.value.clearInput();
|
||||
agreementId.value = '';
|
||||
agreementId.value = ''
|
||||
if (unitId.value && proId.value) {
|
||||
await getAgreement();
|
||||
await getAgreement()
|
||||
// getMaType();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
//标准配置
|
||||
const getConfig = () => {
|
||||
let obj = {
|
||||
unitId: null,
|
||||
}
|
||||
unitId: null,
|
||||
}
|
||||
getConfigList(obj)
|
||||
.then((res) => {
|
||||
configList.value = res.data
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
//标准配置
|
||||
|
|
@ -293,25 +379,27 @@ const getConfigChange = (e) => {
|
|||
configId.value = e?.id || ''
|
||||
formData.value.configId = e?.id || ''
|
||||
let obj = {
|
||||
configId: e?.id || '',
|
||||
}
|
||||
configId: e?.id || '',
|
||||
}
|
||||
getListsByConfigId(obj)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
if (res.code == 200 && res.data.length > 0) {
|
||||
res.data.forEach(item => {
|
||||
res.data.forEach((item) => {
|
||||
let param = {
|
||||
typeId: item.typeId,
|
||||
typeName: item.typeName,
|
||||
maTypeName: item.maTypeName,
|
||||
unitName: item.unitName,
|
||||
remark: '',
|
||||
preNum: item.num,
|
||||
typeId: item.typeId,
|
||||
typeName: item.typeName,
|
||||
maTypeName: item.maTypeName,
|
||||
unitName: item.unitName,
|
||||
remark: '',
|
||||
preNum: item.num,
|
||||
}
|
||||
// 检查 typeList 中是否已经存在相同 typeId 的项
|
||||
const exists = typeList.value.some(existingItem => existingItem.typeId === param.typeId);
|
||||
const exists = typeList.value.some(
|
||||
(existingItem) => existingItem.typeId === param.typeId,
|
||||
)
|
||||
if (!exists) {
|
||||
typeList.value.push(param);
|
||||
typeList.value.push(param)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -319,7 +407,7 @@ const getConfigChange = (e) => {
|
|||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
//工程选择
|
||||
|
|
@ -352,117 +440,119 @@ const getAgreement = async () => {
|
|||
}
|
||||
|
||||
//类下拉选
|
||||
const getMaType = () => {
|
||||
console.log('sdadasda',agreementId.value)
|
||||
const getMaType = () => {
|
||||
console.log('sdadasda', agreementId.value)
|
||||
let obj = {
|
||||
"level":3,
|
||||
}
|
||||
getLevelThreeType(obj).then(res => {
|
||||
console.log(res)
|
||||
maTypeSelectList.value = res.data.map(option => {
|
||||
return {
|
||||
value:option.typeId,
|
||||
text:option.name,
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
level: 3,
|
||||
}
|
||||
getLevelThreeType(obj)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
maTypeSelectList.value = res.data.map((option) => {
|
||||
return {
|
||||
value: option.typeId,
|
||||
text: option.name,
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
//规格
|
||||
const getMaCode = () => {
|
||||
const getMaCode = () => {
|
||||
let obj = {
|
||||
"typeId":typeId.value
|
||||
}
|
||||
getTypeDataList(obj).then(res => {
|
||||
console.log(res)
|
||||
maCodeSelectList.value = res.data.map(option => {
|
||||
let obj = {
|
||||
...option,
|
||||
value:option.typeId,
|
||||
text:option.typeName,
|
||||
typeId: typeId.value,
|
||||
}
|
||||
getTypeDataList(obj)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
maCodeSelectList.value = res.data.map((option) => {
|
||||
let obj = {
|
||||
...option,
|
||||
value: option.typeId,
|
||||
text: option.typeName,
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
const getCode = () => {
|
||||
let obj = {
|
||||
typeId: '',
|
||||
}
|
||||
getLeaseCode(obj)
|
||||
.then((res) => {
|
||||
console.log('xxxxxxxxxxxx', res)
|
||||
if (res.code == 200) {
|
||||
formData.value.code = res.data.taskCode
|
||||
}
|
||||
return obj
|
||||
});
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
const getCode = () => {
|
||||
let obj = {
|
||||
"typeId":''
|
||||
}
|
||||
getLeaseCode(obj).then(res => {
|
||||
console.log('xxxxxxxxxxxx',res)
|
||||
if(res.code == 200){
|
||||
formData.value.code = res.data.taskCode
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//选择规格型号
|
||||
const selectMaCode = (e) => {
|
||||
const selectMaCode = (e) => {
|
||||
console.log(e)
|
||||
// 检查 typeList 中是否已经存在相同 typeId 的项
|
||||
const exists = typeList.value.some(existingItem => existingItem.typeId === e);
|
||||
const exists = typeList.value.some((existingItem) => existingItem.typeId === e)
|
||||
if (exists) {
|
||||
let name = ''
|
||||
maCodeSelectList.value.forEach(item => {
|
||||
maCodeSelectList.value.forEach((item) => {
|
||||
if (item.typeId === e) {
|
||||
name = item.typeName
|
||||
}
|
||||
name = item.typeName
|
||||
}
|
||||
})
|
||||
uni.showToast({
|
||||
title: `${name} 已添加到列表中`,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
duration: 1000,
|
||||
})
|
||||
return
|
||||
}
|
||||
maCodeSelectList.value.forEach(item=>{
|
||||
maCodeSelectList.value.forEach((item) => {
|
||||
console.log(item)
|
||||
if(item.typeId==e){
|
||||
if (item.typeId == e) {
|
||||
let param = {
|
||||
typeId:item.typeId,
|
||||
typeName:item.typeName,
|
||||
maTypeName:item.maTypeName,
|
||||
unitName:item.unitName,
|
||||
remark:'',
|
||||
preNum:item.num,
|
||||
typeId: item.typeId,
|
||||
typeName: item.typeName,
|
||||
maTypeName: item.maTypeName,
|
||||
unitName: item.unitName,
|
||||
remark: '',
|
||||
preNum: item.num,
|
||||
}
|
||||
typeList.value.push(param)
|
||||
}
|
||||
})
|
||||
console.log(typeList.value)
|
||||
}
|
||||
}
|
||||
//提交
|
||||
const submitNum = async() => {
|
||||
|
||||
const submitNum = async () => {
|
||||
console.log(typeList.value)
|
||||
// 直接使用引用调用验证方法
|
||||
form.value.validate(async(valid)=>{
|
||||
console.log('🚀 ~ submitNum ~ valid:', valid)
|
||||
if(!valid){
|
||||
if(flagFile.value && bmFileInfos.value.length==0){
|
||||
await uni.showToast({
|
||||
// 直接使用引用调用验证方法
|
||||
form.value.validate(async (valid) => {
|
||||
console.log('🚀 ~ submitNum ~ valid:', valid)
|
||||
if (!valid) {
|
||||
if (flagFile.value && bmFileInfos.value.length == 0) {
|
||||
await uni.showToast({
|
||||
title: '请上传附件',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
duration: 1000,
|
||||
})
|
||||
return
|
||||
}
|
||||
// 校验 preNum 必须大于 0
|
||||
if (typeList.value.length === 0) {
|
||||
console.log('🚀 ~ submitNum ~ typeList.value:', typeList.value)
|
||||
await uni.showToast({
|
||||
await uni.showToast({
|
||||
title: '请添加申请数据',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
duration: 1000,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
|
@ -471,59 +561,59 @@ const submitNum = async() => {
|
|||
uni.showToast({
|
||||
title: '预领数量不能为空或等于0',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
duration: 1000,
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
let obj = {
|
||||
"leaseApplyInfo":{
|
||||
"unitId":unitId.value,
|
||||
"projectId":proId.value,
|
||||
"agreementId":agreementId.value,
|
||||
"leasePerson":formData.value.leasePerson,
|
||||
"phone":formData.value.phone,
|
||||
"code": formData.value.code,
|
||||
"standardConfigId":configId.value,
|
||||
leaseApplyInfo: {
|
||||
unitId: unitId.value,
|
||||
projectId: proId.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,
|
||||
bmFileInfos: bmFileInfos.value,
|
||||
},
|
||||
"leaseApplyDetailsList":typeList.value
|
||||
leaseApplyDetailsList: typeList.value,
|
||||
}
|
||||
console.log(obj)
|
||||
leaseTask(obj).then( res => {
|
||||
console.log(res)
|
||||
if(res.code==200){
|
||||
console.log('xxxxxxxxxxxxxxxx')
|
||||
uni.showToast({ title: '申请成功', icon: 'none',duration: 1000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}, 1000);
|
||||
}else{
|
||||
console.log('yyyyyyyyyyyyy')
|
||||
uni.showToast({ title: res.msg, icon: 'none',duration: 1000 })
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
})
|
||||
leaseTask(obj)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
console.log('xxxxxxxxxxxxxxxx')
|
||||
uni.showToast({ title: '申请成功', icon: 'none', duration: 1000 })
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
})
|
||||
}, 1000)
|
||||
} else {
|
||||
console.log('yyyyyyyyyyyyy')
|
||||
uni.showToast({ title: res.msg, icon: 'none', duration: 1000 })
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
} else {
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onReady(() => {
|
||||
if (form.value) {
|
||||
// 设置表单验证规则
|
||||
form.value.setRules(rules.value);
|
||||
form.value.setRules(rules.value)
|
||||
} else {
|
||||
console.error('表单引用未正确初始化');
|
||||
console.error('表单引用未正确初始化')
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
getUnit()
|
||||
|
|
@ -535,7 +625,7 @@ onLoad((options) => {
|
|||
})
|
||||
//上传
|
||||
const uploadImg = (item) => {
|
||||
if(bmFileInfos.value.length>=3){
|
||||
if (bmFileInfos.value.length >= 3) {
|
||||
uni.showToast({
|
||||
title: '最多上传3张图片!',
|
||||
icon: 'none',
|
||||
|
|
@ -543,60 +633,60 @@ const uploadImg = (item) => {
|
|||
return
|
||||
}
|
||||
uni.chooseImage({
|
||||
count: 3 - bmFileInfos.value.length, //图片可选择数量
|
||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera',], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||
success: res => {
|
||||
console.log(res)
|
||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||
imgFiles.forEach((filePath) => {
|
||||
console.log('2222222222222222222222')
|
||||
bmFileInfos.value.push({urlTemp:filePath})
|
||||
})
|
||||
console.log('🚀 ~ uploadImg ~ imgFiles:', imgFiles)
|
||||
// imgBeseUrl.value = imgFiles[0]
|
||||
// console.log('本地地址', imgFiles)
|
||||
// console.log('请求地址', baseURL+"/file/upload")
|
||||
bmFileInfos.value.forEach((item,index) => {
|
||||
uni.uploadFile({
|
||||
// url: baseURL+"/file/upload",//app
|
||||
url: "/file/upload",//h5
|
||||
filePath: item.urlTemp,
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
res = JSON.parse(res.data)
|
||||
console.log('上传成功', res.code);
|
||||
console.log('上传成功', res.data);
|
||||
if(res.code&&res.code==200){
|
||||
bmFileInfos.value[index] = {
|
||||
...bmFileInfos.value[index],
|
||||
name: res.data.name,
|
||||
url: res.data.url
|
||||
};
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
}else{
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err);
|
||||
}
|
||||
});
|
||||
});
|
||||
count: 3 - bmFileInfos.value.length, //图片可选择数量
|
||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||
imgFiles.forEach((filePath) => {
|
||||
console.log('2222222222222222222222')
|
||||
bmFileInfos.value.push({ urlTemp: filePath })
|
||||
})
|
||||
console.log('🚀 ~ uploadImg ~ imgFiles:', imgFiles)
|
||||
// imgBeseUrl.value = imgFiles[0]
|
||||
// console.log('本地地址', imgFiles)
|
||||
// console.log('请求地址', baseURL+"/file/upload")
|
||||
bmFileInfos.value.forEach((item, index) => {
|
||||
uni.uploadFile({
|
||||
// url: baseURL+"/file/upload",//app
|
||||
url: '/file/upload', //h5
|
||||
filePath: item.urlTemp,
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
res = JSON.parse(res.data)
|
||||
console.log('上传成功', res.code)
|
||||
console.log('上传成功', res.data)
|
||||
if (res.code && res.code == 200) {
|
||||
bmFileInfos.value[index] = {
|
||||
...bmFileInfos.value[index],
|
||||
name: res.data.name,
|
||||
url: res.data.url,
|
||||
}
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
} else {
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err)
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
// this.$refs.vForm.clearValidate()
|
||||
}
|
||||
})
|
||||
// this.$refs.vForm.clearValidate()
|
||||
},
|
||||
})
|
||||
}
|
||||
const deleteImg = (index) => {
|
||||
bmFileInfos.value.splice(index, 1);
|
||||
bmFileInfos.value.splice(index, 1)
|
||||
// bmFileInfosTemp.value.splice(index, 1);
|
||||
};
|
||||
}
|
||||
//删除
|
||||
const delRow = (index) => {
|
||||
console.log(index)
|
||||
console.log(typeList.value)
|
||||
typeList.value.splice(index,1)
|
||||
typeList.value.splice(index, 1)
|
||||
}
|
||||
// 数量框change事件
|
||||
const onChangeNumber = (item) => {
|
||||
|
|
@ -605,23 +695,23 @@ 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: '已达到当前资最大在用数量!',
|
||||
// icon: 'none',
|
||||
// })
|
||||
// item.preNum = maxNum;
|
||||
// })
|
||||
// item.preNum = maxNum;
|
||||
// }
|
||||
// },500)
|
||||
// },500)
|
||||
}
|
||||
const changeNum = (row) => {
|
||||
// console.log('🚀 ~ changeNum ~ row:', row)
|
||||
|
|
@ -642,7 +732,7 @@ const changeNum = (row) => {
|
|||
// uni.showToast({
|
||||
// title: '完好数量和不合格数量之和不能大于退料数量',
|
||||
// icon: 'none',
|
||||
// })
|
||||
// })
|
||||
// row.badNum = 0
|
||||
// row.goodNum = 0
|
||||
// }
|
||||
|
|
@ -664,7 +754,6 @@ const clearConfig = () => {
|
|||
configId.value = ''
|
||||
getConfig()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
@ -718,23 +807,23 @@ const clearConfig = () => {
|
|||
}
|
||||
}
|
||||
}
|
||||
// 操作按钮样式
|
||||
.uni-group {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.uni-icons {
|
||||
padding: 8rpx;
|
||||
border-radius: 8rpx;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.9);
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 操作按钮样式
|
||||
.uni-group {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.uni-icons {
|
||||
padding: 8rpx;
|
||||
border-radius: 8rpx;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.9);
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 选择区域
|
||||
.select-area {
|
||||
|
|
@ -811,29 +900,29 @@ const clearConfig = () => {
|
|||
}
|
||||
// 上传区域样式
|
||||
.upload {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 48rpx;
|
||||
color: #bfbfbf;
|
||||
transition: all 0.3s ease;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 48rpx;
|
||||
color: #bfbfbf;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
background-color: #f0f0f0;
|
||||
border-color: #3784fb;
|
||||
}
|
||||
&:active {
|
||||
background-color: #f0f0f0;
|
||||
border-color: #3784fb;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
object-fit: cover;
|
||||
}
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
.image-container {
|
||||
position: relative;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@
|
|||
maxlength="200"
|
||||
></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="适用班组数" name="fitNum" v-if="!opts.isOut">
|
||||
<!-- <uni-forms-item label="适用班组数" name="fitNum" v-if="!opts.isOut">
|
||||
<uni-easyinput
|
||||
v-model="formData.fitNum"
|
||||
type="number"
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
:clearable="false"
|
||||
@blur="fitNumChange"
|
||||
></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-forms-item> -->
|
||||
<uni-section title="领用工具器" type="line" />
|
||||
<eselect
|
||||
v-model="equipmentId"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="accept">
|
||||
<div class="card">
|
||||
<uni-forms label-width="170rpx" :border="true">
|
||||
<uni-forms label-width="91px" :border="true">
|
||||
<uni-forms-item label="机具类型:" name="maName" required>
|
||||
<select-one style="width: 100%; height: 90rpx" :options="maNameList" placeholder="请选择机具类型"
|
||||
@change="onMaNameChange" @clear="onMaNameClear" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue