chunk-8e31973a.dfc97e88.js 18 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-8e31973a"],{"03a4":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{"min-width":"1100px"}},[r("el-button",{staticStyle:{"margin-bottom":"20px"},attrs:{size:"mini"},on:{click:t.exportRep}},[r("i",{staticClass:"el-icon-download",staticStyle:{fontSize:"20px"}}),t._v(" 导出测试报告 ")]),r("CCard",[r("CCardHeader",[r("h5",{staticStyle:{display:"inline-block"}},[t._v(t._s(t.software.name)+" ")]),t.checkPerm("EDIT")?r("div",{staticClass:"card-header-actions"},[r("a",{staticClass:"card-header-action",attrs:{href:"javascript:;",rel:"noreferrer noopener"},on:{click:function(e){return t.editModalOpen()}}},[r("CIcon",{attrs:{name:"cil-pencil"}})],1)]):t._e()]),r("CCardBody",[r("el-row",[r("el-col",{attrs:{span:3}},[r("strong",[t._v("项目类型:")]),t._v(" "+t._s(t.software.type))]),r("el-col",{attrs:{span:4}},[r("strong",[t._v("测试任务数量:")]),t._v(" "+t._s(t.software.task_num))]),r("el-col",{attrs:{span:4}},[r("strong",[t._v("测试用例数量:")]),t._v(" "+t._s(t.software.case_num))]),r("el-col",{attrs:{span:2}},[r("strong",[t._v("版本数:")]),t._v(" "+t._s(t.software.versions.length))]),r("el-col",{attrs:{span:5}},[r("strong",[t._v("更新时间:")]),t._v(" "+t._s(t._f("singleDateFilter")(t.software.update_time)))]),r("el-col",{attrs:{span:5}},[r("strong",[t._v("创建时间:")]),t._v(" "+t._s(t._f("singleDateFilter")(t.software.create_time)))])],1)],1)],1),r("CCard",[r("CCardHeader",[r("h5",{staticStyle:{display:"inline-block"}},[t._v("版本记录 ")]),t.checkPerm("CREATE")?r("CButton",{staticStyle:{width:"100px",float:"right"},attrs:{block:"",color:"primary"},on:{click:function(e){t.createVersionModal=!0}}},[t._v("+新建")]):t._e()],1),r("CCardBody",[r("CDataTable",{attrs:{items:t.software.versions,fields:t.iterationfields,"items-per-page":5,hover:"",pagination:{doubleArrows:!0,align:"center"}},scopedSlots:t._u([{key:"operation_edit",fn:function(e){var n=e.item,o=e.index;return[t.checkPerm("EDIT")?r("td",{staticClass:"py-2"},[r("CButton",{staticStyle:{width:"50px"},attrs:{color:"warning",variant:"outline",square:"",size:"sm"},on:{click:function(e){return t.editVersionFirstStep(n,o)}}},[t._v(" 编辑 ")])],1):t._e()]}},{key:"operation_download",fn:function(e){var n=e.item,o=e.index;return[t.checkPerm("CHECK")?r("td",{staticClass:"py-2"},[r("CButton",{staticStyle:{width:"50px"},attrs:{color:"primary",variant:"outline",square:"",size:"sm"},on:{click:function(e){return t.downloadFile(n,o)}}},[t._v(" 下载 ")])],1):t._e()]}},{key:"operation_delete",fn:function(e){var n=e.item,o=e.index;return[t.checkPerm("DELETE")?r("td",{staticClass:"py-2"},[r("CButton",{staticStyle:{width:"50px"},attrs:{color:"danger",variant:"outline",square:"",size:"sm"},on:{click:function(e){return t.deleteVersionFirstStep(n,o)}}},[t._v(" 删除 ")])],1):t._e()]}}])})],1)],1),r("CCard",[r("CCardHeader",[r("h5",[t._v("测试计划")])]),r("CCardBody",[r("CDataTable",{attrs:{items:t.planList,fields:t.planFields,"items-per-page":8,tableFilter:{label:"搜索",placeholder:"输入任意信息检索"},noItemsView:{noResults:"无结果",noItems:"无测试计划"},cleaner:"",hover:"",pagination:{doubleArrows:!0,align:"center"}},scopedSlots:t._u([{key:"state",fn:function(e){var n=e.item;return[r("td",[r("CBadge",{staticStyle:{fontSize:"14px",height:"25px","line-height":"20px"},attrs:{color:t.getBadge(n.state)}},[t._v(" "+t._s(t._f("planStateFilter")(n.state))+" ")])],1)]}},{key:"opt_details",fn:function(e){var n=e.item,o=e.index;return[t.checkPerm("CHECK")?r("td",{staticClass:"py-2"},[r("CButton",{staticStyle:{width:"50px"},attrs:{color:"success",variant:"outline",square:"",size:"sm"},on:{click:function(e){return t.gotoPlan(n,o)}}},[t._v(" 查看 ")])],1):t._e()]}},{key:"opt_copy",fn:function(e){var n=e.item,o=e.index;return[t.checkPerm("COPY")?r("td",{staticClass:"py-2"},[r("CButton",{staticStyle:{width:"50px"},attrs:{color:"primary",variant:"outline",square:"",size:"sm"},on:{click:function(e){return t.copyPlan(n,o)}}},[t._v(" 复制 ")])],1):t._e()]}},{key:"opt_delete",fn:function(e){var n=e.item,o=e.index;return[t.checkPerm("DELETE")?r("td",{staticClass:"py-2"},[r("CButton",{staticStyle:{width:"50px"},attrs:{color:"danger",variant:"outline",square:"",size:"sm"},on:{click:function(e){return t.deletePlanFirstStep(n,o)}}},[t._v(" 删除 ")])],1):t._e()]}}])})],1)],1),r("CModal",{attrs:{show:t.editModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"primary"},on:{"update:show":function(e){t.editModal=e}},scopedSlots:t._u([{key:"header",fn:function(){return[r("h6",{staticClass:"modal-title"},[t._v("编辑测试项目")]),r("CButtonClose",{staticClass:"text-white",on:{click:function(e){t.editModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[r("CButton",{attrs:{color:"danger"},on:{click:function(e){t.editModal=!1}}},[t._v("取消")]),r("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:t.editTarget}},[t._v("确定")])]},proxy:!0}])},[r("CInput",{attrs:{label:"名称",placeholder:"请输入测试项目名称"},model:{value:t.editName,callback:function(e){t.editName=e},expression:"editName"}}),r("CInput",{attrs:{label:"类型",placeholder:"请输入测试项目的类型"},model:{value:t.editType,callback:function(e){t.editType=e},expression:"editType"}})],1),r("CModal",{attrs:{show:t.editVersionModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"primary"},on:{"update:show":function(e){t.editVersionModal=e}},scopedSlots:t._u([{key:"header",fn:function(){return[r("h6",{staticClass:"modal-title"},[t._v("编辑版本")]),r("CButtonClose",{staticClass:"text-white",on:{click:function(e){t.editVersionModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[r("CButton",{attrs:{color:"danger"},on:{click:function(e){t.editVersionModal=!1}}},[t._v("取消")]),r("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:t.editVersionNow}},[t._v("确定")])]},proxy:!0}])},[r("p",{staticStyle:{marginBottom:"6px"}},[t._v("请上传文件")]),r("el-upload",{ref:"editVersionUploader",staticClass:"upload-demo",attrs:{action:"","auto-upload":!1,limit:1,"file-list":t.fileList}},[r("el-button",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},attrs:{size:"small"}},[t._v("点击上传")]),r("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[t._v("文件大小限制不超过20M")])],1)],1),r("CModal",{attrs:{show:t.createVersionModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"primary"},on:{"update:show":function(e){t.createVersionModal=e}},scopedSlots:t._u([{key:"header",fn:function(){return[r("h6",{staticClass:"modal-title"},[t._v("新建版本")]),r("CButtonClose",{staticClass:"text-white",on:{click:function(e){t.createVersionModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[r("CButton",{attrs:{color:"danger"},on:{click:function(e){t.createVersionModal=!1}}},[t._v("取消")]),r("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:t.createNewVersion}},[t._v("新建")])]},proxy:!0}])},[r("CInput",{attrs:{label:"名称",placeholder:"请输入版本名称"},model:{value:t.createVersionName,callback:function(e){t.createVersionName=e},expression:"createVersionName"}}),r("p",{staticStyle:{marginBottom:"6px"}},[t._v("请选择文件")]),r("el-upload",{ref:"createVersionUploader",staticClass:"upload-demo",attrs:{action:"","auto-upload":!1,limit:1,"file-list":t.fileList}},[r("el-button",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},attrs:{size:"small"}},[t._v("点击上传")]),r("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[t._v("文件大小限制不超过20M")])],1)],1),r("CModal",{attrs:{show:t.deleteVersionModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"danger"},on:{"update:show":function(e){t.deleteVersionModal=e}},scopedSlots:t._u([{key:"header",fn:function(){return[r("h6",{staticClass:"modal-title"},[t._v("删除版本")]),r("CButtonClose",{staticClass:"text-white",on:{click:function(e){t.deleteVersionModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[r("CButton",{attrs:{color:"danger"},on:{click:function(e){t.deleteVersionModal=!1}}},[t._v("取消")]),r("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:function(e){return t.deleteVersionNow()}}},[t._v("删除")])]},proxy:!0}])},[r("h5",[t._v("你确定删除该版本目吗?删除后将无法查看该版本的相关信息!删除最后一个版本将会直接删除本项目!")])])],1)},o=[],a=r("1684"),i=r("1619"),s=r("b775");function l(t,e){return Object(s["a"])({url:"/v1/software/".concat(t,"/versions"),method:"POST",data:e})}function c(t,e){return Object(s["a"])({url:"/v1/software/".concat(t,"/versions"),method:"DELETE",params:{version_number:e}})}function d(t,e){return Object(s["a"])({url:"/v1/software/".concat(t,"/versions/edit"),method:"POST",data:e})}var u=r("e350"),f=r("3f13"),p={name:"softwareDetail",data:function(){return{software:{},editModal:!1,iterationfields:[{key:"version",label:"版本",_style:"min-width:50px"},{key:"create_time",label:"创建时间",_style:"min-width:200px;"},{key:"update_time",label:"更新时间",_style:"min-width:200px;"},{key:"file",label:"文件",_style:"min-width:200px",sorter:!1,filter:!1},{key:"operation_download",label:"",_style:"min-width:2%",sorter:!1,filter:!1},{key:"operation_edit",label:"",_style:"min-width:2%",sorter:!1,filter:!1},{key:"operation_delete",label:"",_style:"min-width:2%",sorter:!1,filter:!1}],softwareId:"",editType:"",editName:"",createVersionModal:!1,editVersionModal:!1,deleteVersionModal:!1,createVersionName:"",fileList:[],versionSelected:{},planList:[],planFields:[{key:"title",label:"计划名称",_style:"min-width:100px"},{key:"software_name",label:"所属软件",_style:"min-width:100px"},{key:"version",label:"所属版本",_style:"min-width:100px"},{key:"description",label:"描述",_style:"min-width:200px"},{key:"state",label:"状态",sorter:!1,filter:!1,_style:"min-width:100px;"},{key:"creator",label:"创建者",_style:"min-width:100px"},{key:"create_time",label:"创建时间",_style:"min-width:100px;"},{key:"update_time",label:"更新时间",_style:"min-width:100px;"},{key:"opt_details",label:"",_style:"min-width:10px;"},{key:"opt_copy",label:"",_style:"min-width:10px;"},{key:"opt_delete",label:"",_style:"min-width:10px;"}]}},filters:{singleDateFilter:i["b"],targetDateFilter:i["c"],planStateFilter:i["a"]},mounted:function(){this.softwareId=localStorage.getItem("softwareId"),this.getSoftwareDetail(),this.getPlans(this.softwareId)},computed:{},watch:{},methods:{editTarget:function(){var t=this,e=new FormData;e.append("name",this.editName),e.append("type",this.editType),Object(a["d"])(this.softwareId,e).then((function(e){t.getSoftwareDetail(),t.editModal=!1}))},editModalOpen:function(){this.editModal=!0,this.editName=this.software.name,this.editType=this.software.type},getSoftwareDetail:function(){var t=this;Object(a["a"])(this.softwareId).then((function(e){t.software=e,t.software.versions=Object(i["c"])(t.software.versions)}))},deleteVersionFirstStep:function(t,e){this.deleteVersionModal=!0,this.versionSelected=t},deleteVersionNow:function(){var t=this;c(this.softwareId,this.versionSelected.version).then((function(e){t.getSoftwareDetail(),t.deleteVersionModal=!1}))},createNewVersion:function(){var t=this;if(""!=this.createVersionName)if(this.$refs["createVersionUploader"].uploadFiles.length<1)this.$message.warning("请上传文件!");else{var e,r;if(this.$refs["createVersionUploader"].uploadFiles.length>=1&&(e=this.$refs["createVersionUploader"].uploadFiles.pop(),r=e.size/1024/1024<20,!r))return this.$message.info("文件大小不能超过20M"),this.$refs["createVersionUploader"].uploadFiles.pop(),!1;var n=new FormData;n.append("file",e.raw),n.append("version",this.createVersionName),l(this.softwareId,n).then((function(e){t.$message.success("新建版本成功"),t.createVersionModal=!1,t.createVersionName="",t.getSoftwareDetail()}))}else this.$message.warning("请完整填写版本名称!")},editVersionFirstStep:function(t,e){this.versionSelected=t,this.editVersionModal=!0},editVersionNow:function(){var t=this;if(this.$refs["editVersionUploader"].uploadFiles.length<1)this.$message.warning("请上传文件!");else{var e,r;if(this.$refs["editVersionUploader"].uploadFiles.length>=1&&(e=this.$refs["editVersionUploader"].uploadFiles.pop(),r=e.size/1024/1024<20,!r))return this.$message.info("测试用例集文件大小不能超过20M"),this.$refs["editVersionUploader"].uploadFiles.pop(),!1;var n=new FormData;n.append("file",e.raw),n.append("version_number",this.versionSelected.version),d(this.softwareId,n).then((function(e){t.getSoftwareDetail(),t.createVersionName="",t.editVersionModal=!1,t.$message.success("修改成功!")}))}},downloadFile:function(t){var e=t.file_url,r=document.createElement("a");r.style.display="none",r.href=e,r.target="_blank",r.click()},checkPerm:function(t){return Object(u["a"])(localStorage.getItem("identity"),t)},getPlans:function(){var t=this;Object(f["e"])("","","",this.softwareId,"").then((function(e){t.planList=Object(i["c"])(e)}))},getBadge:function(t){switch(t){case 0:return"success";case 1:return"secondary";default:}},gotoPlan:function(t,e){this.$router.push("/softwareTestPlanDetail/"+t.id)},exportRep:function(){var t=document.createElement("a");t.style.display="none",t.href="/api/v1/software/"+this.softwareId+"/report?executor_id="+localStorage.getItem("userId"),t.target="_blank",t.click()}}},h=p,m=(r("7056"),r("2877")),v=Object(m["a"])(h,n,o,!1,null,"6dcbe41a",null);e["default"]=v.exports},1619:function(t,e,r){"use strict";function n(t,e){var r="undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=o(t))||e&&t&&"number"===typeof t.length){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){l=!0,i=t},f:function(){try{s||null==r.return||r.return()}finally{if(l)throw i}}}}function o(t,e){if(t){if("string"===typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t){var e,r=[],o=n(t);try{for(o.s();!(e=o.n()).done;){var a=e.value,i=a.create_time.split("T")[0],s=a.create_time.split("T")[1].slice(0,8);a.create_time=i+" "+s;var l=a.update_time.split("T")[0],c=a.update_time.split("T")[1].slice(0,8);a.update_time=l+" "+c,r.push(a)}}catch(d){o.e(d)}finally{o.f()}return r}function s(t){var e=t.split("T")[0],r=(t.split("T")[1]+" ").slice(0,8);return e+" "+r}function l(t){switch(t){case 0:return"执行中";case 1:return"已归档";default:return"无"}}function c(t){switch(t){case 0:return"未执行";case 1:return"执行中";case 2:return"已完成";default:return"无"}}r.d(e,"c",(function(){return i})),r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return l})),r.d(e,"d",(function(){return c}))},1684:function(t,e,r){"use strict";r.d(e,"e",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"d",(function(){return i})),r.d(e,"c",(function(){return s})),r.d(e,"b",(function(){return l}));var n=r("b775");function o(t,e,r){return Object(n["a"])({url:"/v1/software",method:"GET",params:{name:t,type:e,sort:r}})}function a(t){return Object(n["a"])({url:"/v1/software/".concat(t),method:"GET"})}function i(t,e){return Object(n["a"])({url:"/v1/software/".concat(t,"/edit"),method:"POST",data:e})}function s(t){return Object(n["a"])({url:"/v1/software/".concat(t),method:"DELETE"})}function l(t){return Object(n["a"])({url:"/v1/software/",method:"POST",data:t})}},"3f13":function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"c",(function(){return i})),r.d(e,"d",(function(){return s})),r.d(e,"e",(function(){return l}));var n=r("b775");function o(t){return Object(n["a"])({url:"/v1/test-plans/",method:"POST",data:t})}function a(t){return Object(n["a"])({url:"/v1/test-plans/".concat(t),method:"GET"})}function i(t){return Object(n["a"])({url:"/v1/test-plans/".concat(t),method:"DELETE"})}function s(t,e){return Object(n["a"])({url:"/v1/test-plans/".concat(t,"/edit"),method:"POST",data:e})}function l(t,e,r,o,a){return Object(n["a"])({url:"/v1/test-plans/",method:"GET",params:{creator_id:t,title:e,state:r,software_id:o,sort:a}})}},7056:function(t,e,r){"use strict";r("f5af")},b775:function(t,e,r){"use strict";var n=r("bc3a"),o=r.n(n),a=r("5c96");r("c0d6");o.a.defaults.withCredentials=!0;var i=o.a.create({baseURL:"/api",withCredentials:!0,timeout:1e5});i.interceptors.response.use((function(t){var e=t.data;return e}),(function(t){return console.log("err"+t),t.response.data.length>1e3?Object(a["Message"])({message:"服务器出错",type:"error",duration:3e3}):Object(a["Message"])({message:t.response.data,type:"error",duration:2e4}),Promise.reject(t)})),i.interceptors.request.use((function(t){var e=window.localStorage.getItem("accessToken");return e?(t.headers.accessToken=e,t):t})),e["a"]=i},e350:function(t,e,r){"use strict";function n(t,e){var r=o[t];return r.includes(e)}r.d(e,"a",(function(){return n}));var o=[["CHECK","EDIT","DELETE","CREATE","EXECUTE","DELETE","CONFIRM","EXPORT"],["CHECK","EDIT","DELETE","CREATE","EXECUTE","DELETE","CONFIRM","EXPORT"],["CHECK","EXECUTE"]]},f5af:function(t,e,r){}}]);