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,376 +1,376 @@
1
- <template>
2
- <div class="ct-form-list" v-focus="foucus" :class="{'tableDisabled':model.tableDisabled}">
3
- <div class="list-title">
4
- <h5>{{model.title}}</h5>
5
- </div>
6
- <div class="list-button max-btn-add">
7
- <el-button v-if="model.create" type="success" size="mini" icon="el-icon-circle-plus-outline" @click="addRow">
8
- 新增
9
- </el-button>
10
- </div>
11
-
12
- <div id="listTable">
13
- <el-row>
14
- <el-col :span="24">
15
- <el-table size="mini" class="max-table--border" :data="model.tableData" :key="itemKey" border style="width: 100%" highlight-current-row :show-summary="model.showSummary" :summary-method="getSummaries">
16
- <!--数据列-->
17
- <el-table-column v-for="(v,i) in model.rows[0].field" :key="i" :prop="v.id" :label="v.label" v-if="v.show !== false" header-align="center">
18
- <template slot="header" slot-scope="scope">
19
- <div class="cell" :class="{'ct-table-required':v.required&&model.rows[0].edit&& model.rows[0].delete&&!model.tableDisabled}">
20
- {{v.label}}
21
- </div>
22
- </template>
23
- <template slot-scope="scope">
24
- <span v-if="scope.row.isSet">
25
- <!--<component v-if ref="Fields" :is="v.is" :vmodel="scope.row[v.id]" :api="model.OptApi"></component>-->
26
- <component ref="Fields" :is="v.is" :vmodel="model.currentRow.data[v.id]" :api="model.OptApi"
27
- @change="changeHandler(model.currentRow.data[v.id], model.currentRow.data.$sourceIndex)"
28
- @input="inputHandler(model.currentRow.data[v.id], model.currentRow.data.$sourceIndex)"></component>
29
- </span>
30
- <!--<span v-else>{{scope.row[v.id].labelValue}}</span>-->
31
- <span v-else-if="v.is=='ct-sensitiveeye'">
32
- <component v-if ref="Fields" :is="v.is" :vmodel="scope.row[v.id]" :vrowmodel="scope.row" :api="model.OptApi"></component>
33
- </span>
34
- <ct-span v-else :vmodel="scope.row[v.id]" :rowNum="scope.row.$sourceIndex" ref="FieldsLabel"></ct-span>
35
- </template>
36
- </el-table-column>
37
-
38
- <!--操作列-->
39
- <el-table-column label="操作" v-if="model.rows[0].edit || model.rows[0].delete || model.buttons.length > 0" header-align="center">
40
- <template slot-scope="scope">
41
- <span v-if="scope.row.edit || scope.row.isSet" class="el-tag el-tag--info el-tag--mini" style="cursor: pointer;" @click="saveRow(scope.row,scope.$index,true)">
42
- {{scope.row.isSet?'保存':"修改"}}
43
- </span>
44
- <span v-if="scope.row.delete && !scope.row.isSet" class="el-tag el-tag--danger el-tag--mini" style="cursor: pointer;" @click="deleteRow(scope.$index, scope.row.$sourceIndex)">
45
- 删除
46
- </span>
47
- <span v-else-if="scope.row.isSet" class="el-tag el-tag--mini" style="cursor: pointer;" @click="saveRow(scope.row,scope.$index,false)">
48
- 取消
49
- </span>
50
- <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)">
51
- {{v.label}}
52
- </span>
53
- </template>
54
- </el-table-column>
55
- </el-table>
56
- </el-col>
57
- </el-row>
58
- </div>
59
-
60
- </div>
61
- </template>
62
- <script>
63
- //Form内表格
64
- var ctSpan = {//临时的span组件对象,用于vue双向绑定,强制更新
65
- props: {
66
- vmodel: Object,
67
- rowNum: Number,
68
- },
69
- data: function () {
70
- return {
71
- }
72
- },
73
- methods: {
74
- getClass() {
75
- if (this.vmodel.is === "ct-inputNumber") {
76
- return 'ct-table-inputnumber';
77
- }
78
- }
79
- },
80
- template: '<div :class="getClass()">{{vmodel.labelValue}}{{vmodel.unitName}}</div>'
81
- }
82
-
83
- export default {
84
- name: 'ct-form-list-table',
85
- components: {
86
- 'ct-span': ctSpan
87
- },
88
- props: {
89
- vmodel: Object,
90
- api: String
91
- },
92
- data() {
93
- return {
94
- model: null,
95
- foucus: false,
96
- itemKey: Math.random()
97
- }
98
- },
99
- created() {
100
- let self = this;
101
- this.model = this.vmodel;
102
- this.model.OptApi = this.api;
103
-
104
- this.$nextTick(function () {
105
- self.model.refField = this.$refs.Fields;
106
- self.model.refFieldsLabel = this.$refs.FieldsLabel;
107
- });
108
- },
109
- methods: {
110
- //添加账号
111
- addRow() {
112
- var app = this;
113
- if (app.model.dialogEdit) {
114
- app.model.addRow(() => {
115
- app.$forceUpdate();
116
- });
117
- }
118
- else {
119
- for (let i of app.model.tableData) {
120
- if (i.isSet) return app.$message.warning("请先保存当前编辑项");
121
- }
122
- let newRow = app.model.getCloneRowData(0);
123
- newRow.isSet = true;
124
- app.model.currentRow.isSet = false;
125
- app.model.tableData.push(newRow);
126
- app.model.currentRow.data = app.model.getCloneRowData(0);
127
- app.model.currentRow.isNew = true;
128
- app.model.currentRow.index = app.model.tableData.length - 1;
129
- }
130
- },
131
- //修改
132
- saveRow(row, index, isCancel) {
133
- let app = this;
134
- if (app.model.dialogEdit) {
135
- this.editRow(row.$sourceIndex);
136
- return;
137
- }
138
-
139
- //点击修改 判断是否已经保存所有操作
140
- for (let i of app.model.tableData) {
141
- if (i.isSet && app.model.currentRow.index !== index) {
142
- app.$message.warning("请先保存当前编辑项");
143
- return false;
144
- }
145
- }
146
- //是否是取消操作
147
- if (!isCancel) {
148
- if (app.model.currentRow.isNew) app.model.tableData.splice(index, 1);
149
- return row.isSet = !row.isSet;
150
- app.model.currentRow.isSet = false;
151
- }
152
- //提交数据
153
- if (row.isSet) {//保存
154
- if (app.fieldsValidExcute()) {
155
- if (!app.model.isDuplicated(app.model.currentRow.data, app.model.currentRow.isNew ? -1 : app.model.currentRow.data.$sourceIndex)) {
156
- let data = app.model.currentRow.data;
157
- for (let k in data) {
158
- if (k !== '$sourceIndex') {
159
- row[k].value = data[k].value;
160
- row[k].value1 = data[k].value1;
161
- row[k].text = data[k].text;
162
- }
163
- };
164
- if (app.model.currentRow.isNew) {
165
- app.model.addSourceRow(row);
166
- }
167
-
168
- row.isSet = false;
169
- app.model.currentRow.isSet = false;
170
- app.itemKey = Math.random();
171
- this.model.change = this.model.formListChange;
172
- app.$emit('change');
173
- }
174
- }
175
- }
176
- else {//修改
177
- app.model.currentRow.data = app.model.getCloneRowData(row.$sourceIndex);
178
- app.model.currentRow.isNew = false;
179
- app.model.currentRow.index = index;
180
- app.model.currentRow.isSet = true;
181
- row.isSet = true;
182
- }
183
- },
184
- //删除
185
- deleteRow(index, sourceIndex) {
186
- var self = this;
187
- //判断是否已经保存所有操作
188
- for (let i of self.model.tableData) {
189
- if (i.isSet && self.model.currentRow.index !== index) {
190
- self.$message.warning("请先保存当前编辑项");
191
- return false;
192
- }
193
- }
194
-
195
- this.model.deleteRow(sourceIndex, () => {
196
- self.model.tableData.splice(index, 1);
197
- self.$forceUpdate();
198
-
199
- self.model.change = self.model.formListChange;
200
- self.$emit('change');
201
- });
202
- },
203
- editRow(index) {
204
- var self = this;
205
- this.model.editRow(index, () => {
206
- self.$forceUpdate();
207
- self.$refs.FieldsLabel.forEach((fd) => {
208
- if (fd.rowNum === index) {
209
- fd.$forceUpdate();
210
- }
211
- });
212
- });
213
- },
214
- fieldsValidExcute() {
215
- var self = this;
216
- var rtnBool = true;
217
- self.$refs.Fields.forEach((f) => {
218
- if (typeof f.validExcute !== 'undefined') {
219
- if (!f.validExcute()) {
220
- rtnBool = false;
221
- }
222
- }
223
- });
224
- return rtnBool;
225
- },
226
- validExcute() {
227
- var self = this;
228
- var rtnBool = true;
229
- for (let i of self.model.tableData) {
230
- if (i.isSet) {
231
- self.$message.warning("请先保存表格编辑项");
232
- rtnBool = false;
233
- }
234
- };
235
-
236
- if (rtnBool && self.model.required && this.model.tableData.length === 0) {
237
- self.$message.warning(this.model.label + " 表格不能为空");
238
- rtnBool = false;
239
- }
240
- self.foucus = true;
241
-
242
- return rtnBool;
243
- },
244
- changeHandler(field, index) {
245
- var self = this;
246
- this.model.change = field.change;
247
- this.model.currentRowIndex = index;
248
- this.model.currentEventField = field;
249
- self.$emit('change');
250
-
251
- //如果有汇总列,触发重新计算汇总
252
- this.recalculationSummary();
253
- },
254
- inputHandler(field, index) {
255
- var self = this;
256
- this.model.input = field.input;//当前小组件事件作为大组件事件
257
- this.model.currentRowIndex = index;
258
- this.model.currentEventField = field;
259
-
260
- self.$emit('input');
261
-
262
- //如果有汇总列,触发重新计算汇总
263
- this.recalculationSummary();
264
- },
265
- //如果有汇总列,触发重新计算汇总
266
- recalculationSummary() {
267
- if (this.model.showSummary) {
268
- this.model.tableData.push({});
269
- this.model.tableData.pop();
270
- }
271
- },
272
- buttonClick(row, button) {
273
- var submitData = {};
274
- button.submitFormField.forEach((v) => {
275
- submitData[v] = row[v].value;
276
- });
277
- this.model.currentRowIndex = row.$sourceIndex;
278
-
279
- this.$emit('tableButtonClick', button, submitData);
280
- },
281
- //汇总行 计算
282
- getSummaries(param) {
283
- const self = this;
284
- const { columns, data } = param;
285
- const sums = [];
286
- columns.forEach((column, index) => {
287
- if (index === 0) {
288
- sums[index] = this.model.totalColTitle;
289
- return;
290
- }
291
-
292
- if (self.model.totalCols.indexOf(column.property) > -1) {
293
- const values = data.map(item => {
294
- let value = 0;
295
- if (item.isSet) {
296
- value = self.model.currentRow.data[column.property].value;
297
- }
298
- else {
299
- value = item[column.property].value;
300
- }
301
- return Number(value);
302
- });
303
-
304
- if (!values.every(value => isNaN(value))) {
305
- sums[index] = values.reduce((prev, curr) => {
306
- const value = Number(curr);
307
- if (!isNaN(value)) {
308
- return Number(prev + curr);
309
- } else {
310
- return Number(prev);
311
- }
312
- }, 0);
313
- //sums[index] += ' 元';
314
- if (data[0][column.property].decimals && data[0][column.property].decimals > 0) {
315
- sums[index] = sums[index].toFixed(data[0][column.property].decimals);
316
- }
317
- } else {
318
- sums[index] = 'N/A';
319
- }
320
- }
321
- });
322
-
323
- return sums;
324
- }
325
- }
326
- }
327
- </script>
328
-
329
- <style>
330
- .el-table-add-row {
331
- margin-top: 10px;
332
- width: 100%;
333
- height: 34px;
334
- border: 1px dashed #c1c1cd;
335
- border-radius: 3px;
336
- cursor: pointer;
337
- justify-content: center;
338
- display: flex;
339
- line-height: 34px;
340
- }
341
-
342
- .ct-form-list .list-title {
343
- padding-bottom: 5px;
344
- text-align: left;
345
- display: inline-table;
346
- width: 45%;
347
- }
348
-
349
- .ct-form-list .list-button {
350
- padding-bottom: 5px;
351
- text-align: right;
352
- width: 45%;
353
- display: inline-table;
354
- float: right;
355
- }
356
-
357
- .ct-table-inputnumber {
358
- text-align: right;
359
- }
360
-
361
- .ct-form-list .el-table__footer-wrapper .el-table__footer .has-gutter div {
362
- text-align: right;
363
- }
364
-
365
- .ct-form-list .el-table__footer-wrapper .el-table__footer .has-gutter tr td:first-child div {
366
- text-align: left;
367
- }
368
-
369
- .ct-table-required {
370
- color: red;
371
- }
372
- .tableDisabled {
373
- pointer-events: none;
374
- opacity:0.4;
375
- }
376
- </style>
1
+ <template>
2
+ <div class="ct-form-list" v-focus="foucus" :class="{'tableDisabled':model.tableDisabled}">
3
+ <div class="list-title">
4
+ <h5>{{model.title}}</h5>
5
+ </div>
6
+ <div class="list-button max-btn-add">
7
+ <el-button v-if="model.create" type="success" size="mini" icon="el-icon-circle-plus-outline" @click="addRow">
8
+ 新增
9
+ </el-button>
10
+ </div>
11
+
12
+ <div id="listTable">
13
+ <el-row>
14
+ <el-col :span="24">
15
+ <el-table size="mini" class="max-table--border" :data="model.tableData" :key="itemKey" border style="width: 100%" highlight-current-row :show-summary="model.showSummary" :summary-method="getSummaries">
16
+ <!--数据列-->
17
+ <el-table-column v-for="(v,i) in model.rows[0].field" :key="i" :prop="v.id" :label="v.label" v-if="v.show !== false" header-align="center">
18
+ <template slot="header" slot-scope="scope">
19
+ <div class="cell" :class="{'ct-table-required':v.required&&model.rows[0].edit&& model.rows[0].delete&&!model.tableDisabled}">
20
+ {{v.label}}
21
+ </div>
22
+ </template>
23
+ <template slot-scope="scope">
24
+ <span v-if="scope.row.isSet">
25
+ <!--<component v-if ref="Fields" :is="v.is" :vmodel="scope.row[v.id]" :api="model.OptApi"></component>-->
26
+ <component ref="Fields" :is="v.is" :vmodel="model.currentRow.data[v.id]" :api="model.OptApi"
27
+ @change="changeHandler(model.currentRow.data[v.id], model.currentRow.data.$sourceIndex)"
28
+ @input="inputHandler(model.currentRow.data[v.id], model.currentRow.data.$sourceIndex)"></component>
29
+ </span>
30
+ <!--<span v-else>{{scope.row[v.id].labelValue}}</span>-->
31
+ <span v-else-if="v.is=='ct-sensitiveeye'">
32
+ <component v-if ref="Fields" :is="v.is" :vmodel="scope.row[v.id]" :vrowmodel="scope.row" :api="model.OptApi"></component>
33
+ </span>
34
+ <ct-span v-else :vmodel="scope.row[v.id]" :rowNum="scope.row.$sourceIndex" ref="FieldsLabel"></ct-span>
35
+ </template>
36
+ </el-table-column>
37
+
38
+ <!--操作列-->
39
+ <el-table-column label="操作" v-if="model.rows[0].edit || model.rows[0].delete || model.buttons.length > 0" header-align="center">
40
+ <template slot-scope="scope">
41
+ <span v-if="scope.row.edit || scope.row.isSet" class="el-tag el-tag--info el-tag--mini" style="cursor: pointer;" @click="saveRow(scope.row,scope.$index,true)">
42
+ {{scope.row.isSet?'保存':"修改"}}
43
+ </span>
44
+ <span v-if="scope.row.delete && !scope.row.isSet" class="el-tag el-tag--danger el-tag--mini" style="cursor: pointer;" @click="deleteRow(scope.$index, scope.row.$sourceIndex)">
45
+ 删除
46
+ </span>
47
+ <span v-else-if="scope.row.isSet" class="el-tag el-tag--mini" style="cursor: pointer;" @click="saveRow(scope.row,scope.$index,false)">
48
+ 取消
49
+ </span>
50
+ <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)">
51
+ {{v.label}}
52
+ </span>
53
+ </template>
54
+ </el-table-column>
55
+ </el-table>
56
+ </el-col>
57
+ </el-row>
58
+ </div>
59
+
60
+ </div>
61
+ </template>
62
+ <script>
63
+ //Form内表格
64
+ var ctSpan = {//临时的span组件对象,用于vue双向绑定,强制更新
65
+ props: {
66
+ vmodel: Object,
67
+ rowNum: Number,
68
+ },
69
+ data: function () {
70
+ return {
71
+ }
72
+ },
73
+ methods: {
74
+ getClass() {
75
+ if (this.vmodel.is === "ct-inputNumber") {
76
+ return 'ct-table-inputnumber';
77
+ }
78
+ }
79
+ },
80
+ template: '<div :class="getClass()">{{vmodel.labelValue}}{{vmodel.unitName}}</div>'
81
+ }
82
+
83
+ export default {
84
+ name: 'ct-form-list-table',
85
+ components: {
86
+ 'ct-span': ctSpan
87
+ },
88
+ props: {
89
+ vmodel: Object,
90
+ api: String
91
+ },
92
+ data() {
93
+ return {
94
+ model: null,
95
+ foucus: false,
96
+ itemKey: Math.random()
97
+ }
98
+ },
99
+ created() {
100
+ let self = this;
101
+ this.model = this.vmodel;
102
+ this.model.OptApi = this.api;
103
+
104
+ this.$nextTick(function () {
105
+ self.model.refField = this.$refs.Fields;
106
+ self.model.refFieldsLabel = this.$refs.FieldsLabel;
107
+ });
108
+ },
109
+ methods: {
110
+ //添加账号
111
+ addRow() {
112
+ var app = this;
113
+ if (app.model.dialogEdit) {
114
+ app.model.addRow(() => {
115
+ app.$forceUpdate();
116
+ });
117
+ }
118
+ else {
119
+ for (let i of app.model.tableData) {
120
+ if (i.isSet) return app.$message.warning("请先保存当前编辑项");
121
+ }
122
+ let newRow = app.model.getCloneRowData(0);
123
+ newRow.isSet = true;
124
+ app.model.currentRow.isSet = false;
125
+ app.model.tableData.push(newRow);
126
+ app.model.currentRow.data = app.model.getCloneRowData(0);
127
+ app.model.currentRow.isNew = true;
128
+ app.model.currentRow.index = app.model.tableData.length - 1;
129
+ }
130
+ },
131
+ //修改
132
+ saveRow(row, index, isCancel) {
133
+ let app = this;
134
+ if (app.model.dialogEdit) {
135
+ this.editRow(row.$sourceIndex);
136
+ return;
137
+ }
138
+
139
+ //点击修改 判断是否已经保存所有操作
140
+ for (let i of app.model.tableData) {
141
+ if (i.isSet && app.model.currentRow.index !== index) {
142
+ app.$message.warning("请先保存当前编辑项");
143
+ return false;
144
+ }
145
+ }
146
+ //是否是取消操作
147
+ if (!isCancel) {
148
+ if (app.model.currentRow.isNew) app.model.tableData.splice(index, 1);
149
+ return row.isSet = !row.isSet;
150
+ app.model.currentRow.isSet = false;
151
+ }
152
+ //提交数据
153
+ if (row.isSet) {//保存
154
+ if (app.fieldsValidExcute()) {
155
+ if (!app.model.isDuplicated(app.model.currentRow.data, app.model.currentRow.isNew ? -1 : app.model.currentRow.data.$sourceIndex)) {
156
+ let data = app.model.currentRow.data;
157
+ for (let k in data) {
158
+ if (k !== '$sourceIndex') {
159
+ row[k].value = data[k].value;
160
+ row[k].value1 = data[k].value1;
161
+ row[k].text = data[k].text;
162
+ }
163
+ };
164
+ if (app.model.currentRow.isNew) {
165
+ app.model.addSourceRow(row);
166
+ }
167
+
168
+ row.isSet = false;
169
+ app.model.currentRow.isSet = false;
170
+ app.itemKey = Math.random();
171
+ this.model.change = this.model.formListChange;
172
+ app.$emit('change');
173
+ }
174
+ }
175
+ }
176
+ else {//修改
177
+ app.model.currentRow.data = app.model.getCloneRowData(row.$sourceIndex);
178
+ app.model.currentRow.isNew = false;
179
+ app.model.currentRow.index = index;
180
+ app.model.currentRow.isSet = true;
181
+ row.isSet = true;
182
+ }
183
+ },
184
+ //删除
185
+ deleteRow(index, sourceIndex) {
186
+ var self = this;
187
+ //判断是否已经保存所有操作
188
+ for (let i of self.model.tableData) {
189
+ if (i.isSet && self.model.currentRow.index !== index) {
190
+ self.$message.warning("请先保存当前编辑项");
191
+ return false;
192
+ }
193
+ }
194
+
195
+ this.model.deleteRow(sourceIndex, () => {
196
+ self.model.tableData.splice(index, 1);
197
+ self.$forceUpdate();
198
+
199
+ self.model.change = self.model.formListChange;
200
+ self.$emit('change');
201
+ });
202
+ },
203
+ editRow(index) {
204
+ var self = this;
205
+ this.model.editRow(index, () => {
206
+ self.$forceUpdate();
207
+ self.$refs.FieldsLabel.forEach((fd) => {
208
+ if (fd.rowNum === index) {
209
+ fd.$forceUpdate();
210
+ }
211
+ });
212
+ });
213
+ },
214
+ fieldsValidExcute() {
215
+ var self = this;
216
+ var rtnBool = true;
217
+ self.$refs.Fields.forEach((f) => {
218
+ if (typeof f.validExcute !== 'undefined') {
219
+ if (!f.validExcute()) {
220
+ rtnBool = false;
221
+ }
222
+ }
223
+ });
224
+ return rtnBool;
225
+ },
226
+ validExcute() {
227
+ var self = this;
228
+ var rtnBool = true;
229
+ for (let i of self.model.tableData) {
230
+ if (i.isSet) {
231
+ self.$message.warning("请先保存表格编辑项");
232
+ rtnBool = false;
233
+ }
234
+ };
235
+
236
+ if (rtnBool && self.model.required && this.model.tableData.length === 0) {
237
+ self.$message.warning(this.model.label + " 表格不能为空");
238
+ rtnBool = false;
239
+ }
240
+ self.foucus = true;
241
+
242
+ return rtnBool;
243
+ },
244
+ changeHandler(field, index) {
245
+ var self = this;
246
+ this.model.change = field.change;
247
+ this.model.currentRowIndex = index;
248
+ this.model.currentEventField = field;
249
+ self.$emit('change');
250
+
251
+ //如果有汇总列,触发重新计算汇总
252
+ this.recalculationSummary();
253
+ },
254
+ inputHandler(field, index) {
255
+ var self = this;
256
+ this.model.input = field.input;//当前小组件事件作为大组件事件
257
+ this.model.currentRowIndex = index;
258
+ this.model.currentEventField = field;
259
+
260
+ self.$emit('input');
261
+
262
+ //如果有汇总列,触发重新计算汇总
263
+ this.recalculationSummary();
264
+ },
265
+ //如果有汇总列,触发重新计算汇总
266
+ recalculationSummary() {
267
+ if (this.model.showSummary) {
268
+ this.model.tableData.push({});
269
+ this.model.tableData.pop();
270
+ }
271
+ },
272
+ buttonClick(row, button) {
273
+ var submitData = {};
274
+ button.submitFormField.forEach((v) => {
275
+ submitData[v] = row[v].value;
276
+ });
277
+ this.model.currentRowIndex = row.$sourceIndex;
278
+
279
+ this.$emit('tableButtonClick', button, submitData);
280
+ },
281
+ //汇总行 计算
282
+ getSummaries(param) {
283
+ const self = this;
284
+ const { columns, data } = param;
285
+ const sums = [];
286
+ columns.forEach((column, index) => {
287
+ if (index === 0) {
288
+ sums[index] = this.model.totalColTitle;
289
+ return;
290
+ }
291
+
292
+ if (self.model.totalCols.indexOf(column.property) > -1) {
293
+ const values = data.map(item => {
294
+ let value = 0;
295
+ if (item.isSet) {
296
+ value = self.model.currentRow.data[column.property].value;
297
+ }
298
+ else {
299
+ value = item[column.property].value;
300
+ }
301
+ return Number(value);
302
+ });
303
+
304
+ if (!values.every(value => isNaN(value))) {
305
+ sums[index] = values.reduce((prev, curr) => {
306
+ const value = Number(curr);
307
+ if (!isNaN(value)) {
308
+ return Number(prev + curr);
309
+ } else {
310
+ return Number(prev);
311
+ }
312
+ }, 0);
313
+ //sums[index] += ' 元';
314
+ if (data[0][column.property].decimals && data[0][column.property].decimals > 0) {
315
+ sums[index] = sums[index].toFixed(data[0][column.property].decimals);
316
+ }
317
+ } else {
318
+ sums[index] = 'N/A';
319
+ }
320
+ }
321
+ });
322
+
323
+ return sums;
324
+ }
325
+ }
326
+ }
327
+ </script>
328
+
329
+ <style>
330
+ .el-table-add-row {
331
+ margin-top: 10px;
332
+ width: 100%;
333
+ height: 34px;
334
+ border: 1px dashed #c1c1cd;
335
+ border-radius: 3px;
336
+ cursor: pointer;
337
+ justify-content: center;
338
+ display: flex;
339
+ line-height: 34px;
340
+ }
341
+
342
+ .ct-form-list .list-title {
343
+ padding-bottom: 5px;
344
+ text-align: left;
345
+ display: inline-table;
346
+ width: 45%;
347
+ }
348
+
349
+ .ct-form-list .list-button {
350
+ padding-bottom: 5px;
351
+ text-align: right;
352
+ width: 45%;
353
+ display: inline-table;
354
+ float: right;
355
+ }
356
+
357
+ .ct-table-inputnumber {
358
+ text-align: right;
359
+ }
360
+
361
+ .ct-form-list .el-table__footer-wrapper .el-table__footer .has-gutter div {
362
+ text-align: right;
363
+ }
364
+
365
+ .ct-form-list .el-table__footer-wrapper .el-table__footer .has-gutter tr td:first-child div {
366
+ text-align: left;
367
+ }
368
+
369
+ .ct-table-required {
370
+ color: red;
371
+ }
372
+ .tableDisabled {
373
+ pointer-events: none;
374
+ opacity:0.4;
375
+ }
376
+ </style>