<template>
|
<view>
|
<uni-section class="mb-10" :title="'用户名称:'+store.user.userName">
|
<template v-slot:right>
|
班组:{{store.user.address || ''}}
|
</template>
|
</uni-section>
|
</view>
|
<view class="content">
|
|
<uni-row>
|
<uni-col :span="12">
|
<button @click="scannerGetGlassInfo" type="primary" size="mini">玻璃信息</button>
|
</uni-col>
|
<uni-col :span="12">
|
<button @click="scanerCode" type="primary" size="mini">扫码报工</button>
|
</uni-col>
|
<uni-col :span="12">
|
<button type="primary" size="mini" @click="quantityCompletion1">当班产量</button>
|
</uni-col>
|
<uni-col :span="12">
|
<navigator url="/pages/ReportingWorkList/ReportingWorkList" open-type="navigate" >
|
<button type="primary" size="mini">报工记录</button>
|
</navigator>
|
</uni-col>
|
|
|
<uni-col :span="12">
|
<button @click="glassFinishToStore" type="primary" size="mini">成品入库</button>
|
</uni-col>
|
<uni-col :span="12">
|
<button type="primary" size="mini">成品出库</button>
|
</uni-col>
|
|
|
<!-- <uni-col :span="24" v-if="store.user.permissions.includes('qualityInspectionReview.edit')">
|
<navigator url="/pages/ReviewReporitingWork/ReviewReporitingWork" open-type="navigate">
|
<button type="primary" size="mini">质检审核</button>
|
</navigator>
|
</uni-col> -->
|
<!-- <uni-col :span="24">
|
<uni-data-select
|
placeholder="报表"
|
v-model="report"
|
:localdata="reports"
|
@change="changePage"
|
></uni-data-select>
|
</uni-col> -->
|
|
<uni-col :span="12">
|
<uni-data-select
|
placeholder="工序"
|
v-model="process"
|
:disabled="flag"
|
:localdata="processList"
|
@change="changeProcess"
|
></uni-data-select>
|
</uni-col>
|
|
<uni-col :span="12">
|
<uni-data-select
|
placeholder="请选择设备"
|
v-model="device"
|
:localdata="store.deviceList"
|
@change="change"
|
></uni-data-select>
|
</uni-col>
|
<uni-col :span="24">
|
<navigator url="/pages/index/index" open-type="reLaunch">
|
<button type='warn' size="mini">退出</button>
|
</navigator>
|
</uni-col>
|
</uni-row>
|
|
<!-- <view class="text-area">
|
|
</view> -->
|
<view>
|
<!-- 提示信息弹窗 -->
|
<uni-popup ref="message" type="message">
|
<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
|
</uni-popup>
|
</view>
|
</view>
|
|
|
</template>
|
|
<script setup>
|
import userInfo from '@/stores/userInfo'
|
import { onLoad } from '@dcloudio/uni-app'
|
import request from '@/utils/request'
|
import mpaasScan from '@/utils/scanner.js'
|
import { ref, watch,onUnmounted, warn } from 'vue'
|
const store=userInfo()
|
const message= ref(null)
|
const type=ref('center')
|
const msgType=ref(null)
|
const messageText=ref('')
|
let device = ref(null)
|
let report = ref(null)
|
const reports = ref([
|
{value:'orderList',text:'订单报表'},
|
{value:'deliveryList',text:'发货报表'},
|
{value:'originalGlassList',text:'原片库存'}
|
])
|
|
let process = ref(null)
|
let processList = ref([])
|
let flag = ref(false)
|
|
|
const Intent = plus.android.importClass('android.content.Intent')
|
const IntentFilter = plus.android.importClass('android.content.IntentFilter')
|
|
const main = plus.android.runtimeMainActivity()
|
// pda定义的广播名称
|
const SCANACTION = "android.intent.ACTION_SCAN_OUTPUT"
|
|
var filter = new IntentFilter()
|
filter.addAction(SCANACTION)
|
|
// 接收
|
var receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {
|
onReceive: onReceive
|
})
|
|
function onReceive(context, intent) {
|
const page =getCurrentPages()[getCurrentPages().length - 1]
|
//判断当前页面是否在主页
|
if(page.route!=='pages/mainView/mainView'){
|
return
|
}
|
if (intent.getAction() === SCANACTION) {
|
const code = intent.getStringExtra("barcode");
|
uni.navigateTo({
|
url: `/pages/glassInfo/glassInfo?projectNo=${code}`
|
})
|
// 扫描信息处理
|
//uni.$emit('scan', code)
|
}
|
}
|
const getDeviceList = async()=> {
|
if(store.choiceDevice.value!=null){
|
device.value = store.choiceDevice.value
|
return
|
}
|
await request.post(`/reportingWork/selectEquipmentByProcess/${process.value}`).then((res) => {
|
if(res.code==='200'){
|
let deviceList = []
|
res.data.forEach((item,index)=>{
|
deviceList.push({
|
value:item['id'],
|
text:item['basicName']
|
})
|
|
})
|
store.deviceList = deviceList
|
}
|
})
|
}
|
|
const getProcessList = async()=> {
|
const regex =/^\s*$/
|
//当工序为空时则进行查询工序
|
if(!(store.user.address == null || regex.test(store.user.address))){
|
return
|
}
|
request.get(`/basicData/BasicDataByType/product/process`).then(res => {
|
let processArr = []
|
res.data.forEach((item,index)=>{
|
processArr.push({
|
value:item['basicName'],
|
text:item['basicName']
|
})
|
|
})
|
processList.value = processArr
|
})
|
}
|
|
const changeProcess = () => {
|
|
store.deviceList = []
|
device.value = null
|
if(process.value == null || process.value=="" ) return
|
getDeviceList()
|
}
|
|
|
const change = (e) => {
|
store.deviceList.forEach((item,index)=>{
|
if(item.value===e){
|
store.choiceDevice = item
|
}
|
})
|
}
|
|
|
onLoad(async (option)=>{
|
if(store.user.userName === null){
|
uni.reLaunch({
|
url: `/pages/index/index`
|
})
|
return
|
}
|
if(store.user.address == null || store.user.address==""){
|
await getProcessList()
|
}else{
|
flag.value = true
|
process.value = store.user.address
|
await getDeviceList()
|
}
|
|
|
main.registerReceiver(receiver, filter)
|
//判断是否是报工后返回
|
/* if(!option.state){
|
return
|
}
|
msgType.value = option.state */
|
|
})
|
onUnmounted(()=>{
|
main.unregisterReceiver(receiver);
|
})
|
/* watch(msgType,(newVal)=>{
|
switch (newVal) {
|
case 'success':
|
setTimeout(()=>{
|
messageToggle(msgType,'报工成功')
|
},500)
|
|
break;
|
}
|
}) */
|
|
|
const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
const scannerGetGlassInfo = () =>{
|
if(uni.getSystemInfoSync().platform==='android'){
|
|
mpaasScan().then(val => {
|
uni.navigateTo({
|
url: `/pages/glassInfo/glassInfo?projectNo=${val}`
|
})
|
})
|
|
}else{
|
uni.navigateTo({
|
url: `/pages/glassInfo/glassInfo?projectNo=25031302009005`
|
})
|
}
|
}
|
|
const scanerCode = () => {
|
if(device.value === null){
|
messageToggle('warn','未选择设备,请选择报工设备!')
|
return
|
}
|
|
if(uni.getSystemInfoSync().platform==='android'){
|
mpaasScan().then(val => {
|
uni.navigateTo({
|
url: `/pages/reportingWork/reportingWork?processId=${val}&process=${process.value}`
|
})
|
})
|
|
|
}else{
|
uni.navigateTo({
|
url: `/pages/reportingWork/reportingWork?processId=NG24111542A012/1`
|
})
|
}
|
}
|
|
const glassFinishToStore = () => {
|
mpaasScan().then(val => {
|
uni.navigateTo({
|
url: `/pages/glassFinishToStore/glassFinishToStore?processId=${val}`
|
})
|
})
|
}
|
|
|
|
|
|
//打开提示框
|
const messageToggle = (type,msg) => {
|
msgType.value = type
|
messageText.value = msg
|
message.value.open()
|
}
|
|
//打开当班产量
|
const quantityCompletion1 = () => {
|
uni.navigateTo({
|
url: `/pages/QuantityCompletion/QuantityCompletion`
|
})
|
}
|
|
const changePage = () => {
|
uni.navigateTo({
|
url: `/pages/statement/${report.value}`
|
})
|
}
|
|
</script>
|
|
<style>
|
|
.uni-col {
|
margin-bottom: 20px;
|
text-align: center;
|
}
|
.content {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.text-area {
|
display: flex;
|
justify-content: center;
|
padding-bottom: 1rem;
|
margin-top: -10rem;
|
}
|
</style>
|