/* * @Descripttion: 主文件 * @version: * @Author: qianlishi * @Date: 2021-08-29 06:43:07 * @LastEditors: qianlishi * @LastEditTime: 2022-03-11 10:35:35 */ import { widgetTool } from "./main"; const screenConfig = { code: "screen", type: "screen", label: "大屏设置", icon: "", options: { setup: [ { type: "el-input-number", label: "大屏宽度", name: "width", required: false, placeholder: "px", value: "1920" }, { type: "el-input-number", label: "大屏高度", name: "height", required: false, placeholder: "px", value: "1080" }, { type: "el-input-text", label: "标题", name: "title", require: false, placeholder: "", value: "大屏" }, { type: "el-input-textarea", label: "大屏简介", name: "description", required: false, placeholder: "" }, { type: "vue-color", label: "背景颜色", name: "backgroundColor", required: false, placeholder: "", value: "#000" }, { type: "custom-upload", label: "图片地址", name: "backgroundImage", required: false, placeholder: "", value: "https://ajreport.beliefteam.cn/file/download/bf566e48-ccad-40e1-8ee9-228427e5466b" } ], data: [], position: [] } }; const widgetTools = [...widgetTool]; const getToolByCode = function(code) { // 获取大屏底层设置属性 if (code == "screen") { return screenConfig; } // 获取组件 let item = widgetTools.find(function(item, index, arrs) { return item.code === code; }); return item; }; console.log(widgetTools); const getWidgetToolsGroup = () => { let [ chartGroup, decorateGroup, textGroup, gridGroup, mediaGroup, otherGroup ] = [[], [], [], [], [], []]; for (const item of widgetTools) { switch (item.group || item.type) { case "chart": chartGroup.push(item); break; case "decorate": decorateGroup.push(item); break; case "text": textGroup.push(item); break; case "grid": gridGroup.push(item); break; case "media": mediaGroup.push(item); break; default: otherGroup.push(item); break; } } return [ { groupType: "chart", groupName: "图表", data: chartGroup }, { groupType: "decorate", groupName: "装饰", data: decorateGroup }, { groupType: "text", groupName: "文字", data: textGroup }, { groupType: "grid", groupName: "表格", data: gridGroup }, { groupType: "media", groupName: "媒体", data: mediaGroup }, { groupType: "other", groupName: "其他", data: otherGroup } ]; }; export { widgetTools, getToolByCode, getWidgetToolsGroup };