Commit 79a42491 authored by van.chen's avatar van.chen

两个模板另存为

parent dc2c0398
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
<span class="editSpan" (click)="update(one)">{{'update' | translate}}</span> <span class="editSpan" (click)="update(one)">{{'update' | translate}}</span>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<span class="deleteFontColor" (click)="deleteConfirm(one)">{{'delete' | translate}}</span> <span class="deleteFontColor" (click)="deleteConfirm(one)">{{'delete' | translate}}</span>
<!--<nz-divider nzType="vertical"></nz-divider>--> <nz-divider nzType="vertical"></nz-divider>
<!--<span class="addSpan" (click)="saveOther(one)">{{'saveOther' | translate}}</span>--> <span class="addSpan" (click)="saveOther(one)">{{'saveOther' | translate}}</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -51,13 +51,15 @@ ...@@ -51,13 +51,15 @@
</ng-template> </ng-template>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="isSaveOther" [nzContent]="con2" nzWidth="500" <nz-modal [(nzVisible)]="isSaveOther" [nzContent]="con2" nzWidth="500" [nzTitle]="'isSaveOtherProbesModel' | translate"
[nzFooter]="foot2" (nzOnCancel)="cancel('isSaveOther')" nzMaskClosable="false"> [nzFooter]="foot2" (nzOnCancel)="cancel('isSaveOther')" nzMaskClosable="false">
<ng-template #con2> <ng-template #con2>
另存为通道模板 <app-search-item inModal="true" isMust="true" [label]="'moduleName' | translate" [(value)]="req2.newProbesModelName"></app-search-item>
<!--<app-search-select isMust="true" inModal="true" [(value)]="req2.companyNo" [label]="'selectCompany' | translate" optL="companyName"-->
<!--[data]="companys" optV="companyNo"></app-search-select>-->
</ng-template> </ng-template>
<ng-template #foot2> <ng-template #foot2>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel('isSaveOther')"><span>{{'cancel' | translate}}</span></button> <button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel('isSaveOther')"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save()"><span>{{'confirm' | translate}}</span></button> <button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('req2')"><span>{{'confirm' | translate}}</span></button>
</ng-template> </ng-template>
</nz-modal> </nz-modal>
...@@ -15,11 +15,13 @@ import {CheckService} from '../../service/check'; ...@@ -15,11 +15,13 @@ import {CheckService} from '../../service/check';
export class ModuleMgrComponent implements OnInit { export class ModuleMgrComponent implements OnInit {
req: any = {}; req: any = {};
req2;
data = []; data = [];
isLoading = false; isLoading = false;
isAddConV = false; isAddConV = false;
isSaveOther = false; isSaveOther = false;
isUpdate = false; isUpdate = false;
companys = [];
moduleName = ''; moduleName = '';
try: any = {}; try: any = {};
...@@ -33,6 +35,7 @@ export class ModuleMgrComponent implements OnInit { ...@@ -33,6 +35,7 @@ export class ModuleMgrComponent implements OnInit {
init() { init() {
this.getData(); this.getData();
this.getCompanys();
} }
getData() { getData() {
...@@ -40,6 +43,18 @@ export class ModuleMgrComponent implements OnInit { ...@@ -40,6 +43,18 @@ export class ModuleMgrComponent implements OnInit {
this.api.probesModel.getAll(['', this.next]); this.api.probesModel.getAll(['', this.next]);
} }
getCompanys() {
this.isLoading = true;
this.api.company.getAll(['', (data) => {
if (data && data.constructor === Array) {
this.companys = data;
} else {
this.message.error(data && data.message ? data.message : '获取数据失败');
}
this.isLoading = false;
}]);
}
onSearch() { onSearch() {
this.getData(); this.getData();
} }
...@@ -72,6 +87,12 @@ export class ModuleMgrComponent implements OnInit { ...@@ -72,6 +87,12 @@ export class ModuleMgrComponent implements OnInit {
saveOther(one) { saveOther(one) {
this.isSaveOther = true; this.isSaveOther = true;
this.req2 = {
companyNo: one.companyNo,
newProbesModelName: '',
probesModelNo: one.probesModelNo
};
this.try = {field: ['newProbesModelName', 'probesModelNo']};
} }
add() { add() {
...@@ -98,10 +119,14 @@ export class ModuleMgrComponent implements OnInit { ...@@ -98,10 +119,14 @@ export class ModuleMgrComponent implements OnInit {
this.isLoading = false; this.isLoading = false;
return; return;
} }
if (this.isUpdate) { if (this.isUpdate && this.isAddConV) {
this.api.probesModel.updateProbesModel([this.req, this.next]); this.api.probesModel.updateProbesModel([this.req, this.next]);
} else { } else if (!this.isUpdate && this.isAddConV) {
this.api.probesModel.addProbesModel([this.req, this.next]); this.api.probesModel.addProbesModel([this.req, this.next]);
} else if (this.isSaveOther) {
this.api.probesModel.saveAsProbesModel([this.req2, this.next]);
} else {
this.isLoading = false;
} }
} }
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
<span class="editSpan" (click)="update(one)">{{'update' | translate}}</span> <span class="editSpan" (click)="update(one)">{{'update' | translate}}</span>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<span class="deleteFontColor" (click)="deleteConfirm(one)">{{'delete' | translate}}</span> <span class="deleteFontColor" (click)="deleteConfirm(one)">{{'delete' | translate}}</span>
<!--<nz-divider nzType="vertical"></nz-divider>--> <nz-divider nzType="vertical"></nz-divider>
<!--<span class="addSpan" (click)="saveOther(one)">{{'saveOther' | translate}}</span>--> <span class="addSpan" (click)="saveOther(one)">{{'saveOther' | translate}}</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -55,13 +55,15 @@ ...@@ -55,13 +55,15 @@
</ng-template> </ng-template>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="isSaveOther" [nzContent]="con2" nzWidth="500" <nz-modal [(nzVisible)]="isSaveOther" [nzContent]="con2" nzWidth="500" [nzTitle]="'isSaveOtherTopicModel' | translate"
[nzFooter]="foot2" (nzOnCancel)="cancel('isSaveOther')" nzMaskClosable="false"> [nzFooter]="foot2" (nzOnCancel)="cancel('isSaveOther')" nzMaskClosable="false">
<ng-template #con2> <ng-template #con2>
另存为主题模板 <app-search-item inModal="true" isMust="true" [label]="'moduleName' | translate" [(value)]="req2.newTopicModelName"></app-search-item>
<!--<app-search-select isMust="true" inModal="true" [(value)]="req2.companyNo" [label]="'selectCompany' | translate" optL="companyName"-->
<!--[data]="companys" optV="companyNo"></app-search-select>-->
</ng-template> </ng-template>
<ng-template #foot2> <ng-template #foot2>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel('isSaveOther')"><span>{{'cancel' | translate}}</span></button> <button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel('isSaveOther')"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('isSaveOther')"><span>{{'confirm' | translate}}</span></button> <button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('req2')"><span>{{'confirm' | translate}}</span></button>
</ng-template> </ng-template>
</nz-modal> </nz-modal>
...@@ -15,6 +15,7 @@ import {CheckService} from '../../service/check'; ...@@ -15,6 +15,7 @@ import {CheckService} from '../../service/check';
export class TopicModuleMgrComponent implements OnInit { export class TopicModuleMgrComponent implements OnInit {
req: any = {}; req: any = {};
req2;
data = []; data = [];
isLoading = false; isLoading = false;
isAddConV = false; isAddConV = false;
...@@ -22,6 +23,7 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -22,6 +23,7 @@ export class TopicModuleMgrComponent implements OnInit {
isUpdate = false; isUpdate = false;
topicModuleName = ''; topicModuleName = '';
try = {}; try = {};
companys = [];
constructor(private api: ApiService, private message: NzMessageService, private modalService: NzModalService, constructor(private api: ApiService, private message: NzMessageService, private modalService: NzModalService,
private translate: TranslateService, private router: Router, private ck: CheckService) { private translate: TranslateService, private router: Router, private ck: CheckService) {
...@@ -33,6 +35,7 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -33,6 +35,7 @@ export class TopicModuleMgrComponent implements OnInit {
init() { init() {
this.getData(); this.getData();
this.getCompanys();
} }
getData() { getData() {
...@@ -40,6 +43,18 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -40,6 +43,18 @@ export class TopicModuleMgrComponent implements OnInit {
this.api.topicModel.getAll(['', this.next]); this.api.topicModel.getAll(['', this.next]);
} }
getCompanys() {
this.isLoading = true;
this.api.company.getAll(['', (data) => {
if (data && data.constructor === Array) {
this.companys = data;
} else {
this.message.error(data && data.message ? data.message : '获取数据失败');
}
this.isLoading = false;
}]);
}
onSearch() { onSearch() {
this.getData(); this.getData();
} }
...@@ -63,7 +78,7 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -63,7 +78,7 @@ export class TopicModuleMgrComponent implements OnInit {
this.message.error(data && data.message ? data.message : '获取数据失败'); this.message.error(data && data.message ? data.message : '获取数据失败');
} }
this.isLoading = false; this.isLoading = false;
} };
toDetail(one) { toDetail(one) {
this.router.navigate(['/app/deviceCenter/topicModuleMgr/topicModuleDetail'], this.router.navigate(['/app/deviceCenter/topicModuleMgr/topicModuleDetail'],
...@@ -72,6 +87,12 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -72,6 +87,12 @@ export class TopicModuleMgrComponent implements OnInit {
saveOther(one) { saveOther(one) {
this.isSaveOther = true; this.isSaveOther = true;
this.req2 = {
companyNo: one.companyNo,
newTopicModelName: '',
topicModelNo: one.topicModelNo
};
this.try = {field: ['newTopicModelName', 'topicModelNo']};
} }
add() { add() {
...@@ -98,19 +119,21 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -98,19 +119,21 @@ export class TopicModuleMgrComponent implements OnInit {
this.isLoading = false; this.isLoading = false;
return; return;
} }
if (this.isUpdate) { if (this.isUpdate && this.isAddConV) {
this.api.topicModel.updateTopic([this.req, this.next]); this.api.topicModel.updateTopic([this.req, this.next]);
} else { } else if (!this.isUpdate && this.isAddConV) {
this.req.addTopicModelForInfoVos = []; this.req.addTopicModelForInfoVos = [];
this.api.topicModel.addTopicModel([this.req, this.next]); this.api.topicModel.addTopicModel([this.req, this.next]);
} else if (this.isSaveOther) {
this.api.topicModel.saveAsTopicModel([this.req2, this.next]);
} }
} }
deleteConfirm(one) { deleteConfirm(one) {
this.modalService.confirm({ this.modalService.confirm({
nzTitle : '<i> </i>', nzTitle: '<i> </i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>', nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one) nzOnOk: () => this.delete(one)
}); });
} }
......
import { HttpService } from './http'; import {HttpService} from './http';
import { Injectable } from '@angular/core'; import {Injectable} from '@angular/core';
import { Router } from '@angular/router'; import {Router} from '@angular/router';
import { NzMessageService } from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
import { environment } from '../../environments/environment'; import {environment} from '../../environments/environment';
import { TranslateService } from '@ngx-translate/core'; import {TranslateService} from '@ngx-translate/core';
@Injectable() @Injectable()
export class ApiService { export class ApiService {
...@@ -71,6 +71,7 @@ export class ApiService { ...@@ -71,6 +71,7 @@ export class ApiService {
addProbesModel: (data) => this.trans('post', '/device/probesModel/addProbesModel', data), addProbesModel: (data) => this.trans('post', '/device/probesModel/addProbesModel', data),
delProbesModel: (data) => this.trans('post', '/device/probesModel/delProbesModel', data), delProbesModel: (data) => this.trans('post', '/device/probesModel/delProbesModel', data),
getAll: (data) => this.trans('get', '/device/probesModel/getAll', data), getAll: (data) => this.trans('get', '/device/probesModel/getAll', data),
saveAsProbesModel: (data) => this.trans('post', '/device/probesModel/saveAsProbesModel', data),
updateProbesModel: (data) => this.trans('post', '/device/probesModel/updateProbesModel', data), updateProbesModel: (data) => this.trans('post', '/device/probesModel/updateProbesModel', data),
}; };
...@@ -93,6 +94,7 @@ export class ApiService { ...@@ -93,6 +94,7 @@ export class ApiService {
addTopicModel: (data) => this.trans('post', '/device/topicModel/addTopicModel', data), addTopicModel: (data) => this.trans('post', '/device/topicModel/addTopicModel', data),
delTopicModel: (data) => this.trans('post', '/device/topicModel/delTopicModel', data), delTopicModel: (data) => this.trans('post', '/device/topicModel/delTopicModel', data),
getAll: (data) => this.trans('get', '/device/topicModel/getAll', data), getAll: (data) => this.trans('get', '/device/topicModel/getAll', data),
saveAsTopicModel: (data) => this.trans('post', '/device/topicModel/saveAsTopicModel', data),
updateTopic: (data) => this.trans('post', '/device/topicModel/updateTopic', data), updateTopic: (data) => this.trans('post', '/device/topicModel/updateTopic', data),
}; };
...@@ -121,7 +123,7 @@ export class ApiService { ...@@ -121,7 +123,7 @@ export class ApiService {
batchUpdateCompany: (data) => this.trans('post', '/device/device/batchUpdateCompany', data), batchUpdateCompany: (data) => this.trans('post', '/device/device/batchUpdateCompany', data),
delDevice: (data) => this.trans('post', '/device/device/delDevice', data), delDevice: (data) => this.trans('post', '/device/device/delDevice', data),
deploySensor: (data) => this.trans('post', '/device/device/deploySensor', data), deploySensor: (data) => this.trans('post', '/device/device/deploySensor', data),
gatewayBindGateway: (data) => this.trans('post', '/device/device/gatewayBindGateway', data), gatewayBindGateway: (data) => this.trans('post', '/device/device/bindDevice', data),
getSensorByMaxDevice: (data) => this.trans('post', '/device/device/getSensorByMaxDevice', data), getSensorByMaxDevice: (data) => this.trans('post', '/device/device/getSensorByMaxDevice', data),
getAll: (data) => this.trans('post', '/device/device/getAll', data), getAll: (data) => this.trans('post', '/device/device/getAll', data),
getByTerm: (data) => this.trans('post', '/device/device/getByTerm', data), getByTerm: (data) => this.trans('post', '/device/device/getByTerm', data),
......
...@@ -154,5 +154,7 @@ ...@@ -154,5 +154,7 @@
"updateTime": "更新时间", "updateTime": "更新时间",
"updateData": "最新数据", "updateData": "最新数据",
"see": "查看", "see": "查看",
"pleaseFillAll": "请填完所有必填项" "pleaseFillAll": "请填完所有必填项",
"isSaveOtherProbesModel": "另存为通道模板",
"isSaveOtherTopicModel": "另存为主题模板"
} }
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
export const environment = { export const environment = {
production: false, production: false,
baseUrl: 'http://cloud-test.witium.com/api', // 对外访问测试网地址 // baseUrl: 'http://cloud-test.witium.com/api', // 对外访问测试网地址
baseUrl: 'http://172.16.1.53:8092', // 对外访问测试网地址
}; };
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment