centaline-data-driven-v3 0.0.89 → 0.0.91
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/dist/centaline-data-driven-v3.umd.js +135 -135
- package/package.json +1 -1
- package/src/assets/commonApp.css +1 -0
- package/src/components/Layout/LayoutMore.vue +2 -1
- package/src/components/app/ComboBox.vue +3 -3
- package/src/components/app/Form.vue +16 -19
- package/src/components/app/FormList.vue +20 -0
- package/src/components/app/PhotoSelectList.vue +17 -6
- package/src/components/app/SearchList/SearchTable.vue +36 -20
- package/src/components/app/Span.vue +2 -2
- package/src/components/app/TextBox.vue +1 -1
- package/src/components/app/dialog.vue +1 -1
- package/src/components/app/searchScreen.vue +53 -28
- package/src/components/common/iframe.vue +4 -1
- package/src/components/web/AIChat.vue +2 -2
- package/src/components/web/ComboBox.vue +15 -6
- package/src/components/web/File.vue +16 -4
- package/src/components/web/Form.vue +27 -7
- package/src/components/web/FormList.vue +55 -28
- package/src/components/web/MapBaidu.vue +10 -2
- package/src/components/web/PhotoSelect.vue +10 -2
- package/src/components/web/Progress.vue +17 -3
- package/src/components/web/SearchList/SearchTable.vue +15 -5
- package/src/components/web/SearchList.vue +5 -4
- package/src/components/web/SearchScreen.vue +16 -6
- package/src/components/web/Span.vue +2 -2
- package/src/components/web/Tree/Tree.vue +11 -4
- package/src/components/web/Tree.vue +11 -2
- package/src/components/web/ViewerFile.vue +7 -2
- package/src/components/web/appContainer.vue +4 -1
- package/src/components/web/dialog.vue +5 -2
- package/src/components/web/other/PopupSearchListTable.vue +6 -1
- package/src/components/web/photo.vue +16 -3
- package/src/loader/src/CheckBoxList.js +18 -7
- package/src/loader/src/Field.js +5 -0
- package/src/loader/src/Form.js +24 -14
- package/src/loader/src/SearchScreen.js +447 -1
- package/src/main.js +3 -3
- package/src/utils/common.js +4 -1
- package/src/utils/mixins.js +13 -21
- package/src/utils/request.js +10 -5
- package/src/views/SearchList.vue +6 -6
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
</div>
|
|
58
58
|
</template>
|
|
59
59
|
<script setup lang="ts">
|
|
60
|
-
import { ref, nextTick } from 'vue'
|
|
60
|
+
import { ref, nextTick, onBeforeUnmount } from 'vue'
|
|
61
61
|
import { ElMessage } from 'element-plus'
|
|
62
62
|
import common from '../../../utils/common'
|
|
63
63
|
import { RouterClickHandler } from '../../../utils/mixins';
|
|
@@ -86,6 +86,11 @@ const isBusy = ref(false)
|
|
|
86
86
|
const elTableHeight = ref(0)
|
|
87
87
|
const selectCount = ref(0)
|
|
88
88
|
const multipleTable = ref()
|
|
89
|
+
|
|
90
|
+
onBeforeUnmount(()=>{
|
|
91
|
+
multipleTable.value.$el.querySelector('.el-scrollbar__wrap').removeEventListener('scroll', scrollHandle);
|
|
92
|
+
multipleTable.value=null;
|
|
93
|
+
})
|
|
89
94
|
function load(data) {
|
|
90
95
|
loadingOne.value = false;
|
|
91
96
|
model.value = data;
|
|
@@ -146,6 +146,8 @@ const refupload = ref()
|
|
|
146
146
|
const QRCodeRef = ref()
|
|
147
147
|
const UploadhttpRequest = ref({})
|
|
148
148
|
const model = ref(null)
|
|
149
|
+
const qrtimer1=ref(null)
|
|
150
|
+
const qrtimer2=ref(null)
|
|
149
151
|
|
|
150
152
|
const headers = computed(() => {
|
|
151
153
|
return common.getDataDrivenOpts().handler.getRequestHeaders();
|
|
@@ -222,7 +224,7 @@ function handleRemove(file) {
|
|
|
222
224
|
}).then(() => {
|
|
223
225
|
Photo.deleteFile(file, false, model.value);
|
|
224
226
|
selfValidExcute("remove");
|
|
225
|
-
setTimeout(() => {
|
|
227
|
+
qrtimer1.value = setTimeout(() => {
|
|
226
228
|
QRCodeLocate();
|
|
227
229
|
}, 1080);
|
|
228
230
|
|
|
@@ -274,7 +276,7 @@ function uploadProcess(event, file, fileList) {
|
|
|
274
276
|
file.loadProgress = parseInt(event.percent); // 动态获取文件上传进度
|
|
275
277
|
if (file.loadProgress >= 100) {
|
|
276
278
|
file.loadProgress = 100;
|
|
277
|
-
setTimeout(() => {
|
|
279
|
+
qrtimer2.value = setTimeout(() => {
|
|
278
280
|
file.progressFlag = false;
|
|
279
281
|
}, 1000); // 一秒后关闭进度条
|
|
280
282
|
}
|
|
@@ -522,10 +524,21 @@ function ListenerPaste(event) {
|
|
|
522
524
|
document.addEventListener('paste', ListenerPaste);
|
|
523
525
|
onBeforeUnmount(() => {
|
|
524
526
|
//销毁定时上传
|
|
525
|
-
|
|
527
|
+
if (model.value.qrtimer) {
|
|
528
|
+
clearTimeout(model.value.qrtimer);
|
|
529
|
+
model.value.qrtimer = null;
|
|
530
|
+
}
|
|
526
531
|
window.removeEventListener('scroll', model.value.QRCodeLocate, true)
|
|
527
532
|
//销毁贴事件监听器
|
|
528
533
|
document.removeEventListener('paste', ListenerPaste)
|
|
534
|
+
if (qrtimer1.value) {
|
|
535
|
+
clearTimeout(qrtimer1.value);
|
|
536
|
+
qrtimer1.value = null;
|
|
537
|
+
}
|
|
538
|
+
if (qrtimer2.value) {
|
|
539
|
+
clearTimeout(qrtimer2.value);
|
|
540
|
+
qrtimer2.value = null;
|
|
541
|
+
}
|
|
529
542
|
})
|
|
530
543
|
defineExpose({
|
|
531
544
|
model
|
|
@@ -8,7 +8,7 @@ const CheckBoxList = function (source) {
|
|
|
8
8
|
this._value = [];
|
|
9
9
|
if (source.code1) {
|
|
10
10
|
let val = source.code1
|
|
11
|
-
if (typeof source.code1 === 'string'){
|
|
11
|
+
if (typeof source.code1 === 'string') {
|
|
12
12
|
val = JSON.parse(source.code1)
|
|
13
13
|
}
|
|
14
14
|
val.forEach((v) => {
|
|
@@ -33,14 +33,14 @@ const CheckBoxList = function (source) {
|
|
|
33
33
|
});
|
|
34
34
|
currentOptions.forEach((v) => {
|
|
35
35
|
rtn.globalOptions.forEach((v1) => {
|
|
36
|
-
if(v.code===v1.code){
|
|
37
|
-
v['rowID']=v1['rowID']
|
|
36
|
+
if (v.code === v1.code) {
|
|
37
|
+
v['rowID'] = v1['rowID']
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
if (source.code1) {
|
|
42
42
|
let checked = source.code1
|
|
43
|
-
if (typeof source.code1 === 'string'){
|
|
43
|
+
if (typeof source.code1 === 'string') {
|
|
44
44
|
checked = JSON.parse(source.code1)
|
|
45
45
|
}
|
|
46
46
|
checked.forEach((v) => {
|
|
@@ -68,17 +68,28 @@ const CheckBoxList = function (source) {
|
|
|
68
68
|
//初始数据
|
|
69
69
|
get globalOptions() {
|
|
70
70
|
if (source.code1) {
|
|
71
|
-
if (typeof source.code1 === 'string'){
|
|
71
|
+
if (typeof source.code1 === 'string') {
|
|
72
72
|
return [].concat(JSON.parse(source.code1));
|
|
73
73
|
}
|
|
74
74
|
return [].concat(source.code1);
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
78
|
return []
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
|
-
|
|
81
|
+
getCheckedName() {
|
|
82
|
+
var nameArr = '';
|
|
83
|
+
var checked = source.code1 === '' ? [] : [].concat(JSON.parse(source.code1));
|
|
84
|
+
checked.forEach((v) => {
|
|
85
|
+
if (v['code']) {
|
|
86
|
+
if (!v['flagDeleted']) {
|
|
87
|
+
nameArr = nameArr + (nameArr ? ' ' : '') + v['name'];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return nameArr;
|
|
92
|
+
},
|
|
82
93
|
|
|
83
94
|
};
|
|
84
95
|
rtn = base.copy(source, rtn);
|
package/src/loader/src/Field.js
CHANGED
package/src/loader/src/Form.js
CHANGED
|
@@ -63,17 +63,6 @@ function loadFromModel(source, isFormList) {
|
|
|
63
63
|
router[attrKey] = attrValue;
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
setbuttonRouter(id, attrKey, attrValue) {
|
|
67
|
-
var router = this.form.buttons.find((v1) => {
|
|
68
|
-
return v1.key === id;
|
|
69
|
-
});
|
|
70
|
-
if (router) {
|
|
71
|
-
router[attrKey] = attrValue;
|
|
72
|
-
if (common.flagApp() && this.form.$vue.loaded) {
|
|
73
|
-
this.form.$vue.loaded(this.form)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
66
|
//获取Field的属性attrKey的值
|
|
78
67
|
getValueByFieldName(id, attrKey) {
|
|
79
68
|
attrKey = common.initialsToLowerCase(attrKey);
|
|
@@ -125,6 +114,11 @@ function loadFromModel(source, isFormList) {
|
|
|
125
114
|
}
|
|
126
115
|
if (rtn1.itemKey) rtn1.itemKey = Math.random()
|
|
127
116
|
}
|
|
117
|
+
if (rtn1.is == 'ct-button') {
|
|
118
|
+
if (common.flagApp() && this.form.$vue.loaded) {
|
|
119
|
+
this.form.$vue.loaded(this.form)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
128
122
|
hiddenHandle(rtn1, this.form);
|
|
129
123
|
requiredHandle(rtn1, this.form);
|
|
130
124
|
}
|
|
@@ -917,14 +911,14 @@ function allRequiredHandle(model) {
|
|
|
917
911
|
function requiredHandle(item, model) {
|
|
918
912
|
if (item.fieldName1) {
|
|
919
913
|
let field = null;
|
|
914
|
+
let field1 = null;
|
|
920
915
|
let value = getFieldValue(item);
|
|
921
916
|
for (var i in model.fields) {
|
|
922
917
|
if (model.fields[i].requiredRelationField === item.fieldName1) {
|
|
923
918
|
field = model.fields[i];
|
|
924
|
-
let f = model.fieldsDic[field.fieldName1];
|
|
925
919
|
if (field) {
|
|
926
|
-
let
|
|
927
|
-
if (
|
|
920
|
+
let requiredValueArr = field.requiredRelationFieldValue.split(',');
|
|
921
|
+
if (requiredValueArr.indexOf(value) > -1) {
|
|
928
922
|
field.required = true;
|
|
929
923
|
}
|
|
930
924
|
else {
|
|
@@ -932,6 +926,22 @@ function requiredHandle(item, model) {
|
|
|
932
926
|
}
|
|
933
927
|
}
|
|
934
928
|
}
|
|
929
|
+
if (model.fields[i].controlType == Enum.ControlType.Compound || model.fields[i].controlType == Enum.ControlType.ContainerControl) {
|
|
930
|
+
for (var i1 in model.fields[i].fields) {
|
|
931
|
+
if (model.fields[i].fields[i1].requiredRelationField === item.fieldName1) {
|
|
932
|
+
field1 = model.fields[i].fields[i1];
|
|
933
|
+
if (field1) {
|
|
934
|
+
let requiredValueArr = field1.requiredRelationFieldValue.split(',');
|
|
935
|
+
if (requiredValueArr.indexOf(item.code1) > -1) {
|
|
936
|
+
field1.required = true;
|
|
937
|
+
}
|
|
938
|
+
else {
|
|
939
|
+
field1.required = false;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
935
945
|
}
|
|
936
946
|
}
|
|
937
947
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import base from '../index';
|
|
1
2
|
import LibFunction from './LibFunction';
|
|
2
3
|
import Enum from '../../utils/Enum';
|
|
3
4
|
import common from '../../utils/common';
|
|
@@ -26,6 +27,395 @@ function loadSearchScreenApi(action, callBack, screenPara, prevParam, failCallBa
|
|
|
26
27
|
}
|
|
27
28
|
function loadSearchScreenModel(source, prevParam) {
|
|
28
29
|
let rtn = {
|
|
30
|
+
formData: {
|
|
31
|
+
form: null,
|
|
32
|
+
formTable: null,
|
|
33
|
+
excuteData: null,//fields
|
|
34
|
+
fieldsDic: null,//fieldsDic
|
|
35
|
+
_excuteListData: undefined,
|
|
36
|
+
enableRelationFields(FlagRelation) {
|
|
37
|
+
this.form.enableRelationFields = FlagRelation
|
|
38
|
+
},
|
|
39
|
+
//获取code1
|
|
40
|
+
getCode1ByField1(id) {
|
|
41
|
+
var rtn1 = this.fieldsDic[id];
|
|
42
|
+
if (rtn1) {
|
|
43
|
+
return rtn1.code1;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
//获取code2
|
|
48
|
+
getCode2ByField1(id) {
|
|
49
|
+
var rtn1 = this.fieldsDic[id];
|
|
50
|
+
if (rtn1) {
|
|
51
|
+
return rtn1.code2;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
setActionRouter(id, attrKey, attrValue) {
|
|
55
|
+
var router = this.form.actionRouters.find((v1) => {
|
|
56
|
+
return v1.key === id;
|
|
57
|
+
});
|
|
58
|
+
if (router) {
|
|
59
|
+
router[attrKey] = attrValue;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
//获取Field的属性attrKey的值
|
|
63
|
+
getValueByFieldName(id, attrKey) {
|
|
64
|
+
attrKey = common.initialsToLowerCase(attrKey);
|
|
65
|
+
var rtn1 = this.fieldsDic[id];
|
|
66
|
+
if (rtn1) {
|
|
67
|
+
return rtn1[attrKey];
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
getValueByFieldNameFromParent(id, attrKey) {
|
|
71
|
+
if (this.form && this.form.parentModelForm) {
|
|
72
|
+
return this.form.parentModelForm.getValueByFieldName(id, attrKey);
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
},
|
|
76
|
+
//设置Field的属性attrKey的值
|
|
77
|
+
setValueByFieldName(id, attrKey, attrValue) {
|
|
78
|
+
attrKey = common.initialsToLowerCase(attrKey);
|
|
79
|
+
var rtn1 = this.fieldsDic[id];
|
|
80
|
+
if (rtn1) {
|
|
81
|
+
if (attrKey == 'code1' && rtn1.controlType === Enum.ControlType.NumericTextBox
|
|
82
|
+
&& attrValue != undefined && attrValue != null && attrValue != '') {
|
|
83
|
+
if (rtn1.decimals1 != undefined && rtn1.decimals1 != null && rtn1.decimals1 > -1) {
|
|
84
|
+
attrValue = Number(attrValue).toFixed(rtn1.decimals1)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (attrKey == 'code1' && (rtn1.controlType === Enum.ControlType.File
|
|
88
|
+
|| rtn1.controlType === Enum.ControlType.SliceUpload || rtn1.controlType === Enum.ControlType.PhotoSelect)
|
|
89
|
+
&& attrValue != undefined && attrValue != null && attrValue != '') {
|
|
90
|
+
rtn1.jsSetFile(attrValue, rtn1);
|
|
91
|
+
}
|
|
92
|
+
rtn1[attrKey] = attrValue;
|
|
93
|
+
if (rtn1.controlType === Enum.ControlType.Tags) {
|
|
94
|
+
rtn1["value"] = JSON.parse(attrValue);
|
|
95
|
+
}
|
|
96
|
+
if (rtn1.controlType === Enum.ControlType.SearchListBox
|
|
97
|
+
|| rtn1.controlType === Enum.ControlType.ComboBox
|
|
98
|
+
|| rtn1.controlType === Enum.ControlType.MultiSelectWithSearch
|
|
99
|
+
|| rtn1.controlType === Enum.ControlType.MultiSelectNoSearch
|
|
100
|
+
) {
|
|
101
|
+
if (rtn1["options"].length == 0) {
|
|
102
|
+
rtn1["options"] = [{ value: '', label: '' }];
|
|
103
|
+
}
|
|
104
|
+
if (attrKey == 'code1') {
|
|
105
|
+
rtn1["value"] = attrValue;
|
|
106
|
+
rtn1["options"][0]["value"] = attrValue
|
|
107
|
+
}
|
|
108
|
+
if (attrKey == 'name1') {
|
|
109
|
+
rtn1["options"][0]["label"] = attrValue
|
|
110
|
+
}
|
|
111
|
+
if (rtn1.itemKey) rtn1.itemKey = Math.random()
|
|
112
|
+
}
|
|
113
|
+
if (rtn1.is == 'ct-button') {
|
|
114
|
+
if (common.flagApp() && this.form.$vue.loaded) {
|
|
115
|
+
this.form.$vue.loaded(this.form)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
hiddenHandle(rtn1, this.form);
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
setValueByFieldNameFromParent(id, attrKey, attrValue) {
|
|
122
|
+
if (this.form && this.form.parentModelForm) {
|
|
123
|
+
return this.form.parentModelForm.setValueByFieldName(id, attrKey, attrValue);
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
},
|
|
127
|
+
//设置Field的v1、v2的值
|
|
128
|
+
setV1AndV2ByField1(id, code1, code2) {
|
|
129
|
+
var rtn1 = this.fieldsDic[id];
|
|
130
|
+
if (rtn1) {
|
|
131
|
+
if (typeof rtn1.code1 !== 'undefined') {
|
|
132
|
+
rtn1.code1 = code1;
|
|
133
|
+
hiddenHandle(rtn1);//隐藏关联的
|
|
134
|
+
}
|
|
135
|
+
if (typeof rtn1.code2 !== 'undefined') {
|
|
136
|
+
rtn1.code2 = code2;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
clearMedia(id) {
|
|
141
|
+
var rtn1 = this.fieldsDic[id];
|
|
142
|
+
for (let i = 0; i < rtn1.fileSourceList.length; i++) {
|
|
143
|
+
rtn1.fileSourceList[i].flagDeleted = true;
|
|
144
|
+
}
|
|
145
|
+
rtn1.fileList = [];
|
|
146
|
+
},
|
|
147
|
+
setTabsSelect(id) {
|
|
148
|
+
if (this.form && this.form.$vue) {
|
|
149
|
+
var f = this.fieldsDic[id];
|
|
150
|
+
if (this.form.isHorizontalLayout) {
|
|
151
|
+
this.form.$vue.activeName = f.collapseName.toString() === '-1' ? this.form.$vue.activeName : f.collapseName.toString();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
//路由提交
|
|
156
|
+
submit(fieldName1) {
|
|
157
|
+
if (this.form && this.form.$vue) {
|
|
158
|
+
this.form.$vue.fieldClickHandler({ fieldName1: fieldName1 });
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
//获取列表数据
|
|
163
|
+
get excuteListData() {
|
|
164
|
+
if (this._excuteListData) {
|
|
165
|
+
return this._excuteListData;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
if (this.excuteData !== null) {
|
|
169
|
+
this._excuteListData = this.excuteData.filter((v) => {
|
|
170
|
+
return typeof v.is !== undefined && (v.is === 'ct-formlist' || v.is === 'ct-repeat');
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return this._excuteListData;
|
|
175
|
+
},
|
|
176
|
+
setExcuteListData(fields) {
|
|
177
|
+
this._excuteListData = null;
|
|
178
|
+
if (fields !== null) {
|
|
179
|
+
this.excuteData = fields;
|
|
180
|
+
this._excuteListData = fields.filter((v) => {
|
|
181
|
+
return typeof v.is !== undefined && (v.is === 'ct-formlist' || v.is === 'ct-repeat');
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
//获取列表的Field
|
|
186
|
+
getListField(tableName, rowNum, fiedlId) {
|
|
187
|
+
let listData = this.excuteListData.find((v) => {
|
|
188
|
+
return v.name === tableName;
|
|
189
|
+
});
|
|
190
|
+
if (listData) {
|
|
191
|
+
let field = null;
|
|
192
|
+
//正在编辑的Field
|
|
193
|
+
if (rowNum === null && (fiedlId === null || listData.currentEventField.fieldName1 === fiedlId)) {
|
|
194
|
+
field = listData.currentEventField;
|
|
195
|
+
}
|
|
196
|
+
//正在编辑的行
|
|
197
|
+
else if (rowNum === null && listData.currentRowIndex === 0) {
|
|
198
|
+
let fields = listData.currentRow.data;
|
|
199
|
+
field = fields[fiedlId];
|
|
200
|
+
}
|
|
201
|
+
//源数据
|
|
202
|
+
else {
|
|
203
|
+
if (rowNum === null && listData.currentRowIndex) {
|
|
204
|
+
rowNum = listData.currentRowIndex;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (rowNum === 0 || (rowNum && fiedlId)) {
|
|
208
|
+
try {
|
|
209
|
+
let fields = listData.rows[rowNum].field;
|
|
210
|
+
field = fields.find((v) => {
|
|
211
|
+
return v.fieldName1 === fiedlId;
|
|
212
|
+
});
|
|
213
|
+
} catch (e) {
|
|
214
|
+
if (listData.rows.length <= rowNum) {
|
|
215
|
+
common.message('获取列表行索引超出界限', 'error')
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return { listData: listData, field: field };
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
//获取列表的行数(注意 这里包括列头)
|
|
225
|
+
getListCount(tableName) {
|
|
226
|
+
tableName = tableName ? tableName : this.form.scripts.$fd;
|
|
227
|
+
let data = this.getListField(tableName, null, null);
|
|
228
|
+
if (data) {
|
|
229
|
+
return data.listData.rows.length;
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
//获取表格某行某列的值
|
|
233
|
+
getListFieldValue(tableName, rowNum, fiedlId, attrName, defaultValue) {
|
|
234
|
+
tableName = tableName ? tableName : this.form.scripts.$fd;
|
|
235
|
+
let data = this.getListField(tableName, rowNum, fiedlId);
|
|
236
|
+
|
|
237
|
+
attrName = common.initialsToLowerCase(attrName);
|
|
238
|
+
attrName = attrName ? attrName : 'code1';
|
|
239
|
+
|
|
240
|
+
if (!fiedlId) {
|
|
241
|
+
fiedlId = data.listData.currentEventField.fieldName1;
|
|
242
|
+
}
|
|
243
|
+
if (fiedlId && rowNum === null && fiedlId === data.listData.currentEventField.fieldName1) {
|
|
244
|
+
data.field = data.listData.currentEventField;
|
|
245
|
+
}
|
|
246
|
+
rowNum = rowNum !== null ? rowNum : data.listData.currentRowIndex;
|
|
247
|
+
|
|
248
|
+
//若该行正在编辑,则取编辑状态的。
|
|
249
|
+
if (data && data.listData && data.listData.currentRow.data && data.listData.currentRow.data[fiedlId]
|
|
250
|
+
&& data.listData.currentRow.data.$sourceIndex === rowNum && data.listData.currentRow.isSet) {
|
|
251
|
+
return data.listData.currentRow.data[fiedlId][attrName];
|
|
252
|
+
}
|
|
253
|
+
else if (data && data.field) {
|
|
254
|
+
if (typeof defaultValue !== 'undefined' && data.listData.rows[rowNum].deleted) {//若该行被删除时,则直接返回默认值
|
|
255
|
+
return defaultValue;
|
|
256
|
+
}
|
|
257
|
+
return data.field[attrName];
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
//设置表格某行某列的值
|
|
261
|
+
setListFieldValue(value, tableName, rowNum, fiedlId, attrName, flagTemplate) {
|
|
262
|
+
value = value == undefined ? "" : value.toString();
|
|
263
|
+
tableName = tableName ? tableName : this.form.scripts.$fd;
|
|
264
|
+
let data = this.getListField(tableName, rowNum, fiedlId);
|
|
265
|
+
|
|
266
|
+
attrName = common.initialsToLowerCase(attrName);
|
|
267
|
+
attrName = attrName ? attrName : 'code1';
|
|
268
|
+
|
|
269
|
+
if (!fiedlId) {
|
|
270
|
+
fiedlId = data.listData.currentEventField.id;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
rowNum = rowNum ? rowNum : data.listData.currentRowIndex;
|
|
274
|
+
|
|
275
|
+
if (data) {
|
|
276
|
+
//正在编辑的行
|
|
277
|
+
if (data.listData.currentRow.data && data.listData.currentRow.data[fiedlId] && rowNum > -1
|
|
278
|
+
&& data.listData.currentRow.data.$sourceIndex === data.listData.source.rows[rowNum].$sourceIndex) {
|
|
279
|
+
let currentField = data.listData.currentRow.data[fiedlId];
|
|
280
|
+
currentField[attrName] = value;
|
|
281
|
+
//校验自己
|
|
282
|
+
if (currentField.validExcute) {
|
|
283
|
+
currentField.validExcute();
|
|
284
|
+
}
|
|
285
|
+
if (data.field) {
|
|
286
|
+
data.field[attrName] = value;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else if (data.field) {
|
|
290
|
+
if (data.field) {
|
|
291
|
+
data.field[attrName] = value;
|
|
292
|
+
}
|
|
293
|
+
if (data.field.source) {
|
|
294
|
+
data.field.source[attrName] = value;
|
|
295
|
+
}
|
|
296
|
+
if (flagTemplate) {
|
|
297
|
+
data.field[attrName] = value;
|
|
298
|
+
}
|
|
299
|
+
if (data.listData.flagTemplate && data.listData.$vue) {
|
|
300
|
+
data.listData.$vue.itemKey = Math.random()
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
//如果有汇总列,触发重新计算汇总
|
|
305
|
+
if (data.listData.showSummary) {
|
|
306
|
+
data.listData.tableData.push({});
|
|
307
|
+
data.listData.tableData.pop();
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
return false;
|
|
313
|
+
},
|
|
314
|
+
//设置表格选择路由
|
|
315
|
+
setListSelectRouter(tableId, attrKey, attrValue) {
|
|
316
|
+
let listData = this.excuteListData.find((v) => {
|
|
317
|
+
return v.fieldName1 === tableId;
|
|
318
|
+
});
|
|
319
|
+
if (listData) {
|
|
320
|
+
var router = listData.selectRouter;
|
|
321
|
+
if (router) {
|
|
322
|
+
router[attrKey] = attrValue;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
//设置表格属性值
|
|
327
|
+
setListAttr(tableId, attrName, attrValue) {
|
|
328
|
+
let listData = this.excuteListData.find((v) => {
|
|
329
|
+
return v.fieldName1 === tableId;
|
|
330
|
+
});
|
|
331
|
+
if (listData) {
|
|
332
|
+
listData[attrName] = attrValue
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
//新增表格数据
|
|
336
|
+
insertRow(tableId, rows) {
|
|
337
|
+
let listData = this.excuteListData.find((v) => {
|
|
338
|
+
return v.fieldName1 === tableId;
|
|
339
|
+
});
|
|
340
|
+
if (listData) {
|
|
341
|
+
listData.$vue.insertRow(rows);
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
//添加单选表格数据
|
|
345
|
+
insertSingleRow(tableId, row) {
|
|
346
|
+
let listData = this.excuteListData.find((v) => {
|
|
347
|
+
return v.fieldName1 === tableId;
|
|
348
|
+
});
|
|
349
|
+
if (listData) {
|
|
350
|
+
listData.$vue.insertSingleRow(row);
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
//新增或替换表格数据
|
|
354
|
+
insertOrUpdateRow(tableId, row) {
|
|
355
|
+
let listData = this.excuteListData.find((v) => {
|
|
356
|
+
return v.fieldName1 === tableId;
|
|
357
|
+
});
|
|
358
|
+
if (listData) {
|
|
359
|
+
listData.$vue.insertOrUpdateRow(row);
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
//删除表格数据
|
|
363
|
+
deleteRow(tableId, row) {
|
|
364
|
+
let listData = this.excuteListData.find((v) => {
|
|
365
|
+
return v.id === tableId;
|
|
366
|
+
});
|
|
367
|
+
if (listData) {
|
|
368
|
+
listData.$vue.delRow(row);
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
//清空表格数据
|
|
372
|
+
clear(tableId) {
|
|
373
|
+
let listData = this.excuteListData.find((v) => {
|
|
374
|
+
return v.fieldName1 === tableId;
|
|
375
|
+
});
|
|
376
|
+
if (listData) {
|
|
377
|
+
listData.$vue.deleteAll();
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
//获取后台数据,并返回脚本。
|
|
382
|
+
execServerScript(action, object, successCallback) {
|
|
383
|
+
let formData = this;//作用域保存
|
|
384
|
+
|
|
385
|
+
//是否是行内触发的
|
|
386
|
+
let data = this.getListField(this.form.scripts.$fd, null, null);
|
|
387
|
+
object.editMode = data ? 1 : 0;
|
|
388
|
+
|
|
389
|
+
request.postHandler(common.globalUri(), { action: action, para: object }).then(
|
|
390
|
+
function (response) {
|
|
391
|
+
if (response.rtnCode === Enum.ReturnCode.Successful) {
|
|
392
|
+
var data = response.content;
|
|
393
|
+
if (response.clientActionType === Enum.ClientActionType.ExcuteScript && data) {
|
|
394
|
+
common.excute.call(formData.form.scripts, data);
|
|
395
|
+
}
|
|
396
|
+
else
|
|
397
|
+
if (response.clientActionType === Enum.ClientActionType.None && data && successCallback) {
|
|
398
|
+
//因为要传参,并直接执行方法,故successCallback回调里要使用formData的话,要加this
|
|
399
|
+
//若不能接受this,也可修改common.excute方法
|
|
400
|
+
//successCallback.call(formData.form.scripts, data);
|
|
401
|
+
|
|
402
|
+
//优化,不需要加this
|
|
403
|
+
common.excuteFun.call(formData.form.scripts, successCallback, data);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
},
|
|
409
|
+
execRouter(routerKey) {
|
|
410
|
+
let field = { fieldName1: routerKey };
|
|
411
|
+
this.form.$vue.fieldClickHandler(field);
|
|
412
|
+
},
|
|
413
|
+
//消息提示 type主题:success/warning/info/error。 duration 显示时间, 毫秒。设为 0 则不会自动关闭。 showClose 是否显示关闭按钮。
|
|
414
|
+
message(message, type, center, duration, showClose, dangerouslyUseHTMLString) {
|
|
415
|
+
common.message(message, type, center, duration, showClose, dangerouslyUseHTMLString)
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
},
|
|
29
419
|
get title() {
|
|
30
420
|
return source.title;
|
|
31
421
|
},
|
|
@@ -41,6 +431,22 @@ function loadSearchScreenModel(source, prevParam) {
|
|
|
41
431
|
get parameterAction() {
|
|
42
432
|
return source.parameterAction
|
|
43
433
|
},
|
|
434
|
+
_scripts: null,
|
|
435
|
+
get scripts() {
|
|
436
|
+
if (rtn._scripts !== null) {
|
|
437
|
+
return rtn._scripts;
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
if (source.scripts) {
|
|
441
|
+
rtn._scripts = base.common.eval(source.scripts);
|
|
442
|
+
return rtn._scripts;
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
rtn._scripts = base.common.eval("");
|
|
446
|
+
return rtn._scripts;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
},
|
|
44
450
|
_screen: null,
|
|
45
451
|
_btnScreen: null,
|
|
46
452
|
_highScreen: null,
|
|
@@ -415,12 +821,52 @@ function getAction(api, callback) {
|
|
|
415
821
|
}
|
|
416
822
|
});
|
|
417
823
|
}
|
|
824
|
+
function changeHandler(field, model){
|
|
825
|
+
hiddenHandle(field, model);
|
|
826
|
+
clearRelatedHandle(field, model.screen)
|
|
827
|
+
if (field.onChanged) {
|
|
828
|
+
if (model.scripts) {
|
|
829
|
+
model.scripts.formData.setExcuteListData(model.screen);
|
|
830
|
+
}
|
|
831
|
+
model.scripts.$fd = field.id;
|
|
832
|
+
common.excute.call(model.scripts, field.onChanged);
|
|
833
|
+
}
|
|
834
|
+
if (field.onAfterChanged && field.controlType !== Enum.ControlType.NumericTextBox) {
|
|
835
|
+
var router = model.actionRouters.find((v) => {
|
|
836
|
+
return v.key === field.onAfterChanged;
|
|
837
|
+
});
|
|
838
|
+
if (router) {
|
|
839
|
+
model.$vue.clickHandler(router);
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
if (model.scripts) {
|
|
843
|
+
model.scripts.formData.setExcuteListData(model.fields);
|
|
844
|
+
}
|
|
845
|
+
model.scripts.$fd = field.id;
|
|
846
|
+
common.excute.call(model.scripts, field.onAfterChanged);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
//清除关联当前组件的组件值
|
|
851
|
+
function clearRelatedHandle(field, fields) {
|
|
852
|
+
var f = fields.filter((v) => {
|
|
853
|
+
return v.parentField && field.fieldName1 && (',' + v.parentField + ',').indexOf(',' + field.fieldName1 + ',') > -1;
|
|
854
|
+
});
|
|
855
|
+
f.forEach((v) => {
|
|
856
|
+
if (v.reset) {
|
|
857
|
+
v.reset();
|
|
858
|
+
}
|
|
859
|
+
clearRelatedHandle(v, fields)
|
|
860
|
+
});
|
|
861
|
+
}
|
|
418
862
|
const SearchScreen = {
|
|
419
863
|
loadSearchScreenApi,
|
|
420
864
|
loadSearchScreenModel,
|
|
421
865
|
hiddenHandle,
|
|
422
866
|
isHandle,
|
|
423
867
|
getNewSearchValue,
|
|
424
|
-
getAction
|
|
868
|
+
getAction,
|
|
869
|
+
changeHandler,
|
|
870
|
+
clearRelatedHandle
|
|
425
871
|
};
|
|
426
872
|
export default SearchScreen;
|