This commit is contained in:
wangshiming
2022-02-15 11:23:47 +08:00
parent 5eaf3cf0bf
commit 510f8f25a5
6 changed files with 58 additions and 16 deletions

View File

@ -69,7 +69,7 @@ nzMessage="签收后不可再修改运费,请确保运费等信息准确无误
[nzPreview]="handlePreview1" [nzPreview]="handlePreview1"
[nzBeforeUpload]="beforeUpload" [nzBeforeUpload]="beforeUpload"
(nzChange)="handleChange1($event)" (nzChange)="handleChange1($event)"
> >beforeUpload
<div> <div>
<i nz-icon nzType="plus"></i> <i nz-icon nzType="plus"></i>
<div style="margin-top: 8px">请上传图片</div> <div style="margin-top: 8px">请上传图片</div>

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-01-25 16:03:45 * @Date : 2022-01-25 16:03:45
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-02-14 16:18:02 * @LastEditTime : 2022-02-15 11:16:42
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-h5\\dynamic-setting-h5.component.html * @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-h5\\dynamic-setting-h5.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
@ -38,6 +38,7 @@
<label nz-radio [nzValue]="1" class="ml-xl">{{item.remark?.[1] || '是'}}</label> <label nz-radio [nzValue]="1" class="ml-xl">{{item.remark?.[1] || '是'}}</label>
</nz-radio-group> </nz-radio-group>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="3"> <ng-container *ngSwitchCase="3">
<nz-time-picker nzFormat="HH:mm" nzPlaceHolder="请选择时间" [(ngModel)]="item.itemValue" <nz-time-picker nzFormat="HH:mm" nzPlaceHolder="请选择时间" [(ngModel)]="item.itemValue"
class="ml-md mr-xl"> class="ml-md mr-xl">
@ -78,6 +79,22 @@
<input nz-input placeholder="请输入" [(ngModel)]="item.itemValue" /> <input nz-input placeholder="请输入" [(ngModel)]="item.itemValue" />
</nz-input-group> </nz-input-group>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="9">
<nz-upload
[nzAction]="service.$api_upload_url"
[nzName]="'multipartFile'"
[nzHeaders]="{ authorization: 'authorization-text' }"
[(nzFileList)]="item.itemValue"
>
<button nz-button>
<i nz-icon nzType="upload"></i>
上传文件
</button>
</nz-upload>
</ng-container>
<ng-container *ngSwitchCase="10">
<nz-switch [(ngModel)]="item.itemValue"></nz-switch>
</ng-container>
</ng-container> </ng-container>
</se> </se>
</div> </div>

View File

@ -1,17 +1,18 @@
/* /*
* @Description : * @Description :
* @Version : 1.0 * @Version : 1.0
* @Author : Shiming * @Author : Shiming
* @Date : 2022-01-25 16:03:45 * @Date : 2022-01-25 16:03:45
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-02-14 14:54:08 * @LastEditTime : 2022-02-15 10:40:43
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-h5\\dynamic-setting-h5.component.ts * @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-h5\\dynamic-setting-h5.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
import { Component, OnInit, EventEmitter, Input, Output } from '@angular/core'; import { Component, OnInit, EventEmitter, Input, Output } from '@angular/core';
import { BaseService } from '@shared'; import { BaseService } from '@shared';
import { NzUploadChangeParam } from 'ng-zorro-antd/upload';
const JSONTYPE = new Set([5,6]); const JSONTYPE = new Set([5, 6, 9]);
@Component({ @Component({
selector: 'app-dynamic-setting-h5', selector: 'app-dynamic-setting-h5',
templateUrl: './dynamic-setting-h5.component.html', templateUrl: './dynamic-setting-h5.component.html',
@ -36,27 +37,37 @@ export class DynamicSettingH5Component implements OnInit {
labelWidth = 250; labelWidth = 250;
@Input() @Input()
itemValue = 'itemValue'; itemValue = 'itemValue';
listUrls: any;
constructor(public service: BaseService) {} constructor(public service: BaseService) {}
ngOnInit() { ngOnInit() {
console.log(this.tabs) console.log(this.tabs);
} }
changeType(type: any): void { changeType(type: any): void {
this.selectedTab = type; this.selectedTab = type;
console.log(type); console.log(type);
this.selectedEvent.emit(this.selectedTab); this.selectedEvent.emit(this.selectedTab);
} }
saveAction() { saveAction() {
if (this.configList?.length < 0) { if (this.configList?.length < 0) {
return; return;
} }
console.log(this.configList) console.log(this.configList);
let params = [...this.configList]; let params = [...this.configList];
params = params.map((item: any) => { params = params.map((item: any) => {
console.log(item);
if (item.itemType == 9) {
const files = item.itemValue?.map(({ url, name }: any) => ({ url, name }));
return {
...item,
remark: item.remark ? JSON.stringify(item.remark) : null,
itemData: item.itemData ? JSON.stringify(item.itemData) : null,
itemValue: item.itemValue ? JSON.stringify(files) : null
};
}
if (JSONTYPE.has(item.itemType)) { if (JSONTYPE.has(item.itemType)) {
item.itemValue = item.itemValue ? JSON.stringify(item.itemValue) : null; item.itemValue = item.itemValue ? JSON.stringify(item.itemValue) : null;
} }
@ -66,6 +77,8 @@ export class DynamicSettingH5Component implements OnInit {
itemData: item.itemData ? JSON.stringify(item.itemData) : null itemData: item.itemData ? JSON.stringify(item.itemData) : null
}; };
}); });
console.log(params);
this.saveEvent.emit(params); this.saveEvent.emit(params);
} }
} }
// [0]?.response?.data.fullFilePath

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-01-10 16:06:17 * @Date : 2022-01-10 16:06:17
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-02-14 16:19:54 * @LastEditTime : 2022-02-15 11:23:29
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-modal\\dynamic-setting-modal.component.ts * @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-modal\\dynamic-setting-modal.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
@ -101,7 +101,7 @@ export class DynamicSettingModalComponent implements OnInit {
remark: item?.remark ? JSON.parse(item?.remark) : null, remark: item?.remark ? JSON.parse(item?.remark) : null,
extend: item?.extend ? JSON.parse(item?.extend) : [], extend: item?.extend ? JSON.parse(item?.extend) : [],
// itemData: item.itemData ? JSON.parse(item.itemData) : item.itemData, // itemData: item.itemData ? JSON.parse(item.itemData) : item.itemData,
itemValue: item?.itemValue ? item?.itemType === 1? JSON.parse(item?.itemValue) : item?.itemValue : item?.itemValue itemValue: item?.itemValue ? item?.itemType !== 8? JSON.parse(item?.itemValue) : item?.itemValue : item?.itemValue
})); }));
} }
return []; return [];

View File

@ -1,15 +1,26 @@
/*
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-01-25 13:10:49
* @LastEditors : Shiming
* @LastEditTime : 2022-02-15 10:09:24
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting.module.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { DynamicSettingH5Component } from './dynamic-setting-h5/dynamic-setting-h5.component'; import { DynamicSettingH5Component } from './dynamic-setting-h5/dynamic-setting-h5.component';
import { SHARED_ZORRO_MODULES } from '../../shared-zorro.module'; import { SHARED_ZORRO_MODULES } from '../../shared-zorro.module';
import { SHARED_DELON_MODULES } from '../../shared-delon.module'; import { SHARED_DELON_MODULES } from '../../shared-delon.module';
import { NzSwitchModule } from 'ng-zorro-antd/switch';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { DynamicSettingModalComponent } from './dynamic-setting-modal/dynamic-setting-modal.component'; import { DynamicSettingModalComponent } from './dynamic-setting-modal/dynamic-setting-modal.component';
import { FreightTableComponent } from './freight-table/freight-table.component'; import { FreightTableComponent } from './freight-table/freight-table.component';
const COMPONENTS = [DynamicSettingH5Component, DynamicSettingModalComponent, FreightTableComponent]; const COMPONENTS = [DynamicSettingH5Component, DynamicSettingModalComponent, FreightTableComponent];
@NgModule({ @NgModule({
declarations: [...COMPONENTS], declarations: [...COMPONENTS],
imports: [CommonModule, FormsModule, SHARED_ZORRO_MODULES, SHARED_DELON_MODULES], imports: [CommonModule, FormsModule, NzSwitchModule,SHARED_ZORRO_MODULES, SHARED_DELON_MODULES],
exports: [...COMPONENTS] exports: [...COMPONENTS]
}) })
export class DynamicSettingModule {} export class DynamicSettingModule {}

View File

@ -1,8 +1,8 @@
/* /*
* @Author: Maple * @Author: Maple
* @Date: 2021-03-20 16:38:44 * @Date: 2021-03-20 16:38:44
* @LastEditors: Do not edit * @LastEditors : Shiming
* @LastEditTime: 2021-06-17 15:06:37 * @LastEditTime : 2022-02-15 09:41:48
* @Description: 全局基础服务: * @Description: 全局基础服务:
* 所有实体类服务必须使用extends扩展此类 * 所有实体类服务必须使用extends扩展此类
* 几个特别的Get参数 * 几个特别的Get参数
@ -63,7 +63,8 @@ export class BaseService implements IBase {
public $api_import_download_tpl!: string; public $api_import_download_tpl!: string;
// 获取字典选项 // 获取字典选项
public $api_get_dict!: string; public $api_get_dict!: string;
// 上传图片
public $api_upload_url = `/api/mdc/pbc/upload/multipartFile/file`;
constructor(public injector: Injector) {} constructor(public injector: Injector) {}
get http(): _HttpClient { get http(): _HttpClient {