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, data,
header 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 = { const fetchMaterial = {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -82,11 +82,49 @@
<h5>{{ notice.createTime }}</h5> <h5>{{ notice.createTime }}</h5>
</view> </view>
</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> </view>
</template> </template>
<script> <script>
import { authPath, basePath, publicPath, systemPath } from '../../public';
export default { export default {
data() { data() {
return { return {
@ -106,7 +144,9 @@ import { authPath, basePath, publicPath, systemPath } from '../../public';
sydsh: '' sydsh: ''
}, },
isUsingList: [], isUsingList: [],
percent: '' percent: '',
unreadList: [],
unreadIndex: 0
} }
}, },
methods: { methods: {
@ -126,23 +166,46 @@ import { authPath, basePath, publicPath, systemPath } from '../../public';
url: `/pages/${path}/${path}` url: `/pages/${path}/${path}`
}) })
}, },
toast () { extractTextFromHTML(htmlString) {
uni.showToast({ return htmlString.replace(/<[^>]*>/g, '');
icon: 'none', },
title: '敬请期待!' 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() { onShow() {
console.log(uni.getStorageSync('token')); console.log(uni.getStorageSync('token'));
console.log(uni.getStorageSync('userInfo')); console.log(uni.getStorageSync('userInfo'));
let that = this let that = this
that.unreadIndex = 0
that.noticeList = [] that.noticeList = []
// //
that.$api.index.noticeCont().then(res => { that.$api.index.noticeCont().then(res => {
@ -209,6 +272,28 @@ import { authPath, basePath, publicPath, systemPath } from '../../public';
console.log(err); 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) { onNavigationBarButtonTap(e) {
console.log(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> </style>

View File

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

View File

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