出库对接

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

@@ -1,6 +1,6 @@
//存放主站域名 //存放主站域名
// const BASE_URL = 'http://192.168.1.5:8082' // w // const BASE_URL = 'http://192.168.1.5:8082' // w
const BASE_URL = 'http://192.168.1.9:8082' // 正式环境接口 const BASE_URL = "http://192.168.1.9:8082"; // yx
// const BASE_URL = 'http://47.100.212.83:18088' // 正式环境接口 // const BASE_URL = 'http://47.100.212.83:18088' // 正式环境接口
// const BASE_URL = 'http://192.168.1.9:8088' // 测试环境接口 // const BASE_URL = 'http://192.168.1.9:8088' // 测试环境接口
// const BASE_URL = 'http://192.168.1.5:8088' // 测试环境接口 // const BASE_URL = 'http://192.168.1.5:8088' // 测试环境接口
@@ -9,7 +9,12 @@ const BASE_URL_IMG = BASE_URL + "/img/upload"; // 上传图片
let requestRecords = {}; let requestRecords = {};
// 重复请求拦截时间(毫秒) // 重复请求拦截时间(毫秒)
const INTERCEPT_DURATION = 2000; const INTERCEPT_DURATION = 2000;
const request = (url, data = {}, method = "GET", ContentType = "application/json") => { const request = (
url,
data = {},
method = "GET",
ContentType = "application/json",
) => {
const requestObj = { const requestObj = {
data, data,
url, url,
@@ -119,29 +124,35 @@ const request = (url, data = {}, method = "GET", ContentType = "application/json
// 图片 // 图片
const Upload = (url, source, formData) => { const Upload = (url, source, formData) => {
console.log("进入上传方法", url, source, formData);
const ContentType = "application/json";
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
console.log(source) console.log(source);
let header = {}; let header = {};
if (uni.getStorageSync("app_token")) { if (uni.getStorageSync("app_token")) {
header = { header = {
// 'Content-Type': ContentType, "Content-Type": ContentType,
authorization: uni.getStorageSync("app_token"), authorization: uni.getStorageSync("app_token"),
// Accept: "application/json",
// "Content-Type": "multipart/form-data",
}; };
} }
console.log(BASE_URL + url, source, formData, header) console.log(BASE_URL + url, source, formData, header);
console.log(typeof source === 'string' ? { filePath: source } : { files: source }) console.log(
typeof source === "string" ? { filePath: source } : { files: source },
);
uni.uploadFile({ uni.uploadFile({
url: BASE_URL + url, url: BASE_URL + url,
...(typeof source === 'string' ...(typeof source === "string"
? { filePath: source } // 单文件使用filePath ? { filePath: source } // 单文件使用filePath
: { files: source } // 多文件使用files : { files: source }), // 多文件使用files
), name: "files",
name: 'files',
formData, formData,
// name, // name,
header, header,
success: function (res) { success: function (res) {
console.log(res) console.log("成功返回res", res);
let obj1 = JSON.parse(res.data); let obj1 = JSON.parse(res.data);
uni.hideLoading(); uni.hideLoading();
if (obj1.code !== 200) { if (obj1.code !== 200) {
@@ -156,12 +167,12 @@ const Upload = (url, source, formData) => {
icon: "success", icon: "success",
duration: 1000, duration: 1000,
}); });
resolve(obj1) resolve(obj1);
} }
}, },
fail: function (err) { fail: function (err) {
console.log(err) console.log("失败返回err", err);
console.log(JSON.stringify(err), "失败999"); console.log("失败999", JSON.stringify(err));
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: "加载失败, 请稍后再试!", title: "加载失败, 请稍后再试!",
@@ -229,5 +240,163 @@ const UploadFile = (url, data = {}, source) => {
}); });
}); });
}; };
/**
* 多文件上传(支持并行/串行)
* @param {Array} files - 要上传的文件数组
* @param {Boolean} sequential - 是否串行上传(默认 false = 并行)
* @returns {Promise<Array>} - 所有文件的上传结果(含成功/失败信息)
*/
const uploadMultipleFiles = async (
url,
files,
formData,
sequential = false,
) => {
let header = {};
if (uni.getStorageSync("app_token")) {
header = {
authorization: uni.getStorageSync("app_token"),
};
}
// 2. 并行上传逻辑
if (!sequential) {
// 循环生成每个文件的上传 Promise
const uploadPromises = files.map((file, index) => {
return new Promise((resolve) => {
uni.uploadFile({
url: BASE_URL + url,
filePath: file,
name: "file",
header,
formData,
// 上传成功处理
success: (res) => {
try {
const result = JSON.parse(res.data);
console.log("成功,", res);
if (result.code === 200 && result.data?.url) {
resolve({
index, // 保留原文件在数组中的索引(方便对应)
file, // 原始文件信息
url: result.data.url, // 上传后的 URL
success: true,
error: null,
});
} else {
// 后端返回失败(如文件格式不允许)
resolve({
index,
file,
url: null,
success: false,
error: new Error(result.msg || "文件上传失败"),
});
}
} catch (e) {
resolve({
index,
file,
url: null,
success: false,
error: new Error("上传结果解析失败:" + e.message),
});
}
},
fail: (err) => {
resolve({
index,
file,
url: null,
success: false,
error: new Error("上传请求失败:" + err.errMsg),
});
},
});
});
});
console.log(uploadPromises, "uploadPromises1111");
// 等待所有请求完成,返回统一结果
return Promise.allSettled(uploadPromises).then((results) => {
// 提取实际结果allSettled 返回的是 {status, value} 结构)
return results.map((res) => res.value);
});
} // 接上文的 if (!sequential) 之后
else {
const uploadResults = []; // 存储所有结果
// 递归函数:上传第 index 个文件
const uploadNext = (index) => {
// 终止条件:所有文件处理完,返回结果
if (index >= files.length) {
return Promise.resolve(uploadResults);
}
const currentFile = files[index];
return new Promise((resolve) => {
uni.uploadFile({
url: BASE_URL + url,
filePath: currentFile,
name: "file",
header,
success: (res) => {
try {
const result = JSON.parse(res.data);
if (result.code === 200 && result.data?.url) {
uploadResults.push({
index,
file: currentFile,
url: result.data.fileUrlList[0].url,
success: true,
error: null,
});
} else {
uploadResults.push({
index,
file: currentFile,
url: null,
success: false,
error: new Error(result.msg || "文件上传失败"),
});
}
// 上传下一个文件(递归)
resolve(uploadNext(index + 1));
} catch (e) {
uploadResults.push({
index,
file: currentFile,
url: null,
success: false,
error: new Error("解析失败:" + e.message),
});
resolve(uploadNext(index + 1));
}
},
fail: (err) => {
uploadResults.push({
index,
file: currentFile,
url: null,
success: false,
error: new Error("请求失败:" + err.errMsg),
});
resolve(uploadNext(index + 1)); // 即使失败,也继续传下一个(可按需修改)
},
});
});
};
// 从第 0 个文件开始上传
return uploadNext(0);
}
};
// form表单 // form表单
export { BASE_URL, BASE_URL_IMG, request, Upload, UploadFile }; export {
BASE_URL,
BASE_URL_IMG,
request,
Upload,
UploadFile,
uploadMultipleFiles,
};

46
api/stockOut.js Normal file
View File

@@ -0,0 +1,46 @@
import { request, Upload,uploadMultipleFiles } from "./request";
const api = "/worn/outboundBill/";
// 新建:出库单
const addStockOut = (params) => {
return request(api + "add", params, "POST");
};
// 列表
const stockOutList = (params) => {
return request(api + "list", params, "get");
};
// 详情
const stockOutDetail = (params) => {
return request("/worn/outboundItem/getByBillNo", params, "post");
};
// 编辑
const stockOutUpdate = (params) => {
return request("/worn/outboundItem/update", params, "post");
};
// 出库
const outBoundFinish = (params) => {
return request("/worn/outboundBill/complete", params, "post");
};
// 添加技术鉴定表
const addWithFiles = (params) => {
return request("/worn/appraisal/addWithFiles", params, "post");
};
// 技术鉴定表
const myList = (params) => {
return request("/worn/appraisal/myList", params, "get");
};
// 上传图片
const uploadTechnicalFile = (files, formData) => {
return uploadMultipleFiles("/worn/technicalFile/upload", files, formData,true);
};
export {
addStockOut,
stockOutList,
stockOutDetail,
stockOutUpdate,
outBoundFinish,
addWithFiles,
uploadTechnicalFile,
myList
};

View File

@@ -1,4 +1,5 @@
import { request } from "./request"; import { request } from "./request";
// /unique/code/getMaterialInfo
// 列表:物料列表 // 列表:物料列表
const getMaterial = (params) => { const getMaterial = (params) => {
return request("/worn/material/list", params, 'GET'); return request("/worn/material/list", params, 'GET');
@@ -27,6 +28,10 @@ const detailUniqueCode = (params) => {
const getMaterialUnique = (params) => { const getMaterialUnique = (params) => {
return request(`/unique/code/materialInfo/${params.code}`, params, 'GET'); return request(`/unique/code/materialInfo/${params.code}`, params, 'GET');
}; };
// 详情:通过唯一码获取物料信息
const getMaterialByQrCodeInfo = (params) => {
return request('/unique/code/getMaterialInfo', params, 'POST');
};
export { export {
getMaterial, getMaterial,
@@ -35,5 +40,6 @@ export {
delUniqueCode, delUniqueCode,
detailUniqueCode, detailUniqueCode,
editUniqueCode, editUniqueCode,
getMaterialUnique getMaterialUnique,
getMaterialByQrCodeInfo
}; };

View File

@@ -22,7 +22,7 @@
}, },
{ {
"path": "pages/warehousing/index", "path": "pages/warehousing/index",
"style": { "navigationBarTitleText": "仓储" } "style": { "navigationBarTitleText": "仓储", "navigationStyle": "custom" }
}, },
{ {
"path": "pages/intelligent/index", "path": "pages/intelligent/index",
@@ -36,7 +36,10 @@
// 仓储 - 唯一码 // 仓储 - 唯一码
{ {
"path": "pages/warehousing/uniqueCode/issueUniqueCode/index", "path": "pages/warehousing/uniqueCode/issueUniqueCode/index",
"style": { "navigationBarTitleText": "唯一码发放" } "style": {
"navigationBarTitleText": "唯一码发放",
"navigationStyle": "custom"
}
}, },
{ {
"path": "pages/warehousing/uniqueCode/issueUniqueCode/materialSelection", "path": "pages/warehousing/uniqueCode/issueUniqueCode/materialSelection",
@@ -44,7 +47,10 @@
}, },
{ {
"path": "pages/warehousing/uniqueCode/myUniqueCode/index", "path": "pages/warehousing/uniqueCode/myUniqueCode/index",
"style": { "navigationBarTitleText": "唯一码" } "style": {
"navigationBarTitleText": "唯一码",
"navigationStyle": "custom"
}
}, },
{ {
"path": "pages/warehousing/uniqueCode/myUniqueCode/detail", "path": "pages/warehousing/uniqueCode/myUniqueCode/detail",
@@ -107,40 +113,82 @@
// ========== 入库单模块 ========== // ========== 入库单模块 ==========
{ {
"path": "pages/warehousing/stockIn/create", "path": "pages/warehousing/stockIn/create",
"style": { "navigationBarTitleText": "入库单开单" , "navigationStyle": "custom"} "style": {
"navigationBarTitleText": "入库单开单",
"navigationStyle": "custom"
}
}, },
{ {
"path": "pages/warehousing/stockIn/my", "path": "pages/warehousing/stockIn/my",
"style": { "navigationBarTitleText": "我的入库单", "navigationStyle": "custom" } "style": {
"navigationBarTitleText": "我的入库单",
"navigationStyle": "custom"
}
}, },
{ {
"path": "pages/warehousing/stockIn/components/detail", "path": "pages/warehousing/stockIn/components/detail",
"style": { "navigationBarTitleText": "详情", "navigationStyle": "custom" } "style": { "navigationBarTitleText": "详情", "navigationStyle": "custom" }
}, },
{ {
"path": "pages/warehousing/stockIn/putaway", "path": "pages/warehousing/stockIn/putAway",
"style": { "navigationBarTitleText": "入库单入库" } "style": {
"navigationBarTitleText": "入库单入库",
"navigationStyle": "custom"
}
}, },
{ {
"path": "pages/warehousing/toChooseList", "path": "pages/warehousing/toChooseList",
"style": { "navigationBarTitleText": "请选择" } "style": {
"navigationBarTitleText": "请选择",
"navigationStyle": "custom"
}
}, },
{ {
"path": "pages/warehousing/stockIn/components/inbound", "path": "pages/warehousing/stockIn/components/inbound",
"style": { "navigationBarTitleText": "入库" } "style": { "navigationBarTitleText": "入库", "navigationStyle": "custom" }
}, },
// ========== 出库单模块 ========== // ========== 出库单模块 ==========
{ {
"path": "pages/warehousing/stockOut/create", "path": "pages/warehousing/stockOut/create",
"style": { "navigationBarTitleText": "出库单开单" } "style": {
"navigationBarTitleText": "出库单开单",
"navigationStyle": "custom"
}
}, },
{ {
"path": "pages/warehousing/stockOut/my", "path": "pages/warehousing/stockOut/my",
"style": { "navigationBarTitleText": "我的出库单" } "style": {
"navigationBarTitleText": "我的出库单",
"navigationStyle": "custom"
}
}, },
{ {
"path": "pages/warehousing/stockOut/outbound", "path": "pages/warehousing/stockOut/outbound",
"style": { "navigationBarTitleText": "出库单出库" } "style": {
"navigationBarTitleText": "出库单出库",
"navigationStyle": "custom"
}
},
{
"path": "pages/warehousing/stockOut/components/outAway",
"style": {
"navigationBarTitleText": "出库单出库",
"navigationStyle": "custom"
}
},
{
"path": "pages/warehousing/stockOut/components/technicalEvaluation",
"style": {
"navigationBarTitleText": "技术鉴定表",
"navigationStyle": "custom"
}
},
{
"path": "pages/warehousing/stockOut/components/myTechnicalEvaluation",
"style": {
"navigationBarTitleText": "我提交的技术鉴定表",
"navigationStyle": "custom"
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@@ -1,6 +1,8 @@
<!-- 仓库/存储区选择 --> <!-- 仓库/存储区选择 -->
<template> <template>
<view class="content"> <navigation :title="isWarehousing.value ? '仓库选择' : '存储区选择'" :back-url="backUrl"></navigation>
<view class="contentBox">
<view class="topSearch"> <view class="topSearch">
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false" <uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false"
@iconClick="getList" placeholder="请输入搜索内容" /> @iconClick="getList" placeholder="请输入搜索内容" />
@@ -56,11 +58,13 @@
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, toRefs } from 'vue'; import { computed, ref, toRefs } from 'vue';
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import { getWarehousingInfo } from '../../api/system'; import { getWarehousingInfo } from '@/api/system';
import getRepository from "@/api/getRepository"; import getRepository from "@/api/getRepository";
import { objectToQuery } from '../until'; import { objectToQuery } from '../until';
import Navigation from '../components/Navigation.vue';
import { watch } from 'vue';
const props = defineProps({ const props = defineProps({
// 是否为仓库查询 // 是否为仓库查询
@@ -69,12 +73,6 @@ const props = defineProps({
default: true, default: true,
required: true required: true
}, },
// 返回出库开单/入库开单
backStr: {
type: String,
default: true,
required: true
},
pathParams: { pathParams: {
type: Object, type: Object,
default: null, default: null,
@@ -82,11 +80,14 @@ const props = defineProps({
} }
}) })
const { isWarehousing, backStr, pathParams } = toRefs(props) const { isWarehousing, pathParams } = toRefs(props)
// 数据:查询关键字 // 数据:查询关键字
const queryParams = ref({ const queryParams = ref({
keyword: '' keyword: ''
}) })
const backUrl = ref('')
// stockIn 入库单开单 stockIn_Detail入库单编辑 issueUniqueCode唯一码 issueUniqueCode_inbound入库生成唯一码
const keyType = computed(() => pathParams.value.type || pathParams.value.back)
// 绑定:加载屏 // 绑定:加载屏
const pagingRef = ref(null) const pagingRef = ref(null)
// 数据:仓库/存储区 // 数据:仓库/存储区
@@ -132,25 +133,27 @@ const getRepositoryInfo = async () => {
} }
// 返回路径 // 返回路径
const toBack = (back) => { const toBack = (keyType) => {
console.log('监听', keyType);
let url = '' let url = ''
switch (back) { switch (keyType) {
case 'stockIn': case 'stockIn':
// 入库单开单 // 入库单开单
url = '/pages/warehousing/stockIn/create' url = '/pages/warehousing/stockIn/create'
break; break;
case 'stockOut': case 'stockOut':
// 出库单开单 // 出库单开单
url = '' url = '/pages/warehousing/stockOut/create'
break;
case 'stockOut-outbound':
// 出库单出库
url = '/pages/warehousing/stockOut/components/outAway'
break; break;
} }
let params = pathParams.value
delete params.backStr const query = objectToQuery(pathParams.value)
delete params.flag backUrl.value = `${url}${query}`
const query = objectToQuery(params)
uni.navigateTo({
url: `${url}${query}`
})
} }
// 选择:仓库/存储区 // 选择:仓库/存储区
const onChecked = (val) => { const onChecked = (val) => {
@@ -166,9 +169,25 @@ const onChecked = (val) => {
} }
// 返回list // 返回list
toBack(backStr.value)
uni.navigateTo({
url: backUrl.value
})
} }
// 监听:确保 pathParams 变化时一定执行 toBack()
watch(
() => pathParams.value,
(d) => {
console.log('pathParams 变化:', d);
if (!d) return
const type = d.type || d.back;
console.log(type, 'eeeeeee');
toBack(type)
},
{ deep: true, immediate: true }
)
onShow(() => { onShow(() => {
pagingRef.value?.reload?.() pagingRef.value?.reload?.()
}) })
@@ -177,7 +196,7 @@ onShow(() => {
<style scoped lang="scss"> <style scoped lang="scss">
.topSearch { .topSearch {
position: fixed; position: fixed;
top: 0; top: 65rpx;
left: 0; left: 0;
right: 0; right: 0;
z-index: 999; z-index: 999;
@@ -188,7 +207,7 @@ onShow(() => {
} }
.containerBox { .containerBox {
padding-top: 44px; padding-top: 120rpx !important;
width: 100%; width: 100%;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
@@ -199,12 +218,10 @@ onShow(() => {
} }
::v-deep.listBox { ::v-deep.listBox {
.uni-list {
background-color: #F8F8FF; background-color: #F8F8FF;
}
.uni-list-item { .uni-list-item {
margin-bottom: 1rpx; margin-bottom: 8rpx;
} }
.uni-list-item__container { .uni-list-item__container {

View File

@@ -5,7 +5,7 @@
<view class="line title"> <view class="line title">
<p> {{ typeName + '单号' }}{{ detailInfo?.billNo }}</p> <p> {{ typeName + '单号' }}{{ detailInfo?.billNo }}</p>
<span :style="getColor(detailInfo?.billType)"> <span :style="getColor(detailInfo?.billType)">
{{ getBillType(detailInfo?.billType,detailInfo?.status) }} {{ getBillType(detailInfo?.billType, detailInfo?.status, flag) }}
</span> </span>
</view> </view>
@@ -44,7 +44,7 @@
import { getBillType, formatDate, getColor } from '../until' import { getBillType, formatDate, getColor } from '../until'
import { computed, toRefs } from 'vue'; import { computed, toRefs } from 'vue';
import MaterialList from './MaterialList.vue' import MaterialList from './MaterialList.vue'
import { includes } from 'lodash';
const props = defineProps({ const props = defineProps({
// 查询列表类型 stockIn:入库 stockOut出库 // 查询列表类型 stockIn:入库 stockOut出库
type: { type: {
@@ -60,10 +60,8 @@ const props = defineProps({
}) })
const { type, detailInfo } = toRefs(props) const { type, detailInfo } = toRefs(props)
const typeName = computed(() => type.value == 'stockIn' ? '入库单' : '出库单') const typeName = computed(() => includes(type.value, 'stockIn') ? '入库单' : '出库单')
const flag = computed(() => includes(type.value, 'stockIn') ? 0 : 1)
console.log(detailInfo, 'detailInfo');
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -1,12 +1,12 @@
<template> <template>
<!-- 物料列表 - 添加物料 --> <!-- 物料列表 - 添加物料 -->
<view class="materialList"> <view class="materialList">
<view class="remarkLine"> <view class="remarkLine">
<text>物料列表</text> <text>物料列表</text>
<uv-button type="primary" v-if="isAddMaterial" :plain="true" <uv-button type="primary" v-if="isAddMaterial" :plain="true" size="small" text="添加物料"
size="small" text="添加物料" @click="toMaterial"></uv-button> @click="toMaterial"></uv-button>
<view v-if="isEdit == 5" class="flex align-center justify-between">
<view v-if="isShowRqCode" class="flex align-center justify-between">
<span class="f-12 mr-16 grey" style="font-size: 12px;" v-if="num > 0"> <span class="f-12 mr-16 grey" style="font-size: 12px;" v-if="num > 0">
剩余<span style="color: red;"> 剩余<span style="color: red;">
{{ num }} {{ num }}
@@ -15,7 +15,7 @@
<uv-button type="primary" :plain="true" size="small" text="快速生成唯一码" <uv-button type="primary" :plain="true" size="small" text="快速生成唯一码"
@click="toGenerateUniqueCodeQuickly"></uv-button> @click="toGenerateUniqueCodeQuickly"></uv-button>
</view> </view>
<!-- <p class="btn-link" v-if="isEdit == 2" @click="toEdit">修改</p> -->
</view> </view>
<!-- 物料列表--> <!-- 物料列表-->
@@ -52,7 +52,7 @@
</view> </view>
</view> </view>
<!-- 库存状态 --> <!-- 库存状态 -->
<view class="flex justify-between mb-2 " v-if="isEdit == 3"> <view class="flex justify-between mb-2 " v-if="isEdit == 3 && isStockIn">
<p style="font-size: 13px;"> <p style="font-size: 13px;">
已入库 已入库
<span style="color:green">{{ getStockQuantity(item, 'complete') }}</span> <span style="color:green">{{ getStockQuantity(item, 'complete') }}</span>
@@ -62,6 +62,16 @@
<span style="color:red">{{ getStockQuantity(item, 'remaining') }}</span> <span style="color:red">{{ getStockQuantity(item, 'remaining') }}</span>
</p> </p>
</view> </view>
<view class="flex justify-between mb-2 " v-if="isEdit == 3 && !isStockIn">
<p style="font-size: 13px;">
已出库
<span style="color:green">{{ getStockQuantity(item, 'complete') }}</span>
</p>
<p style="font-size: 13px;">
剩余
<span style="color:red">{{ getStockQuantity(item, 'remaining') }}</span>
</p>
</view>
<!-- 备注 --> <!-- 备注 -->
<view class="remark-row"> <view class="remark-row">
<uni-forms-item :name="`material[${idx}].remark`" label="备注:"> <uni-forms-item :name="`material[${idx}].remark`" label="备注:">
@@ -98,29 +108,39 @@
</template> </template>
<script setup> <script setup>
import { computed, onMounted, ref, toRefs } from 'vue'; import { computed, ref, toRefs } from 'vue';
import { assign, findIndex, includes } from 'lodash'; import { assign, findIndex, includes } from 'lodash';
import { getStockQuantity, objectToQuery } from '../until'; import { getStockQuantity, objectToQuery } from '../until';
import { getTypeParentNames } from '../warehousing/uniqueCode/until'; import { getTypeParentNames } from '../warehousing/uniqueCode/until';
import { onLoad, onShow } from "@dcloudio/uni-app"; const OPERATE_CONFIG = {
// 唯一码创建 /唯一码编辑 /唯一码详情 /入库单开单
issueUniqueCode: {
toMaterialUrl: '/pages/warehousing/uniqueCode/issueUniqueCode/materialSelection',
title: '入库单开单'
},
// 入库单入库
stockIn: {
toMaterialUrl: '/pages/warehousing/uniqueCode/issueUniqueCode/index',
title: '入库单开单'
},
}
const props = defineProps({ const props = defineProps({
formData: { type: Object, default: () => ({ material: [], remark: '' }), required: true },//物料信息 formData: { type: Object, default: () => ({ material: [], remark: '' }), required: true },//物料信息
isEdit: { type: Boolean, default: true, required: true }, //编辑1 / 物料只读2 / 入库单只读3 /入库生成唯一码编辑4 /5数量不可编辑 备注可编辑 isEdit: { type: Boolean, default: true, required: true }, //编辑1 / 物料只读2 / 入库单只读3 /入库生成唯一码编辑4 /5数量不可编辑 备注可编辑
backStr: { type: String, default: '' }, //选择物料返回页面的标识
pathParams: { type: Object, default: {} }, //只读时传入对应的code、id pathParams: { type: Object, default: {} }, //只读时传入对应的code、id
extendData: { type: Object, default: {} }, //其他额外参数 extendData: { type: Object, default: {} }, //其他额外参数
}) })
const { formData, isEdit, backStr, pathParams, extendData } = toRefs(props) const { formData, isEdit, pathParams, extendData } = toRefs(props)
const keyType = computed(() => pathParams.value.type)
//是否为编辑状态 //是否为编辑状态
const edit = computed(() => { const edit = computed(() => includes(['1', '4', '5'], `${isEdit.value}`))
if (`${isEdit.value}` === '1') return '1';
else if (`${isEdit.value}` === '4') return '4';
else return false;
})
// 显示添加物料按钮 isEdit编辑、 // 显示添加物料按钮 isEdit编辑、
const isAddMaterial = computed(() => isEdit == 1 && pathParams.back != 'issueUniqueCode_inbound' && !includes(backStr.value,'stockOut')) const isAddMaterial = computed(() => `${isEdit.value}` === '1' && keyType != 'issueUniqueCode_inbound' && !includes(keyType.value, 'stockOut'))
// 显示快速生成唯一码 isShowRqCode
const isShowRqCode = computed(() => `${isEdit.value}` === '5' && !includes(keyType.value, 'stockOut'))
const isStockIn = computed(() => includes(keyType.value, 'stockIn'))
// 删除:数据 // 删除:数据
const delItem = ref(null) const delItem = ref(null)
// 删除:开关 // 删除:开关
@@ -134,16 +154,15 @@ const modalRef = ref()
// 按钮:添加物料 // 按钮:添加物料
const toMaterial = () => { const toMaterial = () => {
if (backStr.value == 'stockIn') { // 入库单开单 - 添加物料可选择手输入/无线液位计 if (keyType.value == 'stockIn') { // 入库单开单 - 添加物料可选择手输入/无线液位计
modalRef.value.open() modalRef.value.open()
} else { } else {
const path = objectToQuery({ ...pathParams.value, back: backStr?.value }) const path = objectToQuery(pathParams.value)
// 唯一码 - 编辑/新增 // 唯一码 - 编辑/新增
let url = '/pages/warehousing/uniqueCode/issueUniqueCode/materialSelection';
const value = uni.getStorageSync('app_material'); const value = uni.getStorageSync('app_material');
uni.setStorageSync('app_material', [{ ...value[0], uniqueCodeRemark: formData.value?.remark }]); // 将最新的唯一码备注写入缓存 uni.setStorageSync('app_material', [{ ...value[0], uniqueCodeRemark: formData.value?.remark }]); // 将最新的唯一码备注写入缓存
uni.navigateTo({ uni.navigateTo({
url: `${url}${path}` url: `${OPERATE_CONFIG.issueUniqueCode.toMaterialUrl}${path}`
}) })
} }
} }
@@ -151,9 +170,9 @@ const toMaterial = () => {
const toMaterialSelection = (type) => { const toMaterialSelection = (type) => {
// 0无线液 1手动输入 // 0无线液 1手动输入
let url = '' let url = ''
const path = objectToQuery({ ...pathParams.value, back: backStr.value }) const path = objectToQuery(pathParams.value)
if (type === '1') { if (type === '1') {
url = '/pages/warehousing/uniqueCode/issueUniqueCode/materialSelection' url = `${OPERATE_CONFIG.issueUniqueCode.toMaterialUrl}`
} }
uni.navigateTo({ uni.navigateTo({
url: `${url}${path}` url: `${url}${path}`
@@ -161,9 +180,11 @@ const toMaterialSelection = (type) => {
} }
// 快速生成唯一码 - // 快速生成唯一码 -
const toGenerateUniqueCodeQuickly = () => { const toGenerateUniqueCodeQuickly = () => {
const path = objectToQuery({ ...pathParams.value, back: 'inbound' }) const path = objectToQuery(pathParams.value)
console.log(path, 'path==>');
uni.navigateTo({ uni.navigateTo({
url: `/pages/warehousing/uniqueCode/issueUniqueCode/index${path}` url: `${OPERATE_CONFIG.stockIn.toMaterialUrl}${path}`
}) })
} }
@@ -188,7 +209,8 @@ const dialogConfirm = () => {
const getMaterialList = () => { const getMaterialList = () => {
const params = formData.value?.material?.map((i) => ({ const material = formData.value?.material || []
const params = material?.map((i) => ({
...i, ...i,
material: { material: {
//? 这里的判断是为了区分 =详情带出的物料以及新增的物料 详情带出的物料有id以及materialId 新增物料id为物料id materialId无值 //? 这里的判断是为了区分 =详情带出的物料以及新增的物料 详情带出的物料有id以及materialId 新增物料id为物料id materialId无值

View File

@@ -1,10 +1,10 @@
<template> <template>
<!-- 状态栏占位 --> <!-- 状态栏占位 -->
<view class="nav-placeholder" :style="{ height: navHeight + 'px' }"></view> <!-- <view class="nav-placeholder" :style="{ height: 35 + 'px' }"></view> -->
<view class="navbar" :style="{ paddingTop: statusBarHeight + 'px' }"> <view class="navbar" :style="{ height: navHeight + 'rpx' }">
<view class="left" @click="goBack"> <view class="left" @click="goBack">
<uni-icons type="left" size="18" /> <uni-icons type="left" size="18" v-if="showBack" />
</view> </view>
<!-- 标题 --> <!-- 标题 -->
@@ -16,14 +16,14 @@
</view> </view>
</view> </view>
<view class="content"></view> <!-- <view class="contentBox"></view> -->
</template> </template>
<script setup> <script setup>
import { ref, onMounted, toRefs } from 'vue' import { ref, onMounted, toRefs } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { getTabBarList } from '../until' import { getTabBarList } from '../until'
import { find, findIndex } from 'lodash' import { findIndex } from 'lodash'
const props = defineProps({ const props = defineProps({
title: { title: {
@@ -54,9 +54,11 @@ const isTabBar = ref('')
onMounted(() => { onMounted(() => {
try { try {
const res = uni.getSystemInfoSync() const res = uni.getSystemInfoSync()
statusBarHeight.value = res.statusBarHeight || 0 statusBarHeight.value = res.statusBarHeight || 0
console.log(statusBarHeight, 'statusBarHeight==>');
// 标准导航栏高度 44px + 状态栏 = 总高度 // 标准导航栏高度 44px + 状态栏 = 总高度
navHeight.value = statusBarHeight.value + 44 navHeight.value = statusBarHeight.value + 60
} catch (e) { } catch (e) {
console.warn('获取系统信息失败', e) console.warn('获取系统信息失败', e)
} }
@@ -66,6 +68,7 @@ onMounted(() => {
onLoad(() => { onLoad(() => {
const tabList = getTabBarList() const tabList = getTabBarList()
const isTabBarNav = findIndex(tabList, (i) => i.pagePath == backUrl.value) != -1 const isTabBarNav = findIndex(tabList, (i) => i.pagePath == backUrl.value) != -1
console.log(tabList, backUrl, isTabBarNav);
isTabBar.value = isTabBarNav isTabBar.value = isTabBarNav
if (backUrl.value) { if (backUrl.value) {
@@ -101,7 +104,6 @@ const goBack = () => {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/* 导航栏占位:撑开页面内容,不被遮挡 */
.nav-placeholder { .nav-placeholder {
width: 100%; width: 100%;
} }
@@ -112,8 +114,6 @@ const goBack = () => {
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
// 高度由 状态栏 + 44px 决定,不要写死 70px
height: 44px;
background: #fff; background: #fff;
display: flex; display: flex;
align-items: center; align-items: center;
@@ -132,8 +132,9 @@ const goBack = () => {
} }
.title { .title {
font-size: 16rpx; font-size: 16px;
font-weight: bold; font-weight: 600;
text-align: center;
color: #333; color: #333;
max-width: 400rpx; max-width: 400rpx;
overflow: hidden; overflow: hidden;

View File

@@ -2,7 +2,7 @@
<!-- 我的入库单/我的出库单/入库单入库/出库单出库--> <!-- 我的入库单/我的出库单/入库单入库/出库单出库-->
<navigation :title="title" back-url="pages/warehousing/index"></navigation> <navigation :title="title" back-url="pages/warehousing/index"></navigation>
<view class="content"> <view class="contentBox">
<!-- 搜索框 --> <!-- 搜索框 -->
<view class="topSearch"> <view class="topSearch">
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :input-border="false" <uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :input-border="false"
@@ -18,14 +18,15 @@
<view class="line title"> <view class="line title">
<p> {{ typeName }}编号{{ item.billNo }}</p> <p> {{ typeName }}编号{{ item.billNo }}</p>
<span :style="getColor(item?.billType)"> <span :style="getColor(item?.billType)">
{{ getBillType(item?.billType, item?.status) }} {{ getBillType(item?.billType, item?.status, flag) }}
</span> </span>
</view> </view>
<p class="line content">{{ typeName }}类型 <p class="line content">{{ typeName }}类型
<span>{{ getOrderType(item.status) }}</span> <span>{{ getOrderType(item.status) }}</span>
</p> </p>
<p class="line content">库位 <p class="line content">库位
<span>{{ item.areaName }}</span> <span v-if="item.warehouseName">{{ item.warehouseName }}/</span>
<span v-if="item.areaName"> {{ item.areaName }}</span>
</p> </p>
<p class="line content">开单时间 <p class="line content">开单时间
<span>{{ item.createTime }}</span> <span>{{ item.createTime }}</span>
@@ -39,10 +40,11 @@
</template> </template>
<script setup> <script setup>
import _, { includes } from 'lodash'; import _ from 'lodash';
import { computed, toRefs, ref } from 'vue'; import { computed, toRefs, ref } from 'vue';
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import { stockList } from '../../api/stockIn'; import { stockList } from '@/api/stockIn';
import { stockOutList } from '@/api/stockOut';
import { getBillType, getColor } from '../until'; import { getBillType, getColor } from '../until';
import Navigation from '../components/Navigation.vue'; import Navigation from '../components/Navigation.vue';
@@ -65,7 +67,8 @@ const { type, query } = toRefs(props)
const pagingRef = ref(null) const pagingRef = ref(null)
const list = ref([]) const list = ref([])
const typeName = computed(() => includes(type.value, 'stockIn') ? '入库单' : '出库单') const flag = computed(() => _.includes(type.value, 'stockIn') ? 0 : 1)
const typeName = computed(() => _.includes(type.value, 'stockIn') ? '入库单' : '出库单')
const title = computed(() => { const title = computed(() => {
if (type.value == 'stockIn') return '我的入库单' if (type.value == 'stockIn') return '我的入库单'
else if (type.value == 'stockIn-putAway') return '入库单入库' else if (type.value == 'stockIn-putAway') return '入库单入库'
@@ -73,7 +76,7 @@ const title = computed(() => {
else return '出库单出库' else return '出库单出库'
}) })
const getOrderType = () => { const getOrderType = () => {
return includes(type.value, 'stockIn') ? '入库单入库' : '出库单出库' return _.includes(type.value, 'stockIn') ? '入库单入库' : '出库单出库'
} }
const queryParams = ref({ const queryParams = ref({
@@ -85,12 +88,10 @@ onShow(() => {
}) })
const onDetail = (val) => { const onDetail = (val) => {
if (_.includes(type.value, 'stockIn')) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/warehousing/stockIn/components/detail?billNo=${val.billNo}&type=${type.value}`, url: `/pages/warehousing/stockIn/components/detail?billNo=${val.billNo}&type=${type.value}`,
}); });
} }
}
const getList = (pageNo, pageSize) => { const getList = (pageNo, pageSize) => {
queryParams.value.pageNum = pageNo queryParams.value.pageNum = pageNo
@@ -104,7 +105,14 @@ const getList = (pageNo, pageSize) => {
pagingRef.value.complete(false) pagingRef.value.complete(false)
}) })
} else { } else {
stockOutList({ ...queryParams.value, ...query.value }).then(res => {
res.rows.forEach(e => {
e.showMore = false;
});
pagingRef.value.complete(res.rows)
}).catch(() => {
pagingRef.value.complete(false)
})
} }
} }
</script> </script>
@@ -113,21 +121,19 @@ const getList = (pageNo, pageSize) => {
/* 搜索框:放在导航栏下面,不覆盖 */ /* 搜索框:放在导航栏下面,不覆盖 */
.topSearch { .topSearch {
position: fixed; position: fixed;
top: var(--nav-height); top: 65rpx;
/* 关键:自动在导航栏下方 */
left: 0; left: 0;
right: 0; right: 0;
z-index: 99; z-index: 99;
/* 比导航栏小 */
padding: 8rpx 16rpx; padding: 8rpx 16rpx;
background-color: #fff; background-color: #fff;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
box-sizing: border-box; box-sizing: border-box;
} }
.containerBox { .containerBox {
padding-top: 90px !important; padding-top: 125rpx !important;
/* 撑开:导航栏+搜索框高度 */
width: 100%; width: 100%;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
@@ -143,6 +149,10 @@ const getList = (pageNo, pageSize) => {
font-size: 12px; font-size: 12px;
} }
.uni-list--border-bottom {
padding: 8px 12px 8px 15px;
}
.uni-list { .uni-list {
background-color: #F8F8FF; background-color: #F8F8FF;
} }
@@ -154,7 +164,7 @@ const getList = (pageNo, pageSize) => {
.line { .line {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 12rpx 20rpx; padding: 8px 0;
} }
.title { .title {

View File

@@ -1,6 +1,6 @@
<!-- 获取仓库数据 --> <!-- 获取仓库数据 -->
<template> <template>
<view class="content"> <view>
<uv-form ref="formRef" class="form" :model="formData" label-width="150rpx"> <uv-form ref="formRef" class="form" :model="formData" label-width="150rpx">
<!-- 仓库 --> <!-- 仓库 -->
<uv-form-item label="仓库" prop="warehouse"> <uv-form-item label="仓库" prop="warehouse">
@@ -70,8 +70,7 @@ onShow(() => {
// 点击事件:选择仓库/选择存储区 // 点击事件:选择仓库/选择存储区
const onClick = (type) => { const onClick = (type) => {
uni.setStorageSync('app_billRemark', formData.value.remark) uni.setStorageSync('app_billRemark', formData.value.remark)
let query = { ...pathParams.value }
let query = { ...pathParams.value, backStr: 'stockIn' }
if (type == 'warehouse') { if (type == 'warehouse') {
query = objectToQuery({ ...query, flag: 'warehousing' }) query = objectToQuery({ ...query, flag: 'warehousing' })
} else if (type == 'storageArea') { } else if (type == 'storageArea') {

View File

@@ -1,6 +1,6 @@
<!-- 底部导航栏首页 --> <!-- 底部导航栏首页 -->
<template> <template>
<view class="content"> <view class="contentBox">
首页 首页
</view> </view>
</template> </template>

View File

@@ -1,6 +1,6 @@
<!-- 底部导航栏智能 --> <!-- 底部导航栏智能 -->
<template> <template>
<view class="content"> <view class="contentBox">
智能 智能
</view> </view>
</template> </template>

View File

@@ -1,6 +1,6 @@
<!-- 底部导航栏我的 --> <!-- 底部导航栏我的 -->
<template> <template>
<view class="content"> <view class="contentBox">
<view class="userInfo"> <view class="userInfo">
<uv-image src="../../static/avatar.png" width="120rpx" height="120rpx" shape="circle" /> <uv-image src="../../static/avatar.png" width="120rpx" height="120rpx" shape="circle" />

View File

@@ -5,20 +5,12 @@ import numeral from "numeral";
const billTypeMenu = [ const billTypeMenu = [
{ {
value: "0", value: "0",
label: "入库单已提交", label: "已提交",
}, },
{ {
value: "1", value: "1",
label: "已完成", label: "已完成",
}, },
{
value: "2",
label: "出库单已提交",
},
{
value: "3",
label: "已完成",
},
{ {
value: "4", value: "4",
label: "已取消", label: "已取消",
@@ -29,7 +21,7 @@ const billTypeMenu = [
const billStatueMenu = [ const billStatueMenu = [
{ {
value: "0", value: "0",
label: "库单已提交", label: "库单已提交",
}, },
{ {
value: "1", value: "1",
@@ -37,7 +29,7 @@ const billStatueMenu = [
}, },
{ {
value: "2", value: "2",
label: "物料部分入库", label: "物料部分",
}, },
]; ];
// 物料状态 // 物料状态
@@ -51,15 +43,41 @@ const materialType = [
label: "已提交", label: "已提交",
}, },
]; ];
/**
* 获取入库/出库单状态展示文本
* @param {any} val - 状态
* @param {string|number} status - 物料状态
* @param {number} flag - 1=出库 0=入库
* @returns {string} 状态文本
*/
export const getBillType = (val, status, flag) => {
const valStr = String(val);
const statusStr = String(status);
// 入/出库单状态的label if (valStr === "0") {
export const getBillType = (val, status) => { const statusItem = billStatueMenu.find((item) => item.value === statusStr);
if (val === "0") { if (!statusItem) return "";
return billStatueMenu.find((i) => i.value == `${status}`)?.label;
const isOut = flag === 1;
const stateVal = statusItem.value;
// 状态 0前缀拼接 入/出
if (stateVal === "0") {
return isOut ? "出" + statusItem.label : "入" + statusItem.label;
} }
return billTypeMenu.find((i) => i.value == `${val}`)?.label;
};
// 状态 2后缀拼接 入库/出库
if (stateVal === "2") {
return isOut ? statusItem.label + "出库" : statusItem.label + "入库";
}
// 其他状态直接返回
return statusItem.label;
}
// 非0走普通单据类型菜单
return billTypeMenu.find((item) => item.value === valStr)?.label || "";
};
// 获取出入库单的状态以及tag颜色 // 获取出入库单的状态以及tag颜色
export const getColor = (val) => { export const getColor = (val) => {
@@ -101,7 +119,6 @@ export const getStockQuantity = (item, type) => {
} }
}; };
// 清楚缓存 - 将所有需要清楚的缓存写入此处不要写登录信息 // 清楚缓存 - 将所有需要清楚的缓存写入此处不要写登录信息
export const removeStorage = () => { export const removeStorage = () => {
uni.removeStorageSync("app_warehousing"); uni.removeStorageSync("app_warehousing");
@@ -124,8 +141,28 @@ export const objectToQuery = (params) => {
// 获取配置的导航路由 // 获取配置的导航路由
export const getTabBarList = () => { export const getTabBarList = () => {
// 1. 从 uni-app 全局配置中读取 tabBar // 1. 从 uni-app 全局配置中读取 tabBar
const tabBarConfig = __uniConfig.tabBar || {} const tabBarConfig = __uniConfig.tabBar || {};
// 2. 获取 list 数组 // 2. 获取 list 数组
const tabList = tabBarConfig.list || [] const tabList = tabBarConfig.list || [];
return tabList return tabList;
};
// ======================
// 工具函数blobUrl 转 可上传的临时文件路径
// ======================
export function blobToTempFilePath(blobUrl) {
return new Promise((resolve, reject) => {
// 1. 下载 blob 数据
uni.downloadFile({
url: blobUrl,
success: (res) => {
if (res.statusCode === 200) {
resolve(res.tempFilePath);
} else {
reject("下载失败");
}
},
fail: reject,
});
});
} }

View File

@@ -5,19 +5,25 @@
<view class="right-btn flex align-center justify-center "> <view class="right-btn flex align-center justify-center ">
<uv-image @click="onPrinter" src="../../../../static/printer.png" width="20px" height="20px" <uv-image @click="onPrinter" src="../../../../static/printer.png" width="20px" height="20px"
style="margin-top:10rpx" /> style="margin-top:10rpx" />
<uv-image @click="onEdit" src="../../../../static/edit.png" class="ml-24" width="20px" height="20px" <uv-image @click="toEditOrAway('2')" src="../../../../static/edit.png" class="ml-24" width="20px"
style="margin-top:10rpx" /> height="20px" style="margin-top:10rpx" />
</view> </view>
</template> </template>
</navigation> </navigation>
<view class="contentBox">
<!-- 详情信息 --> <!-- 详情信息 -->
<detail-info type="stockIn" :detailInfo="detailInfo" /> <detail-info :type="pathParams.value?.type" :detailInfo="detailInfo" />
<view v-if="detailInfo?.billType == '0'" <!-- 底部按钮 -->
<view v-if="detailInfo?.billType == '0' && !flag"
:class="getBillType(detailInfo?.billType, detailInfo?.status) != '物料部分入库' ? 'bottom' : 'bottom1'"> :class="getBillType(detailInfo?.billType, detailInfo?.status) != '物料部分入库' ? 'bottom' : 'bottom1'">
<uv-button type="error" v-if="getBillType(detailInfo?.billType, detailInfo?.status) != '物料部分入库'" text="作废" <uv-button type="error" v-if="getBillType(detailInfo?.billType, detailInfo?.status, flag) != '物料部分入库'"
@click="toObsolete"></uv-button> text="作废" @click="toObsolete"></uv-button>
<uv-button type="primary" text="入库单入库" @click="toPutAway"></uv-button> <uv-button type="primary" text="入库单入库" @click="toEditOrAway('1')"></uv-button>
</view>
<view v-if="detailInfo?.billType == '0' && flag" class="bottom1">
<uv-button type="primary" text="出库单出库" @click="toEditOrAway('1')"></uv-button>
</view>
</view> </view>
</template> </template>
<script setup> <script setup>
@@ -25,101 +31,139 @@ import _ from 'lodash';
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import { objectToQuery, getBillType } from '../../../until'; import { objectToQuery, getBillType } from '../../../until';
import { stockInDetail, inboundBillVoid } from '../../../../api/stockIn';
import { stockOutDetail } from '@/api/stockOut';
import { stockInDetail, inboundBillVoid } from '@/api/stockIn';
import DetailInfo from '../../../components/DetailInfo.vue'; import DetailInfo from '../../../components/DetailInfo.vue';
import Navigation from '../../../components/Navigation.vue'; import Navigation from '../../../components/Navigation.vue';
// ref:返回路径 // ref:返回路径
const backUrl = ref('') const backUrl = ref('')
// 数据:路径参数 // 数据:路径参数
const pathParams = ref('') const pathParams = ref('')
// 数据:详情 // 数据:详情
const detailInfo = ref('') const detailInfo = ref('')
// 数据:类型 stockIn:入库 stockIn-putAway入库单入库 stockOut出库 // type
const type = computed(() => pathParams.value.type) const OPERATE_CONFIG = {
// 方法:获取详情 - 将isDelete写入 // url:入库/出库 地址 back导航栏返回地址 editUrl编辑地址
stockIn: {// 入库单开单
type: 'stockIn',
url: '/pages/warehousing/stockOut/components/outAway',
back: '/pages/warehousing/stockIn/my',
editUrl: '/pages/warehousing/stockIn/create',
},
stockIn_inbound: { // 入库单入库
type: 'stockIn_inbound',
url: '/pages/warehousing/stockIn/components/inbound',
back: '/pages/warehousing/stockIn/putAway',
editUrl: '/pages/warehousing/stockIn/create',
},
stockOut: { // 出库单开单
type: 'stockOut',
url: '/pages/warehousing/stockOut/components/outAway',
back: '/pages/warehousing/stockOut/my',
editUrl: '/pages/warehousing/stockOut/create',
},
stockOut_outAway: { // 出库单入库
type: 'stockOut_outAway',
url: '/pages/warehousing/stockOut/components/outAway',
back: '/pages/warehousing/stockOut/outbound',
editUrl: '/pages/warehousing/stockOut/create',
},
}
const flag = computed(() => _.includes(pathParams.value.type, 'stockIn') ? 0 : 1)
// 打印
const onPrinter = () => { }
// 获取详情 - 将isDelete写入
const getDetailInfo = () => { const getDetailInfo = () => {
if (flag.value == 1) {
stockOutDetail({ billNo: pathParams.value.billNo }).then((res) => {
detailInfo.value = res.data
})
} else {
stockInDetail({ billNo: pathParams.value.billNo }).then((res) => { stockInDetail({ billNo: pathParams.value.billNo }).then((res) => {
detailInfo.value = res.data detailInfo.value = res.data
}) })
} }
// 打印
const onPrinter = () => {
} }
const toObsolete = () => { const toObsolete = () => {
const params = { inboundBillVoid({
billNo: pathParams.value?.billNo, billNo: pathParams.value?.billNo,
billType: '5' billType: '5'
} }).then((res) => {
inboundBillVoid(params).then((res) => {
// /pages/warehousing/stockIn/my
uni.navigateTo({ uni.navigateTo({
url: `/pages/warehousing/stockIn/my` url: `/pages/warehousing/stockIn/my`
}); });
}) })
} }
/**
* 详情信息存入本地缓存
* @param {any} type - 类型标识,控制物料存储逻辑
*/
const setDetailInfoToStorage = (type) => { const setDetailInfoToStorage = (type) => {
const data = detailInfo.value || {}
// 仓库信息
uni.setStorageSync('app_warehousing', [{ uni.setStorageSync('app_warehousing', [{
deptName: detailInfo.value?.warehouseName, deptName: data.warehouseName || '',
deptCode: detailInfo.value?.warehouseCode, deptCode: data.warehouseCode || ''
}]) }])
// 库区信息
uni.setStorageSync('app_storageArea', [{ uni.setStorageSync('app_storageArea', [{
deptName: detailInfo.value?.areaName, deptName: data.areaName || '',
deptCode: detailInfo.value?.areaCode, deptCode: data.areaCode || ''
}]) }])
if (type) { // 单据备注
const material = _.filter(detailInfo.value?.itemList, (i) => i?.uniqueCode && i.status == '0') uni.setStorageSync('app_billRemark', data.billRemark || '')
const materialSelectList = _.filter(detailInfo.value?.itemList, (i) => !i?.uniqueCode && i.status == '0') // 物料列表
const itemList = data.itemList || []
if (!type) {
// 无 type筛选出状态=0 的数据,分两组
const material = _.filter(itemList, i => i?.uniqueCode && i.status === '0')
const materialSelectList = _.filter(itemList, i => !i?.uniqueCode && i.status === '0')
uni.setStorageSync('app_material', material) uni.setStorageSync('app_material', material)
uni.setStorageSync('app_material_select_list', materialSelectList) uni.setStorageSync('app_material_select_list', materialSelectList)
} else { } else {
uni.setStorageSync('app_material', detailInfo.value?.itemList) // 有 type直接存储全部 itemList
uni.setStorageSync('app_material', itemList)
} }
uni.setStorageSync('app_billRemark', detailInfo.value?.billRemark,)
}
// 按钮:入库单入库
const toPutAway = () => {
setDetailInfoToStorage('1')
const query = objectToQuery(pathParams.value)
uni.navigateTo({
url: `/pages/warehousing/stockIn/components/inbound${query}`
});
}
// 编辑
const onEdit = () => {
setDetailInfoToStorage()
const query = objectToQuery(pathParams.value)
let url = `/pages/warehousing/stockIn/create${query}`
uni.navigateTo({
url: url
});
} }
// 接收路径参数billNo /**
* 路径跳转操作 入库、出库、编辑
* @param {any} type - 类型标识1 出入库操作 2 编辑
*/
const toEditOrAway = (key) => {
const config = flag.value ? OPERATE_CONFIG.stockOut_outAway : OPERATE_CONFIG.stockIn_inbound; // 获取配置flag 区分入库/出库)
console.log(config, 'config===>');
const queryParams = { ...pathParams.value, type: config.type } // 拼接路径参数
const queryStr = objectToQuery(queryParams)
const targetUrl = key === '1' ? config.url : config.editUrl // 区分跳转:操作 / 编辑
setDetailInfoToStorage(key === '1' ? flag.value : undefined)// 存储数据
uni.navigateTo({
url: targetUrl + queryStr
}).catch(err => {
console.error('页面跳转失败:', err)
})
}
// 接收路径参数
onLoad((options) => { onLoad((options) => {
if (!options.billNo) { if (!options.billNo) {
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' }) uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
return return
} }
if (options.type == 'stockIn') {
backUrl.value = '/pages/warehousing/stockIn/my'
} else if (options.type == 'stockIn-putAway') {
backUrl.value = '/pages/warehousing/stockIn/putaway'
}
pathParams.value = options pathParams.value = options
const query = objectToQuery(pathParams.value)
backUrl.value = OPERATE_CONFIG?.[pathParams.value.type]?.back + `${query}`
getDetailInfo() getDetailInfo()
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/* 底部按钮 */
// 底部按钮 // 底部按钮
.bottom { .bottom {
position: fixed; position: fixed;

View File

@@ -2,12 +2,11 @@
<template> <template>
<view class="page"> <view class="page">
<navigation title="入库" :back-url="backUrl"></navigation> <navigation title="入库" :back-url="backUrl"></navigation>
<!-- 仓库信息 - 仓库存储区 --> <!-- 仓库信息 - 仓库存储区 -->
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" :pathParams="pathParams" /> <warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo"
:pathParams="{ ...pathParams, back: 'stockIn' }" />
<!-- 物料列表 - 添加物料 --> <!-- 物料列表 - 添加物料 -->
<material-list ref="materialRef" :formData="formData" isEdit="5" backStr="stockIn" :pathParams="pathParams" <material-list ref="materialRef" :formData="formData" isEdit="5" :pathParams="pathParams":extendData="{ selectMaterialList }" />
:extendData="{ selectMaterialList }" />
<!-- 底部操作栏 --> <!-- 底部操作栏 -->
<view class="bottom"> <view class="bottom">
<uv-button type="primary" @click="submitForm">入库</uv-button> <uv-button type="primary" @click="submitForm">入库</uv-button>
@@ -16,32 +15,25 @@
</template> </template>
<script setup> <script setup>
import _ from 'lodash'; import _ from 'lodash';
import { ref } from 'vue'; import { ref, onMounted } from 'vue';
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import { objectToQuery } from '../../../until';
import { inboundFinish, stockInDetail } from '@/api/stockIn'; import { inboundFinish, stockInDetail } from '@/api/stockIn';
import Navigation from '../../../components/Navigation.vue';
import MaterialList from '../../../components/MaterialList.vue'; import MaterialList from '../../../components/MaterialList.vue';
import WarehousingInfo from '../../../components/WarehousingInfo.vue'; import WarehousingInfo from '../../../components/WarehousingInfo.vue';
import { onMounted } from 'vue';
import Navigation from '../../../components/Navigation.vue'; // stockIn-putAway入库单入库编辑
import {objectToQuery} from '../../../until';
const backUrl = ref('') const backUrl = ref('')
// 数据:路径参数 // 数据:路径参数
const pathParams = ref('') const pathParams = ref('')
// 标志:是否为编辑
const isEdit = ref('')
// 标志:区分页面 进入页面的状态 null新建 stockIn:入库编辑 stockIn-putAway入库单入库编辑
const flag = ref('')
// ref物料绑定 // ref物料绑定
const materialRef = ref([]) const materialRef = ref([])
// ref仓库信息绑定 // ref仓库信息绑定
const warehousingInfoRef = ref([]) const warehousingInfoRef = ref([])
// ref:选中的物料
const selectMaterialList = ref([]) const selectMaterialList = ref([])
const detailInfo = ref('')
// 数据:物料列表 // 数据:物料列表
const formData = ref([{ remark: '', material: [] }]) const formData = ref([{ remark: '', material: [] }])
// 数据:仓库信息 // 数据:仓库信息
@@ -69,7 +61,6 @@ const getMaterialList = () => {
} }
// 方法:获取详情 - 更新物料得值 获取唯一码后回来 // 方法:获取详情 - 更新物料得值 获取唯一码后回来
const getDetailInfo = () => { const getDetailInfo = () => {
stockInDetail({ billNo: pathParams.value.billNo }).then((res) => { stockInDetail({ billNo: pathParams.value.billNo }).then((res) => {
@@ -102,32 +93,27 @@ const submitForm = () => {
billRemark: info.remark, billRemark: info.remark,
itemList: _.map(_materialInfo, (i) => ({ ...i.material })) itemList: _.map(_materialInfo, (i) => ({ ...i.material }))
} }
try {
inboundFinish(params).then((res) => { inboundFinish(params).then((res) => {
// stockIn uni.navigateTo({ url: backUrl.value });
// /pages/warehousing/stockIn/components/detail
uni.navigateTo({
url: backUrl.value
});
console.log(res, '入库单入库');
}) })
} catch (err) {
console.log('入库单入库失败==》', err);
}
} }
// 数据:路径参数 // 数据:路径参数
onLoad((options) => { onLoad((options) => {
console.log(options, 'options', _.includes(options?.type, 'stockIn'));
if (!options.billNo) { if (!options.billNo) {
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' }) uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
return return
} }
pathParams.value = options pathParams.value = options
// stockIn-putAway
// stockIn
const query = objectToQuery(pathParams.value) const query = objectToQuery(pathParams.value)
backUrl.value = `/pages/warehousing/stockIn/components/detail${query}` backUrl.value = `/pages/warehousing/stockIn/components/detail${query}`
getDetailInfo() getDetailInfo()
flag.value = options.type
isEdit.value = _.includes(options?.type, 'stockIn')
}) })
onMounted(() => { onMounted(() => {

View File

@@ -1,8 +1,9 @@
<template> <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: 'stockIn' }" />
<!-- 物料列表 - 添加物料 --> <!-- 物料列表 - 添加物料 -->
<material-list ref="materialRef" :formData="formData" isEdit="1" backStr="stockIn" :pathParams="pathParams" /> <material-list ref="materialRef" :formData="formData" isEdit="1" backStr="stockIn" :pathParams="pathParams" />
<!-- 底部操作栏 --> <!-- 底部操作栏 -->
@@ -24,18 +25,26 @@ import { getMaterialUnique } from '@/api/uniqueCode';
import MaterialList from '../../components/MaterialList.vue'; import MaterialList from '../../components/MaterialList.vue';
import WarehousingInfo from '../../components/WarehousingInfo.vue'; import WarehousingInfo from '../../components/WarehousingInfo.vue';
import Navigation from '../../components/Navigation.vue'; import Navigation from '../../components/Navigation.vue';
import { includes } from 'lodash'; const OPERATE_CONFIG = {
// 创建
list: {
back: 'pages/warehousing/index',
title: '入库单开单'
},
// 编辑/入库
stockIn: {
back: '/pages/warehousing/stockIn/components/detail',
title: ''
}
}
// 数据:路径参数 // 数据:路径参数
const pathParams = ref('') const pathParams = ref('')
// 标志:是否为编辑 // 标志:是否为编辑
const isEdit = ref('') const isEdit = ref('')
// 标志:区分页面 进入页面的状态 null新建 stockIn:入库编辑 stockIn-putAway入库单入库编辑
const flag = ref('')
// ref标题 // ref标题
const title = ref('入库单开单') const title = ref('')
const backUrl = ref('pages/warehousing/index') const backUrl = ref('')
// ref物料绑定 // ref物料绑定
const materialRef = ref([]) const materialRef = ref([])
@@ -49,20 +58,19 @@ const warehouseInfo = ref({ warehousing: {}, storageArea: {}, remark: '' })
// 数据:获取缓存信息 // 数据:获取缓存信息
const getMaterialList = () => { const getMaterialList = () => {
// 仓库信息
// 获取仓库信息
const warehouse = uni.getStorageSync('app_warehousing'); const warehouse = uni.getStorageSync('app_warehousing');
warehouseInfo.value.warehousing = warehouse warehouseInfo.value.warehousing = warehouse
// 获取存储区信息 // 存储区信息
const storageArea = uni.getStorageSync('app_storageArea'); const storageArea = uni.getStorageSync('app_storageArea');
warehouseInfo.value.storageArea = storageArea warehouseInfo.value.storageArea = storageArea
// 获取物料信息 // 物料信息
const material = uni.getStorageSync('app_material'); const material = uni.getStorageSync('app_material');
formData.value.material = material formData.value.material = material
// 获取入库单备注 // 入库单备注
const billRemark = uni.getStorageSync('app_billRemark'); const billRemark = uni.getStorageSync('app_billRemark');
warehouseInfo.value.remark = billRemark warehouseInfo.value.remark = billRemark
} }
@@ -128,65 +136,56 @@ const submitForm = () => {
billRemark: info.remark, billRemark: info.remark,
itemList: _.map(materialInfo, (i) => ({ ...i.material })) itemList: _.map(materialInfo, (i) => ({ ...i.material }))
} }
console.log(params, isEdit, !isEdit, info, materialInfo, '入参params'); try {
// 新建
if (!isEdit.value) { if (!isEdit.value) {
// 新增
addStockIn(params).then((res) => { addStockIn(params).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({ title: '入库单创建成功', icon: 'success', mask: true })
title: '入库单创建成功', uni.navigateTo({ url: OPERATE_CONFIG.list.back })
mask: true,
icon: 'success',
})
uni.navigateTo({
url: `/pages/warehousing/stockIn/my`,
});
} }
}) })
} else if (isEdit.value) { } else {
// 编辑 // 编辑
params.billNo = pathParams.value?.billNo params.billNo = pathParams.value?.billNo;
params.billId = pathParams.value?.billId params.billId = pathParams.value?.billId;
const query = objectToQuery(pathParams.value) const queryStr = objectToQuery(pathParams.value)
stockInUpdate(params).then((res) => { stockInUpdate(params).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({ title: '入库单编辑成功', icon: 'success', mask: true })
title: '入库单编辑成功', uni.navigateTo({ url: OPERATE_CONFIG.stockIn.back + queryStr })
mask: true,
icon: 'success',
})
let url = `/pages/warehousing/stockIn/components/detail${query}`
uni.navigateTo({
url: url,
});
} }
}) })
} }
} catch (err) {
console.error('提交失败:', err)
uni.showToast({ title: '提交失败', icon: 'none' })
}
}
}
// 数据:路径参数 // 数据:路径参数
onLoad((options) => { onLoad((options) => {
console.log(options, 'options', _.includes(options?.type, 'stockIn'));
pathParams.value = options pathParams.value = options
flag.value = options.type console.log('options==>', options);
isEdit.value = _.includes(options?.type, 'stockIn')
}) // 若有billNo传入 修改标题且为编辑 stockIn:入库编辑 stockIn-putAway入库单入库编辑
// 修改标题若有billNo传入 修改标题 if (options?.billNo) {
onShow(() => { const query = objectToQuery(options)
const query = objectToQuery(pathParams.value) title.value = options.billNo
if (pathParams.value.billNo) { backUrl.value = OPERATE_CONFIG.stockIn.back + query;
title.value = pathParams.value.billNo isEdit.value = true
} } else {
if ( includes(pathParams.value.type,'stockIn') ) { isEdit.value = false
backUrl.value = `/pages/warehousing/stockIn/components/detail${query}` title.value = OPERATE_CONFIG.list.title;
backUrl.value = OPERATE_CONFIG.list.back;
} }
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .contentBox {
background: #f5f5f5; background: #f5f5f5;
min-height: 100vh; min-height: 100vh;
} }

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>

View File

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

View File

@@ -4,5 +4,4 @@
</template> </template>
<script setup> <script setup>
import SearchList from '../../components/SearchList.vue'; import SearchList from '../../components/SearchList.vue';
</script> </script>

View File

@@ -1,6 +1,8 @@
<!-- 底部导航栏仓库 --> <!-- 底部导航栏仓库 -->
<template> <template>
<view class="content"> <navigation title="仓储" :showBack="false"></navigation>
<view class="contentBox">
<uni-card v-for="(item, index) in menuList" :key="item.id" :title="item.title" :isFull="true" <uni-card v-for="(item, index) in menuList" :key="item.id" :title="item.title" :isFull="true"
class="custom-card"> class="custom-card">
<view v-for="value in item.menuItem" :key="value.id" class="card_items" @click="value.click"> <view v-for="value in item.menuItem" :key="value.id" class="card_items" @click="value.click">
@@ -14,6 +16,8 @@
<script setup> <script setup>
import { onShow } from '@dcloudio/uni-app'; import { onShow } from '@dcloudio/uni-app';
import { removeStorage } from '../until'; import { removeStorage } from '../until';
import Navigation from '../components/Navigation.vue';
const menuList = [ const menuList = [
{ {
id: 'inventory', id: 'inventory',
@@ -152,7 +156,7 @@ const menuList = [
click: () => { click: () => {
console.log('入库单入库') console.log('入库单入库')
uni.navigateTo({ uni.navigateTo({
url: '/pages/warehousing/stockIn/putaway' url: '/pages/warehousing/stockIn/putAway'
}); });
} }

View File

@@ -1,6 +1,6 @@
<!-- 仓库信息选择 --> <!-- 仓库信息选择 -->
<template> <template>
<choose-list :isWarehousing="isWarehousing" :backStr="pathParams.backStr" :pathParams="pathParams" /> <choose-list :isWarehousing="isWarehousing" :backStr="pathParams.back" :pathParams="pathParams" />
</template> </template>
<script setup> <script setup>
import { computed, ref } from 'vue' import { computed, ref } from 'vue'

View File

@@ -1,64 +1,65 @@
<!-- 唯一码发放页面 - 唯一码发放唯一码编辑入库单快速生成唯一码 --> <!-- 唯一码发放页面 - 唯一码发放唯一码编辑入库单快速生成唯一码 -->
<template> <template>
<view class="content">
<navigation :title="title" :back-url="backUrl"></navigation> <navigation :title="title" :back-url="backUrl"></navigation>
<view class="contentBox">
<view class="remarkLine"> <view class="remarkLine">
<span>备注</span> <span>备注</span>
<uni-easyinput type="text" v-model="formData.remark" :inputBorder="false" placeholder="请输入备注" /> <uni-easyinput type="text" v-model="formData.remark" :inputBorder="false" placeholder="请输入备注" />
</view> </view>
<!-- 物料列表 - 添加物料 --> <!-- 物料列表 - 添加物料 -->
<material-list ref="materialRef" :formData="formData" :remark="formData.remark" isEdit="1" :backStr="backStr" <material-list ref="materialRef" :formData="formData" :remark="formData.remark" isEdit="1"
:pathParams="pathParams" /> :pathParams="pathParams" />
<button class="bottom-btn" type="primary" @click="handleSubmit">提交</button> <button class="bottom-btn" type="primary" @click="handleSubmit">提交</button>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { addUniqueCode, editUniqueCode } from '@/api/uniqueCode'; import { addUniqueCode, editUniqueCode } from '@/api/uniqueCode';
import MaterialList from '../../../components/MaterialList.vue'; import MaterialList from '../../../components/MaterialList.vue';
import Navigation from '../../../components/Navigation.vue'; import Navigation from '../../../components/Navigation.vue';
import { objectToQuery } from '../../../until'; import { objectToQuery } from '../../../until';
import { computed } from 'vue';
import _ from 'lodash'; import _ from 'lodash';
import { includes } from 'lodash'; const OPERATE_CONFIG = {
// 唯一码创建
issueUniqueCode: {
title: '唯一码发放',
back: 'pages/warehousing/index'
},
//唯一码编辑
issueUniqueCode_edit: {
title: '',
back: '/pages/warehousing/uniqueCode/myUniqueCode'
},
//入库单入库
stockIn_inbound: {
title: '快速生成唯一码',
back: '/pages/warehousing/stockIn/components/inbound'
},
}
// ref标题 // ref标题
const title = ref('入库单开单') const title = ref('')
const backUrl = ref('pages/warehousing/index') const backUrl = ref('')
// 数据:路径参数 // 数据:路径参数
const pathParams = ref('') const pathParams = ref('')
// 数据:物料、备注 // 数据:物料、备注
const formData = ref({ remark: '', material: [] }) const formData = ref({ remark: '', material: [] })
// ref:绑定物料列表 // ref:绑定物料列表
const materialRef = ref([]) const materialRef = ref([])
const backStr = computed(() => pathParams.value.back == 'inbound' ? `issueUniqueCode_inbound` : 'issueUniqueCode')
// 接收路径参数 - 修改标题- 携带code、id、materialId // 接收路径参数 - 修改标题- 携带code、id、materialId
onLoad((options) => { onLoad((options) => {
const query = objectToQuery(options)
pathParams.value = options pathParams.value = options
const config = options.type ? OPERATE_CONFIG[options.type] : OPERATE_CONFIG.issueUniqueCode
title.value = config.title ? config.title : options.title
backUrl.value = config.back + query
})
onShow(() => {
// 唯一码发放、唯一码编辑、入库单快速生成唯一码
const query = objectToQuery(pathParams.value)
if (pathParams.value.title) {
// 唯一码编辑 /pages/warehousing/uniqueCode/myUniqueCode/detail?id=64&code=600064
title.value = pathParams.value.title
backUrl.value = `/pages/warehousing/uniqueCode/myUniqueCode${query}`
} else if (includes(pathParams.value.back, 'inbound')) {
// 入库单快速生成唯一码 /pages/warehousing/uniqueCode/issueUniqueCode/index?billNo=WR1775527275119&back=inbound
title.value = '快速生成唯一码'
backUrl.value = `/pages/warehousing/stockIn/components/inbound${query}`
} else {
title.value = '唯一码发放'
backUrl.value = 'pages/warehousing/index'
}
}) })
onMounted(() => { onMounted(() => {
// 快速生成唯一码时 已选择的物料列表初始为空 点击添加物料 去选择 // 快速生成唯一码时 已选择的物料列表初始为空 点击添加物料 去选择
if (pathParams.value.back != 'inbound') { if (pathParams.value.type != 'inbound') {
getMaterialList(); getMaterialList();
} }
@@ -67,12 +68,12 @@ onMounted(() => {
const handleSubmit = () => { const handleSubmit = () => {
// 物料最新编辑数据 // 物料最新编辑数据
const material = materialRef.value.getMaterialList()?.[0] const material = materialRef.value.getMaterialList()?.[0]
const query = objectToQuery(pathParams.value)
const params = { const params = {
remark: formData.value.remark, remark: formData.value.remark,
material: { ...material.material, unitId: '23' } material: { ...material.material, unitId: '23' }
} }
if (pathParams.value.back == `issueUniqueCode_inbound`) { if (pathParams.value.type == `issueUniqueCode_inbound`) {
params.billNo = pathParams.value.billNo params.billNo = pathParams.value.billNo
} }
if (pathParams.value.id) { if (pathParams.value.id) {
@@ -87,7 +88,7 @@ const handleSubmit = () => {
icon: 'success', icon: 'success',
}) })
uni.navigateTo({ uni.navigateTo({
url: `/pages/warehousing/uniqueCode/myUniqueCode/detail?id=${pathParams.value.id}&title=${pathParams.value.title}`, url: OPERATE_CONFIG.issueUniqueCode_edit.back + query
}); });
} }
@@ -100,17 +101,15 @@ const handleSubmit = () => {
mask: true, mask: true,
icon: 'success', icon: 'success',
}) })
if (_.includes(pathParams.value?.back, 'inbound')) { if (_.includes(pathParams.value?.type, 'inbound')) {
// /pages/warehousing/uniqueCode/myUniqueCode/detail?id=38&code=600038
uni.navigateTo({ uni.navigateTo({
url: `/pages/warehousing/stockIn/components/inbound?billNo=${pathParams.value.billNo}`, url: OPERATE_CONFIG.stockIn_inbound.back + query
}); });
} else { } else {
uni.switchTab({ uni.switchTab({
url: "/pages/warehousing/index" url: OPERATE_CONFIG.issueUniqueCode.back
}) })
} }
// /pages/warehousing/stockIn/components/inbound?billNo=WR1775032495153
} }

View File

@@ -1,14 +1,14 @@
<!-- 物料选择 --> <!-- 物料选择 -->
<template> <template>
<view class="content"> <view class="contentBox">
<view class="topSearch" v-if="!backUrl.includes('inbound')"> <view class="topSearch" v-if="!isInbound">
<uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false" <uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false"
@iconClick="getMaterialList" placeholder="请输入搜索内容" /> @iconClick="getMaterialList" placeholder="请输入搜索内容" />
</view> </view>
<!-- 物料列表 --> <!-- 物料列表 -->
<z-paging ref="pagingRef" class="containerBox" v-model="materialList" @query="getMaterialList" <z-paging ref="pagingRef" class="containerBox" v-model="materialList" @query="getMaterialList"
v-if="!backUrl.includes('inbound')"> v-if="!isInbound">
<uni-list> <uni-list>
<uni-list-item v-for="item in materialList" :key="item.id" clickable class="material-card" <uni-list-item v-for="item in materialList" :key="item.id" clickable class="material-card"
@click="onMaterial(item)"> @click="onMaterial(item)">
@@ -33,7 +33,7 @@
</uni-list> </uni-list>
</z-paging> </z-paging>
<view v-if="backUrl.includes('inbound')"> <view v-if="isInbound">
<uni-list> <uni-list>
<uni-list-item v-for="item in materialList" :key="item.id" clickable class="material-card" <uni-list-item v-for="item in materialList" :key="item.id" clickable class="material-card"
@click="onMaterial(item)"> @click="onMaterial(item)">
@@ -66,7 +66,28 @@ import { getTypeParentNames, } from '../until';
import { objectToQuery } from '../../../until'; import { objectToQuery } from '../../../until';
import { getMaterial } from '@/api/uniqueCode' import { getMaterial } from '@/api/uniqueCode'
import { onShow, onLoad } from "@dcloudio/uni-app"; import { onShow, onLoad } from "@dcloudio/uni-app";
const OPERATE_CONFIG = {
// 唯一码创建
issueUniqueCode: {
back: '/pages/warehousing/uniqueCode/issueUniqueCode/index'
},
//唯一码编辑
issueUniqueCode_edit: {
back: '/pages/warehousing/uniqueCode/issueUniqueCode/index'
},
//入库单开单
stockIn: {
back: '/pages/warehousing/stockIn/create'
},
//入库单入库
stockIn_inbound: {
back: '/pages/warehousing/uniqueCode/issueUniqueCode/index'
},
//入库单编辑
stockIn_detail: {
back: '/pages/warehousing/stockIn/create'
},
}
// ref:下拉加载 // ref:下拉加载
const pagingRef = ref(null) const pagingRef = ref(null)
// 数据:查询参数 // 数据:查询参数
@@ -77,9 +98,9 @@ const queryParams = ref({
const materialList = ref([]) const materialList = ref([])
// 数据:路径参数 // 数据:路径参数
const pathParams = ref('') const pathParams = ref('')
// 数据:返回路径标识
// 数据:返回路径标识 stockIn 入库单开单 stockInDetail入库单编辑 issueUniqueCode唯一码 issueUniqueCode_inbound入库生成唯一码 const keyType = computed(() => pathParams?.value?.type)
const backUrl = computed(() => pathParams?.value?.back) const isInbound = computed(() => _.includes(pathParams?.value?.type, 'inbound'))
// 方法:获取列表 // 方法:获取列表
const getMaterialList = () => { const getMaterialList = () => {
getMaterial(queryParams.value).then(res => { getMaterial(queryParams.value).then(res => {
@@ -94,10 +115,7 @@ const getMaterialList = () => {
// 方法:获取列表 - 入库生成唯一码 // 方法:获取列表 - 入库生成唯一码
const getMaterialListInbound = () => { const getMaterialListInbound = () => {
const list = uni.getStorageSync('app_material_select_list') const list = uni.getStorageSync('app_material_select_list')
console.log('list',list);
materialList.value = list materialList.value = list
} }
onShow(() => { onShow(() => {
@@ -118,76 +136,39 @@ const getStorageMaterial = (val) => {
} }
return [{ ...val, quantity: 1 }] return [{ ...val, quantity: 1 }]
} }
// 方法:返回路径
const toBack = (back) => {
const path = objectToQuery({ ...pathParams.value })
let url = ''
switch (back) {
case 'stockIn':
// 入库单开单添加物料进入
url = `/pages/warehousing/stockIn/create`
break
case 'issueUniqueCode':
case 'issueUniqueCode_inbound':
// 唯一码发放/入库生成唯一码
url = `/pages/warehousing/uniqueCode/issueUniqueCode/index`
break
case 'stockInDetail':
//我的入库单/入库单入库
url = `/pages/warehousing/stockIn/components/detail`
break
}
uni.navigateTo({
url: `${url}${path}`
})
}
// 方法:选择物料 // 方法:选择物料
const onMaterial = (val) => { const onMaterial = (val) => {
let materialChecked = uni.getStorageSync('app_material'); let materialChecked = uni.getStorageSync('app_material');
const path = objectToQuery(pathParams.value)
if (!Array.isArray(materialChecked)) { if (!Array.isArray(materialChecked)) {
materialChecked = []; materialChecked = [];
} }
console.log(materialChecked, 'materialChecked==>');
const item = _.find(materialChecked, (i) => i.materialId ? i.materialId === val.id : i.id === val.id) const item = _.find(materialChecked, (i) => i.materialId ? i.materialId === val.id : i.id === val.id)
console.log(item, 'item==>');
const idx = _.findIndex(materialChecked, (i) => i.materialId ? i.materialId === val.id : i.id === val.id) const idx = _.findIndex(materialChecked, (i) => i.materialId ? i.materialId === val.id : i.id === val.id)
console.log(idx, 'idx==>', idx != -1 && item?.isDelete == '0', backUrl.value);
if (idx != -1 && item?.isDelete == '0') { // isDelete为0表示未删除 1为已删除数据不在对比范围内 if (idx != -1 && item?.isDelete == '0') { // isDelete为0表示未删除 1为已删除数据不在对比范围内
console.log(backUrl.value == 'stockIn', '11111111111111111111111111'); if (keyType.value === 'stockIn') {
if (backUrl.value == 'stockIn') {
console.log(111111111111);
uni.showToast({ uni.showToast({
title: '该物料已添加,请勿重复添加!', title: '该物料已添加,请勿重复添加!',
mask: true, mask: true,
icon: 'none', icon: 'none',
}) })
} }
//! 现在仅允许添加一条物料打印一个唯一码 但保留可添加多个
// uni.showToast({
// title: '该物料已添加,请勿重复添加!',
// mask: true,
// icon: 'none',
// })
toBack(backUrl.value)
} else {
console.log('执行到这里');
} else {
if (val) { if (val) {
if (backUrl.value == 'stockIn') { if (keyType.value == 'stockIn') {
materialChecked = [...materialChecked, { ...val, quantity: 1, isDelete: '0' }]; materialChecked = [...materialChecked, { ...val, quantity: 1, isDelete: '0' }];
} else { } else {
materialChecked = getStorageMaterial(val) materialChecked = getStorageMaterial(val)
} }
uni.setStorageSync('app_material', materialChecked); uni.setStorageSync('app_material', materialChecked);
} }
toBack(backUrl.value)
} }
uni.navigateTo({
url: OPERATE_CONFIG?.[keyType.value].back + path
})
} }
</script> </script>

View File

@@ -136,7 +136,7 @@ const toTraceability = () => {
// 修改:唯一码的物料信息 - 携带title和唯一码id // 修改:唯一码的物料信息 - 携带title和唯一码id
const toEdit = () => { const toEdit = () => {
uni.navigateTo({ uni.navigateTo({
url: `/pages/warehousing/uniqueCode/issueUniqueCode/index?title=${pathParams.value.code}&id=${pathParams.value.id}`, url: `/pages/warehousing/uniqueCode/issueUniqueCode/index?title=${pathParams.value.code}&id=${pathParams.value.id}type=issueUniqueCode_edit`,
}); });
} }

View File

@@ -1,7 +1,7 @@
<!-- 唯一码 --> <!-- 唯一码 -->
<template> <template>
<view class="content">
<navigation title="唯一码" back-url="pages/warehousing/index"></navigation> <navigation title="唯一码" back-url="pages/warehousing/index"></navigation>
<view class="contentBox">
<view class="topSearch"> <view class="topSearch">
<uni-easyinput type="text" v-model="queryParams.code" prefixIcon="search" :inputBorder="false" <uni-easyinput type="text" v-model="queryParams.code" prefixIcon="search" :inputBorder="false"
@iconClick="getMaterialList" placeholder="请输入关键词搜索" /> @iconClick="getMaterialList" placeholder="请输入关键词搜索" />
@@ -61,11 +61,11 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { getStatusName, getDetail } from '../until';
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import { getUniqueCodeList, delUniqueCode, detailUniqueCode } from '@/api/uniqueCode'
import QrCodeModal from './QrCodeModal.vue'; import QrCodeModal from './QrCodeModal.vue';
import { getStatusName, getDetail } from '../until';
import Navigation from '../../../components/Navigation.vue'; import Navigation from '../../../components/Navigation.vue';
import { getUniqueCodeList, delUniqueCode, detailUniqueCode } from '@/api/uniqueCode'
const queryParams = ref({ const queryParams = ref({
code: '' code: ''
@@ -144,10 +144,10 @@ const getDetailInfo = (row) => {
<style scoped lang="scss"> <style scoped lang="scss">
.topSearch { .topSearch {
position: fixed; position: fixed;
top: var(--nav-height); /* 关键:自动在导航栏下方 */ top: var(--nav-height);
left: 0; left: 0;
right: 0; right: 0;
z-index: 99; /* 比导航栏小 */ z-index: 99;
padding: 8rpx 16rpx; padding: 8rpx 16rpx;
background-color: #fff; background-color: #fff;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
@@ -155,8 +155,7 @@ const getDetailInfo = (row) => {
} }
.containerBox { .containerBox {
// padding: 0 12rpx; padding-top: 100px !important;
padding-top: 90px !important; /* 撑开:导航栏+搜索框高度 */
width: 100%; width: 100%;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;

View File

@@ -13,7 +13,7 @@ const statusMenu = [
}, },
{ {
value: 1, value: 1,
label: "已打印", label: "入库单开单",
}, },
{ {
value: 2, value: 2,
@@ -21,11 +21,15 @@ const statusMenu = [
}, },
{ {
value: 3, value: 3,
label: "出库,", label: "出库单开单",
}, },
{ {
value: 3, value: 4,
label: "已配送,", label: "已出库",
},
{
value: 9,
label: "已作废",
}, },
]; ];
export const getStatusName = (val) => { export const getStatusName = (val) => {

View File

@@ -223,3 +223,7 @@
color: #616161; color: #616161;
} }
} }
.contentBox{
margin-top: 80rpx;
}