出库对接
This commit is contained in:
@@ -5,20 +5,12 @@ import numeral from "numeral";
|
||||
const billTypeMenu = [
|
||||
{
|
||||
value: "0",
|
||||
label: "入库单已提交",
|
||||
label: "已提交",
|
||||
},
|
||||
{
|
||||
value: "1",
|
||||
label: "已完成",
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "出库单已提交",
|
||||
},
|
||||
{
|
||||
value: "3",
|
||||
label: "已完成",
|
||||
},
|
||||
{
|
||||
value: "4",
|
||||
label: "已取消",
|
||||
@@ -29,7 +21,7 @@ const billTypeMenu = [
|
||||
const billStatueMenu = [
|
||||
{
|
||||
value: "0",
|
||||
label: "入库单已提交",
|
||||
label: "库单已提交",
|
||||
},
|
||||
{
|
||||
value: "1",
|
||||
@@ -37,7 +29,7 @@ const billStatueMenu = [
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "物料部分入库",
|
||||
label: "物料部分",
|
||||
},
|
||||
];
|
||||
// 物料状态
|
||||
@@ -51,15 +43,41 @@ const materialType = [
|
||||
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
|
||||
export const getBillType = (val, status) => {
|
||||
if (val === "0") {
|
||||
return billStatueMenu.find((i) => i.value == `${status}`)?.label;
|
||||
if (valStr === "0") {
|
||||
const statusItem = billStatueMenu.find((item) => item.value === statusStr);
|
||||
if (!statusItem) return "";
|
||||
|
||||
const isOut = flag === 1;
|
||||
const stateVal = statusItem.value;
|
||||
|
||||
// 状态 0:前缀拼接 入/出
|
||||
if (stateVal === "0") {
|
||||
return isOut ? "出" + statusItem.label : "入" + statusItem.label;
|
||||
}
|
||||
|
||||
// 状态 2:后缀拼接 入库/出库
|
||||
if (stateVal === "2") {
|
||||
return isOut ? statusItem.label + "出库" : statusItem.label + "入库";
|
||||
}
|
||||
|
||||
// 其他状态直接返回
|
||||
return statusItem.label;
|
||||
}
|
||||
return billTypeMenu.find((i) => i.value == `${val}`)?.label;
|
||||
};
|
||||
|
||||
// 非0:走普通单据类型菜单
|
||||
return billTypeMenu.find((item) => item.value === valStr)?.label || "";
|
||||
};
|
||||
|
||||
// 获取出入库单的状态以及tag颜色
|
||||
export const getColor = (val) => {
|
||||
@@ -101,7 +119,6 @@ export const getStockQuantity = (item, type) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 清楚缓存 - 将所有需要清楚的缓存写入此处不要写登录信息
|
||||
export const removeStorage = () => {
|
||||
uni.removeStorageSync("app_warehousing");
|
||||
@@ -124,8 +141,28 @@ export const objectToQuery = (params) => {
|
||||
// 获取配置的导航路由
|
||||
export const getTabBarList = () => {
|
||||
// 1. 从 uni-app 全局配置中读取 tabBar
|
||||
const tabBarConfig = __uniConfig.tabBar || {}
|
||||
const tabBarConfig = __uniConfig.tabBar || {};
|
||||
// 2. 获取 list 数组
|
||||
const tabList = tabBarConfig.list || []
|
||||
return tabList
|
||||
}
|
||||
const tabList = tabBarConfig.list || [];
|
||||
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,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user