centaline-data-driven 1.1.54 → 1.1.55

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.
Files changed (193) hide show
  1. package/.babelrc +12 -12
  2. package/.editorconfig +9 -9
  3. package/.gitattributes +63 -63
  4. package/.postcssrc.js +10 -10
  5. package/Centaline.Front_End.DataDriven.csproj +37 -37
  6. package/Centaline.Front_End.DataDriven.sln +25 -25
  7. package/Properties/launchSettings.json +26 -26
  8. package/README.md +140 -140
  9. package/build/build.js +41 -41
  10. package/build/centaline/centaline.path.js +59 -59
  11. package/build/centaline/webpack.centaline.conf.js +106 -106
  12. package/build/check-versions.js +54 -54
  13. package/build/utils.js +102 -102
  14. package/build/vue-loader.conf.js +22 -22
  15. package/build/webpack.base.conf.js +82 -82
  16. package/build/webpack.dev.conf.js +111 -111
  17. package/build/webpack.prod.conf.js +145 -145
  18. package/config/dev.env.js +12 -12
  19. package/config/index.js +73 -73
  20. package/config/prod.env.js +4 -4
  21. package/index.html +14 -14
  22. package/package.json +75 -75
  23. package/src/App.vue +10 -10
  24. package/src/Detail.vue +26 -26
  25. package/src/Edit.vue +32 -32
  26. package/src/Form.vue +29 -29
  27. package/src/SearchList.vue +40 -40
  28. package/src/SearchTree.vue +51 -51
  29. package/src/Tabs.vue +19 -19
  30. package/src/centaline/api/index.js +249 -249
  31. package/src/centaline/comfirm/index.js +11 -11
  32. package/src/centaline/comfirm/src/comfirm.vue +44 -44
  33. package/src/centaline/common/index.js +738 -738
  34. package/src/centaline/css/common.css +748 -748
  35. package/src/centaline/css/max.css +207 -207
  36. package/src/centaline/dialogList/index.js +11 -11
  37. package/src/centaline/dialogList/src/dialog.vue +210 -210
  38. package/src/centaline/dialogList/src/dialogList.vue +65 -65
  39. package/src/centaline/dialogList/src/dialogNew.vue +78 -78
  40. package/src/centaline/dialogList/src/drag.js +77 -77
  41. package/src/centaline/directives/index.js +23 -23
  42. package/src/centaline/dynamicBtn/index.js +11 -11
  43. package/src/centaline/dynamicBtn/src/dynamicBtn.vue +100 -100
  44. package/src/centaline/dynamicCb/index.js +11 -11
  45. package/src/centaline/dynamicCb/src/dynamicCb.vue +72 -72
  46. package/src/centaline/dynamicCheckbox/index.js +11 -11
  47. package/src/centaline/dynamicCheckbox/src/dynamicCheckbox.vue +128 -128
  48. package/src/centaline/dynamicComboBoxWithTextBox/index.js +11 -11
  49. package/src/centaline/dynamicComboBoxWithTextBox/src/dynamicComboBoxWithTextBox.vue +240 -240
  50. package/src/centaline/dynamicD/index.js +11 -11
  51. package/src/centaline/dynamicD/src/dynamicD.vue +92 -92
  52. package/src/centaline/dynamicDetail/index.js +10 -10
  53. package/src/centaline/dynamicDetail/src/dynamicDetail.vue +40 -40
  54. package/src/centaline/dynamicDetail/src/dynamicPropertyDetailOFI.vue +1280 -1280
  55. package/src/centaline/dynamicDetail/src/dynamicPropertyDetailRET.vue +1293 -1293
  56. package/src/centaline/dynamicDrop/index.js +11 -11
  57. package/src/centaline/dynamicDrop/src/dynamicDrop.vue +54 -54
  58. package/src/centaline/dynamicDtd/index.js +11 -11
  59. package/src/centaline/dynamicDtd/src/dynamicDtd.vue +125 -125
  60. package/src/centaline/dynamicDtd/src/dynamicDtdOld.vue +93 -93
  61. package/src/centaline/dynamicFile/index.js +11 -11
  62. package/src/centaline/dynamicFile/src/dynamicFile.vue +288 -283
  63. package/src/centaline/dynamicForm/index.js +24 -24
  64. package/src/centaline/dynamicForm/src/dynamicForm.vue +564 -564
  65. package/src/centaline/dynamicForm/src/dynamicFormList.vue +209 -209
  66. package/src/centaline/dynamicForm/src/dynamicFormListTable.vue +376 -376
  67. package/src/centaline/dynamicGp/index.js +11 -11
  68. package/src/centaline/dynamicGp/src/dynamicGp.vue +27 -27
  69. package/src/centaline/dynamicHyperLink/index.js +11 -11
  70. package/src/centaline/dynamicHyperLink/src/dynamicHyperLink.vue +54 -54
  71. package/src/centaline/dynamicInput/index.js +35 -35
  72. package/src/centaline/dynamicInput/src/dynamicInput.vue +35 -35
  73. package/src/centaline/dynamicInputNumber/index.js +11 -11
  74. package/src/centaline/dynamicInputNumber/src/dynamicInputNumber.vue +157 -157
  75. package/src/centaline/dynamicIti/index.js +11 -11
  76. package/src/centaline/dynamicIti/src/dynamicIti.vue +148 -148
  77. package/src/centaline/dynamicL/index.js +11 -11
  78. package/src/centaline/dynamicL/src/dynamicL.vue +37 -37
  79. package/src/centaline/dynamicLabel/index.js +11 -11
  80. package/src/centaline/dynamicLabel/src/dynamicLabel.vue +73 -73
  81. package/src/centaline/dynamicLs/index.js +22 -22
  82. package/src/centaline/dynamicLs/src/dynamicLs.vue +233 -233
  83. package/src/centaline/dynamicMo/index.js +13 -13
  84. package/src/centaline/dynamicMo/src/dynamicMo.vue +421 -421
  85. package/src/centaline/dynamicMt/index.js +11 -11
  86. package/src/centaline/dynamicMt/src/dynamicMt.vue +44 -44
  87. package/src/centaline/dynamicPlaceHolder/index.js +11 -11
  88. package/src/centaline/dynamicPlaceHolder/src/dynamicPlaceHolder.vue +29 -29
  89. package/src/centaline/dynamicPopupSearchList/index.js +11 -11
  90. package/src/centaline/dynamicPopupSearchList/src/dynamicPopupSearchList.vue +157 -157
  91. package/src/centaline/dynamicPopupSearchList/src/dynamicPopupSearchListTable.vue +239 -239
  92. package/src/centaline/dynamicRichText/index.js +11 -11
  93. package/src/centaline/dynamicRichText/src/dynamicRichText.vue +33 -33
  94. package/src/centaline/dynamicSearchList/index.js +11 -11
  95. package/src/centaline/dynamicSearchList/src/dynamicSearchCategory.vue +121 -121
  96. package/src/centaline/dynamicSearchList/src/dynamicSearchList.vue +135 -135
  97. package/src/centaline/dynamicSearchList/src/dynamicSearchScreen.vue +206 -206
  98. package/src/centaline/dynamicSearchList/src/dynamicSearchTable.vue +1069 -1069
  99. package/src/centaline/dynamicSearchList/src/dynamicTableStatistics.vue +41 -41
  100. package/src/centaline/dynamicSearchList/src/dynamicTableTip.vue +46 -46
  101. package/src/centaline/dynamicSearchList/src/dynamicTableToolbar.vue +61 -61
  102. package/src/centaline/dynamicSeg/index.js +11 -11
  103. package/src/centaline/dynamicSeg/src/dynamicSeg.vue +100 -100
  104. package/src/centaline/dynamicSensitiveEye/index.js +11 -11
  105. package/src/centaline/dynamicSensitiveEye/src/dynamicSensitiveEye.vue +74 -74
  106. package/src/centaline/dynamicSo/index.js +14 -14
  107. package/src/centaline/dynamicSo/src/dynamicSo.vue +328 -328
  108. package/src/centaline/dynamicSo/src/dynamicSo/345/211/257/346/234/254.vue +69 -69
  109. package/src/centaline/dynamicSos/index.js +14 -14
  110. package/src/centaline/dynamicSos/src/dynamicSos - /345/244/215/345/210/266.vue" +223 -223
  111. package/src/centaline/dynamicSos/src/dynamicSos.vue +260 -260
  112. package/src/centaline/dynamicSw/index.js +11 -11
  113. package/src/centaline/dynamicSw/src/dynamicSw.vue +74 -74
  114. package/src/centaline/dynamicT/index.js +11 -11
  115. package/src/centaline/dynamicT/src/dynamicT.vue +79 -79
  116. package/src/centaline/dynamicTab/index.js +11 -11
  117. package/src/centaline/dynamicTab/src/dynamicTab.vue +49 -49
  118. package/src/centaline/dynamicTabs/index.js +11 -11
  119. package/src/centaline/dynamicTabs/src/dynamicTabs.vue +69 -69
  120. package/src/centaline/dynamicTags/index.js +13 -13
  121. package/src/centaline/dynamicTags/src/dynamicTags - /345/244/215/345/210/266.vue" +391 -391
  122. package/src/centaline/dynamicTags/src/dynamicTags.vue +427 -427
  123. package/src/centaline/dynamicTimeSelect/index.js +11 -11
  124. package/src/centaline/dynamicTimeSelect/src/dynamicTimeSelect.vue +141 -141
  125. package/src/centaline/dynamicTree/index.js +11 -11
  126. package/src/centaline/dynamicTree/src/dynamicSearchTree.vue +66 -66
  127. package/src/centaline/dynamicTree/src/dynamicTree.vue +233 -233
  128. package/src/centaline/dynamicTree/src/dynamicTreeList.vue +74 -74
  129. package/src/centaline/formData/index.js +290 -290
  130. package/src/centaline/imgPreview/index.js +42 -42
  131. package/src/centaline/imgPreview/src/imgPreview.vue +26 -26
  132. package/src/centaline/index.js +51 -51
  133. package/src/centaline/loader/index.js +157 -157
  134. package/src/centaline/loader/src/ctl/Base.js +261 -261
  135. package/src/centaline/loader/src/ctl/Button.js +44 -44
  136. package/src/centaline/loader/src/ctl/Cb.js +27 -27
  137. package/src/centaline/loader/src/ctl/Checkbox.js +107 -107
  138. package/src/centaline/loader/src/ctl/ComboBoxWithTextBox.js +162 -162
  139. package/src/centaline/loader/src/ctl/D.js +31 -31
  140. package/src/centaline/loader/src/ctl/Detail.js +175 -175
  141. package/src/centaline/loader/src/ctl/Dtd.js +115 -115
  142. package/src/centaline/loader/src/ctl/DtdOld.js +129 -129
  143. package/src/centaline/loader/src/ctl/File.js +292 -292
  144. package/src/centaline/loader/src/ctl/Form.js +380 -380
  145. package/src/centaline/loader/src/ctl/FormList.js +428 -428
  146. package/src/centaline/loader/src/ctl/GM.js +20 -20
  147. package/src/centaline/loader/src/ctl/Gp.js +9 -9
  148. package/src/centaline/loader/src/ctl/Hd.js +13 -13
  149. package/src/centaline/loader/src/ctl/HyperLink.js +24 -24
  150. package/src/centaline/loader/src/ctl/InputNumber.js +51 -51
  151. package/src/centaline/loader/src/ctl/Iti.js +108 -108
  152. package/src/centaline/loader/src/ctl/L.js +18 -18
  153. package/src/centaline/loader/src/ctl/Mo.js +183 -183
  154. package/src/centaline/loader/src/ctl/Mt.js +20 -20
  155. package/src/centaline/loader/src/ctl/PlaceHolder.js +17 -17
  156. package/src/centaline/loader/src/ctl/Router.js +273 -273
  157. package/src/centaline/loader/src/ctl/SearchCategory.js +54 -54
  158. package/src/centaline/loader/src/ctl/SearchScreen.js +236 -236
  159. package/src/centaline/loader/src/ctl/SearchTable.js +772 -772
  160. package/src/centaline/loader/src/ctl/Seg.js +37 -37
  161. package/src/centaline/loader/src/ctl/SensitiveEye.js +65 -65
  162. package/src/centaline/loader/src/ctl/So.js +117 -117
  163. package/src/centaline/loader/src/ctl/Sos.js +128 -128
  164. package/src/centaline/loader/src/ctl/Sw.js +27 -27
  165. package/src/centaline/loader/src/ctl/T.js +65 -65
  166. package/src/centaline/loader/src/ctl/Tabs.js +57 -57
  167. package/src/centaline/loader/src/ctl/Tags.js +191 -191
  168. package/src/centaline/loader/src/ctl/TimeSelect.js +87 -87
  169. package/src/centaline/loader/src/ctl/Tree.js +151 -151
  170. package/src/centaline/loader/src/ctl/Ttts.js +78 -78
  171. package/src/centaline/loader/src/ctl/lib/Enum.js +563 -563
  172. package/src/centaline/loader/src/ctl/lib/LibFunction.js +364 -364
  173. package/src/centaline/loader/src/ctl.js +36 -36
  174. package/src/centaline/mixins/dynamicElement.js +151 -151
  175. package/src/centaline/mixins/dynamicSelect.js +84 -84
  176. package/src/centaline/mixins/emitter.js +33 -33
  177. package/src/centaline/progress/index.js +11 -11
  178. package/src/centaline/progress/src/progress.vue +70 -70
  179. package/src/centaline/quickInput/src/quickInput.vue +64 -64
  180. package/src/centaline/selectOption/src/selectOption.vue +61 -61
  181. package/src/centaline/selectOption/src/selectOptionVertical.vue +80 -80
  182. package/src/centaline/templateControls/index.js +17 -17
  183. package/src/centaline/templateControls/src/dynamicTableA.vue +20 -20
  184. package/src/centaline/templateControls/src/dynamicTableCurrency.vue +62 -62
  185. package/src/centaline/templateControls/src/dynamicTableImg.vue +25 -25
  186. package/src/centaline/templates/index.js +34 -34
  187. package/src/centaline/templates/src/ContractSearch.js +67 -67
  188. package/src/centaline/templates/src/test.js +44 -44
  189. package/src/centaline/validate/index.js +332 -332
  190. package/src/main.js +46 -46
  191. package/src/router/index.js +44 -44
  192. package/wwwroot/static/centaline/centaline-data-driven.js +1 -1
  193. package/wwwroot/static/centaline/centaline-data-driven.js.map +1 -1
@@ -1,291 +1,291 @@
1
- import Vue from 'vue';
2
- import common from '../common';
3
- import Enum from '../loader/src/ctl/lib/Enum';
4
- import Axios from 'axios';
5
- const formData = {
6
- install(Vue) {
7
- Vue.prototype.$formData = formData;
8
- if (typeof window !== 'undefined') {
9
- window.$formData = formData;
10
- }
11
- },
12
- common: common,
13
- Axios: Axios,
14
- form: null,
15
- formTable:null,
16
- excuteData: null,//fields
17
- fieldsDic: null,//fieldsDic
18
- _excuteListData: undefined,
19
-
20
- //获取code1
21
- getCode1ByField1(id) {
22
- var rtn1 = this.fieldsDic[id];
23
- if (rtn1) {
24
- return rtn1.value;
25
- }
26
- },
27
- //获取code2
28
- getCode2ByField1(id) {
29
- var rtn1 = this.fieldsDic[id];
30
- if (rtn1) {
31
- return rtn1.value1;
32
- }
33
- },
34
- //获取Field的属性attrKey的值
35
- getValueByFieldName(id, attrKey) {
36
- attrKey = this.common.initialsToUpperCase(attrKey);
37
- var rtn1 = this.fieldsDic[id];
38
- if (rtn1) {
39
- return rtn1.source[attrKey];
40
- }
41
- },
42
- //设置Field的属性attrKey的值
43
- setValueByFieldName(id, attrKey, attrValue) {
44
- attrKey = this.common.initialsToUpperCase(attrKey);
45
- var rtn1 = this.fieldsDic[id];
46
- if (rtn1) {
47
- rtn1.source[attrKey] = attrValue;
48
- console.log(this.form)
49
- this.form.hatchHandle(id, attrKey, attrValue, rtn1);
50
- //this.form.hiddenHandle(rtn1);//隐藏关联的
51
-
52
- //用于处理源数据改动,强制更新视图数据 todo
53
- if (rtn1.self.$forceUpdate) {
54
- rtn1.self.$forceUpdate();
55
- }
56
- }
57
- },
58
- //设置Field的v1、v2的值
59
- setV1AndV2ByField1(id, code1, code2) {
60
- var rtn1 = this.fieldsDic[id];
61
- if (rtn1) {
62
- if (typeof rtn1.value !== 'undefined') {
63
- rtn1.value = code1;
64
-
65
- this.form.validMrf(rtn1);//验证必填关联组件
66
- this.form.hiddenHandle(rtn1, true);//隐藏关联的
67
- }
68
- if (typeof rtn1.value1 !== 'undefined') {
69
- rtn1.value1 = code2;
70
- }
71
-
72
- if (rtn1.self.$forceUpdate) {
73
- rtn1.self.$forceUpdate();
74
- }
75
- }
76
- },
77
- //获取列表数据
78
- get excuteListData() {
79
- if (this._excuteListData) {
80
- return this._excuteListData;
81
- }
82
- else {
83
- if (this.excuteData !== null) {
84
- this._excuteListData = this.excuteData.filter((v) => {
85
- return typeof v.is !== undefined && v.is === 'ct-form-list-table';
86
- });
87
- }
88
- }
89
- return this._excuteListData;
90
- },
91
- setExcuteListData(fields) {
92
- this._excuteListData=null;
93
- if (fields !== null) {
94
- this.excuteData=fields;
95
- this._excuteListData = fields.filter((v) => {
96
- return typeof v.is !== undefined && v.is === 'ct-form-list-table';
97
- });
98
- }
99
- },
100
- //获取列表的Field
101
- getListField(tableName, rowNum, fiedlId) {
102
- let listData = this.excuteListData.find((v) => {
103
- return v.id === tableName;
104
- });
105
- if (listData) {
106
- let field = null;
107
- //正在编辑的Field
108
- if (rowNum === null && (fiedlId === null || listData.currentEventField.id === fiedlId)) {
109
- field = listData.currentEventField;
110
- }
111
- //正在编辑的行
112
- else if (rowNum === null && listData.currentRowIndex === 0) {
113
- let fields = listData.currentRow.data;
114
- field = fields[fiedlId];
115
- }
116
- //源数据
117
- else {
118
- if (rowNum === null && listData.currentRowIndex) {
119
- rowNum = listData.currentRowIndex;
120
- }
121
-
122
- if (rowNum === 0 || (rowNum && fiedlId)) {
123
- try {
124
- let fields = listData.rows[rowNum].field;
125
- field = fields.find((v) => {
126
- return v.id === fiedlId;
127
- });
128
- } catch (e) {
129
- if (listData.rows.length <= rowNum) {
130
- var checkMsg = "获取列表行索引超出界限";
131
- this.message(checkMsg);
132
- }
133
- }
134
- }
135
- }
136
-
137
- return { listData: listData, field: field };
138
- }
139
- },
140
- //获取列表的行数(注意 这里包括列头)
141
- getListCount(tableName) {
142
- tableName = tableName ? tableName : this.form.scripts.$fd;
143
- let data = this.getListField(tableName, null, null);
144
- if (data) {
145
- return data.listData.rows.length;
146
- }
147
- },
148
- //获取表格某行某列的值
149
- getListFieldValue(tableName, rowNum, fiedlId, attrName, defaultValue) {
150
- tableName = tableName ? tableName : this.form.scripts.$fd;
151
-
152
- let data = this.getListField(tableName, rowNum, fiedlId);
153
-
154
- attrName = this.common.initialsToUpperCase(attrName);
155
- attrName = attrName ? attrName : 'code1';
156
-
157
- if (!fiedlId) {
158
- fiedlId = data.listData.currentEventField.id;
159
- }
160
- if (fiedlId && rowNum === null && fiedlId === data.listData.currentEventField.id) {
161
- data.field = data.listData.currentEventField;
162
- }
163
- rowNum = rowNum !== null ? rowNum : data.listData.currentRowIndex;
164
-
165
- //若该行正在编辑,则取编辑状态的。
166
- if (data && data.listData && data.listData.currentRow.data && data.listData.currentRow.data[fiedlId]
167
- && data.listData.currentRow.data.$sourceIndex === rowNum && data.listData.currentRow.isSet) {
168
- return data.listData.currentRow.data[fiedlId].source[attrName];
169
- }
170
- else if (data && data.field) {
171
- if (typeof defaultValue !== 'undefined' && data.listData.rows[rowNum].deleted) {//若该行被删除时,则直接返回默认值
172
- return defaultValue;
173
- }
174
- return data.field.source[attrName];
175
- }
176
- },
177
- //设置表格某行某列的值
178
- setListFieldValue(value, tableName, rowNum, fiedlId, attrName) {
179
- value = value==undefined?"":value.toString();
180
- tableName = tableName ? tableName : this.form.scripts.$fd;
181
- let data = this.getListField(tableName, rowNum, fiedlId);
182
-
183
- attrName = this.common.initialsToUpperCase(attrName);
184
- attrName = attrName ? attrName : 'code1';
185
-
186
- if (!fiedlId) {
187
- fiedlId = data.listData.currentEventField.id;
188
- }
189
- if (fiedlId && !rowNum && fiedlId === data.listData.currentEventField.id) {
190
- //data.field = data.listData.currentEventField;
191
- }
192
- rowNum = rowNum ? rowNum : data.listData.currentRowIndex;
193
-
194
- if (data) {
195
- if (data.field) {
196
- data.field.source[attrName] = value;
197
- data.listData.updateListField(data.listData.refFieldsLabel, rowNum, fiedlId);
198
- }
199
- //data.field.self.$forceUpdate();
200
-
201
- //正在编辑的行
202
- if (data.listData.currentRow.data && data.listData.currentRow.data[fiedlId] && data.listData.currentRow.data.$sourceIndex === rowNum) {
203
- let currentField = data.listData.currentRow.data[fiedlId];
204
- currentField.source[attrName] = value;
205
- //校验自己
206
- if (currentField.self && currentField.self.validExcute) {
207
- currentField.self.validExcute();
208
- }
209
- if (typeof currentField.self.$forceUpdate === "function") {
210
- currentField.self.$forceUpdate();
211
- }
212
- }
213
-
214
- //如果有汇总列,触发重新计算汇总
215
- if (data.listData.showSummary) {
216
- data.listData.tableData.push({});
217
- data.listData.tableData.pop();
218
- }
219
-
220
- return true;
221
- }
222
- return false;
223
- },
224
- //设置表格属性值
225
- setListAttr(tableId, attrName, attrValue) {
226
- let listData = this.excuteListData.find((v) => {
227
- return v.id === tableId;
228
- });
229
- listData[attrName] = attrValue
230
- },
231
- //获取后台数据,并返回脚本。
232
- execServerScript(action, object, successCallback) {
233
- let formData = this;//作用域保存
234
- debugger;
235
- //是否是行内触发的
236
- let data = this.getListField(this.form.scripts.$fd, null, null);
237
- object.editMode = data ? 1 : 0;
238
-
239
- Vue.prototype.$api.postHandler(this.common.globalUri(), { action: action, para: object }).then(
240
- function (response) {
241
- if (response.rtnCode === Enum.ReturnCode.Successful) {
242
- var data = response.content;
243
- if (response.clientActionType === Enum.ClientActionType.ExcuteScript && data) {
244
- formData.common.excute.call(formData.form.scripts, data);
245
- }
246
- else
247
- if (response.clientActionType === Enum.ClientActionType.None && data && successCallback) {
248
- //因为要传参,并直接执行方法,故successCallback回调里要使用formData的话,要加this
249
- //若不能接受this,也可修改common.excute方法
250
- //successCallback.call(formData.form.scripts, data);
251
-
252
- //优化,不需要加this
253
- formData.common.excuteFun.call(formData.form.scripts, successCallback, data);
254
- }
255
- }
256
- }
257
- );
258
- },
259
- //消息提示 type主题:success/warning/info/error。 duration 显示时间, 毫秒。设为 0 则不会自动关闭。 showClose 是否显示关闭按钮。
260
- message(message, type, center, duration, showClose, dangerouslyUseHTMLString) {
261
- if (typeof center === 'undefined') {
262
- center = true;
263
- }
264
- if (typeof duration === 'undefined') {
265
- duration = 1500;
266
- }
267
- if (typeof showClose === 'undefined') {
268
- showClose = false;
269
- }
270
-
271
- Vue.prototype.$message({
272
- message: message,//消息文字
273
- dangerouslyUseHTMLString: dangerouslyUseHTMLString || false,
274
- type: type || 'error',//主题:success/warning/info/error
275
- center: center,//是否居中
276
- duration: duration, //显示时间, 毫秒。设为 0 则不会自动关闭
277
- showClose: showClose,//是否显示关闭按钮
278
- });
279
- },
280
- //打开商铺房源详情页
281
- openPropertyDetailRET(parm){
282
- let title=parm.field.pageTitle==undefined ?parm.field.label:parm.field.pageTitle;
283
- common.getDataDrivenOpts().handler.openPropertyDetailRET(parm.submitData, title,this.form);
284
- },
285
- };
286
-
287
- if (typeof window !== 'undefined' && window.Vue) {
288
- window.Vue.use(formData);
289
- }
290
-
1
+ import Vue from 'vue';
2
+ import common from '../common';
3
+ import Enum from '../loader/src/ctl/lib/Enum';
4
+ import Axios from 'axios';
5
+ const formData = {
6
+ install(Vue) {
7
+ Vue.prototype.$formData = formData;
8
+ if (typeof window !== 'undefined') {
9
+ window.$formData = formData;
10
+ }
11
+ },
12
+ common: common,
13
+ Axios: Axios,
14
+ form: null,
15
+ formTable:null,
16
+ excuteData: null,//fields
17
+ fieldsDic: null,//fieldsDic
18
+ _excuteListData: undefined,
19
+
20
+ //获取code1
21
+ getCode1ByField1(id) {
22
+ var rtn1 = this.fieldsDic[id];
23
+ if (rtn1) {
24
+ return rtn1.value;
25
+ }
26
+ },
27
+ //获取code2
28
+ getCode2ByField1(id) {
29
+ var rtn1 = this.fieldsDic[id];
30
+ if (rtn1) {
31
+ return rtn1.value1;
32
+ }
33
+ },
34
+ //获取Field的属性attrKey的值
35
+ getValueByFieldName(id, attrKey) {
36
+ attrKey = this.common.initialsToUpperCase(attrKey);
37
+ var rtn1 = this.fieldsDic[id];
38
+ if (rtn1) {
39
+ return rtn1.source[attrKey];
40
+ }
41
+ },
42
+ //设置Field的属性attrKey的值
43
+ setValueByFieldName(id, attrKey, attrValue) {
44
+ attrKey = this.common.initialsToUpperCase(attrKey);
45
+ var rtn1 = this.fieldsDic[id];
46
+ if (rtn1) {
47
+ rtn1.source[attrKey] = attrValue;
48
+ console.log(this.form)
49
+ this.form.hatchHandle(id, attrKey, attrValue, rtn1);
50
+ //this.form.hiddenHandle(rtn1);//隐藏关联的
51
+
52
+ //用于处理源数据改动,强制更新视图数据 todo
53
+ if (rtn1.self.$forceUpdate) {
54
+ rtn1.self.$forceUpdate();
55
+ }
56
+ }
57
+ },
58
+ //设置Field的v1、v2的值
59
+ setV1AndV2ByField1(id, code1, code2) {
60
+ var rtn1 = this.fieldsDic[id];
61
+ if (rtn1) {
62
+ if (typeof rtn1.value !== 'undefined') {
63
+ rtn1.value = code1;
64
+
65
+ this.form.validMrf(rtn1);//验证必填关联组件
66
+ this.form.hiddenHandle(rtn1, true);//隐藏关联的
67
+ }
68
+ if (typeof rtn1.value1 !== 'undefined') {
69
+ rtn1.value1 = code2;
70
+ }
71
+
72
+ if (rtn1.self.$forceUpdate) {
73
+ rtn1.self.$forceUpdate();
74
+ }
75
+ }
76
+ },
77
+ //获取列表数据
78
+ get excuteListData() {
79
+ if (this._excuteListData) {
80
+ return this._excuteListData;
81
+ }
82
+ else {
83
+ if (this.excuteData !== null) {
84
+ this._excuteListData = this.excuteData.filter((v) => {
85
+ return typeof v.is !== undefined && v.is === 'ct-form-list-table';
86
+ });
87
+ }
88
+ }
89
+ return this._excuteListData;
90
+ },
91
+ setExcuteListData(fields) {
92
+ this._excuteListData=null;
93
+ if (fields !== null) {
94
+ this.excuteData=fields;
95
+ this._excuteListData = fields.filter((v) => {
96
+ return typeof v.is !== undefined && v.is === 'ct-form-list-table';
97
+ });
98
+ }
99
+ },
100
+ //获取列表的Field
101
+ getListField(tableName, rowNum, fiedlId) {
102
+ let listData = this.excuteListData.find((v) => {
103
+ return v.id === tableName;
104
+ });
105
+ if (listData) {
106
+ let field = null;
107
+ //正在编辑的Field
108
+ if (rowNum === null && (fiedlId === null || listData.currentEventField.id === fiedlId)) {
109
+ field = listData.currentEventField;
110
+ }
111
+ //正在编辑的行
112
+ else if (rowNum === null && listData.currentRowIndex === 0) {
113
+ let fields = listData.currentRow.data;
114
+ field = fields[fiedlId];
115
+ }
116
+ //源数据
117
+ else {
118
+ if (rowNum === null && listData.currentRowIndex) {
119
+ rowNum = listData.currentRowIndex;
120
+ }
121
+
122
+ if (rowNum === 0 || (rowNum && fiedlId)) {
123
+ try {
124
+ let fields = listData.rows[rowNum].field;
125
+ field = fields.find((v) => {
126
+ return v.id === fiedlId;
127
+ });
128
+ } catch (e) {
129
+ if (listData.rows.length <= rowNum) {
130
+ var checkMsg = "获取列表行索引超出界限";
131
+ this.message(checkMsg);
132
+ }
133
+ }
134
+ }
135
+ }
136
+
137
+ return { listData: listData, field: field };
138
+ }
139
+ },
140
+ //获取列表的行数(注意 这里包括列头)
141
+ getListCount(tableName) {
142
+ tableName = tableName ? tableName : this.form.scripts.$fd;
143
+ let data = this.getListField(tableName, null, null);
144
+ if (data) {
145
+ return data.listData.rows.length;
146
+ }
147
+ },
148
+ //获取表格某行某列的值
149
+ getListFieldValue(tableName, rowNum, fiedlId, attrName, defaultValue) {
150
+ tableName = tableName ? tableName : this.form.scripts.$fd;
151
+
152
+ let data = this.getListField(tableName, rowNum, fiedlId);
153
+
154
+ attrName = this.common.initialsToUpperCase(attrName);
155
+ attrName = attrName ? attrName : 'code1';
156
+
157
+ if (!fiedlId) {
158
+ fiedlId = data.listData.currentEventField.id;
159
+ }
160
+ if (fiedlId && rowNum === null && fiedlId === data.listData.currentEventField.id) {
161
+ data.field = data.listData.currentEventField;
162
+ }
163
+ rowNum = rowNum !== null ? rowNum : data.listData.currentRowIndex;
164
+
165
+ //若该行正在编辑,则取编辑状态的。
166
+ if (data && data.listData && data.listData.currentRow.data && data.listData.currentRow.data[fiedlId]
167
+ && data.listData.currentRow.data.$sourceIndex === rowNum && data.listData.currentRow.isSet) {
168
+ return data.listData.currentRow.data[fiedlId].source[attrName];
169
+ }
170
+ else if (data && data.field) {
171
+ if (typeof defaultValue !== 'undefined' && data.listData.rows[rowNum].deleted) {//若该行被删除时,则直接返回默认值
172
+ return defaultValue;
173
+ }
174
+ return data.field.source[attrName];
175
+ }
176
+ },
177
+ //设置表格某行某列的值
178
+ setListFieldValue(value, tableName, rowNum, fiedlId, attrName) {
179
+ value = value==undefined?"":value.toString();
180
+ tableName = tableName ? tableName : this.form.scripts.$fd;
181
+ let data = this.getListField(tableName, rowNum, fiedlId);
182
+
183
+ attrName = this.common.initialsToUpperCase(attrName);
184
+ attrName = attrName ? attrName : 'code1';
185
+
186
+ if (!fiedlId) {
187
+ fiedlId = data.listData.currentEventField.id;
188
+ }
189
+ if (fiedlId && !rowNum && fiedlId === data.listData.currentEventField.id) {
190
+ //data.field = data.listData.currentEventField;
191
+ }
192
+ rowNum = rowNum ? rowNum : data.listData.currentRowIndex;
193
+
194
+ if (data) {
195
+ if (data.field) {
196
+ data.field.source[attrName] = value;
197
+ data.listData.updateListField(data.listData.refFieldsLabel, rowNum, fiedlId);
198
+ }
199
+ //data.field.self.$forceUpdate();
200
+
201
+ //正在编辑的行
202
+ if (data.listData.currentRow.data && data.listData.currentRow.data[fiedlId] && data.listData.currentRow.data.$sourceIndex === rowNum) {
203
+ let currentField = data.listData.currentRow.data[fiedlId];
204
+ currentField.source[attrName] = value;
205
+ //校验自己
206
+ if (currentField.self && currentField.self.validExcute) {
207
+ currentField.self.validExcute();
208
+ }
209
+ if (typeof currentField.self.$forceUpdate === "function") {
210
+ currentField.self.$forceUpdate();
211
+ }
212
+ }
213
+
214
+ //如果有汇总列,触发重新计算汇总
215
+ if (data.listData.showSummary) {
216
+ data.listData.tableData.push({});
217
+ data.listData.tableData.pop();
218
+ }
219
+
220
+ return true;
221
+ }
222
+ return false;
223
+ },
224
+ //设置表格属性值
225
+ setListAttr(tableId, attrName, attrValue) {
226
+ let listData = this.excuteListData.find((v) => {
227
+ return v.id === tableId;
228
+ });
229
+ listData[attrName] = attrValue
230
+ },
231
+ //获取后台数据,并返回脚本。
232
+ execServerScript(action, object, successCallback) {
233
+ let formData = this;//作用域保存
234
+ debugger;
235
+ //是否是行内触发的
236
+ let data = this.getListField(this.form.scripts.$fd, null, null);
237
+ object.editMode = data ? 1 : 0;
238
+
239
+ Vue.prototype.$api.postHandler(this.common.globalUri(), { action: action, para: object }).then(
240
+ function (response) {
241
+ if (response.rtnCode === Enum.ReturnCode.Successful) {
242
+ var data = response.content;
243
+ if (response.clientActionType === Enum.ClientActionType.ExcuteScript && data) {
244
+ formData.common.excute.call(formData.form.scripts, data);
245
+ }
246
+ else
247
+ if (response.clientActionType === Enum.ClientActionType.None && data && successCallback) {
248
+ //因为要传参,并直接执行方法,故successCallback回调里要使用formData的话,要加this
249
+ //若不能接受this,也可修改common.excute方法
250
+ //successCallback.call(formData.form.scripts, data);
251
+
252
+ //优化,不需要加this
253
+ formData.common.excuteFun.call(formData.form.scripts, successCallback, data);
254
+ }
255
+ }
256
+ }
257
+ );
258
+ },
259
+ //消息提示 type主题:success/warning/info/error。 duration 显示时间, 毫秒。设为 0 则不会自动关闭。 showClose 是否显示关闭按钮。
260
+ message(message, type, center, duration, showClose, dangerouslyUseHTMLString) {
261
+ if (typeof center === 'undefined') {
262
+ center = true;
263
+ }
264
+ if (typeof duration === 'undefined') {
265
+ duration = 1500;
266
+ }
267
+ if (typeof showClose === 'undefined') {
268
+ showClose = false;
269
+ }
270
+
271
+ Vue.prototype.$message({
272
+ message: message,//消息文字
273
+ dangerouslyUseHTMLString: dangerouslyUseHTMLString || false,
274
+ type: type || 'error',//主题:success/warning/info/error
275
+ center: center,//是否居中
276
+ duration: duration, //显示时间, 毫秒。设为 0 则不会自动关闭
277
+ showClose: showClose,//是否显示关闭按钮
278
+ });
279
+ },
280
+ //打开商铺房源详情页
281
+ openPropertyDetailRET(parm){
282
+ let title=parm.field.pageTitle==undefined ?parm.field.label:parm.field.pageTitle;
283
+ common.getDataDrivenOpts().handler.openPropertyDetailRET(parm.submitData, title,this.form);
284
+ },
285
+ };
286
+
287
+ if (typeof window !== 'undefined' && window.Vue) {
288
+ window.Vue.use(formData);
289
+ }
290
+
291
291
  export default formData;
@@ -1,42 +1,42 @@
1
- import imgPreview from './src/imgPreview.vue'
2
-
3
- imgPreview.install = function (Vue) {
4
- Vue.component(imgPreview.name, imgPreview);
5
- //import ElImageViewer from "element-ui/packages/image/src/image-viewer";
6
- //Vue.component("ElImageViewer", ElImageViewer);
7
-
8
- const PreviewConstructor = Vue.extend(imgPreview);
9
- const instance = new PreviewConstructor();
10
- instance.$mount(document.createElement("div"));
11
- setTimeout(function () {
12
- document.body.appendChild(instance.$el);
13
- }, 1000);
14
-
15
-
16
- /**
17
- * 挂载在vue原型上
18
- * @param {Array} imgs 需要预览的图片数组
19
- */
20
- Vue.prototype.$openPreview = function (imgs = []) {
21
- instance.showPreview = true;
22
- instance.previewImages = imgs;
23
- };
24
- }
25
-
26
- if (typeof window !== 'undefined' && window.Vue) {
27
- window.Vue.use(imgPreview);
28
-
29
- const PreviewConstructor = Vue.extend(imgPreview);
30
- const instance = new PreviewConstructor();
31
- instance.$mount(document.createElement("div"));
32
- /**
33
- * 挂载在vue原型上
34
- * @param {Array} imgs 需要预览的图片数组
35
- */
36
- window.Vue.prototype.$openPreview = function (imgs = []) {
37
- instance.showPreview = true;
38
- instance.previewImages = imgs;
39
- };
40
- }
41
-
42
- export default imgPreview;
1
+ import imgPreview from './src/imgPreview.vue'
2
+
3
+ imgPreview.install = function (Vue) {
4
+ Vue.component(imgPreview.name, imgPreview);
5
+ //import ElImageViewer from "element-ui/packages/image/src/image-viewer";
6
+ //Vue.component("ElImageViewer", ElImageViewer);
7
+
8
+ const PreviewConstructor = Vue.extend(imgPreview);
9
+ const instance = new PreviewConstructor();
10
+ instance.$mount(document.createElement("div"));
11
+ setTimeout(function () {
12
+ document.body.appendChild(instance.$el);
13
+ }, 1000);
14
+
15
+
16
+ /**
17
+ * 挂载在vue原型上
18
+ * @param {Array} imgs 需要预览的图片数组
19
+ */
20
+ Vue.prototype.$openPreview = function (imgs = []) {
21
+ instance.showPreview = true;
22
+ instance.previewImages = imgs;
23
+ };
24
+ }
25
+
26
+ if (typeof window !== 'undefined' && window.Vue) {
27
+ window.Vue.use(imgPreview);
28
+
29
+ const PreviewConstructor = Vue.extend(imgPreview);
30
+ const instance = new PreviewConstructor();
31
+ instance.$mount(document.createElement("div"));
32
+ /**
33
+ * 挂载在vue原型上
34
+ * @param {Array} imgs 需要预览的图片数组
35
+ */
36
+ window.Vue.prototype.$openPreview = function (imgs = []) {
37
+ instance.showPreview = true;
38
+ instance.previewImages = imgs;
39
+ };
40
+ }
41
+
42
+ export default imgPreview;