修改显示字段,增加信息弹窗,保存账号,增加websocket定时刷新,增加校验功能

This commit is contained in:
2024-04-29 16:46:44 +08:00
parent 3bbea6fcae
commit 243ef444c7
11 changed files with 567 additions and 83 deletions

View File

@@ -27,38 +27,30 @@
</template>
<script>
// import {getBillsCount} from '@/utils/getData2.js'
import { sendWebsocket, closeWebsocket } from '@/utils/websocket.js'
export default {
data() {
return {
intervalId: null,
interTime: this.$store.getters.setTime,
userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
menuList: []
};
},
onLoad () {
created () {
this._getBillsCount()
// this.intervalId = setInterval(this._getBillsCount, this.$store.getters.setTime)
},
onUnload () {
beforeDestroy () {
closeWebsocket(true)
if (this.intervalId) {
clearInterval(this.intervalId)
}
clearTimeout(this.intervalId)
this.intervalId = null
},
destroyed () {
closeWebsocket(true)
clearTimeout(this.intervalId)
this.intervalId = null
},
methods: {
// async _getBillsCount () {
// let res = await getBillsCount()
// if (res.code === 1) {
// this.menuList = [...res.result]
// } else {
// uni.showToast({
// title: res.desc,
// icon: 'none'
// })
// }
// },
_getBillsCount () {
let getTimestamp = new Date().getTime()
let url = this.$store.getters.baseUrl
@@ -67,17 +59,17 @@
},
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'
// })
// }
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(() => {

View File

@@ -0,0 +1,218 @@
<template>
<view class="home_content">
<view class="zd-row header">
<view class="zd-col-8 home_title">首页</view>
<view class="zd-col-8 zd-row jcflexend home_userinfo">
<view class="user_icon"></view>
<view class="user_name">{{userName}}</view>
<view class="exit_text" @tap="Quit">退出</view>
</view>
</view>
<view class="welcome_text_wraper">
<view class="welcome_text">{{userName}}, 欢迎进入诺力三期平板系统</view>
</view>
<view class="zd_wrapper">
<view class="zd-row menu-wrap">
<view class="menu-item" v-for="(e, i) in menuList" :key="i" @tap="toPage(e)">
<view class="menu_name_bg" :class="'bg_texture_' + i">
<view class="menu-name">{{e.name}}</view>
<view v-show="Number(e.counts) > 0" class="bill_count">{{e.counts}}</view>
</view>
</view>
</view>
</view>
<view class="left_bg"></view>
<view class="left_bg right_bg"></view>
</view>
</template>
<script>
import {getBillsCount} from '@/utils/getData2.js'
import { sendWebsocket, closeWebsocket } from '@/utils/websocket.js'
export default {
data() {
return {
intervalId: null,
interTime: this.$store.getters.setTime,
userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
menuList: []
};
},
created () {
this._getBillsCount()
this.intervalId = setInterval(() => {
this._getBillsCount()
}, this.interTime)
},
beforeDestroy () {
// closeWebsocket(true)
clearInterval(this.intervalId)
this.intervalId = null
},
destroyed () {
// closeWebsocket(true)
clearInterval(this.intervalId)
this.intervalId = null
},
methods: {
async _getBillsCount () {
let res = await getBillsCount()
if (res.code === 1) {
this.menuList = [...res.result]
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
},
// _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
uni.redirectTo({
url: url
})
},
Quit () {
this.$store.dispatch('delUserInfo', '')
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.home_content
position relative
_wh(100%, 100%)
_bis(,'../../static/images/home_bg.jpg', 100%, 100%,bottom)
.header
height 60px
padding 0 15px
align-items flex-start
justify-content flex-end
_bis(,'../../static/images/header_bg.png', 100%, 100%,bottom)
.home_title
_font(25px,35px,#F6F9FE,,center)
font-family: YouSheBiaoTiHei;
.home_userinfo
height 35px
.user_icon
_wh(25px, 25px)
margin-right 5px
_bis(,'../../static/images/user_icon.png', 100%, 100%,center)
.user_name
_font(17px,17px,#fff,,center)
padding-right 5px
margin 9px 10px 9px 0
border-right 1px solid #AECAF5
.exit_text
height 30px
_font(14px,30px,#fff,,center)
padding 0 10px
margin 2.5px 0
_bis(,'../../static/images/state-item_bg.png', 100%, 100%,center)
.welcome_text_wraper
height 70px
margin 0 50px
.welcome_text
_font(26px, 70px, #F6F9FE,,)
padding-left 20px
font-family: YouSheBiaoTiHei
background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(49,190,255,0.9) 0%, rgba(239,252,254,1) 40%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
.zd_wrapper
_wh(calc(100% - 100px),calc(100% - 180px)) /** 120rpx + 200rpx + 130rpx */
margin 20px 50px 0 50px
_bis(,'../../static/images/bg-task-r2.png', 100%, 100%,center)
.menu-wrap
flex-wrap wrap
justify-content flex-start
align-content center
height 100%
.menu-item
width 20%
margin 20px 0
.menu_name_bg
position relative
_wh(100px, 100px)
margin 0 auto
border-radius 20px
background-image: radial-gradient( ellipse farthest-corner at 11px 11px , #afafb9, #afafb9 50%, #ffffff 50%);
background-size: 11px 11px;
.bg_texture_1, .bg_texture_7
background: repeating-linear-gradient( -45deg, #afafb9, #afafb9 5px, #ffffff 5px, #ffffff 8px );
.menu-name
background-color rgba(49, 95, 255, 0.8)
.bg_texture_3, .bg_texture_6
background-image: repeating-linear-gradient(45deg, #afafb9 25%, transparent 25%, transparent 75%, #afafb9 75%, #afafb9), repeating-linear-gradient(45deg, #afafb9 25%, #ffffff 25%, #ffffff 75%, #afafb9 75%, #afafb9);
background-position: 0 0, 11px 11px;
background-size: 22px 22px;
.menu-name
background-color rgba(0, 239, 48, 0.8)
.bg_texture_2, .bg_texture_5
background: radial-gradient(circle, transparent 20%, #ffffff 20%, #ffffff 80%, transparent 80%, transparent), radial-gradient(circle, transparent 20%, #ffffff 20%, #ffffff 80%, transparent 80%, transparent) 13.5px 13.5px, linear-gradient(#afafb9 2px, transparent 2px) 0 -2px, linear-gradient(90deg, #afafb9 2px, #ffffff 2px) -2px 0;
background-size: 27.5px 27.5px, 27.5px 27.5px, 13.75px 13.75px, 13.75px 13.75px;
.menu-name
background-color rgba(255, 189, 45, 0.8)
.bg_texture_4
.menu-name
background-color rgba(255, 139, 69, 0.8)
.menu-name
display flex
justify-content center
align-items center
_wh(100px, 100px)
padding 10px
border-radius 20px
_font(20px, 25px, #fff,bold,center)
background-color rgba(0,166,255,0.8)
.bill_count
position absolute
top -10px
right -10px
_wh(30px, 30px)
background-color $red
border-radius 50%
_font(20px, 30px, #fff,bold,center)
box-shadow 3px 3px 1px 1px rgba(0,0,0,.3)
.left_bg
position absolute
left 0
top 0
_wh(25px, 100%)
_bis(,'../../static/images/hud_left.png', 100%, ,center)
.right_bg
left auto
right 0
background-image url('../../static/images/hud_right.png')
</style>

View File

@@ -44,8 +44,8 @@
</view>
</view>
<view class="zd-row mgb20">
<view class="zd-col-6 login_label">刷新时间</view>
<view class="zd-col-18">
<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 File

@@ -3,13 +3,17 @@
<nav-bar :title="crType === 'IN' ? '入库' : '出库'"></nav-bar>
<view class="search-confirm-wrap">
<view class="zd-row">
<view class="zd-col-11 zd-row">
<search-box
v-model="val1"
/>
<view class="zd-col-18 zd-row">
<view class="zd-col-10"><search-box v-model="val1" /></view>
<view class="zd-col-10 select_wraper">
<uni-data-select
v-model="value"
:localdata="range"
></uni-data-select>
</view>
<button class="confirm-button" @tap="toSearch">查询</button>
</view>
<view class="zd-col-11 zd-row jcflexend">
<view class="zd-col-6 zd-row jcflexend">
<!-- <button class="confirm-button" :class="{'confirm-button_disabled': checkArr1.length === 0 || btnActive1}" :disabled="disabled1" @tap="toSure">单据审核</button> -->
<button class="confirm-button" :class="{'confirm-button_disabled': checkArr1.length === 0}" :disabled="disabled1" @tap="toSure">单据审核</button>
</view>
@@ -24,13 +28,14 @@
<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>状态</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"><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"><text>操作人</text></view>
<view class="zd-col-1 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}">
@@ -39,15 +44,16 @@
<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.fqmc}}</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" @tap.stop="toCollapse(e)"><text class="fontbg1">{{e.djzt}}</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>{{e.cjsj.substring(0, 10)}}</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" @tap.stop="toCollapse(e)"><text>{{e.ywrq.substring(0, 10)}}</text></view>
<view class="zd-col-2 zd-td" @tap.stop="toCollapse(e)"><text>{{e.update_time}}</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 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>
<!-- 二级表格start -->
<view v-show="pkId === e.djid" class="zd-sec-wraper">
@@ -56,7 +62,7 @@
<view class="zd-col-1 zd-sec-th"><text>选择</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-3 zd-sec-th"><text>物料名称</text></view>
<view class="zd-col-2 zd-sec-th"><text>物料名称</text></view>
<view class="zd-col-1 zd-sec-th"><text>单位</text></view>
<view class="zd-col-2 zd-sec-th"><text>库位</text></view>
<view class="zd-col-2 zd-sec-th"><text>数量</text></view>
@@ -65,13 +71,14 @@
<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-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)">
<view class="zd-col-1 zd-sec-td"><text>{{j+1}}</text></view>
<view class="zd-col-1 zd-sec-td"><view class="zd-checkbox" :class="{'zd-checkbox_active': el.checked}"></view></view>
<view class="zd-col-2 zd-sec-td"><text>{{el.ckmc}}</text></view>
<view class="zd-col-2 zd-sec-td"><text>{{el.wlbm}}</text></view>
<view class="zd-col-3 zd-sec-td"><text>{{el.wlmc}}</text></view>
<view class="zd-col-2 zd-sec-td"><text>{{el.wlmc}}</text></view>
<view class="zd-col-1 zd-sec-td nowrap"><text>{{el.jldw}}</text></view>
<view class="zd-col-2 zd-sec-td"><text>{{el.kwbm}}</text></view>
<view class="zd-col-2 zd-sec-td"><text>{{el.sl}}</text></view>
@@ -80,10 +87,11 @@
<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-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">
<view class="zd-col-12 zd-row jcflexstart">
<button class="confirm-button" :class="{'confirm-button_disabled': checkArr2.length === 0}" @tap="kuwConfirm">库位修改</button>
<button class="confirm-button" :class="{'confirm-button_disabled': checkArr2.length === 0}" @tap="kuwConfirm">{{crType === 'IN' ? '入库' : '出库'}}</button>
</view>
<view class="zd-col-12 zd-row jcflexend">
<pagination :total="totalCount2" :page-size="queryParams2.pageSize" :current-page="currentPage2" @page-change="handlePageChange2" />
@@ -95,22 +103,23 @@
</view>
<pagination v-show="dataList1.length > 0" :total="totalCount1" :page-size="queryParams1.pageSize" :current-page="currentPage1" @page-change="handlePageChange1" />
</view>
<view class="footer"></view>
<grid-detail :show="delShow" :data="detailObj" :crType="crType" @closeDetail="delShow=false"></grid-detail>
<view class="pop-wraper" :class="{'popshow': show, 'pophide': !show}">
<view class="allwidth pop-title">{{type === '1' ?'库位修改' : '库位确认'}}</view>
<view class="allwidth pop-title">{{crType === 'IN' ? '库' : '库'}}</view>
<view v-if="type === '1'" class="pop-grid-wraper">
<view class="zd-row sticky zd-sec-th-wraper zd-pop-th-wraper">
<view class="zd-col-2 zd-sec-th"><text>序号</text></view>
<view class="zd-col-4 zd-sec-th"><text>物料编号</text></view>
<view class="zd-col-5 zd-sec-th"><text>物料名称</text></view>
<view class="zd-col-4 zd-sec-th"><text>推荐库位</text></view>
<view class="zd-col-5 zd-sec-th"><text>实际库位</text></view>
<view class="zd-col-5 zd-sec-th"><text>选择库位</text></view>
<view class="zd-col-4 zd-sec-th"><text>数量</text></view>
<view class="zd-col-4 zd-sec-th"><text>库存数量</text></view>
</view>
<view class="zd-row zd-td-wraper" v-for="(ele, t) in dataList3" :key="ele.id">
<view class="zd-col-2 zd-sec-td zd-pop-td"><text>{{t+1}}</text></view>
<view class="zd-col-4 zd-sec-td zd-pop-td"><text>{{ele.wlbm}}</text></view>
<view class="zd-col-5 zd-sec-td zd-pop-td"><text>{{ele.wlmc}}</text></view>
<view class="zd-col-4 zd-sec-td zd-pop-td"><text>{{ele.tjkw}}</text></view>
<view class="zd-col-5 zd-sec-td zd-pop-td">
<scan-input
v-model="ele.kwbm"
@@ -120,6 +129,7 @@
<input v-show="!ele.checked" type="number" class="pop-input" v-model="ele.sysl" @blur="handleBlur(ele)">
<text v-show="ele.checked">{{ele.sysl}}</text>
</view>
<view class="zd-col-4 zd-sec-td zd-pop-td"><text>{{ele.kcsl}}</text></view>
</view>
</view>
<view v-else class="zd-row jcenter kwcode_wraper">
@@ -150,13 +160,15 @@
import SearchBox from '@/components/SearchBox.vue'
import ScanInput from '@/components/ScanInput.vue'
import Pagination from '@/components/Pagination.vue'
import GridDetail from '@/components/GridDetail.vue'
import {easOutInBillPage, easOutInBillDetailPage, easOutInBillUpdate, easOutInBillDetailUpdate, queryInventoryInfo} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox,
ScanInput,
Pagination
Pagination,
GridDetail
},
data() {
return {
@@ -189,7 +201,11 @@
show: false,
type: '',
kwCode: '',
checkArr3: []
checkArr3: [],
delShow: false,
detailObj: {},
value: '',
range:[{value: 1, text: '提交'}, {value: 2, text: '审核'}]
};
},
onShow() {
@@ -220,7 +236,7 @@
this._easOutInBillPage()
},
async _easOutInBillPage () {
let res = await easOutInBillPage(this.val1, this.id, this.queryParams1.pageNum + '', this.queryParams1.pageSize + '')
let res = await easOutInBillPage(this.val1, this.id, this.value, this.queryParams1.pageNum + '', this.queryParams1.pageSize + '')
if (res.code === 1) {
this.checkArr1 = []
res.result.map(el => {
@@ -328,12 +344,34 @@
if (this.checkArr2.length === 0) {
return
} else if (this.checkArr2.length === 1) {
this.type = '1'
this._queryInventoryInfo()
} else {
this.type = '2'
this.show = true
this.kwCode = ''
if (Number(this.checkArr2[0].sl) > Number(this.checkArr2[0].kcsl)) {
uni.showToast({
title: '库存不足',
icon: 'none'
})
return
} else {
this.type = '1'
this._queryInventoryInfo()
}
} else if (this.checkArr2.length >= 2) {
let flag = false
this.checkArr2.map(el => {
if (Number(el.sl) > Number(el.kcsl)) {
flag = true
}
})
if (flag) {
uni.showToast({
title: '库存不足',
icon: 'none'
})
return
} else {
this.type = '2'
this.show = true
this.kwCode = ''
}
}
},
async _queryInventoryInfo () {
@@ -423,6 +461,10 @@
} catch (e) {
this.disabled2 = false
}
},
getDetails (type,e) {
this.delShow = !this.delShow
this.detailObj = {type: type, data:e}
}
}
}
@@ -430,4 +472,25 @@
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.select_wraper
/deep/ .uni-select__selector
z-index 11
/deep/ .uni-select
height: 30px;
padding: 0 2px 0 12px;
border: 1px solid #4980bd;
background-color: rgba(45,88,184,0.1);
border-radius: 6px;
/deep/ .uni-select__input-placeholder, /deep/ .uni-select__input-text
font-size 13px
color #fff
/deep/ .uni-select__selector
background-color #071F3E
border-color #0c3162
/deep/ .uni-popper__arrow
border-bottom-color #0c3162
&:after
border-bottom-color #071F3E
/deep/ .uni-select__selector-item
color #fff
</style>