screen.js 951 B

12345678910111213141516171819202122232425262728293031323334
  1. import { eventBus } from "@/utils/eventBus";
  2. export function setAssChartData(widgets, options) {
  3. const selectOptions = options.filter(item => item.uuid).map(item => {
  4. return {
  5. code: item.uuid,
  6. name: item.label
  7. }
  8. })
  9. widgets.forEach(item => {
  10. const setup = item['options']['setup']
  11. console.log(setup)
  12. setup.forEach(sItem => {
  13. if (sItem.name == 'assChart') {
  14. sItem['selectOptions'] = selectOptions
  15. }
  16. })
  17. })
  18. }
  19. export function eventBusParams(optionsSetup, optionsData, callback) {
  20. eventBus.$on("eventParams", (formParams) => {
  21. const uuid = optionsSetup.uuid;
  22. if (formParams.assChart.includes(uuid)) {
  23. const contextData = optionsData.dynamicData.contextData;
  24. for (const key in contextData) {
  25. if (formParams.hasOwnProperty(key)) {
  26. contextData[key] = formParams[key];
  27. }
  28. }
  29. callback(optionsData.dynamicData, optionsSetup)
  30. }
  31. });
  32. }