236 lines
6.4 KiB
Vue
236 lines
6.4 KiB
Vue
|
|
<!-- 仓库/存储区选择 -->
|
|||
|
|
<template>
|
|||
|
|
<view class="content">
|
|||
|
|
<view class="topSearch">
|
|||
|
|
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false"
|
|||
|
|
@iconClick="getList" placeholder="请输入搜索内容" />
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
<!-- 仓库/存储列表 -->
|
|||
|
|
<z-paging ref="pagingRef" class="containerBox" v-model="infoList" @query="getList">
|
|||
|
|
<uni-list class="listBox">
|
|||
|
|
<uni-list-item v-for="item in infoList" :key="item.id" clickable @click="onChecked(item)">
|
|||
|
|
<template v-slot:body>
|
|||
|
|
<view style="display: flex; flex-direction: column; width: 100%;" v-if="isWarehousing">
|
|||
|
|
<view class="line title">
|
|||
|
|
<p>仓库名称</p>
|
|||
|
|
<p>{{ item.deptName }}</p>
|
|||
|
|
</view>
|
|||
|
|
<view class="line content">
|
|||
|
|
<p>仓库编码</p>
|
|||
|
|
<p>{{ item.deptId }}</p>
|
|||
|
|
</view>
|
|||
|
|
<!-- todo 以下两个字段pc未维护暂时注释 -->
|
|||
|
|
<!-- <view class=" line content">
|
|||
|
|
<p>仓库类型</p>
|
|||
|
|
<p></p>
|
|||
|
|
</view>
|
|||
|
|
<view class="line content">
|
|||
|
|
<p>仓库位置</p>
|
|||
|
|
<p></p>
|
|||
|
|
</view> -->
|
|||
|
|
<view class="line content">
|
|||
|
|
<p>备注</p>
|
|||
|
|
<p>
|
|||
|
|
<span v-if="item?.remark"></span>
|
|||
|
|
<span v-else class="empty">未填写</span>
|
|||
|
|
</p>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
<view v-else style="display: flex; flex-direction: column;width: 100%;">
|
|||
|
|
<view class="line title">
|
|||
|
|
<p>{{ item.deptName }} ({{ item.deptId }})</p>
|
|||
|
|
</view>
|
|||
|
|
<view class="line content">
|
|||
|
|
<p>
|
|||
|
|
<span v-if="item?.remark">{{ item?.remark }}</span>
|
|||
|
|
<span v-else class="empty">未填写</span>
|
|||
|
|
</p>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
</template>
|
|||
|
|
</uni-list-item>
|
|||
|
|
</uni-list>
|
|||
|
|
</z-paging>
|
|||
|
|
</view>
|
|||
|
|
</template>
|
|||
|
|
<script setup>
|
|||
|
|
import { ref, toRefs } from 'vue';
|
|||
|
|
import { onShow } from "@dcloudio/uni-app";
|
|||
|
|
import { getWarehousingInfo } from '../../api/system';
|
|||
|
|
import getRepository from "@/api/getRepository";
|
|||
|
|
import { objectToQuery } from '../until';
|
|||
|
|
|
|||
|
|
const props = defineProps({
|
|||
|
|
// 是否为仓库查询
|
|||
|
|
isWarehousing: {
|
|||
|
|
type: Boolean,
|
|||
|
|
default: true,
|
|||
|
|
required: true
|
|||
|
|
},
|
|||
|
|
// 返回出库开单/入库开单
|
|||
|
|
backStr: {
|
|||
|
|
type: String,
|
|||
|
|
default: true,
|
|||
|
|
required: true
|
|||
|
|
},
|
|||
|
|
pathParams: {
|
|||
|
|
type: Object,
|
|||
|
|
default: null,
|
|||
|
|
required: false
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
const { isWarehousing, backStr, pathParams } = toRefs(props)
|
|||
|
|
// 数据:查询关键字
|
|||
|
|
const queryParams = ref({
|
|||
|
|
keyword: ''
|
|||
|
|
})
|
|||
|
|
// 绑定:加载屏
|
|||
|
|
const pagingRef = ref(null)
|
|||
|
|
// 数据:仓库/存储区
|
|||
|
|
const infoList = ref([])
|
|||
|
|
|
|||
|
|
// 列表判断:获取仓库列表/存储库列表
|
|||
|
|
const getList = () => {
|
|||
|
|
if (isWarehousing.value) {
|
|||
|
|
// 仓库列表
|
|||
|
|
getWarehousing()
|
|||
|
|
} else {
|
|||
|
|
// 存储库列表
|
|||
|
|
getRepositoryInfo()
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 列表:仓库列表
|
|||
|
|
const getWarehousing = () => {
|
|||
|
|
const userInfo = uni.getStorageSync('app_user')
|
|||
|
|
const params = {
|
|||
|
|
userId: `${userInfo.userId}`,
|
|||
|
|
keyword: queryParams.value.keyword
|
|||
|
|
}
|
|||
|
|
getWarehousingInfo(params).then(res => {
|
|||
|
|
res.data.forEach(e => {
|
|||
|
|
e.showMore = false;
|
|||
|
|
});
|
|||
|
|
pagingRef.value.complete(res.data)
|
|||
|
|
}).catch(res => {
|
|||
|
|
pagingRef.value.complete(false)
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
// 列表:存储区列表
|
|||
|
|
const getRepositoryInfo = async () => {
|
|||
|
|
getRepository({ pageNum: 1, pageSize: 10 }).then(res => {
|
|||
|
|
res.data.forEach(e => {
|
|||
|
|
e.showMore = false;
|
|||
|
|
});
|
|||
|
|
pagingRef.value.complete(res.data)
|
|||
|
|
}).catch(res => {
|
|||
|
|
pagingRef.value.complete(false)
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 返回路径
|
|||
|
|
const toBack = (back) => {
|
|||
|
|
let url = ''
|
|||
|
|
switch (back) {
|
|||
|
|
case 'stockIn':
|
|||
|
|
// 入库单开单
|
|||
|
|
url = '/pages/warehousing/stockIn/create'
|
|||
|
|
break;
|
|||
|
|
case 'stockOut':
|
|||
|
|
// 出库单开单
|
|||
|
|
url = ''
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
let params = pathParams.value
|
|||
|
|
delete params.backStr
|
|||
|
|
delete params.flag
|
|||
|
|
const query = objectToQuery(params)
|
|||
|
|
uni.navigateTo({
|
|||
|
|
url: `${url}${query}`
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
// 选择:仓库/存储区
|
|||
|
|
const onChecked = (val) => {
|
|||
|
|
const flag = isWarehousing.value ? 'app_warehousing' : 'app_storageArea'
|
|||
|
|
let infoChecked = uni.getStorageSync(flag);
|
|||
|
|
if (!Array.isArray(infoChecked)) {
|
|||
|
|
infoChecked = [];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (val) {
|
|||
|
|
infoChecked = [{ ...val }]
|
|||
|
|
uni.setStorageSync(flag, infoChecked);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 返回list
|
|||
|
|
toBack(backStr.value)
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
onShow(() => {
|
|||
|
|
pagingRef.value?.reload?.()
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
<style scoped lang="scss">
|
|||
|
|
.topSearch {
|
|||
|
|
position: fixed;
|
|||
|
|
top: 0;
|
|||
|
|
left: 0;
|
|||
|
|
right: 0;
|
|||
|
|
z-index: 999;
|
|||
|
|
padding: 4rpx;
|
|||
|
|
background-color: #fff;
|
|||
|
|
border-bottom: 1px solid #eee;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.containerBox {
|
|||
|
|
padding-top: 44px;
|
|||
|
|
width: 100%;
|
|||
|
|
height: 100%;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
|
|||
|
|
.zp-l-text-rpx {
|
|||
|
|
font-size: 12px;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
::v-deep.listBox {
|
|||
|
|
.uni-list {
|
|||
|
|
background-color: #F8F8FF;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.uni-list-item {
|
|||
|
|
margin-bottom: 1rpx;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.uni-list-item__container {
|
|||
|
|
padding: 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.line {
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
align-items: center;
|
|||
|
|
border-bottom: 1px solid #eee;
|
|||
|
|
padding: 12rpx;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.title {
|
|||
|
|
font-weight: 600;
|
|||
|
|
font-size: 14px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.content {
|
|||
|
|
font-weight: 500;
|
|||
|
|
font-size: 13px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.empty {
|
|||
|
|
color: #D3D3D3;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</style>
|