提交代码

pull/1/head
胡锐 2 years ago
parent 818f6039d8
commit 18447a2ce4
  1. 68
      src/app/admin/device/device-list/device-list.component.html
  2. 29
      src/app/admin/device/device-list/device-list.component.ts

@ -4,10 +4,10 @@
<!--条件搜索--> <!--条件搜索-->
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> <nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}">
<div class="inner-content"> <!-- <div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> <form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
<div nz-row> <div nz-row>
<!-- <div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 1"> &lt;!&ndash; <div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 1">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="8">所属部门</nz-form-label> <nz-form-label [nzSpan]="8">所属部门</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
@ -16,7 +16,7 @@
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div>--> </div>&ndash;&gt;
<div nz-col nzSpan="8"> <div nz-col nzSpan="8">
<nz-form-item> <nz-form-item>
@ -36,7 +36,7 @@
</div> </div>
</div> </div>
</form> </form>
</div> </div>-->
<div class="inner-content"> <div class="inner-content">
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> <span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
@ -55,15 +55,18 @@
[nzScroll]="{ x: '1100px'}"> [nzScroll]="{ x: '1100px'}">
<thead> <thead>
<tr> <tr>
<th nzWidth="50px">序号</th> <th nzWidth="70px">序号</th>
<th nzWidth="90px">设备类型</th> <th nzWidth="130px">设备类型</th>
<th nzWidth="100px">设备名称</th> <!-- <th nzWidth="100px">设备名称</th>-->
<th nzWidth="100px">设备SN</th> <th nzWidth="120px">设备SN</th>
<th nzWidth="100px">设备KEY</th> <th nzWidth="120px">设备KEY</th>
<th nzWidth="100px">设备IMEI</th> <th nzWidth="150px">设备IMEI</th>
<th nzWidth="100px">设备ICCID</th> <th nzWidth="150px">设备ICCID</th>
<th nzWidth="130px">小票顶部标题</th>
<th nzWidth="130px">小票来源显示</th>
<th nzWidth="130px">小票底部文案</th>
<th nzWidth="110px">创建时间</th> <th nzWidth="110px">创建时间</th>
<th nzWidth="80px" nzRight="0px">操作</th> <th nzWidth="120px" nzRight="0px">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -73,16 +76,20 @@
<span *ngIf="data.type == 1">商鹏云打印机</span> <span *ngIf="data.type == 1">商鹏云打印机</span>
<span *ngIf="data.type == 2">ZKC云打印机</span> <span *ngIf="data.type == 2">ZKC云打印机</span>
</td> </td>
<td>{{data.deviceName}}</td> <!-- <td>{{data.deviceName}}</td>-->
<td>{{data.deviceSn?data.deviceSn:'未填写'}} </td> <td>{{data.deviceSn?data.deviceSn:'未填写'}} </td>
<td>{{data.deviceKey?data.deviceKey:'未填写'}}</td> <td>{{data.deviceKey?data.deviceKey:'未填写'}}</td>
<td>{{data.deviceImei?data.deviceImei:'未填写'}}</td> <td>{{data.deviceImei?data.deviceImei:'未填写'}}</td>
<td>{{data.deviceIccid?data.deviceIccid:'未填写'}}</td> <td>{{data.deviceIccid?data.deviceIccid:'未填写'}}</td>
<td>{{data.receiptTop?data.receiptTop:'默认'}}</td>
<td>{{data.receiptSource?data.receiptSource:'默认'}}</td>
<td>{{data.receiptBottom?data.receiptBottom:'默认'}}</td>
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> <td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td nzRight="0px" class="table-td-operation"> <td nzRight="0px" class="table-td-operation">
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a> <a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a>
<nz-dropdown-menu #menu="nzDropdownMenu"> <nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable> <ul nz-menu nzSelectable>
<li nz-menu-item (click)="showConfigDeviceModal(data)"><a>修改</a></li>
<li nz-menu-item (click)="showDelConfirm(data.id)"><a>删除</a></li> <li nz-menu-item (click)="showDelConfirm(data.id)"><a>删除</a></li>
</ul> </ul>
</nz-dropdown-menu> </nz-dropdown-menu>
@ -99,48 +106,69 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >设备类型</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired >设备类型</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<nz-select formControlName="type"> <nz-select formControlName="type" [nzPlaceHolder]="'请选择设备类型'">
<nz-option nzValue="1" nzLabel="商鹏云打印机"></nz-option> <nz-option nzValue="1" nzLabel="商鹏云打印机"></nz-option>
<nz-option nzValue="2" nzLabel="ZKC云打印机"></nz-option> <nz-option nzValue="2" nzLabel="ZKC云打印机"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<!--
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >设备名称</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired >设备名称</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input nz-input formControlName="deviceName" [placeholder]="'请输入设备名称'" /> <input nz-input formControlName="deviceName" [placeholder]="'请输入设备名称'" />
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>-->
<nz-form-item *ngIf="configDeviceForm.value.type == 1"> <nz-form-item *ngIf="configDeviceForm.controls.type.value == 1">
<nz-form-label [nzSpan]="6" nzRequired >设备SN</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired >设备SN</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input nz-input formControlName="deviceSn" [placeholder]="'请输入设备SN号'" /> <input nz-input formControlName="deviceSn" [placeholder]="'请输入设备SN号'" />
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item *ngIf="configDeviceForm.value.type == 1"> <nz-form-item *ngIf="configDeviceForm.controls.type.value == 1">
<nz-form-label [nzSpan]="6" nzRequired >设备KEY</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired >设备KEY</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input nz-input formControlName="deviceKey" [placeholder]="'请输入设备KEY'"/> <input nz-input formControlName="deviceKey" [placeholder]="'请输入设备KEY'"/>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item *ngIf="configDeviceForm.value.type == 2"> <nz-form-item *ngIf="configDeviceForm.controls.type.value == 2">
<nz-form-label [nzSpan]="6" nzRequired >设备IMEI</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired >设备IMEI</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input nz-input formControlName="deviceImei" [placeholder]="'请输入设备IMEI'"/> <input nz-input formControlName="deviceImei" [placeholder]="'请输入设备IMEI'"/>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item *ngIf="configDeviceForm.value.type == 2"> <nz-form-item *ngIf="configDeviceForm.controls.type.value == 2">
<nz-form-label [nzSpan]="6" nzRequired >设备ICCID</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired >设备ICCID</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input nz-input formControlName="deviceIccid" [placeholder]="'请输入设备ICCID'"/> <input nz-input formControlName="deviceIccid" [placeholder]="'请输入设备ICCID'"/>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">小票顶部标题</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="receiptTop" maxlength="5" [placeholder]="'默认嗨森逛'"/>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">小票来源显示</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="receiptSource" maxlength="10" [placeholder]="'默认嗨森逛'"/>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">小票底部文案</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="receiptBottom" maxlength="15" [placeholder]="'默认开心又省钱嗨森逛'"/>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;"> <div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitConfigDevice()">确定</button> <button nz-button nzType="primary" style="width: 150px;" (click)="submitConfigDevice()">确定</button>
</div> </div>

@ -62,13 +62,17 @@ export class DeviceListComponent implements OnInit {
}); });
this.configDeviceForm = this.form.group({ this.configDeviceForm = this.form.group({
id: [null],
merStoreId: [null], merStoreId: [null],
type: [null, [Validators.required]], type: [null, [Validators.required]],
deviceName: [null, [Validators.required]], // deviceName: [null, [Validators.required]],
deviceSn: [null], deviceSn: [null],
deviceKey: [null], deviceKey: [null],
deviceImei: [null], deviceImei: [null],
deviceIccid: [null], deviceIccid: [null],
receiptTop: [null],
receiptSource: [null],
receiptBottom: [null],
}); });
this.requestData(1); this.requestData(1);
@ -114,7 +118,14 @@ export class DeviceListComponent implements OnInit {
showConfigDeviceModal(deviceData: object) { showConfigDeviceModal(deviceData: object) {
if (deviceData != null) { if (deviceData != null) {
this.configDeviceModalTitle = '修改设备'; this.configDeviceModalTitle = '修改设备';
deviceData['type'] = String(deviceData['type']);
this.configDeviceForm.patchValue(deviceData); this.configDeviceForm.patchValue(deviceData);
this.configDeviceForm.controls.type.disable();
this.configDeviceForm.controls.deviceSn.disable();
this.configDeviceForm.controls.deviceKey.disable();
this.configDeviceForm.controls.deviceImei.disable();
this.configDeviceForm.controls.deviceIccid.disable();
} }
if (deviceData == null) { if (deviceData == null) {
this.configDeviceModalTitle = '新增设备'; this.configDeviceModalTitle = '新增设备';
@ -126,6 +137,12 @@ export class DeviceListComponent implements OnInit {
* *
*/ */
closeConfigDeviceModal() { closeConfigDeviceModal() {
this.configDeviceForm.controls.type.enable();
this.configDeviceForm.controls.deviceSn.enable();
this.configDeviceForm.controls.deviceKey.enable();
this.configDeviceForm.controls.deviceImei.enable();
this.configDeviceForm.controls.deviceIccid.enable();
this.configDeviceForm.reset();
this.configDeviceModal = false; this.configDeviceModal = false;
} }
@ -144,6 +161,11 @@ export class DeviceListComponent implements OnInit {
}); });
return; return;
} }
this.configDeviceForm.controls.type.enable();
this.configDeviceForm.controls.deviceSn.enable();
this.configDeviceForm.controls.deviceKey.enable();
this.configDeviceForm.controls.deviceImei.enable();
this.configDeviceForm.controls.deviceIccid.enable();
this.configDeviceForm.value.merStoreId = this.merStoreId; this.configDeviceForm.value.merStoreId = this.merStoreId;
this.deviceService.editDevice(this.configDeviceForm.value, data => { this.deviceService.editDevice(this.configDeviceForm.value, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
@ -158,6 +180,11 @@ export class DeviceListComponent implements OnInit {
nzTitle: '提示', nzTitle: '提示',
nzContent: data['return_msg'], nzContent: data['return_msg'],
}); });
this.configDeviceForm.controls.type.disable();
this.configDeviceForm.controls.deviceSn.disable();
this.configDeviceForm.controls.deviceKey.disable();
this.configDeviceForm.controls.deviceImei.disable();
this.configDeviceForm.controls.deviceIccid.disable();
} }
this.loadingObject.spinning = false; this.loadingObject.spinning = false;
}); });

Loading…
Cancel
Save