This commit is contained in:
hongchao 2025-07-03 11:11:15 +08:00
commit c2d716bb99
3 changed files with 404 additions and 315 deletions

View File

@ -1,7 +1,13 @@
<template> <template>
<view class="accept page-common"> <view class="accept page-common">
<div class="card"> <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> <uni-forms-item label="领用单位" name="unitId" required>
<eselect <eselect
style="width: 100%; height: 90rpx" style="width: 100%; height: 90rpx"
@ -22,16 +28,24 @@
@clear="clearPro" @clear="clearPro"
></eselect> ></eselect>
</uni-forms-item> </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-easyinput v-model="formData.applyCode" maxlength="10" placeholder="请输入采购申请编号" />
</uni-forms-item> --> </uni-forms-item> -->
<uni-forms-item label="领料人" name="leasePerson" required> <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>
<uni-forms-item label="联系电话" name="phone" required> <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>
<uni-forms-item label="标准配置" name="configId" > <uni-forms-item label="标准配置" name="configId">
<eselect <eselect
style="width: 100%; height: 90rpx" style="width: 100%; height: 90rpx"
v-model="formData.configId" v-model="formData.configId"
@ -41,20 +55,41 @@
@clear="clearConfig" @clear="clearConfig"
></eselect> ></eselect>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="附件" label-width="100rpx" v-if="flagFile"> <uni-forms-item label="附件" label-width="100rpx" v-if="flagFile">
<div class="upload-wrapper" style="display: flex; flex-wrap: wrap;"> <div class="upload-wrapper" style="display: flex; flex-wrap: wrap">
<!-- 上传按钮仅当上传图片数量少于 3 张时显示 --> <!-- 上传按钮仅当上传图片数量少于 3 张时显示 -->
<div class="upload" @click="uploadImg" v-if="bmFileInfos.length < 3">+</div> <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
<div class="image-container"> class="upload"
<image :src="img.urlTemp" style="width: 160rpx;height: 160rpx;" mode=""></image> @click="uploadImg"
<!-- 删除 logo这里用一个 span 模拟可替换为实际的 logo 图片 --> v-for="(img, index) in bmFileInfos"
<span class="delete-logo" @click.stop="deleteImg(index)">&times;</span> :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)"
>&times;</span
>
</div>
</div>
</div> </div>
</div> </uni-forms-item>
</div> <uni-forms-item label="适用班组数" name="fitNum">
</uni-forms-item> <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">
@ -62,17 +97,23 @@
<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="10">
<view> <view>
<uni-data-select v-model="typeId" <uni-data-select
v-model="typeId"
placeholder="请选择物资类型" placeholder="请选择物资类型"
:localdata="maTypeSelectList" @change="getMaCode" > :localdata="maTypeSelectList"
@change="getMaCode"
>
</uni-data-select> </uni-data-select>
</view> </view>
</uni-col> </uni-col>
<uni-col :span="10"> <uni-col :span="10">
<view> <view>
<uni-data-select v-model="typeCode" <uni-data-select
v-model="typeCode"
placeholder="请选择规格型号" placeholder="请选择规格型号"
:localdata="maCodeSelectList" @change="selectMaCode" > :localdata="maCodeSelectList"
@change="selectMaCode"
>
</uni-data-select> </uni-data-select>
</view> </view>
</uni-col> </uni-col>
@ -82,43 +123,61 @@
<uni-table border stripe emptyText="暂无更多数据"> <uni-table border stripe emptyText="暂无更多数据">
<!-- 表头行 --> <!-- 表头行 -->
<uni-tr> <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 width="100px" style="font-size: 24rpx;" align="center">规格型号</uni-th> >类型名称</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="100px" style="font-size: 24rpx" align="center"
<uni-th width="90px" style="font-size: 24rpx;" align="center">备注</uni-th> >规格型号</uni-th
<uni-th width="70px" 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>
<!-- 表格数据行 --> <!-- 表格数据行 -->
<uni-tr v-for="(item,index) in typeList" :key="item.id"> <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">{{
<uni-td style="font-size: 24rpx;text-align: center;">{{item.typeName}}</uni-td> item.maTypeName
<uni-td style="font-size: 24rpx;text-align: center;">{{item.unitName}}</uni-td> }}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;"> <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 <uni-easyinput
placeholder="预领数量" placeholder="预领数量"
v-model="item.preNum" v-model="item.preNum"
type="number" type="number"
:clearable="false" :clearable="false"
@input="onChangeNumber(item)" @input="onChangeNumber(item)"
:styles="{width: '100rpx'}" :styles="{ width: '100rpx' }"
/> />
</uni-td> </uni-td>
<uni-td style="font-size: 24rpx;text-align: center;"> <uni-td style="font-size: 24rpx; text-align: center">
<uni-easyinput <uni-easyinput
placeholder="备注" placeholder="备注"
v-model="item.remark" v-model="item.remark"
:clearable="false" :clearable="false"
:styles="{width: '100rpx'}" :styles="{ width: '100rpx' }"
/> />
</uni-td> </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="uni-group">
<!-- <view class="action-btn" @click="uploadImg(item)"> <!-- <view class="action-btn" @click="uploadImg(item)">
<uni-icons type="camera" size="20" style="color: #3784fb;"/> <uni-icons type="camera" size="20" style="color: #3784fb;"/>
</view> --> </view> -->
<view class="action-btn delete" @click="delRow(index)"> <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>
</view> </view>
</uni-td> </uni-td>
@ -133,25 +192,36 @@
</view> </view>
</template> </template>
<script setup > <script setup>
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import eselect from '@/components/tree-select/eselect.vue' import eselect from '@/components/tree-select/eselect.vue'
import { onLoad,onReady } from '@dcloudio/uni-app' import { onLoad, onReady } from '@dcloudio/uni-app'
import { getUnitList,getProjectList,getConfigList,getLevelThreeType,insertApp,getAgreementInfoById,getListsByConfigId,getTypeDataList,leaseTask,getLeaseCode } from '../../services/back.js'; import {
getUnitList,
getProjectList,
getConfigList,
getLevelThreeType,
insertApp,
getAgreementInfoById,
getListsByConfigId,
getTypeDataList,
leaseTask,
getLeaseCode,
} from '../../services/back.js'
const taskInfo = ref({}) const taskInfo = ref({})
const treeSelect = ref(null) const treeSelect = ref(null)
const treeSelect2 = ref(null) const treeSelect2 = ref(null)
const formData = ref({ const formData = ref({
value: { unitId: '',
unitId: '', proId: '',
proId: '', leasePerson: '',
leasePerson: '', phone: '',
phone: '', configId: '',
configId: '', // applyCode: '',
// applyCode: '', code: '',
code:'' fitNum: 1, //
}
}) })
const lastFitNum = ref(formData.value.fitNum)
const unitList = ref([]) const unitList = ref([])
const proList = ref([]) const proList = ref([])
@ -162,16 +232,15 @@ const configId = ref('')
const agreementId = ref('') const agreementId = ref('')
const maTypeSelectList = ref([]) const maTypeSelectList = ref([])
const typeId = ref("")// const typeId = ref('') //
const maCodeSelectList = ref([]) const maCodeSelectList = ref([])
const typeCode = ref("")// const typeCode = ref('') //
const typeList = ref([]) const typeList = ref([])
const bmFileInfos = ref([])// const bmFileInfos = ref([]) //
// form // form
const form = ref(null) const form = ref(null)
const flagFile = ref(false) const flagFile = ref(false)
// //
const rules = ref({ const rules = ref({
unitId: { unitId: {
@ -179,18 +248,18 @@ const rules = ref({
{ {
required: true, required: true,
errorMessage: '领用单位为必填项', errorMessage: '领用单位为必填项',
trigger: 'change' trigger: 'change',
} },
] ],
}, },
proId: { proId: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '领用工程为必填项', errorMessage: '领用工程为必填项',
trigger: 'change' trigger: 'change',
} },
] ],
}, },
// applyCode: { // applyCode: {
// rules: [ // rules: [
@ -206,26 +275,43 @@ const rules = ref({
{ {
required: true, required: true,
errorMessage: '领料人为必填项', errorMessage: '领料人为必填项',
trigger: 'blur' trigger: 'blur',
} },
] ],
}, },
phone: { phone: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '联系电话为必填项', errorMessage: '联系电话为必填项',
trigger: 'blur' trigger: 'blur',
}, },
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
errorMessage: '请输入正确的手机号码', errorMessage: '请输入正确的手机号码',
trigger: 'blur' 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 = () => { const getUnit = () => {
@ -249,7 +335,7 @@ const getUnit = () => {
// //
const getProject = async (e) => { const getProject = async (e) => {
flagFile.value = false flagFile.value = false
if (e.typeKey == 'fbs') { if (e && e.typeKey == 'fbs') {
flagFile.value = true flagFile.value = true
} }
console.log('🚀 ~ getProject ~ e:', e) console.log('🚀 ~ getProject ~ e:', e)
@ -260,24 +346,24 @@ const getProject = async (e) => {
// "isApp":true // "isApp":true
} }
try { try {
const res = await getProjectList(obj); const res = await getProjectList(obj)
proList.value = res.data; proList.value = res.data
// 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)
} }
} }
// //
const getConfig = () => { const getConfig = () => {
let obj = { let obj = {
unitId: null, unitId: null,
} }
getConfigList(obj) getConfigList(obj)
.then((res) => { .then((res) => {
@ -285,7 +371,7 @@ const getConfig = () => {
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)
}) })
} }
// //
@ -293,25 +379,27 @@ const getConfigChange = (e) => {
configId.value = e?.id || '' configId.value = e?.id || ''
formData.value.configId = e?.id || '' formData.value.configId = e?.id || ''
let obj = { let obj = {
configId: e?.id || '', configId: e?.id || '',
} }
getListsByConfigId(obj) getListsByConfigId(obj)
.then((res) => { .then((res) => {
console.log(res) console.log(res)
if (res.code == 200 && res.data.length > 0) { if (res.code == 200 && res.data.length > 0) {
res.data.forEach(item => { res.data.forEach((item) => {
let param = { let param = {
typeId: item.typeId, typeId: item.typeId,
typeName: item.typeName, typeName: item.typeName,
maTypeName: item.maTypeName, maTypeName: item.maTypeName,
unitName: item.unitName, unitName: item.unitName,
remark: '', remark: '',
preNum: item.num, preNum: item.num,
} }
// typeList typeId // typeList typeId
const exists = typeList.value.some(existingItem => existingItem.typeId === param.typeId); const exists = typeList.value.some(
(existingItem) => existingItem.typeId === param.typeId,
)
if (!exists) { if (!exists) {
typeList.value.push(param); typeList.value.push(param)
} }
}) })
} }
@ -319,7 +407,7 @@ const getConfigChange = (e) => {
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)
}) })
} }
// //
@ -353,87 +441,90 @@ const getAgreement = async () => {
// //
const getMaType = () => { const getMaType = () => {
console.log('sdadasda',agreementId.value) console.log('sdadasda', agreementId.value)
let obj = { let obj = {
"level":3, level: 3,
} }
getLevelThreeType(obj).then(res => { getLevelThreeType(obj)
console.log(res) .then((res) => {
maTypeSelectList.value = res.data.map(option => { console.log(res)
return { maTypeSelectList.value = res.data.map((option) => {
value:option.typeId, return {
text:option.name, value: option.typeId,
} text: option.name,
}); }
}).catch(error => { })
console.log(error) })
}) .catch((error) => {
console.log(error)
})
} }
// //
const getMaCode = () => { const getMaCode = () => {
let obj = { let obj = {
"typeId":typeId.value typeId: typeId.value,
} }
getTypeDataList(obj).then(res => { getTypeDataList(obj)
console.log(res) .then((res) => {
maCodeSelectList.value = res.data.map(option => { console.log(res)
let obj = { maCodeSelectList.value = res.data.map((option) => {
...option, let obj = {
value:option.typeId, ...option,
text:option.typeName, value: option.typeId,
} text: option.typeName,
return obj }
}); return obj
}).catch(error => { })
console.log(error) })
}) .catch((error) => {
console.log(error)
})
} }
const getCode = () => { const getCode = () => {
let obj = { let obj = {
"typeId":'' typeId: '',
} }
getLeaseCode(obj).then(res => { getLeaseCode(obj)
console.log('xxxxxxxxxxxx',res) .then((res) => {
if(res.code == 200){ console.log('xxxxxxxxxxxx', res)
formData.value.code = res.data.taskCode if (res.code == 200) {
} formData.value.code = res.data.taskCode
}).catch(error => { }
console.log(error) })
}) .catch((error) => {
console.log(error)
})
} }
// //
const selectMaCode = (e) => { const selectMaCode = (e) => {
console.log(e) console.log(e)
// typeList typeId // typeList typeId
const exists = typeList.value.some(existingItem => existingItem.typeId === e); const exists = typeList.value.some((existingItem) => existingItem.typeId === e)
if (exists) { if (exists) {
let name = '' let name = ''
maCodeSelectList.value.forEach(item => { maCodeSelectList.value.forEach((item) => {
if (item.typeId === e) { if (item.typeId === e) {
name = item.typeName name = item.typeName
} }
}) })
uni.showToast({ uni.showToast({
title: `${name} 已添加到列表中`, title: `${name} 已添加到列表中`,
icon: 'none', icon: 'none',
duration: 1000 duration: 1000,
}) })
return return
} }
maCodeSelectList.value.forEach(item=>{ maCodeSelectList.value.forEach((item) => {
console.log(item) console.log(item)
if(item.typeId==e){ if (item.typeId == e) {
let param = { let param = {
typeId:item.typeId, typeId: item.typeId,
typeName:item.typeName, typeName: item.typeName,
maTypeName:item.maTypeName, maTypeName: item.maTypeName,
unitName:item.unitName, unitName: item.unitName,
remark:'', remark: '',
preNum:item.num, preNum: item.num,
} }
typeList.value.push(param) typeList.value.push(param)
} }
@ -441,28 +532,27 @@ const selectMaCode = (e) => {
console.log(typeList.value) console.log(typeList.value)
} }
// //
const submitNum = async() => { const submitNum = async () => {
console.log(typeList.value) console.log(typeList.value)
// 使 // 使
form.value.validate(async(valid)=>{ form.value.validate(async (valid) => {
console.log('🚀 ~ submitNum ~ valid:', valid) console.log('🚀 ~ submitNum ~ valid:', valid)
if(!valid){ if (!valid) {
if(flagFile.value && bmFileInfos.value.length==0){ if (flagFile.value && bmFileInfos.value.length == 0) {
await uni.showToast({ await uni.showToast({
title: '请上传附件', title: '请上传附件',
icon: 'none', icon: 'none',
duration: 1000 duration: 1000,
}) })
return return
} }
// preNum 0 // preNum 0
if (typeList.value.length === 0) { if (typeList.value.length === 0) {
console.log('🚀 ~ submitNum ~ typeList.value:', typeList.value) console.log('🚀 ~ submitNum ~ typeList.value:', typeList.value)
await uni.showToast({ await uni.showToast({
title: '请添加申请数据', title: '请添加申请数据',
icon: 'none', icon: 'none',
duration: 1000 duration: 1000,
}) })
return return
} }
@ -471,59 +561,59 @@ const submitNum = async() => {
uni.showToast({ uni.showToast({
title: '预领数量不能为空或等于0', title: '预领数量不能为空或等于0',
icon: 'none', icon: 'none',
duration: 1000 duration: 1000,
}) })
return return
} }
} }
let obj = { let obj = {
"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,
}, },
"leaseApplyDetailsList":typeList.value leaseApplyDetailsList: typeList.value,
} }
console.log(obj) console.log(obj)
leaseTask(obj).then( res => { leaseTask(obj)
console.log(res) .then((res) => {
if(res.code==200){ console.log(res)
console.log('xxxxxxxxxxxxxxxx') if (res.code == 200) {
uni.showToast({ title: '申请成功', icon: 'none',duration: 1000 console.log('xxxxxxxxxxxxxxxx')
}) uni.showToast({ title: '申请成功', icon: 'none', duration: 1000 })
setTimeout(() => { setTimeout(() => {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1,
}); })
}, 1000); }, 1000)
}else{ } else {
console.log('yyyyyyyyyyyyy') console.log('yyyyyyyyyyyyy')
uni.showToast({ title: res.msg, icon: 'none',duration: 1000 }) uni.showToast({ title: res.msg, icon: 'none', duration: 1000 })
} }
}).catch(error => { })
console.log(error) .catch((error) => {
}) console.log(error)
}else{ })
return; } else {
} return
}) }
})
} }
onReady(() => { onReady(() => {
if (form.value) { if (form.value) {
// //
form.value.setRules(rules.value); form.value.setRules(rules.value)
} else { } else {
console.error('表单引用未正确初始化'); console.error('表单引用未正确初始化')
} }
}); })
onLoad((options) => { onLoad((options) => {
getUnit() getUnit()
@ -535,7 +625,7 @@ onLoad((options) => {
}) })
// //
const uploadImg = (item) => { const uploadImg = (item) => {
if(bmFileInfos.value.length>=3){ if (bmFileInfos.value.length >= 3) {
uni.showToast({ uni.showToast({
title: '最多上传3张图片', title: '最多上传3张图片',
icon: 'none', icon: 'none',
@ -543,60 +633,60 @@ const uploadImg = (item) => {
return return
} }
uni.chooseImage({ uni.chooseImage({
count: 3 - bmFileInfos.value.length, // count: 3 - bmFileInfos.value.length, //
sizeType: ['original', 'compressed'], //original compressed sizeType: ['original', 'compressed'], //original compressed
sourceType: ['album', 'camera',], //album camera 使 sourceType: ['album', 'camera'], //album camera 使
success: res => { success: (res) => {
console.log(res) console.log(res)
let imgFiles = res.tempFilePaths // let imgFiles = res.tempFilePaths //
imgFiles.forEach((filePath) => { imgFiles.forEach((filePath) => {
console.log('2222222222222222222222') console.log('2222222222222222222222')
bmFileInfos.value.push({urlTemp:filePath}) bmFileInfos.value.push({ urlTemp: filePath })
}) })
console.log('🚀 ~ uploadImg ~ imgFiles:', imgFiles) console.log('🚀 ~ uploadImg ~ imgFiles:', imgFiles)
// imgBeseUrl.value = imgFiles[0] // imgBeseUrl.value = imgFiles[0]
// console.log('', imgFiles) // console.log('', imgFiles)
// console.log('', baseURL+"/file/upload") // console.log('', baseURL+"/file/upload")
bmFileInfos.value.forEach((item,index) => { bmFileInfos.value.forEach((item, index) => {
uni.uploadFile({ uni.uploadFile({
// url: baseURL+"/file/upload",//app // url: baseURL+"/file/upload",//app
url: "/file/upload",//h5 url: '/file/upload', //h5
filePath: item.urlTemp, filePath: item.urlTemp,
name: 'file', name: 'file',
success: (res) => { success: (res) => {
res = JSON.parse(res.data) res = JSON.parse(res.data)
console.log('上传成功', res.code); console.log('上传成功', res.code)
console.log('上传成功', res.data); console.log('上传成功', res.data)
if(res.code&&res.code==200){ if (res.code && res.code == 200) {
bmFileInfos.value[index] = { bmFileInfos.value[index] = {
...bmFileInfos.value[index], ...bmFileInfos.value[index],
name: res.data.name, name: res.data.name,
url: res.data.url url: res.data.url,
}; }
uni.showToast({ title: '上传成功', icon: 'none' }) uni.showToast({ title: '上传成功', icon: 'none' })
}else{ } else {
uni.showToast({ title: '上传失败', icon: 'none' }) uni.showToast({ title: '上传失败', icon: 'none' })
} }
}, },
fail: (err) => { fail: (err) => {
console.error('上传失败', err); console.error('上传失败', err)
} },
}); })
}); })
// this.$refs.vForm.clearValidate() // this.$refs.vForm.clearValidate()
} },
}) })
} }
const deleteImg = (index) => { const deleteImg = (index) => {
bmFileInfos.value.splice(index, 1); bmFileInfos.value.splice(index, 1)
// bmFileInfosTemp.value.splice(index, 1); // bmFileInfosTemp.value.splice(index, 1);
}; }
// //
const delRow = (index) => { const delRow = (index) => {
console.log(index) console.log(index)
console.log(typeList.value) console.log(typeList.value)
typeList.value.splice(index,1) typeList.value.splice(index, 1)
} }
// change // change
const onChangeNumber = (item) => { const onChangeNumber = (item) => {
@ -664,7 +754,6 @@ const clearConfig = () => {
configId.value = '' configId.value = ''
getConfig() getConfig()
} }
</script> </script>
<style lang="scss"> <style lang="scss">
@ -718,23 +807,23 @@ const clearConfig = () => {
} }
} }
} }
// //
.uni-group { .uni-group {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.uni-icons { .uni-icons {
padding: 8rpx; padding: 8rpx;
border-radius: 8rpx; border-radius: 8rpx;
transition: all 0.3s ease; transition: all 0.3s ease;
&:active { &:active {
transform: scale(0.9); transform: scale(0.9);
opacity: 0.8; opacity: 0.8;
} }
} }
} }
// //
.select-area { .select-area {
@ -811,29 +900,29 @@ const clearConfig = () => {
} }
// //
.upload { .upload {
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
background-color: #f7f8fa; background-color: #f7f8fa;
border: 2rpx dashed #d9d9d9; border: 2rpx dashed #d9d9d9;
border-radius: 12rpx; border-radius: 12rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 48rpx; font-size: 48rpx;
color: #bfbfbf; color: #bfbfbf;
transition: all 0.3s ease; transition: all 0.3s ease;
&:active { &:active {
background-color: #f0f0f0; background-color: #f0f0f0;
border-color: #3784fb; border-color: #3784fb;
} }
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 12rpx; border-radius: 12rpx;
object-fit: cover; object-fit: cover;
} }
} }
.image-container { .image-container {
position: relative; position: relative;

View File

@ -64,7 +64,7 @@
maxlength="200" maxlength="200"
></uni-easyinput> ></uni-easyinput>
</uni-forms-item> </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 <uni-easyinput
v-model="formData.fitNum" v-model="formData.fitNum"
type="number" type="number"
@ -73,7 +73,7 @@
:clearable="false" :clearable="false"
@blur="fitNumChange" @blur="fitNumChange"
></uni-easyinput> ></uni-easyinput>
</uni-forms-item> </uni-forms-item> -->
<uni-section title="领用工具器" type="line" /> <uni-section title="领用工具器" type="line" />
<eselect <eselect
v-model="equipmentId" v-model="equipmentId"

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="accept"> <view class="accept">
<div class="card"> <div class="card">
<uni-forms label-width="170rpx" :border="true"> <uni-forms label-width="91px" :border="true">
<uni-forms-item label="机具类型:" name="maName" required> <uni-forms-item label="机具类型:" name="maName" required>
<select-one style="width: 100%; height: 90rpx" :options="maNameList" placeholder="请选择机具类型" <select-one style="width: 100%; height: 90rpx" :options="maNameList" placeholder="请选择机具类型"
@change="onMaNameChange" @clear="onMaNameClear" /> @change="onMaNameChange" @clear="onMaNameClear" />