(config, property, sourceData = {})
| 253 | |
| 254 | }, |
| 255 | bluePrintAction(config, property, sourceData = {}) { |
| 256 | /** |
| 257 | * @name: |
| 258 | * @param {config: 蓝图配置参数 property: 组件配置的属性, sourceData: 若连接了数据处理 则操作的sourceData} |
| 259 | * @return {*} |
| 260 | */ |
| 261 | // 蓝图根据name执行对应的方法 |
| 262 | if (!config) return; |
| 263 | config.forEach(async item => { |
| 264 | const { customFunction, moveStep } = item.property |
| 265 | if (item.type === 'dataHandler' || item.type === 'judge') { |
| 266 | // 结尾不是组件 |
| 267 | this.bluePrintAction(item.leave, item.property, sourceData); |
| 268 | return; |
| 269 | } |
| 270 | const { actionName, id } = item |
| 271 | const nowTemplate = this.findTemplateForId(id) |
| 272 | switch (actionName) { |
| 273 | case 'hidden': |
| 274 | { |
| 275 | this.$set(nowTemplate.property, 'isHidden', true) |
| 276 | }; |
| 277 | break; |
| 278 | case 'show': |
| 279 | { |
| 280 | this.$set(nowTemplate.property, 'isHidden', false) |
| 281 | }; |
| 282 | break; |
| 283 | case 'move': |
| 284 | { |
| 285 | const elementRef = document.getElementById(`${nowTemplate.property.elementId}chart-item`) |
| 286 | elementRef.style.transition = '0.5s' |
| 287 | this.setValue(nowTemplate.property, 'left', nowTemplate.property.left + moveStep) |
| 288 | setTimeout(() => { |
| 289 | elementRef.style.transition = 'none' |
| 290 | }, 500); |
| 291 | }; |
| 292 | break; |
| 293 | case 'importData': |
| 294 | { |
| 295 | // 导入数据接口 |
| 296 | const func = new Function(`return ${customFunction}`)() |
| 297 | try { |
| 298 | const result = func(sourceData) |
| 299 | vm.$set(nowTemplate.property.option, 'data', result) |
| 300 | nowTemplate.isLoading = this.guid() |
| 301 | } catch (err) { |
| 302 | console.log(err) |
| 303 | } |
| 304 | |
| 305 | }; |
| 306 | break; |
| 307 | case 'changeVisible': |
| 308 | { |
| 309 | // 切换显隐状态 |
| 310 | this.$set(nowTemplate.property, 'isHidden', !nowTemplate.property.isHidden) |
| 311 | }; |
| 312 | break; |
nothing calls this directly
no test coverage detected