vue2-client 1.8.139 → 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.139",
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
@@ -30,7 +30,7 @@ export default {
30
30
  },
31
31
  mode: {
32
32
  type: String,
33
- default: 'sql' // 目前只有 sql/go 如果需要配置其他语言,需要在 setting.js 中配置 更多看官方文档
33
+ default: 'sql' // 目前只有 sql/go/js 如果需要配置其他语言,需要在 setting.js 中配置 更多看官方文档
34
34
  },
35
35
  styleObj: {
36
36
  type: Object,
@@ -15,6 +15,7 @@ import 'codemirror/addon/search/match-highlighter.js'
15
15
  // keyMap
16
16
  import 'codemirror/mode/go/go.js'
17
17
  import 'codemirror/mode/sql/sql.js'
18
+ import 'codemirror/mode/javascript/javascript.js'
18
19
  import 'codemirror/addon/edit/matchbrackets.js'
19
20
  import 'codemirror/addon/comment/comment.js'
20
21
  import 'codemirror/addon/dialog/dialog.js'
@@ -34,5 +35,6 @@ import 'codemirror/addon/fold/xml-fold.js'
34
35
  // 编辑的主题文件
35
36
  import 'codemirror/theme/dracula.css'
36
37
  import 'codemirror/theme/base16-light.css'
38
+ import 'codemirror/theme/monokai.css'
37
39
  // 括号自动不全
38
40
  import 'codemirror/addon/edit/closebrackets.js'
@@ -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
  ],