Newer
Older
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {ServeService} from "../../serve.service";
import {CommonService} from "../../../../provide/common.service";
@Component({
selector: 'page-goods-verify',
templateUrl: 'goods-verify.html',
})
export class GoodsVerifyPage {
changeType = 1;
doneList = [];
noList = [];
constructor(public navCtrl: NavController, public navParams: NavParams, private appMainSer: AppMainService,
private serveSer: ServeService, private commonSer: CommonService) {
}
ionViewDidLoad() {
this.footerView = true;
//获取权限
this.appMainSer.role.subscribe(value => {
this.role = value;
console.log(value);
if (this.role.includes(1)) { //内勤
this.type = 1;
this.params = 2;
}
if (this.role.includes(6)) { //耗材管理员
this.type = 2;
this.params = 3;
}
this.getUnsubmit();
}
);
//获取个人信息
this.appMainSer.mineInfo.subscribe(value => {
this.mineInfo = value;
})
this.changeType = 1;
this.footerView = true;
const data = {
P_pageNumber: 1,
};
this.serveSer.searchUnsubmit(data).subscribe(
(res) => {
this.noList = res.list;
}
)
}
getSubmited() {
this.changeType = 2;
this.footerView = false;
const data = {
P_pageNumber: 1,
//待领取
getDelivery() {
this.changeType = 3;
this.footerView = false;
const data = {
P_pageNumber: 1,
type: this.type,
};
this.serveSer.searchDelivery(data).subscribe(
(res) => {
this.deliveryList = res.list;
}
)
}
delivery(item) {
const data = {
idStr: item.id
};
this.commonSer.alert("确定发放?", () => {
this.serveSer.delivery(data).subscribe(
(res) => {
this.getDelivery();
this.getSubmited();
}
)
});
}
if(this.changeType == 1) this.getUnsubmit();
if(this.changeType == 2) this.getSubmited();
if(this.changeType == 3) this.getDelivery();
timer(1000).subscribe(() => e.complete());
}
doInfinite(e) {
e.complete()
}
//单选
changeCheck(goods) {
const index = this.chooseObj.indexOf(goods.id);
if (index > -1) {
this.chooseObj.splice(index, 1);
} else {
this.chooseObj.push(goods.id);
}
}
//全选
selectAll(e) {
this.chooseObj = [];
if (e == false) {
this.noList.forEach(e => {
e.checkbox = false;
})
} else {
this.noList.forEach(e => {
e.checkbox = true;
this.chooseObj.push(e.id);
})
}
}
//提交
submit(operateFlag) {
const data = {
idStr: this.chooseObj.join(','),
operateFlag: operateFlag,
};
let msg = operateFlag == 1 ? '确定通过所选申请' : '确定退回所选申请';
this.commonSer.alert(msg, () => {
(res) => {
this.getSubmited();
this.getUnsubmit();
}
)
})
goDetail(item) {
this.navCtrl.push(OrderDetailPage, {id: item.id});