|
@@ -78,7 +78,7 @@ export class UserData {
|
|
}, async err => {
|
|
}, async err => {
|
|
console.log(err);
|
|
console.log(err);
|
|
const toast = await this.toastCtrl.create({
|
|
const toast = await this.toastCtrl.create({
|
|
- message: err.error+err.url,
|
|
|
|
|
|
+ message: err.error + err.url,
|
|
duration: 1000,
|
|
duration: 1000,
|
|
position: 'top'
|
|
position: 'top'
|
|
});
|
|
});
|
|
@@ -105,23 +105,23 @@ export class UserData {
|
|
async getAppMenu(): Promise<any> {
|
|
async getAppMenu(): Promise<any> {
|
|
const token = await this.getToken();
|
|
const token = await this.getToken();
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
- from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/admin/menu/app`,
|
|
|
|
- {},
|
|
|
|
- { Authorization: `Bearer ${token}`,'Content-Type': 'application/json;charset=UTF-8' })).pipe(
|
|
|
|
- finalize(() => { })
|
|
|
|
- ).subscribe(async data => {
|
|
|
|
- // console.log(JSON.parse(data.data))
|
|
|
|
- resolve(JSON.parse(data.data).data)
|
|
|
|
- }, async err => {
|
|
|
|
- console.log(err);
|
|
|
|
- const toast = await this.toastCtrl.create({
|
|
|
|
- message: '查询目录失败',
|
|
|
|
- duration: 1000,
|
|
|
|
- position: 'top'
|
|
|
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/admin/menu/app`,
|
|
|
|
+ {},
|
|
|
|
+ { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' })).pipe(
|
|
|
|
+ finalize(() => { })
|
|
|
|
+ ).subscribe(async data => {
|
|
|
|
+ // console.log(JSON.parse(data.data))
|
|
|
|
+ resolve(JSON.parse(data.data).data)
|
|
|
|
+ }, async err => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
|
+ message: '查询目录失败',
|
|
|
|
+ duration: 1000,
|
|
|
|
+ position: 'top'
|
|
|
|
+ });
|
|
|
|
+ await toast.present();
|
|
});
|
|
});
|
|
- await toast.present();
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
|
|
+ return;
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -257,23 +257,36 @@ export class UserData {
|
|
await loading.present();
|
|
await loading.present();
|
|
this.nativeHttp.setDataSerializer('json');
|
|
this.nativeHttp.setDataSerializer('json');
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
- from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/search/samples/mobile/page`,
|
|
|
|
- form,
|
|
|
|
- headers)).pipe(
|
|
|
|
- finalize(() => loading.dismiss())
|
|
|
|
- ).subscribe(data => {
|
|
|
|
- this.storage.set('sample-table-data', data.data);
|
|
|
|
- this.router.navigateByUrl('/sample-table');
|
|
|
|
- }, async err => {
|
|
|
|
- console.log(err);
|
|
|
|
- const toast = await this.toastCtrl.create({
|
|
|
|
- message: '查询失败',
|
|
|
|
- duration: 1000,
|
|
|
|
- position: 'top'
|
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/search/samples/mobile/page`,
|
|
|
|
+ form,
|
|
|
|
+ headers)).pipe(
|
|
|
|
+ finalize(() => loading.dismiss())
|
|
|
|
+ ).subscribe(async data => {
|
|
|
|
+ if (JSON.parse(data.data).code == 1) {
|
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
|
+ message: JSON.parse(data.data).msg,
|
|
|
|
+ duration: 1000,
|
|
|
|
+ position: 'top'
|
|
|
|
+ });
|
|
|
|
+ await toast.present();
|
|
|
|
+ reject()
|
|
|
|
+ } else if (JSON.parse(data.data).code == 0) {
|
|
|
|
+ resolve(JSON.parse(data.data).data)
|
|
|
|
+ }
|
|
|
|
+ // this.storage.set('sample-table-data', data.data);
|
|
|
|
+ // this.router.navigateByUrl('/sample-table');
|
|
|
|
+ }, async err => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
|
+ message: '查询失败',
|
|
|
|
+ duration: 1000,
|
|
|
|
+ position: 'top'
|
|
|
|
+ });
|
|
|
|
+ await toast.present();
|
|
});
|
|
});
|
|
- await toast.present();
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
|
|
+ return;
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
// 获得采购合同列表
|
|
// 获得采购合同列表
|
|
@@ -283,23 +296,34 @@ export class UserData {
|
|
await loading.present();
|
|
await loading.present();
|
|
this.nativeHttp.setDataSerializer('json');
|
|
this.nativeHttp.setDataSerializer('json');
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
- from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/search/supplier/contract/mobile/page`,
|
|
|
|
- form,
|
|
|
|
- headers)).pipe(
|
|
|
|
- finalize(() => loading.dismiss())
|
|
|
|
- ).subscribe(data => {
|
|
|
|
- this.storage.set('contract-table-data', data.data);
|
|
|
|
- this.router.navigateByUrl('/contract-table');
|
|
|
|
- }, async err => {
|
|
|
|
- console.log(err);
|
|
|
|
- const toast = await this.toastCtrl.create({
|
|
|
|
- message: '查询失败',
|
|
|
|
- duration: 1000,
|
|
|
|
- position: 'top'
|
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/search/supplier/contract/mobile/page`,
|
|
|
|
+ form,
|
|
|
|
+ headers)).pipe(
|
|
|
|
+ finalize(() => loading.dismiss())
|
|
|
|
+ ).subscribe(async data => {
|
|
|
|
+ if (JSON.parse(data.data).code == 1) {
|
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
|
+ message: JSON.parse(data.data).msg,
|
|
|
|
+ duration: 1000,
|
|
|
|
+ position: 'top'
|
|
|
|
+ });
|
|
|
|
+ await toast.present();
|
|
|
|
+ reject()
|
|
|
|
+ } else if (JSON.parse(data.data).code == 0) {
|
|
|
|
+ resolve(JSON.parse(data.data).data)
|
|
|
|
+ }
|
|
|
|
+ }, async err => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
|
+ message: '查询失败',
|
|
|
|
+ duration: 1000,
|
|
|
|
+ position: 'top'
|
|
|
|
+ });
|
|
|
|
+ await toast.present();
|
|
});
|
|
});
|
|
- await toast.present();
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
|
|
+ return;
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
// 获取样品单详情
|
|
// 获取样品单详情
|
|
@@ -395,8 +419,8 @@ export class UserData {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- // 删除qa日志
|
|
|
|
- async deleteSampleQa(id: any): Promise<any> {
|
|
|
|
|
|
+ // 删除qa日志
|
|
|
|
+ async deleteSampleQa(id: any): Promise<any> {
|
|
const token = await this.getToken();
|
|
const token = await this.getToken();
|
|
const loading = await this.loadingCtrl.create();
|
|
const loading = await this.loadingCtrl.create();
|
|
await loading.present();
|
|
await loading.present();
|
|
@@ -426,36 +450,36 @@ export class UserData {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- // 删除qc日志
|
|
|
|
- async deleteSampleQc(id: any): Promise<any> {
|
|
|
|
- const token = await this.getToken();
|
|
|
|
- const loading = await this.loadingCtrl.create();
|
|
|
|
- await loading.present();
|
|
|
|
- const header = { Authorization: `Bearer ${token}` };
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
- from(this.nativeHttp.delete(`${environment.APP_SERVE_URL}/inventory/qc/mobile/qclog/${id}`, {},
|
|
|
|
- header)).pipe(
|
|
|
|
- finalize(() => loading.dismiss())
|
|
|
|
- ).subscribe(async data => {
|
|
|
|
- if (JSON.parse(data.data).code == 1) {
|
|
|
|
- const toast = await this.toastCtrl.create({
|
|
|
|
- message: JSON.parse(data.data).msg,
|
|
|
|
- duration: 1000,
|
|
|
|
- position: 'top'
|
|
|
|
- });
|
|
|
|
- await toast.present();
|
|
|
|
- }
|
|
|
|
- }, async err => {
|
|
|
|
- console.log(err);
|
|
|
|
|
|
+ // 删除qc日志
|
|
|
|
+ async deleteSampleQc(id: any): Promise<any> {
|
|
|
|
+ const token = await this.getToken();
|
|
|
|
+ const loading = await this.loadingCtrl.create();
|
|
|
|
+ await loading.present();
|
|
|
|
+ const header = { Authorization: `Bearer ${token}` };
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ from(this.nativeHttp.delete(`${environment.APP_SERVE_URL}/inventory/qc/mobile/qclog/${id}`, {},
|
|
|
|
+ header)).pipe(
|
|
|
|
+ finalize(() => loading.dismiss())
|
|
|
|
+ ).subscribe(async data => {
|
|
|
|
+ if (JSON.parse(data.data).code == 1) {
|
|
const toast = await this.toastCtrl.create({
|
|
const toast = await this.toastCtrl.create({
|
|
- message: '操作失败',
|
|
|
|
|
|
+ message: JSON.parse(data.data).msg,
|
|
duration: 1000,
|
|
duration: 1000,
|
|
position: 'top'
|
|
position: 'top'
|
|
});
|
|
});
|
|
await toast.present();
|
|
await toast.present();
|
|
|
|
+ }
|
|
|
|
+ }, async err => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
|
+ message: '操作失败',
|
|
|
|
+ duration: 1000,
|
|
|
|
+ position: 'top'
|
|
});
|
|
});
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ await toast.present();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
// 获取采购合同详情
|
|
// 获取采购合同详情
|
|
async getContractDetail(sscId: Number): Promise<any> {
|
|
async getContractDetail(sscId: Number): Promise<any> {
|