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