{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\flow\\FlowNodeEventSetting.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\flow\\FlowNodeEventSetting.vue","mtime":1675071991803},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"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\r\nimport req from \"@/request.js\";\r\nimport { mapState, mapActions } from \"vuex\";\r\nimport { Message } from 'element-ui';\r\nexport default {\r\n  name:\"FlowNodeEventSetting\",\r\n  components: {},\r\n  props: {\r\n    //某个节点事件的标题\r\n    titleSetting:{\r\n      type: String,\r\n      required: true,\r\n      default:\"节点事件设置\"\r\n    },\r\n    //节点事件配置信息\r\n    passConf:{\r\n      type: Object,\r\n      required: true\r\n    },\r\n  },\r\n  data() {\r\n    return {\r\n      dialogVisibleSetting:false,//是否显示设置节点事件侧边栏\r\n      restfulList:[],//接口配置信息\r\n      restfulCopy:[],//复制的节点事件配置信息\r\n      canSubmit: true\r\n    };\r\n  },\r\n  methods: {\r\n    //全局事件中是否包含节点事件\r\n    isGlobalNode(callTime){\r\n        if(callTime){\r\n            return callTime.indexOf('taskCreate')!=-1||callTime.indexOf('taskComplete')!=-1?true:false;\r\n        }\r\n        return false;\r\n    },\r\n    //显示设置节点事件侧边栏\r\n    showDialog(){\r\n        this.dialogVisibleSetting=true;\r\n        this.restfulList =[];\r\n        this.restfulCopy = JSON.parse(JSON.stringify(this.passConf.restful));//复制的节点事件配置信息 （原生的）\r\n        let restfulJson = this.restfulCopy;\r\n        //判断是否存在接口事件\r\n        if(!restfulJson || restfulJson.length==0){\r\n            restfulJson = '[{\"url\":\"\",\"desc\":\"\",\"invokeMode\":1,\"callTime\":\"\",\"header\":\"\",\"inParam\":\"\",\"outParam\":\"\"}]';\r\n            restfulJson = eval('(' + restfulJson + ')');\r\n        }else{\r\n            let len = restfulJson.length;\r\n            for(let i=0;i<len;i++){\r\n                let headerJson = restfulJson[i]['header'];\r\n                if(headerJson&& typeof(headerJson) == \"object\" ){\r\n                    restfulJson[i]['header'] = headerJson;\r\n                }\r\n            }\r\n        }\r\n        this.restfulList = restfulJson;\r\n    },\r\n    //判断是否JSON类型\r\n    fromJson(json) {\r\n        //传入的参数如果是字符串类型则转JOSN类型\r\n        if(this.isString(json)){\r\n          this.canSubmit = true;\r\n          let formJson = {};\r\n            try {\r\n                formJson = JSON.parse(json);\r\n                this.canSubmit = true;\r\n            } catch (error) {\r\n                this.$message.warning(\"请求头部必须是json格式的字符串\");\r\n                this.canSubmit = false;\r\n            }\r\n            return json;\r\n        }else{\r\n            this.canSubmit = true;\r\n             return JSON.stringify(json);\r\n        }\r\n        \r\n    },\r\n    //判断是否字符串类型\r\n    isString(value) {return typeof value === 'string';},\r\n    //保存节点事件\r\n    saveEvent(){\r\n       const this_ = this;\r\n       this_.$validator.validateAll(\"settingSave\").then(result => {\r\n        if (result) {\r\n            let data = JSON.parse(JSON.stringify(this_.restfulList));//复制接口配置信息\r\n            if(data && data.length>0){\r\n                for(let i=0;i<data.length;i++){\r\n                    let headerJson = data[i]['header'];\r\n                    if(headerJson){\r\n                        data[i]['header'] = this_.fromJson(headerJson);\r\n                    }\r\n                }\r\n            }\r\n            if (!this_.canSubmit) {\r\n                return;\r\n            }\r\n            this.$emit(\"handle-save\",data);//点击保存了获取最新的节点事件配置信息,并发布保存事件\r\n            this_.dialogVisibleSetting=false;//关闭侧边栏\r\n        } else {\r\n            let arr = this_.$validator.errors.items.filter(item=>item.scope==\"settingSave\");\r\n            let errorLength = arr.length;\r\n            this_.$message({\r\n                showClose: true,\r\n                message: `有${errorLength}个字段未通过校验，请正确填写表单内容。`,\r\n                type: \"warning\"\r\n            });\r\n        }\r\n       });\r\n    },\r\n    //新增节点事件\r\n    addEvent(){\r\n        let restful = {\"url\":\"\",\"desc\":\"\",\"invokeMode\":1,\"callTime\":\"\",\"header\":\"\",\"inParam\":\"\",\"outParam\":\"\"};\r\n        this.restfulList.push(restful);\r\n    },\r\n    //关闭设置接口事件侧边栏\r\n    close(){\r\n       this.restfulList = [];\r\n       this.passConf.restful = this.restfulCopy;//没点击保存直接关闭则获取原来复制的节点事件配置信息 （原生的）\r\n       this.dialogVisibleSetting = false;\r\n    },\r\n    //删除事件\r\n    deleteSetting(list,index){\r\n      list.splice(index,1);\r\n    },\r\n  },\r\n  mounted() {\r\n    this.$validator = this.$root.$validator;\r\n  }\r\n};\r\n",null]}