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_APP_MODE = 'dev'
VITE_API_URL = http://114.218.158.24:9020 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 mode = prod
VITE_APP_MODE = 'prod' VITE_APP_MODE = 'prod'
VITE_API_URL = https://erpapi.fontree.cn/ 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 () { onShow: function () {
console.log("App Show"); console.log("App Show");
console.log(window.location.href);
}, },
onHide: function () { onHide: function () {
console.log("App Hide"); console.log("App Hide");

View File

@ -1,36 +1,36 @@
import request from "../../utils/service/index"; import request from "../../utils/service/index";
//登录 //登录
export const userLogin = (data) => { export const userLogin = (data) => {
return request({ return request({
url: "/user/v2/login", url: "/user/v2/login",
method: "POST", method: "POST",
data, data,
}); });
}; };
//验证码 //验证码
export const userSend = (data) => { export const userSend = (data) => {
return request({ return request({
url: "/user/send", url: "/user/send",
method: "POST", method: "POST",
data, data,
}); });
}; };
//扫码查看画桶详情 //扫码查看画桶详情
export const pbDetail = (data) => { export const pbDetail = (data) => {
return request({ return request({
url: "/containeradm/v1/painting_bucket/get_by_id", url: "/containeradm/v1/painting_bucket/get_by_id",
method: "POST", method: "POST",
data, data,
}); });
}; };
//查询可放画桶的空闲货架孔 //查询可放画桶的空闲货架孔
export const freebox = (data) => { export const freebox = (data) => {
return request({ return request({
url: "/containeradm/v1/box_rel_bucket/freebox", url: "/containeradm/v1/box_rel_bucket/freebox",
method: "POST", method: "POST",
data, data,
}); });
}; };
//出库 //出库
export const outbound = (data) => { export const outbound = (data) => {
return request({ return request({
@ -79,3 +79,10 @@ export const cancel = (data) => {
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; const root = document.documentElement;
root.style.setProperty( root.style.setProperty(
"--statusBarHeight", "--statusBarHeight",
`${ `${currentWebView.RunTime === "app"
currentWebView.RunTime === "app" ? plus.navigator.getStatusbarHeight()
? plus.navigator.getStatusbarHeight() : 0 ?? 0
: 0 ?? 0
}px` }px`
); );
</script> </script>
@ -51,9 +50,11 @@ root.style.setProperty(
.status_bar { .status_bar {
height: var(--status-bar-height); height: var(--status-bar-height);
} }
:deep(.u-status-bar) { :deep(.u-status-bar) {
margin-top: var(--statusBarHeight); margin-top: var(--statusBarHeight);
} }
@mixin flex($direction: row) { @mixin flex($direction: row) {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="content"> <view class="content">
<navBar> 入库 </navBar> <!-- <navBar> 入库 </navBar> -->
<view class="container-box"> <view class="container-box">
<span style="font-weight: bold"> 已扫画筒号{{ state.pid }} </span> <span style="font-weight: bold"> 已扫画筒号{{ state.pid }} </span>
<span style="margin-top: 40rpx"> 请放入 </span> <span style="margin-top: 40rpx"> 请放入 </span>
@ -17,9 +17,11 @@
margin-top: 20rpx; margin-top: 20rpx;
" "
> >
{{state.boxName}} {{ state.boxName }}
</span>
<span style="text-align: center; margin-top: 20rpx">
{{ state.column }}{{ state.row }}
</span> </span>
<span style="text-align: center; margin-top: 20rpx"> {{state.column}}{{state.row}} </span>
</view> </view>
</view> </view>
</view> </view>
@ -31,6 +33,7 @@
:disabled="closeButton" :disabled="closeButton"
@click="closeFn" @click="closeFn"
:loading="loading" :loading="loading"
v-if="runTimeEnv()"
>取消</up-button >取消</up-button
> >
<up-button <up-button
@ -40,6 +43,7 @@
@click="doneSet" @click="doneSet"
:disabled="isButtonDisabled" :disabled="isButtonDisabled"
:loading="loading" :loading="loading"
v-if="hasPermission('APP-scanEnteringwarehouse')"
>{{ buttonText }}</up-button >{{ buttonText }}</up-button
> >
</view> </view>
@ -49,7 +53,8 @@
import { ref, reactive, onBeforeMount } from "vue"; import { ref, reactive, onBeforeMount } from "vue";
import useToast from "@/hooks/toast/useToast.js"; import useToast from "@/hooks/toast/useToast.js";
import { onLoad } from "@dcloudio/uni-app"; 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 { showMessage } = useToast();
const loading = ref(false); const loading = ref(false);
const isButtonDisabled = ref(false); const isButtonDisabled = ref(false);
@ -59,15 +64,15 @@ const state = reactive({
id: "", id: "",
pid: "", pid: "",
containerName: "", containerName: "",
boxName:"", boxName: "",
boxUid:"", boxUid: "",
containerUid:'', containerUid: "",
}); });
onLoad((options) => { onLoad((options) => {
state.id = options.id; state.id = options.id;
state.pid = options.pid; state.pid = options.pid;
bindShelfHole(); bindShelfHole();
getBtngetRules();
}); });
const bindShelfHole = async () => { const bindShelfHole = async () => {
@ -76,15 +81,14 @@ const bindShelfHole = async () => {
if (res.status === 0) { if (res.status === 0) {
state.containerName = res.data.containerName; state.containerName = res.data.containerName;
state.boxName = res.data.boxName; state.boxName = res.data.boxName;
state.containerUid=res.data.containerUid; state.containerUid = res.data.containerUid;
state.boxUid=res.data.boxUid; state.boxUid = res.data.boxUid;
check() check();
if (state.boxName) { if (state.boxName) {
const parts = state.boxName.split(/(\d+)/); const parts = state.boxName.split(/(\d+)/);
state.column = parts[0]; // state.column = parts[0]; //
state.row = parts[1]; // state.row = parts[1]; //
} }
} }
loading.value = false; loading.value = false;
}; };
@ -94,46 +98,68 @@ const doneSet = async () => {
const res = await bind({ const res = await bind({
paintingBucketId: state.id, paintingBucketId: state.id,
paintingBucketUid: state.pid, paintingBucketUid: state.pid,
boxUid:state.boxUid, boxUid: state.boxUid,
containerUid:state.containerUid, containerUid: state.containerUid,
containerName:state.containerName, containerName: state.containerName,
boxName:state.boxName, boxName: state.boxName,
}); });
if (res.status === 0) { if (res.status === 0) {
showMessage({ type: "sucess", message: "入库成功" }); showMessage({ type: "sucess", message: "入库成功" });
isButtonDisabled.value = true; isButtonDisabled.value = true;
buttonText.value = "已入库"; buttonText.value = "已入库";
}else{ if (runTimeEnv()) {
showMessage({ type: "error", message: res.msg }); closeWebview();
} }
loading.value = false; } else {
showMessage({ type: "error", message: res.msg });
}
loading.value = false;
}; };
// //
const closeFn = async () => { const closeFn = async () => {
loading.value = true; loading.value = true;
const res = await cancel({ const res = await cancel({
boxUid : state.boxUid boxUid: state.boxUid,
}); });
if(res.status === 0){ if (res.status === 0) {
showMessage({ type: "error", message: "取消入库" }); showMessage({ type: "error", message: "取消入库" });
closeButton.value = true; closeButton.value = true;
isButtonDisabled.value = true; isButtonDisabled.value = true;
}else{ if (runTimeEnv()) {
showMessage({ type: "error", message: res.msg }); closeWebview();
} }
loading.value = false; } else {
} showMessage({ type: "error", message: res.msg });
}
loading.value = false;
};
// //
const check = async () => { const check = async () => {
const res = await check_freebox({ const res = await check_freebox({
boxUid : state.boxUid boxUid: state.boxUid,
}); });
if(res.status === 0){ if (res.status === 0) {
}else{ } else {
showMessage({ type: "error", message: res.msg }); 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -173,6 +199,7 @@ page {
box-shadow: 0 0 6px rgba(219, 218, 218, 0.5); box-shadow: 0 0 6px rgba(219, 218, 218, 0.5);
} }
} }
.button-container { .button-container {
display: flex; display: flex;
justify-content: space-between; 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 Request from "./request/index.js";
import useToast from "@/hooks/toast/useToast.js"; import useToast from "@/hooks/toast/useToast.js";
import { OAorMc } from "../index.js";
const { showMessage } = useToast(); const { showMessage } = useToast();
console.log(window?.plus?.storage.getItem("token"));
const request = new Request({ 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, timeout: 1000 * 60 * 5,
interceptors: { interceptors: {
//实例的请求拦截器 //实例的请求拦截器
@ -12,7 +17,10 @@ const request = new Request({
? "application/x-www-form-urlencoded" ? "application/x-www-form-urlencoded"
: "application/json"; : "application/json";
const token = uni.getStorageSync("token") || ""; const token =
window?.plus?.storage.getItem("token") ||
uni.getStorageSync("token") ||
"";
if (config.isFormData) { if (config.isFormData) {
config.headers["Content-Type"] = "multipart/form-data"; config.headers["Content-Type"] = "multipart/form-data";
config.headers["Authorization"] = token; config.headers["Authorization"] = token;
@ -32,14 +40,14 @@ const request = new Request({
// response.config.headers["Authorization"] = response.data.data.Token; // response.config.headers["Authorization"] = response.data.data.Token;
// } // }
if (response.data.code === 401) { if (response.data.code === 401) {
uni.clearStorageSync()//清缓存 uni.clearStorageSync(); //清缓存
const params = new URLSearchParams(window.location.search)//属性包含当前 URL 的查询字符串部分 const params = new URLSearchParams(window.location.search); //属性包含当前 URL 的查询字符串部分
const id = params.get('id') const id = params.get("id");
const pid = params.get('pid') const pid = params.get("pid");
uni.navigateTo({ 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)) { if ([200, 201, 204].includes(response.status)) {
return response.config.responseType === "blob" ? response : response; return response.config.responseType === "blob" ? response : response;