Files
GX.O3.WMS/APK/APP_Report/pages/tabbar/SingleResRpt/SingleResRpt.vue
T

1978 lines
66 KiB
Vue
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="content">
<view class="header-row-class-organzie" v-if="isShowOrg">
<view class="header-row-title-class-organzie">当前组织:</view>
<picker @change="orgChange" :value="index" :range="orgArry" range-key="FNAME">
<view class="head-row-content-class-organzie">{{orgArry[index].FNAME}}</view>
</picker>
<image class="img-organzie" src="../../../static/img/changearrow.svg"></image>
</view>
<view class="search">
<view class="search-type-select" @click="sourceSelClick" style="width: 280rpx;">
<view class="uni-input">
<view class="uni-input-text">{{sourceSelected}}</view>
<image src="../../../static/report/arrow_down.png" style="height: 32rpx;width: 32rpx;flex-shrink: 0;"></image>
</view>
</view>
<input class="search-input" placeholder="搜索……" placeholder-class="search-placeholder" v-model="sourceCode"
@confirm="searchFunction"></input>
<image class="search-img" src="../../../static/report/scan_gray.png" @click="searchSourceList"></image>
</view>
<view class="list-card" @touchstart="touchS($event,index)"
@touchmove="touchM($event,index)" @touchend="touchE($event,index)"
:style="{'left': (currIndex==index?leftStyle + 'rpx':'')}"
v-for="(item,index) in reportList" v-if="reportList.length>0">
<view class="list-card-Info" @click="workStageClick(item)">
<view class="list-card-Info-item" style="padding-left: 40rpx;">
<!-- 当前汇报状态 90=计划;1=换型中 2=调机中 3=首检中 4=生产中 5=暂停中 -->
<view class="list-card-Info-item-status-realse" v-if="item.RunType=='90'">状态:计划</view>
<text class="list-card-Info-item-status-ongoing" v-if="item.RunType=='1'">状态:换型中</text>
<text class="list-card-Info-item-status-ongoing" v-if="item.RunType=='2'">状态:调机中</text>
<text class="list-card-Info-item-status-ongoing" v-if="item.RunType=='3'">状态:首检中</text>
<text class="list-card-Info-item-status-ongoing" v-if="item.RunType=='4'">状态:生产中</text>
<text class="list-card-Info-item-status-ongoing" v-if="item.RunType=='5'">状态:暂停中</text>
<text class="list-card-Info-item-text">资源名称:{{item.ResourcesName?item.ResourcesName:''}}</text>
<text class="list-card-Info-item-text">资源代码:{{item.ResourcesNO}}</text>
<text class="list-card-Info-item-text">产品代码:{{item.ProductNO}}</text>
<text class="list-card-Info-item-text">工序流转卡:{{item.FFlowCardNO}}</text>
</view>
<view class="list-card-Info-item">
<text class="list-card-Info-item-text">已完成/计划数量:{{item.FTotalFinishQty}}/{{item.FPlanQty}}</text>
<text class="list-card-Info-item-text">工序名称:{{item.FProcessName}}</text>
<text class="list-card-Info-item-text">工序代码:{{item.FProcessNO}}</text>
<text class="list-card-Info-item-text">生产任务单:{{item.FMONO}}</text>
<text class="list-card-Info-item-text"><span style="color: #FFFFFF;">占位符</span></text>
</view>
<!-- <view class="list-card-Info-item">
<text class="list-card-Info-item-text">产品代码:{{item.ProductNO}}</text>
<text class="list-card-Info-item-text">工序流转卡:{{item.FFlowCardNO}}</text>
<text class="list-card-Info-item-text">生产任务单:{{item.FICMONO}}</text>
</view> -->
<image class="list-card-img" src="../../../static/myinfo/right-arrow.png"></image>
</view>
<view class="list-card-btn">
<view class="btn" @click="workStarClick(item,index)"
v-if="item.WorkState=='90' || item.RunType=='90'">开工</view>
<view class="btn-gray" v-if="item.RunType!='90'||item.RunType=='5'">开工</view>
<view class="btn" v-if="item.RunType!='90'&&item.RunType!='5'" @click="safeLightClick(item)">安灯</view>
<view class="btn-gray" v-if="item.RunType=='90'||item.RunType=='5'" >安灯</view>
<view class="btn" @click="laidClick(item,index)">上下岗</view>
<view class="btn" @click="finishedClick(item,index)" v-if="item.RunType!='90'&&item.RunType!='5'"
style="border-right: none;">完工注销</view>
<view class="btn-gray" v-if="item.RunType=='90'||item.RunType=='5'"
style="border-right: none;">完工注销</view>
</view>
<view class="delete-icon" @click="delItem(item,index,0)">
删除
</view>
</view>
<view style="height: 16rpx;width: 100%;"></view>
<view class="gray-layer" v-if="showGrayLayer" @click="hideGrayLayer"></view>
<view class="bottom-select" v-if="showSourceList">
<view class="bottom-select-head">
<view class="bottom_select-head-cancel" @click="sourceSelCancelClick">取消</view>
<view class="bottom_select-head-confirm" @click="sourceSelConfirmClick">确定</view>
</view>
<view style="display: flex;flex-direction: row;">
<scroll-view scroll-y="true" style="height: 150px;">
<view class="bottom-select-list" v-for="(item,index) in sourceCenter">
<view class="bottom-select-list-item" v-if="item.isChoose" style="color: #007AFF;"
@click="sourceWorkCenterItemSel(item,index)">{{item.FName}}</view>
<view class="bottom-select-list-item" v-if="!item.isChoose"
@click="sourceWorkCenterItemSel(item,index)">{{item.FName}}</view>
</view>
</scroll-view>
<scroll-view scroll-y="true" style="height: 150px;" v-if="sourceCenter[0].isChoose">
<view class="bottom-select-list" v-for="(item,index) in sourceList">
<view class="bottom-select-list-item" v-if="item.isChoose" style="color: #007AFF;"
@click="sourceItemSel(item)">{{item.FNO+'|'+item.FName}}</view>
<view class="bottom-select-list-item" v-if="!item.isChoose"
@click="sourceItemSel(item)">{{item.FNO+'|'+item.FName}}</view>
</view>
</scroll-view>
<scroll-view scroll-y="true" style="height: 150px;" v-if="sourceCenter[0].isChoose">
<view class="bottom-select-list" v-for="(item,index) in blankList">
<view class="bottom-select-list-item" v-if="item.isChoose" style="color: #007AFF;"
@click="sourceItemSel(item)">{{item.FName}}</view>
<view class="bottom-select-list-item" v-if="!item.isChoose"
@click="sourceItemSel(item)">{{item.FName}}</view>
</view>
</scroll-view>
<scroll-view scroll-y="true" style="height: 150px;" v-if="sourceCenter[1].isChoose">
<view class="bottom-select-list" v-for="(item,index) in centerList">
<view class="bottom-select-list-item" v-if="item.isChoose" style="color: #007AFF;"
@click="centerItemSel(item)">{{item.FName}}</view>
<view class="bottom-select-list-item" v-if="!item.isChoose"
@click="centerItemSel(item)">{{item.FName}}</view>
</view>
</scroll-view>
<scroll-view scroll-y="true" style="height: 150px;" v-if="sourceCenter[1].isChoose">
<view class="bottom-select-list" v-for="(item,index) in centerSubSourceList">
<view class="bottom-select-list-item" v-if="item.isChoose" style="color: #007AFF;"
@click="centerSourceItemSel(item)">{{item.FName}}</view>
<view class="bottom-select-list-item" v-if="!item.isChoose"
@click="centerSourceItemSel(item)">{{item.FName}}</view>
</view>
</scroll-view>
</view>
</view>
<view class="alter-window" v-if="showStartWorkWindow" style="height: 480rpx;width: 720rpx;">
<view class="window-title">开工</view>
<view class="window-content">
<view class="search" style="font-size: 28rpx;font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;text-align: right;color: #727171;">扫描开工条码</view>
<view class="search">
<input class="search-input" v-model="identifyCode" @confirm="scanIdentifyCodeConfirm"
placeholder="输入开工条码" placeholder-class="search-placeholder" style="background-color: #FFFFFF;"></input>
<image class="search-img" src="../../../static/report/scan_gray.png" @click="scanIdentifyCodeClick"></image>
</view>
</view>
<!-- <view class="window-btn">
<view class="window-btn-cancel" @click="resetClick">重置</view>
<view class="window-btn-confirm" @click="workStarConfirmClick">确定</view>
</view> -->
</view>
<view class="alter-window" v-if="showFinishedWindow" style="height: 480rpx;width: 720rpx;">
<view class="window-title">完工注销</view>
<view class="window-content">
<view class="window-content-item" style="font-size: 36rpx;margin-top: 60rpx;">是否确定完工注销?</view>
</view>
<view class="window-btn">
<view class="window-btn-cancel" @click="finishedCancelClick">取消</view>
<view class="window-btn-confirm" @click="finishedConfirmClick">确定</view>
</view>
</view>
<!-- //注销汇报提交 -->
<view class="alter-window" v-if="showReportEdit">
<view class="window-title" style="margin: 20rpx auto;">生产汇报</view>
<view class="window-content" style="width: 100%;">
<view class="window-content-item-zx">
<text style="width: 25%;">合格数量</text>
<input style="width: 25%;" v-model="acceptQty" type="number"/>
<text style="width: 25%;">不良数量</text>
<input style="width: 25%;" v-model="defultQty" type="number"/>
</view>
<view class="window-content-item-zx">
<text>不良原因</text>
<view class="uni-input" @click="showReportDefultResone" style="background-color: #FFFFFF;padding-left: 0;">
<view style="background-color: #FFFFFF;border: none;padding-left: 0;margin-left: 10rpx;">{{defultResone}}</view>
<image src="../../../static/report/arrow_down.png" style="height: 32rpx;width: 32rpx;flex-shrink: 0;"></image>
</view>
</view>
<view class="window-content-item-zx" @click="addDefultReason()" style="justify-content: space-between;">
<text>添加不良</text>
<image src="../../../static/report/add.png" style="height: 32rpx;width: 32rpx;flex-shrink: 0;"></image>
</view>
<view class="list-card-Info-table-zx"
style="background-color: #f5f9ff;margin:0 70rpx 0 70rpx;padding: 0 20rpx;
border: solid rgba(60,60,67,0.29) 1px;">
<view class="list-card-Info-item-table-zx" style="">
<text class="table-text">不良原因</text>
</view>
<view class="list-card-Info-item-table-zx" style="">
<text class="table-text">不良数量</text>
</view>
<view class="list-card-Info-item-table-zx" style="">
<text class="table-text">操作</text>
</view>
</view>
<view class="list-card-Info-table-zx"
style="height: 120rpx;margin:0 70rpx;padding: 0 0rpx;
border-bottom: solid rgba(60,60,67,0.29) 1px;border-left: solid rgba(60,60,67,0.29) 1px;
border-right: solid rgba(60,60,67,0.29) 1px;">
<scroll-view scroll-y="true" style="height: 120rpx;" show-scrollbar="true">
<view class="list-card-Info-table-zx" v-for="(item,index) in submitDefultList" style="margin:0 0;padding: 0 20rpx;">
<view class="list-card-Info-item-table-zx" style="margin: 0 0;">
<view class="table-text">{{item.FName}}</view>
</view>
<view class="list-card-Info-item-table-zx" style="margin: 0 0;">
<view class="table-text">{{item.FQty}}</view>
</view>
<view class="list-card-Info-item-table-zx" style="color: red;margin: 0 0;" @click="delDefultReason(item,index)">
<span class="table-text" style="color: red;">删除</span>
</view>
</view>
</scroll-view>
</view>
</view>
<view class="window-btn">
<view class="window-btn-cancel" @click="reportResetClick">重置</view>
<view class="window-btn-confirm" @click="reportSubmitClick">提交</view>
</view>
</view>
<view class="bottom-select" v-if="showReportResoneList">
<view class="bottom-select-head">
<view class="bottom_select-head-cancel">选择不良原因</view>
<image class="search-img"></image>
</view>
<scroll-view scroll-y="true" style="height: 150px;">
<view class="bottom-select-list" v-for="(item,index) in reportResoneList">
<view class="bottom-select-list-item" @click="reportDefultResoneItemSel(item)">{{item.FName}}</view>
</view>
</scroll-view>
</view>
<view class="alter-window" v-if="showSafeAlterWindow" style="min-height: 480rpx;width: 720rpx;">
<view class="window-title">安灯预警</view>
<view class="window-content" style="padding-top: 50rpx; padding-left: 10rpx; padding-right: 10rpx; padding-bottom: 20rpx;">
<view class="alter-window-content-item">
<view v-for="(item, index) in lampType" style="height: 50px;line-height: 50px;">
<view :class="[safeAlterType==item.FNO?'alter-window-content-item-list-click':
'alter-window-content-item-list']" @click="safeAlterClick(item.FNO)">{{item.FNAME.substr(0,4)}}</view>
</view>
</view>
</view>
<view class="window-btn">
<view class="window-btn-cancel" @click="SafeAlterCancelClick">取消</view>
<view class="window-btn-confirm" @click="SafeAlterConfirmClick">确定</view>
</view>
</view>
<view class="bottom-select" v-if="showLaidWindow" style="height: 80%;">
<view class="bottom-select-head">
<view class="bottom_select-head-cancel">员工上岗</view>
<view class="bottom_select-head-confirm">
<span class="bottom_select-head-confirm-text" @click="onOffLaidClick(1)">上岗</span>
</view>
</view>
<scroll-view scroll-y="true" :style="{'height':laidHight}">
<view class="search" style="margin: 32rpx 120rpx; 0 120rpx">
<text style="flex-shrink: 0;">选择班组</text>
<view class="search-type-select" style="flex-grow: 1;width: auto;margin-right: 0;margin-left: 20rpx;" @click="teamSelClick">
<view class="uni-input">
<view class="uni-input-text">{{teamSelected}}</view>
<image src="../../../static/report/arrow_down.png" style="height: 32rpx;width: 32rpx;flex-shrink: 0;"></image>
</view>
</view>
</view>
<!-- <view class="search" style="margin: 32rpx 120rpx; 0 120rpx">
<text style="flex-shrink: 0;">选择班次</text>
<view class="search-type-select" style="flex-grow: 1;width: auto;margin-right: 0;margin-left: 20rpx;" @click="teamRowSelClick">
<view class="uni-input">
<view class="uni-input-text">{{teamRowSelected}}</view>
<image src="../../../static/report/arrow_down.png" style="height: 32rpx;width: 32rpx;flex-shrink: 0;"></image>
</view>
</view>
</view> -->
<view class="search" style="margin: 32rpx 120rpx; 0 120rpx">
<text style="flex-shrink: 0;">选择员工</text>
<input class="search-input" v-model="workerCode" @confirm="searchBasicInfo(0,10)"
placeholder="输入工号" placeholder-class="search-placeholder" style="background-color: #FFFFFF;margin-left: 20rpx;"></input>
<image class="search-img" src="../../../static/report/scan_gray.png" @click="scanWorkerCodeClick"></image>
</view>
<view class="" style="margin: 32rpx 120rpx; 0 120rpx;flex-direction: row;display: flex;">
<text style="flex-shrink: 0;">已选员工</text>
<view style="">
<view style="display: flex;flex-direction: row;margin-left: 20rpx;flex-wrap: wrap;">
<view class="selected-worker-item" v-for="(item,index) in selectedWorkerList">
<view>{{item.FName}}</view>
<image src="../../../static/report/delBtn_gray.png"
style="height: 24rpx;width: 24rpx;" @click="delWorker(item,index)"></image>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="bottom-select-head">
<view class="bottom_select-head-cancel">在岗员工</view>
<view class="bottom_select-head-confirm">
<span class="bottom_select-head-confirm-text" @click="onOffLaidClick(2)">下岗</span>
</view>
</view>
<view class="list-card-Info-table" style="background-color: #f5f9ff">
<view class="list-card-Info-item-table" style="margin-left: 20rpx;margin-right: 48rpx;width: 4%;">
<checkbox value="cb" :checked="selAll" @click="selAllClick()" style="transform:scale(0.7)" :key = "key"/>
</view>
<view class="list-card-Info-item-table">
<span class="table-text">人员工号</span>
</view>
<view class="list-card-Info-item-table">
<span class="table-text">姓名</span>
</view>
<view class="list-card-Info-item-table">
<span class="table-text">上岗时间</span>
</view>
</view>
<scroll-view scroll-y="true" :style="{'height':laidHight}" :key="key">
<view class="list-card-Info-table" v-for="(item,index) in onWorkWorkerList"
:style="'background-color:' + (!index%2 ? '#FFFFFF' : '#FFFFFF')">
<view class="list-card-Info-item-table" style="margin-left: 20rpx;margin-right: 48rpx;width: 4%;">
<checkbox value="cb" :checked="item.isChoose" @click="selClick(item,index)"
style="transform:scale(0.7);"/>
</view>
<view class="list-card-Info-item-table">
<span class="table-text">{{item.FEmpNumber}}</span>
</view>
<view class="list-card-Info-item-table">
<span class="table-text">{{item.FEmpName}}</span>
</view>
<view class="list-card-Info-item-table">
<span class="table-text">{{item.FStartTime}}</span>
</view>
</view>
<view style="height: 32px;width: 100%;"></view>
</scroll-view>
</view>
<view class="gray-layer" v-if="showSecGrayLayer" @click="hideSecGrayLayer" style="z-index: 9 !important;"></view>
<view class="bottom-select" v-if="showTeamList" style="z-index: 99 !important;">
<view class="bottom-select-head">
<view class="bottom_select-head-cancel">选择班组</view>
<image class="search-img"></image>
</view>
<scroll-view scroll-y="true" style="height: 150px;">
<view class="bottom-select-list" v-if="teamList.length>0" v-for="(item,index) in teamList">
<view class="bottom-select-list-item" @click="teamItemSel(item)">{{item.FName}}</view>
</view>
<view class="bottom-select-list" v-for="(item,index) in teamList">
<view class="bottom-select-list-item" v-if="teamList.length==0">无数据</view>
</view>
</scroll-view>
</view>
<view class="bottom-select" v-if="showTeamRowList" style="z-index: 99 !important;">
<view class="bottom-select-head">
<view class="bottom_select-head-cancel">选择班次</view>
<image class="search-img"></image>
</view>
<scroll-view scroll-y="true" style="height: 150px;">
<view class="bottom-select-list" v-if="teamRowList.length>0" v-for="(item,index) in teamRowList">
<view class="bottom-select-list-item" @click="teamRowItemSel(item)">{{item.FName}}</view>
</view>
<view class="bottom-select-list" v-if="teamRowList.length==0">
<view class="bottom-select-list-item">无数据</view>
</view>
</scroll-view>
</view>
<!-- <view class="tabBar">
<view class="tabBar-item" @click="mainSelectF">
<view v-show="mainSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/report/home_blue.png"></image>
<span class="tabBar-item-text" style="color:#007AFF">首页</span>
</view>
<view v-show="!mainSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/report/home_gray.png"></image>
<span class="tabBar-item-text" style="color: #666666;">首页</span>
</view>
</view>
<view class="tabBar-item" @click="reportSelectF">
<view v-show="reportSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/report/report_blue.png"></image>
<span class="tabBar-item-text" style="color:#007AFF">开工汇报</span>
</view>
<view v-show="!reportSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/report/report_gray.png"></image>
<span class="tabBar-item-text" style="color: #666666;">开工汇报</span>
</view>
</view>
<view class="tabBar-item" @click="safeAlterSelectF">
<view v-show="safeAlterSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src=".../../../static/report/safeAlter_blue.png"></image>
<span class="tabBar-item-text" style="color:#007AFF">安灯</span>
</view>
<view v-show="!safeAlterSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/report/safeAlter_gray.png"></image>
<span class="tabBar-item-text" style="color: #666666;">安灯</span>
</view>
</view>
<view class="tabBar-item" @click="mySelectF">
<view v-show="mySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/report/my_gray.png"></image>
<span class="tabBar-item-text" style="color:#007AFF">我的</span>
</view>
<view v-show="!mySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/report/my_gray.png"></image>
<span class="tabBar-item-text" style="color: #666666;">我的</span>
</view>
</view>
</view> -->
</view>
</template>
<script>
import errorUtil from '@/common/errorutil.js'
import {
mapState,
mapMutations
} from 'vuex'
var commonUtil = require('../../../common/util.js')
export default {
data() {
return {
key:1,
laidHight:'',
showGrayLayer:false,
showSecGrayLayer:false,
showSourceList:false,
showStartWorkWindow:false,
showSafeAlterWindow:false,
showFinishedWindow:false,
showLaidWindow:false,
showTeamList: false,
showTeamRowList: false,
showReportEdit:false,
showReportResoneList: false,
leftStyle: 0,
startX: 0,
hiddenFlag: true,
delBtnWidth: 220,
currIndex:'',
mainSelect:false,
reportSelect:true,
safeAlterSelect:false,
mySelect:false,
safeAlterType:'-1',
identifyCode:'',
reportList:[],
currReportIndex:'',
teamSelected:"选择班组",
teamNOSelected:'',
teamRowSelected:"选择班次",
teamRowNOSelected:'',
workerCode:'',
isShowOrg:true,
index:0,
orgArry:[],
sourceSelected:"选择资源",
sourceCenter:[{FName:"所有资源",isChoose:true},{FName:"工作中心",isChoose:false}],
centerList:[],
sourceList:[],
blankList:[{FName:"",isChoose:""}],
selectedCenterList:[],
selectedCenterNOList:[],
centerSubSourceList:[],
selectedSourceList:[],
selectedSourceNOList:[],
submitSourceCodeList:[],
sourceCode:'',
laidType:'',
lampItem:null,
selAll:false,
teamList: [],
teamRowList: [],
selectedWorkerList:[],
selectedOffWorkList:[],
workerInfo:[], //当前工序资源全部员工信息
onWorkWorkerList:[],
singeleResourceInfo:[],
macAddress:"",
lampType:[],
currReportTeamNO:'',
currReportTeamRowNO:'',
macAddress:"",
scrollTop: 0,
old: {
scrollTop: 0
},
showTips:false,
reportResoneList:[],
acceptQty:'',
defultQty:'',
FPassQty:'',
FBadQty:'',
defultResone:'',
defultResoneID:'',
submitDefultList:[],
barType:''
}
},
components:{
},
onLoad() {
const pageHeight = uni.getSystemInfoSync();
this.laidHight = (pageHeight.windowHeight*0.8-80)*0.5+'px';
let count = 0;
this.macAddress = uni.getStorageSync('MACAddress');
this.reloadHisReport(false,1);
this.teamList = uni.getStorageSync('teamInfo');
this.teamRowList = uni.getStorageSync('teamRowInfo');
let workCenterList = uni.getStorageSync('workCenterInfo');
let allSourceList = uni.getStorageSync('allSourceInfo');
this.centerList = workCenterList;
this.sourceList = allSourceList;
this.lampType = uni.getStorageSync('defultLampType');
this.reportResoneList = uni.getStorageSync("defultReasonInfo");
this.getOrgList();
},
onShow() {
const pageHeight = uni.getSystemInfoSync();
this.laidHight = (pageHeight.windowHeight*0.8-80)*0.5+'px';
let count = 0;
this.macAddress = uni.getStorageSync('MACAddress');
this.reloadHisReport(false,1);
this.teamList = uni.getStorageSync('teamInfo');
this.teamRowList = uni.getStorageSync('teamRowInfo');
let workCenterList = uni.getStorageSync('workCenterInfo');
let allSourceList = uni.getStorageSync('allSourceInfo');
this.centerList = workCenterList;
this.sourceList = allSourceList;
this.lampType = uni.getStorageSync('defultLampType');
this.reportResoneList = uni.getStorageSync("defultReasonInfo");
},
onPullDownRefresh:function(){
let _self = this;
_self.showTips = false;
this.reloadHisReport(true,1);
setTimeout(()=>{
//停止下拉样式
uni.stopPullDownRefresh();
//隐藏标题读取
uni.hideNavigationBarLoading();
},
500);
},
// onReachBottom:function(){
// let _self = this;
// if(!_self.showTips) {
// this.reloadHisReport(0,1);
// }
// else {
// uni.showToast({
// icon: 'none',
// title: '已经到底了'
// });
// }
// },
methods: {
hideGrayLayer(){
this.showLaidWindow = false;
this.showFinishedWindow = false;
this.showSafeAlterWindow = false;
this.showStartWorkWindow = false;
this.showSourceList = false;
this.showReportEdit = false;
this.showReportResoneList = false;
this.showGrayLayer = false;
},
hideSecGrayLayer(){
this.showTeamList= false;
this.showTeamRowList= false;
this.showSecGrayLayer= false;
},
getBarcodeInfo(){
let _self = this;
let params;
this.$request.get('/ReportInfoLoad/GetBarcodeInfo',{
params:{
"basicType":1,
"barCode":this.identifyCode?this.identifyCode:""
}
}).then(res => {
if(res){
let data = res;
this.barType = data.FTypeID;
this.processStart();
}
}).catch(err => {
errorUtil.handle(err)
});
},
getOrgList:function(){
let _self = this;
let orgInfo = uni.getStorageSync('orgInfo');
if(orgInfo && orgInfo.length > 0) {
this.orgFItemID = orgInfo[0].FINTERID;
uni.setStorageSync('orgID',this.orgFItemID)
this.orgArry = orgInfo;
this.orgArry.forEach(
function(el,index){
let currentOrgid = el.FINTERID;
let result = (currentOrgid == _self.orgFItemID);
if(result){
_self.index = index;
}
}
);
}else{
this.orgArry = [{name:"请选择组织", key:"", FNAME:"当前无组织"}];
this.index = 0;
uni.setStorageSync('orgID','')
}
},
orgChange:function(e){
console.log(this.orgArry)
this.index = e.target.value;
if(!this.orgArry[this.index].FItemID){
this.orgFItemID = "";
}else{
this.orgFItemID = this.orgArry[this.index].FItemID;
}
uni.setStorageSync('orgID',this.orgFItemID)
console.log(this.orgFItemID);
this.orgChangedClear();
},
showOrg:function(){
let userID = this.userInfo.token;
let currentPage = "MESMT05";
let requestParams = {
"id": userID,
"prgkey": currentPage
};
this.$request.post(
{
data: {
action: 'QueryIsEnableOr',
params: requestParams
}
}
).then(res => {
uni.hideLoading();
this.isShowOrg = JSON.parse(res);
if(!this.isShowOrg){
this.orgFItemID = "";
}
});
},
orgChangedClear:function(){},
//注销汇报
showReportDefultResone(){
this.showReportResoneList = true;
},
reportDefultResoneItemSel(item){
this.defultResone = item.FName;
this.defultResoneID = item.FID;
this.showReportResoneList = false;
},
addDefultReason(){
if(this.defultResone && this.defultQty && this.defultResone){
let arr = {
FName:this.defultResone,
FID:this.defultResoneID,
FQty:this.defultQty
}
this.submitDefultList.push(arr);
this.FPassQty = this.acceptQty;
this.FBadQty = this.defultQty
this.defultResone = '';
// this.acceptQty = '';
this.defultQty = '';
}else{
uni.showToast({
title:'不良数量、原因不能为空',
icon:'none'
})
return
}
},
delDefultReason(item,index){
this.submitDefultList.splice(index,1);
},
reportResetClick(){
this.acceptQty = '';
this.defultQty = '';
this.defultResone = '';
this.FPassQty = '';
this.FBadQty = '';
this.submitDefultList = [];
},
reportSubmitClick(){
this.submitReport(0);
this.showGrayLayer = false;
this.showReportEdit = false;
},
//生产汇报提交
submitReport(count){},
//搜索资源下工序
searchFunction(){
this.selectedSourceNOList = [];
if(this.sourceCode){
this.selectedSourceNOList.push(this.sourceCode);
this.reloadHisReport(false,2);
if(this.singeleResourceInfo.length==0){
this.submitSourceCodeList = [this.sourceCode]
this.addReport(0)
}
}else{
this.reloadHisReport(false,2);
}
},
searchSourceList(){
let _self = this;
this.selectedSourceNOList = [];
uni.scanCode({
success:function(res){
_self.sourceCode = res.result;
if(_self.sourceCode){
_self.selectedSourceNOList.push(_self.sourceCode);
_self.reloadHisReport(false,2);
if(_self.singeleResourceInfo.length==0){
_self.submitSourceCodeList = [_self.sourceCode]
_self.addReport(0)
}
}else{
uni.showToast({
title:'资源码为空'
})
}
}
})
},
//是否存在历史信息
isExistsHisReport(count){
let _self = this;
let userInfo = uni.getStorageSync('userInfo');
let tokenpara = uni.getStorageSync('tokenpara');
let requestParams = {
"id": userInfo.token,
"phoneID":this.macAddress
};
this.$request.post(
{
data: {
action: 'IsExistsHisReport',
params: requestParams
}
},
tokenpara
).then(res => {
if(res.status == 0){
this.reportList = [];
}else{
uni.showModal({
title:'提示',
content:'是否加载历史资源',
success(res) {
if(res.confirm){
_self.reloadHisReport(false,1);
}else if(res.cancel){
_self.reportList = [];
}
}
})
}
});
},
//获取历史信息
reloadHisReport(isRefresh,type){
let _self = this;
let tokenpara = uni.getStorageSync('token');
let ResourceNOList = [];
if(this.selectedSourceNOList.length>0){
ResourceNOList = this.selectedSourceNOList
}else{
ResourceNOList = [];
}
let params;
let dataList = [];
this.$request.get('/ReportInfoLoad/ReloadHisReport',{
params:{
"phoneID":this.macAddress,
"basicType":type, //1=从数据库加载汇报信息;2=从缓存加载汇报信息
"data":isRefresh ? JSON.stringify(dataList) : JSON.stringify(ResourceNOList)
}
}).then(res => {
if(res){
let data = res;
this.reportList = data
}
}).catch(err => {
errorUtil.handle(err);
});
},
//获取当前工序资源信息
async getSingeleResource(count, item, callBack){
let _self = this;
let params;
let tokenpara = uni.getStorageSync('token');
await this.$request.get('/ReportInfoLoad/ReloadSingeleResource',{
params:{
phoneID:this.macAddress,
resourceID:item.ResourcesID
}
}).then(res => {
if(res){
// if(res.length>0){
_self.onWorkWorkerList = [];
let data = res;
_self.singeleResourceInfo = data;
if(data.EmpDutys.length>0){
data.EmpDutys.forEach(function(el){
el.FStartTime = commonUtil.removeLetter(el.FStartTime);
el.FStartTime = el.FStartTime.substr(0,10) + " " + el.FStartTime.substr(10 ,8);
let arr = {
"FEmpID":el.FEmpID,
"FEmpNumber":el.FEmpNumber,
"FEmpName":el.FEmpName,
"FStartTime":el.FStartTime,
"isChoose":false
}
_self.onWorkWorkerList.push(arr)
})
_self.currReportTeamNO = _self.singeleResourceInfo.TeamNO;
_self.currReportTeamRowNO = _self.singeleResourceInfo.ShiftNO;
}
// }
}
if(callBack) {
callBack();
}
});
},
//新增资源汇报
addReport(count){
let _self = this;
let params;
let sourceCodeList = this.submitSourceCodeList;
let tokenpara = uni.getStorageSync('token');
params = {
"phoneID":this.macAddress,
"data":sourceCodeList
}
this.$request.post('/ReportInfoLoad/SubmitResouces',params).then(res => {
let data = res;
let count = 0;
this.refreshloadHisReport()
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
refreshloadHisReport(){
let _self = this;
let tokenpara = uni.getStorageSync('token');
let ResourceNOList = [];
let params;
this.$request.get('/ReportInfoLoad/ReloadHisReport',{
params:{
"phoneID":this.macAddress,
"basicType":2, //1=从数据库加载汇报信息;2=从缓存加载汇报信息
"data":JSON.stringify(ResourceNOList)
}
}).then(res => {
if(res){
let data = res;
this.reportList = data
}
}).catch(err => {
errorUtil.handle(err);
});
},
// 资源选择
sourceSelClick(){
// this.sourceCenterList[0].isChoose = false;
// this.sourceList = [];
this.showSourceList = true;
this.showGrayLayer = true;
},
sourceWorkCenterItemSel(item,index){
let _self = this;
this.selectedSourceList = [];
this.selectedSourceNOList = [];
let curItemIndex = index;
item.isChoose = !item.isChoose;
let selType = this.sourceCenter.filter(
function(el){
return el.isChoose == true;
}
)
if(selType.length>1){
this.sourceCenter.forEach(
function(el,index){
if(index == curItemIndex){
el.isChoose = true
}else{
el.isChoose = false
}
}
)
if(this.sourceCenter[1].isChoose){
this.centerList = uni.getStorageSync('workCenterInfo');
}else if(this.sourceCenter[0].isChoose){
this.sourceList = uni.getStorageSync('allSourceInfo');
}else{
this.sourceList = [];
}
}else{
if(this.sourceCenter[1].isChoose){
this.centerList = uni.getStorageSync('workCenterInfo');
}else if(this.sourceCenter[0].isChoose){
this.sourceList = uni.getStorageSync('allSourceInfo');
}else{
this.sourceList = [];
}
}
},
sourceItemSel(item){
let _self = this;
this.selectedSourceList = [];
this.selectedSourceNOList = [];
item.isChoose = !item.isChoose;
this.selectedSourceList = this.sourceList.filter(
function(el){
return el.isChoose == true
}
)
this.selectedSourceList.forEach(
function(el){
if(el.isChoose){
_self.selectedSourceNOList.push(el.FNO)
}
}
)
this.selectedSourceNOList = Array.from(new Set(this.selectedSourceNOList));
},
centerItemSel(item){
let _self = this;
this.selectedSourceList = [];
this.selectedSourceNOList = [];
item.isChoose = !item.isChoose;
let workCenterList = this.centerList;
this.selectedCenterList = [];
workCenterList.forEach(
function(el){
if(el.isChoose == true){
_self.selectedCenterList.push(el)
}
}
)
let obj = {};
this.selectedCenterList= this.selectedCenterList.reduce((cur,next) => {
obj[next.FID] ? "" : obj[next.FID] = true && cur.push(next);
return cur;
},[]);
if(this.selectedCenterList && this.selectedCenterList.length>0){
this.selectedCenterNOList = [];
this.selectedCenterList.forEach(
function(el){
_self.selectedCenterNOList.push(el.FNO)
}
)
this.selectedCenterNOList = Array.from(new Set(this.selectedCenterNOList));
let count = 0;
this.getResourceByWorkCenter(count)
}else{
this.selectedCenterNOList = [];
let count = 0;
this.getResourceByWorkCenter(count);
}
console.log(this.centerSubSourceList);
},
centerSourceItemSel(item){
let _self = this;
this.selectedSourceList = [];
this.selectedSourceNOList = [];
item.isChoose = !item.isChoose;
this.selectedSourceList = this.centerSubSourceList.filter(
function(el){
return el.isChoose == true
}
)
this.selectedSourceList.forEach(
function(el){
if(el.isChoose){
_self.selectedSourceNOList.push(el.FNO)
}
}
)
this.selectedSourceNOList = Array.from(new Set(this.selectedSourceNOList));
},
sourceSelCancelClick(){
this.showSourceList = false;
this.showGrayLayer = false;
},
sourceSelConfirmClick(){
let _self = this;
let allSource = uni.getStorageSync('allSourceInfo');
let currMACaddress = this.macAddress;
let selectedCenterSource = this.sourceCenter.filter(
function(el){
return el.isChoose == true
}
);
let selectedCenter = this.centerList.filter(
function(el){
return el.isChoose == true
}
);
let selectedSourceSubmitList = this.selectedSourceList;
let repeatList = [];
let repeatNOList = [];
let sourceAbsentCurMobel = [];
let sourceAbsentCurMobelNO = [];
if(selectedCenterSource.length == 0){
uni.showToast({
title:'请选择"所有资源"或"工作中心"',
icon:'none'
})
}else{
if(selectedCenterSource[0].FName == "所有资源"){
if(allSource.length==0){
uni.showToast({
title:'无资源信息',
icon:'none'
})
this.showGrayLayer = false;
this.showSourceList =false;
}else{
if(selectedSourceSubmitList.length == 0){
uni.showToast({
title:'请选择所有资源下级资源',
icon:'none'
})
}else{
this.utilFunction(selectedSourceSubmitList,repeatList,repeatNOList,
currMACaddress,sourceAbsentCurMobel,sourceAbsentCurMobelNO)
}
}
}
if(selectedCenterSource[0].FName == "工作中心"){
if(this.selectedCenterList.length==0||this.selectedSourceList==0){
uni.showToast({
title:'请选择工作中心及下属资源',
icon:'none'
})
}else{
if(selectedSourceSubmitList.length == 0){
uni.showToast({
title:'请选择资源',
icon:'none'
})
}else{
this.utilFunction(selectedSourceSubmitList,repeatList,repeatNOList,
currMACaddress,sourceAbsentCurMobel,sourceAbsentCurMobelNO)
}
}
}
}
},
utilFunction(selectedSourceSubmitList,repeatList,repeatNOList,currMACaddress,sourceAbsentCurMobel,sourceAbsentCurMobelNO){
//去除与汇报列表重复的
let _self = this;
this.reportList.forEach(
function(el){
let FNO = el.ResourcesNO;
let list = selectedSourceSubmitList.filter(
function(sel){
return sel.FNO === FNO
}
)
if(list.length>0){
repeatList.push(list);
}
}
)
console.log(repeatList);
repeatNOList = repeatList.map(function(el){
return el[0].FNO
})
let tempSubmitNOList = selectedSourceSubmitList.map(function(el){
return el.FNO
})
tempSubmitNOList = tempSubmitNOList.filter(function(el){
return repeatNOList.indexOf(el) === -1
})
let tempSubmitList = [];
tempSubmitNOList.forEach(function(el){
let FNO = el;
let arrTemp;
arrTemp = selectedSourceSubmitList.filter(function(subList){
return subList.FNO === FNO
})
tempSubmitList.push(arrTemp)
})
console.log(tempSubmitList)
selectedSourceSubmitList = tempSubmitList;
if(selectedSourceSubmitList.length>0){
//不在此设备的资源
sourceAbsentCurMobel = selectedSourceSubmitList.filter(
function(el){
let resultF = (el[0].FPhoneID !== currMACaddress);
let resultS = (!el[0].FPhoneID);
// return el[0].FPhoneID !== currMACaddress && el[0].FPhoneID !==""
return resultF && !resultS
}
)
if(sourceAbsentCurMobel.length>0){
sourceAbsentCurMobelNO = sourceAbsentCurMobel.map(function(el){
return el.FNO
})
let tips = "";
sourceAbsentCurMobel.forEach(function(el){
tips = tips+el[0].FNO+' '
})
uni.showModal({
title:'提示',
content:'资源 '+tips +'汇报,不在此设备,是否在此设备汇报?',
success(res) {
if(res.confirm){
_self.submitSourceCodeList = selectedSourceSubmitList.map(function(el){
return el[0].FNO
})
let count = 0;
_self.addReport(count);
_self.showGrayLayer = false;
_self.showSourceList = false;
}else if(res.cancel){
let tempList = [];
let tempNOList = [];
sourceAbsentCurMobelNO.forEach(function(el){
let PID = el;
let arrTemp;
arrTemp = selectedSourceSubmitList.filter(function(subList){
return subList.FPhoneID === PID
})
tempList.push(arrTemp)
})
tempNOList = tempList.map(function(el){
return el.FNO
})
_self.submitSourceCodeList = selectedSourceSubmitList.map(function(el){
return el.FNO
})
_self.submitSourceCodeList = _self.submitSourceCodeList.filter(function(el){
return tempNOList.indexOf(el) ===-1
})
console.log(_self.submitSourceCodeList);
if(_self.submitSourceCodeList.length>0){
_self.addReport(0);
}
_self.showGrayLayer = false;
_self.showSourceList = false;
}
}
})
}else{
this.submitSourceCodeList = selectedSourceSubmitList.map(function(el){
return el[0].FNO
})
let count = 0;
this.addReport(count);
this.showGrayLayer = false;
this.showSourceList = false;
}
}else{
uni.showToast({
title:'选择的资源已全部存在汇报列表中',
icon:'none'
})
this.showGrayLayer = false;
this.showSourceList = false;
}
},
getResourceByWorkCenter(count){
let _self = this;
let workCenterFNOList = this.selectedCenterNOList;
let tokenpara = uni.getStorageSync('token');
this.$request.get('/ReportInfoLoad/QueryResourceByWorkCenter?data='+JSON.stringify(workCenterFNOList)).then(res => {
let data = res;
let list = [];
data.forEach(
function(el){
let arr = {
"FID":el.FID,
"FNO":el.FNO,
"FName":el.FNAME,
"FPhoneID":el.FPHONEID,
"FCOMPANYID":el.FCOMPANYID,
"isChoose":false
}
list.push(arr)
}
)
this.centerSubSourceList = list;
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
// 安灯
safeLightClick(item){
this.showGrayLayer = true;
this.showSafeAlterWindow = true;
this.lampItem = item;
},
safeAlterClick(type){
this.safeAlterType = type;
},
SafeAlterCancelClick(){
this.showSafeAlterWindow = false;
this.showGrayLayer = false;
this.lampItem = null;
this.safeAlterType = '-1';
},
SafeAlterConfirmClick(){
this.showSafeAlterWindow = false;
this.showGrayLayer = false;
if(this.safeAlterType == '-1'){
uni.showToast({
title:'请选择一种安灯预警类型',
icon:'none'
})
}else{
let tokenpara = uni.getStorageSync('token');
let requestParams = {
"phoneID": this.macAddress,
"resource": this.lampItem.ResourcesNO,
"reportID": this.lampItem.FReportID,
"fCode": this.lampItem.FCode,
"callNO": this.safeAlterType
};
this.$request.post('/ReportProduce/ProcessWarningCall',requestParams).then(res => {
let data = res;
uni.showToast({
title:'呼叫成功',
icon:'none'
});
}).catch(err => {
errorUtil.handle(err);
});
}
this.lampItem = null;
this.safeAlterType = '-1';
},
// 开工
workStarClick(item,index){
let _self = this;
_self.currReportIndex = index;
_self.identifyCode = '',
_self.getSingeleResource(0, item,
function(){
// if(_self.onWorkWorkerList.length>0 && _self.currReportTeamNO && _self.currReportTeamRowNO){
_self.showStartWorkWindow = true;
_self.showGrayLayer = true;
// }else{
// let arr = _self.onWorkWorkerList.length;
// let arr1 = _self.currReportTeamNO;
// let arr2 = _self.currReportTeamRowNO;
// uni.showToast({
// title:'班组,班次,人员信息不能为空',
// icon:'none'
// })
// return
// }
}
);
},
scanIdentifyCodeClick(){
let _self = this;
uni.scanCode({
success:function(res){
console.log(res);
_self.identifyCode = res.result;
_self.getBarcodeInfo();
}
})
},
scanIdentifyCodeConfirm(){
this.getBarcodeInfo();
},
resetClick(){
this.identifyCode = '';
},
workStarConfirmClick(){
let _self = this;
this.reportList.forEach(
function(el,index){
if(_self.currReportIndex == index){
el.disableWorkStart = true;
}
}
)
this.showStartWorkWindow = false;
this.showGrayLayer = false;
// this.identifyCode = '';
this.processStart(0)
},
processStart(count){
let _self = this;
let params;
// let barInfo = {"barType":1,"barCode":this.identifyCode?this.identifyCode:""};
let tokenpara = uni.getStorageSync('token');
params = {
"barCode":this.identifyCode?this.identifyCode:"",
"barType":this.barType,
"phoneID":this.macAddress,
"resource":this.reportList[this.currReportIndex].ResourcesNO?this.reportList[this.currReportIndex].ResourcesNO:"",
"team":this.teamNOSelected?this.teamNOSelected:(this.reportList[this.currReportIndex].TeamNO?this.reportList[this.currReportIndex].TeamNO:""),
"shift":this.teamRowNOSelected?this.teamRowNOSelected:(this.reportList[this.currReportIndex].ShiftNO?this.reportList[this.currReportIndex].ShiftNO:"")
};
this.$request.post('/ReportProduce/ProcessStart',params).then(res => {
let data = res;
this.showStartWorkWindow = false;
this.showGrayLayer = false;
this.reloadHisReport(false,2)
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
//上下岗
laidClick(item,index){
let _self = this;
this.currReportIndex = index;
this.selAll = false;
this.teamSelected = '选择班组';
this.teamNOSelected ='';
this.teamRowSelected = '选择班次';
this.teamRowNOSelected = '';
this.selectedWorkerList = [];
this.selectedOffWorkList = [];
this.getSingeleResource(0,item)
this.showLaidWindow = true;
this.showGrayLayer = true;
},
delWorker(item,index){
this.selectedWorkerList.splice(index,1);
},
onOffLaidClick(type){
this.submitEmployee(0,type);
this.key = this.key+1;
this.showLaidWindow = false;
this.showGrayLayer = false;
},
submitEmployee(count,type){
let _self = this;
let params;
let workerNOList;
// debugger
if(type == 1){
if(this.selectedWorkerList.length>0){
workerNOList = this.selectedWorkerList.map(function(el){
return el.FNO
})
}else{
workerNOList = [];
return
}
}
if(type == 2){
if(this.selectedOffWorkList.length>0){
workerNOList = this.selectedOffWorkList.map(function(el){
return el.FEmpNumber
})
}else{
workerNOList = [];
return
}
}
let tokenpara = uni.getStorageSync('token');
params = {
"phoneID": this.macAddress,
"basicType": type,
"resource":this.reportList[this.currReportIndex].ResourcesNO,
"data":workerNOList
// "team":this.teamNOSelected,
// "shift":this.teamRowNOSelected
};
this.$request.post('/ReportProduce/SubmitEmployee',params).then(res => {
if(res){
if(res.length>0){
let data = res;
if(data.EmpDutys.length>0){
data.EmpDutys.forEach(function(el){
el.FStartTime = commonUtil.removeLetter(el.FStartTime);
el.FStartTime = el.FStartTime.substr(0,10) + " " + el.FStartTime.substr(10 ,8);
let arr = {
"FEmpID":el.FEmpID,
"FEmpNumber":el.FEmpNumber,
"FEmpName":el.FEmpName,
"FStartTime":el.FStartTime,
"isChoose":false
}
_self.onWorkWorkerList.push(arr)
})
}
}
}
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
scanWorkerCodeClick(){
let _self = this;
uni.scanCode({
success:function(res){
console.log(res);
_self.workerCode = res.result;
_self.searchBasicInfo(0)
}
})
},
searchBasicInfo(count){
let _self = this;
let requestParams = {
basicType:10,
basicNO:this.workerCode,
orgId:this.orgFItemID
};
this.$request.get('/SysConfigData/QueryResource',{
params:requestParams
}).then(res => {
// debugger
if(res && res.length>0){
// let data = res;
let data = {
"FID":res[0].FID,
"FNO":res[0].FNO,
"FName":res[0].FNAME,
"FPhoneID":res[0].FPhoneID?res.FPhoneID:'',
"FCOMPANYID":res[0].FCOMPANYID,
"isChoose":false
}
this.laidUtilFunction(data,1)
}else{
uni.showToast({
title:'人员不存在',
icon:'none'
})
return
}
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
//单个上岗员工
laidUtilFunction(data,laidType){
let _self = this;
// debugger
if(laidType){
if(laidType == 1){//上岗
//当前在岗员工
let currOnLaidList = this.onWorkWorkerList;
let repeatCurrOnList = currOnLaidList.find(function(el){
return el.FEmpNumber == data.FNO
})
if(!repeatCurrOnList){
if(this.selectedWorkerList.length>0){
let repeatSelList = this.selectedWorkerList.find(function(el){
return el.FNO == data.FNO
})
if(!repeatSelList){
this.selectedWorkerList.push(data);
}else{
uni.showToast({
title:'员工已选择,不可重复选择',
icon:'none'
})
return
}
}else{
this.selectedWorkerList.push(data);
}
}else{
uni.showToast({
title:'员工已在岗,不可重复上岗',
icon:'none'
})
return
}
}
if(laidType ==2){//下岗
//当前在岗员工
let currOnLaidList = this.onWorkWorkerList;
let repeatCurrOnList = currOnLaidList.find(function(el){
return el.FEmpNumber == data.FNO
})
if(!repeatCurrOnList){
uni.showToast({
title:'员工未上岗,不可执行下岗',
icon:'none'
})
return
}else{
if(this.selectedWorkerList.length>0){
let repeatSelList = this.selectedWorkerList.find(function(el){
return el.FNO == data.FNO
})
if(!repeatSelList){
this.selectedWorkerList.push(data);
}else{
uni.showToast({
title:'员工已选择,不可重复选择',
icon:'none'
})
return
}
}else{
this.selectedWorkerList.push(data);
}
}
}
}
},
//班组批量上岗员工
lotLaidUtilFunction(laidType){
let _self = this;
if(laidType){
if(laidType == 1){//上岗
//当前在岗员工
let currOnLaidList = this.onWorkWorkerList;
//通过班组选择的员工
let teamSelectedWorkerList = this.selectedWorkerList;
for (let i = 0; i < teamSelectedWorkerList.length; i++) {
for (let j = 0; j < currOnLaidList.length; j++) {
if(teamSelectedWorkerList.length>0){
if(teamSelectedWorkerList[i].FNO == currOnLaidList[j].FEmpNumber){
teamSelectedWorkerList.splice(i,1)
}
}
}
}
this.selectedWorkerList = teamSelectedWorkerList;
if(this.selectedWorkerList == 0){
uni.showToast({
title:'当前班组员工全部在岗',
icon:'none'
})
}
}
}
},
//选择下岗人员
selAllClick(){
if(this.onWorkWorkerList.length>0){
this.selAll = !this.selAll;
if(this.selAll){
this.onWorkWorkerList.forEach(
function(el){
el.isChoose = true;
}
)
this.selectedOffWorkList = this.onWorkWorkerList;
}else{
this.onWorkWorkerList.forEach(
function(el){
el.isChoose = false;
}
)
this.selectedOffWorkList = [];
}
}
},
selClick(item,index){
item.isChoose = !item.isChoose;
this.selectedOffWorkList = this.onWorkWorkerList.filter(function(el){
return el.isChoose == true
})
if(this.selectedOffWorkList.length == this.onWorkWorkerList.length){
this.selAll = true
}else{
this.selAll = false
}
},
//班组/班次
teamSelClick() {
this.showSecGrayLayer = true;
this.showTeamList = true;
},
teamItemSel(item) {
this.selectedWorkerList = [];
this.teamSelected = item.FName;
this.teamNOSelected = item.FNO;
this.currReportTeamNO = item.FNO;
this.getTeamFromEmp(0,item)
this.showSecGrayLayer= false,
this.showTeamList = false;
},
teamRowSelClick() {
this.showSecGrayLayer = true;
this.showTeamRowList = true;
},
teamRowItemSel(item) {
this.teamRowSelected = item.FName;
this.teamRowNOSelected = item.FNO;
this.currReportTeamRowNO = item.FNO;
this.showSecGrayLayer= false,
this.showTeamRowList = false;
},
getTeamFromEmp(count,item){
let _self = this;
let params;
let tokenpara = uni.getStorageSync('token');
this.$request.get('/ReportInfoLoad/GetTeamFromEmp',{
params:{
"basicNO": item.FNO,
"basicType": 1
}
}).then(res => {
if(res){
let data = res;
this.selectedWorkerList = [];
data.forEach(
function(el){
let arr = {
"FID":el.FID,
"FNO":el.FNO,
"FName":el.FNAME,
"FPhoneID":el.FPhoneID?el.FPhoneID:'',
"FCOMPANYID":el.FCOMPANYID,
"isChoose":false
}
_self.selectedWorkerList.push(arr)
}
)
this.lotLaidUtilFunction(1)
}
}).catch(err => {
errorUtil.handle(err);
});
},
// 注销
finishedClick(item,index){
let _self = this;
let reLoadReportSystemParam = uni.getStorageSync('reLoadReportSystemParam');
this.currReportIndex = index;
if(reLoadReportSystemParam.FIsCloseToReport){
if(this.reportList[this.currReportIndex].RunType == 4){
this.CheckInspectionStatus(0);
}else{
if(this.reportList[this.currReportIndex].RunType == 1){
uni.showToast({
title:'未换型',
icon:'none'
})
return
}
if(this.reportList[this.currReportIndex].RunType == 2){
uni.showToast({
title:'未调机',
icon:'none'
})
return
}
if(this.reportList[this.currReportIndex].RunType == 3){
uni.showToast({
title:'首检中',
icon:'none'
})
return
}
}
}else{
this.showFinishedWindow = true;
this.showGrayLayer = true;
}
},
finishedCancelClick(){
this.showFinishedWindow = false;
this.showGrayLayer = false;
},
finishedConfirmClick(){
let _self = this;
this.reportList.forEach(
function(el,index){
if(_self.currReportIndex == index){
el.disableFinished = true;
}
}
)
this.ProcessAllCancel(0);
this.showFinishedWindow = false;
this.showGrayLayer = false;
},
ProcessAllCancel(count){
let _self = this;
let requestParams;
requestParams = {
"phoneID":this.macAddress,
"resource":this.reportList[this.currReportIndex].ResourcesNO,
"reportID":this.reportList[this.currReportIndex].FReportID,
"fCode":this.reportList[this.currReportIndex].FCode
};
this.$request.post('/ReportProduce/ProcessAllCancel',requestParams).then(res => {
let data = res;
this.reloadHisReport(false,2)
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
//检查检验状态
CheckInspectionStatus(count){
let _self = this;
let requestParams;
this.$request.get('/ReportProduce/CheckInspectionStatus',{
params:{
phoneID:this.macAddress,
resource:this.reportList[this.currReportIndex].ResourcesNO
}
}).then(res => {
let data = res;
this.acceptQty = '';
this.defultQty = '';
this.defultResone = '';
this.FPassQty = '';
this.FBadQty = '';
this.submitDefultList = [];
this.showGrayLayer = true;
this.showReportEdit = true;
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
// bottomBar
// mainSelectF(){
// uni.redirectTo({
// url:'../home/home'
// })
// },
// reportSelectF(){
// console.log('')
// },
// safeAlterSelectF(){
// uni.redirectTo({
// url:'../safeAlter/safeAlter'
// })
// },
// mySelectF(){
// uni.redirectTo({
// url:'../myinfo/myinfo'
// })
// },
workStageClick(item){
uni.setStorageSync('singelResourceInfo',item);
uni.navigateTo({
url:'../../views/O3RP01/reportWorkStage'
})
},
delItem:function(item,index,count){
let _self = this;
let params;
let delNO = [item.ResourcesNO];
let tokenpara = uni.getStorageSync('token');
params = {
"data":delNO,
"phoneID":this.macAddress
};
this.$request.post('/ReportInfoLoad/DeleteResources',params).then(res => {
this.reportList.splice(index,1);
this.leftStyle = 0;
uni.showToast({
title:"删除成功",
icon:'none'
})
this.$forceUpdate();
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
// 开始移动时
touchS($event,index) {
// startX记录开始移动的位置
console.log($event);
console.log(index);
this.currIndex = index;
if($event.touches.length === 1) {
this.startX = $event.touches[0].clientX;
}
// hiddenFlag为true则是从右向左,为false则是从左向右
if(this.leftStyle === 0) {
this.hiddenFlag = true;
} else {
this.hiddenFlag = false;
}
},
touchM($event,index) {
if($event.touches.length === 1) {
//手指移动时水平方向位置
const moveX = $event.touches[0].clientX;
this.moveFunc(moveX);
}
},
touchE($event,index) {
const { leftStyle } = this;
const { delBtnWidth } = this;
// 如果停止滑动的距离大于二分之一则直接弹出删除按钮,不然则left为0
if(-leftStyle > delBtnWidth/2) {
this.leftStyle = -delBtnWidth;
} else {
this.leftStyle = 0;
}
},
moveFunc(moveX) {
// 原始位置向左,leftStyle为小于0;原始位置向右,leftStyle为大于0
// disX为相对最初位置的左右距离
// 大于0为向右,小于0为向左
const disX = moveX - this.startX;
const delBtnWidth = this.delBtnWidth;
let offsetNum = 0;
if(-disX >= delBtnWidth && this.leftStyle === -delBtnWidth) {
return;
}
console.log(disX, this.hiddenFlag);
// this.hiddenFlag为true则是从左到右,则应该将container向左移动
// this.hiddenFlag为false则是从右向左,则应该将container向右移动
if(this.hiddenFlag) {
// 此时container为最右边,则应该将container向左移动
// disX大于0为相对原始位置的向右移动,则直接将offsetNum置为0
// 否则为向左移动,offsetNum为disX相反的值,判断是否超过设置的最大位置
if(disX == 0 || disX > 0) {
offsetNum = 0;
} else {
offsetNum = disX;
if (disX <= -delBtnWidth) {
//控制手指移动距离最大值为删除按钮的宽度
offsetNum = -delBtnWidth;
}
}
} else {
// 此时container为最左边,应该向右移动
// disX小于0为相对原始位置的向左移动,则直接将offsetNum置为-this.delBtnWidth
// 否则为相对原始位置的向右移动,此时应该将最大位置与向右位置的差值为此刻位置,判断是否为大于0
if(disX < 0) {
offsetNum = -this.delBtnWidth;
} else {
offsetNum = -this.delBtnWidth + disX;
if(offsetNum > 0) {
offsetNum = 0;
}
}
}
this.leftStyle = offsetNum;
}
}
}
</script>
<style>
page{background-color: #F7F7F7;}
.content{overflow-x: hidden;}
.list-card-Info-item{display: flex;flex-direction: column;align-items: flex-start;width: 50%;}
.list-card-Info-item-text{width: 100%;}
.list-card-Info-item-text span{width: 100%;}
.window-content-item{margin: 0 auto 40rpx; }
.window-content-item-list{height: 60rpx;line-height: 60rpx;width: 140rpx;font-size: 28rpx;border: 2rpx solid #e2e2e2;
border-radius: 14rpx;margin-left: 20rpx;flex-shrink: 0;
font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;text-align: center;color: #888888;background-color: #FFFFFF;}
.window-content-item-list-click{height: 60rpx;line-height: 60rpx;width: 140rpx;font-size: 28rpx;border: 2rpx solid #e2e2e2;
border-radius: 14rpx;margin-left: 20rpx;flex-shrink: 0;
font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;text-align: center;color: #FFFFFF;background-color: #0a7aff;}
.alter-window-content-item{margin: 0 auto 40rpx; display: flex; flex-direction: row; justify-content:flex-start; width: 400px;
flex-wrap: wrap;}
.alter-window-content-item-list-click{height: 60rpx;line-height: 60rpx;width: 140rpx;font-size: 28rpx;border: 2rpx solid #e2e2e2;
border-radius: 14rpx;margin-left: 20rpx;flex-shrink: 0;
font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;text-align: center;color: #FFFFFF;background-color: #0a7aff;}
.alter-window-content-item-list{height: 60rpx;line-height: 60rpx;width: 140rpx;font-size: 28rpx;border: 2rpx solid #e2e2e2;
border-radius: 14rpx;margin-left: 20rpx;flex-shrink: 0;
font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;text-align: center;color: #888888;background-color: #FFFFFF;}
.list-card-Info-table{display: flex;flex-direction: row;align-items: center;height: 64rpx;overflow: hidden;width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;}
.list-card-Info-item-table uni-text{margin-bottom: 0;overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;}
.list-card-Info-item-table{width: 32%;}
.selected-worker-item{display: flex;flex-direction: row;align-items: center;height: 50rpx;background-color: #E9E9E9;
padding: 0 24rpx;margin-right: 32rpx;margin-bottom: 24rpx;border-radius: 50rpx;}
.selected-worker-item view{height: 50rpx;line-height: 50rpx;}
.bottom_select-head-confirm-text{height: 80rpx;line-height: 80rpx;width: 200rpx;font-size: 32rpx;text-align: center;color: #0184ff;}
.window-content-item-zx{display: flex;flex-direction: row;align-items: center;height: 72rpx;margin:0 70rpx 24rpx 70rpx;position: relative;}
.window-content-item-zx text{width: 140rpx;font-size: 28rpx;font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;text-align: right;color: #727171;}
.window-content-item-zx view{height: 72rpx;line-height: 72rpx;margin-left: 20rpx;font-size: 28rpx;background: #e9e9e9;border: 1px solid rgba(60,60,67,0.29);border-radius: 12rpx;
font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: #727171;flex-grow: 1;padding: 0 16rpx;}
.window-content-item-zx input{height: 72rpx;margin-left: 20rpx;font-size: 28rpx;background: #FFFFFF;border: 1px solid rgba(60,60,67,0.29);border-radius: 12rpx;
font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: #727171;flex-grow: 1;padding: 0 16rpx;}
.list-card-Info-table-zx{display: flex;flex-direction: row;align-items: center;justify-content: space-between;height: 64rpx;margin: 0 32rpx;}
.list-card-Info-item-table-zx uni-text{margin-bottom: 0;}
.list-card-Info-item-table-zx span{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;word-break: break-all;}
.bottom-select-list-item{overflow: hidden;text-overflow:ellipsis;}
</style>