centaline-data-driven 1.2.81 → 1.2.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/Form.vue +5 -4
- package/src/centaline/api/index.js +7 -17
- package/src/centaline/dynamicDetail/src/dynamicPropertyDetailRET.vue +16 -1
- package/src/centaline/dynamicDetail/src/dynamicPropertySimpleDetailRET.vue +15 -0
- package/src/centaline/dynamicFile/src/dynamicFile.vue +15 -37
- package/src/centaline/dynamicForm/src/dynamicForm.vue +10 -2
- package/src/centaline/dynamicForm/src/dynamicFormListTable.vue +18 -7
- package/src/centaline/dynamicLayout/src/dynamicLayout.vue +198 -14
- package/src/centaline/dynamicLayout/src/dynamicLayoutChildren.vue +14 -6
- package/src/centaline/dynamicLayout/src/dynamicLayoutChildrenFor.vue +39 -0
- package/src/centaline/dynamicLayout/src/dynamicLayoutImage.vue +1 -1
- package/src/centaline/dynamicSearchList/src/dynamicSearchTable.vue +101 -65
- package/src/centaline/loader/src/ctl/Base.js +3 -0
- package/src/centaline/loader/src/ctl/CellLayout.js +1 -63
- package/src/centaline/loader/src/ctl/File.js +0 -1
- package/src/centaline/loader/src/ctl/Form.js +8 -8
- package/src/centaline/loader/src/ctl/FormList.js +7 -0
- package/src/centaline/loader/src/ctl/Router.js +2 -2
- package/src/centaline/loader/src/ctl/SearchTable.js +49 -252
- package/src/main.js +2 -2
- package/wwwroot/static/centaline/centaline-data-driven.js +3 -3
- package/wwwroot/static/centaline/centaline-data-driven.js.map +1 -1
package/README.md
CHANGED
|
@@ -128,9 +128,9 @@ execServerScript(action, object, successCallback)
|
|
|
128
128
|
/**
|
|
129
129
|
* @method
|
|
130
130
|
* @param {string} message 消息文字。
|
|
131
|
-
* @param {string}
|
|
132
|
-
* @param {boolean}
|
|
133
|
-
* @param {number} duration 显示时间,
|
|
131
|
+
* @param {string} type 主题:success/warning/info/error。
|
|
132
|
+
* @param {boolean} center 是否居中。
|
|
133
|
+
* @param {number} duration 显示时间,1500毫秒。设为 0 则不会自动关闭。
|
|
134
134
|
* @param {boolean} showClose 是否显示关闭按钮。
|
|
135
135
|
* @desc 消息提示。常用于主动操作后的反馈提示。
|
|
136
136
|
*/
|
package/package.json
CHANGED
package/src/Form.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div id="app-form" class="data-driven" style="width:100%;height:100%;overflow:auto">
|
|
3
3
|
<!-- <ct-form :api="'/PropertyRET/getLayoutOfNew'" :apiParam="apiParam"></ct-form> -->
|
|
4
4
|
<!-- <ct-form :source="formdata.content" :apiParam="apiParam"></ct-form> -->
|
|
5
|
-
<ct-form :api="'/api/
|
|
5
|
+
<ct-form :api="'/api/finance/refund-apply/refundApplyView'" :apiParam="apiParam"></ct-form>
|
|
6
6
|
<!--<ct-form :api="'api/Form/formdata'"></ct-form>-->
|
|
7
7
|
<ct-dialog-list></ct-dialog-list>
|
|
8
8
|
</div>
|
|
@@ -18,11 +18,12 @@
|
|
|
18
18
|
// apiParam: {originalTraId: "1475658732246241281", actionType: 2, chanceID: "1"} ,
|
|
19
19
|
// apiParam: {originalTraId: "1516290587463507969", actionType: "3", pageStyle: "2", pageTitle: "成交报告",pageOnly: "true"}
|
|
20
20
|
apiParam:{
|
|
21
|
-
actionType:
|
|
22
|
-
originalTraId: "
|
|
21
|
+
actionType: 1,
|
|
22
|
+
originalTraId: "1491279498301755394",
|
|
23
23
|
pageOnly: true,
|
|
24
24
|
pageStyle: 2,
|
|
25
|
-
pageTitle: "
|
|
25
|
+
pageTitle: "放款申请查看",
|
|
26
|
+
paymentId: "1524305327414583297"
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
},
|
|
@@ -156,7 +156,7 @@ const api = {
|
|
|
156
156
|
}
|
|
157
157
|
);
|
|
158
158
|
},
|
|
159
|
-
postThenHandler: function (response) {
|
|
159
|
+
postThenHandler: function (response,scripts) {
|
|
160
160
|
var data = response.data;
|
|
161
161
|
|
|
162
162
|
if (typeof common.getDataDrivenOpts().handler.requestComplete === 'function') {
|
|
@@ -165,7 +165,8 @@ const api = {
|
|
|
165
165
|
|
|
166
166
|
// 执行js
|
|
167
167
|
if (data.clientActionType === Enum.ClientActionType.ExcuteScript && data.content) {
|
|
168
|
-
eval(data.content);
|
|
168
|
+
// eval(data.content);
|
|
169
|
+
common.excute.call(scripts, data.content);
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
//关闭tab页
|
|
@@ -192,9 +193,6 @@ const api = {
|
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
if (data.notification === Enum.ActionType.Export && data.content) {//导出
|
|
195
|
-
//var fileName = data.content.fieldName1;
|
|
196
|
-
//var fileContent = window.atob(data.content.code1);
|
|
197
|
-
//Vue.prototype.$common.saveFile(fileName, fileContent);
|
|
198
196
|
var dialogOption = {
|
|
199
197
|
title: "导出",
|
|
200
198
|
content: [{
|
|
@@ -222,14 +220,6 @@ const api = {
|
|
|
222
220
|
}
|
|
223
221
|
else {
|
|
224
222
|
Vue.prototype.$message.error(response.data.rtnMsg);
|
|
225
|
-
// Vue.prototype.$message({
|
|
226
|
-
// message: response.data.rtnMsg,//消息文字
|
|
227
|
-
// dangerouslyUseHTMLString: false,
|
|
228
|
-
// type: 'error',//主题:success/warning/info/error
|
|
229
|
-
// center: true,//是否居中
|
|
230
|
-
// duration: 0, //显示时间, 毫秒。设为 0 则不会自动关闭
|
|
231
|
-
// showClose: true,//是否显示关闭按钮
|
|
232
|
-
// });
|
|
233
223
|
}
|
|
234
224
|
}
|
|
235
225
|
return Promise.reject(response);
|
|
@@ -237,22 +227,22 @@ const api = {
|
|
|
237
227
|
//返回给下一个链式调用
|
|
238
228
|
return Promise.resolve(response.data);
|
|
239
229
|
},
|
|
240
|
-
postHandler(url, params,
|
|
230
|
+
postHandler(url, params, scripts) {
|
|
241
231
|
if(common.flagRouterSelf()){
|
|
242
232
|
url=url+params.action;
|
|
243
233
|
params=params.para;
|
|
244
234
|
}
|
|
245
235
|
return Axios.post(url, params, {
|
|
246
236
|
headers: common.getDataDrivenOpts().handler.getRequestHeaders()
|
|
247
|
-
}).then(
|
|
248
|
-
|
|
237
|
+
}).then((response) => {
|
|
238
|
+
return this.postThenHandler(response,scripts);
|
|
239
|
+
}).catch((ex) => {
|
|
249
240
|
if (ex.message) {
|
|
250
241
|
Vue.prototype.$message.error(ex.message);
|
|
251
242
|
}
|
|
252
243
|
else if (typeof ex.data === "string") {
|
|
253
244
|
Vue.prototype.$message.error(ex.data);
|
|
254
245
|
}
|
|
255
|
-
//return Promise.reject(ex.data ? ex.data : ex);
|
|
256
246
|
return Promise.resolve(ex.data ? ex.data : ex);//错误处理了,直接返回成功,要判断response.rtnCode=200再处理
|
|
257
247
|
});
|
|
258
248
|
}
|
|
@@ -354,6 +354,20 @@
|
|
|
354
354
|
if(this.model.tags2 && this.model.tags2[0]){
|
|
355
355
|
this.model.getTags2List(0);
|
|
356
356
|
}
|
|
357
|
+
if (typeof window.localStorage !== 'undefined') {
|
|
358
|
+
var tagkey = window.localStorage.getItem('detailtagkey');
|
|
359
|
+
for (var i = 0; i < self.model.tags1.length; i++) {
|
|
360
|
+
if (tagkey == self.model.tags1[i].appID) {
|
|
361
|
+
self.model.activeIndex1 = i.toString();
|
|
362
|
+
if (self.model.tags1 && self.model.tags1[i]) {
|
|
363
|
+
self.listKey = self.listKey + 1;
|
|
364
|
+
self.model.searchConditionApiTags1 = self.model.tags1[i].searchConditionApiUrl || '';
|
|
365
|
+
self.model.searchDataApiTags1 = self.model.tags1[i].searchDataApiUrl || '';
|
|
366
|
+
self.model.paramDataTags1 = self.model.tags1[i].paramData || '';
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
357
371
|
this.loadOperation();
|
|
358
372
|
this.loadCommission();
|
|
359
373
|
this.setDetailHeight();
|
|
@@ -444,7 +458,8 @@
|
|
|
444
458
|
this.listKey=this.listKey+1;
|
|
445
459
|
this.model.searchConditionApiTags1=this.model.tags1[i].searchConditionApiUrl||'';
|
|
446
460
|
this.model.searchDataApiTags1=this.model.tags1[i].searchDataApiUrl||'';
|
|
447
|
-
this.model.paramDataTags1=this.model.tags1[i].paramData||'';
|
|
461
|
+
this.model.paramDataTags1 = this.model.tags1[i].paramData || '';
|
|
462
|
+
window.localStorage.setItem("detailtagkey", this.model.tags1[i].appID);//存储
|
|
448
463
|
}
|
|
449
464
|
},
|
|
450
465
|
fieldClickHandler(field) {
|
|
@@ -149,6 +149,20 @@
|
|
|
149
149
|
if(this.model.tags2 && this.model.tags2[0]){
|
|
150
150
|
this.model.getTags2List(0);
|
|
151
151
|
}
|
|
152
|
+
if (typeof window.localStorage !== 'undefined') {
|
|
153
|
+
var tagkey = window.localStorage.getItem('simpletagkey');
|
|
154
|
+
for (var i = 0; i < self.model.tags1.length;i++) {
|
|
155
|
+
if (tagkey == self.model.tags1[i].appID) {
|
|
156
|
+
self.model.activeIndex1 = i.toString();
|
|
157
|
+
if (self.model.tags1 && self.model.tags1[i]) {
|
|
158
|
+
self.listKey = self.listKey + 1;
|
|
159
|
+
self.model.searchConditionApiTags1 = self.model.tags1[i].searchConditionApiUrl || '';
|
|
160
|
+
self.model.searchDataApiTags1 = self.model.tags1[i].searchDataApiUrl || '';
|
|
161
|
+
self.model.paramDataTags1 = self.model.tags1[i].paramData || '';
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
152
166
|
this.loadOperation();
|
|
153
167
|
this.setDetailStyle();
|
|
154
168
|
this.$nextTick(() => {
|
|
@@ -249,6 +263,7 @@
|
|
|
249
263
|
this.model.searchConditionApiTags1 = this.model.tags1[i].searchConditionApiUrl || '';
|
|
250
264
|
this.model.searchDataApiTags1 = this.model.tags1[i].searchDataApiUrl || '';
|
|
251
265
|
this.model.paramDataTags1 = this.model.tags1[i].paramData || '';
|
|
266
|
+
window.localStorage.setItem("simpletagkey", this.model.tags1[i].appID);//存储
|
|
252
267
|
}
|
|
253
268
|
},
|
|
254
269
|
fieldClickHandler(field) {
|
|
@@ -207,7 +207,6 @@
|
|
|
207
207
|
},
|
|
208
208
|
//不能共用的数据校验
|
|
209
209
|
selfValidExcute: function (eventName) {
|
|
210
|
-
|
|
211
210
|
if (this.model.required) {
|
|
212
211
|
if (this.model.getfileListLength() === 0) {
|
|
213
212
|
this.validMessage = "必须上传附件";
|
|
@@ -217,48 +216,31 @@
|
|
|
217
216
|
}
|
|
218
217
|
|
|
219
218
|
if (this.model.max) {
|
|
220
|
-
|
|
221
|
-
if(this.model.getfileListLength() >= this.model.max)
|
|
222
|
-
{
|
|
219
|
+
if(this.model.getfileListLength() >= this.model.max){
|
|
223
220
|
this.disableUpload=true;
|
|
224
|
-
}
|
|
225
|
-
{
|
|
221
|
+
}
|
|
222
|
+
else{
|
|
226
223
|
this.disableUpload=false;
|
|
227
224
|
}
|
|
228
|
-
|
|
229
|
-
// if (this.model.getfileListLength() > this.model.max) {
|
|
230
|
-
// this.validMessage = "附件数量";
|
|
231
|
-
// if(this.model.min)
|
|
232
|
-
// {
|
|
233
|
-
// this.validMessage += "最少" + this.model.min + "个"+",";
|
|
234
|
-
// }
|
|
235
|
-
// // this.validMessage += "最多" + this.model.max+ "个";
|
|
236
|
-
// this.valid = false;
|
|
237
|
-
// return false;
|
|
238
|
-
// }
|
|
239
225
|
}
|
|
240
226
|
if (this.model.min) {
|
|
241
227
|
if (this.model.getfileListLength() < this.model.min) {
|
|
242
228
|
//change时需要判断有没有上传图片如果没有图片则不提示
|
|
243
|
-
|
|
244
|
-
if(eventName=='change' && this.model.getfileListLength()>0)
|
|
245
|
-
{
|
|
229
|
+
if(eventName=='change' && this.model.getfileListLength()>0){
|
|
246
230
|
this.validMessage = "附件数量还差" + (parseInt(this.model.min)-this.model.getfileListLength()) + "张";
|
|
247
231
|
this.valid = false;
|
|
248
|
-
}
|
|
249
|
-
{
|
|
232
|
+
}
|
|
233
|
+
else if(eventName=='valid'){
|
|
250
234
|
this.validMessage = "附件数量还差" + (parseInt(this.model.min)-this.model.getfileListLength()) + "张";
|
|
251
235
|
this.valid = false;
|
|
252
|
-
}else if(eventName=='remove')
|
|
253
|
-
{
|
|
254
|
-
this.valid = true;
|
|
255
236
|
}
|
|
256
|
-
|
|
237
|
+
else if(eventName=='remove'){
|
|
238
|
+
this.valid = true;
|
|
239
|
+
}
|
|
257
240
|
return false;
|
|
258
241
|
}
|
|
259
242
|
}
|
|
260
|
-
if(eventName=='valid'&&!this.validFileClass())
|
|
261
|
-
{
|
|
243
|
+
if(eventName=='valid'&&!this.validFileClass()){
|
|
262
244
|
this.validMessage="请选择附件分类";
|
|
263
245
|
this.valid = false;
|
|
264
246
|
return false;
|
|
@@ -267,17 +249,13 @@
|
|
|
267
249
|
return this.valid;
|
|
268
250
|
},
|
|
269
251
|
//验证附件分类是否必填
|
|
270
|
-
validFileClass()
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
{
|
|
274
|
-
if(this.model.sourceList&&this.model.sourceList.length>0)
|
|
275
|
-
{
|
|
252
|
+
validFileClass(){
|
|
253
|
+
if(this.model.paramName){
|
|
254
|
+
if(this.model.sourceList&&this.model.sourceList.length>0){
|
|
276
255
|
let notClass= this.model.sourceList.filter(item=>{
|
|
277
|
-
return item.mediaLabelID==undefined||item.mediaLabelID=="";
|
|
256
|
+
return (item.mediaLabelID==undefined||item.mediaLabelID=="") && item.flagDeleted !== true;
|
|
278
257
|
})
|
|
279
|
-
if(notClass.length>0)
|
|
280
|
-
{
|
|
258
|
+
if(notClass.length>0){
|
|
281
259
|
return false
|
|
282
260
|
}
|
|
283
261
|
}
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
else{
|
|
413
413
|
self.model.doAction(data);
|
|
414
414
|
}
|
|
415
|
-
})
|
|
415
|
+
},self.model.scripts);
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
}
|
|
@@ -474,6 +474,14 @@
|
|
|
474
474
|
self.model.hiddenHandle(field);
|
|
475
475
|
self.model.requiredHandle(field);
|
|
476
476
|
//self.model.validMrf(field);
|
|
477
|
+
|
|
478
|
+
if(field.onAfterChanged){
|
|
479
|
+
var router =self.model.actionRouters.find((v) => {
|
|
480
|
+
return v.id === field.onAfterChanged;
|
|
481
|
+
});
|
|
482
|
+
self.clickHandler(router);
|
|
483
|
+
}
|
|
484
|
+
|
|
477
485
|
self.$forceUpdate();
|
|
478
486
|
},
|
|
479
487
|
changeCallBackHandler(field, callBackFunName, callBackPara) {
|
|
@@ -552,7 +560,7 @@
|
|
|
552
560
|
self.$refs.Fields.forEach((f) => {
|
|
553
561
|
if (f.model && typeof f.validExcute !== 'undefined') {
|
|
554
562
|
if (!f.validExcute()) {
|
|
555
|
-
if(i===0){
|
|
563
|
+
if(i===0 && f.model.label){
|
|
556
564
|
self.$message.error('【'+f.model.label+'】不能为空!');
|
|
557
565
|
}
|
|
558
566
|
i++;
|
|
@@ -31,12 +31,11 @@
|
|
|
31
31
|
<component v-if ref="Fields" :is="v.is" :vmodel="scope.row[v.id]" :vrowmodel="scope.row" :api="model.OptApi"></component>
|
|
32
32
|
</span>
|
|
33
33
|
<!--可点击的列-->
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</span> -->
|
|
34
|
+
<span v-else-if="v.router" :class="'cell'" style="display: flex;">
|
|
35
|
+
<ct-tablecurrency :router="v.router" :colValue="scope.row[v.id].code1" :rowData="scope.row"
|
|
36
|
+
@click="rolRouterClickHandler">
|
|
37
|
+
</ct-tablecurrency>
|
|
38
|
+
</span>
|
|
40
39
|
<ct-span v-else :vmodel="scope.row[v.id]" :rowNum="scope.row.$sourceIndex" ref="FieldsLabel"></ct-span>
|
|
41
40
|
</template>
|
|
42
41
|
</el-table-column>
|
|
@@ -53,7 +52,7 @@
|
|
|
53
52
|
<span v-else-if="scope.row.isSet" class="el-tag el-tag--mini" style="cursor: pointer;" @click="saveRow(scope.row,scope.$index,false)">
|
|
54
53
|
取消
|
|
55
54
|
</span>
|
|
56
|
-
<span v-for="(v,i) in model.buttons" v-if="!scope.row.isSet" class="el-tag el-tag--info el-tag--mini" style="cursor: pointer;" @click="buttonClick(scope.row, v)">
|
|
55
|
+
<span v-for="(v,i) in model.buttons" v-if="!scope.row.isSet && v.show" class="el-tag el-tag--info el-tag--mini" style="cursor: pointer;" @click="buttonClick(scope.row, v)">
|
|
57
56
|
{{v.label}}
|
|
58
57
|
</span>
|
|
59
58
|
</template>
|
|
@@ -288,6 +287,18 @@
|
|
|
288
287
|
|
|
289
288
|
this.$emit('tableButtonClick', button, submitData);
|
|
290
289
|
},
|
|
290
|
+
rolRouterClickHandler(field, rowData,rowindex) {
|
|
291
|
+
if(this.$refs['popover'+rowindex]){
|
|
292
|
+
this.$refs['popover'+rowindex][0].doClose();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
var submitData = {};
|
|
296
|
+
field.submitListField.forEach((k) => {
|
|
297
|
+
submitData[k] = rowData[k].value;
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
this.$emit('tableButtonClick', field, submitData);
|
|
301
|
+
},
|
|
291
302
|
//汇总行 计算
|
|
292
303
|
getSummaries(param) {
|
|
293
304
|
const self = this;
|
|
@@ -1,41 +1,222 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
</
|
|
2
|
+
<div v-loading="loading" class="ct-Layout" v-if="Layout !== null && !loading">
|
|
3
|
+
<ct-layoutchildren :rowindex="rowindex" :vmodel="Layout" @click="clickHandler"></ct-layoutchildren>
|
|
4
|
+
</div>
|
|
5
5
|
</template>
|
|
6
6
|
<script>
|
|
7
7
|
import dynamicElement from '../../mixins/dynamicElement'
|
|
8
|
-
import dynamicLayoutLabel from './dynamicLayoutLabel.vue';
|
|
9
|
-
import dynamicLayoutLine from './dynamicLayoutLine.vue';
|
|
10
|
-
import dynamicLayoutImage from './dynamicLayoutImage.vue';
|
|
11
8
|
import dynamicLayoutChildren from './dynamicLayoutChildren.vue';
|
|
12
9
|
export default {
|
|
13
10
|
name: 'ct-layout',
|
|
14
11
|
mixins: [dynamicElement],
|
|
15
12
|
components: {
|
|
16
|
-
'ct-layoutlabel': dynamicLayoutLabel,
|
|
17
|
-
'ct-layoutline': dynamicLayoutLine,
|
|
18
|
-
'ct-layoutimage': dynamicLayoutImage,
|
|
19
13
|
'ct-layoutchildren': dynamicLayoutChildren
|
|
20
14
|
},
|
|
21
15
|
props: {
|
|
16
|
+
api: String,
|
|
17
|
+
cellLayout: String,
|
|
22
18
|
vmodel: Object,
|
|
23
19
|
rowindex: Number,
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
actionRouter: Array,
|
|
21
|
+
listData: Array,
|
|
22
|
+
apiParam: Object
|
|
26
23
|
},
|
|
27
24
|
data() {
|
|
28
25
|
return {
|
|
29
|
-
|
|
26
|
+
Layout: []
|
|
30
27
|
};
|
|
31
28
|
},
|
|
32
29
|
created() {
|
|
33
|
-
this.
|
|
30
|
+
this.init();
|
|
34
31
|
},
|
|
35
32
|
methods: {
|
|
33
|
+
init() {
|
|
34
|
+
var self = this;
|
|
35
|
+
//初始化
|
|
36
|
+
this.loading = true;
|
|
37
|
+
this.$nextTick(function () {
|
|
38
|
+
if (typeof self.api !== 'undefined') {
|
|
39
|
+
self.loaderObj.CellLayout(self.api, self.load, this.apiParam, self.failLoad);
|
|
40
|
+
}
|
|
41
|
+
else if (typeof self.vmodel !== 'undefined') {
|
|
42
|
+
self.load(self.vmodel, self.cellLayout);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
failLoad() {
|
|
47
|
+
this.$emit('failLoad', this.model);
|
|
48
|
+
},
|
|
49
|
+
load(data, cellLayout) {
|
|
50
|
+
var str = '';
|
|
51
|
+
if (cellLayout.indexOf("for=") != -1) {
|
|
52
|
+
var cellxmlDOM = this.loadXML(cellLayout);
|
|
53
|
+
var listxml = this.getxmlForStr(cellxmlDOM);
|
|
54
|
+
|
|
55
|
+
if (typeof listxml !== 'undefined') {
|
|
56
|
+
for (var j = 0; j < listxml.attributes.length; j++) {
|
|
57
|
+
var attribute = listxml.attributes.item(j);
|
|
58
|
+
if (attribute.nodeName.toLowerCase() == "for".toLowerCase()) {
|
|
59
|
+
var liststr = "";
|
|
60
|
+
var celllist = this.xmlToString(listxml)
|
|
61
|
+
|
|
62
|
+
var celllistNew = this.loadXML(celllist);
|
|
63
|
+
var newAtt = celllistNew.createAttribute("forrowindex");
|
|
64
|
+
newAtt.nodeValue = "{{forrowindex}}";
|
|
65
|
+
var x = celllistNew.getElementsByTagName("Layout");
|
|
66
|
+
x[0].setAttributeNode(newAtt);
|
|
67
|
+
var cellstr = this.xmlToString(celllistNew)
|
|
68
|
+
var list = data[attribute.nodeValue];
|
|
69
|
+
if (typeof list !== 'undefined') {
|
|
70
|
+
for (var i = 0; i < list.length; i++) {
|
|
71
|
+
list[i].forrowindex = i;
|
|
72
|
+
liststr += cellstr.replace(/\{\{(.+?)\}\}/g, (...args) => {
|
|
73
|
+
return this.getValue(list[i], args[1])
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
cellLayout = cellLayout.replace(/\n/g, '').trim() //去除换行 和头尾空格
|
|
78
|
+
let replacer = function (match, p1, p2, p3, offset) {
|
|
79
|
+
return p1 + p3
|
|
80
|
+
}
|
|
81
|
+
cellLayout = cellLayout.replace(/(>)(\s*)(<)/g, replacer) //把 > 和 < 之间的空格去除
|
|
82
|
+
cellLayout = cellLayout.replace(/ +/g, ' ')
|
|
83
|
+
cellLayout = cellLayout.replace(celllist, liststr)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (typeof data !== 'undefined') {
|
|
89
|
+
str = cellLayout.replace(/\{\{(.+?)\}\}/g, (...args) => {
|
|
90
|
+
return this.getValue(data, args[1])
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
var xmlDOM = this.loadXML(str);
|
|
94
|
+
this.Layout = this.xmlToJson(xmlDOM);
|
|
95
|
+
this.loading = false;
|
|
96
|
+
},
|
|
97
|
+
getValue(data, val) {
|
|
98
|
+
return val.split('.').reduce((data, currentVal) => {
|
|
99
|
+
var rtn = data[currentVal];
|
|
100
|
+
if (rtn.toString().indexOf('"') != -1) {
|
|
101
|
+
rtn = rtn.replace(/"/g, "'");
|
|
102
|
+
rtn = rtn.replace(/>/g, ">");
|
|
103
|
+
rtn = rtn.replace(/</g, "<");
|
|
104
|
+
}
|
|
105
|
+
return rtn
|
|
106
|
+
}, data)
|
|
107
|
+
},
|
|
108
|
+
loadXML(xmlString) {
|
|
109
|
+
xmlString = xmlString.replace(/\n/g, '').trim()
|
|
110
|
+
let replacer = function (match, p1, p2, p3, offset) {
|
|
111
|
+
return p1 + p3
|
|
112
|
+
}
|
|
113
|
+
xmlString = xmlString.replace(/(>)(\s*)(<)/g, replacer)
|
|
114
|
+
if (document.all) {
|
|
115
|
+
var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
|
|
116
|
+
xmlDom.loadXML(xmlString)
|
|
117
|
+
return xmlDom
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
return new DOMParser().parseFromString(xmlString, "text/xml");
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
xmlToString(xmlObj) {
|
|
124
|
+
if (document.all) //IE浏览器
|
|
125
|
+
{
|
|
126
|
+
return xmlObj.xml;
|
|
127
|
+
}
|
|
128
|
+
else //其他浏览器
|
|
129
|
+
{
|
|
130
|
+
return (new XMLSerializer()).serializeToString(xmlObj);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
getxmlForStr(xml) {
|
|
134
|
+
if (xml.nodeType == 1) { // element
|
|
135
|
+
// do attributes
|
|
136
|
+
if (xml.attributes.length > 0) {
|
|
137
|
+
for (var j = 0; j < xml.attributes.length; j++) {
|
|
138
|
+
var attribute = xml.attributes.item(j);
|
|
139
|
+
if (attribute.nodeName.toLowerCase() == "for".toLowerCase()) {
|
|
140
|
+
return xml
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (xml.hasChildNodes()) {
|
|
146
|
+
for (var i = 0; i < xml.childNodes.length; i++) {
|
|
147
|
+
var item = xml.childNodes.item(i);
|
|
148
|
+
var result = this.getxmlForStr(item);
|
|
149
|
+
if (result) {
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
xmlToJson(xml) {
|
|
157
|
+
var self = this;
|
|
158
|
+
// Create the return object
|
|
159
|
+
var obj = {};
|
|
160
|
+
if (xml.nodeName.toLowerCase() == "Layout".toLowerCase() || xml.nodeName.toLowerCase() == "StackLayout".toLowerCase()) {
|
|
161
|
+
obj["is"] = "ct-layoutchildren";
|
|
162
|
+
}
|
|
163
|
+
else if (xml.nodeName.toLowerCase() == "Label".toLowerCase()) {
|
|
164
|
+
obj["is"] = "ct-layoutlabel";
|
|
165
|
+
}
|
|
166
|
+
else if (xml.nodeName.toLowerCase() == "Line".toLowerCase()) {
|
|
167
|
+
obj["is"] = "ct-layoutline";
|
|
168
|
+
}
|
|
169
|
+
else if (xml.nodeName.toLowerCase() == "Image".toLowerCase()) {
|
|
170
|
+
obj["is"] = "ct-layoutimage";
|
|
171
|
+
}
|
|
172
|
+
if (xml.nodeType == 1) { // element
|
|
173
|
+
// do attributes
|
|
174
|
+
if (xml.attributes.length > 0) {
|
|
175
|
+
for (var j = 0; j < xml.attributes.length; j++) {
|
|
176
|
+
var attribute = xml.attributes.item(j);
|
|
177
|
+
obj[attribute.nodeName] = attribute.nodeValue;
|
|
178
|
+
if (attribute.nodeName.toLowerCase() == "for".toLowerCase()) {
|
|
179
|
+
obj["is"] = "ct-layoutchildrenfor";
|
|
180
|
+
}
|
|
181
|
+
if (attribute.nodeName.toLowerCase() == "routerKey".toLowerCase()) {
|
|
182
|
+
var actionRouter = self.actionRouter;
|
|
183
|
+
let field = actionRouter.find(b => {
|
|
184
|
+
return b.id === attribute.nodeValue;
|
|
185
|
+
});
|
|
186
|
+
if (typeof field !== "undefined") {
|
|
187
|
+
if (!field.rightField || self.vmodel[field.rightField] == 1) {
|
|
188
|
+
obj["rightRouter"] = true;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// do children
|
|
198
|
+
if (xml.hasChildNodes()) {
|
|
199
|
+
for (var i = 0; i < xml.childNodes.length; i++) {
|
|
200
|
+
var item = xml.childNodes.item(i);
|
|
201
|
+
if (typeof (obj["fields"]) == "undefined") {
|
|
202
|
+
obj["fields"] = [];
|
|
203
|
+
obj["fields"].push(this.xmlToJson(item));
|
|
204
|
+
} else {
|
|
205
|
+
if (typeof (obj["fields"].push) == "undefined") {
|
|
206
|
+
var old = obj["fields"];
|
|
207
|
+
obj["fields"] = [];
|
|
208
|
+
obj["fields"].push(old);
|
|
209
|
+
}
|
|
210
|
+
obj["fields"].push(this.xmlToJson(item));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return obj;
|
|
215
|
+
},
|
|
36
216
|
clickHandler(routerKey, rowindex, forname, forrowindex) {
|
|
37
217
|
this.$emit('click', routerKey, rowindex, forname, forrowindex);
|
|
38
|
-
}
|
|
218
|
+
},
|
|
219
|
+
|
|
39
220
|
},
|
|
40
221
|
mounted() {
|
|
41
222
|
|
|
@@ -43,4 +224,7 @@
|
|
|
43
224
|
}
|
|
44
225
|
</script>
|
|
45
226
|
<style>
|
|
227
|
+
.ct-Layout {
|
|
228
|
+
font-size: 12px;
|
|
229
|
+
}
|
|
46
230
|
</style>
|
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-container :direction="model.orientation" :style="model.styleObject">
|
|
3
|
-
<
|
|
2
|
+
<el-container :direction="model.orientation" :style="model.styleObject" ref="layoutchildren">
|
|
3
|
+
<component v-for="(item, index) in model.fields" :key="index" :is="item.is" :vmodel="item" :rowindex="rowindex" :forname="forname" :forrowindex="forrowindex" @click="clickHandler"></component>
|
|
4
4
|
</el-container>
|
|
5
5
|
</template>
|
|
6
6
|
<script>
|
|
7
7
|
import dynamicElement from '../../mixins/dynamicElement'
|
|
8
|
+
import dynamicLayoutLabel from './dynamicLayoutLabel.vue';
|
|
9
|
+
import dynamicLayoutLine from './dynamicLayoutLine.vue';
|
|
10
|
+
import dynamicLayoutImage from './dynamicLayoutImage.vue';
|
|
11
|
+
import dynamicLayoutChildrenFor from './dynamicLayoutChildrenFor.vue';
|
|
8
12
|
export default {
|
|
9
13
|
name: 'ct-layoutchildren',
|
|
10
14
|
mixins: [dynamicElement],
|
|
11
15
|
components: {
|
|
12
|
-
'ct-
|
|
16
|
+
'ct-layoutlabel': dynamicLayoutLabel,
|
|
17
|
+
'ct-layoutline': dynamicLayoutLine,
|
|
18
|
+
'ct-layoutimage': dynamicLayoutImage,
|
|
19
|
+
'ct-layoutchildrenfor': dynamicLayoutChildrenFor
|
|
13
20
|
},
|
|
14
21
|
props: {
|
|
15
22
|
vmodel: Object,
|
|
16
|
-
rowindex: Number
|
|
23
|
+
rowindex: Number,
|
|
24
|
+
forname: String,
|
|
25
|
+
forrowindex: String
|
|
17
26
|
},
|
|
18
27
|
data() {
|
|
19
28
|
return {
|
|
20
|
-
|
|
21
|
-
forwindex: 0
|
|
29
|
+
forindex: 0
|
|
22
30
|
};
|
|
23
31
|
},
|
|
24
32
|
created() {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-container :direction="model.orientation" :style="model.styleObject">
|
|
3
|
+
<ct-layoutchildren v-for="(item, index) in model.fields" :key="index" :rowindex="rowindex" :forrowindex="model.forrowindex" :vmodel="item" :forname="model.forname" @click="clickHandler"></ct-layoutchildren>
|
|
4
|
+
</el-container>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
import dynamicElement from '../../mixins/dynamicElement'
|
|
8
|
+
export default {
|
|
9
|
+
name: 'ct-layoutchildrenfor',
|
|
10
|
+
mixins: [dynamicElement],
|
|
11
|
+
components: {
|
|
12
|
+
'ct-layoutchildren': () => import('./dynamicLayoutChildren.vue'),
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
vmodel: Object,
|
|
16
|
+
rowindex: Number
|
|
17
|
+
},
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
forname: '',
|
|
21
|
+
forwindex:0
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
created() {
|
|
25
|
+
this.model = this.loaderObj.CellLayout(this.vmodel);
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
clickHandler(routerKey, rowindex, forname, forrowindex) {
|
|
29
|
+
this.$emit('click', routerKey, rowindex, forname, forrowindex);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
mounted() {
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
<style>
|
|
38
|
+
|
|
39
|
+
</style>
|