vue2-client 1.8.141 → 1.8.143

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.141",
3
+ "version": "1.8.143",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -76,6 +76,10 @@ export default {
76
76
  dontFormat: {
77
77
  type: Boolean,
78
78
  default: false
79
+ },
80
+ configData: {
81
+ type: Object,
82
+ default: undefined
79
83
  }
80
84
  },
81
85
  components: {
@@ -524,6 +528,9 @@ export default {
524
528
  beforeMount () {
525
529
  if (this.localConfig) {
526
530
  this.config = this.localConfig
531
+ if (this.configData !== undefined) {
532
+ this.config.data = this.configData
533
+ }
527
534
  if (this.config.data.images === undefined) {
528
535
  this.config.data.images = {}
529
536
  }
@@ -531,6 +538,9 @@ export default {
531
538
  } else {
532
539
  getConfigByName(this.configName, 'af-system', res => {
533
540
  this.config = res
541
+ if (this.configData !== undefined) {
542
+ this.config.data = this.configData
543
+ }
534
544
  if (this.config.data.images === undefined) {
535
545
  this.config.data.images = {}
536
546
  }
@@ -42,7 +42,7 @@
42
42
  </template>
43
43
  <template v-else-if="cell.type === 'images'">
44
44
  <template v-for="(img,imgIndex) in configData.images[cell.dataIndex]">
45
- <span :key="imgIndex" style="margin-right: 5%">{{img.name}}</span>
45
+ <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
46
46
  </template>
47
47
  </template>
48
48
  </td>
@@ -71,7 +71,9 @@
71
71
  {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
72
72
  </template>
73
73
  <template v-else>
74
- {{ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]) }}
74
+ {{
75
+ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])
76
+ }}
75
77
  </template>
76
78
  </template>
77
79
  <template v-else-if="cell.type === 'input'">
@@ -79,7 +81,9 @@
79
81
  {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
80
82
  </template>
81
83
  <template v-else>
82
- {{ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]) }}
84
+ {{
85
+ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])
86
+ }}
83
87
  </template>
84
88
  </template>
85
89
  <template v-else-if="cell.type === 'inputs'">
@@ -87,7 +91,9 @@
87
91
  {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
88
92
  </template>
89
93
  <template v-else>
90
- {{ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]) }}
94
+ {{
95
+ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])
96
+ }}
91
97
  </template>
92
98
  </template>
93
99
  </td>
@@ -111,17 +117,54 @@
111
117
  <template v-else-if="cell.type === 'value'">
112
118
  {{ cell.value }}
113
119
  </template>
120
+ <template v-else-if="cell.type === 'curDateInput'">
121
+ <a-button type="dashed" v-if="configData[cell.dataIndex]">
122
+ {{ configData[cell.dataIndex] }}
123
+ </a-button>
124
+ <a-button
125
+ v-if="!configData[cell.dataIndex]"
126
+ type="primary"
127
+ @click="getNowDate(cell.dataIndex)"
128
+ >{{ cell.text || '确认' }}
129
+ </a-button>
130
+ </template>
114
131
  <template v-else-if="cell.type === 'input'">
115
- <a-input v-model="configData[cell.dataIndex]" :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
132
+ <template v-if="cell.inputReadOnly === true">
133
+ <a-input
134
+ v-model="configData[cell.dataIndex]"
135
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
136
+ :disabled="true"/>
137
+ </template>
138
+ <template v-else>
139
+ <a-input
140
+ v-model="configData[cell.dataIndex]"
141
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
142
+ </template>
116
143
  </template>
117
144
  <template v-else-if="cell.type === 'inputs'">
118
- <div class="inputsDiv">
119
- <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
120
- <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
121
- <a-input v-model="configData[cell.dataIndex][index]" :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
122
- <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
145
+ <template v-if="cell.inputReadOnly === true">
146
+ <div class="inputsDiv">
147
+ <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
148
+ <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
149
+ <a-input
150
+ v-model="configData[cell.dataIndex][index]"
151
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
152
+ :disabled="true"/>
153
+ <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
154
+ </div>
123
155
  </div>
124
- </div>
156
+ </template>
157
+ <template v-else>
158
+ <div class="inputsDiv">
159
+ <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
160
+ <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
161
+ <a-input
162
+ v-model="configData[cell.dataIndex][index]"
163
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
164
+ <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
165
+ </div>
166
+ </div>
167
+ </template>
125
168
  </template>
126
169
  <template v-else-if="cell.type === 'images'">
127
170
  <div>
@@ -141,11 +184,15 @@
141
184
  <template v-else-if="inputColumnsButton">
142
185
  <td :colspan="maxColSpan" class="tdWithBorder">
143
186
  <a-button-group>
144
- <a-button @click="addData(configData[columns[0].dataIndex], columns)"><a-icon type="plus"/></a-button>
145
- <a-button @click="removeData(configData[columns[0].dataIndex])"><a-icon type="minus"/></a-button>
187
+ <a-button @click="addData(columns[0].dataIndex, columns)">
188
+ <a-icon type="plus"/>
189
+ </a-button>
190
+ <a-button @click="removeData(columns[0].dataIndex)">
191
+ <a-icon type="minus"/>
192
+ </a-button>
146
193
  </a-button-group>
147
194
  </td>
148
- </template >
195
+ </template>
149
196
  <!-- 其他行 -->
150
197
  <template v-else>
151
198
  <td
@@ -161,14 +208,45 @@
161
208
  <template v-else-if="cell.type === 'value'">
162
209
  {{ cell.value }}
163
210
  </template>
211
+ <template v-else-if="cell.type === 'curDateInput'">
212
+ <a-button type="dashed" v-if="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]">
213
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
214
+ </a-button>
215
+ <a-button
216
+ v-if="!configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
217
+ type="primary"
218
+ @click="getNowDate(inputColumnsDefinitionIndex,cell.dataIndex)"
219
+ >{{ cell.text || '确认' }}
220
+ </a-button>
221
+ </template>
164
222
  <template v-else-if="cell.type === 'increment'">
165
223
  {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
166
224
  </template>
167
225
  <template v-else-if="cell.type === 'input'">
168
- <a-input v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]" :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
226
+ <template v-if="cell.inputReadOnly === true">
227
+ <a-input
228
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
229
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
230
+ :disabled="true"/>
231
+ </template>
232
+ <template v-else>
233
+ <a-input
234
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
235
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
236
+ </template>
169
237
  </template>
170
238
  <template v-else-if="cell.type === 'inputs'">
171
- <a-input v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]" :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
239
+ <template v-if="cell.inputReadOnly === true">
240
+ <a-input
241
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
242
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
243
+ :disabled="true"/>
244
+ </template>
245
+ <template v-else>
246
+ <a-input
247
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
248
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
249
+ </template>
172
250
  </template>
173
251
  </td>
174
252
  </template>
@@ -177,6 +255,7 @@
177
255
 
178
256
  <script>
179
257
  import Upload from '@vue2-client/base-client/components/common/Upload'
258
+ import { formatDate } from '@vue2-client/utils/util'
180
259
 
181
260
  export default {
182
261
  name: 'XReportTrGroup',
@@ -228,6 +307,15 @@ export default {
228
307
  }
229
308
  },
230
309
  methods: {
310
+ getNowDate (index1, index2) {
311
+ if (index2) {
312
+ // @click="getNowDate(configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])"
313
+ this.configData.arr[index1][index2] = formatDate('now')
314
+ } else {
315
+ this.configData[index1] = formatDate('now')
316
+ }
317
+ this.configData = Object.assign({}, this.configData)
318
+ },
231
319
  deserializeFunctionAndRun (functionStr, value) {
232
320
  console.warn('执行了!')
233
321
  // eslint-disable-next-line no-eval
@@ -238,15 +326,15 @@ export default {
238
326
  console.warn('接收', imageIds)
239
327
  this.configData.images[dataIndex] = imageIds
240
328
  },
241
- removeData (dataItem) {
242
- if (dataItem.length === 0) {
329
+ removeData (index) {
330
+ if (this.configData[index].length === 0) {
243
331
  this.$message.warn('已经没有更多了')
244
332
  return
245
333
  }
246
- dataItem.pop()
334
+ this.configData[index].pop()
247
335
  },
248
336
  // 添加一行
249
- addData (dataItem, row) {
337
+ addData (index, row) {
250
338
  // 获取定义
251
339
  const defs = row[0].definition
252
340
 
@@ -277,7 +365,7 @@ export default {
277
365
  temp[def.dataIndex] = lastDataNo + step
278
366
  }
279
367
  })
280
- dataItem.push(temp)
368
+ this.configData[index].push(temp)
281
369
  },
282
370
  // 根据format计算需要多少个输入框
283
371
  calcFormatInputNum (formatStr) {
@@ -374,11 +462,13 @@ export default {
374
462
  .inputsDiv {
375
463
  display: flex;
376
464
  justify-content: space-between;
465
+
377
466
  .inputsDivItem {
378
467
  display: flex;
379
468
  align-items: center;
380
469
  padding: 0 4px;
381
470
  white-space: nowrap;
471
+
382
472
  .inputsDivItemLabel {
383
473
  padding: 0 4px;
384
474
  }
@@ -22,10 +22,15 @@ export default {
22
22
 
23
23
  ## API
24
24
 
25
- | 参数 | 说明 | 类型 | 默认值 |
26
- |-----------------|--------------------------|--------|-------|
27
- | configName | 配置文件名| String | 无(必填) |
28
- | activatedSlotName| 激活插槽名| String | undefined |
25
+ | 参数 | 说明 | 类型 | 默认值 |
26
+ |-----------------|------|-------|-----------|
27
+ | configName | 配置文件名 | String | 无(必填) |
28
+ | activatedSlotName| 激活插槽名 | String | undefined |
29
+ | files | 文件列表 | Array | [] |
30
+ | authority | 权限控制 | String | user |
31
+ | localConfig | 本地配置 | Object | undefined |
32
+ | dontFormat | 禁止已经格式化后的配置格式化| Boolean | false|
33
+ | configData | 配置中的Data | Object | undefined |
29
34
  ## 例子1
30
35
  ----
31
36
  ```vue
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <div>
3
3
  <!-- <XReport :config-name="'test_tableConfig'" :activated-slot-name="'test_tableConfig_slot'"/>-->
4
- <XReport :config-name="'test_tableConfig'" :local-config="test_config_withoutSlot"/>
4
+ <XReport :config-name="'test_tableConfig'" :local-config="test_config_withoutSlot" :config-data="test_config_data"/>
5
+ <!-- <XReport :config-name="'test_tableConfig'" :local-config="test_config_withoutSlot"/>-->
5
6
  <!-- <XReport :config-name="'test_tableConfig'" />-->
6
7
  </div>
7
8
  </template>
@@ -259,67 +260,7 @@ export default {
259
260
  }
260
261
  ],
261
262
  slotsDeclare: [],
262
- data: {
263
- subTitleNumber: [
264
- '12580'
265
- ],
266
- unitName: 'xxx单位',
267
- startDateArr3: [],
268
- startDateArr2: [
269
- '14',
270
- '06'
271
- ],
272
- subTitleDate: [
273
- '2024',
274
- '2',
275
- '28'
276
- ],
277
- remark: '',
278
- endDateArr2: [
279
- '15',
280
- '38'
281
- ],
282
- endDateArr: [
283
- '2',
284
- '28'
285
- ],
286
- subTitleCompany: [
287
- 'xxx分公司'
288
- ],
289
- startDateArr: [
290
- '2',
291
- '28'
292
- ],
293
- actionPerson: '张三',
294
- taskName: '',
295
- addressName: 'xxxx地点',
296
- guardian: '',
297
- images: {
298
- locationImage: [
299
- {
300
- id: 61500,
301
- name: '2345.png',
302
- url: '/resource/webmeter/cs/20240418/f80b97a48f2a454e82630db182e193c4.png',
303
- uid: 61500,
304
- status: 'done'
305
- },
306
- {
307
- id: 61539,
308
- name: '1111.png',
309
- url: '/resource/webmeter/cs/20240418/b30f8ec6ebfb4a32a261e8b63dc4abc3.png',
310
- uid: 61539,
311
- status: 'done'
312
- },
313
- {
314
- id: 61543,
315
- name: '98be5b14896860cb2b3caa448715b68.jpg',
316
- url: '/resource/webmeter/cs/20240418/58ace4d1482b4b9585c47737afc970c7.jpg',
317
- uid: 61543,
318
- status: 'done'
319
- }
320
- ]
321
- }
322
- },
263
+ data: {},
323
264
  columns: [
324
265
  [
325
266
  {
@@ -352,7 +293,8 @@ export default {
352
293
  colSpan: 4,
353
294
  dataIndex: 'unitName',
354
295
  noBoarder: false,
355
- type: 'input'
296
+ type: 'input',
297
+ inputReadOnly: true
356
298
  },
357
299
  {
358
300
  rowSpan: 0,
@@ -382,7 +324,8 @@ export default {
382
324
  colSpan: 4,
383
325
  dataIndex: 'startDateArr',
384
326
  format: '{}月{}日',
385
- type: 'inputs'
327
+ type: 'inputs',
328
+ inputReadOnly: true
386
329
  },
387
330
  {
388
331
  rowSpan: 1,
@@ -488,7 +431,68 @@ export default {
488
431
  fontWeight: 'bolder'
489
432
  },
490
433
  title: '陕西城市燃气产业发展有限公司<br/>操作卡'
491
- }
434
+ },
435
+ test_config_data: {
436
+ subTitleNumber: [
437
+ '12580'
438
+ ],
439
+ unitName: 'xxx单位',
440
+ startDateArr3: [],
441
+ startDateArr2: [
442
+ '14',
443
+ '06'
444
+ ],
445
+ subTitleDate: [
446
+ '2024',
447
+ '2',
448
+ '28'
449
+ ],
450
+ remark: '',
451
+ endDateArr2: [
452
+ '15',
453
+ '38'
454
+ ],
455
+ endDateArr: [
456
+ '2',
457
+ '28'
458
+ ],
459
+ subTitleCompany: [
460
+ 'xxx分公司'
461
+ ],
462
+ startDateArr: [
463
+ '2',
464
+ '28'
465
+ ],
466
+ actionPerson: '张三',
467
+ taskName: '',
468
+ addressName: 'xxxx地点',
469
+ guardian: '',
470
+ images: {
471
+ locationImage: [
472
+ {
473
+ id: 61500,
474
+ name: '2345.png',
475
+ url: '/resource/webmeter/cs/20240418/f80b97a48f2a454e82630db182e193c4.png',
476
+ uid: 61500,
477
+ status: 'done'
478
+ },
479
+ {
480
+ id: 61539,
481
+ name: '1111.png',
482
+ url: '/resource/webmeter/cs/20240418/b30f8ec6ebfb4a32a261e8b63dc4abc3.png',
483
+ uid: 61539,
484
+ status: 'done'
485
+ },
486
+ {
487
+ id: 61543,
488
+ name: '98be5b14896860cb2b3caa448715b68.jpg',
489
+ url: '/resource/webmeter/cs/20240418/58ace4d1482b4b9585c47737afc970c7.jpg',
490
+ uid: 61543,
491
+ status: 'done'
492
+ }
493
+ ]
494
+ }
495
+ },
492
496
  }
493
497
  },
494
498
  }