1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
import { Prop, Provide, Emit, Model } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs';
import { Watch, GridControllerBase } from '@/studio-core';
import ProductSubstituteService from '@/service/product-substitute/product-substitute-service';
import MainService from './main-grid-service';
import ProductSubstituteUIService from '@/uiservice/product-substitute/product-substitute-ui-service';
import { FormItemModel } from '@/model/form-detail';
/**
* grid部件基类
*
* @export
* @class GridControllerBase
* @extends {MainGridBase}
*/
export class MainGridBase extends GridControllerBase {
/**
* 获取部件类型
*
* @protected
* @type {string}
* @memberof MainGridBase
*/
protected controlType: string = 'GRID';
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof MainGridBase
*/
public service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {ProductSubstituteService}
* @memberof MainGridBase
*/
public appEntityService: ProductSubstituteService = new ProductSubstituteService({ $store: this.$store });
/**
* 应用实体名称
*
* @protected
* @type {string}
* @memberof MainGridBase
*/
protected appDeName: string = 'productsubstitute';
/**
* 界面UI服务对象
*
* @type {ProductSubstituteUIService}
* @memberof MainBase
*/
public appUIService:ProductSubstituteUIService = new ProductSubstituteUIService(this.$store);
/**
* 界面行为模型
*
* @type {*}
* @memberof MainBase
*/
public ActionModel: any = {
};
/**
* 本地缓存标识
*
* @protected
* @type {string}
* @memberof GridControllerBase
*/
protected localStorageTag: string = 'productsubstitute_main_grid';
/**
* 所有列成员
*
* @type {any[]}
* @memberof MainGridBase
*/
public allColumns: any[] = [
{
name: 'substitutedproductname',
label: '相关产品',
langtag: 'entities.productsubstitute.main_grid.columns.substitutedproductname',
show: true,
util: 'PX',
isEnableRowEdit: false,
},
{
name: 'salesrelationshiptype',
label: '销售关系类型',
langtag: 'entities.productsubstitute.main_grid.columns.salesrelationshiptype',
show: true,
util: 'PX',
isEnableRowEdit: false,
},
{
name: 'direction',
label: '方向',
langtag: 'entities.productsubstitute.main_grid.columns.direction',
show: true,
util: 'PX',
isEnableRowEdit: false,
},
]
/**
* 获取表格行模型
*
* @type {*}
* @memberof MainGridBase
*/
public getGridRowModel(){
return {
srfkey: new FormItemModel(),
}
}
/**
* 属性值规则
*
* @type {*}
* @memberof MainGridBase
*/
public rules: any = {
srfkey: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '产品关系 ID 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '产品关系 ID 值不能为空', trigger: 'blur' },
],
}
/**
* 获取对应列class
*
* @type {*}
* @memberof MainBase
*/
public hasRowEdit: any = {
'substitutedproductname':false,
'salesrelationshiptype':false,
'direction':false,
};
/**
* 获取对应列class
*
* @param {*} $args row 行数据,column 列数据,rowIndex 行索引,列索引
* @returns {void}
* @memberof MainBase
*/
public getCellClassName(args: {row: any, column: any, rowIndex: number, columnIndex: number}): any {
return ( this.hasRowEdit[args.column.property] && this.actualIsOpenEdit ) ? "edit-cell" : "info-cell";
}
/**
* 导出数据格式化
*
* @param {*} filterVal
* @param {*} jsonData
* @param {any[]} [codelistColumns=[]]
* @returns {Promise<any>}
* @memberof MainGridBase
*/
public async formatExcelData(filterVal: any, jsonData: any, codelistColumns?: any[]): Promise<any> {
return super.formatExcelData(filterVal, jsonData, [
{
name: 'salesrelationshiptype',
srfkey: 'Productsubstitute__SalesRelationshipType',
codelistType : 'STATIC',
renderMode: 'other',
textSeparator: '、',
valueSeparator: ',',
},
{
name: 'direction',
srfkey: 'Productsubstitute__Direction',
codelistType : 'STATIC',
renderMode: 'other',
textSeparator: '、',
valueSeparator: ',',
},
]);
}
}