|
@@ -7,6 +7,7 @@ import { Router } from '@angular/router';
|
|
|
import { AlertController } from '@ionic/angular';
|
|
|
import { finalize } from 'rxjs/operators';
|
|
|
import { queryForm } from './query';
|
|
|
+import { environment } from '../environments/environment';
|
|
|
|
|
|
|
|
|
@Injectable({
|
|
@@ -55,7 +56,7 @@ export class UserData {
|
|
|
// this.nativeHttp.setDataSerializer('json')
|
|
|
|
|
|
// tslint:disable-next-line:max-line-length
|
|
|
- from(this.nativeHttp.post(`http://dev.sgsino.cn/auth/oauth/token?username=${account}&password=${encodeURIComponent(password)}&grant_type=password&scope=server`,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/auth/oauth/token?username=${account}&password=${encodeURIComponent(password)}&grant_type=password&scope=server`,
|
|
|
{},
|
|
|
{ Authorization: 'Basic cGlnOnBpZw==', TENANT_ID: '1', isToken: 'false', })).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
@@ -77,7 +78,7 @@ export class UserData {
|
|
|
}, async err => {
|
|
|
console.log(err);
|
|
|
const toast = await this.toastCtrl.create({
|
|
|
- message: '登录失败',
|
|
|
+ message: err.error+err.url,
|
|
|
duration: 1000,
|
|
|
position: 'top'
|
|
|
});
|
|
@@ -104,7 +105,7 @@ export class UserData {
|
|
|
async getAppMenu(): Promise<any> {
|
|
|
const token = await this.getToken();
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get('http://dev.sgsino.cn/admin/menu/app',
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/admin/menu/app`,
|
|
|
{},
|
|
|
{ Authorization: `Bearer ${token}`,'Content-Type': 'application/json;charset=UTF-8' })).pipe(
|
|
|
finalize(() => { })
|
|
@@ -156,7 +157,7 @@ export class UserData {
|
|
|
await loading.present();
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
- from(this.nativeHttp.post(`http://dev.sgsino.cn/production/sample/factory/`,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/production/sample/factory/`,
|
|
|
data,
|
|
|
headers)).pipe(
|
|
|
finalize(() => { })
|
|
@@ -182,7 +183,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.post('http://dev.sgsino.cn/production/sample/factory/pCode',
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/production/sample/factory/pCode`,
|
|
|
data,
|
|
|
headers)).pipe(
|
|
|
finalize(() => { })
|
|
@@ -218,7 +219,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.post('http://dev.sgsino.cn/production/sample/factory/details/',
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/production/sample/factory/details/`,
|
|
|
data,
|
|
|
headers)).pipe(
|
|
|
finalize(() => { })
|
|
@@ -256,7 +257,7 @@ export class UserData {
|
|
|
await loading.present();
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
- from(this.nativeHttp.post(`http://dev.sgsino.cn/search/samples/mobile/page`,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/search/samples/mobile/page`,
|
|
|
form,
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
@@ -282,7 +283,7 @@ export class UserData {
|
|
|
await loading.present();
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
- from(this.nativeHttp.post(`http://dev.sgsino.cn/search/supplier/contract/mobile/page`,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/search/supplier/contract/mobile/page`,
|
|
|
form,
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
@@ -310,7 +311,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/production/samples/mobile/${sdId}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/production/samples/mobile/${sdId}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -335,7 +336,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/production/samples/mobile/qalog/${sdpId}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/production/samples/mobile/qalog/${sdpId}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => { })
|
|
|
).subscribe(async data => {
|
|
@@ -364,7 +365,7 @@ export class UserData {
|
|
|
// })
|
|
|
const header = { Authorization: `Bearer ${token}` };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.post(`http://dev.sgsino.cn/production/samples/mobile/qalog`, form,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/production/samples/mobile/qalog`, form,
|
|
|
header)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -394,6 +395,68 @@ export class UserData {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ // 删除qa日志
|
|
|
+ async deleteSampleQa(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/qa/mobile/qalog/${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);
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
+ message: '操作失败',
|
|
|
+ duration: 1000,
|
|
|
+ position: 'top'
|
|
|
+ });
|
|
|
+ await toast.present();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除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);
|
|
|
+ const toast = await this.toastCtrl.create({
|
|
|
+ message: '操作失败',
|
|
|
+ duration: 1000,
|
|
|
+ position: 'top'
|
|
|
+ });
|
|
|
+ await toast.present();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
// 获取采购合同详情
|
|
|
async getContractDetail(sscId: Number): Promise<any> {
|
|
|
const token = await this.getToken();
|
|
@@ -402,7 +465,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/production/purchase/mobile/${sscId}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/production/purchase/mobile/${sscId}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -427,7 +490,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('urlencoded');
|
|
|
const headers = { Authorization: `Bearer ${token}` };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.post('http://dev.sgsino.cn/inventory/qa/mobile/qalog', form,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/inventory/qa/mobile/qalog`, form,
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -463,7 +526,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}` };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/qa/mobile/qalog/${sscId}/${pId}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/qa/mobile/qalog/${sscId}/${pId}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => { })
|
|
|
).subscribe(async data => {
|
|
@@ -485,7 +548,7 @@ export class UserData {
|
|
|
const token = await this.getToken();
|
|
|
const headers = { Authorization: `Bearer ${token}` };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/qc/mobile/qclog/${sscId}/${pId}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/qc/mobile/qclog/${sscId}/${pId}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => { })
|
|
|
).subscribe(async data => {
|
|
@@ -510,7 +573,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/enterStore/mobile/detail?sscId=${sscId}&pId=${pId}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/enterStore/mobile/detail?sscId=${sscId}&pId=${pId}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -544,7 +607,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/shelf/mobile/code?code=${code}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/shelf/mobile/code?code=${code}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -578,7 +641,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.post(`http://dev.sgsino.cn/inventory/enterStore/mobile/`, list,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/inventory/enterStore/mobile/`, list,
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -623,7 +686,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/shelf/mobile?${current}&${size}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/shelf/mobile?${current}&${size}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -657,7 +720,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.put(`http://dev.sgsino.cn/inventory/shelf/mobile`, list,
|
|
|
+ from(this.nativeHttp.put(`${environment.APP_SERVE_URL}/inventory/shelf/mobile`, list,
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -701,7 +764,7 @@ export class UserData {
|
|
|
await loading.present();
|
|
|
const headers = { Authorization: `Bearer ${token}` };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.put(`http://dev.sgsino.cn/inventory/shelf/mobile/lend?code=${code}`, {},
|
|
|
+ from(this.nativeHttp.put(`${environment.APP_SERVE_URL}/inventory/shelf/mobile/lend?code=${code}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -747,7 +810,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/shelf/mobile/12`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/shelf/mobile/12`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -771,7 +834,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.post('http://dev.sgsino.cn/inventory/shelf/mobile/bind/sample', list,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/inventory/shelf/mobile/bind/sample`, list,
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -808,7 +871,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/qc/mobile/Pending?${current}&${size}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/qc/mobile/Pending?${current}&${size}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -842,7 +905,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/shelf/mobile/pending?${current}&${size}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/shelf/mobile/pending?${current}&${size}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -876,7 +939,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/warehouse/mobile/pending?${current}&${size}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/warehouse/mobile/pending?${current}&${size}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -912,7 +975,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.put(`http://dev.sgsino.cn/inventory/warehouse/mobile/prepare?sscId=${sscId}&pId=${pId}`, {},
|
|
|
+ from(this.nativeHttp.put(`${environment.APP_SERVE_URL}/inventory/warehouse/mobile/prepare?sscId=${sscId}&pId=${pId}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -957,7 +1020,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/qc/mobile?${current}&${size}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/qc/mobile?${current}&${size}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -991,7 +1054,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.get(`http://dev.sgsino.cn/inventory/qc/mobile/detail?sscId=${sscId}&pId=${pId}`, {},
|
|
|
+ from(this.nativeHttp.get(`${environment.APP_SERVE_URL}/inventory/qc/mobile/detail?sscId=${sscId}&pId=${pId}`, {},
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -1028,7 +1091,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('json');
|
|
|
const headers = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json;charset=UTF-8' };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.post('http://dev.sgsino.cn/inventory/qc/mobile', form,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/inventory/qc/mobile`, form,
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|
|
@@ -1069,7 +1132,7 @@ export class UserData {
|
|
|
this.nativeHttp.setDataSerializer('urlencoded');
|
|
|
const headers = { Authorization: `Bearer ${token}` };
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- from(this.nativeHttp.post('http://dev.sgsino.cn/inventory/qc/mobile/qclog', form,
|
|
|
+ from(this.nativeHttp.post(`${environment.APP_SERVE_URL}/inventory/qc/mobile/qclog`, form,
|
|
|
headers)).pipe(
|
|
|
finalize(() => loading.dismiss())
|
|
|
).subscribe(async data => {
|