出库对接
This commit is contained in:
170
pages/warehousing/StockOut/components/myTechnicalEvaluation.vue
Normal file
170
pages/warehousing/StockOut/components/myTechnicalEvaluation.vue
Normal 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>
|
||||
204
pages/warehousing/StockOut/components/outAway.vue
Normal file
204
pages/warehousing/StockOut/components/outAway.vue
Normal 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>
|
||||
145
pages/warehousing/StockOut/components/technicalEvaluation.vue
Normal file
145
pages/warehousing/StockOut/components/technicalEvaluation.vue
Normal 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>
|
||||
@@ -1,10 +1,12 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<navigation :title="title" :back-url="backUrl"></navigation>
|
||||
<navigation :title="title" :back-url="backUrl"></navigation>
|
||||
<view class="contentBox">
|
||||
<!-- 仓库信息 - 仓库、存储区 -->
|
||||
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" :pathParams="pathParams" />
|
||||
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo"
|
||||
:pathParams="{ ...pathParams, type: 'stockOut' }" />
|
||||
<!-- 物料列表 - 添加物料 -->
|
||||
<material-list ref="materialRef" :formData="formData" isEdit="1" backStr="stockOut" :pathParams="pathParams" />
|
||||
<material-list ref="materialRef" :formData="formData" :isEdit="flag == 'stockOut' ? 5 : 1"
|
||||
:pathParams="{...pathParams.value, type: 'stockOut' }" />
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="bottom">
|
||||
<uv-button @click="scanCode">扫码添加</uv-button>
|
||||
@@ -17,10 +19,10 @@
|
||||
|
||||
import _ from 'lodash';
|
||||
import { ref } from 'vue';
|
||||
import { objectToQuery } from '../../until';
|
||||
import { objectToQuery, removeStorage } from '../../until';
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app";
|
||||
import { addStockIn, stockInUpdate } from '@/api/stockIn';
|
||||
import { getMaterialUnique } from '@/api/uniqueCode';
|
||||
import { addStockOut, stockOutUpdate } from '@/api/stockOut';
|
||||
import { getMaterialByQrCodeInfo } from '@/api/uniqueCode';
|
||||
import MaterialList from '../../components/MaterialList.vue';
|
||||
import WarehousingInfo from '../../components/WarehousingInfo.vue';
|
||||
import Navigation from '../../components/Navigation.vue';
|
||||
@@ -30,12 +32,14 @@ import { includes } from 'lodash';
|
||||
const pathParams = ref('')
|
||||
// 标志:是否为编辑
|
||||
const isEdit = ref('')
|
||||
// 标志:区分页面 进入页面的状态 null新建 stockIn:入库编辑 stockIn-putAway:入库单入库编辑
|
||||
// 标志:区分页面 进入页面的状态 null新建 stockOut:出库编辑 stockOut-putAway:出库单出库编辑
|
||||
const flag = ref('')
|
||||
|
||||
// ref:标题
|
||||
const title = ref('入库单开单')
|
||||
const title = ref('出库单开单')
|
||||
const backUrl = ref('pages/warehousing/index')
|
||||
//ref:已经扫过的code
|
||||
const existList = ref([])
|
||||
|
||||
// ref:物料绑定
|
||||
const materialRef = ref([])
|
||||
@@ -49,7 +53,6 @@ const warehouseInfo = ref({ warehousing: {}, storageArea: {}, remark: '' })
|
||||
|
||||
// 数据:获取缓存信息
|
||||
const getMaterialList = () => {
|
||||
|
||||
// 获取仓库信息
|
||||
const warehouse = uni.getStorageSync('app_warehousing');
|
||||
warehouseInfo.value.warehousing = warehouse
|
||||
@@ -62,44 +65,53 @@ const getMaterialList = () => {
|
||||
const material = uni.getStorageSync('app_material');
|
||||
formData.value.material = material
|
||||
|
||||
// 获取入库单备注
|
||||
// 获取出库单备注
|
||||
const billRemark = uni.getStorageSync('app_billRemark');
|
||||
warehouseInfo.value.remark = billRemark
|
||||
}
|
||||
getMaterialList();
|
||||
const scanResult = ref('')
|
||||
// 扫码添加
|
||||
const scanCode = () => {
|
||||
// 先校验是否支持扫码
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode', 'barCode'], // 支持二维码 + 条形码
|
||||
success: (res) => {
|
||||
scanResult.value = res.result;
|
||||
console.log('二维码code====>', res.result);
|
||||
const idx = includes(existList, res.result)
|
||||
if (idx) {
|
||||
uni.showToast({
|
||||
title: '该物料已添加,请勿重复添加!',
|
||||
mask: true,
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
if (res.result) {
|
||||
getMaterialUnique({ code: res.result }).then((response) => {
|
||||
console.log('物料内容:', response);
|
||||
getMaterialByQrCodeInfo({ code: res.result, existList: existList.value }).then((response) => {
|
||||
console.log('物料内容====>:', response);
|
||||
if (`${response.code}` === '200') {
|
||||
const material = uni.getStorageSync('app_material');
|
||||
// 处理物料信息 合并
|
||||
const materialInfo = _.filter(material, { isDelete: '0' });
|
||||
console.log('materialInfo', materialInfo);
|
||||
console.log('materialInfo====>', materialInfo);
|
||||
const materialId = response.data?.[0]?.materialId;
|
||||
console.log('materialId', materialId);
|
||||
const idx = _.findIndex(materialInfo, (i) => i.materialId ? i.materialId == materialId : i.id == materialId);
|
||||
console.log('已选中是否有重复数据', idx);
|
||||
console.log('materialId====>', materialId);
|
||||
// const idx = _.findIndex(materialInfo, (i) => i.materialId ? i.materialId == materialId : i.id == materialId);
|
||||
// console.log('已选中是否有重复数据====>', idx);
|
||||
|
||||
if (idx != -1) {
|
||||
uni.showToast({
|
||||
title: '该物料已添加,请勿重复添加!',
|
||||
mask: true,
|
||||
icon: 'none',
|
||||
})
|
||||
} else {
|
||||
let _material = [...materialInfo, { ...response.data[0], uniqueCode: res.result }]
|
||||
console.log('新的物料数组', _material);
|
||||
formData.value.material = _material
|
||||
uni.setStorageSync('app_material', formData.value.material)
|
||||
}
|
||||
// if (idx != -1) {
|
||||
// uni.showToast({
|
||||
// title: '该物料已添加,请勿重复添加!',
|
||||
// mask: true,
|
||||
// icon: 'none',
|
||||
// })
|
||||
// } else {
|
||||
let _material = [...materialInfo, { ...response.data[0], uniqueCode: res.result }]
|
||||
console.log('新的物料数组====>', _material);
|
||||
formData.value.material = _material
|
||||
uni.setStorageSync('app_material', formData.value.material)
|
||||
existList.value.push(res.result)
|
||||
// }
|
||||
} else {
|
||||
console.log(response.code, 'response.code');
|
||||
}
|
||||
@@ -118,7 +130,9 @@ const scanCode = () => {
|
||||
const submitForm = () => {
|
||||
const info = warehousingInfoRef.value.getWarehousingInfo()
|
||||
const materialInfo = materialRef.value.getMaterialList()
|
||||
if (!info.warehousing?.[0].deptCode) {
|
||||
console.log(info, 'info==>');
|
||||
|
||||
if (!info.warehousing?.[0]?.deptName) {
|
||||
uni.showToast({
|
||||
title: '请填写仓库信息',
|
||||
mask: true,
|
||||
@@ -126,7 +140,7 @@ const submitForm = () => {
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!info.storageArea?.[0].deptName) {
|
||||
if (!info.storageArea?.[0]?.deptName) {
|
||||
uni.showToast({
|
||||
title: '请填写存储区信息',
|
||||
mask: true,
|
||||
@@ -146,15 +160,16 @@ const submitForm = () => {
|
||||
console.log(params, isEdit, !isEdit, info, materialInfo, '入参params');
|
||||
// 新建
|
||||
if (!isEdit.value) {
|
||||
addStockIn(params).then((res) => {
|
||||
addStockOut(params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '入库单创建成功',
|
||||
title: '出库单创建成功',
|
||||
mask: true,
|
||||
icon: 'success',
|
||||
})
|
||||
removeStorage()
|
||||
uni.navigateTo({
|
||||
url: `/pages/warehousing/stockIn/my`,
|
||||
url: `/pages/warehousing/stockOut/my`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -164,14 +179,14 @@ const submitForm = () => {
|
||||
params.billNo = pathParams.value?.billNo
|
||||
params.billId = pathParams.value?.billId
|
||||
const query = objectToQuery(pathParams.value)
|
||||
stockInUpdate(params).then((res) => {
|
||||
stockOutUpdate(params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '入库单编辑成功',
|
||||
title: '出库单编辑成功',
|
||||
mask: true,
|
||||
icon: 'success',
|
||||
})
|
||||
let url = `/pages/warehousing/stockIn/components/detail${query}`
|
||||
let url = `/pages/warehousing/stockOut/components/detail${query}`
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
@@ -182,21 +197,23 @@ const submitForm = () => {
|
||||
}
|
||||
// 数据:路径参数
|
||||
onLoad((options) => {
|
||||
console.log(options, 'options', _.includes(options?.type, 'stockIn'));
|
||||
console.log(options, 'options', _.includes(options?.type, 'stockOut'));
|
||||
|
||||
pathParams.value = options
|
||||
flag.value = options.type
|
||||
isEdit.value = _.includes(options?.type, 'stockIn')
|
||||
isEdit.value = _.includes(options?.type, 'stockOut')
|
||||
})
|
||||
// 修改标题:若有billNo传入 修改标题
|
||||
onShow(() => {
|
||||
const query = objectToQuery(pathParams.value)
|
||||
if (pathParams.value.billNo) {
|
||||
title.value = pathParams.value.billNo
|
||||
}
|
||||
// /pages/warehousing/stockIn/components/detail?billNo=DL1775619567111&type=stockOut
|
||||
if (includes(pathParams.value.type, 'stockOut')) {
|
||||
backUrl.value = `/pages/warehousing/stockIn/components/detail${query}`
|
||||
}
|
||||
if (pathParams.value.billNo) {
|
||||
title.value = pathParams.value.billNo
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -4,5 +4,4 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import SearchList from '../../components/SearchList.vue';
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user