Files

312 lines
8.4 KiB
Vue
Executable File
Raw Permalink 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="container" style="background-color: #F0F0F0;">
<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="search">
<!-- <text class="search-title">备件搜索:</text> -->
<input class="search-input" placeholder="输入备件名称" v-model="sparePartName" focus="focus"
@confirm="partSearch(sparePartName)"></input>
<image class="search-img" style="height: 40rpx;width: 40rpx;position: absolute;top: 20rpx;"
src="../../../static/emapp/scan.png" @click="scanClick()"></image>
</view>
<view class="card-list" v-for="(i,k) in dataList" :key='k'>
<view class="card-info">
<view class="card-info-title">
<view class="card-info-item">
<text class="card-info-title-text-left">备件名称:</text>
<text class="card-info-title-text-detail-left">{{i.FName}}</text>
</view>
</view>
<!-- <view class="card-info-item">
<text class="card-info-item-text">点检名称:</text>
<text class="card-info-item-text-detail">{{i.FName}}</text>
</view> -->
<view class="card-info-item">
<text class="card-info-item-text">备件代码:</text>
<text class="card-info-item-text-detail">{{i.FBillNO}}</text>
</view>
<view class="card-info-item">
<text class="card-info-item-text">规格型号:</text>
<text class="card-info-item-text-detail">{{i.FEqModel}}</text>
</view>
<view class="card-info-item">
<text class="card-info-item-text">库存数量:</text>
<text class="card-info-item-text-detail">{{i.FQty}}</text>
</view>
</view>
</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: {
...mapState(['userInfo'])
},
onLoad(options) {
if(options.item && options.item.length>0){
this.pageKey = options.item;
}
this.userID = this.userInfo.ID;
this.orgid = uni.getStorageSync('orgid');
this.getPartList(this.sparePartName);
this.getOrgList()
},
data() {
return {
dialogNoticeContent:'',
dialogNoticeTitle:'',
dialogNoticeType:'',
showDialog:false,
focus:true,
dataList: [],
orgid:'',
commitList:[],
userID:'',
pageKey:'',
sparePartName:'',
isShowOrg:true
};
},
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'
})
},
scanClick:function(){
let _self = this;
let count = '';
uni.scanCode({
success:function(res){
_self.sparePartName = res.result;
_self.getPartList(_self.sparePartName);
}
})
},
partSearch:function(sparePartName){
this.getPartList(sparePartName);
},
getPartList(sparePartName){
let requestParams = {
"basicType":0,
"equipID":'',
"sparePartName":sparePartName,
};
this.$request.get('/SparePart/GetSparePart',{params:requestParams}).then(res => {
let _self = this;
let data = res
_self.dataList = [];
if(data && data.length>0){
_self.dataList = data.map(
function(el){
return {
FBillNO:el.FBILLNO,
FName:el.FNAME,
FEqModel:el.FEQMODEL,
FCount:el.FCount,
FItemID:el.FINTERID,
num:0,
minForbidden:true,
FQty:el.FQTY
};
}
);
}
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
},
}
</script>
<style lang="scss">
page{
background-color: #F0F0F0;
}
.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>
</style>