7.16宁夏首页添加公告-部分页面添加上拉加载

This commit is contained in:
FrancisHu 2024-07-16 17:54:01 +08:00
parent e7ab390cfb
commit a999ac3192
10 changed files with 381 additions and 70 deletions

View File

@ -95,7 +95,23 @@ const index = {
data,
header
)
}
},
async fetchNotice (data = {} , header = {}){
return await Http.get(
HttpConfig.systemPath,
HttpConfig.serviceUrl.index.fetchNotice,
data,
header
)
},
async uploadNotice (data = {} , header = {}){
return await Http.post(
HttpConfig.systemPath,
HttpConfig.serviceUrl.index.uploadNotice,
data,
header
)
},
}
const fetchMaterial = {

View File

@ -3,8 +3,8 @@ class HttpConfig {
baseUrl = "/api"
// #endif
// #ifdef APP-PLUS
baseUrl = "http://112.29.103.165:21624"
// baseUrl = "http://192.168.0.14:21624"
// baseUrl = "http://112.29.103.165:21624"
baseUrl = "http://192.168.0.14:21624"
// baseUrl = "http://112.29.103.165:21626"
// baseUrl = "http://172.20.10.3:8080"
// baseUrl = "http://10.40.92.8:8080"
@ -41,6 +41,8 @@ class HttpConfig {
keyData: '/app/getCriticalData', // 获取关键数据
getUserInfo: '/user/getInfo', // 获取用户信息
fetchCompanyName: '/dept/getCompanyByAncestors', // 获取公司名称
fetchNotice: '/notice/getList', // 获取未读公告
uploadNotice: '/notice/addUserId', // 将公告置为已读
},
fetchMaterial: {
fetchMaterialList: '/type/selectMaTypeListByLevelIndex', // 获取设备列表
@ -163,7 +165,7 @@ class HttpConfig {
infoByCode: '/machine/getMachineByQrCode', // 首页根据二维码查询设备信息
},
preCrashExam: {
fetchPreCrashList: '/scrap/getScrapApplyListApp', //获取预报废审核列表
fetchPreCrashList: '/scrap/getScrapApplyList', //获取预报废审核列表
fetchPreCrashDetail: '/scrap/getScrapAuditListApp', //获取预报废审核列表详情
submitPreExam: '/scrap/forecastWasteAudit', //提交审核
},

View File

@ -2,8 +2,8 @@
"name" : "智慧仓储",
"appid" : "__UNI__9D122E1",
"description" : "",
"versionName" : "1.1.4",
"versionCode" : 114,
"versionName" : "1.1.5",
"versionCode" : 115,
"transformPx" : false,
/* 5+App */
"app-plus" : {

View File

@ -291,7 +291,7 @@
"titleNView": {
"buttons": [
{
"text": "结束任务",
"text": "完成退料",
"fontSize": "12px",
"color": "#4e6ef2",
"width": "auto"

View File

@ -97,6 +97,9 @@ import { basePath } from '../../public'
export default {
data() {
return {
pageNum: 1,
pageSize: 10,
pageTotal: 0,
allChecked: false,
fetchMaterialList: [
@ -241,8 +244,11 @@ import { basePath } from '../../public'
// 退
that.$api.backMaterialReceive.backMaterialReceiveList({
companyId: uni.getStorageSync('userInfo').sysUser.companyId,
flag: 0,
keyWord
flag: 1,
keyWord,
backSource: 2,
pageNum: that.pageNum,
pageSize: that.pageSize
}).then(res => {
console.log(res);
if (res.data.code == 200) {
@ -252,7 +258,8 @@ import { basePath } from '../../public'
title: '未查询到相关数据!'
})
} else {
that.fetchMaterialList = res.data.data
that.pageTotal = res.data.data.total
that.fetchMaterialList = [...that.fetchMaterialList, ...res.data.data.rows]
console.log("fetchMaterialList",that.fetchMaterialList)
}
} else {
@ -271,6 +278,11 @@ import { basePath } from '../../public'
},
onShow() {
this.getList('')
},
onReachBottom() {
if (this.fetchMaterialList.length >= this.pageTotal) return;
this.pageNum++
this.getList(this.exitIpt)
}
}
</script>

View File

@ -1,17 +1,44 @@
<template>
<view>
<view class="single-fetch" v-for="(fetch, index) in fetchList" :key="index" @click="openPopup(fetch)">
<view
class="single-fetch"
v-for="(fetch, index) in fetchList"
:key="index"
>
<view>
<span>类型名称</span>
<h4>{{ fetch.typeName }}</h4>
<checkbox-group
@change="checkClick(fetch)"
style="margin-right: 15rpx;"
>
<checkbox :checked="fetch.checked" />
</checkbox-group>
</view>
<view>
<span>规格型号</span>
<h4>{{ fetch.typeCode }}</h4>
<view class="info-cont">
<view>
<span>类型名称</span>
<h4>{{ fetch.typeName }}</h4>
</view>
<view>
<span>规格型号</span>
<h4>{{ fetch.typeCode }}</h4>
</view>
<view>
<span>待退料数量</span>
<h4>{{ fetch.num }}</h4>
</view>
<h5
@click="openPopup(fetch)"
>
点击退料
</h5>
</view>
<view>
<span>待退料数量</span>
<h4>{{ fetch.num }}</h4>
</view>
<view class="btm-sticky">
<view class="checked">
<checkbox-group @tap="checkAll" style="margin-right: 15rpx;">
<checkbox :checked="allChecked" />
</checkbox-group>
<text>全选</text>
</view>
</view>
<uni-popup ref="popup1" type="center" :mask-click="false">
@ -84,6 +111,7 @@
export default {
data() {
return {
allChecked: false,
fetchList: [
],
@ -175,6 +203,37 @@
closePopup2() {
this.$refs.popup2.close()
},
checkClick(item) {
item.checked = !item.checked
if (!item.checked) {
this.allChecked = false
} else {
const goods = this.fetchList.every(item => {
return item.checked === true
})
if (goods) {
this.allChecked = true
} else {
this.allChecked = false
}
}
},
checkAll() {
this.allChecked = !this.allChecked
if (this.allChecked) {
this.fetchList.map(item => {
if (item.checked == false) {
item.checked = true
}
})
} else {
this.fetchList.map(item => {
if (item.checked == true) {
item.checked = false
}
})
}
},
scanCode() {
const that = this
that.closePopup1()
@ -271,6 +330,9 @@
}).then(res => {
console.log(res);
if (res.data.code == 200) {
res.data.data.forEach(item => {
item.checked = false
})
/* for (let i = 0; i < res.data.data.length; i++) {
res.data.data[i].num = res.data.data[i].num.split('.')[0]
} */
@ -344,9 +406,8 @@
this.initListData()
},
onNavigationBarButtonTap(ev) {
console.log("点击了自定义按钮", ev);
const that = this
if (ev.text == '结束任务') {
let that = this
/* if (ev.text == '') {
if(this.taskStatus=="40"){
uni.showToast({
icon: 'none',
@ -355,37 +416,68 @@
return
}
that.backReceiveEndBackFn()
} */
let submitList = that.fetchList.filter(item => item.checked == true)
if (submitList.length != 0) {
console.log(submitList);
} else {
uni.showToast({
icon: 'none',
title: '未选中完成退料项!'
})
}
}
}
</script>
<style lang="scss">
body{
background-color: #FAFDFF;
box-sizing: border-box;
padding-bottom: 10vh;
}
.single-fetch {
width: 100%;
box-sizing: border-box;
padding: 20rpx 35rpx;
padding: 30rpx;
border-bottom: 1px solid #DDDDDD;
view {
display: flex;
align-items: center;
margin-bottom: 25rpx;
span {
color: #A7A7A7;
padding-right: 20rpx;
display: flex;
align-items: center;
.info-cont{
view {
display: flex;
align-items: center;
margin-bottom: 25rpx;
span {
color: #A7A7A7;
padding-right: 20rpx;
}
h4 {
font-size: 14px;
font-weight: normal;
}
}
h4 {
view:last-child {
margin-bottom: 0;
}
h5{
width: 150rpx;
font-size: 14px;
font-weight: normal;
box-sizing: border-box;
padding: 10rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #3788FF;
color: #fff;
border-radius: 15rpx;
}
}
view:last-child {
margin-bottom: 0;
}
}
.btm-exam {
@ -408,6 +500,23 @@
color: #fff;
}
}
.btm-sticky{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
box-sizing: border-box;
padding: 15rpx 30rpx;
background-color: #fff;
display: flex;
justify-content: left;
align-items: center;
.checked{
display: flex;
align-items: center;
}
}
.popup1 {
width: 80vw;

View File

@ -232,6 +232,11 @@ import { basePath } from '../../public'
export default {
data() {
return {
pageOpt: {
pageNum: 1,
pageSize: 10
},
pageTotal: 0,
showLoading: false,
showSubLoading: false,
allChecked: false,
@ -660,9 +665,7 @@ import { basePath } from '../../public'
initFetch () {
let that = this
that.showLoading = true
that.$api.fetchExam.fetchTrueExamList({
souceBy: 1
}).then(res => {
that.$api.fetchExam.fetchTrueExamList(that.pageOpt).then(res => {
console.log(res);
if (res.data.code == 200) {
if (res.data.data.length == 0) {
@ -672,7 +675,8 @@ import { basePath } from '../../public'
title: '未查询到相关数据!'
})
} else {
that.fetchMaterialList = res.data.data
that.pageTotal = res.data.data.total
that.fetchMaterialList = [...that.fetchMaterialList, ...res.data.data.rows]
that.showLoading = false
console.log(that.fetchMaterialList);
}
@ -734,6 +738,11 @@ import { basePath } from '../../public'
console.log(that.roles);
that.initFetch()
// that.getRoles()
},
onReachBottom() {
if (this.fetchMaterialList.length >= this.pageTotal) return
this.pageOpt.pageNum++
this.initFetch()
}
}
</script>

View File

@ -82,11 +82,49 @@
<h5>{{ notice.createTime }}</h5>
</view>
</view>
<uni-popup
ref="popup"
type="center"
:mask-click="false"
>
<view class="popup">
<view class="pop-top">
<h4>公告({{ unreadIndex + 1 }}/{{ unreadList.length }})</h4>
<uni-icons
style="color: #AAAAAA; font-weight: bold;"
type="closeempty"
@click="closePopup"
>
</uni-icons>
</view>
<view
class="unread-notice"
v-for="(list, index) in unreadList"
:key="index"
v-show="index == unreadIndex"
>
<view class="tit">
{{ list.noticeTitle }}
</view>
<view class="info">
<view>发布人{{ list.createBy }}</view>
<view>发布时间{{ list.createTime }}</view>
<view>公告内容{{ list.noticeContent }}</view>
</view>
<view
class="read-one"
v-show="unreadIndex < unreadList.length - 1"
@click="readOneNotice(list.noticeId)"
>
我知道了
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { authPath, basePath, publicPath, systemPath } from '../../public';
export default {
data() {
return {
@ -106,7 +144,9 @@ import { authPath, basePath, publicPath, systemPath } from '../../public';
sydsh: ''
},
isUsingList: [],
percent: ''
percent: '',
unreadList: [],
unreadIndex: 0
}
},
methods: {
@ -126,23 +166,46 @@ import { authPath, basePath, publicPath, systemPath } from '../../public';
url: `/pages/${path}/${path}`
})
},
toast () {
uni.showToast({
icon: 'none',
title: '敬请期待!'
extractTextFromHTML(htmlString) {
return htmlString.replace(/<[^>]*>/g, '');
},
openPopup () {
this.$refs.popup.open()
},
closePopup () {
let that = this
let noticeArr = []
that.unreadList.forEach(item => {
noticeArr.push(item.noticeId)
})
console.log(noticeArr);
that.uploadUnNotice(noticeArr)
that.$refs.popup.close()
},
readOneNotice (noticeId) {
let that = this
let noticeArr = []
noticeArr.push(noticeId)
that.uploadUnNotice(noticeArr)
that.unreadIndex++
},
uploadUnNotice (arr) {
let that = this
that.$api.index.uploadNotice({
noticeId: arr,
userId: uni.getStorageSync('userInfo').userid
}).then(res => {
console.log(res);
}).catch(err => {
console.log(err);
})
}
},
onReady() {
},
onLoad() {
},
onShow() {
console.log(uni.getStorageSync('token'));
console.log(uni.getStorageSync('userInfo'));
let that = this
that.unreadIndex = 0
that.noticeList = []
//
that.$api.index.noticeCont().then(res => {
@ -209,6 +272,28 @@ import { authPath, basePath, publicPath, systemPath } from '../../public';
console.log(err);
})
}
//
that.$api.index.fetchNotice().then(res => {
if (res.data.code == 200) {
if (res.data.data.length != 0) {
res.data.data.forEach(item => {
item.noticeContent = that.extractTextFromHTML(item.noticeContent)
})
that.unreadList = res.data.data
console.log(that.unreadList);
that.openPopup()
} else {
console.log('无未读公告');
}
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
},
onNavigationBarButtonTap(e) {
console.log(e);
@ -407,4 +492,54 @@ import { authPath, basePath, publicPath, systemPath } from '../../public';
}
}
}
.popup{
width: 80vw;
height: 90vh;
background-color: #fff;
border-radius: 15rpx;
overflow-y: auto;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
.pop-top{
width: 100%;
height: 5vh;
box-sizing: border-box;
padding: 0 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.unread-notice{
width: 85%;
margin: 40rpx auto;
display: flex;
flex-direction: column;
align-items: center;
.tit{
font-size: 20px;
font-weight: bold;
margin-bottom: 20rpx;
}
.info{
width: 100%;
view{
margin-bottom: 15rpx;
}
view:last-child{
margin-bottom: 0;
}
}
.read-one{
width: 40%;
margin: 40rpx auto;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
border-radius: 15rpx;
padding: 10rpx 0;
background-color: #3788FF;
color: #fff;
}
}
}
</style>

View File

@ -134,6 +134,11 @@
export default {
data() {
return {
pageOpt: {
pageNum: 1,
pageSize: 10
},
pageTotal: 0,
allChecked: false,
examFormData: {
ifPass: '',
@ -222,24 +227,34 @@
console.log(formData);
that.$refs.popup.close()
})
},
getNewList () {
let that = this
//
that.$api.newInStore.fetchNewInStoreList(that.pageOpt).then(res => {
console.log(res);
if (res.data.code == 200) {
that.pageTotal = res.data.total
that.fetchMaterialList = [...that.fetchMaterialList, ...res.data.rows]
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
}
},
onShow() {
let that = this
//
that.$api.newInStore.fetchNewInStoreList().then(res => {
console.log(res);
if (res.data.code == 200) {
that.fetchMaterialList = res.data.rows
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
that.getNewList()
},
onReachBottom() {
if (this.fetchMaterialList.length >= this.pageTotal) return;
this.pageOpt.pageNum++
this.getNewList()
}
}
</script>

View File

@ -138,6 +138,9 @@
export default {
data() {
return {
pageNum: 1,
pageSize: 10,
pageTotal: 0,
preCrashList: [],
preIpt: '',
roles: uni.getStorageSync('roles'),
@ -152,11 +155,14 @@
fetchPreCrashList (keyword) {
let that = this
that.$api.preCrashExam.fetchPreCrashList({
keyword
keyword,
pageNum: that.pageNum,
pageSize: that.pageSize
}).then(res => {
console.log(res);
if (res.data.code == 200) {
that.preCrashList = res.data.data
that.pageTotal = res.data.total
that.preCrashList = [...that.preCrashList, ...res.data.rows]
}
}).catch(err => {
console.log(err);
@ -177,6 +183,8 @@
},
onShow() {
let that = this
that.pageNum = 1
that.preCrashList = []
that.fetchPreCrashList('')
console.log(uni.getStorageSync('roles'));
for (let role of that.roles) {
@ -186,6 +194,11 @@
}
}
console.log(that.ifRole);
},
onReachBottom() {
if (this.preCrashList.length >= this.pageTotal) return;
this.pageNum++
this.fetchPreCrashList(this.preIpt)
}
}
</script>