bug修改

This commit is contained in:
jjLv 2025-08-22 13:56:35 +08:00
parent a243788a27
commit e33be099d4
3 changed files with 654 additions and 658 deletions

View File

@ -5,56 +5,37 @@
<scroll-view style="width: 100%;height: calc(100vh - 80px);" scroll-y="true"> <scroll-view style="width: 100%;height: calc(100vh - 80px);" scroll-y="true">
<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" style="margin-left: 20rpx;"> <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" style="margin-left: 20rpx;">
<u-form-item label="出库单号:" labelWidth="180rpx" style="height: 6vh"> <u-form-item label="出库单号:" labelWidth="180rpx" style="height: 6vh">
<u--input <u--input v-model.number="form.outCode" placeholder="自动生成" :disabled="true"
v-model.number="form.outCode" type="number"></u--input>
placeholder="自动生成"
:disabled="true"
type="number"
></u--input>
</u-form-item> </u-form-item>
<u-form-item label="所属区域" prop="areaId" required labelWidth="180rpx" style="height: 6vh"> <u-form-item label="所属区域" prop="areaId" required labelWidth="180rpx" style="height: 6vh">
<uni-data-select <uni-data-select v-model="form.areaId" :localdata="selectors.areaId.options" placeholder="请选择所属区域"
v-model="form.areaId" style="text-align: left;" @change="changeWarehouse"></uni-data-select>
:localdata="selectors.areaId.options"
placeholder="请选择所属区域"
style="text-align: left;"
@change="changeWarehouse"
></uni-data-select>
</u-form-item> </u-form-item>
<u-form-item label="货品仓库" prop="warehouseId" required labelWidth="180rpx" style="height: 6vh"> <u-form-item label="货品仓库" prop="warehouseId" required labelWidth="180rpx" style="height: 6vh">
<uni-data-select <uni-data-select v-model="form.warehouseId" :localdata="selectors.warehouseId.options"
v-model="form.warehouseId" placeholder="请选择货品仓库" style="text-align: left;"></uni-data-select>
:localdata="selectors.warehouseId.options"
placeholder="请选择货品仓库"
style="text-align: left;"
></uni-data-select>
</u-form-item> </u-form-item>
<u-form-item label="出库类型" prop="outType" required labelWidth="180rpx" style="height: 6vh"> <u-form-item label="出库类型" prop="outType" required labelWidth="180rpx" style="height: 6vh">
<uni-data-select <uni-data-select v-model="form.outType" :localdata="selectors.outType.options" placeholder="请选择入库类型"
v-model="form.outType" style="text-align: left;"></uni-data-select>
:localdata="selectors.outType.options"
placeholder="请选择入库类型"
style="text-align: left;"
></uni-data-select>
</u-form-item> </u-form-item>
<u-form-item label="领料人" prop="fetchUserId" required labelWidth="180rpx" style="height: 6vh"> <u-form-item label="领料人" prop="fetchUserId" required labelWidth="180rpx" style="height: 6vh">
<uni-data-select <uni-data-select v-model="form.fetchUserId" :localdata="selectors.fetchUserId.options"
v-model="form.fetchUserId" placeholder="请选择入库人" style="text-align: left;"></uni-data-select>
:localdata="selectors.fetchUserId.options"
placeholder="请选择入库人"
style="text-align: left;"
></uni-data-select>
</u-form-item> </u-form-item>
<u-form-item label="备注说明" prop="remark" labelWidth="180rpx" style="height: 200rpx"> <u-form-item label="备注说明" prop="remark" labelWidth="180rpx" style="height: 200rpx">
<uni-easyinput type="textarea" v-model="form.remark" placeholder="请输入备注" maxlength="100" /> <uni-easyinput type="textarea" v-model="form.remark" placeholder="请输入备注" maxlength="100" />
</u-form-item> </u-form-item>
<u-form-item style="width: 100%; padding: 20rpx 0;"> <u-form-item style="width: 100%; padding: 20rpx 0;">
<view class="button-group"> <view class="button-group">
<view @click="selectGoods" class="action-button" style="background: linear-gradient( 270deg, #7D97FF 0%, #4367F5 100%);width: 200rpx;"> <view @click="selectGoods" class="action-button"
style="background: linear-gradient( 270deg, #7D97FF 0%, #4367F5 100%);width: 200rpx;">
<image src="/static/images/handheld/ic_select_goods.png" class="button-icon"></image> <image src="/static/images/handheld/ic_select_goods.png" class="button-icon"></image>
<text class="button-text">选择货品</text> <text class="button-text">选择货品</text>
</view> </view>
<view @click="selectDocument" class="action-button" style="margin-left: 20rpx;background: linear-gradient( 270deg, #FFB679 0%, #EF882E 100%);width: 200rpx;"> <view @click="selectDocument" class="action-button"
style="margin-left: 20rpx;background: linear-gradient( 270deg, #FFB679 0%, #EF882E 100%);width: 200rpx;">
<image src="/static/images/handheld/ic_select_document.png" class="button-icon"></image> <image src="/static/images/handheld/ic_select_document.png" class="button-icon"></image>
<text class="button-text">选择领料单</text> <text class="button-text">选择领料单</text>
</view> </view>
@ -75,7 +56,9 @@
<view style="width:90%;"> <view style="width:90%;">
<text style="margin-left: 10px;">{{ item.materialName }}</text> <text style="margin-left: 10px;">{{ item.materialName }}</text>
</view> </view>
<view style="width:10%;display: flex;align-items: center;justify-content: center">{{ index + 1 }} <view
style="width:10%;display: flex;align-items: center;justify-content: center">
{{ index + 1 }}
</view> </view>
</view> </view>
</view> </view>
@ -118,36 +101,33 @@
</view> </view>
</view> </view>
<u-button class="action-btn delete-btn" text="删除" @click="del"></u-button> <u-button class="action-btn delete-btn" text="删除" @click="del"></u-button>
<u-button class="action-btn save-btn" text="保存" @click="handleSubmit"></u-button> <u-button class="action-btn save-btn" text="保存" @click="handleSubmit" :throttle-time="1000"></u-button>
</view> </view>
<u-action-sheet <u-action-sheet v-if="currentSelector" :show="selectorVisible" :actions="getSelectorOptions(currentSelector)"
v-if="currentSelector" :title="getSelectorTitle(currentSelector)" @close="hideSelector" style="max-height: 400px"
:show="selectorVisible"
:actions="getSelectorOptions(currentSelector)"
:title="getSelectorTitle(currentSelector)"
@close="hideSelector"
style="max-height: 400px"
@select="handleSelectorSelect"></u-action-sheet> @select="handleSelectorSelect"></u-action-sheet>
</view> </view>
</template> </template>
<script> <script>
import {
import {
addEnterRecord, addEnterRecord,
addOutRecord, addOutRecord,
getAreaApi, getAreaApi,
getPersonApi, getPersonApi,
getSupplierApi, getSupplierApi,
getWarehouseApi getWarehouseApi
} from '@/api/enterExit' } from '@/api/enterExit'
import UButton from '@/uni_modules/uview-ui/components/u-button/u-button.vue' import UButton from '@/uni_modules/uview-ui/components/u-button/u-button.vue'
import URow from '@/uni_modules/uview-ui/components/u-row/u-row.vue' import URow from '@/uni_modules/uview-ui/components/u-row/u-row.vue'
export default { export default {
components: { URow, UButton }, components: {
URow,
UButton
},
data() { data() {
return { return {
fontValue: uni.getStorageSync('fontSize') || 8, fontValue: uni.getStorageSync('fontSize') || 8,
@ -157,17 +137,45 @@ export default {
totalMoney: 0.00, totalMoney: 0.00,
totalNum: 0.00, totalNum: 0.00,
selectors: { selectors: {
areaId: { options: [], title: '请选择所属区域' }, areaId: {
warehouseId: { options: [], title: '请选择所属仓库' }, options: [],
fetchUserId: { options: [], title: '请选择领料人' }, title: '请选择所属区域'
supplierId: { options: [], title: '请选择供应商' }, },
warehouseId: {
options: [],
title: '请选择所属仓库'
},
fetchUserId: {
options: [],
title: '请选择领料人'
},
supplierId: {
options: [],
title: '请选择供应商'
},
outType: { outType: {
options: [ options: [{
{ name: '领取出库', text: '领取出库', value: '1' }, name: '领取出库',
{ name: '报损出库', text: '报损出库', value: '2' }, text: '领取出库',
{ name: '退货出库', text: '退货出库', value: '3' }, value: '1'
{ name: '调拨出库', text: '调拨出库', value: '4' } },
], title: '请选择出库类型' {
name: '报损出库',
text: '报损出库',
value: '2'
},
{
name: '退货出库',
text: '退货出库',
value: '3'
},
{
name: '调拨出库',
text: '调拨出库',
value: '4'
}
],
title: '请选择出库类型'
} }
}, },
imsOutInventoryDetailAddList: [], imsOutInventoryDetailAddList: [],
@ -184,7 +192,7 @@ export default {
totalAmount: 0, totalAmount: 0,
totalNum: 0, totalNum: 0,
outDate: null outDate: null
},// }, //
showProductCalendar: false, showProductCalendar: false,
showExpireCalendar: false, showExpireCalendar: false,
dateValue: new Date(), dateValue: new Date(),
@ -194,7 +202,6 @@ export default {
supplierName: null supplierName: null
}, },
currentDateOption: -1, currentDateOption: -1,
isUploading: false,
} }
}, },
onLoad(options) { onLoad(options) {
@ -205,7 +212,7 @@ export default {
item.checked = false // item.checked = false //
}) })
this.form = options.form ? JSON.parse(decodeURIComponent(options.form)) : this.form this.form = options.form ? JSON.parse(decodeURIComponent(options.form)) : this.form
console.log('form------',this.form) console.log('form------', this.form)
this.areaControlName = this.getDisplayName('areaId', this.form.areaId) this.areaControlName = this.getDisplayName('areaId', this.form.areaId)
this.calculateTotal() this.calculateTotal()
} }
@ -328,7 +335,7 @@ export default {
return return
} }
uni.navigateTo({ uni.navigateTo({
url: '/pages/enterAndExit/exit/selectGoods?form=' + JSON.stringify(this.form) url: '/pages/enterAndExit/exit/selectGoods?form=' + JSON.stringify(this.form) + '&selectList=' + encodeURIComponent(JSON.stringify(this.imsOutInventoryDetailAddList))
}) })
}, },
selectDocument() { selectDocument() {
@ -355,79 +362,49 @@ export default {
this.allChecked = false this.allChecked = false
this.calculateTotal() this.calculateTotal()
}, },
handleSubmit() { async handleSubmit() {
if (this.isUploading) return const requiredFields = [
this.isUploading = true { key: 'areaId', msg: '请选择所属区域' },
if (this.checkIsExist(this.form.areaId)) { { key: 'warehouseId', msg: '请选择货品仓库' },
this.isUploading = false { key: 'outType', msg: '请选择出库类型' },
uni.showToast({ { key: 'fetchUserId', msg: '请选择领料人' }
title: '请选择所属区域', ]
icon: 'none' for (const field of requiredFields) {
}) if (this.checkIsExist(this.form[field.key])) {
return
} else if (this.checkIsExist(this.form.warehouseId)) { uni.showToast({ title: field.msg, icon: 'none' })
this.isUploading = false
uni.showToast({
title: '请选择货品仓库',
icon: 'none'
})
return
} else if (this.checkIsExist(this.form.outType)) {
this.isUploading = false
uni.showToast({
title: '请选择出库类型',
icon: 'none'
})
return
} else if (this.checkIsExist(this.form.fetchUserId)) {
this.isUploading = false
uni.showToast({
title: '请选择领料人',
icon: 'none'
})
return
} else if (this.imsOutInventoryDetailAddList.length === 0) {
this.isUploading = false
uni.showToast({
title: '请选择出库货品',
icon: 'none'
})
return return
} }
var tf = false }
this.imsOutInventoryDetailAddList.forEach(item => { if (this.imsOutInventoryDetailAddList.length === 0) {
if (tf) {
this.isUploading = false uni.showToast({ title: '请选择出库货品', icon: 'none' })
return return
} }
for (const item of this.imsOutInventoryDetailAddList) {
if (this.checkIsExist(item.fetchNum)) { if (this.checkIsExist(item.fetchNum)) {
this.isUploading = false
uni.showToast({ uni.showToast({
title: '请输入货品:【' + item.materialName + '】的数量', title: `请输入货品:【${item.materialName}】的数量`,
icon: 'none' icon: 'none'
}) })
tf = true
return return
} }
if (item.materialNum && item.materialNum > 0 && item.fetchNum > item.materialNum) { if (item.materialNum && item.materialNum > 0 && item.fetchNum > item.materialNum) {
this.isUploading = false
uni.showToast({ uni.showToast({
title: '货品:【' + item.materialName + '】的出库数量不能大于库存数量【' + item.materialNum + '】', title: `货品:【${item.materialName}】的出库数量不能大于库存数量【${item.materialNum}`,
icon: 'none' icon: 'none'
}) })
tf = true return
} }
})
if (!tf) {
this.uploadDate()
} }
await this.uploadDate()
}, },
async uploadDate() { async uploadDate() {
var list = this.imsOutInventoryDetailAddList var list = this.imsOutInventoryDetailAddList
const now = new Date() const now = new Date()
const dateTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}` const dateTime =
`${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`
let param = { let param = {
...this.form, ...this.form,
imsOutInventoryDetailAddList: list, imsOutInventoryDetailAddList: list,
@ -435,15 +412,16 @@ export default {
outDate: dateTime outDate: dateTime
} }
const res = await addOutRecord(param) const res = await addOutRecord(param)
console.log(res) console.log("res===========",res)
if (res.code == 200) { if (res.code == 200) {
console.log('出库成功=======', res)
uni.$u.toast('出库成功') uni.$u.toast('出库成功')
setTimeout(() => { setTimeout(() => {
this.$tab.reLaunch('/pages/enterAndExit/exit/index') this.$tab.reLaunch('/pages/enterAndExit/exit/index')
}, 1000) }, 1000)
} else { } else {
this.isUploading = false const msg = res.code == 500 ? res.msg : '出库失败,请稍后再试'
uni.$u.toast('出库失败,请稍后再试') uni.$u.toast(msg)
} }
}, },
@ -453,7 +431,7 @@ export default {
calculateTotal(e) { calculateTotal(e) {
if (!e || typeof e.fetchNum === 'undefined') { if (!e || typeof e.fetchNum === 'undefined') {
this.totalNum = 0 this.totalNum = 0
}else if(e.fetchNum && e.fetchNum < 0) { } else if (e.fetchNum && e.fetchNum < 0) {
uni.showToast({ uni.showToast({
title: '领取数量不能小于0', title: '领取数量不能小于0',
icon: 'none' icon: 'none'
@ -465,26 +443,28 @@ export default {
}, 0) }, 0)
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
page { page {
// //
min-height: 100vh; min-height: 100vh;
background-size: 100% 100%; background-size: 100% 100%;
} }
.u-form-item {
.u-form-item {
min-height: 80rpx !important; min-height: 80rpx !important;
padding: 20rpx 0 !important; padding: 20rpx 0 !important;
} }
.button-group {
.button-group {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
width: 100%; width: 100%;
} }
.action-button { .action-button {
width: 48%; width: 48%;
height: 110rpx; height: 110rpx;
border-radius: 8rpx; border-radius: 8rpx;
@ -492,19 +472,20 @@ page {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.button-icon { .button-icon {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.button-text { .button-text {
color: #FFFFFF; color: #FFFFFF;
font-size: 28rpx; font-size: 28rpx;
} }
.health-form {
.health-form {
padding: 20rpx; padding: 20rpx;
height: 100vh; height: 100vh;
background-color: #F7F7F7; background-color: #F7F7F7;
@ -520,9 +501,9 @@ page {
display: block; display: block;
} }
} }
} }
.submit-btn { .submit-btn {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@ -534,64 +515,65 @@ page {
right: 0; right: 0;
height: 100rpx; height: 100rpx;
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05); box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
} }
.checked { .checked {
display: flex; display: flex;
align-items: center; align-items: center;
width: 20%; width: 20%;
} }
.check-all-text { .check-all-text {
margin-left: 10rpx; margin-left: 10rpx;
font-size: 26rpx; font-size: 26rpx;
} }
.total-info { .total-info {
width: 30%; width: 30%;
} }
.total-item { .total-item {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.total-label { .total-label {
font-size: 20rpx; font-size: 20rpx;
color: #A69F9A; color: #A69F9A;
} }
.total-value { .total-value {
font-size: 28rpx; font-size: 28rpx;
color: #FF6816; color: #FF6816;
font-weight: bold; font-weight: bold;
margin-left: 10rpx; margin-left: 10rpx;
} }
.action-btn { .action-btn {
width: 150rpx !important; width: 150rpx !important;
height: 70rpx !important; height: 70rpx !important;
border-radius: 8rpx !important; border-radius: 8rpx !important;
margin-left: 20rpx !important; margin-left: 20rpx !important;
} }
.delete-btn { .delete-btn {
background: linear-gradient(270deg, #F87665 0%, #E43D26 100%) !important; background: linear-gradient(270deg, #F87665 0%, #E43D26 100%) !important;
color: white !important; color: white !important;
} }
.save-btn { .save-btn {
background: linear-gradient(270deg, #FFB679 0%, #EF882E 100%) !important; background: linear-gradient(270deg, #FFB679 0%, #EF882E 100%) !important;
color: white !important; color: white !important;
} }
.searchInput {
.searchInput {
width: 80%; width: 80%;
height: 40px; height: 40px;
margin-left: 10px; margin-left: 10px;
font-size: 16px; font-size: 16px;
} }
.chronic-science { .chronic-science {
width: 100%; width: 100%;
height: 35vh; height: 35vh;
@ -651,46 +633,46 @@ page {
} }
} }
} }
} }
::v-deep .uni-scroll-view-content { ::v-deep .uni-scroll-view-content {
max-height: 16vh !important; max-height: 16vh !important;
} }
::v-deep .u-form-item { ::v-deep .u-form-item {
min-height: 100rpx; min-height: 100rpx;
&__body__right__content__slot { &__body__right__content__slot {
text-align: right; text-align: right;
} }
} }
::v-deep .u-checkbox { ::v-deep .u-checkbox {
margin-bottom: 16rpx; margin-bottom: 16rpx;
} }
/deep/ uni-checkbox .uni-checkbox-input { /deep/ uni-checkbox .uni-checkbox-input {
width: 25px; width: 25px;
height: 25px; height: 25px;
border-radius: 15px; border-radius: 15px;
} }
/deep/ uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked { /deep/ uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
border-color: #ddd; border-color: #ddd;
color: #fff !important; color: #fff !important;
background-color: #3E34FF !important; background-color: #3E34FF !important;
} }
/deep/ uni-checkbox .uni-checkbox-input { /deep/ uni-checkbox .uni-checkbox-input {
border-color: #ddd; border-color: #ddd;
} }
/deep/ uni-checkbox .uni-checkbox-input:hover { /deep/ uni-checkbox .uni-checkbox-input:hover {
border-color: #ddd; border-color: #ddd;
} }
.date-input { .date-input {
flex: 1; flex: 1;
width: 75%; width: 75%;
@ -701,5 +683,5 @@ page {
.selected-date { .selected-date {
color: #333333; color: #333333;
} }
} }
</style> </style>

View File

@ -8,7 +8,8 @@
@iconClick="search" @iconClick="search"
@keyup.enter.native="search"></uni-easyinput> @keyup.enter.native="search"></uni-easyinput>
</view> </view>
<uni-table :th-style="{backgroundColor:'#3c94fd'}" type="selection" @selection-change="selectChange" border stripe empty-text="暂无更多数据"> <uni-table ref="uniTable" :th-style="{backgroundColor:'#3c94fd'}" type="selection"
@selection-change="selectChange" border stripe empty-text="暂无更多数据">
<view class="tableHeader"> <view class="tableHeader">
<uni-tr style="display:flex;width: 100%"> <uni-tr style="display:flex;width: 100%">
<uni-th align="center" style="width: 25vw">货品编码</uni-th> <uni-th align="center" style="width: 25vw">货品编码</uni-th>
@ -69,6 +70,7 @@ export default {
onLoad(options) { onLoad(options) {
console.log('options:', options) console.log('options:', options)
this.form = options.form ? JSON.parse(decodeURIComponent(options.form)) : this.form this.form = options.form ? JSON.parse(decodeURIComponent(options.form)) : this.form
this.selectList = options.selectList ? JSON.parse(decodeURIComponent(options.selectList)) : []
console.log('form:', this.form) console.log('form:', this.form)
this.getList() this.getList()
}, },
@ -114,9 +116,21 @@ export default {
this.tableList.map(item => { this.tableList.map(item => {
if (item.materialId === selectItem.materialId) { if (item.materialId === selectItem.materialId) {
item.checked = true item.checked = true
item.fetchNum = selectItem.fetchNum
} }
}) })
}) })
this.$nextTick(() => {
if (this.$refs.uniTable) {
this.tableList.forEach((item, index) => {
if (item.checked) {
this.$refs.uniTable.toggleRowSelection(index, true)
}
})
} else {
console.warn('uniTable未挂载或setSelection方法不存在')
}
})
this.status = this.total == this.tableList.length ? 'nomore' : 'loadmore' this.status = this.total == this.tableList.length ? 'nomore' : 'loadmore'
} catch (error) { } catch (error) {
console.log(error) console.log(error)

View File

@ -38,7 +38,7 @@ export default {
searchValue: '', searchValue: '',
tableList: [], tableList: [],
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 100,
total: 0, total: 0,
status: 'loadmore', status: 'loadmore',
} }
@ -85,8 +85,8 @@ export default {
} }
}, },
handleImage(item) { handleImage(item) {
if (item.materialImage) { if (item.imgUrl) {
return item.materialImage return item.imgUrl
} else { } else {
return '/static/images/handheld/ic_goods_img.jpg' return '/static/images/handheld/ic_goods_img.jpg'
} }