This commit is contained in:
贾旖璇 2024-10-21 11:25:34 +08:00
commit 0fb2cc4a45
13 changed files with 582 additions and 394 deletions

View File

@ -1,2 +1,3 @@
VITE_APP_MODE = 'dev'
VITE_API_URL = http://114.218.158.24:9020
VITE_API_OA_URL=http://114.218.158.24:9020

View File

@ -1,3 +1,4 @@
mode = prod
VITE_APP_MODE = 'prod'
VITE_API_URL = https://erpapi.fontree.cn/
VITE_API_OA_URL=https://erp-out.szjixun.cn/

View File

@ -5,6 +5,7 @@ export default {
},
onShow: function () {
console.log("App Show");
console.log(window.location.href);
},
onHide: function () {
console.log("App Hide");

View File

@ -1,36 +1,36 @@
import request from "../../utils/service/index";
//登录
export const userLogin = (data) => {
return request({
url: "/user/v2/login",
method: "POST",
data,
});
};
//验证码
return request({
url: "/user/v2/login",
method: "POST",
data,
});
};
//验证码
export const userSend = (data) => {
return request({
url: "/user/send",
method: "POST",
data,
});
};
//扫码查看画桶详情
export const pbDetail = (data) => {
return request({
url: "/containeradm/v1/painting_bucket/get_by_id",
method: "POST",
data,
});
};
//查询可放画桶的空闲货架孔
export const freebox = (data) => {
return request({
url: "/containeradm/v1/box_rel_bucket/freebox",
method: "POST",
data,
});
};
return request({
url: "/user/send",
method: "POST",
data,
});
};
//扫码查看画桶详情
export const pbDetail = (data) => {
return request({
url: "/containeradm/v1/painting_bucket/get_by_id",
method: "POST",
data,
});
};
//查询可放画桶的空闲货架孔
export const freebox = (data) => {
return request({
url: "/containeradm/v1/box_rel_bucket/freebox",
method: "POST",
data,
});
};
//出库
export const outbound = (data) => {
return request({
@ -79,3 +79,10 @@ export const cancel = (data) => {
data,
});
};
export const getRules = (data) => {
return request({
url: "/rule/rules",
method: "POST",
data,
});
};

View File

@ -39,10 +39,9 @@ const currentWebView = plus.webview.getWebviewById("wv");
const root = document.documentElement;
root.style.setProperty(
"--statusBarHeight",
`${
currentWebView.RunTime === "app"
? plus.navigator.getStatusbarHeight()
: 0 ?? 0
`${currentWebView.RunTime === "app"
? plus.navigator.getStatusbarHeight()
: 0 ?? 0
}px`
);
</script>
@ -51,9 +50,11 @@ root.style.setProperty(
.status_bar {
height: var(--status-bar-height);
}
:deep(.u-status-bar) {
margin-top: var(--statusBarHeight);
}
@mixin flex($direction: row) {
/* #ifndef APP-NVUE */
display: flex;

View File

@ -3,6 +3,7 @@ import App from "./App.vue";
import uviewPlus from "uview-plus";
import globalComponents from "./components";
import VConsole from "vconsole";
if (import.meta.env.VITE_APP_MODE === "dev") {
new VConsole();
}

View File

@ -12,43 +12,35 @@
{
"path": "pages/login/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": false //
}
"navigationBarTitleText": "登录",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": false //
}
"navigationBarTitleText": "添加画作",
"enablePullDownRefresh": false
}
},
{
"path": "pages/painting/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": false //
}
"navigationBarTitleText": "入库",
"enablePullDownRefresh": false
}
},
{
"path": "pages/detail/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": false //
}
"enablePullDownRefresh": false
}
},
}
],
"globalStyle": {
"navigationBarTextStyle": "black",

View File

@ -1,84 +1,113 @@
<template>
<view class="content">
<navBar v-if="state.boxRelBucketStatus == 1"> 出库 </navBar>
<navBar v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4"> 画筒详情 </navBar>
<view class="container-box" >
<span style="font-weight: bold;text-align: center;" v-if="state.boxRelBucketStatus == 1">
确定要出库{{state.locateAddress}}
</span>
<span style="font-weight: bold;text-align: center;margin-top: 20rpx;" v-if="state.boxRelBucketStatus == 1"> {{state.pid}}画筒吗</span>
<span style="font-weight: bold;text-align: center;" v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4">画筒号{{state.pid}}</span>
<span style="font-weight: bold;text-align: center;margin-top: 20rpx;" v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4">所在位置{{ state.locateAddress }}</span>
<view class="painting-box" >
<span>画作名称{{ state.drawName }}</span>
<span style="margin-top: 20rpx;">画家{{ state.drawerName }}</span>
<span style="margin-top: 20rpx;">预览图</span>
<view class="image-container">
<up-image
:src=state.drawThumbnail
></up-image>
<view class="content">
<!-- <navBar v-if="state.boxRelBucketStatus == 1"> 出库 </navBar>
<navBar
v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4"
>
画筒详情
</navBar> -->
<view class="container-box">
<span
style="font-weight: bold; text-align: center"
v-if="state.boxRelBucketStatus == 1"
>
确定要出库{{ state.locateAddress }}
</span>
<span
style="font-weight: bold; text-align: center; margin-top: 20rpx"
v-if="state.boxRelBucketStatus == 1"
>
{{ state.pid }}画筒吗</span
>
<span
style="font-weight: bold; text-align: center"
v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4"
>画筒号{{ state.pid }}</span
>
<span
style="font-weight: bold; text-align: center; margin-top: 20rpx"
v-if="state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4"
>所在位置{{ state.locateAddress }}</span
>
<view class="painting-box">
<span>画作名称{{ state.drawName }}</span>
<span style="margin-top: 20rpx">画家{{ state.drawerName }}</span>
<span style="margin-top: 20rpx">预览图</span>
<view class="image-container">
<up-image :src="state.drawThumbnail"></up-image>
</view>
</view>
</view>
</view>
<view class="button-container">
<up-button
</view>
<view class="button-container">
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#BABABA"
throttleTime="5"
v-if="state.boxRelBucketStatus == 1"
v-if="state.boxRelBucketStatus == 1 && runTimeEnv()"
@click="backScan"
>取消</up-button
>
<up-button
style="width: 336rpx; margin: auto; height: 80rpx;"
color="#EFC54E"
throttleTime="5"
@click="doneSet"
v-if="state.boxRelBucketStatus == 1"
:disabled="isButtonDisabled"
> {{ buttonText }}</up-button
>
<up-button
style="width: 426rpx; margin: auto; height: 86rpx;"
color="#EFC54E"
throttleTime="5"
@click="login"
v-if="state.boxRelBucketStatus == 2||state.boxRelBucketStatus ==4"
>返回继续扫码</up-button
>
</view>
</template>
<script setup>
import { ref,reactive,onBeforeMount } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import useToast from "@/hooks/toast/useToast.js";
import { pbDetail,outbound } from "@/api/login.js";
const { showMessage } = useToast();
const isDetail = ref(false);
const loading = ref(false);
const isButtonDisabled = ref(false);
const buttonText = ref("确认");
const state = reactive({
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#EFC54E"
throttleTime="5"
@click="doneSet"
v-if="state.boxRelBucketStatus == 1"
:disabled="isButtonDisabled"
>
{{ buttonText }}</up-button
>
<up-button
style="width: 426rpx; margin: auto; height: 86rpx"
color="#EFC54E"
throttleTime="5"
@click="backScan"
v-if="
(state.boxRelBucketStatus == 2 || state.boxRelBucketStatus == 4) &&
runTimeEnv()
"
>返回继续扫码</up-button
>
</view>
</template>
<script setup>
import { ref, reactive, onBeforeMount } from "vue";
import { closeWebview, hasPermission } from "../../../utils/index.js";
import { onLoad, onShow } from "@dcloudio/uni-app";
import useToast from "@/hooks/toast/useToast.js";
import { pbDetail, outbound, getRules } from "@/api/login.js";
const { showMessage } = useToast();
const isDetail = ref(false);
const loading = ref(false);
const isButtonDisabled = ref(false);
const buttonText = ref("确认");
const state = reactive({
id: "",
pid: "",
containerName:"",
boxRelBucketStatus:"",
drawName:"",
drawerName:"",
drawThumbnail:"",
locateAddress:"",
boxUid:"",
containerName: "",
boxRelBucketStatus: "",
drawName: "",
drawerName: "",
drawThumbnail: "",
locateAddress: "",
boxUid: "",
});
onLoad((options) =>{
state.id = options.id;
state.pid = options.pid;
state.boxRelBucketStatus = options.boxRelBucketStatus;
paintingDetail()
onShow(() => {
uni.setNavigationBarTitle({
title: state.boxRelBucketStatus == 1 ? "出库" : "画筒详情",
});
const paintingDetail = async () => {
});
onLoad((options) => {
state.id = options.id;
state.pid = options.pid;
state.boxRelBucketStatus = options.boxRelBucketStatus;
paintingDetail();
getBtngetRules();
});
const paintingDetail = async () => {
loading.value = true;
const res = await pbDetail({
id: state.id,
@ -90,84 +119,102 @@
state.drawThumbnail = res.data.drawThumbnail;
state.locateAddress = res.data.locateAddress;
state.boxUid = res.data.boxUid;
}
}
};
const doneSet = async () => {
loading.value = true;
const res = await outbound({
id: state.id,
pid: state.pid,
boxUid:state.boxUid,
boxUid: state.boxUid,
});
if (res.status === 0) {
showMessage({ type: "sucess", message: "出库成功" });
isButtonDisabled.value = true;
isButtonDisabled.value = true;
buttonText.value = "已出库";
}else{
} else {
showMessage({ type: "error", message: res.msg });
}
loading.value = false;
};
</script>
<style lang="scss" scoped>
page {
background: url("@/static/bgp.png") no-repeat;
background-size: 100% 100%;
background-attachment: fixed;
height: 100vh;
box-sizing: border-box;
}
.content {
loading.value = false;
};
const backScan = () => {
closeWebview();
};
const runTimeEnv = () => {
if (plus) {
const currentWebView = plus.webview.getWebviewById("wv");
return currentWebView.RunTime === "app";
} else {
return false;
}
};
const getBtngetRules = async () => {
const res = await getRules({});
if (res.status === 0) {
const ruleBtn = res.data.MyButtonAuths?.map((button) => button.Url) || [];
uni.setStorageSync("ruleBtn", ruleBtn);
} else {
showMessage({ type: "error", message: res.msg });
}
};
</script>
<style lang="scss" scoped>
page {
background: url("@/static/bgp.png") no-repeat;
background-size: 100% 100%;
background-attachment: fixed;
height: 100vh;
box-sizing: border-box;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.container-box {
height: 100%;
width: 98%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.container-box {
height: 100%;
width: 98%;
display: flex;
flex-direction: column;
margin-top: 60rpx;
padding: 40rpx;
box-sizing: border-box;
}
.painting-box {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
margin-top: 60rpx;
padding: 20rpx;
box-sizing: border-box;
background-color: #fff;
box-shadow: 0 0 6px rgba(219, 218, 218, 0.5);
}
.image-container {
display: flex;
justify-content: center;
align-items: center;
margin-top: 20rpx;
height:auto;
}
margin-top: 60rpx;
padding: 40rpx;
box-sizing: border-box;
}
.button-container {
display: flex;
justify-content: space-between;
width: 100%;
position: fixed;
bottom: 1rpx;
left: 0;
padding: 0 20rpx;
box-sizing: border-box;
background-color: #fff;
height: 8%;
}
</style>
.painting-box {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
margin-top: 60rpx;
padding: 20rpx;
box-sizing: border-box;
background-color: #fff;
box-shadow: 0 0 6px rgba(219, 218, 218, 0.5);
}
.image-container {
display: flex;
justify-content: center;
align-items: center;
margin-top: 20rpx;
height: auto;
}
}
.button-container {
display: flex;
justify-content: space-between;
width: 100%;
position: fixed;
bottom: 1rpx;
left: 0;
padding: 0 20rpx;
box-sizing: border-box;
background-color: #fff;
height: 8%;
}
</style>

View File

@ -1,48 +1,74 @@
<template>
<view class="content">
<navBar> 添加画作 </navBar>
<!-- <navBar> 添加画作 </navBar> -->
<view class="container-box">
<span style="font-weight: bold">
已扫画筒号{{state.pid }}
</span>
<view style="display: flex; align-items: center;">
<up-input class="login-input" placeholder="画家姓名/画作名称" v-model="state.searchValue" style="flex: 1; margin-right: 10rpx;height: 80rpx;" clearable>
<span style="font-weight: bold"> 已扫画筒号{{ state.pid }} </span>
<view style="display: flex; align-items: center">
<up-input
class="login-input"
placeholder="画家姓名/画作名称"
v-model="state.searchValue"
style="flex: 1; margin-right: 10rpx"
clearable
>
</up-input>
<up-button style="width: 120rpx;
height: 80rpx;
margin-top: 15rpx;
margin-left: 15rpx;"
color="#EFC54E"
throttleTime="5"
:loading="loading"
@click="paintingList(state.page=1)">搜索</up-button>
<up-button
style="
width: 120rpx;
height: 80rpx;
margin-top: 15rpx;
margin-left: 15rpx;
"
color="#EFC54E"
throttleTime="5"
:loading="loading"
@click="paintingList((state.page = 1))"
>搜索</up-button
>
</view>
<up-list @scrolltolower="scrolltolower" style="height:1120rpx">
<up-list-item class="painting-box" v-for="(painting,index) in state.tableData" :key="index">
<span style="display: flex; align-items: center;position: relative;" >
<up-image :show-loading="true" :src="painting.HdPic" width="100px" height="100px" @click = "enlarge(painting.HdPic)"></up-image>
<span style="display: flex; flex-direction: column; margin-left: 10px;">
<span style="font-weight: bold;" >{{painting.ArtworkName}}</span>
<span style="color:#BCBCBC;font-size: 16px;">画作编号{{ painting.Tfnum }}</span>
<span style="color:#BCBCBC;font-size: 16px;">画家编号{{ painting.Tnum }}</span>
<span style="color:#BCBCBC;font-size: 16px;">画家姓名{{ painting.ArtistName }}</span>
<span style="color:#BCBCBC;font-size: 16px;">平尺{{ painting.Ruler }}</span>
</span>
<up-radio-group
v-model="painting.checked"
style="position: absolute;
left: 550rpx;
bottom: 150rpx;
"
placement="right"
@change="groupChange"
<up-list @scrolltolower="scrolltolower" style="height: 1120rpx">
<up-list-item
class="painting-box"
v-for="(painting, index) in state.tableData"
:key="index"
>
<span style="display: flex; align-items: center; position: relative">
<up-image
:show-loading="true"
:src="painting.HdPic"
width="100px"
height="100px"
@click="enlarge(painting.HdPic)"
></up-image>
<span
style="display: flex; flex-direction: column; margin-left: 10px"
>
<up-radio :name="painting.ArtworkUuid"></up-radio>
</up-radio-group>
</span>
</up-list-item>
</up-list>
<span style="font-weight: bold">{{ painting.ArtworkName }}</span>
<span style="color: #bcbcbc; font-size: 16px"
>画作编号{{ painting.Tfnum }}</span
>
<span style="color: #bcbcbc; font-size: 16px"
>画家编号{{ painting.Tnum }}</span
>
<span style="color: #bcbcbc; font-size: 16px"
>画家姓名{{ painting.ArtistName }}</span
>
<span style="color: #bcbcbc; font-size: 16px"
>平尺{{ painting.Ruler }}</span
>
</span>
<up-radio-group
v-model="painting.checked"
style="position: absolute; left: 550rpx; bottom: 150rpx"
placement="right"
@change="groupChange"
>
<up-radio :name="painting.ArtworkUuid"></up-radio>
</up-radio-group>
</span>
</up-list-item>
</up-list>
</view>
</view>
<view class="button-container">
@ -50,26 +76,31 @@
style="width: 336rpx; margin: auto; height: 80rpx"
color="#BABABA"
throttleTime="5"
@click="backScan"
v-if="runTimeEnv()"
>取消</up-button
>
<up-button
style="width: 336rpx; margin: auto; height: 80rpx;"
color="#EFC54E"
throttleTime="5"
:loading="loading"
:disabled="isButtonDisabled"
@click="doneSet"
> {{ buttonText }}</up-button
>
</view>
<up-button
style="width: 336rpx; margin: auto; height: 80rpx"
color="#EFC54E"
throttleTime="5"
:loading="loading"
:disabled="isButtonDisabled"
@click="doneSet"
v-if="hasPermission('APP-scanAdd')"
>
{{ buttonText }}</up-button
>
</view>
</template>
<script setup>
import { ref, reactive, onBeforeMount } from "vue";
import useToast from "@/hooks/toast/useToast.js";
import { onLoad,onReachBottom } from "@dcloudio/uni-app";
import { creChangepainting,add } from "@/api/login.js";
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
import { creChangepainting, add, getRules } from "@/api/login.js";
import { closeWebview, hasPermission } from "../../../utils/index";
const { showMessage } = useToast();
const loading = ref(false);
const isButtonDisabled = ref(false);
@ -77,92 +108,93 @@ const buttonText = ref("确认");
const state = reactive({
id: "",
pid: "",
tableData:[],
page:1,
pageSize:10,
selectedUuid:"",
searchValue:"",
tableData: [],
page: 1,
pageSize: 10,
selectedUuid: "",
searchValue: "",
});
onLoad((options) => {
state.id = options.id;
state.pid = options.pid;
paintingList()
state.id = options.id;
state.pid = options.pid;
paintingList();
getBtngetRules();
});
const groupChange =(e) =>{
state.tableData.forEach((item) =>{
if(item.ArtworkUuid!==e){
item.checked =''
const groupChange = (e) => {
state.tableData.forEach((item) => {
if (item.ArtworkUuid !== e) {
item.checked = "";
}
})
}
});
};
//
const paintingList = async (param) => {
loading.value = true;
const res = await creChangepainting({
Tfnum: "",
ArtworkName: "",
Tnum: "",
ArtistName: "",
page: state.page,
pageSize: state.pageSize,
keywords: state.searchValue,
...param,
});
loading.value = false;
if (res.status === 0) {
if (res.data.Data !== null) {
state.tableData = res.data.Data.map((item) => {
return {
...item,
checked: ''
}
});
console.log(1111, state.tableData);
} else {
state.tableData = [];
showMessage({ type: "error", message: "查询失败,暂无画作!" });
}
loading.value = true;
const res = await creChangepainting({
Tfnum: "",
ArtworkName: "",
Tnum: "",
ArtistName: "",
page: state.page,
pageSize: state.pageSize,
keywords: state.searchValue,
...param,
});
loading.value = false;
if (res.status === 0) {
if (res.data.Data !== null) {
state.tableData = res.data.Data.map((item) => {
return {
...item,
checked: "",
};
});
console.log(1111, state.tableData);
} else {
showMessage({ type: "error", message: res.msg });
state.tableData = [];
showMessage({ type: "error", message: "查询失败,暂无画作!" });
}
}
} else {
showMessage({ type: "error", message: res.msg });
}
};
//
const doneSet = async () => {
loading.value = true;
const selectedPainting = state.tableData.find((item) => item.checked);
if (selectedPainting) {
const res = await add({
type: "add",
id: state.id,
pid: state.pid,
drawUid: selectedPainting.ArtworkUuid,
drawName: selectedPainting.ArtworkName,
drawerName: selectedPainting.ArtistName,
drawerUid: selectedPainting.ArtistUuid,
rulerNum:selectedPainting.Ruler,
drawThumbnail:selectedPainting.HdPic,
drawerNum:selectedPainting.Tnum,//
drawNum:selectedPainting.Tfnum,
});
if (res.status === 0) {
showMessage({ type: "sucess", message: "添加画作成功" });
isButtonDisabled.value = true;
buttonText.value = "已添加";
state.searchValue = "";
//
paintingList({
page: 1,
pageSize: 10,
keywords: ""
});
} else {
showMessage({ type: "error", message: res.msg });
}
const res = await add({
type: "add",
id: state.id,
pid: state.pid,
drawUid: selectedPainting.ArtworkUuid,
drawName: selectedPainting.ArtworkName,
drawerName: selectedPainting.ArtistName,
drawerUid: selectedPainting.ArtistUuid,
rulerNum: selectedPainting.Ruler,
drawThumbnail: selectedPainting.HdPic,
drawerNum: selectedPainting.Tnum, //
drawNum: selectedPainting.Tfnum,
});
if (res.status === 0) {
showMessage({ type: "sucess", message: "添加画作成功" });
isButtonDisabled.value = true;
buttonText.value = "已添加";
state.searchValue = "";
//
paintingList({
page: 1,
pageSize: 10,
keywords: "",
});
} else {
showMessage({ type: "error", message: "请先选择要添加的画作" });
showMessage({ type: "error", message: res.msg });
}
loading.value = false;
} else {
showMessage({ type: "error", message: "请先选择要添加的画作" });
}
loading.value = false;
};
//
const scrolltolower = async () => {
@ -174,33 +206,56 @@ const scrolltolower = async () => {
ArtistName: "",
page: state.page,
pageSize: state.pageSize,
keywords: state.searchValue
keywords: state.searchValue,
});
if (res.status === 0) {
if(res.data.Data!==null){ const newData = res.data.Data.map((item) => {
return {
...item,
checked: ''
}
});
const uniqueData = newData.filter((newItem) => {
return!state.tableData.some((existingItem) => existingItem.ArtworkUuid === newItem.ArtworkUuid);
});
state.tableData = state.tableData.concat(uniqueData);
} }
else {
showMessage({type: "error", message: res.msg});
if (res.data.Data !== null) {
const newData = res.data.Data.map((item) => {
return {
...item,
checked: "",
};
});
const uniqueData = newData.filter((newItem) => {
return !state.tableData.some(
(existingItem) => existingItem.ArtworkUuid === newItem.ArtworkUuid
);
});
state.tableData = state.tableData.concat(uniqueData);
}
} else {
showMessage({ type: "error", message: res.msg });
}
};
//
const enlarge=(src) =>{
const enlarge = (src) => {
uni.previewImage({
urls: [src],
current: src
urls: [src],
current: src,
});
}
};
const backScan = () => {
closeWebview();
};
const runTimeEnv = () => {
try {
if (plus) {
const currentWebView = plus.webview.getWebviewById("wv");
return currentWebView.RunTime === "app";
}
} catch (e) {
return false;
}
};
const getBtngetRules = async () => {
const res = await getRules({});
if (res.status === 0) {
const ruleBtn = res.data.MyButtonAuths?.map((button) => button.Url) || [];
uni.setStorageSync("ruleBtn", ruleBtn);
} else {
showMessage({ type: "error", message: res.msg });
}
};
</script>
<style lang="scss" scoped>
@ -217,7 +272,7 @@ page {
flex-direction: column;
align-items: center;
justify-content: center;
.container-box {
height: auto;
width: 95%;
@ -250,22 +305,20 @@ page {
background-color: #fff;
box-shadow: 0 0 6px rgba(219, 218, 218, 0.5);
}
}
.button-container {
display: flex;
justify-content: space-between;
width: 100%;
position: fixed;
bottom: 1rpx;
left: 0;
padding: 0 20rpx;
box-sizing: border-box;
background-color: #fff;
height: 8%;
}
uni-button:after {
display: flex;
justify-content: space-between;
width: 100%;
position: fixed;
bottom: 1rpx;
left: 0;
padding: 0 20rpx;
box-sizing: border-box;
background-color: #fff;
height: 8%;
}
uni-button:after {
border: none;
}
</style>

View File

@ -1,6 +1,6 @@
<template>
<view class="content">
<navBar> 登录 </navBar>
<!-- <navBar> 登录 </navBar> -->
<view class="container-box">
<view class="title">
<span>登录</span>
@ -103,7 +103,7 @@
import { ref, reactive } from "vue";
import useToast from "@/hooks/toast/useToast.js";
import { onLoad } from "@dcloudio/uni-app";
import { userLogin, userSend, pbDetail } from "@/api/login.js";
import { userLogin, userSend, pbDetail, getRules } from "@/api/login.js";
const state = reactive({
TelNum: "",
Password: "",
@ -120,20 +120,23 @@ onLoad((options) => {
console.log("options", options);
state.id = options.id;
state.pid = options.pid;
const token = uni.getStorageSync("token");
const token =
window?.plus?.storage.getItem("token") || uni.getStorageSync("token");
const userInfo = uni.getStorageSync("userInfo");
console.log("token", token);
//
if (token && userInfo) {
if (token) {
paintingDetail();
getBtngetRules();
}
}
/*
/*
1.先调用options的对应接口
2.判断是是否有没有登录
3如果登录了判断状态去相应页面
4.没有登录让他登录然后根据状态判断去相应页面
**/
});
const paintingDetail = async () => {
@ -199,7 +202,7 @@ const paintingDetail = async () => {
// };
const toCode = () => {
isCode.value = true;
state.Password= "";
state.Password = "";
};
//
const obtainCode = async () => {
@ -237,9 +240,19 @@ const logining = async () => {
uni.setStorageSync("token", res.data.Token);
uni.setStorageSync("userInfo", res.data.AccountInfo);
await paintingDetail();
await getBtngetRules();
}
loading.value = false;
};
const getBtngetRules = async () => {
const res = await getRules({});
if (res.status === 0) {
const ruleBtn = res.data.MyButtonAuths?.map((button) => button.Url) || [];
uni.setStorageSync("ruleBtn", ruleBtn);
} else {
showMessage({ type: "error", message: res.msg });
}
};
</script>
<style lang="scss" scoped>

View File

@ -1,6 +1,6 @@
<template>
<view class="content">
<navBar> 入库 </navBar>
<!-- <navBar> 入库 </navBar> -->
<view class="container-box">
<span style="font-weight: bold"> 已扫画筒号{{ state.pid }} </span>
<span style="margin-top: 40rpx"> 请放入 </span>
@ -17,9 +17,11 @@
margin-top: 20rpx;
"
>
{{state.boxName}}
{{ state.boxName }}
</span>
<span style="text-align: center; margin-top: 20rpx">
{{ state.column }}{{ state.row }}
</span>
<span style="text-align: center; margin-top: 20rpx"> {{state.column}}{{state.row}} </span>
</view>
</view>
</view>
@ -31,6 +33,7 @@
:disabled="closeButton"
@click="closeFn"
:loading="loading"
v-if="runTimeEnv()"
>取消</up-button
>
<up-button
@ -40,6 +43,7 @@
@click="doneSet"
:disabled="isButtonDisabled"
:loading="loading"
v-if="hasPermission('APP-scanEnteringwarehouse')"
>{{ buttonText }}</up-button
>
</view>
@ -49,7 +53,8 @@
import { ref, reactive, onBeforeMount } from "vue";
import useToast from "@/hooks/toast/useToast.js";
import { onLoad } from "@dcloudio/uni-app";
import { freebox,bind,check_freebox,cancel} from "@/api/login.js";
import { freebox, bind, check_freebox, cancel, getRules } from "@/api/login.js";
import { closeWebview, hasPermission } from "../../../utils/index";
const { showMessage } = useToast();
const loading = ref(false);
const isButtonDisabled = ref(false);
@ -59,15 +64,15 @@ const state = reactive({
id: "",
pid: "",
containerName: "",
boxName:"",
boxUid:"",
containerUid:'',
boxName: "",
boxUid: "",
containerUid: "",
});
onLoad((options) => {
state.id = options.id;
state.pid = options.pid;
bindShelfHole();
getBtngetRules();
});
const bindShelfHole = async () => {
@ -76,15 +81,14 @@ const bindShelfHole = async () => {
if (res.status === 0) {
state.containerName = res.data.containerName;
state.boxName = res.data.boxName;
state.containerUid=res.data.containerUid;
state.boxUid=res.data.boxUid;
check()
state.containerUid = res.data.containerUid;
state.boxUid = res.data.boxUid;
check();
if (state.boxName) {
const parts = state.boxName.split(/(\d+)/);
const parts = state.boxName.split(/(\d+)/);
state.column = parts[0]; //
state.row = parts[1]; //
}
}
loading.value = false;
};
@ -94,46 +98,68 @@ const doneSet = async () => {
const res = await bind({
paintingBucketId: state.id,
paintingBucketUid: state.pid,
boxUid:state.boxUid,
containerUid:state.containerUid,
containerName:state.containerName,
boxName:state.boxName,
boxUid: state.boxUid,
containerUid: state.containerUid,
containerName: state.containerName,
boxName: state.boxName,
});
if (res.status === 0) {
showMessage({ type: "sucess", message: "入库成功" });
isButtonDisabled.value = true;
isButtonDisabled.value = true;
buttonText.value = "已入库";
}else{
showMessage({ type: "error", message: res.msg });
if (runTimeEnv()) {
closeWebview();
}
loading.value = false;
} else {
showMessage({ type: "error", message: res.msg });
}
loading.value = false;
};
//
const closeFn = async () => {
loading.value = true;
const res = await cancel({
boxUid : state.boxUid
boxUid: state.boxUid,
});
if(res.status === 0){
showMessage({ type: "error", message: "取消入库" });
closeButton.value = true;
isButtonDisabled.value = true;
}else{
showMessage({ type: "error", message: res.msg });
if (res.status === 0) {
showMessage({ type: "error", message: "取消入库" });
closeButton.value = true;
isButtonDisabled.value = true;
if (runTimeEnv()) {
closeWebview();
}
loading.value = false;
}
} else {
showMessage({ type: "error", message: res.msg });
}
loading.value = false;
};
//
const check = async () => {
const res = await check_freebox({
boxUid : state.boxUid
boxUid: state.boxUid,
});
if(res.status === 0){
}else{
showMessage({ type: "error", message: res.msg });
if (res.status === 0) {
} else {
showMessage({ type: "error", message: res.msg });
}
};
const runTimeEnv = () => {
try {
if (plus) {
const currentWebView = plus.webview.getWebviewById("wv");
return currentWebView.RunTime === "app";
}
}
} catch (e) {}
};
const getBtngetRules = async () => {
const res = await getRules({});
if (res.status === 0) {
const ruleBtn = res.data.MyButtonAuths?.map((button) => button.Url) || [];
uni.setStorageSync("ruleBtn", ruleBtn);
} else {
showMessage({ type: "error", message: res.msg });
}
};
</script>
<style lang="scss" scoped>
@ -173,6 +199,7 @@ page {
box-shadow: 0 0 6px rgba(219, 218, 218, 0.5);
}
}
.button-container {
display: flex;
justify-content: space-between;

36
utils/index.js Normal file
View File

@ -0,0 +1,36 @@
// export const runTimeEnv = () => {
// if (plus) {
// const currentWebView = plus.webview.getWebviewById("wv");
// return currentWebView.RunTime === "app";
// } else {
// return false;
// }
// };\
export const closeWebview = () => {
try {
const currentWebView = plus.webview.getWebviewById("wv");
currentWebView.close();
} catch (e) {
return () => {};
}
};
// 判断是oa还是墨册
export const OAorMc = () => {
try {
return plus.webview.currentWebview().type;
} catch (e) {
return "";
}
};
export const hasPermission = (userPermission) => {
let userPermissionList = Array.isArray(userPermission)
? userPermission
: [userPermission];
// 当前用户的权限列表
let permissionList = uni.getStorageSync("ruleBtn")
? uni.getStorageSync("ruleBtn")
: [];
return userPermissionList.some((e) => permissionList.includes(e));
};

View File

@ -1,8 +1,13 @@
import Request from "./request/index.js";
import useToast from "@/hooks/toast/useToast.js";
import { OAorMc } from "../index.js";
const { showMessage } = useToast();
console.log(window?.plus?.storage.getItem("token"));
const request = new Request({
baseURL: import.meta.env.VITE_API_URL,
baseURL:
OAorMc() === "MC"
? import.meta.env.VITE_API_URL
: import.meta.env.VITE_API_OA_URL,
timeout: 1000 * 60 * 5,
interceptors: {
//实例的请求拦截器
@ -12,7 +17,10 @@ const request = new Request({
? "application/x-www-form-urlencoded"
: "application/json";
const token = uni.getStorageSync("token") || "";
const token =
window?.plus?.storage.getItem("token") ||
uni.getStorageSync("token") ||
"";
if (config.isFormData) {
config.headers["Content-Type"] = "multipart/form-data";
config.headers["Authorization"] = token;
@ -32,14 +40,14 @@ const request = new Request({
// response.config.headers["Authorization"] = response.data.data.Token;
// }
if (response.data.code === 401) {
uni.clearStorageSync()//清缓存
const params = new URLSearchParams(window.location.search)//属性包含当前 URL 的查询字符串部分
const id = params.get('id')
const pid = params.get('pid')
uni.clearStorageSync(); //清缓存
const params = new URLSearchParams(window.location.search); //属性包含当前 URL 的查询字符串部分
const id = params.get("id");
const pid = params.get("pid");
uni.navigateTo({
url: "/pages/login/index?id="+id+'&pid='+pid,
url: "/pages/login/index?id=" + id + "&pid=" + pid,
});
return false
return false;
}
if ([200, 201, 204].includes(response.status)) {
return response.config.responseType === "blob" ? response : response;