优化websocket

This commit is contained in:
2024-04-30 13:51:32 +08:00
parent 243ef444c7
commit 068ffaaf6c
8 changed files with 70 additions and 84 deletions

View File

@@ -114,7 +114,7 @@ uni-button[disabled]:not([type]), uni-button[disabled][type=default] {
background: center / 100% 100% url(./static/images/bg-task-r1.png) no-repeat;
}
.grid-wrap{
width: 100%;
width: calc(100% - 20px);
/* height: calc(100% - 145px); */
margin: 0 auto;
padding-top: 5px;
@@ -238,9 +238,9 @@ uni-button[disabled]:not([type]), uni-button[disabled][type=default] {
align-items: center;
font-size: 12px;
line-height: 13px;
height: 39px;
height: 49px;
color: #fff;
/* padding: 0 5px; */
padding: 5px 2px;
text-align: center;
border-bottom: 1px solid #7A9FE0;
word-break: break-all;
@@ -252,10 +252,10 @@ uni-button[disabled]:not([type]), uni-button[disabled][type=default] {
align-items: center;
font-size: 12px;
line-height: 13px;
height: 52px;
height: 49px;
color: #fff;
background-color: rgba(194, 86, 62, 0.2);
padding: 0 5px;
padding: 5px 2px;
text-align: center;
border-bottom: 1px solid #C2563E;
word-break: break-all;

View File

@@ -5,11 +5,11 @@
<view v-if="data.type === 1" class="allwidth font1">{{data.data.djbh}}</view>
<table v-if="data.type === 1" class="detail_table">
<tr>
<td>发起部门</td>
<td>来源部门</td>
<td>{{data.data.bmmc}}</td>
</tr>
<tr>
<td>去向</td>
<td>去向部门</td>
<td>{{data.data.zzmc}}</td>
</tr>
<tr>
@@ -32,20 +32,36 @@
<td>业务日期</td>
<td>{{data.data.ywrq}}</td>
</tr>
<tr>
<td>操作日期</td>
<td>{{data.data.update_time}}</td>
</tr>
<tr>
<td>操作人</td>
<td>{{data.data.update_name}}</td>
</tr>
<tr>
<td>操作日期</td>
<td>{{data.data.update_time}}</td>
</tr>
<tr>
<td>备注</td>
<td>{{data.data.remark}}</td>
</tr>
</table>
<table v-if="data.type === 2" class="detail_table">
<tr>
<td>单据ID</td>
<td>{{data.data.djid}}</td>
</tr>
<tr>
<td>分录ID</td>
<td>{{data.data.flid}}</td>
</tr>
<tr>
<td>来源部门</td>
<td>{{data.data.bmmc}}</td>
</tr>
<tr>
<td>去向部门</td>
<td>{{data.data.zzmc}}</td>
</tr>
<tr>
<td>仓库名称</td>
<td>{{data.data.ckmc}}</td>
@@ -58,6 +74,10 @@
<td>物料名称</td>
<td>{{data.data.wlmc}}</td>
</tr>
<tr>
<td>规格型号</td>
<td>{{data.data.ggxh}}</td>
</tr>
<tr>
<td>单位</td>
<td>{{data.data.jldw}}</td>
@@ -82,14 +102,15 @@
<td>库存</td>
<td>{{data.data.kcsl}}</td>
</tr>
<tr>
<td>操作日期</td>
<td>{{data.data.update_time}}</td>
</tr>
<tr>
<td>操作人</td>
<td>{{data.data.update_name}}</td>
</tr>
<tr>
<td>操作日期</td>
<td>{{data.data.update_time}}</td>
</tr>
<tr>
<td>备注</td>
<td>{{data.data.remark}}</td>
@@ -137,7 +158,7 @@
padding 30px 10px
transition: all .3s linear;
.modal
background-color rgba(0,0,0,0.1)
background-color rgba(0,0,0,0.4)
.font1
font-size: 16px;
color: #000;

View File

@@ -34,15 +34,11 @@
} else if (this.inner2) {
this.$emit('goIn')
} else {
uni.redirectTo({
url: '/pages/home/home'
})
uni.navigateBack()
}
},
backHome () {
uni.redirectTo({
url: '/pages/home/home'
})
uni.navigateBack()
}
}
}

View File

@@ -32,12 +32,16 @@
data() {
return {
intervalId: null,
interTime: this.$store.getters.setTime,
userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
menuList: []
};
},
created () {
onLoad() {
// setTimeout(() => {
// uni.showLoading({
// title: '加载中...'
// })
// }, 200)
this._getBillsCount()
},
beforeDestroy () {
@@ -60,16 +64,8 @@
wsMessage (res) {
console.log(res)
clearTimeout(this.intervalId)
let data = res.head
this.$store.dispatch('materObj', res.home.result)
if (data.code === '1') {
this.menuList = [...data.result]
} else {
uni.showToast({
title: data.desc,
icon: 'none'
})
}
// uni.hideLoading()
this.menuList = [...res]
},
wsErr () {
this.intervalId = setTimeout(() => {
@@ -79,15 +75,15 @@
toPage (e) {
let url = ''
url = '/pages/management/in-storage?id=' + e.djlx + '&name=' + e.name + '&type=' + e.ywlx
uni.redirectTo({
uni.navigateTo({
url: url
})
},
Quit () {
this.$store.dispatch('delUserInfo', '')
uni.redirectTo({
url: '/pages/login/login'
})
this.$store.dispatch('delUserInfo', '')
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}

View File

@@ -28,7 +28,6 @@
<script>
import {getBillsCount} from '@/utils/getData2.js'
import { sendWebsocket, closeWebsocket } from '@/utils/websocket.js'
export default {
data() {
return {
@@ -45,12 +44,10 @@
}, this.interTime)
},
beforeDestroy () {
// closeWebsocket(true)
clearInterval(this.intervalId)
this.intervalId = null
},
destroyed () {
// closeWebsocket(true)
clearInterval(this.intervalId)
this.intervalId = null
},
@@ -66,31 +63,6 @@
})
}
},
// _getBillsCount () {
// let getTimestamp = new Date().getTime()
// let url = this.$store.getters.baseUrl
// url = url.substring(7)
// sendWebsocket('ws://' + url + '/webSocket/SendHomeInfo/' + getTimestamp, {}, this.wsMessage, this.wsErr)
// },
// wsMessage (res) {
// console.log(res)
// clearTimeout(this.intervalId)
// let data = res.head
// this.$store.dispatch('materObj', res.home.result)
// if (data.code === '1') {
// this.menuList = [...data.result]
// } else {
// uni.showToast({
// title: data.desc,
// icon: 'none'
// })
// }
// },
// wsErr () {
// this.intervalId = setTimeout(() => {
// this._getBillsCount()
// }, 10000)
// },
toPage (e) {
let url = ''
url = '/pages/management/in-storage?id=' + e.djlx + '&name=' + e.name + '&type=' + e.ywlx

View File

@@ -43,12 +43,12 @@
<input type="text" placeholder="域名地址" v-model.trim="baseUrl" class="inputStyle">
</view>
</view>
<view class="zd-row mgb20">
<!-- <view class="zd-row mgb20">
<view class="zd-col-7 login_label">刷新时间(s)</view>
<view class="zd-col-17">
<input type="number" placeholder="刷新时间" v-model.trim="setTime" class="inputStyle">
</view>
</view>
</view> -->
</view>
<view class="zd-row mgt20 mgb20">
<button class="primary-button" :disabled="disabled" @tap="toConfig">&nbsp;&nbsp;</button>
@@ -215,6 +215,7 @@
width 50%
float left
.card_wrap
min-height 130px
overflow hidden
.login_label
_font(18px, 45px, #AFBED8,,)

View File

@@ -25,17 +25,17 @@
<view class="zd-row sticky zd-th-wraper">
<view class="zd-col-1 zd-th"><text>序号</text></view>
<view class="zd-col-1 zd-th"><text>选择</text></view>
<view class="zd-col-3 zd-th"><text>{{crType === 'IN'? '入库单号':'出库单号'}}</text></view>
<view class="zd-col-2 zd-th"><text>发起部门</text></view>
<view class="zd-col-3 zd-th"><text>去向</text></view>
<view class="zd-col-2 zd-th"><text>{{crType === 'IN'? '入库单号':'出库单号'}}</text></view>
<view class="zd-col-2 zd-th"><text>来源部门</text></view>
<view class="zd-col-2 zd-th"><text>去向部门</text></view>
<view class="zd-col-2 zd-th"><text>仓库名称</text></view>
<view class="zd-col-2 zd-th"><text>状态</text></view>
<view class="zd-col-2 zd-th nowrap"><text>制单日期</text></view>
<view class="zd-col-1 zd-th nowrap"><text>制单人</text></view>
<view class="zd-col-2 zd-th nowrap"><text>制单人</text></view>
<view class="zd-col-2 zd-th nowrap"><text>业务日期</text></view>
<view class="zd-col-2 zd-th nowrap"><text>操作日期</text></view>
<view class="zd-col-2 zd-th"><text>操作人</text></view>
<view class="zd-col-1 zd-th">更多</view>
<view class="zd-col-2 zd-th">更多</view>
</view>
<view class="zd-td-wraper" v-for="(e, i) in dataList1" :key="e.id">
<view class="zd-row" :class="{'zd-td-checked': pkId === e.id}">
@@ -43,17 +43,17 @@
<view class="zd-col-1 zd-td" @tap.stop="toCheck1(e)">
<view class="zd-checkbox" :class="{'zd-checkbox_active': e.checked}"></view>
</view>
<view class="zd-col-3 zd-td fontcol1" @tap.stop="toCollapse(e)"><text>{{e.djbh}}</text></view>
<view class="zd-col-2 zd-td fontcol1" @tap.stop="toCollapse(e)"><text>{{e.bmmc}}</text></view>
<view class="zd-col-3 zd-td" @tap.stop="toCollapse(e)"><text>{{e.zzmc}}</text></view>
<view class="zd-col-2 zd-td fontcol1" @tap.stop="toCollapse(e)"><text>{{e.djbh}}</text></view>
<view class="zd-col-2 zd-td" @tap.stop="toCollapse(e)"><text>{{e.bmmc}}</text></view>
<view class="zd-col-2 zd-td" @tap.stop="toCollapse(e)"><text>{{e.zzmc}}</text></view>
<view class="zd-col-2 zd-td" @tap.stop="toCollapse(e)"><text>{{e.ckmc}}</text></view>
<view class="zd-col-2 zd-td" @tap.stop="toCollapse(e)"><text class="fontbg1">{{e.djzt}}</text></view>
<view class="zd-col-2 zd-td nowrap" @tap.stop="toCollapse(e)"><text>{{e.cjsj}}</text></view>
<view class="zd-col-1 zd-td nowrap" @tap.stop="toCollapse(e)"><text>{{e.cjr}}</text></view>
<view class="zd-col-2 zd-td" @tap.stop="toCollapse(e)"><text>{{e.cjr}}</text></view>
<view class="zd-col-2 zd-td nowrap" @tap.stop="toCollapse(e)"><text>{{e.ywrq}}</text></view>
<view class="zd-col-2 zd-td nowrap" @tap.stop="toCollapse(e)"><text>{{e.update_time}}</text></view>
<view class="zd-col-2 zd-td" @tap.stop="toCollapse(e)"><text>{{e.update_name}}</text></view>
<view class="zd-col-1 zd-td" @tap.stop="getDetails(1,e)"><uni-icons type="more-filled" size="14" color="#fff"></uni-icons></view>
<view class="zd-col-2 zd-td" @tap.stop="getDetails(1,e)"><uni-icons type="more-filled" size="14" color="#fff"></uni-icons></view>
</view>
<!-- 二级表格start -->
<view v-show="pkId === e.djid" class="zd-sec-wraper">
@@ -69,8 +69,8 @@
<view class="zd-col-2 zd-sec-th"><text>{{crType === 'IN'? '已入数量':'已出数量'}}</text></view>
<view class="zd-col-2 zd-sec-th"><text>剩余数量</text></view>
<view class="zd-col-2 zd-sec-th"><text>库存</text></view>
<view class="zd-col-2 zd-th"><text>操作日期</text></view>
<view class="zd-col-2 zd-th"><text>操作人</text></view>
<view class="zd-col-2 zd-th"><text>操作日期</text></view>
<view class="zd-col-1 zd-th"><text>更多</text></view>
</view>
<view class="zd-row zd-td-wraper" v-for="(el, j) in dataList2" :key="el.id" @tap.stop="toCheck2(el)">
@@ -85,8 +85,8 @@
<view class="zd-col-2 zd-sec-td"><text>{{el.czsl}}</text></view>
<view class="zd-col-2 zd-sec-td"><text>{{el.sysl}}</text></view>
<view class="zd-col-2 zd-sec-td"><text>{{el.kcsl}}</text></view>
<view class="zd-col-2 zd-sec-td"><text>{{el.update_time}}</text></view>
<view class="zd-col-2 zd-sec-td"><text>{{el.update_name}}</text></view>
<view class="zd-col-2 zd-sec-td nowrap"><text>{{el.update_time}}</text></view>
<view class="zd-col-1 zd-sec-td"><uni-icons type="more-filled" size="14" color="#fff" @tap="getDetails(2,el)"></uni-icons></view>
</view>
<view class="zd-row mgt10">
@@ -344,7 +344,7 @@
if (this.checkArr2.length === 0) {
return
} else if (this.checkArr2.length === 1) {
if (Number(this.checkArr2[0].sl) > Number(this.checkArr2[0].kcsl)) {
if ((Number(this.checkArr2[0].sl) > Number(this.checkArr2[0].kcsl)) && this.crType === 'OUT') {
uni.showToast({
title: '库存不足',
icon: 'none'
@@ -361,7 +361,7 @@
flag = true
}
})
if (flag) {
if (flag && this.crType === 'OUT') {
uni.showToast({
title: '库存不足',
icon: 'none'

View File

@@ -11,7 +11,7 @@ export const handLogin = (user, password) => request({
// 版本更新测试
export const pdaUpdate = () => request({
url:'api/cacheLineHand/appUpdate'
url:'api/easOutInBill/appUpdate'
})
// 首页显示出入库单据数量