{"remainingRequest":"/data/jenkins/workspace/test-v5in-source-front-01/src/badp-bcxin-5.x/obpm-designer-web/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/test-v5in-source-front-01/src/badp-bcxin-5.x/obpm-designer-web/src/components/CommonTool/WidgetList.vue?vue&type=script&lang=js&","dependencies":[{"path":"/data/jenkins/workspace/test-v5in-source-front-01/src/badp-bcxin-5.x/obpm-designer-web/src/components/CommonTool/WidgetList.vue","mtime":1701674859500},{"path":"/data/jenkins/workspace/test-v5in-source-front-01/src/badp-bcxin-5.x/obpm-designer-web/node_modules/babel-loader/lib/index.js","mtime":1701674874357},{"path":"/data/jenkins/workspace/test-v5in-source-front-01/src/badp-bcxin-5.x/obpm-designer-web/node_modules/cache-loader/dist/cjs.js","mtime":1701674874584},{"path":"/data/jenkins/workspace/test-v5in-source-front-01/src/badp-bcxin-5.x/obpm-designer-web/node_modules/vue-loader/lib/index.js","mtime":1701674874903}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport { getWidgets, deleteWidgets,getViewsModuleList,saveWidgets,updateWidgets,getLogoUrl } from \"@/service/CommontoolsAPI.js\";\nimport { getAllmodules } from \"@/service/CommonApi.js\";\nimport { getChartsList }from \"@/service/ModulesApi.js\";\nimport { getSummarysListData }from \"@/service/FormApi.js\";\nimport { getReportsList }from \"@/service/ReportApi.js\";\nimport publicTable from \"@/components/Common/publicTable.vue\";\nimport icon_select from \"@/components/Common/icon_select.vue\";\nimport font_select from \"@/components/Common/font_select.vue\";\nimport ColorPicker from \"@/components/Common/ColorPicker\";\nimport fileUpload from \"@/components/Common/fileUpload\"\nimport { nameCheck } from \"@/utils/utils.js\";\nimport {delMsg} from '@/utils/elementui'\nimport { getRoles } from \"@/service/CommontoolsAPI.js\";\nimport ScriptEditorSelect from \"@/components/Common/scriptEditor\";\nimport config from '@/assets/json/config'\nexport default {\n name: 'widgetlist',\n data(){\n return{\n params: {\n appId: \"\",\n id: \"\", //widget id\n name: \"\", //widget 名称\n type: \"\", //类型\n published: \"\", //是否发布\n orderno: \"\", //排序号\n searchword: \"\", //搜索名字\n pageNo: 1,\n linesPerPage: 10\n },\n data: {},\n multipleSelectionId: [],\n multipleSelectionArray: [],\n tableHeight: 100,\n dialogFormVisible: false, //对话框\n widgetForm: {\n name: \"\", //名称\n type: \"\", //类型\n authMode: \"0\", //授权方式\n widgetType: \"0\", //支持类型\n countType: 'none', // 统计类型\n published: \"true\", //是否发布\n moduleid: \"\", //模块\n actionView: \"\", //作用视图\n chart: \"\", //图表\n actionContent: \"\", //\n actionSummary: \"\", //摘要\n actionUrl: \"\", //链接地址URL\n iconShow: false, //是否常用\n iscript: \"\", //Iscript脚本内容\n userScript: \"\", // 脚本返回用户对象集合\n width: \"\", //宽度\n height: \"\", //高度\n authRolesId: \"\", //\n authRolesName: \"\", //\n icon: \"\", //\n titleColor: \"#000\", //标题颜色\n titleBColor: null, //标题背景颜色\n titleBarColor: null,//标题栏颜色\n orderno: \"\", //排序号\n frequency: 0, //频率\n carouselImg: \"\", //轮播图图片\n },\n icon: { \n icontype: \"img\",\n imgUrl: \"/uploads/lib/icon_menu_default.png\",\n fontUrl: \"\",\n iconFontColor: \"rgba(0, 0, 0, 1)\"\n },\n iconSelectCheck: false, // 图片\n fontSelectCheck: false, // 字体图标\n fontStyle: \"\", // 字体图标的样式\n rules: {\n name: [\n { required: true, message: this.$t('placeholder.name'), trigger: 'blur'},\n { validator: nameCheck, trigger: \"blur\" },\n ],\n type: [\n { required: true, message: this.$t('placeholder.select_type'), trigger: 'blur'}\n ],\n orderno: [\n { required: true, message: this.$t('placeholder.into_order_num'), trigger: 'blur'}\n ],\n actionSummary:[\n { required: true, message: this.$t('placeholder.choose_summary'), trigger: 'blur'}\n ],\n customizeReport:[\n { required: true, message: this.$t('msg.select_report'), trigger: 'blur'}\n ],\n actionUrl:[\n { required: true, message: this.$t('placeholder.enter_url'), trigger: 'blur'}\n ],\n iscript:[\n { required: true, message: this.$t('placeholder.enter_script'), trigger: 'blur'}\n ],\n },\n predefineColors:[\n '#000',\n '#ff4500',\n '#ff8c00',\n '#ffd700',\n '#90ee90',\n '#00ced1',\n '#1e90ff',\n '#c71585',\n 'rgba(255, 69, 0, 0.68)',\n 'rgb(255, 120, 0)',\n 'hsv(51, 100, 98)',\n 'hsva(120, 40, 94, 0.5)',\n 'hsl(181, 100%, 37%)',\n 'hsla(209, 100%, 56%, 0.73)',\n '#c7158577'\n ],\n typeOptions: config.widgetOptions,\n isTypeOptions: {\n isActionSummary: false, //摘要\n isModule: false, //模块\n isActionView: false, //作用视图\n isCustomizeReport: false, //作用报表\n isChart: false, //图表\n isActionUrl: false, //链接地址(URL)\n isIsript: false, //Iscript脚本内容\n },\n moduleOptions : [], //模板数组\n actionViewOptions: [], //作用视图数组\n reportOptions: [], //报表\n tableData:{params:[{name:'name',label:this.$t('stateLabel.name'),value:\"\",}]},\n roleVisible:false,\n roleParams: {\n appId: \"\",\n name: \"\", //角色名称\n pageNo: 1,\n linesPerPage: 10\n },\n tableDataRole:{params:[{name:'name',label:this.$t('stateLabel.name'),value:\"\",}],tableHeight:'350px',},\n checkedRoles:[],\n scriptEditorVisible: false, // 脚本编辑器弹窗\n currentScriptEditor: '', // 当前选中哪一个脚本编辑器\n fileUploadVisible: false, // 图片上传弹窗\n btnLoading: false, // 按钮的加载\n }\n },\n components:{\n publicTable,\n icon_select,\n font_select,\n ColorPicker,\n ScriptEditorSelect,\n fileUpload\n },\n\n mounted(){\n this.getScollerHeight();\n if(this.$route.query.edit){\n let appId = sessionStorage.getItem(\"appId\");\n let params = {\n ...this.params,\n appId: appId,\n }\n this.params = params;\n this.roleParams.appId = appId;\n this.getWidgets();\n }\n },\n methods:{\n /**\n * 显示脚本编辑器弹框\n */\n showScriptEditor (val) {\n this.scriptEditorVisible = true;\n this.currentScriptEditor = val\n },\n /**\n * 将脚本编辑器的值写入到textarea中\n */\n handleScriptEditor (val) {\n switch (this.currentScriptEditor){\n case \"iscript\":\n this.widgetForm.iscript = val\n break;\n case \"userScript\":\n this.widgetForm.userScript = val\n break;\n default:\n break;\n }\n },\n //退出编辑widget\n exitEditDetail(){\n this.dialogFormVisible = false;\n this.checkedRoles=[];\n },\n //退出选择角色弹窗\n onRoleExit(){\n this.roleVisible = false;\n },\n //角色选中确认\n onRoleConfirm(){\n debugger\n let authRolesNames=[];\n let authRolesIds=[];\n this.checkedRoles.map((e) => {\n authRolesNames.push(e.name)\n authRolesIds.push(e.id)\n })\n this.widgetForm.authRolesName = authRolesNames.join(\";\");\n this.widgetForm.authRolesId = authRolesIds.join(\";\");\n this.roleVisible = false;\n },\n //清除所选角色\n onRoleClean(){\n this.$refs.publictable_role.clearSelection();\n this.checkedRoles =[];\n this.tableDataRole.checkedRows = this.checkedRoles;\n this.widgetForm.authRolesName = '';\n this.widgetForm.authRolesId = '';\n },\n //清除详情中的角色字段\n onRoleClean_detail(){\n this.checkedRoles =[];\n this.tableDataRole.checkedRows = this.checkedRoles;\n this.widgetForm.authRolesName = '';\n this.widgetForm.authRolesId = '';\n },\n //角色列表页码变化\n roleCurrPageChange(val){\n let roleParams = {\n ...this.roleParams,\n pageNo: val\n }\n this.roleParams = roleParams;\n this.getRoles()\n },\n //角色列表页大小变化\n rolePageSizeChange(val){\n let roleParams = {\n ...this.roleParams,\n linesPerPage: val\n }\n this.roleParams = roleParams;\n this.getRoles()\n },\n /**\n * 勾选行时响应\n */\n handleRoleSelectionChange(val) {\n this.checkedRoles=[]\n if(val.length){\n val.map((e) => {\n this.checkedRoles.push(e)\n })\n }\n this.tableDataRole.checkedRows = this.checkedRoles;\n },\n //更新参数\n updataRoleParams(obj){\n Object.assign(this.roleParams,obj)\n },\n //获取角色列表\n async getRoles(){\n const response = await getRoles(this.roleParams)\n if (response.data.errcode == 0) {\n let data = response.data.data;\n\n // 进行数据回选\n if(this.widgetForm.authRolesId != \"\"){\n let tempArr = this.widgetForm.authRolesId.split(';').filter(item => item != \"\")\n for(let i = 0; i < tempArr.length; i++){\n for(let j = 0; j < data.datas.length; j++){\n if(data.datas[j].id == tempArr[i]){\n this.checkedRoles.push(data.datas[j])\n break;\n }\n }\n }\n }\n this.tableDataRole.columns=[{prop:'name',label: this.$t('roles.name')}];\n this.tableDataRole.data = data;\n this.tableDataRole.checkedRows =this.checkedRoles\n\n this.$nextTick(() => {\n this.$refs.publictable_role.init(this.tableDataRole);\n })\n }\n },\n //选择角色\n chooseRole(){\n this.roleVisible = true;\n this.getRoles();\n },\n //更新参数\n updataParams(obj){\n Object.assign(this.params,obj)\n },\n /**\n * 动态计算页面table高度\n */\n getScollerHeight() {\n setTimeout(() => {\n let clientHeight = document.documentElement.clientHeight || document.body.clientHeight;\n //60 头部, 32 面包屑, 41 第一层页签, 40 第二层页签, 50 列表标题, 71 查询, 20 父组件外边距, 40分页\n this.tableData.tableHeight = (clientHeight - 60 - 32 - 41 - 40 - 50 - 71 - 20 - 40) + 'px';\n this.$nextTick(() => {\n this.$refs.publictable.init(this.tableData);\n })\n }, 100)\n },\n \n /**\n * 获取widget列表\n */\n async getWidgets(){\n let response = await getWidgets(this.params);\n if (response.data.errcode == 0) {\n let data = response.data.data;\n for(let i=0;i {\n this.$refs.publictable.init(this.tableData);\n })\n }\n },\n\n /**\n * 重置查询名称值\n */\n resetName(){\n let params = {\n ...this.params,\n name: \"\",\n }\n this.params = params;\n this.getWidgets();\n },\n\n /**\n * 勾选行时响应\n */\n handleSelectionChange(val) {\n let multipleSelectionId = [];\n if(val.length){\n val.map((e) => {\n multipleSelectionId.push(e.id)\n })\n }\n this.multipleSelectionArray = val;\n this.multipleSelectionId = multipleSelectionId;\n },\n\n /**\n * 新建widget\n */\n createRoles(){\n this.dialogFormVisible = true;\n let widgetForm = {\n id: \"\", //id\n name: \"\", //名称\n type: \"\", //类型\n authMode: \"0\", //授权方式\n widgetType: \"0\", //支持类型\n countType: 'none', // 统计类型\n published: \"true\", //是否发布\n moduleid: \"\", //模块\n actionView: \"\", //作用视图\n chart: \"\", //图表\n icontype: \"font\", //图标类型\n actionContent: \"\", //\n actionSummary: \"\", //摘要\n actionUrl: \"\", //链接地址URL\n iconShow: false, //是否常用\n iscript: \"\", //Iscript脚本内容\n width: \"\", //宽度\n height: \"\", //高度\n authRolesId: \"\", //\n authRolesName: \"\", //\n icon: \"\", //\n titleColor: \"#000\", //标题颜色\n titleBColor: null, //标题背景颜色\n titleBarColor: null,//标题栏颜色\n orderno: \"\", //排序号\n frequency: 0, //频率\n carouselImg: \"\", //轮播图图片\n imgUrl: \"/uploads/lib/icon_menu_default.png\",\n fontUrl: \"\",\n iconFontColor: \"rgba(0, 0, 0, 1)\"\n }\n // 重置显示的属性\n let isTypeOptions = {\n isActionSummary: false, //摘要\n isModule: false, //模块\n isActionView: false, //作用视图\n isCustomizeReport: false, //作用报表\n isChart: false, //图表\n isActionUrl: false, //链接地址(URL)\n isIsript: false, //Iscript脚本内容\n }\n this.widgetForm = widgetForm;\n this.isTypeOptions = isTypeOptions;\n // 重置所有的错误消息\n // let params = {\n // appId: sessionStorage.getItem(\"appId\"),\n // }\n // this.$router.push({path: '/home/softwaresdetails/commontool/roles', query:{edit: false, params: params}});\n },\n\n /**\n * 删除widget\n */\n async showDeleteConfirm(){\n let params = this.params;\n let multipleSelectionId = this.multipleSelectionId;\n if(multipleSelectionId.length > 0){\n try{\n await delMsg(this.$t('msg.delConfirm'), this.$t('msg.tip'))\n let response = await deleteWidgets(multipleSelectionId, params.appId);\n if (response.data.errcode == 0) {\n this.getWidgets();\n this.$message.success(this.$t('msg.del_ss'));\n }\n }catch(e){\n console.log(e)\n }\n }else{\n this.$message.error(this.$t('msg.check_data'))\n }\n },\n\n /**\n * 选中数据源回显\n */\n onRowClick(row){\n this.icon = JSON.parse(row.icon)\n // 设置字体图标颜色\n if(this.icon.iconFontColor && this.icon.icontype == 'font'){\n this.$nextTick(() => {\n this.fontStyle = 'color:' + this.icon.iconFontColor\n this.$refs.fontcolor.color = this.icon.iconFontColor\n })\n }\n // 同步数据\n this.widgetForm = {\n ...row,\n authMode: row.authMode + \"\", //授权方式\n widgetType:row.widgetType + \"\", //支持方式\n published:row.published == true ? \"true\" : \"false\", //是否发布\n icontype:JSON.parse(row.icon).icontype\n }\n this.typeChange(row.type,row);\n this.dialogFormVisible = true;\n // this.$router.push({path: '/home/softwaresdetails/commontool/roles', query:{edit: true, params: params}});\n },\n /**\n * 当前页\n */\n handleCurrentChange(val) {\n let params = {\n ...this.params,\n pageNo: val\n }\n this.params = params;\n this.getWidgets()\n },\n\n /**\n * 切换分页,每页显示多少条\n */\n handleSizeChange(val){\n let params = {\n ...this.params,\n linesPerPage: val\n }\n this.params = params;\n this.getWidgets()\n },\n /**\n * 选择类型\n */\n async typeChange(val,row){\n let isActionSummary = false; //摘要\n let isModule = false; //模块\n let isActionView = false; //作用视图\n let isCustomizeReport = false; //作用报表\n let isChart = false; //图表\n let isActionUrl = false; //链接地址(URL)\n let isIsript = false; //Iscript脚本内容\n let appId = sessionStorage.getItem(\"appId\");\n let currentModuleId = \"\";\n this.widgetForm.moduleid='';\n this.actionViewOptions=[];\n let response, resp;\n\n switch(val){\n case \"summary\": //摘要\n isActionSummary = true;\n getSummarysListData({appId:appId,id:''},{\n onSucess: async response => {\n if (response.data.errcode == 0) {\n let summaryArr = response.data.data.data\n summaryArr.map(item => {\n if(item.scope == 0){\n item.showName = item.name + this.$t('widget.todo_summary')\n }else if(item.scope == 1){\n item.showName = item.name + this.$t('widget.flow_share')\n }else if(item.scope == 6){\n item.showName = item.name + this.$t('widget.flow_carboncopy')\n }\n })\n this.actionViewOptions = summaryArr;\n // 需要拼接数据才可以\n this.$set(this.widgetForm, 'actionSummary', row.actionContent)\n }\n }\n });\n break;\n case \"view\": //视图\n isModule = true;\n isActionView = true;\n response = await getAllmodules(appId, currentModuleId);\n if (response.data.errcode == 0) {\n this.moduleOptions = response.data.data;\n if(row){\n this.widgetForm.moduleid = row.moduleid;\n // this.params.linesPerPage = 100;\n getViewsModuleList(row.moduleid,this.params, {\n onSucess: response => {\n if (response.data.errcode == 0) {\n this.actionViewOptions = response.data.data.datas.filter(item => item.type == 1 || item.type == 16)\n // 判断有当前id就选中,没有就清空数组\n let flag = false\n for (let i = 0; i < this.actionViewOptions.length; i++) {\n if (this.actionViewOptions[i].id == row.actionContent) {\n flag = true;\n this.$set(this.widgetForm, 'actionView', row.actionContent)\n break;\n }\n }\n if (!flag) {\n this.$set(this.widgetForm, 'actionView', \"\")\n }\n }\n }\n });\n }\n }\n break;\n case \"page\": //链接内容\n isActionUrl = true;\n if(row){\n // this.widgetForm.actionUrl = row.actionContent\n this.$set(this.widgetForm, 'actionUrl', row.actionContent)\n }\n break;\n case \"customizeReport\": //自定义报表\n isModule = true;\n isCustomizeReport = true;\n resp = await getAllmodules(appId, currentModuleId);\n if (resp.data.errcode == 0) {\n this.moduleOptions = resp.data.data;\n if(row){\n this.widgetForm.moduleid = row.moduleid;\n this.params.moduleId = row.moduleid;\n // this.params.linesPerPage = 100;\n let response = await getReportsList(this.params);\n if (response.data.errcode == 0) {\n this.actionViewOptions = response.data.data.datas;\n this.$set(this.widgetForm, 'customizeReport', row.actionContent)\n }\n }\n }\n break;\n case \"chart\": //图表\n isModule = true;\n isChart = true;\n resp = await getAllmodules(appId, currentModuleId);\n if (resp.data.errcode == 0) {\n this.moduleOptions = resp.data.data;\n if(row){\n this.widgetForm.moduleid = row.moduleid;\n this.params.moduleId = row.moduleid;\n // this.params.linesPerPage = 100;\n let response = await getChartsList(this.params);\n if (response.data.errcode == 0) {\n this.actionViewOptions = response.data.data.data;\n // this.widgetForm.chart = row.actionContent\n this.$set(this.widgetForm, 'chart', row.actionContent)\n }\n }\n }\n break;\n case \"iscript\": //计算脚本值\n isIsript = true;\n if(row){\n // this.widgetForm.iscript = row.actionContent\n this.$set(this.widgetForm, 'iscript', row.actionContent)\n }\n break;\n default:\n break;\n }\n let isTypeOptions = {\n ...isTypeOptions,\n isActionSummary: isActionSummary, //摘要\n isModule: isModule, //模块\n isActionView: isActionView, //作用视图\n isCustomizeReport: isCustomizeReport, //作用报表\n isChart: isChart, //图表\n isActionUrl: isActionUrl, //链接地址(URL)\n isIsript: isIsript, //Iscript脚本内容\n }\n this.isTypeOptions = isTypeOptions\n },\n /**\n * 获取模块列表--->根据上一级获取\n */\n async moduleChange(val){\n this.params.moduleId = val;\n this.params.linesPerPage = 100000;\n if(this.widgetForm.type == \"customizeReport\"){\n let response = await getReportsList(this.params);\n if (response.data.errcode == 0) {\n this.actionViewOptions = response.data.data.datas;\n }\n }else if(this.widgetForm.type == \"chart\"){\n let response = await getChartsList(this.params);\n if (response.data.errcode == 0) {\n this.actionViewOptions = response.data.data.data;\n }\n }else{\n getViewsModuleList(val,this.params, {\n onSucess: response => {\n if (response.data.errcode == 0) {\n this.actionViewOptions = response.data.data.datas\n this.$set(this.widgetForm, 'actionView', \"\")\n }\n }\n });\n }\n },\n /**\n * 新建保存widget\n */\n save(widgetForm){\n this.$refs[widgetForm].validate(async (valid) => {\n if(valid){\n let appId = sessionStorage.getItem(\"appId\");\n let data = JSON.parse(JSON.stringify(this.widgetForm));\n data.authMode = parseInt(data.authMode);\n data.widgetType = parseInt(data.widgetType);\n data.orderno = parseInt(data.orderno);\n data.published = data.published == \"true\"? true : false;\n \n // 图片或字体图标\n if(this.icon.icontype == 'img'){\n data.icon = `{\"icon\":\"${this.icon.imgUrl}\",\"icontype\":\"${this.icon.icontype}\", \"imgUrl\": \"${this.icon.imgUrl}\"}`\n }else if(this.icon.icontype == 'font'){\n data.icon = `{\"icon\":\"${this.icon.fontUrl}\",\"icontype\":\"${this.icon.icontype}\", \"fontUrl\":\"${this.icon.fontUrl}\", \"iconFontColor\":\"${this.icon.iconFontColor}\"}`\n }\n\n // 校验授权给特定角色\n if(this.widgetForm.authMode == 1 && this.widgetForm.authRolesId == \"\"){\n this.$message.error(this.$t('widget.select_role'))\n return false\n }\n \n if(this.isTypeOptions.isActionView){\n data.actionContent = data.actionView;\n }else if(this.isTypeOptions.isChart){\n data.actionContent = data.chart;\n }else if(this.isTypeOptions.isIsript){\n data.actionContent = data.iscript\n }else if(this.isTypeOptions.isActionUrl){\n data.actionContent = data.actionUrl\n }else if(this.isTypeOptions.isActionSummary){\n data.actionContent = data.actionSummary\n }else if(this.isTypeOptions.isCustomizeReport){\n data.actionContent = data.customizeReport\n }\n\n // 更新\n if(data.id){\n data.widgetId = data.id\n data.parentId = sessionStorage.getItem(\"appId\")\n this.btnLoading = true\n let response = await updateWidgets(data);\n this.btnLoading = false\n if (response.data.errcode == 0) {\n this.$message.success(this.$t('msg.update_ss'));\n this.dialogFormVisible = false;\n this.getWidgets();\n }\n }else{ // 新建\n this.btnLoading = true\n let response = await saveWidgets(appId,data);\n this.btnLoading = false\n if (response.data.errcode == 0) {\n this.actionViewOptions = response.data.data.datas;\n this.$message.success(this.$t('msg.created_ss'));\n this.dialogFormVisible = false;\n this.getWidgets();\n }\n }\n }else {\n return false;\n }\n });\n },\n\n /**\n * 重置弹窗信息\n */\n resetWidgetForm(formName) {\n this.icon = {\n imgUrl: \"/uploads/lib/icon_menu_default.png\",\n fontUrl: \"\",\n icontype: \"img\",\n iconFontColor: \"rgba(0, 0, 0, 1)\"\n };\n this.$nextTick(() => this.$refs[formName].resetFields())\n },\n\n getLogoUrl (url) {\n return getLogoUrl(url);\n },\n onSelectIconOk (item) {\n if (item) {\n if (item.path) {\n this.widgetForm.icontype = \"img\";\n this.icon.imgUrl = item.path;\n } else {\n this.$message({\n showClose: true,\n type: \"error\",\n message: this.$t('msg.select_fail'),\n });\n }\n }\n },\n selectImg () {\n this.iconSelectCheck = true;\n },\n\n onSelectFontOk (font) {\n this.icon.fontUrl = font\n this.icon.icontype = 'font'\n this.fontSelectCheck = false; \n },\n selectFont () {\n this.fontSelectCheck = true;\n },\n\n /**\n * 读取和设置颜色\n */\n setColor(val, name) {\n if(name == 'iconFontColor'){\n this.icon.iconFontColor = val\n // 设置颜色\n this.fontStyle = 'color:' + val\n }else if(name == 'titleColor'){\n this.widgetForm.titleColor = val\n }else if(name == 'titleBColor'){\n this.widgetForm.titleBColor = val\n }else if(name == 'titleBarColor'){\n this.widgetForm.titleBarColor = val\n }\n },\n\n onCheckUpload(file) {\n if(file){\n this.widgetForm.carouselImg = file[0].filePath\n }\n },\n },\n computed:{\n /**\n * textarea 传给 脚本编辑器的值\n */\n showScritptEditorCode () {\n let code\n if (this.currentScriptEditor === 'iscript') {\n // 表单基本是否可编辑脚本\n code = this.widgetForm.iscript\n }else if(this.currentScriptEditor === 'userScript'){\n // 脚本返回用户对象集合\n code = this.widgetForm.userScript\n }\n return code\n },\n /**\n * 显示 高 标签\n */\n showHeightLabel(){\n let flag = false\n if(this.widgetForm.type == 'chart' || this.widgetForm.type == 'page' || this.widgetForm.type == 'iscript' || this.widgetForm.type == 'carousel'){\n flag = true\n }\n return flag\n },\n /**\n * 显示 频率 标签\n */\n showCarousel(){\n let flag = false\n if(this.widgetForm.type == 'carousel'){\n flag = true\n }\n return flag\n }\n },\n}\n",null]}