centaline-data-driven 1.1.33 → 1.1.37
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/build/centaline/centaline.path.js +1 -0
- package/package.json +1 -1
- package/src/Form.vue +1 -1
- package/src/SearchTree.vue +3 -8
- package/src/assets/icon-eye.png +0 -0
- package/src/centaline/common/index.js +12 -6
- package/src/centaline/css/common.css +6 -1
- package/src/centaline/css/max.css +4 -1
- package/src/centaline/dynamicDetail/src/dynamicPropertyDetailRET.vue +1258 -4
- package/src/centaline/dynamicForm/src/dynamicForm.vue +1 -7
- package/src/centaline/dynamicInputNumber/src/dynamicInputNumber.vue +0 -4
- package/src/centaline/dynamicSearchList/src/dynamicSearchCategory.vue +5 -4
- package/src/centaline/dynamicSearchList/src/dynamicSearchList.vue +12 -3
- package/src/centaline/dynamicSearchList/src/dynamicSearchScreen.vue +5 -3
- package/src/centaline/dynamicSearchList/src/dynamicSearchTable.vue +16 -7
- package/src/centaline/dynamicSensitiveEye/src/dynamicSensitiveEye.vue +18 -5
- package/src/centaline/dynamicSw/src/dynamicSw.vue +2 -2
- package/src/centaline/dynamicTree/src/dynamicTreeList.vue +7 -8
- package/src/centaline/formData/index.js +279 -0
- package/src/centaline/loader/src/ctl/Form.js +2 -319
- package/src/centaline/loader/src/ctl/SearchTable.js +19 -1
- package/src/centaline/validate/index.js +18 -4
- package/src/main.js +7 -1
- package/wwwroot/static/centaline/centaline-data-driven.js +1 -1
- package/wwwroot/static/centaline/centaline-data-driven.js.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-loading="loading" style="width:100%">
|
|
3
|
-
<div v-if="model !== null && !loading" class="ct-form" :class="{'
|
|
3
|
+
<div v-if="model !== null && !loading" class="ct-form" :class="{'domDisabled':model.pageDisabled}">
|
|
4
4
|
<!--可根据场景判断显示el-card还是el-main-->
|
|
5
5
|
<component :is="model.showTitle?'el-main':'el-card'">
|
|
6
6
|
<div slot="header" class="clearfix" v-if="typeof model.title !== 'undefined' && model.flagShowTitle">
|
|
@@ -523,9 +523,3 @@
|
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
</script>
|
|
526
|
-
<style>
|
|
527
|
-
.tableDisabled {
|
|
528
|
-
pointer-events: none;
|
|
529
|
-
opacity:0.4;
|
|
530
|
-
}
|
|
531
|
-
</style>
|
|
@@ -68,10 +68,8 @@
|
|
|
68
68
|
this.model.value = '';
|
|
69
69
|
this.inputHandler(this.model.value);
|
|
70
70
|
this.changeHandler(this.model.value);
|
|
71
|
-
console.log('clearClickHandle');
|
|
72
71
|
},
|
|
73
72
|
onInputHandler: function (val) {
|
|
74
|
-
|
|
75
73
|
this.model.value = this.$common.numFloat(this.model.value, this.model.decimals, this.inputOld);//保留n位小数
|
|
76
74
|
if (this.model.max !== "" && parseFloat(this.model.value) > parseFloat(this.model.max)) {
|
|
77
75
|
this.model.value = this.inputOld;
|
|
@@ -79,12 +77,10 @@
|
|
|
79
77
|
|
|
80
78
|
this.inputHandler(this.model.value);
|
|
81
79
|
this.changeHandler(this.model.value);//todo input事件里要不要加这个事件
|
|
82
|
-
console.log('onInputHandler');
|
|
83
80
|
},
|
|
84
81
|
onChangeHandler: function (val) {
|
|
85
82
|
this.changeHandler(this.model.value);
|
|
86
83
|
this.isShowClear();
|
|
87
|
-
console.log('onChangeHandler');
|
|
88
84
|
},
|
|
89
85
|
onBlurHandler:function(event){
|
|
90
86
|
this.model.value = this.$common.numToFloat(this.model.value, this.model.decimals);//保留n位小数
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
]">
|
|
4
4
|
<div style="flex:1;" :class="[model.showLabel?'el-input-group el-input-group--prepend':'',!valid?'inputError':'']">
|
|
5
5
|
<div v-if="model.showLabel && model.label" class="el-input-group__prepend" :class="[model.labelClass]">
|
|
6
|
-
<img v-if="model.preLabel" :src="model.preLabel" style="width:
|
|
6
|
+
<img v-if="model.preLabel" :src="model.preLabel" style="width: 1.3em;height: 1.3em;fill: currentColor;
|
|
7
7
|
overflow: hidden;vertical-align: middle;"/>
|
|
8
8
|
{{model.label}}
|
|
9
9
|
</div>
|
|
@@ -77,17 +77,18 @@
|
|
|
77
77
|
}
|
|
78
78
|
.ct-searchcategory .el-input-group__prepend{
|
|
79
79
|
text-align: left;
|
|
80
|
-
|
|
80
|
+
padding-left: 0px!important;
|
|
81
|
+
color: #ee6b6b !important;
|
|
81
82
|
font-weight: Bold;
|
|
82
83
|
text-shadow: 0 2px 2px rgb(121 0 4 / 10%);
|
|
83
|
-
font-size:
|
|
84
|
+
font-size: 16px;
|
|
84
85
|
vertical-align: middle;
|
|
85
86
|
}
|
|
86
87
|
.ct-searchcategory .ct-radios {
|
|
87
88
|
color: #606266;
|
|
88
89
|
border-radius: 4px;
|
|
89
90
|
/*border: 1px solid #dcdfe6;*/
|
|
90
|
-
line-height:
|
|
91
|
+
line-height: 30px;
|
|
91
92
|
padding-left: 15px;
|
|
92
93
|
text-align: right;
|
|
93
94
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="ct-search-list" :style="searchListStyle">
|
|
2
|
+
<div class="ct-search-list" :style="searchListStyle" :class="{'domDisabled':pageDisabled}">
|
|
3
3
|
<div slot="header" class="clearfix" v-if="typeof title !== 'undefined' && showTitle">
|
|
4
4
|
<span style="font-weight:bold">{{title}}</span>
|
|
5
5
|
</div>
|
|
6
6
|
<ct-searchcategory v-if="searchCategoryApi" ref="category" :api="searchCategoryApi" @loadedCategory="categoryLoaded"
|
|
7
7
|
@changeCategory="categorychange" ></ct-searchcategory>
|
|
8
8
|
|
|
9
|
-
<ct-searchscreen ref="screen" :api="searchConditionApi" :key="
|
|
9
|
+
<ct-searchscreen ref="screen" :api="searchConditionApi" :key="reloadKeyScreen"
|
|
10
10
|
@loaded="screenLoaded" :screenPara="screenPara"
|
|
11
11
|
:categoryLoaded="loaded.categoryLoaded" @search="search()"
|
|
12
12
|
@showTitle="showTitleScreenHandler"></ct-searchscreen>
|
|
13
13
|
|
|
14
14
|
<ct-searchtable ref="table" :api="searchDataApi" :searchDataStatisticsApi="searchDataStatisticsApi"
|
|
15
|
-
@toolbarClick="toolbarClickHandler" @refreshParent="refreshParentHandler" :key="
|
|
15
|
+
@toolbarClick="toolbarClickHandler" @refreshParent="refreshParentHandler" :key="reloadKeyTable" @searchComplate="searchComplate()"
|
|
16
16
|
@showTitle="showTitleHandler"></ct-searchtable>
|
|
17
17
|
</div>
|
|
18
18
|
</template>
|
|
@@ -69,7 +69,10 @@
|
|
|
69
69
|
showTitle:false,
|
|
70
70
|
screenPara:null,
|
|
71
71
|
reloadKey:0,
|
|
72
|
+
reloadKeyScreen:'s0',
|
|
73
|
+
reloadKeyTable:'t0',
|
|
72
74
|
isReload:false,
|
|
75
|
+
pageDisabled:false,
|
|
73
76
|
}
|
|
74
77
|
},
|
|
75
78
|
methods: {
|
|
@@ -86,15 +89,21 @@
|
|
|
86
89
|
categorychange(param) {
|
|
87
90
|
if(param)this.screenPara=param;
|
|
88
91
|
this.reloadKey = this.reloadKey+1;
|
|
92
|
+
this.reloadKeyScreen='s'+this.reloadKey;
|
|
93
|
+
this.reloadKeyTable='t'+this.reloadKey;
|
|
89
94
|
},
|
|
90
95
|
search(btn) {
|
|
91
96
|
if (this.$refs.table.model) {
|
|
97
|
+
this.pageDisabled=true;
|
|
92
98
|
this.$refs.table.getPage(1);
|
|
93
99
|
}
|
|
94
100
|
else {
|
|
95
101
|
this.$refs.table.searchComplate(this.$refs.screen.model);
|
|
96
102
|
}
|
|
97
103
|
},
|
|
104
|
+
searchComplate() {
|
|
105
|
+
this.pageDisabled=false;
|
|
106
|
+
},
|
|
98
107
|
toolbarClickHandler(field, submitData) {
|
|
99
108
|
if (field.isExport) {
|
|
100
109
|
this.$refs.screen.model.export(field, submitData);
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
</template>
|
|
9
9
|
<component v-for="(col, index) in model.btnScreen" :key="index" :is="col.is" :vmodel="col" :api="model.optionApi" @click="clickHandler(col)"></component>
|
|
10
10
|
</div>
|
|
11
|
-
|
|
12
11
|
<!--<el-row>
|
|
13
12
|
<el-col v-for="(col, index) in model.screen" :key="index" :span="col.colspan" style="padding:10px" v-if="col.show !== false">
|
|
14
13
|
<component :is="col.is" :vmodel="col" :api="model.optionApi" @click="clickHandler(col)"></component>
|
|
@@ -45,11 +44,14 @@
|
|
|
45
44
|
props: {
|
|
46
45
|
api: String,
|
|
47
46
|
vmodel: Object,
|
|
48
|
-
categoryLoaded:
|
|
47
|
+
categoryLoaded:{
|
|
48
|
+
type:Boolean,
|
|
49
|
+
default:true
|
|
50
|
+
},
|
|
49
51
|
screenPara: {
|
|
50
52
|
type: Object,
|
|
51
53
|
default: () => { }
|
|
52
|
-
}
|
|
54
|
+
},
|
|
53
55
|
},
|
|
54
56
|
data() {
|
|
55
57
|
return {
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
},
|
|
170
170
|
activated() {
|
|
171
171
|
this.$nextTick(() => {
|
|
172
|
-
this.calculatingRowHeight();
|
|
172
|
+
// this.calculatingRowHeight();
|
|
173
173
|
this.setTableHeight();
|
|
174
174
|
})
|
|
175
175
|
},
|
|
@@ -194,6 +194,8 @@
|
|
|
194
194
|
});
|
|
195
195
|
self.isLoading = false;
|
|
196
196
|
self.$forceUpdate();
|
|
197
|
+
this.model.scripts.formData = this.model.formData;
|
|
198
|
+
this.model.scripts.formData.form = this.model;
|
|
197
199
|
|
|
198
200
|
self.$emit('loaded');
|
|
199
201
|
self.$emit('showTitle');
|
|
@@ -332,6 +334,7 @@
|
|
|
332
334
|
self.tableLoading = false;
|
|
333
335
|
self.rowColorChange();
|
|
334
336
|
}
|
|
337
|
+
self.$emit('searchComplate');
|
|
335
338
|
}
|
|
336
339
|
self.tableLoading = true;
|
|
337
340
|
this.model.getPage(index, next);
|
|
@@ -526,10 +529,13 @@
|
|
|
526
529
|
this.currentRow.children[i].classList.remove('select');
|
|
527
530
|
}
|
|
528
531
|
}
|
|
529
|
-
|
|
530
|
-
|
|
532
|
+
if(this.$refs['rows.' + index][0])
|
|
533
|
+
{
|
|
534
|
+
for (var j = 0; j < this.$refs['rows.' + index][0].children.length; j++) {
|
|
535
|
+
this.$refs['rows.' + index][0].children[j].classList.add('select');
|
|
536
|
+
}
|
|
531
537
|
}
|
|
532
|
-
this.currentRow = this.$refs['rows.' + index][0];
|
|
538
|
+
this.currentRow = this.$refs['rows.' + index][0]||null;
|
|
533
539
|
}
|
|
534
540
|
},
|
|
535
541
|
resetScroll: function () {
|
|
@@ -644,7 +650,8 @@
|
|
|
644
650
|
var clickAcion = function () {
|
|
645
651
|
//若不是客户端方法,则直接访问接口
|
|
646
652
|
if (!field.isClientFuntion) {
|
|
647
|
-
|
|
653
|
+
// 外部框架tab页打开
|
|
654
|
+
if (field.isFormPageInTab || field.isSearchPageInTab) {
|
|
648
655
|
submitData = field.getActionPara(submitData).para;
|
|
649
656
|
if (field.pageStyle) {
|
|
650
657
|
submitData.pageStyle = field.pageStyle;
|
|
@@ -754,8 +761,10 @@
|
|
|
754
761
|
}
|
|
755
762
|
//执行客户端脚本
|
|
756
763
|
else {
|
|
757
|
-
|
|
758
|
-
|
|
764
|
+
let parm={submitData:submitData,field:field}
|
|
765
|
+
self.$common.excuteFunStr.call(self.model.scripts, field.action,parm);
|
|
766
|
+
// var fun = self.model.scripts.formData[action];
|
|
767
|
+
// fun(submitData,field);
|
|
759
768
|
}
|
|
760
769
|
}
|
|
761
770
|
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
<div v-if="model.showLabel && model.label" class="el-input-group__prepend field-label-div" :class="[model.labelClass]">
|
|
5
5
|
<span>{{model.label}}</span>
|
|
6
6
|
</div>
|
|
7
|
-
<span>{{showLable==true?model.labelValue1:model.labelValue}}</span>
|
|
8
|
-
<i v-if="model.labelValue" class="el-icon-view" @click="onSensitiveEye($event)"></i>
|
|
7
|
+
<span class="eyelabel">{{showLable==true?model.labelValue1:model.labelValue}}</span>
|
|
8
|
+
<i v-if="model.labelValue" :class="[!showLable?'el-icon-view':'el-icon-eye']" @click="onSensitiveEye($event)"></i>
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
</template>
|
|
13
|
+
|
|
13
14
|
<script>
|
|
14
15
|
import dynamicElement from '../../mixins/dynamicElement'
|
|
15
16
|
export default {
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
}
|
|
34
35
|
},
|
|
35
36
|
computed: {
|
|
36
|
-
|
|
37
|
+
|
|
37
38
|
},
|
|
38
39
|
methods: {
|
|
39
40
|
onSensitiveEye() {
|
|
@@ -54,8 +55,20 @@
|
|
|
54
55
|
}
|
|
55
56
|
</script>
|
|
56
57
|
<style>
|
|
57
|
-
.el-icon-view {
|
|
58
|
+
.el-icon-view, .el-icon-eye {
|
|
58
59
|
margin-left: 5px;
|
|
59
60
|
font-size: 16px;
|
|
60
61
|
}
|
|
62
|
+
.eyelabel {
|
|
63
|
+
width:80px;
|
|
64
|
+
}
|
|
65
|
+
.el-icon-eye:before {
|
|
66
|
+
background: url("../../../assets/icon-eye.png") no-repeat;
|
|
67
|
+
content: '';
|
|
68
|
+
display: block;
|
|
69
|
+
width: 16px;
|
|
70
|
+
height: 16px;
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
background-size: 16px;
|
|
73
|
+
}
|
|
61
74
|
</style>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div id="app-Tree" style="height:100%;">
|
|
3
|
-
<el-container style="height: calc(100vh - 98px);
|
|
4
|
-
<el-aside width="
|
|
3
|
+
<el-container style="height: calc(100vh - 98px);border: 1px solid #eee">
|
|
4
|
+
<el-aside width="14%" style="background-color:white">
|
|
5
5
|
<ct-searchtree :flagsearch="true" :searchConditionApi="searchConditionApi" :searchDataApi="searchDataApi" @loaded="loaded"></ct-searchtree>
|
|
6
6
|
</el-aside>
|
|
7
7
|
<el-main v-if="isShowSearchlist">
|
|
8
|
-
<div style="height: calc(100vh -
|
|
8
|
+
<div style="height: calc(100vh - 100px);">
|
|
9
9
|
<ct-searchlist :searchConditionApi="searchTableConditionApi" :searchDataApi="searchTableDataApi" :api-param="apiParam"></ct-searchlist>
|
|
10
10
|
</div>
|
|
11
11
|
</el-main>
|
|
@@ -69,9 +69,8 @@
|
|
|
69
69
|
#app-Tree .el-main {
|
|
70
70
|
padding: 0 0px 0px 10px;
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
|
|
73
|
+
#app-Tree .el-main .ct-table-content {
|
|
74
|
+
padding: 0 0 0 15px;
|
|
75
|
+
}
|
|
77
76
|
</style>
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import common from '../common';
|
|
3
|
+
import Axios from 'axios';
|
|
4
|
+
const formData = {
|
|
5
|
+
install(Vue) {
|
|
6
|
+
Vue.prototype.$formData = formData;
|
|
7
|
+
if (typeof window !== 'undefined') {
|
|
8
|
+
window.$formData = formData;
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
common: common,
|
|
12
|
+
Axios: Axios,
|
|
13
|
+
form: null,
|
|
14
|
+
excuteData: null,//fields
|
|
15
|
+
fieldsDic: null,//fieldsDic
|
|
16
|
+
_excuteListData: undefined,
|
|
17
|
+
|
|
18
|
+
//获取code1
|
|
19
|
+
getCode1ByField1(id) {
|
|
20
|
+
var rtn1 = this.fieldsDic[id];
|
|
21
|
+
if (rtn1) {
|
|
22
|
+
return rtn1.value;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
//获取code2
|
|
26
|
+
getCode2ByField1(id) {
|
|
27
|
+
var rtn1 = this.fieldsDic[id];
|
|
28
|
+
if (rtn1) {
|
|
29
|
+
return rtn1.value1;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
//获取Field的属性attrKey的值
|
|
33
|
+
getValueByFieldName(id, attrKey) {
|
|
34
|
+
attrKey = this.common.initialsToUpperCase(attrKey);
|
|
35
|
+
var rtn1 = this.fieldsDic[id];
|
|
36
|
+
if (rtn1) {
|
|
37
|
+
return rtn1.source[attrKey];
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
//设置Field的属性attrKey的值
|
|
41
|
+
setValueByFieldName(id, attrKey, attrValue) {
|
|
42
|
+
attrKey = this.common.initialsToUpperCase(attrKey);
|
|
43
|
+
var rtn1 = this.fieldsDic[id];
|
|
44
|
+
if (rtn1) {
|
|
45
|
+
rtn1.source[attrKey] = attrValue;
|
|
46
|
+
this.form.hatchHandle(id, attrKey, attrValue, rtn1);
|
|
47
|
+
//this.form.hiddenHandle(rtn1);//隐藏关联的
|
|
48
|
+
|
|
49
|
+
//用于处理源数据改动,强制更新视图数据 todo
|
|
50
|
+
if (rtn1.self.$forceUpdate) {
|
|
51
|
+
rtn1.self.$forceUpdate();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
//设置Field的v1、v2的值
|
|
56
|
+
setV1AndV2ByField1(id, code1, code2) {
|
|
57
|
+
var rtn1 = this.fieldsDic[id];
|
|
58
|
+
if (rtn1) {
|
|
59
|
+
if (typeof rtn1.value !== 'undefined') {
|
|
60
|
+
rtn1.value = code1;
|
|
61
|
+
|
|
62
|
+
this.form.validMrf(rtn1);//验证必填关联组件
|
|
63
|
+
this.form.hiddenHandle(rtn1, true);//隐藏关联的
|
|
64
|
+
}
|
|
65
|
+
if (typeof rtn1.value1 !== 'undefined') {
|
|
66
|
+
rtn1.value1 = code2;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (rtn1.self.$forceUpdate) {
|
|
70
|
+
rtn1.self.$forceUpdate();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
//获取列表数据
|
|
75
|
+
get excuteListData() {
|
|
76
|
+
if (this._excuteListData) {
|
|
77
|
+
return this._excuteListData;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
if (this.excuteData !== null) {
|
|
81
|
+
this._excuteListData = this.excuteData.filter((v) => {
|
|
82
|
+
return typeof v.is !== undefined && v.is === 'ct-form-list-table';
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return this._excuteListData;
|
|
87
|
+
},
|
|
88
|
+
//获取列表的Field
|
|
89
|
+
getListField(tableName, rowNum, fiedlId) {
|
|
90
|
+
let listData = this.excuteListData.find((v) => {
|
|
91
|
+
return v.id === tableName;
|
|
92
|
+
});
|
|
93
|
+
if (listData) {
|
|
94
|
+
let field = null;
|
|
95
|
+
//正在编辑的Field
|
|
96
|
+
if (rowNum === null && (fiedlId === null || listData.currentEventField.id === fiedlId)) {
|
|
97
|
+
field = listData.currentEventField;
|
|
98
|
+
}
|
|
99
|
+
//正在编辑的行
|
|
100
|
+
else if (rowNum === null && listData.currentRowIndex === 0) {
|
|
101
|
+
let fields = listData.currentRow.data;
|
|
102
|
+
field = fields[fiedlId];
|
|
103
|
+
}
|
|
104
|
+
//源数据
|
|
105
|
+
else {
|
|
106
|
+
if (rowNum === null && listData.currentRowIndex) {
|
|
107
|
+
rowNum = listData.currentRowIndex;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (rowNum === 0 || (rowNum && fiedlId)) {
|
|
111
|
+
try {
|
|
112
|
+
let fields = listData.rows[rowNum].field;
|
|
113
|
+
field = fields.find((v) => {
|
|
114
|
+
return v.id === fiedlId;
|
|
115
|
+
});
|
|
116
|
+
} catch (e) {
|
|
117
|
+
if (listData.rows.length <= rowNum) {
|
|
118
|
+
var checkMsg = "获取列表行索引超出界限";
|
|
119
|
+
this.message(checkMsg);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return { listData: listData, field: field };
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
//获取列表的行数(注意 这里包括列头)
|
|
129
|
+
getListCount(tableName) {
|
|
130
|
+
tableName = tableName ? tableName : this.form.scripts.$fd;
|
|
131
|
+
let data = this.getListField(tableName, null, null);
|
|
132
|
+
if (data) {
|
|
133
|
+
return data.listData.rows.length;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
//获取表格某行某列的值
|
|
137
|
+
getListFieldValue(tableName, rowNum, fiedlId, attrName, defaultValue) {
|
|
138
|
+
tableName = tableName ? tableName : this.form.scripts.$fd;
|
|
139
|
+
|
|
140
|
+
let data = this.getListField(tableName, rowNum, fiedlId);
|
|
141
|
+
|
|
142
|
+
attrName = this.common.initialsToUpperCase(attrName);
|
|
143
|
+
attrName = attrName ? attrName : 'code1';
|
|
144
|
+
|
|
145
|
+
if (!fiedlId) {
|
|
146
|
+
fiedlId = data.listData.currentEventField.id;
|
|
147
|
+
}
|
|
148
|
+
if (fiedlId && rowNum === null && fiedlId === data.listData.currentEventField.id) {
|
|
149
|
+
data.field = data.listData.currentEventField;
|
|
150
|
+
}
|
|
151
|
+
rowNum = rowNum !== null ? rowNum : data.listData.currentRowIndex;
|
|
152
|
+
|
|
153
|
+
//若该行正在编辑,则取编辑状态的。
|
|
154
|
+
if (data && data.listData && data.listData.currentRow.data && data.listData.currentRow.data[fiedlId]
|
|
155
|
+
&& data.listData.currentRow.data.$sourceIndex === rowNum && data.listData.currentRow.isSet) {
|
|
156
|
+
return data.listData.currentRow.data[fiedlId].source[attrName];
|
|
157
|
+
}
|
|
158
|
+
else if (data && data.field) {
|
|
159
|
+
if (typeof defaultValue !== 'undefined' && data.listData.rows[rowNum].deleted) {//若该行被删除时,则直接返回默认值
|
|
160
|
+
return defaultValue;
|
|
161
|
+
}
|
|
162
|
+
return data.field.source[attrName];
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
//设置表格某行某列的值
|
|
166
|
+
setListFieldValue(value, tableName, rowNum, fiedlId, attrName) {
|
|
167
|
+
value = value.toString();
|
|
168
|
+
tableName = tableName ? tableName : this.form.scripts.$fd;
|
|
169
|
+
let data = this.getListField(tableName, rowNum, fiedlId);
|
|
170
|
+
|
|
171
|
+
attrName = this.common.initialsToUpperCase(attrName);
|
|
172
|
+
attrName = attrName ? attrName : 'code1';
|
|
173
|
+
|
|
174
|
+
if (!fiedlId) {
|
|
175
|
+
fiedlId = data.listData.currentEventField.id;
|
|
176
|
+
}
|
|
177
|
+
if (fiedlId && !rowNum && fiedlId === data.listData.currentEventField.id) {
|
|
178
|
+
//data.field = data.listData.currentEventField;
|
|
179
|
+
}
|
|
180
|
+
rowNum = rowNum ? rowNum : data.listData.currentRowIndex;
|
|
181
|
+
|
|
182
|
+
if (data) {
|
|
183
|
+
if (data.field) {
|
|
184
|
+
data.field.source[attrName] = value;
|
|
185
|
+
data.listData.updateListField(data.listData.refFieldsLabel, rowNum, fiedlId);
|
|
186
|
+
}
|
|
187
|
+
//data.field.self.$forceUpdate();
|
|
188
|
+
|
|
189
|
+
//正在编辑的行
|
|
190
|
+
if (data.listData.currentRow.data && data.listData.currentRow.data[fiedlId] && data.listData.currentRow.data.$sourceIndex === rowNum) {
|
|
191
|
+
let currentField = data.listData.currentRow.data[fiedlId];
|
|
192
|
+
currentField.source[attrName] = value;
|
|
193
|
+
//校验自己
|
|
194
|
+
if (currentField.self && currentField.self.validExcute) {
|
|
195
|
+
currentField.self.validExcute();
|
|
196
|
+
}
|
|
197
|
+
if (typeof currentField.self.$forceUpdate === "function") {
|
|
198
|
+
currentField.self.$forceUpdate();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
//如果有汇总列,触发重新计算汇总
|
|
203
|
+
if (data.listData.showSummary) {
|
|
204
|
+
data.listData.tableData.push({});
|
|
205
|
+
data.listData.tableData.pop();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
return false;
|
|
211
|
+
},
|
|
212
|
+
//设置表格属性值
|
|
213
|
+
setListAttr(tableId, attrName, attrValue) {
|
|
214
|
+
let listData = this.excuteListData.find((v) => {
|
|
215
|
+
return v.id === tableId;
|
|
216
|
+
});
|
|
217
|
+
listData[attrName] = attrValue
|
|
218
|
+
},
|
|
219
|
+
//获取后台数据,并返回脚本。
|
|
220
|
+
execServerScript(action, object, successCallback) {
|
|
221
|
+
let formData = this;//作用域保存
|
|
222
|
+
|
|
223
|
+
//是否是行内触发的
|
|
224
|
+
let data = this.getListField(this.form.scripts.$fd, null, null);
|
|
225
|
+
object.editMode = data ? 1 : 0;
|
|
226
|
+
|
|
227
|
+
Vue.prototype.$api.postHandler(this.common.globalUri(), { action: action, para: object }).then(
|
|
228
|
+
function (response) {
|
|
229
|
+
if (response.rtnCode === Enum.ReturnCode.Successful) {
|
|
230
|
+
var data = response.content;
|
|
231
|
+
if (response.clientActionType === Enum.ClientActionType.ExcuteScript && data) {
|
|
232
|
+
formData.common.excute.call(formData.form.scripts, data);
|
|
233
|
+
}
|
|
234
|
+
else
|
|
235
|
+
if (response.clientActionType === Enum.ClientActionType.None && data && successCallback) {
|
|
236
|
+
//因为要传参,并直接执行方法,故successCallback回调里要使用formData的话,要加this
|
|
237
|
+
//若不能接受this,也可修改common.excute方法
|
|
238
|
+
//successCallback.call(formData.form.scripts, data);
|
|
239
|
+
|
|
240
|
+
//优化,不需要加this
|
|
241
|
+
formData.common.excuteFun.call(formData.form.scripts, successCallback, data);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
},
|
|
247
|
+
//消息提示 type主题:success/warning/info/error。 duration 显示时间, 毫秒。设为 0 则不会自动关闭。 showClose 是否显示关闭按钮。
|
|
248
|
+
message(message, type, center, duration, showClose, dangerouslyUseHTMLString) {
|
|
249
|
+
if (typeof center === 'undefined') {
|
|
250
|
+
center = true;
|
|
251
|
+
}
|
|
252
|
+
if (typeof duration === 'undefined') {
|
|
253
|
+
duration = 1500;
|
|
254
|
+
}
|
|
255
|
+
if (typeof showClose === 'undefined') {
|
|
256
|
+
showClose = false;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
Vue.prototype.$message({
|
|
260
|
+
message: message,//消息文字
|
|
261
|
+
dangerouslyUseHTMLString: dangerouslyUseHTMLString || false,
|
|
262
|
+
type: type || 'error',//主题:success/warning/info/error
|
|
263
|
+
center: center,//是否居中
|
|
264
|
+
duration: duration, //显示时间, 毫秒。设为 0 则不会自动关闭
|
|
265
|
+
showClose: showClose,//是否显示关闭按钮
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
//打开商铺房源详情页
|
|
269
|
+
openPropertyDetailRET(parm){
|
|
270
|
+
let title=parm.field.pageTitle==undefined ?parm.field.label:parm.field.pageTitle;
|
|
271
|
+
common.getDataDrivenOpts().handler.openPropertyDetailRET(parm.submitData, title,this.form);
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
|
276
|
+
window.Vue.use(formData);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export default formData;
|