218 lines
6.4 KiB
Vue
218 lines
6.4 KiB
Vue
|
<template>
|
|||
|
<view class="page">
|
|||
|
<view class="box" v-if="listCards&&listCards.length>0">
|
|||
|
<view v-for="(item,index) in listCards" :key="index" class="people-box myContainer myContentBox" @click="toDetail(index,item)">
|
|||
|
<view class="name_">{{item.typeName}}</view>
|
|||
|
<view class="user_container">
|
|||
|
<img src="../../static/img/home.png">
|
|||
|
<view class="username">{{item.id}}</view>
|
|||
|
</view>
|
|||
|
<view class="user_container">
|
|||
|
<img src="../../static/img/task.png">
|
|||
|
<view class="username">{{item.supplierName}}</view>
|
|||
|
</view>
|
|||
|
<uni-icons type="checkbox-filled" size="20" :color="item.checked?'#3699FF':'#CECECE'" class="checkbox-filled" ></uni-icons>
|
|||
|
</view>
|
|||
|
<uni-load-more :status="loading_status" ></uni-load-more>
|
|||
|
</view>
|
|||
|
<view class="box" v-else>
|
|||
|
<xinsoft-no-record noRecordContent="暂无满足条件的内容,请输入关键字重新搜索" ></xinsoft-no-record>
|
|||
|
</view>
|
|||
|
<view class="goHome" @click='goMain()'>
|
|||
|
<img src="../../static/img/gohome.png">
|
|||
|
</view>
|
|||
|
<mpvue-picker ref="mpvuePicker" mode="multiLinkageSelector" :deepLength="deepLength" :pickerValueDefault="[0,0]"
|
|||
|
@onConfirm="pickerConfirm" :pickerValueArray="deptArray"></mpvue-picker>
|
|||
|
</view>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
import mpvuePicker from '@/components/mpvue-picker/mpvuePicker.vue';
|
|||
|
import devBlock from '@/components/xinsoft-dev-block/xinsoft-dev-block.vue'
|
|||
|
import uniIcons from '@/components/uni-icons/uni-icons.vue'
|
|||
|
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
|||
|
import xinsoftNoRecord from '@/components/xinsoft-no-record/xinsoft-no-record.vue';
|
|||
|
export default {
|
|||
|
components: {
|
|||
|
devBlock,
|
|||
|
uniIcons,
|
|||
|
uniLoadMore,
|
|||
|
mpvuePicker,
|
|||
|
xinsoftNoRecord
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
id:"",
|
|||
|
listCards: [],
|
|||
|
pagenumber:1,//当前第几页
|
|||
|
pagesize:20,//每页加载数据条数
|
|||
|
loading_status: 'more',//more(loading前)、loading(loading中)、noMore(没有更多了)
|
|||
|
deepLength:2,
|
|||
|
deptArray:[],
|
|||
|
selectPeopleArray :[],
|
|||
|
dispatchItemId: '',
|
|||
|
currentIndex: '',
|
|||
|
code: '',
|
|||
|
}
|
|||
|
},
|
|||
|
onShow(){
|
|||
|
},
|
|||
|
created() {
|
|||
|
this.getDateList();
|
|||
|
},
|
|||
|
onLoad(option) {
|
|||
|
this.dispatchItemId = option.dispatchItemId;
|
|||
|
this.code = option.code
|
|||
|
this.currentIndex = option.currentIndex
|
|||
|
},
|
|||
|
//滚动到底部加载下一页
|
|||
|
onReachBottom(obj){
|
|||
|
if(this.loading_status=='noMore'){
|
|||
|
return false;
|
|||
|
}
|
|||
|
this.pagenumber++;
|
|||
|
this.getDateList();
|
|||
|
},
|
|||
|
//下拉刷新
|
|||
|
onPullDownRefresh(){
|
|||
|
this.listCards=[];
|
|||
|
this.pagenumber=1;
|
|||
|
this.loading_status="more";
|
|||
|
this.getDateList();
|
|||
|
|
|||
|
},
|
|||
|
methods: {
|
|||
|
//获取列表数据
|
|||
|
getDateList(){
|
|||
|
this.loading_status="loading";
|
|||
|
var filterRes = {};
|
|||
|
filterRes.pageno = this.pagenumber;
|
|||
|
filterRes.pagesize = this.pagesize;
|
|||
|
this.$http.request({
|
|||
|
url: '/apis/materiel/list',
|
|||
|
params: filterRes,
|
|||
|
method:"GET"
|
|||
|
}).then(res => {
|
|||
|
uni.stopPullDownRefresh();
|
|||
|
if(!res.data.data){
|
|||
|
this.loading_status="noMore";
|
|||
|
}else if(res.data.data.datas.length<this.pagesize){
|
|||
|
this.loading_status="noMore";
|
|||
|
}else{
|
|||
|
this.loading_status="more";
|
|||
|
}
|
|||
|
|
|||
|
if (res.data.code == 0) {
|
|||
|
for(var i=0;i<res.data.data.datas.length;i++){
|
|||
|
res.data.data.datas[i].checked=false;
|
|||
|
}
|
|||
|
this.listCards = this.listCards.concat(res.data.data.datas);
|
|||
|
}
|
|||
|
}).catch(err => {
|
|||
|
this.loading_status="noMore";
|
|||
|
});
|
|||
|
},
|
|||
|
showSinglePicker() {
|
|||
|
this.$refs.mpvuePicker.show()
|
|||
|
},
|
|||
|
pickerConfirm(e){
|
|||
|
var value = e.value;
|
|||
|
this.deptResult.value = value[1]?value[1]:value[0];
|
|||
|
var name = e.label;
|
|||
|
if(!value[1]){
|
|||
|
name = name.substring(0,name.length-2);
|
|||
|
}
|
|||
|
this.deptResult.name = name;
|
|||
|
this.listCards=[];
|
|||
|
this.pagenumber=1;
|
|||
|
this.loading_status="more";
|
|||
|
this.getDateList();
|
|||
|
|
|||
|
},
|
|||
|
|
|||
|
//点击事件
|
|||
|
toDetail(index,item){
|
|||
|
// console.log(this.listCards)
|
|||
|
for(var i=0;i<this.listCards.length;i++){
|
|||
|
this.listCards[i].checked=false;
|
|||
|
}
|
|||
|
this.listCards[index].checked=true;
|
|||
|
},
|
|||
|
},
|
|||
|
onNavigationBarButtonTap(obj) {
|
|||
|
var userArray=[];
|
|||
|
for(var i=0;i<this.listCards.length;i++){
|
|||
|
if(this.listCards[i].checked){
|
|||
|
var myJson = {
|
|||
|
materialId :this.listCards[i].id,
|
|||
|
typeName:this.listCards[i].typeName,
|
|||
|
unitUomName:this.listCards[i].unitUomName,
|
|||
|
supplierName:this.listCards[i].supplierName,
|
|||
|
specification:this.listCards[i].specification,
|
|||
|
}
|
|||
|
userArray.push(myJson);
|
|||
|
}
|
|||
|
}
|
|||
|
if(userArray.length ==0){
|
|||
|
uni.showToast({
|
|||
|
title: '请选择物料',
|
|||
|
duration: 2000,
|
|||
|
icon:"none"
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
var _this=this;
|
|||
|
// this.$http.request({
|
|||
|
// url: '/apis/repairEvent/reventTurnToSend',
|
|||
|
// params: {
|
|||
|
// eventId:_this.id,
|
|||
|
// userId:userArray[0].userId
|
|||
|
// }
|
|||
|
// }).then(res => {
|
|||
|
// if (res.data.code == 0) {
|
|||
|
// uni.showToast({
|
|||
|
// title: res.data.msg,
|
|||
|
// duration: 2000,
|
|||
|
// icon:"none"
|
|||
|
// });
|
|||
|
// setTimeout( function(){
|
|||
|
// uni.redirectTo({
|
|||
|
// url: 'repairDetail?id='+_this.id
|
|||
|
// });
|
|||
|
// },1000)
|
|||
|
// }
|
|||
|
// }).catch(err => {
|
|||
|
// uni.showToast({
|
|||
|
// title: '操作失败',
|
|||
|
// duration: 1000,
|
|||
|
// icon:"none"
|
|||
|
// });
|
|||
|
// });
|
|||
|
|
|||
|
var arrays = userArray[0];
|
|||
|
|
|||
|
//新增。
|
|||
|
var materialCollectInfo = uni.getStorageSync('materialCollectInfo');
|
|||
|
if(!materialCollectInfo){
|
|||
|
materialCollectInfo = {}
|
|||
|
}
|
|||
|
this.$set(materialCollectInfo[this.currentIndex],'materialId',userArray[0].materialId);
|
|||
|
this.$set(materialCollectInfo[this.currentIndex],'typeName',userArray[0].typeName);
|
|||
|
this.$set(materialCollectInfo[this.currentIndex],'unitUomName',userArray[0].unitUomName);
|
|||
|
this.$set(materialCollectInfo[this.currentIndex],'supplierName',userArray[0].supplierName);
|
|||
|
this.$set(materialCollectInfo[this.currentIndex],'specification',userArray[0].specification);
|
|||
|
var _this = this
|
|||
|
uni.setStorage({
|
|||
|
key: 'materialCollectInfo',
|
|||
|
data: materialCollectInfo,
|
|||
|
success: function () {
|
|||
|
uni.navigateTo({
|
|||
|
url: 'materialCollect?dispatchItemId='+_this.dispatchItemId+"&code="+_this.code
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
// }
|
|||
|
}
|
|||
|
}
|
|||
|
</script>
|