vue2-client 1.8.140 → 1.8.141

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.140",
3
+ "version": "1.8.141",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -17,13 +17,28 @@
17
17
  <!-- 占位 -->
18
18
  </template>
19
19
  <template v-else-if="cell.type === 'value'">
20
- {{ cell.value }}
20
+ <template v-if="cell.customFunction === undefined">
21
+ {{ cell.value }}
22
+ </template>
23
+ <template v-else>
24
+ {{ deserializeFunctionAndRun(cell.customFunction, cell.value) }}
25
+ </template>
21
26
  </template>
22
27
  <template v-else-if="cell.type === 'input'">
23
- {{ configData[cell.dataIndex] }}
28
+ <template v-if="cell.customFunction === undefined">
29
+ {{ configData[cell.dataIndex] }}
30
+ </template>
31
+ <template v-else>
32
+ {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex]) }}
33
+ </template>
24
34
  </template>
25
35
  <template v-else-if="cell.type === 'inputs'">
26
- {{ showSubRowValue(cell) }}
36
+ <template v-if="cell.customFunction === undefined">
37
+ {{ showSubRowValue(cell) }}
38
+ </template>
39
+ <template v-else>
40
+ {{ deserializeFunctionAndRun(cell.customFunction, showSubRowValue(cell)) }}
41
+ </template>
27
42
  </template>
28
43
  <template v-else-if="cell.type === 'images'">
29
44
  <template v-for="(img,imgIndex) in configData.images[cell.dataIndex]">
@@ -44,16 +59,36 @@
44
59
  {{ cell.text }}
45
60
  </template>
46
61
  <template v-else-if="cell.type === 'value'">
47
- {{ cell.value }}
62
+ <template v-if="cell.customFunction === undefined">
63
+ {{ cell.value }}
64
+ </template>
65
+ <template v-else>
66
+ {{ deserializeFunctionAndRun(cell.customFunction, cell.value) }}
67
+ </template>
48
68
  </template>
49
69
  <template v-else-if="cell.type === 'increment'">
50
- {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
70
+ <template v-if="cell.customFunction === undefined">
71
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
72
+ </template>
73
+ <template v-else>
74
+ {{ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]) }}
75
+ </template>
51
76
  </template>
52
77
  <template v-else-if="cell.type === 'input'">
53
- {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
78
+ <template v-if="cell.customFunction === undefined">
79
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
80
+ </template>
81
+ <template v-else>
82
+ {{ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]) }}
83
+ </template>
54
84
  </template>
55
85
  <template v-else-if="cell.type === 'inputs'">
56
- {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
86
+ <template v-if="cell.customFunction === undefined">
87
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
88
+ </template>
89
+ <template v-else>
90
+ {{ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]) }}
91
+ </template>
57
92
  </template>
58
93
  </td>
59
94
  </template>
@@ -193,6 +228,12 @@ export default {
193
228
  }
194
229
  },
195
230
  methods: {
231
+ deserializeFunctionAndRun (functionStr, value) {
232
+ console.warn('执行了!')
233
+ // eslint-disable-next-line no-eval
234
+ const fun = eval('(' + functionStr + ')')
235
+ return fun(value)
236
+ },
196
237
  setImages (imageIds, dataIndex) {
197
238
  console.warn('接收', imageIds)
198
239
  this.configData.images[dataIndex] = imageIds
@@ -334,6 +334,7 @@ export default {
334
334
  rowSpan: 0,
335
335
  colSpan: 10,
336
336
  type: 'value',
337
+ customFunction: 'function (val) {\n return `@${val}@`\n}',
337
338
  value: '立管置换及顶层用户通气点火工艺流程'
338
339
  }
339
340
  ],