This commit is contained in:
Taric Xin
2021-12-30 11:18:24 +08:00
parent 9270ece824
commit 6e33516cd4
4 changed files with 264 additions and 55 deletions

View File

@ -211,7 +211,7 @@ export class TransactionFlowComponent implements OnInit {
{ title: '交易类型', index: 'tradeTypeLabel', width: 120 },
{ title: '关联单号', index: 'businessNumber', width: 150 },
{ title: '账户类型', index: 'accountTypeLabel', width: 100 },
{ title: '账户名称', index: 'driverName', width: 100 },
{ title: '账户名称', index: 'enterpriseName', width: 100 },
{ title: '所属项目', index: 'projectName', width: 100 },
{ title: '收支类型', index: 'incomeTypeLabel', width: 100 },
{ title: '交易金额', index: 'amount', width: 100 },

View File

@ -6,18 +6,18 @@
<div style="width: 250px;">
<nz-list nzBordered [nzHeader]="listHeader">
<nz-list-item *ngFor="let item of typeList;let i = index"
[ngClass]="{'select-type': selectedType===item.id}">
[ngClass]="{'select-type': selectedType.id===item.id}" (click)="selectedTypeAction(item)">
<div class="d-flex justify-content-between align-items-center" style="width: 100%;">
<label style="flex:1">{{item.title}}</label>
<label style="flex:1">{{item.name}}</label>
<i nz-icon nzType="more" nzTheme="outline" style="font-size: 18px;cursor: pointer;" nz-dropdown
[nzDropdownMenu]="menu" nzTrigger="click"></i>
</div>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item>编辑{{i}}</li>
<li nz-menu-item>上移</li>
<li nz-menu-item>下移</li>
<li nz-menu-item nzDanger>删除</li>
<li nz-menu-item (click)="typeAction(item)">编辑</li>
<li nz-menu-item (click)="sortType(item,3)" *ngIf="i!==0">上移</li>
<li nz-menu-item (click)="sortType(item,4)" *ngIf="i!==typeList.length-1">下移</li>
<li nz-menu-item nzDanger (click)="removeType(item)">删除</li>
</ul>
</nz-dropdown-menu>
</nz-list-item>
@ -25,7 +25,8 @@
<ng-template #listHeader>
<div class="d-flex justify-content-between align-items-center">
<label style="font-weight: 700;font-size: 16px;">货物类型</label>
<button nz-button nzType="primary"><i nz-icon nzType="plus" nzTheme="outline"></i>新增</button>
<button nz-button nzType="primary" (click)="typeAction()"><i nz-icon nzType="plus"
nzTheme="outline"></i>新增</button>
</div>
</ng-template>
</div>
@ -33,20 +34,44 @@
<div style="flex: 1;" class="ml-md">
<div class="d-flex justify-content-between align-items-center mb-md">
<nz-input-group [nzSuffix]="suffixTemplateInfo" style="width: 300px;">
<input type="text" nz-input placeholder="请输入货物名称" />
<input type="text" nz-input placeholder="请输入货物名称" [(ngModel)]="searchName" (keydown)="keydownEvent($event)"/>
</nz-input-group>
<ng-template #suffixTemplateInfo><i nz-icon nzType="search" nzTheme="outline"></i></ng-template>
<button nz-button nzType="primary"><i nz-icon nzType="plus" nzTheme="outline"></i>新增</button>
<ng-template #suffixTemplateInfo><i nz-icon nzType="search" nzTheme="outline" (click)="st.load(1)"></i>
</ng-template>
<button nz-button nzType="primary" (click)="typeItemAction()"><i nz-icon nzType="plus"
nzTheme="outline"></i>新增</button>
</div>
<st #st [data]="url" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
<st #st [data]="selectedType?.id?service.$api_get_config_item_page:[]" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, process: beforeReq }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" [scroll]="{ y: '370px' }"></st>
</div>
</div>
</nz-card>
</nz-card>
<ng-template #configTypeModal>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="110">
<se [col]="1" label="货物类型" required="">
<input nz-input [(ngModel)]="configTypeName" placeholder="请输入" />
</se>
</div>
</div>
</ng-template>
<ng-template #configTypeItemModal>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="110">
<se [col]="1" label="货物类型" required="">
{{selectedType?.name}}
</se>
<se [col]="1" label="货物名称" required="">
<input nz-input [(ngModel)]="configTypeItemName" placeholder="请输入" />
</se>
</div>
</div>
</ng-template>

View File

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn } from '@delon/abc/st';
import { STComponent, STColumn, STRequestOptions } from '@delon/abc/st';
import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from '../../services/system.service';
@ -9,66 +9,229 @@ import { SystemService } from '../../services/system.service';
styleUrls: ['./goods-name-config.component.less']
})
export class GoodsNameConfigComponent implements OnInit {
typeList = [
{ title: '零件配件', sort: 1, id: 1 },
{ title: '衣用物资', sort: 2, id: 2 },
{ title: '空包装', sort: 3, id: 3 },
{ title: '废品废料', sort: 4, id: 4 },
{ title: '家具家居', sort: 8, id: 5 },
{ title: '衣用物资', sort: 6, id: 6 },
{ title: '空包装', sort: 7, id: 7 },
{ title: '衣用物资', sort: 8, id: 8 },
{ title: '空包装', sort: 9, id: 9 },
{ title: '废品废料', sort: 10, id: 10 },
{ title: '废品废料2', sort: 11, id: 11 },
{ title: '废品废料3', sort: 12, id: 12 },
{ title: '零件配件', sort: 1, id: 1 },
{ title: '衣用物资', sort: 2, id: 2 },
{ title: '空包装', sort: 3, id: 3 },
{ title: '废品废料', sort: 4, id: 4 },
{ title: '家具家居', sort: 8, id: 5 },
{ title: '衣用物资', sort: 6, id: 6 },
{ title: '空包装', sort: 7, id: 7 },
{ title: '衣用物资', sort: 8, id: 8 },
{ title: '空包装', sort: 9, id: 9 },
{ title: '废品废料', sort: 10, id: 10 },
{ title: '废品废料2', sort: 11, id: 11 },
{ title: '废品废料3', sort: 12, id: 12 }
];
selectedType = 1;
@ViewChild('configTypeModal', { static: true })
configTypeModal: any;
@ViewChild('configTypeItemModal', { static: true })
configTypeItemModal: any;
@ViewChild('st', { static: true })
st!: STComponent;
url = `/rule?_allow_anonymous=true`;
reqParams = {};
typeList: any[] = [];
selectedType: any = null;
parentId = null;
columns: STColumn[] = [
{ title: '货物名称', index: 'no' },
{ title: '更新时间', index: 'description' },
{ title: '货物名称', index: 'name' },
{ title: '更新时间', index: 'modifyTime' },
{
title: '操作',
buttons: [
{
text: '编辑'
// click: item => this.staffAction(item)
text: '编辑',
click: item => this.typeItemAction(item)
},
{
text: '上移',
iif: item => item.no !== 0
// click: item => this.action(2)
click: item => this.sortTypeItem(item, 3)
},
{
text: '下移',
iif: item => item.status !== 10
// click: item => this.action(1)
click: item => this.sortTypeItem(item, 4)
},
{
text: '删除',
// click: item => this.action(3)
click: item => this.removeTypeItem(item)
}
]
}
];
configTypeName = '';
configTypeItemName = '';
searchName = '';
constructor(public service: SystemService, private nzModalService: NzModalService) {}
ngOnInit(): void {}
ngOnInit(): void {
this.getTypeList();
}
beforeReq = (requestOptions: STRequestOptions) => {
Object.assign(requestOptions.body, {
configId: this.selectedType?.id
});
if (this.searchName) {
Object.assign(requestOptions.body, {
name: this.searchName
});
}
return requestOptions;
};
keydownEvent(event: any) {
if (event.keyCode === 13) {
this.st.load(1);
}
}
getTypeList() {
this.service.request(this.service.$api_get_config_tree, { configFullKey: 'goods.name.config' }).subscribe((res: Array<any>) => {
if (res?.length > 0) {
const typeData = res
.find(config => config.configFullKey === 'goods.name.config')
?.children.find((type: any) => type.configFullKey === 'goods.name.config.type');
if (typeData) {
this.typeList = typeData.children;
this.parentId = typeData.id;
this.selectedType = typeData.children[0];
}
}
});
}
selectedTypeAction(item: any) {
this.selectedType = item;
this.st.load(1);
}
/**
* 货物类型操作
* @param item
*/
typeAction(item?: any) {
this.configTypeName = item?.name || '';
this.nzModalService.create({
nzTitle: item ? '编辑' : '新增',
nzContent: this.configTypeModal,
nzOnOk: () => {
if (!this.configTypeName) {
this.service.msgSrv.warning('请填写货物类型');
return false;
}
if (item) {
this.service.request(this.service.$api_update_config, { ...item, name: this.configTypeName }).subscribe(res => {
if (res) {
this.service.msgSrv.success('更新货物类型成功');
this.getTypeList();
}
});
} else {
this.service.request(this.service.$api_add_config, { name: this.configTypeName, parentId: this.parentId }).subscribe(res => {
if (res) {
this.service.msgSrv.success('新增货物类型成功');
this.getTypeList();
}
});
}
return true;
}
});
}
/**
* 货物类型操作
* @param item
*/
typeItemAction(item?: any) {
this.configTypeItemName = item?.name || '';
this.nzModalService.create({
nzTitle: item ? '编辑' : '新增',
nzContent: this.configTypeItemModal,
nzOnOk: () => {
if (!this.configTypeItemName) {
this.service.msgSrv.warning('请填写货物名称');
return false;
}
if (item) {
this.service.request(this.service.$api_update_config_item, { ...item, name: this.configTypeItemName }).subscribe(res => {
if (res) {
this.service.msgSrv.success('更新货物名称成功');
this.st.load(1);
}
});
} else {
this.service
.request(this.service.$api_add_config_item, {
name: this.configTypeItemName,
configId: this.selectedType.id
})
.subscribe(res => {
if (res) {
this.service.msgSrv.success('新增货物名称成功');
this.st.load(1);
}
});
}
return true;
}
});
}
/**
* 删除货物类型
* @param item
*/
removeType(item: any) {
this.nzModalService.warning({
nzTitle: '确定删除该货物类型吗?',
nzContent: '分类下含有内容则无法删除,请确认',
nzOnOk: () => {
this.service.request(this.service.$api_remove_config, [item.id]).subscribe(res => {
if (res) {
this.getTypeList();
this.service.msgSrv.success('删除货物类型成功');
}
});
}
});
}
/**
* 删除货物名称
* @param item
*/
removeTypeItem(item: any) {
this.nzModalService.warning({
nzTitle: '确定删除该货物名称吗?',
nzContent: '删除后不可恢复,谨慎操作',
nzOnOk: () => {
this.service.request(this.service.$api_remove_config_item, [item.id]).subscribe(res => {
if (res) {
this.service.msgSrv.success('删除货物名称成功');
this.st.load(1);
}
});
}
});
}
/**
* 修改类型排序
* @param item
* @param sortMode
*/
sortType(item: any, sortMode: 1 | 2 | 3 | 4) {
this.service.request(this.service.$api_update_config_sort, { id: item.id, sortMode }).subscribe(res => {
if (res) {
this.service.msgSrv.success('更新排序成功');
this.getTypeList();
} else {
this.service.msgSrv.warning('更新排序失败');
}
});
}
/**
* 修改类型详情排序
* @param item
* @param sortMode
*/
sortTypeItem(item: any, sortMode: 1 | 2 | 3 | 4) {
this.service.request(this.service.$api_update_config_item_sort, { id: item.id, sortMode }).subscribe(res => {
if (res) {
this.service.msgSrv.success('更新排序成功');
this.st.load(1);
} else {
this.service.msgSrv.warning('更新排序失败');
}
});
}
}

View File

@ -92,6 +92,27 @@ export class SystemService extends BaseService {
// 编辑协议
public $api_update_agreement = '/api/mdc/pbc/agreementInfo/modifyAgreementInfo';
// 根据FullKey获取系统子配置(树)
public $api_get_config_tree = '/api/mdc/pbc/sysConfig/getSysConfigTreeByParentFullKey';
// 新增系统配置
public $api_add_config = '/api/mdc/pbc/sysConfig/save';
// 更新系统配置
public $api_update_config = '/api/mdc/pbc/sysConfig/update';
// 更新系统配置排序
public $api_update_config_sort = '/api/mdc/pbc/sysConfig/updateSort';
// 删除系统配置
public $api_remove_config = '/api/mdc/pbc/sysConfig/deletebatch';
// 查询系统配置项
public $api_get_config_item_page = '/api/mdc/pbc/sysConfigItem/list/page';
// 新增系统配置项
public $api_add_config_item = '/api/mdc/pbc/sysConfigItem/save';
// 更新系统配置项
public $api_update_config_item = '/api/mdc/pbc/sysConfigItem/update';
// 更新系统配置项排序
public $api_update_config_item_sort = '/api/mdc/pbc/sysConfigItem/updateSort';
// 删除系统配置项
public $api_remove_config_item = '/api/mdc/pbc/sysConfigItem/deletebatch';
$api_getRoleTemplateInfo: string = '';
$api_getFunctionButtonInfo: string = '';
$api_getFunctionDataInfo: string = '';