2 lines
34 KiB
JavaScript
2 lines
34 KiB
JavaScript
|
webpackJsonp([3],{AfI0:function(e,t){},BFa7:function(e,t){},HMVn:function(e,t){},"P+qo":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a("mvHQ"),s=a.n(n),i={data:function(){return{loading:!1,basicInfo:{id:"",itemId:"",caseId:"",ipPath:"",port:"",interfacePath:"",interfaceName:"",requestHeader:"",requestParams:"",requestBody:"",relationValues:"",assertField:"",expectResult:"",comments:"",protocolType:"",requestType:""},requestOptions:[],protocolOptions:[],basicInfoRules:{protocolType:[{required:!0,message:"请选择协议类型",trigger:"blur"}],requestType:[{required:!0,message:"请选择请求方式",trigger:"blur"}],ipPath:[{required:!0,message:"请输入IP/域名地址",trigger:"blur"},{min:1,max:100,message:"长度在 1 到 100 个字符",trigger:"blur"}]},requestBodyObj:{requestHeadersList:{items:[{keys:"",value:""}]},requestParamsList:{items:[{keys:"",value:""}]}},assertInfo:{assertField:"",expectResult:""},relationValues:"",scriptInfo:{preScript_textarea:"",posScript_textarea:"",preSql_textarea:"",posSql_textarea:""},activeScriptName:"preScript",activeParamName:"requestHeader",activeOtherName:"comments",activeRequestName:"raw"}},created:function(){this.getRequestTypeAndProtocol()},methods:{getRequestTypeAndProtocol:function(){var e=this;this.$api.dict.queryAllDataDict().then(function(t){e.requestOptions=t.data.data.requestType,e.protocolOptions=t.data.data.protocolType}).catch(function(){})},changeInterfaceDataBasicInfo:function(e){var t=this;if(e){this.basicInfo=e,this.basicInfo.caseId=e.caseId,this.basicInfo.requestBody=e.requestBody;var a=e.requestHeader,n=e.requestParams;if(a)this.requestBodyObj.requestHeadersList.items=[],a.slice(1,a.length-1).replace(/"/g,"").replace(",",",").replace(/,\s*/g,",").split(",").forEach(function(e){var a=e.split(":");t.requestBodyObj.requestHeadersList.items.push({key:Math.random(),keys:a[0],value:a[1]})});else this.requestBodyObj.requestHeadersList.items=[],this.addRequestHeadersList();if(n)this.requestBodyObj.requestParamsList.items=[],"?"==n.slice(0,1)&&(n=n.slice(1)),n.replace(/"/g,"").split("&").forEach(function(e){var a=e.split("=");t.requestBodyObj.requestParamsList.items.push({key:Math.random(),keys:a[0],value:a[1]})});else this.requestBodyObj.requestParamsList.items=[],this.addRequestParamsList()}else this.basicInfo={},this.assertInfo={},this.relationValues="",this.scriptInfo={},this.requestBodyObj.requestHeadersList.items=[],this.requestBodyObj.requestParamsList.items=[],this.addRequestHeadersList(),this.addRequestParamsList();e.interfaceName?this.basicInfo.interfaceName=e.interfaceName:this.basicInfo.interfaceName=this.$common.getSessionStorage("currentInterfaceName")},saveInterfaceData:function(){var e=this;this.$refs.basicInfoRef.validate(function(t){t&&(e.basicInfo.itemId=e.$common.getSessionStorage("currentItemId"),e.basicInfo.envCode=e.$common.getSessionStorage("currentEnvCode"),e.basicInfo.caseId=e.basicInfo.caseId?e.basicInfo.caseId:e.$common.getSessionStorage("currentCaseId"),e.basicInfo.requestHeader=e.getCurrentRequestHeader(),e.basicInfo.requestParams=e.getCurrentRequestParam(),e.loading=!0,e.basicInfo.id?(e.basicInfo.updatePerson=JSON.parse(localStorage.getItem("userInfo")).nick,e.basicInfo.updateTime=Date.now(),e.$api.testdata.updateInterfaceTestData(s()(e.basicInfo)).then(function(t){e.$notify({type:"success",message:t.data.msg}),e.loading=!1}).catch(function(){e.loading=!1})):(e.basicInfo.createPerson=JSON.parse(localStorage.getItem("userInfo")).nick,e.basicInfo.createTime=Date.now(),e.$api.testdata.insertInterfaceTestData(s()(e.basicInfo)).then(function(t){e.$notify({type:"success",message:t.data.msg}),e.loading=!1}).catch(function(){e.loading=!1})))})},getCurrentRequestHeader:function(){var e=this.requestBodyObj.requestHeadersList.items;return""!=e[0].keys?this.parseListItemsBackJsonString(e):""},getCurrentRequestParam:function(){var e=this.requestBodyObj.requestParamsList.items;if(""!=e[0].keys){var t=this.parseListItemsBackJsonString(e).replace(/,/g,"&").replace(/:/g,"=").replace(/"/g,"");return"?"!=(t=t.slice(
|
|||
|
//# sourceMappingURL=3.c1c7a79f6998c191a587.js.map
|