出库对接

This commit is contained in:
zx
2026-04-14 08:46:29 +08:00
parent b16dd22d70
commit 6f1db0f92e
30 changed files with 1366 additions and 458 deletions

View File

@@ -0,0 +1,170 @@
<!-- 选择 -->
<template>
<navigation title="我提交的技术鉴定表" :back-url="backUrl"></navigation>
<view class="contentBox">
<view class="topSearch">
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false"
@iconClick="getTechnicalList" placeholder="请输入搜索内容" />
</view>
<!-- 列表 -->
<z-paging ref="pagingRef" class="containerBox" v-model="infoList" @query="getTechnicalList">
<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%;">
<view class="line title">
<p>技术鉴定表</p>
<p>{{ item?.appraisalNo }}</p>
</view>
<view class="line content">
<uv-upload :fileList="item?.fileUrlList" name="3" multiple :maxCount="6"
:previewFullImage="true"></uv-upload>
</view>
<view class="line content">
<p>备注</p>
<p>
<span v-if="item?.appraisalDesc">{{ item?.appraisalDesc }}</span>
<span v-else class="empty">未填写</span>
</p>
</view>
<view class="line content">
<p>创建时间</p>
<view>{{ formatDate(item?.createTime) }}</view>
</view>
</view>
</template>
</uni-list-item>
</uni-list>
</z-paging>
</view>
</template>
<script setup>
import { ref, toRefs } from 'vue';
import { onShow, onLoad } from "@dcloudio/uni-app";
import { myList } from '@/api/stockOut';
import { formatDate, objectToQuery } from '../../../until';
import Navigation from '../../../components/Navigation.vue';
const props = defineProps({
pathParams: {
type: Object,
default: null,
required: false
}
})
const { pathParams } = toRefs(props)
// 数据:查询关键字
const queryParams = ref({
keyword: ''
})
// 数据:返回路径
const backUrl = ref('')
// 绑定:加载屏
const pagingRef = ref(null)
// 数据
const infoList = ref([])
// 选中技术鉴定表
const onChecked = (item) => {
if (item.appraisalNo) {
uni.setStorageSync('app_technical', item);
uni.navigateTo({
url: backUrl.value
});
}
}
// 列表
const getTechnicalList = (pageNo, pageSize) => {
queryParams.value.pageNum = pageNo
myList(queryParams.value).then(res => {
res.rows.forEach(e => {
e.showMore = false;
});
infoList.value = res.rows
pagingRef.value.complete(res.rows)
}).catch(res => {
pagingRef.value.complete(false)
})
}
// 数据:路径参数
onLoad((options) => {
pathParams.value = options
const query = objectToQuery(options)
backUrl.value = `/pages/warehousing/stockOut/components/technicalEvaluation${query}`
})
onShow(() => {
pagingRef.value?.reload?.()
})
const onDownLoad = () => {
}
</script>
<style scoped lang="scss">
.topSearch {
position: fixed;
top: 65rpx;
left: 0;
right: 0;
z-index: 999;
padding: 4rpx;
background-color: #fff;
border-bottom: 1px solid #eee;
box-sizing: border-box;
}
.containerBox {
padding-top: 125rpx !important;
width: 100%;
height: 100%;
box-sizing: border-box;
.zp-l-text-rpx {
font-size: 12px;
}
}
::v-deep.listBox {
.uni-list {
background-color: #F8F8FF;
}
.uv-upload {
flex: none !important;
}
.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>

View File

@@ -0,0 +1,204 @@
<!--点击出库单出库后的出库页面 -->
<template>
<navigation title="出库" :back-url="backUrl"></navigation>
<view class="contentBox">
<!-- 技术鉴定表 -->
<uv-form ref="formRef" class="form" :model="technicalEvaluationList" label-width="150rpx">
<uv-form-item label="技术鉴定表" prop="fileList" @click="toTechnical">
<u-cell>
<view slot="title" class="u-slot-title">
<text class="u-cell-text" v-if="technicalEvaluationList">
{{ technicalEvaluationList?.appraisalNo }}
</text>
<text class="placeholder" v-else> 请添加技术鉴定表</text>
<uni-icons type="right" size="10" />
</view>
</u-cell>
</uv-form-item>
</uv-form>
<!-- 仓库信息 - 仓库存储区 -->
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo"
:pathParams="{ ...pathParams, back: 'stockOut' }" />
<!-- 物料列表 - 添加物料 -->
<material-list ref="materialRef" :formData="formData" isEdit="5" backStr="stockOut" :pathParams="pathParams" />
<!-- 底部操作栏 -->
<view class="bottom">
<uv-button type="primary" @click="submitForm">出库</uv-button>
</view>
</view>
</template>
<script setup>
import _ from 'lodash';
import { ref } from 'vue';
import { onLoad } from "@dcloudio/uni-app";
import { outBoundFinish } from '@/api/stockOut';
import MaterialList from '../../../components/MaterialList.vue';
import WarehousingInfo from '../../../components/WarehousingInfo.vue';
import { onMounted } from 'vue';
import Navigation from '../../../components/Navigation.vue';
import { objectToQuery } from '../../../until';
const backUrl = ref('')
// 数据:路径参数
const pathParams = ref('')
// ref物料绑定
const materialRef = ref([])
// ref仓库信息绑定
const warehousingInfoRef = ref([])
// 数据:物料列表
const formData = ref([{ remark: '', material: [] }])
// 数据:仓库信息
const warehouseInfo = ref({ warehousing: {}, storageArea: {}, remark: '' })
// 技术鉴定表
const technicalEvaluationList = ref({
appraisalNo: '',
fileList: [],
remark:''
})
// 数据:获取缓存信息
const getMaterialList = () => {
// 获取仓库信息
const warehouse = uni.getStorageSync('app_warehousing');
warehouseInfo.value.warehousing = warehouse
// 获取存储区信息
const storageArea = uni.getStorageSync('app_storageArea');
warehouseInfo.value.storageArea = storageArea
// 获取出库单备注
const billRemark = uni.getStorageSync('app_billRemark');
warehouseInfo.value.remark = billRemark
// 获取技术鉴定表数据
const list = uni.getStorageSync('app_technical');
technicalEvaluationList.value.appraisalNo = list.appraisalNo
// 获取物料信息 - 有uniqueCode
const material = uni.getStorageSync('app_material');
formData.value.material = material
}
// 出库:提交表单
const submitForm = () => {
const info = warehousingInfoRef.value.getWarehousingInfo()
const materialInfo = materialRef.value.getMaterialList()
// 过滤出已删除的物料
const _materialInfo = _.filter(materialInfo, { isDelete: '0' })
let params = {
billType: '1',//0出库申请 1出库成功 2出库申请 3出库成功 4出库单已作废 5出库单已作废
billNo: pathParams.value.billNo,
warehouseCode: info.warehousing?.[0].deptCode || info.warehousing?.[0].deptId,
warehouseName: info.warehousing?.[0].deptName,
areaCode: info.storageArea?.[0].deptCode || info.storageArea?.[0].deptId,
areaName: info.storageArea?.[0].deptName,
remark: info.remark,
billRemark: info.remark,
itemList: _.map(_materialInfo, (i) => ({ ...i.material }))
}
outBoundFinish(params).then((res) => {
// /pages/warehousing/stockOut/components/detail
uni.navigateTo({
url: backUrl.value
});
console.log(res, '出库单出库');
})
}
// 数据:路径参数
onLoad((options) => {
console.log(options, 'options', _.includes(options?.type, 'stockOut'));
if (!options.billNo) {
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
return
}
pathParams.value = options
// stockOut-putAway
// stockOut
const query = objectToQuery(pathParams.value)
backUrl.value = `/pages/warehousing/stockIn/components/detail${query}`
})
onMounted(() => {
getMaterialList()
})
const toTechnical = () => {
const query = objectToQuery(pathParams.value)
uni.navigateTo({
url: `/pages/warehousing/stockOut/components/technicalEvaluation${query}`
})
}
</script>
<style lang="scss" scoped>
.page {
background: #f5f5f5;
min-height: 100vh;
}
/* 底部按钮 */
::v-deep .bottom {
position: fixed;
bottom: 0;
height: 60rpx;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
.uv-button-wrapper {
width: 100%;
border-radius: 0;
}
}
::v-deep .form {
// background-color: #fff;
padding: 0;
.uv-input__content {
.uv-input__content__field-wrapper__field {
text-align: right !important;
}
}
.uv-form-item__body {
background-color: #fff;
padding: 12rpx;
margin-bottom: 2rpx;
align-items: center;
}
.uv-form-item__body__left__content__label {
font-size: 14px;
}
.uv-line {
border-bottom: 0 !important;
}
.uv-form-item__body__right__content__slot {
justify-content: flex-end;
align-items: center;
}
.uv-cell__body {
padding: 0
}
.uni-icons {
display: block;
}
.u-slot-title {
display: flex;
align-items: center;
}
}
</style>

View File

@@ -0,0 +1,145 @@
<template>
<navigation title="技术鉴定表详情" :back-url="backUrl">
<template #right>
<my-link @click="toMyTechnicalList" style="font-size: 14px;">我的</my-link>
</template>
</navigation>
<view class="contentBox">
<uv-form labelPosition="top" :model="formModel" class="technicalForm" ref="technicalEvaluationRef"
labelWidth="auto">
<uv-form-item label="技术鉴定表" prop="fileList" style="margin-top: 16rpx;">
<uv-upload :fileList="formModel?.fileList" name="1" multiple :maxCount="6" @afterRead="afterRead"
@delete="deleteImg" :previewFullImage="true"></uv-upload>
</uv-form-item>
<uv-form-item label="技术鉴定表备注说明" prop="remark" style="margin-top: 16rpx;">
<uv-textarea v-model="formModel.remark" placeholder="请输入技术鉴定表备注说明..." border="none"></uv-textarea>
</uv-form-item>
</uv-form>
<view class="bottom">
<uv-button type="primary" @click="submitForm">提交信息</uv-button>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
import { onLoad } from "@dcloudio/uni-app";
import { objectToQuery } from '../../../until';
import Navigation from '../../../components/Navigation.vue';
import { uploadTechnicalFile, addWithFiles } from '@/api/stockOut'
import _ from 'lodash';
const queryParams = ref('')
const formModel = ref({
billNo: null,
remark: '',
fileList: [],
})
const backUrl = ref('')
const afterRead = async (event) => {
// scene = outbound
// bizType = technical_appraisal
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
console.log(event, '上传')
let files = event.file?.map(file => file.url);
// console.log('files', files);
let formData = {
scene: 'OUTBOUND',
bizType: 'TECHNICAL_APPRAISAL',
}
// files = files.map(p => ({ name: "files", uri: p }))
uploadTechnicalFile(files, formData).then(res => {
const some = _.some(res, { success: false })
console.log(some,'上传接口调取成功', res)
if (some) return;
if (!formModel.value.fileList || formModel.value.fileList.length == 0) {
formModel.value.fileList = []
}
res?.data?.fileUrlList.forEach(item => {
formModel.value.fileList.push({ url: item?.url, name: item?.name, scene: 'OUTBOUND', bizType: 'TECHNICAL_APPRAISAL' })
})
})
}
// 删除图片
const deleteImg = (index, type) => {
formModel.value.fileList?.splice(index, 1)
}
// 提交
const submitForm = () => {
console.log(formModel, 'formModel==>');
addWithFiles({ ...formModel.value, billNo: queryParams.value.billNo }).then((res) => {
if (res.code == 200) {
console.log(res.data);
}
})
}
// 数据:路径参数
onLoad((options) => {
const query = objectToQuery(options)
queryParams.value = options
backUrl.value = `/pages/warehousing/stockOut/components/outAway${query}`
})
const toMyTechnicalList = () => {
console.log('1111111111');
const query = objectToQuery(queryParams.value)
uni.navigateTo({
url: `/pages/warehousing/stockOut/components/myTechnicalEvaluation${query}`
});
}
// 获取技术鉴定编数据
const getTechnicalList = () => {
const list = uni.getStorageSync('app_technical');
formModel.value.fileList = list?.fileList
formModel.value.remark = list?.remark
}
getTechnicalList()
</script>
<style scoped lang="scss">
::v-deep.technicalForm {
.uv-form-item {
background-color: #fff;
padding: 0 24rpx;
}
.uv-form-item__body__left__content__label {
margin-bottom: 8px;
}
.uv-form-item__body {
background-color: #fff;
padding: 12rpx;
margin-bottom: 2rpx;
}
.uv-textarea {
padding: 0;
}
}
/* 底部按钮 */
::v-deep .bottom {
position: fixed;
bottom: 0;
height: 60rpx;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
.uv-button-wrapper {
width: 100%;
border-radius: 0;
}
.uv-button--info {
background-color: #07c160;
color: #fff;
}
}
</style>