1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4c8e2482"],{1619:function(t,e,n){"use strict";function a(t,e){var n="undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=i(t))||e&&t&&"number"===typeof t.length){n&&(t=n);var a=0,r=function(){};return{s:r,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:r}}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 l,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,l=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw l}}}}function i(t,e){if(t){if("string"===typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n<e;n++)a[n]=t[n];return a}function l(t){var e,n=[],i=a(t);try{for(i.s();!(e=i.n()).done;){var r=e.value,l=r.create_time.split("T")[0],o=r.create_time.split("T")[1].slice(0,8);r.create_time=l+" "+o;var s=r.update_time.split("T")[0],c=r.update_time.split("T")[1].slice(0,8);r.update_time=s+" "+c,r.creator=(r.executor||{}).name,n.push(r)}}catch(d){i.e(d)}finally{i.f()}return n}function o(t){var e=-1!=(t||"").indexOf("T")&&t.split("T")[0],n=-1!=(t||"").indexOf("T")&&(t.split("T")[1]+" ").slice(0,8);return e+" "+n}function s(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"无"}}function d(t){switch(t){case 0:return"系统管理员";case 1:return"测试管理员";case 2:return"测试工程师";default:return"测试工程师"}}n.d(e,"d",(function(){return l})),n.d(e,"c",(function(){return o})),n.d(e,"b",(function(){return s})),n.d(e,"e",(function(){return c})),n.d(e,"a",(function(){return d}))},"277b":function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticStyle:{"min-width":"1100px"}},[n("CCard",[n("CCardHeader",[n("h5",{staticStyle:{display:"inline-block"}},[t._v("测试计划详情")]),n("br"),n("span",{staticClass:"infoColor"},[t._v("创建者: "+t._s(t.plan.creator))]),n("span",{staticClass:"infoColor textMarginLeft"},[t._v("创建时间: "+t._s(t._f("singleDateFilter")(t.plan.create_time)))]),n("span",{staticClass:"infoColor textMarginLeft"},[t._v("最后更新时间: "+t._s(t._f("singleDateFilter")(t.plan.update_time)))]),t.checkPerm("EDIT")?n("div",{staticClass:"card-header-actions"},[n("a",{staticClass:"card-header-action",attrs:{href:"javascript:;",rel:"noreferrer noopener"},on:{click:function(e){return t.editPlanModalOpen()}}},[n("el-button",[t._v("编辑")])],1)]):t._e()]),n("CCardBody",[n("el-row",{staticStyle:{"margin-bottom":"40px"}},[n("el-col",{attrs:{span:6}},[n("strong",[t._v("计划名称:")]),n("span",[t._v(t._s(this.plan.title))]),n("CBadge",{staticStyle:{fontSize:"14px",height:"21px","line-height":"15px",margin:"0px 10px"},attrs:{color:t.getPlanBadge(t.plan.state)}},[n("span",[t._v(t._s(this.plan.type))])]),n("i",{staticClass:"el-icon-edit",on:{click:function(e){t.editPlanTypeModel=!0}}})],1),n("el-col",{attrs:{span:6}},[n("strong",[t._v("计划描述:")]),t._v(" "+t._s(t.plan.description))]),n("el-col",{attrs:{span:6}},[n("strong",[t._v("所属软件名称:")]),t._v(" "+t._s(t.plan.software_name))]),n("el-col",{attrs:{span:3}},[n("strong",[t._v("所属软件版本:")]),t._v(" "+t._s(t.plan.version))]),n("el-col",{attrs:{span:3}},[n("strong",[t._v("状态:")]),n("CBadge",{staticStyle:{fontSize:"14px",height:"21px","line-height":"15px","margin-left":"10px"},attrs:{color:t.getPlanBadge(t.plan.state)}},[t._v(" "+t._s(t._f("planStateFilter")(t.plan.state))+" ")])],1)],1),n("CCard",[n("CCardHeader",[n("CIcon",{attrs:{name:"cil-justify-center"}}),n("strong",[t._v(" 说明文档列表 ")]),n("small",[t._v("查阅相关文件")]),t.checkPerm("CREATE")?n("CButton",{staticStyle:{width:"100px",float:"right"},attrs:{block:"",color:"primary"},on:{click:function(e){t.appendFileModal=!0}}},[t._v("+新增")]):t._e()],1),n("CCardBody",[n("CListGroup",{attrs:{accent:""}},t._l(this.plan.statements,(function(e){return n("CListGroupItem",{key:e.url,staticClass:"d-flex justify-content-between align-items-center",attrs:{href:"#",color:"secondary",accent:"secondary"}},[t._v(t._s(e.name)+" "),n("div",[n("CButton",{staticStyle:{width:"50px","margin-right":"10px"},attrs:{color:"primary",variant:"outline",square:"",size:"sm"},on:{click:function(n){return t.checkFile(e.url)}}},[t._v(" 下载 ")]),t.checkPerm("DELETE")?n("CButton",{staticStyle:{width:"50px"},attrs:{color:"danger",variant:"outline",square:"",size:"sm"},on:{click:function(n){return t.deleteFileFirstStep(e)}}},[t._v(" 删除 ")]):t._e()],1)])})),1)],1)],1)],1)],1),n("CCard",[n("CCardBody",[n("CDataTable",{attrs:{items:t.planTask,fields:t.taskFields,"items-per-page":5,tableFilter:{label:"搜索",placeholder:"输入任意信息检索"},noItemsView:{noResults:"无结果",noItems:"无测试任务"},hover:"",pagination:{doubleArrows:!0,align:"center"}},scopedSlots:t._u([{key:"state",fn:function(e){var a=e.item;return[n("td",[n("CBadge",{staticStyle:{fontSize:"14px",height:"21px","line-height":"15px"},attrs:{color:t.getBadge(a.state)}},[t._v(" "+t._s(t._f("taskStateFilter")(a.state))+" ")])],1)]}}])})],1)],1),n("CModal",{attrs:{show:t.editPlanModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"primary"},on:{"update:show":function(e){t.editPlanModal=e}},scopedSlots:t._u([{key:"header",fn:function(){return[n("h6",{staticClass:"modal-title"},[t._v("编辑测试计划")]),n("CButtonClose",{staticClass:"text-white",on:{click:function(e){t.editPlanModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[n("CButton",{attrs:{color:"danger"},on:{click:function(e){t.editPlanModal=!1}}},[t._v("取消")]),n("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:t.confirmEditPlan}},[t._v("确定")])]},proxy:!0}])},[n("CInput",{attrs:{label:"名称",placeholder:"请输入测试计划名称"},model:{value:t.newPlanTitle,callback:function(e){t.newPlanTitle=e},expression:"newPlanTitle"}}),n("CInput",{attrs:{label:"描述",placeholder:"请输入测试计划描述"},model:{value:t.newPlanDescription,callback:function(e){t.newPlanDescription=e},expression:"newPlanDescription"}}),n("div",{staticClass:"stateItem"},[n("div",[n("p",{staticStyle:{marginBottom:"6px"}},[t._v("计划状态")]),n("el-radio",{attrs:{label:0},model:{value:t.radio,callback:function(e){t.radio=e},expression:"radio"}},[t._v(" 执行中 ")]),n("el-radio",{attrs:{label:1},model:{value:t.radio,callback:function(e){t.radio=e},expression:"radio"}},[t._v(" 已归档 ")])],1)])],1),n("CModal",{attrs:{show:t.editPlanTypeModel,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"primary"},on:{"update:show":function(e){t.editPlanTypeModel=e}},scopedSlots:t._u([{key:"header",fn:function(){return[n("h6",{staticClass:"modal-title"},[t._v("编辑测试计划类型")]),n("CButtonClose",{staticClass:"text-white",on:{click:function(e){t.editPlanTypeModel=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[n("CButton",{attrs:{color:"danger"},on:{click:function(e){t.editPlanTypeModel=!1}}},[t._v("取消")]),n("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:t.confirmEditPlanType}},[t._v("确定")])]},proxy:!0}])},[n("p",{staticStyle:{marginBottom:"10px",marginTop:"10px"}},[t._v("计划类型")]),n("el-select",{attrs:{clearable:"",placeholder:"请选择计划类型"},model:{value:t.newPlanType,callback:function(e){t.newPlanType=e},expression:"newPlanType"}},t._l(t.planTypes,(function(t){return n("el-option",{key:t.id,attrs:{label:t.id,value:t.id}})})),1)],1),n("CModal",{attrs:{show:t.deleteFileModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"danger"},on:{"update:show":function(e){t.deleteFileModal=e}},scopedSlots:t._u([{key:"header",fn:function(){return[n("h6",{staticClass:"modal-title"},[t._v("删除测试计划文件")]),n("CButtonClose",{staticClass:"text-white",on:{click:function(e){t.deleteFileModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[n("CButton",{on:{click:function(e){t.deleteFileModal=!1}}},[t._v("取消")]),n("CButton",{attrs:{color:"danger"},on:{click:t.confirmDeleteFile}},[t._v("删除")])]},proxy:!0}])},[n("h5",[t._v("你确定删除该文件吗?")])]),n("CModal",{attrs:{show:t.appendFileModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"primary"},on:{"update:show":function(e){t.appendFileModal=e}},scopedSlots:t._u([{key:"header",fn:function(){return[n("h6",{staticClass:"modal-title"},[t._v("新增测试计划文件")]),n("CButtonClose",{staticClass:"text-white",on:{click:function(e){t.appendFileModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[n("CButton",{attrs:{color:"danger"},on:{click:function(e){t.appendFileModal=!1}}},[t._v("取消")]),n("CButton",{attrs:{color:"primary"},on:{click:t.appendPlanFile}},[t._v("新增")])]},proxy:!0}])},[n("el-upload",{ref:"newPlanFileUploader",staticClass:"upload-demo",attrs:{action:"","auto-upload":!1,multiple:!0,"file-list":t.fileList}},[n("el-button",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},attrs:{size:"small"}},[t._v("点击上传")])],1)],1)],1)},i=[],r=n("3f13"),l=n("1619"),o=n("e350"),s=n("3f5e"),c={name:"planDetail",data:function(){return{planId:"",plan:{},newPlan:{},taskList:[{title:"xxx",executors:[{id:"1",name:"xxx"},{id:"2",name:"xxx"},{id:"3",name:"xxx"}],description:"xxxxxxx",files:[{name:"xxx",url:"xxxxxx"}]}],planTypes:[{id:"功能测试"},{id:"性能测试"},{id:"环境适应性测试"},{id:"电磁兼容性测试"},{id:"可靠性检验"}],editPlanTypeModel:!1,newPlanType:"",taskFields:[{key:"title",label:"任务名称",_style:"min-width:100px"},{key:"description",label:"描述",_style:"min-width:200px"},{key:"creator",label:"执行者",_style:"min-width:100px;"},{key:"create_time",label:"创建时间",_style:"min-width:100px;"},{key:"update_time",label:"更新时间",_style:"min-width:100px;"}],editPlanModal:!1,fileList:[],radio:0,newPlanDescription:"",newPlanTitle:"",deleteFileModal:!1,fileId:"",appendFileModal:!1,planTask:[]}},mounted:function(){this.planId=this.$route.params.id,this.getPlanDetail(this.planId)},filters:{singleDateFilter:l["c"],targetDateFilter:l["d"],planStateFilter:l["b"],taskStateFilter:l["e"]},computed:{},watch:{},methods:{getBadge:function(t){switch(t){case 0:return"secondary";case 1:return"success";case 2:return"primary";default:}},editPlanModalOpen:function(){this.editPlanModal=!0,this.newPlanTitle=this.plan.title,this.newPlanDescription=this.plan.description},getPlanBadge:function(t){switch(t){case 0:return"success";case 1:return"secondary";case 2:return"primary";default:}},getPlanDetail:function(t){var e=this;Object(r["b"])(t).then((function(t){e.plan=t,e.planTask=Object(l["d"])(e.plan.tasks),e.newPlan=t,e.radio=t.state,localStorage.setItem("softwareId",e.plan.software_id)}))},confirmEditPlanType:function(){var t=this;this.editPlanTypeModel=!1;var e=new FormData;e.append("type",this.newPlanType),Object(r["f"])(this.planId,e).then((function(e){console.log(e,"编辑计划类型"),t.getPlanDetail(t.planId)}))},gotoTask:function(t){localStorage.setItem("softwareId",this.plan.software_id),localStorage.setItem("taskId",t.id),this.$router.push("/softwareTestTaskDetail/"+t.id)},checkFile:function(t){var e=document.createElement("a");e.style.display="none",e.href=t,e.target="_blank",e.click()},confirmEditPlan:function(){var t=this;if(""!=this.newPlan.title){var e=new FormData;this.newPlan.title=this.newPlanTitle,this.newPlan.description=this.newPlanDescription,this.newPlan.state=this.radio,e.append("title",this.newPlan.title),e.append("state",this.newPlan.state),e.append("description",this.newPlan.description),Object(r["e"])(this.planId,e).then((function(e){t.getPlanDetail(t.planId),t.editPlanModal=!1}))}else this.$message.warning("计划名称不能为空!")},checkPerm:function(t){return Object(o["a"])(localStorage.getItem("identity"),t)},deleteFileFirstStep:function(t){this.deleteFileModal=!0,this.fileId=t.file_id},confirmDeleteFile:function(){var t=this;Object(s["b"])("plan_statement",this.planId,"",this.fileId).then((function(e){t.getPlanDetail(t.planId),t.deleteFileModal=!1}))},appendPlanFile:function(){var t=this,e=new FormData;this.$refs["newPlanFileUploader"].uploadFiles.length>=1&&this.$refs["newPlanFileUploader"].uploadFiles.forEach((function(t){e.append("files",t.raw)})),e.append("type","plan_statement"),e.append("plan_id",this.planId),e.append("task_id",""),Object(s["a"])(e).then((function(e){t.getPlanDetail(t.planId),t.appendFileModal=!1}))}}},d=c,u=(n("bb74"),n("2877")),p=Object(u["a"])(d,a,i,!1,null,"59fe273e",null);e["default"]=p.exports},"3f13":function(t,e,n){"use strict";n.d(e,"c",(function(){return i})),n.d(e,"b",(function(){return r})),n.d(e,"d",(function(){return l})),n.d(e,"e",(function(){return o})),n.d(e,"g",(function(){return s})),n.d(e,"f",(function(){return c})),n.d(e,"h",(function(){return d})),n.d(e,"a",(function(){return u}));var a=n("b775");function i(t){return Object(a["a"])({url:"/api/v1/test-plans/",method:"POST",data:t})}function r(t){return Object(a["a"])({url:"/api/v1/test-plans/".concat(t),method:"GET"})}function l(t){return Object(a["a"])({url:"/api/v1/test-plans/".concat(t),method:"DELETE"})}function o(t,e){return Object(a["a"])({url:"/api/v1/test-plans/".concat(t,"/edit"),method:"POST",data:e})}function s(t,e,n,i,r){return Object(a["a"])({url:"/api/v1/test-plans/",method:"GET",params:{creator_id:t,title:e,state:n,software_id:i,sort:r}})}function c(t,e){return Object(a["a"])({url:"/api/v1/test-plans/".concat(t,"/edit-type"),method:"POST",data:e})}function d(t){return Object(a["a"])({url:"/api/v1/software/".concat(t,"/plans"),method:"GET"})}function u(t,e,n){return Object(a["a"])({url:"/api/v1/software/".concat(t,"/versions/plan"),method:"POST",data:{version_number:e,plan_ids:n}})}},"3f5e":function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return r}));var a=n("b775");function i(t){return Object(a["a"])({url:"/api/v1/files/",method:"POST",data:t})}function r(t,e,n,i){return Object(a["a"])({url:"/api/v1/files/",method:"DELETE",params:{type:t,plan_id:e,task_id:n,file_id:i}})}},"44fd":function(t,e,n){},b775:function(t,e,n){"use strict";var a=n("bc3a"),i=n.n(a),r=n("5c96");n("c0d6");i.a.defaults.withCredentials=!0;var l=i.a.create({withCredentials:!0,timeout:1e5});l.interceptors.response.use((function(t){var e=t.data;return e}),(function(t){return console.log("err"+t),t.response.data.length>1e3?Object(r["Message"])({message:"服务器出错",type:"error",duration:3e3}):Object(r["Message"])({message:t.response.data,type:"error",duration:2e4}),Promise.reject(t)})),l.interceptors.request.use((function(t){var e=window.localStorage.getItem("accessToken");return e?(t.headers.accessToken=e,t):t})),e["a"]=l},bb74:function(t,e,n){"use strict";n("44fd")},e350:function(t,e,n){"use strict";function a(t,e){var n=i[t];return n.includes(e)}n.d(e,"a",(function(){return a}));var i=[["CHECK","EDIT","DELETE","CREATE","EXECUTE","DELETE","CONFIRM","EXPORT"],["CHECK","EDIT","DELETE","CREATE","EXECUTE","DELETE","CONFIRM","EXPORT"],["CHECK","EXECUTE"]]}}]);
|