<template>
|
<view class="content">
|
<view class="header">
|
<view class="switch-button">
|
<uni-icons type="loop" @click="switchIconsModeHandler"></uni-icons>
|
</view>
|
</view>
|
<view class="mains">
|
<view v-if="!canEdit" :hidden="item.hidden||!item.id" class="box" v-for="(item,index) in itemData"
|
:key="index" @tap="toUrl(item)">
|
<template v-if="item.corner">
|
<uni-badge :text="item.cornerCount" type="error" :max-num="99" size="normal"
|
absolute="rightTop"
|
:offset="[7, 7]">
|
<image :src="item.img" mode=""></image>
|
</uni-badge>
|
</template>
|
<template v-else>
|
<image :src="item.img" mode=""></image>
|
</template>
|
<view class="texts">
|
{{item.text}}
|
</view>
|
</view>
|
<view :enable-hidden="item.hidden" :hidden="!item.id" v-if="canEdit" class="box edit"
|
v-for="(item,index) in itemData" :key="index" @tap="switchHidden(index)">
|
<uni-icons class="edit-mark" color="red" type="closeempty"></uni-icons>
|
<image :src="item.img" mode=""></image>
|
<view class="texts">
|
{{item.text}}
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
CommonUtils
|
} from '../../utils/common'
|
import {
|
setMenuList,
|
getMenuList
|
} from '../../utils/menuListApp'
|
import {
|
getUserInfo
|
} from '../../utils/auth'
|
export default {
|
data() {
|
return {
|
bindingData: {
|
UnReadCount: 0,
|
},
|
initFinished: false,
|
updateCount: 0,
|
menuListName: 'tab1',
|
canEdit: false,
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
itemData: [{
|
img: '../../static/icon/icon9.png',
|
text: '工序进站接收单新增',
|
tip: '立即新增',
|
url: '/pages/gongxuIn/Cj_StationInBill',
|
id: 1,
|
hidden: false,
|
},
|
|
{
|
img: '../../static/icon/icon10.png',
|
text: '工序出站汇报单新增',
|
tip: '立即新增',
|
url: '/pages/gongxuOut/Cj_StationOutBill',
|
id: 2,
|
hidden: false,
|
},
|
|
{
|
img: '../../static/icon/icon11.png',
|
text: '工序委外发出单新增',
|
tip: '立即新增',
|
url: '/pages/weiwaigxIn/Cj_StationEntrustInBill',
|
id: 3,
|
hidden: false,
|
},
|
|
{
|
img: '../../static/icon/icon12.png',
|
text: '工序委外接收单新增',
|
tip: '立即新增',
|
url: '/pages/weiwaigxOut/Cj_StationEntrustOutBill',
|
id: 4,
|
hidden: false,
|
},
|
|
{
|
img: '../../static/icon/icon14.png',
|
text: '我的报工平台',
|
tip: '点击进入',
|
url: '/pages/baogong/IpadIndex',
|
id: 5,
|
hidden: false,
|
},
|
{
|
img: '../../static/icon/icon10.png',
|
text: '我的任务',
|
tip: '立即新增',
|
url: '/pages/gongxuOutSendWork/gongxuOutSendWorkBill',
|
id: 6,
|
hidden: false,
|
},
|
{
|
img: '../../static/icon/icon12.png',
|
text: '员工签到记录单',
|
tip: '立即新增',
|
url: '/pages/EmployeeRecords/EmployeeRecordsBill',
|
id: 7,
|
hidden: false,
|
},
|
{
|
"img": "../../static/icon/icon15.png",
|
"text": "工作联系单查询",
|
"url": "/pages/ZLGL/OA_WorkLink/OA_WorkLinkBillQuery?OperationType=1",
|
"id": 8,
|
"hidden": false,
|
},
|
{
|
"img": "../../static/icon/icon16.png",
|
"text": "异常反馈待处理列表",
|
"url": "/pages/ZLGL/AanDengHujiao/OA_MyErrMsgBanck/OA_ErrMsgBackMyList",
|
"id": 9,
|
"hidden": false
|
},
|
{
|
"img": "../../static/icon/icon8.png",
|
"text": "设备故障登记单",
|
"url": "/pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBill?operationType=1",
|
"id": 10,
|
"hidden": false
|
},
|
{
|
"img": "../../static/icon/icon13.png",
|
"text": "模具故障登记单",
|
"url": "/pages/MJGL/Sc_MouldConkBookBill/Sc_MouldConkBookBill?operationType=1",
|
"id": 11,
|
"hidden": false
|
},
|
{
|
img: '../../static/icon/icon8.png',
|
text: '上模单',
|
url: `/pages/MJGL/shangmudan/MouldUpperBill`,
|
id: 12,
|
hidden: false,
|
},
|
{
|
img: '../../static/icon/icon8.png',
|
text: '下模单',
|
url: `/pages/MJGL/xiamodan/MouldLowerBill`,
|
id: 13,
|
hidden: false,
|
},
|
{
|
"img": "../../static/icon/icon15.png",
|
"text": "取样单",
|
"url": "/pages/ZLGL/QuYangHuangYang/QC_TakeSampleCheckBill/QC_TakeSampleCheckBill?operationType=0",
|
"id": 14,
|
"hidden": false
|
},
|
{
|
"img": "../../static/icon/icon8.png",
|
"text": "设备点检记录单",
|
"url": "/pages/MJGL/Sb_EquipDotCheckBill/Sb_EquipDotCheckBill",
|
"id": 15,
|
"hidden": false
|
},
|
|
// 车间相关单据列表
|
{
|
"img": "../../static/icon/icon6.png",
|
"text": "设备故障登记列表",
|
"url": "/pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBillList",
|
"id": 16,
|
"hidden": false
|
},
|
{
|
"img": "../../static/icon/icon13.png",
|
"text": "模具故障登记列表",
|
"url": "/pages/MJGL/Sc_MouldConkBookBill/Sc_MouldConkBookBillList",
|
"id": 17,
|
"hidden": false
|
},
|
]
|
}
|
},
|
onLoad() {
|
this.getHiddenItem()
|
},
|
async onShow() {
|
if(this.initFinished) {
|
let MessageIdentifier = await this.getMessageIdentifierCount(this.menuListName)
|
if(MessageIdentifier.code == 0) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: MessageIdentifier.msg
|
})
|
|
return
|
}
|
|
this.itemData.forEach((e, index) => {
|
if(MessageIdentifier.data[e.text] != undefined) {
|
this.itemData[index]["corner"] = true
|
this.itemData[index]["cornerCount"] = MessageIdentifier.data[e.text]
|
}
|
})
|
|
this.$forceUpdate()
|
}
|
},
|
methods: {
|
async getWorkLinkList() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: 'Sc_MESTransFerWorkBill/GetOA_WorkLinkBillList',
|
data: {
|
sWhere: ` and (接收人 = '${getUserInfo()['HEmpName']}' or 抄送接收人 = '${getUserInfo()['HEmpName']}') and 阅读状态 = '未阅'`,
|
user: getUserInfo()["Czymc"]
|
}
|
})
|
|
let {
|
count,
|
data,
|
Message,
|
list
|
} = res.data
|
if (count == 1) {
|
this.bindingData.UnReadCount = data.length
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取工作联系单异常: ${Message}`
|
})
|
}
|
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取工作联系单异常: ${err}`
|
})
|
}
|
},
|
// 根据模块获取未处理消息条数
|
async getMessageIdentifierCount(menuListName) {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/Web/getMessageIdentified',
|
data: {
|
user: getUserInfo()["HEmpName"],
|
moduleName: menuListName
|
}
|
})
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
let retVal = Array.from(data).reduce((acc, item) => {
|
acc[item['moduleName']] = item.count
|
return acc
|
}, {})
|
|
return {
|
code: 1,
|
msg: Message,
|
data: retVal
|
}
|
} else {
|
return {
|
code: 0,
|
msg: Message,
|
data: []
|
}
|
}
|
} catch (err) {
|
|
}
|
},
|
async getHiddenItem() {
|
let data = await getMenuList({
|
menuName: this.menuListName
|
})
|
|
Array.from(data).forEach((e, index) => {
|
if (index < this.itemData.length) {
|
this.itemData[e["HIndex"]]["hidden"] = !CommonUtils.stringToBoolean(e[
|
"HShowMode"] || false)
|
this.itemData[e["HIndex"]].id = e["HEntryID"]; //id为0强制隐藏
|
}
|
})
|
|
let MessageIdentifier = await this.getMessageIdentifierCount(this.menuListName)
|
if (MessageIdentifier.code == 0) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: MessageIdentifier.msg
|
})
|
|
return
|
}
|
|
Array.from(data).forEach((e, index) => {
|
if (index < this.itemData.length) {
|
if (MessageIdentifier.data[this.itemData[e["HIndex"]].text]) {
|
this.$set(this.itemData[e["HIndex"]], "corner", true)
|
this.$set(this.itemData[e["HIndex"]], "cornerCount", MessageIdentifier.data[this.itemData[e["HIndex"]].text])
|
}
|
}
|
})
|
this.initFinished = true
|
this.$forceUpdate()
|
},
|
switchHidden(index) {
|
this.updateCount++;
|
this.itemData[index].hidden = !this.itemData[index].hidden
|
},
|
switchIconsModeHandler() {
|
this.canEdit = !this.canEdit
|
if (this.canEdit == false && this.updateCount > 0) {
|
this.$nextTick(() => {
|
// uni.setStorageSync("HIndexItemData", this.itemData)
|
setMenuList({
|
menuName: this.menuListName,
|
payload: this.itemData
|
})
|
|
this.updateCount = 0
|
})
|
}
|
this.$forceUpdate()
|
},
|
toUrl(item) {
|
if (item.url) {
|
uni.navigateTo({
|
url: item.url
|
})
|
} else {
|
uni.showToast({
|
title: '功能开发中。。。',
|
icon: 'none'
|
})
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.header {
|
width: 100%;
|
height: 2em;
|
position: relative;
|
|
.switch-button {
|
position: absolute;
|
right: 10rpx;
|
bottom: 0;
|
}
|
}
|
|
page {
|
width: 100vw;
|
min-height: 100vh;
|
background-color: #fff;
|
}
|
|
.mains {
|
width: 720rpx;
|
margin: 0 auto;
|
display: flex;
|
flex-wrap: wrap;
|
padding-bottom: 80rpx;
|
|
.box {
|
width: 25%;
|
margin-top: 2.5vh;
|
text-align: center;
|
|
image {
|
width: 18vw;
|
height: 18vw;
|
}
|
|
.texts {
|
width: 120rpx;
|
margin: 0 auto;
|
font-size: 29rpx;
|
font-weight: normal;
|
color: #333333;
|
margin-top: .2vh;
|
}
|
}
|
|
.edit {
|
position: relative;
|
}
|
|
.edit-mark {
|
position: absolute;
|
top: 0;
|
right: 0;
|
}
|
|
view[enable-hidden] {
|
opacity: .4 !important;
|
}
|
|
view[hidden] {
|
display: none;
|
}
|
}
|
|
// .mains {
|
// width: 720rpx;
|
// margin: 0 auto;
|
// padding-bottom: 120rpx;
|
|
// .box {
|
// width: 680rpx;
|
// margin: 0 auto;
|
// margin-top: 20rpx;
|
// display: flex;
|
// align-items: center;
|
// background-color: #fff;
|
// border-radius: 20rpx;
|
// box-shadow: 2upx 2upx 20upx 0 #ddd;
|
|
// image {
|
// width: 78rpx;
|
// height: 78rpx;
|
// padding: 10rpx;
|
// margin: 14rpx 30rpx;
|
// }
|
|
// .texts {
|
// font-size: 30rpx;
|
// font-weight: normal;
|
// color: #333333;
|
|
// .font1 {}
|
|
// .font2 {
|
// font-size: 25rpx;
|
// color: #999;
|
// }
|
// }
|
// }
|
// }
|
</style>
|