Files
GX.O3.WMS/APK/APP_O3/pages/views/EQUM08/EQUM08.vue
T

803 lines
25 KiB
Vue
Executable File

<template>
<view class="page">
<opsoft-dialog-notice
:dialogNoticeShow="showDialog"
:dialogNoticeType="dialogNoticeType"
:dialogNoticeTitle="dialogNoticeTitle"
:dialogNoticeContent="dialogNoticeContent"
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
>
</opsoft-dialog-notice>
<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="gray-layer" v-show="showLayer" @click="layerClick"></view>
<view class="order-title">领用信息</view>
<view class="head" style="padding: 0 32rpx;">
<view class="search">
<text class="search-title">供应商</text>
<view class="active-input">
<input class="search-input" placeholder="选择供应商" placeholder-class="placeholder-class-input"
v-model="supplyName" disabled="true" @click="supplyClick()"></input>
<scroll-view class="active-list" scroll-y="true" v-show="showSupply">
<view class="order-title">选择供应商</view>
<view class="active-list-item" v-for="(item, index) in supplyList" @click="supplyNameClick(item)">{{item.FNAME}}({{item.FNO}})</view>
</scroll-view>
</view>
<image class="search-img" src="../../../static/myinfo/right-arrow.png" @click="supplyClick()"></image>
</view>
<view class="search">
<text class="search-title">设备</text>
<view class="active-input">
<input class="search-input" placeholder="选择设备" placeholder-class="placeholder-class-input"
v-model="equipName" disabled="true" @click="equipmentClick()"></input>
<scroll-view class="active-list" scroll-y="true" v-show="showEquipment">
<view class="order-title">选择设备</view>
<view class="active-list-item" v-for="(item, index) in equipList" @click="equipNameClick(item)">{{item.FNAME}}({{item.FNO}})</view>
</scroll-view>
</view>
<image class="search-img" src="../../../static/myinfo/right-arrow.png" @click="equipmentClick()"></image>
</view>
<view class="search">
<text class="search-title">领用类型</text>
<view class="active-input">
<input class="search-input" placeholder="选择领用类型" placeholder-class="placeholder-class-input"
v-model="storageTypeName" disabled="true" @click="storageTypeClick()"></input>
<scroll-view class="active-list" scroll-y="true" v-show="showStorageType">
<view class="order-title">选择领用类型</view>
<view class="active-list-item" v-for="(item, index) in partStorageTypeList" @click="storageTypeNameClick(item)">{{item.FNAME}}({{item.FNO}})</view>
</scroll-view>
</view>
<image class="search-img" src="../../../static/myinfo/right-arrow.png" @click="storageTypeClick()"></image>
</view>
<view class="search">
<text class="search-title">领用编号</text>
<input class="search-input" placeholder="输领用编号" v-model="Fnumber" placeholder-class="placeholder-class-input"></input>
</view>
</view>
<view class="add-part-area">
<view class="add-part-title">备件列表</view>
<view class="card-info-item">
<image class="add-part-img" src="../../../static/icon/plus.png" @click="addSpart()" style="height: 40rpx;width: 40rpx;"></image>
<text class="add-part-text">添加</text>
</view>
</view>
<view class="sapre-body">
<scroll-view class="scroll-area" scroll-y="true" :style="{'height':scrollHeightPart}">
<view class="card-list-container" @touchstart="touchS($event,index)"
@touchmove="touchM($event,index)" @touchend="touchE($event,index)"
:style="{'left': (currIndex==index?leftStyle + 'rpx':'')}" v-for="(item, index) in selectPartList" :key="index">
<view class="card-list">
<view style="display: flex;flex-direction: row;align-items: center;">
<image class="img-left-large" src="../../../static/emapp/part.png"></image>
<view>
<view class="card-info-item" style="justify-content: space-between;width: 100%;">
<text class="card-info-title-text-left">{{item.FName}}</text>
</view>
<view style="display: flex;flex-direction: row;justify-content: space-between;width: 100%;">
<view class="card-info-item">
<text class="card-info-title-text-left">出库单价</text>
<input v-model="item.FAddStoragePrice" type="number"
style="border: #D8D8D8 solid 1px;border-radius: 10rpx; width: 100rpx;text-align: center;margin-left: 20rpx;padding: 0 10rpx;"/>
</view>
<view class="card-info-item">
<text class="card-info-title-text-left">领用数量</text>
<input v-model="item.FAmount" type="number" @input="FAmountInput(item)"
style="border: #D8D8D8 solid 1px;border-radius: 10rpx; width: 100rpx;text-align: center;margin-left: 20rpx;padding: 0 10rpx;"/>
</view>
</view>
<view class="card-info-item">
<text class="card-info-item-text">库存数量</text>
<view class="card-info-item-text-detail">
<view style="margin-left: 20rpx;">{{item.FQty}}</view>
</view>
</view>
<view class="card-info-item" style="width: 100%;">
<text class="card-info-title-text-left">备注</text>
<input v-model="item.FNote" type="text"
placeholder="输入备注" placeholder-style="color: #D8D8D8;font-size:26rpx"
style="border: #D8D8D8 solid 1px;border-radius: 10rpx;margin-left: 20rpx;padding: 0 10rpx;width: 100%;"/>
</view>
</view>
</view>
</view>
<view class="delete-icon" @click="delItem(index)">
删除
</view>
</view>
<!-- <view style="height: 80rpx;width: 100%;"></view> -->
</scroll-view>
</view>
<view class="sapre-all-list" v-show="showPartList">
<scroll-view class="scroll-area" scroll-y="true" :style="{'height':partListHeigh}">
<view class="card-list" v-for="(i, k) in partList" style="display: flex;flex-direction: row;align-items: center;">
<image class="img-left-large" src="../../../static/emapp/part_storage.png" style="margin-left: 32rpx;" v-if="i.isChoose"></image>
<image class="img-left-large" src="../../../static/emapp/part_storage_gray.png" style="margin-left: 32rpx;" v-if="!i.isChoose"></image>
<view class="card-info">
<view class="card-info-item" style="justify-content: space-between;">
<text class="card-info-item-text-detail">{{i.FName}}({{i.FNO}})</text>
<view class="card-info-item-text" style="text-align: end;">
<checkbox value="cb" :checked="i.isChoose" @click="selectPart(i)"
style="transform:scale(0.7)" />
</view>
</view>
<view class="card-info-item">
<text class="card-info-item-text">出库单价</text>
<view class="card-info-item-text-detail">
<input v-model="i.FAddStoragePrice" type="number" :disabled="!i.isChoose" :class="[i.isChoose?'input-blue':'input-gray']"/>
</view>
</view>
<view class="card-info-item">
<text class="card-info-item-text">领用数量</text>
<view class="card-info-item-text-detail">
<input v-model="i.FAmount" type="number" :disabled="!i.isChoose" @input="FAmountInput(i)" :class="[i.isChoose?'input-blue':'input-gray']"/>
</view>
</view>
<view class="card-info-item">
<text class="card-info-item-text">库存数量</text>
<view class="card-info-item-text-detail">
<view style="margin-left: 20rpx;">{{i.FQty}}</view>
</view>
</view>
<view class="card-info-item">
<text class="card-info-item-text">备注</text>
<view class="card-info-item-text-detail">
<input v-model="i.FNote" type="text" :disabled="!i.isChoose" :class="[i.isChoose?'input-blue':'input-gray']" style="width: 340rpx;"/>
<!-- <input v-model="i.FNote" type="text" :class="[i.isChoose?'input-blue':'input-gray']" style="width: auto;"/> -->
</view>
</view>
</view>
</view>
<view style="height: 80rpx;width: 100%;"></view>
</scroll-view>
<view class="btn-confirm" @click="selectPartConfirm">确定</view>
</view>
<view class="btn-confirm" @click="submit">领用提交</view>
</view>
</template>
<script>
import Vue from 'vue';
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import errorStrUntil from '@/common/errorStrUntil.js';
import {
mapState,
mapMutations
} from 'vuex';
export default {
computed: {
indicatorStyle() {
return {
background: 'rgba(255,0,0,.2)',
height: '40px',
};
},
...mapState(['userInfo'])
},
onLoad() {
const res = uni.getSystemInfoSync();
this.windowHeight = res.windowHeight;
this.scrollHeightPart = (this.windowHeight-300)+'px';
this.partListHeigh = (this.windowHeight-100)+'px';
this.getPartList()
this.getOrgList()
},
data() {
return {
dialogNoticeContent:'',
dialogNoticeTitle:'',
dialogNoticeType:'',
showDialog:false,
leftStyle: 0,
startX: 0,
hiddenFlag: true,
delBtnWidth: 220,
currIndex:'',
isShowOrg:true,
scrollHeightPart:'',
basicType:0, // basicType 必录 0=设备信息、1=故障类别、2=故障程度、3=设备部位、4=设备供应商、5=备件出入库类型
showLayer:false,
showSupply:false,
showEquipment:false,
showStorageType:false,
showPartList:false,
supplyList: [],
supplyName:'',
FSupplyID:'',
equipList: [],
equipName:'',
FEquipmentID:'',
partStorageTypeList: [],
storageTypeName:'',
FAddStorageTypeID:'', //入库类型
Fnumber:'', //入库编号
partList: [],
selectPartList:[],
};
},
components: {
opsoftDialogNotice
},
onBackPress(options) {
if(options.from === 'navigateBack'){
return false;
}
this.back();
return true;
},
methods: {
dialogNoticeConfirmClick(){
this.showDialog = false;
},
dialogNoticeProps(err,type){
err = errorStrUntil.handle(err);
this.showDialog = true;
this.dialogNoticeType = 'error';
this.dialogNoticeTitle = '异常提示';
if(type=='success'){
this.dialogNoticeType = 'success';
this.dialogNoticeTitle = '执行成功';
}
this.dialogNoticeContent = err;
},
getOrgList:function(){
let _self = this;
let orgInfo = uni.getStorageSync('orgInfo');
if(orgInfo && orgInfo.length > 0) {
let defaultOrgInfo = uni.getStorageSync('defaultOrgInfo');
let isOpenDefaultOrg = uni.getStorageSync('isOpenDefaultOrg');
if(!isOpenDefaultOrg){
this.orgFItemID = orgInfo[0].FINTERID;
}else{
if(defaultOrgInfo){
this.orgFItemID = defaultOrgInfo.FINTERID;
}else{
this.orgFItemID = orgInfo[0].FINTERID;
}
}
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;
}
},
orgChange:function(e){
console.log(this.orgArry)
this.index = e.target.value;
let isOpenDefaultOrg = uni.getStorageSync('isOpenDefaultOrg');
if(!this.orgArry[this.index].FItemID){
this.orgFItemID = "";
}else{
this.orgFItemID = this.orgArry[this.index].FItemID;
if(isOpenDefaultOrg){
uni.setStorageSync('defaultOrgInfo',this.orgArry[this.index]);
}
}
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(){
this.currentBarCodeInfo = new Object();
this.FInvenPlanNO = "";
this.FInvenPlanName = "";
this.currentBarCodeInfo.FBarcodeNumber = "";
this.currentBarCodeInfo.FItemNumber = "";
this.currentBarCodeInfo.FItemName = "";
this.currentBarCodeInfo.FAuxPropName = "";
this.currentBarCodeInfo.FQty = "";
this.currentBarCodeInfo.FLocation = "";
this.currentBarCodeInfo.FSCStockNumber = "";
this.currentBarCodeInfo.FSCSPNumber = "";
this.fQtyDisabled = true;
this.showResult = true;
this.fSCSPNumberDisabled = true;
this.scannedDataList = [];
this.totalData = [];
this.barcodeList = [];
this.commitList = [];
this.judgeCash();
this.$forceUpdate();
},
judgeCash:function(){
const cashValue = uni.getStorageSync('pageCash'+this.currentTranType+this.orgFItemID);
if(cashValue) {
if(cashValue.otherInfo.dbAlise == this.userInfo.dbAlise &&
cashValue.otherInfo.UserID == this.userInfo.UserID){
// this.showCashTips = true;
this.loadByCash();
}
}
},
back(){
uni.redirectTo({
url:'../../tabbar/apply/apply'
})
},
FAmountInput(item){
item.FAmount = parseInt(item.FAmount)
let storageQty = parseInt(item.FQty);
if(item.FAmount > storageQty){
uni.showModal({
title: '提示',
content:'领用数量不能大于库存数量',
showCancel:false,
success: function (res) {
if (res.confirm) {
item.FAmount = 0;
}
}
});
}
},
scanClick:function(){
let _self = this;
let count = '';
uni.scanCode({
success:function(res){
}
})
},
layerClick(){
this.showLayer = false;
this.showSupply = false;
this.showEquipment = false;
this.showStorageType = false;
this.showPartList = false;
},
addSpart(){
if(this.partList.length>0){
this.partList.forEach(e => {
e.isChoose = false;
e.FAddStoragePrice = '';
e.FAmount = '';
e.FNote = '';
})
}
this.showLayer = true;
this.showPartList = true;
},
getBasicData: function(){
let _self = this;
this.getEquipmentBasicData(0);
setTimeout(
function(){
_self.getEquipmentBasicData(4);
}, 1000);
setTimeout(
function(){
_self.getEquipmentBasicData(5);
}, 1000);
},
getEquipmentBasicData(basicType){
let _self = this;
this.basicType = basicType;
let requestParams = {
"basicType":this.basicType,
"type":-1,
"fNO":'',
"fName":'',
};
this.$request.get('/RepairOreder/GetEquipmentBasicData',{params:requestParams}).then(res => {
let data = res;
if(_self.basicType == 0){
_self.equipList = data;
}
if(_self.basicType == 4){
_self.supplyList = data;
}
if(_self.basicType == 5){
_self.partStorageTypeList = data;
}
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
supplyClick:function(){
this.showSupply = !this.showSupply;
if(this.showSupply){
this.showLayer = true;
this.getEquipmentBasicData(4);
}
else {
this.showLayer = false;
}
},
supplyNameClick:function(item){
this.showSupply = false;
this.showLayer = false;
this.supplyName = item.FNAME;
this.FSupplyID = item.FID;
},
equipmentClick:function(){
this.showEquipment = !this.showEquipment;
if(this.showEquipment){
this.showLayer = true;
this.getEquipmentBasicData(0);
}
else{
this.showLayer = false;
}
},
equipNameClick:function(item){
this.selectPartList = [];
this.showEquipment = false;
this.showLayer = false;
this.equipName = item.FNAME;
this.FEquipmentID = item.FID;
this.getPartList(this.FEquipmentID);
},
storageTypeClick:function(){
this.showStorageType = !this.showStorageType;
if(this.showStorageType){
this.showLayer = true;
this.getEquipmentBasicData(5);
}else{
this.showLayer = false;
}
},
storageTypeNameClick:function(item){
this.showStorageType = false;
this.showLayer = false;
this.storageTypeName = item.FNAME;
this.FAddStorageTypeID = item.FID;
},
getPartList(equipID){
let requestParams = {
"basicType":0,
"equipID":equipID? equipID: '',
"sparePartName":''
};
this.$request.get('/SparePart/GetSparePart',{params:requestParams}).then(res => {
let _self = this;
let data = res;
_self.partList = [];
if(data && data.length>0){
data.forEach(
function(el){
let arr = {
FName:el.FNAME,
FSparePartID:el.FINTERID,
FAmount:'',
FAddStoragePrice:'',
FNote:'',
isChoose:false,
FNO:el.FBILLNO,
FQty:el.FQTY
};
_self.partList.push(arr);
}
)
}
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
selectPart:function(item){
let _self = this;
item.isChoose = !item.isChoose;
},
selectPartListFunction(){
let _self = this;
this.partList.forEach(
function(el){
if(el.isChoose){
let arr = {
FName:el.FName,
FSparePartID:el.FSparePartID,
FAmount:parseInt(el.FAmount)?parseInt(el.FAmount):0,
FAddStoragePrice:parseFloat(el.FAddStoragePrice)?parseFloat(el.FAddStoragePrice):0,
FNote:el.FNote,
FNO:el.FBillNO,
FQty:el.FQty
}
_self.selectPartList.push(arr);
}
}
)
},
selectPartConfirm(){
this.showLayer = false;
this.showPartList = false;
this.selectPartListFunction();
},
submit:function(){
let _self = this;
let data = this.selectPartList;
if(this.selectPartList.length==0){
uni.showToast({
title:'请添加备件',
icon:'none'
})
return false
}
let flag = false;
flag = this.selectPartList.some(e => {
return e.FAmount == 0 || e.FAmount < 0;
})
if(flag){
uni.showToast({
title:'领用数量需大于0',
icon:'none'
})
return false
}
let requestParams = {
"basicType":1,
"data":{
"FSupplyID":this.FSupplyID,
"FEquipmentID":this.FEquipmentID,
"FAddStorageTypeID":this.FAddStorageTypeID,
"FNumber":this.Fnumber
},
"SData":data
};
this.$request.post('/SparePart/SparePartStorage',requestParams).then(res => {
let data = res;
// let arrlist = _self.partList.filter((item) =>{
// return !item.isChoose;
// });
// _self.partList = arrlist;
_self.selectPartList = [];
uni.showToast({
icon:'none',
title:'提交成功'
})
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
delItem:function(index){
this.selectPartList.splice(index,1);
this.leftStyle = 0;
uni.showToast({
title:"删除成功",
icon:'none'
})
this.$forceUpdate();
},
// 开始移动时
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 lang="scss">
page {
background-color: #F9F9F9;
overflow: hidden;
}
.search{padding: 10rpx 0;margin: 0 0;border-bottom: 1px solid #f9f9f9;}
.search-img{height: 28rpx;width: 28rpx;margin-top: 20rpx;}
.active-input{position: relative;width: 100%;padding-right: 32rpx;}
.placeholder-class-input{font-size: 30rpx;font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: #cacaca;}
.active-list{
position: fixed;
left: 0;
right: 0;
bottom: 0;
height: 50%;
border: #D8D8D8 solid 1px;
background-color: #FFFFFF;
border-radius: 10rpx;
z-index: 100;
}
.active-list-item{padding: 5rpx 10rpx;font-size: 30rpx;color: #666666;text-align: center;}
.add-part-area{display: flex;flex-direction: row;margin: 32rpx 32rpx 24rpx 32rpx;align-items: center;justify-content: space-between;}
.add-part-title{font-size: 28rpx;font-family: PingFangSC, PingFangSC-Semibold;font-weight: 600;color: #59595f;}
.add-part-img{width: 28rpx;height: 28rpx;margin-right: 14rpx;}
.add-part-text{font-size: 28rpx;font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: #2776ff;}
.card-list{display: flex;flex-direction: column;align-items: flex-start;padding: 0rpx 32rpx;margin: 10rpx 32rpx;border: #D8D8D8 solid 1px;}
.card-info-item{padding: 10rpx 0;}
.card-info-item-text{text-align: left;width: auto;}
.card-info-item-text-detail{}
.card-info-title-text-left{text-align: left;width: auto;}
.input-blue{border: #0184FF solid 1px;border-radius: 10rpx; width: 100rpx;text-align: center;
margin-left: 20rpx;padding: 0 10rpx;color: #0184FF;}
.input-gray{border: #D8D8D8 solid 1px;border-radius: 10rpx; width: 100rpx;text-align: center;
margin-left: 20rpx;padding: 0 10rpx;}
.sapre-all-list{
position: fixed;
top: 200rpx;
bottom: 80rpx;
left: 0;
right: 0;
background-color: #FFFFFF;
z-index: 100;
}
.card-list-container {position: relative;display: flex;flex-direction: column;}
.delete-icon {
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
right: -175rpx;
width: 130rpx;
height: 62rpx;
line-height: 62rpx;
border-radius: 31rpx;
font-weight: 500;
font-size: 32rpx;
text-align: center;
color: #FFFFFF;
background: #FF1C1C;
}
.header-row-class-organzie{
display: flex;
justify-content: flex-end;
align-items: center;
// padding-right: 50rpx;
}
.header-row-title-class-organzie{
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
}
.head-row-content-class-organzie{
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
}
.img-organzie{
height: 32rpx;
width: 32rpx;
margin-left: 24rpx;
}
</style>