Browse Source

仓库管理 直接传详情数据到修改页面

master
邓宏 2 years ago
parent
commit
45ebc799ec
  1. 27
      pages/warehouse/detail.vue
  2. 35
      pages/warehouse/info.vue
  3. 25
      pages/warehouse/mana.vue

27
pages/warehouse/detail.vue

@ -76,16 +76,16 @@
<text>仓库位置</text> <text>{{detail.warehouseAddress}}</text> <text>仓库位置</text> <text>{{detail.warehouseAddress}}</text>
</view> </view>
<view class="item"> <view class="item">
<text>仓库容量</text> <text>{{detail.warehouseVolume}}</text> <text>仓库容量</text> <text>{{detail.warehouseVolume}}(m²)</text>
</view> </view>
<view class="item"> <view class="item">
<text>仓库类型</text> <text>{{detail.warehouseType}}</text> <text>仓库类型</text> <text>{{detail.warehouseType_dictText}}</text>
</view> </view>
<view class="item"> <view class="item">
<text>仓库管理员</text> <text>{{detail.warehouseKeeper}}</text> <text>仓库管理员</text> <text>{{detail.contactPeople}}</text>
</view> </view>
<view class="item"> <view class="item">
<text>库管员电话</text> <text>{{detail.warehouseKeeperTelephone}}</text> <text>库管员电话</text> <text>{{detail.contactNumber}}</text>
</view> </view>
</view> </view>
@ -107,24 +107,11 @@ import request from '@/common/request.js'
} }
}, },
onLoad(options){ onLoad(options){
this.getDetail(options.id) var eventChannel=this.getOpenerEventChannel()
eventChannel.on("detail", e=>this.detail=e)
}, },
methods:{ methods:{
async getDetail(warehouseId){
var res=await request("/api/WarehouseManageApi/querysWarehouseDetails",{
params:{warehouseId}
})
if(res.statu){
this.detail=res.data.upper
this.list=res.data.lower
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取仓库详情失败!",
showCancel:false,
})
}
}
} }
} }
</script> </script>

35
pages/warehouse/info.vue

@ -73,12 +73,17 @@ import request from '@/common/request.js'
onLoad(options){ onLoad(options){
this.eventChannel=this.getOpenerEventChannel() this.eventChannel=this.getOpenerEventChannel()
this.init() this.init()
if(options.id){ this.eventChannel.on("detail", e=>{
this.getDetail(options.id) if(e){
}else if(this.$store.getters['userInfo'].roleCode=="baseAdmin"){ this.formData=e
this.formData.contactPeople=this.$store.getters['userInfo'].realname this.fields.warehousePic.value=e.warehousePic.join(',')
this.formData.contactNumber=this.$store.getters['userInfo'].phone this.fields.warehouseType.value=[e.warehouseType]
} this.fields.goodsType.value=[e.goodsType]
}else if(this.$store.getters['userInfo'].roleCode=="baseAdmin"){
this.formData.contactPeople=this.$store.getters['userInfo'].realname
this.formData.contactNumber=this.$store.getters['userInfo'].phone
}
})
}, },
methods:{ methods:{
async init(){ async init(){
@ -138,24 +143,6 @@ import request from '@/common/request.js'
} }
}) })
}, },
async getDetail(id){
var res=await request("/api/WarehouseManageApi/queryById",{
params:{id}
})
if(res.statu){
this.formData=res.data
this.fields.warehousePic.value=res.data.warehousePic
this.formData.warehousePic=res.data.warehousePic?.split?.(",")?.filter?.(v=>v)||[]
this.fields.warehouseType.value=[res.data.warehouseType]
this.fields.goodsType.value=[res.data.goodsType]
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取仓库详情失败!",
showCancel:false,
})
}
},
}, },
} }
</script> </script>

25
pages/warehouse/mana.vue

@ -92,7 +92,7 @@
<d-search v-model="searchVal.search" @search="clean();search()"/> <d-search v-model="searchVal.search" @search="clean();search()"/>
<scroll-view scroll-y @scrolltolower="search"> <scroll-view scroll-y @scrolltolower="search">
<view class="card item" v-for="(v,k) in list" :key="k" @click="$u.route({url:'pages/warehouse/detail',params:{id:v.warehouseId}})"> <view class="card item" v-for="(v,k) in list" :key="k" @click="toDetail(v)">
<view class="img"> <view class="img">
<u-image width="100%" height="144rpx" radius="16rpx" mode="aspectFill" :src="`${host}/${v.warehousePic[0]}`"> <u-image width="100%" height="144rpx" radius="16rpx" mode="aspectFill" :src="`${host}/${v.warehousePic[0]}`">
<text slot="error" class="plant-xiaopangchetupianjiazaishibai" style="font-size:45rpx"/> <text slot="error" class="plant-xiaopangchetupianjiazaishibai" style="font-size:45rpx"/>
@ -104,10 +104,10 @@
<view class="title">{{v.warehouseName}} <text class="plant-youbian"/></view> <view class="title">{{v.warehouseName}} <text class="plant-youbian"/></view>
<view class="adder">{{v.warehouseAddress}}</view> <view class="adder">{{v.warehouseAddress}}</view>
<view class="data"> <view class="data">
<text>库存种类{{v.inventoryCount||0}}</text> <text>{{v.capacity||0}}</text> <text>库存种类{{v.inventoryCount||0}}</text> <text>{{v.warehouseVolume||0}}</text>
</view> </view>
<view class="btns"> <view class="btns">
<text class="plant-xiugai" @click.stop="toAdd(v.warehouseId)">修改</text> <text class="plant-xiugai" @click.stop="toAdd(v)">修改</text>
<text class="plant-shanchu" @click.stop="del(k)">删除</text> <text class="plant-shanchu" @click.stop="del(k)">删除</text>
<text class="plant-chakan" @click.stop="$u.route({url:'pages/stock/mana',params:{id:v.id, goodsType:({1:'nz',2:'ncp'})[v.goodsType]}})">查看库存</text> <text class="plant-chakan" @click.stop="$u.route({url:'pages/stock/mana',params:{id:v.id, goodsType:({1:'nz',2:'ncp'})[v.goodsType]}})">查看库存</text>
</view> </view>
@ -118,7 +118,7 @@
</view> </view>
</template> </template>
<script> <script>
import request,{host} from '@/common/request.js' import request,{host} from '@/common/request'
export default { export default {
data(){ data(){
return{ return{
@ -192,13 +192,24 @@ import request,{host} from '@/common/request.js'
} }
}) })
}, },
toAdd(id){ toAdd(e){
uni.navigateTo({ uni.navigateTo({
url:`/pages/warehouse/info?id=${id||''}`, url:`/pages/warehouse/info`,
events:{update:()=>{ events:{update:()=>{
this.clean() this.clean()
this.search() this.search()
}} }},
success(res){
res.eventChannel.emit("detail", e)
}
})
},
toDetail(e){
uni.navigateTo({
url:"/pages/warehouse/detail",
success(res){
res.eventChannel.emit('detail', {...e})
}
}) })
} }
} }

Loading…
Cancel
Save