1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-48594924"],{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=r(t))||e&&t&&"number"===typeof t.length){n&&(t=n);var a=0,o=function(){};return{s:o,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:o}}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,l=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){c=!0,i=t},f:function(){try{l||null==n.return||n.return()}finally{if(c)throw i}}}}function r(t,e){if(t){if("string"===typeof t)return o(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)?o(t,e):void 0}}function o(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 i(t){var e,n=[],r=a(t);try{for(r.s();!(e=r.n()).done;){var o=e.value,i=o.create_time.split("T")[0],l=o.create_time.split("T")[1].slice(0,8);o.create_time=i+" "+l;var c=o.update_time.split("T")[0],s=o.update_time.split("T")[1].slice(0,8);o.update_time=c+" "+s,o.creator=(o.executor||{}).name,n.push(o)}}catch(u){r.e(u)}finally{r.f()}return n}function l(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 c(t){switch(t){case 0:return"执行中";case 1:return"已归档";default:return"无"}}function s(t){switch(t){case 0:return"未执行";case 1:return"执行中";case 2:return"已完成";default:return"无"}}function u(t){switch(t){case 0:return"系统管理员";case 1:return"测试管理员";case 2:return"测试工程师";default:return"测试工程师"}}n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return l})),n.d(e,"b",(function(){return c})),n.d(e,"e",(function(){return s})),n.d(e,"a",(function(){return u}))},1684:function(t,e,n){"use strict";n.d(e,"e",(function(){return r})),n.d(e,"a",(function(){return o})),n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return l})),n.d(e,"b",(function(){return c}));var a=n("b775");function r(t,e,n){return Object(a["a"])({url:"/api/v1/software/",method:"GET",params:{name:t,type:e,sort:n}})}function o(t){return Object(a["a"])({url:"/api/v1/software/".concat(t),method:"GET"})}function i(t,e){return Object(a["a"])({url:"/api/v1/software/".concat(t,"/edit"),method:"POST",data:e})}function l(t){return Object(a["a"])({url:"/api/v1/software/".concat(t),method:"DELETE"})}function c(t){return Object(a["a"])({url:"/api/v1/software/",method:"POST",data:t})}},"3f13":function(t,e,n){"use strict";n.d(e,"c",(function(){return r})),n.d(e,"b",(function(){return o})),n.d(e,"d",(function(){return i})),n.d(e,"e",(function(){return l})),n.d(e,"g",(function(){return c})),n.d(e,"f",(function(){return s})),n.d(e,"h",(function(){return u})),n.d(e,"a",(function(){return d}));var a=n("b775");function r(t){return Object(a["a"])({url:"/api/v1/test-plans/",method:"POST",data:t})}function o(t){return Object(a["a"])({url:"/api/v1/test-plans/".concat(t),method:"GET"})}function i(t){return Object(a["a"])({url:"/api/v1/test-plans/".concat(t),method:"DELETE"})}function l(t,e){return Object(a["a"])({url:"/api/v1/test-plans/".concat(t,"/edit"),method:"POST",data:e})}function c(t,e,n,r,o){return Object(a["a"])({url:"/api/v1/test-plans/",method:"GET",params:{creator_id:t,title:e,state:n,software_id:r,sort:o}})}function s(t,e){return Object(a["a"])({url:"/api/v1/test-plans/".concat(t,"/edit-type"),method:"POST",data:e})}function u(t){return Object(a["a"])({url:"/api/v1/software/".concat(t,"/plans"),method:"GET"})}function d(t,e,n){return Object(a["a"])({url:"/api/v1/software/".concat(t,"/versions/plan"),method:"POST",data:{version_number:e,plan_ids:n}})}},b71d: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",[n("CCard",[n("CCardHeader",[t._v("测试计划管理")]),t.checkPerm("CREATE")?n("CCardBody",[n("CButton",{staticStyle:{width:"100px"},attrs:{block:"",color:"primary"},on:{click:function(e){t.createPlanModal=!0}}},[t._v("+新建")])],1):t._e()],1),n("CModal",{attrs:{show:t.createPlanModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"primary"},on:{"update:show":function(e){t.createPlanModal=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.createPlanModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[n("CButton",{attrs:{color:"danger"},on:{click:function(e){t.createPlanModal=!1}}},[t._v("取消")]),n("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:t.createNewPlan}},[t._v("新建")])]},proxy:!0}])},[n("CInput",{attrs:{label:"名称",placeholder:"请输入测试计划名称"},model:{value:t.newPlan.title,callback:function(e){t.$set(t.newPlan,"title",e)},expression:"newPlan.title"}}),n("CInput",{attrs:{label:"描述",placeholder:"输入测试计划描述"},model:{value:t.newPlan.description,callback:function(e){t.$set(t.newPlan,"description",e)},expression:"newPlan.description"}}),n("p",{staticStyle:{marginBottom:"6px"}},[t._v("测试目标")]),n("el-select",{attrs:{clearable:"",placeholder:"请选择所属测试目标"},on:{change:t.selectTarget,clear:function(e){t.newPlan.version=""}},model:{value:t.newPlan.softwareId,callback:function(e){t.$set(t.newPlan,"softwareId",e)},expression:"newPlan.softwareId"}},t._l(t.softwareList,(function(t){return n("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})})),1),n("p",{staticStyle:{marginBottom:"10px",marginTop:"10px"}},[t._v("所属版本")]),n("el-select",{attrs:{clearable:"",placeholder:"请选择版本"},model:{value:t.newPlan.version,callback:function(e){t.$set(t.newPlan,"version",e)},expression:"newPlan.version"}},t._l(t.versions,(function(t){return n("el-option",{key:t.version,attrs:{label:t.version,value:t.version}})})),1),n("p",{staticStyle:{marginBottom:"10px",marginTop:"10px"}},[t._v("计划类型")]),n("el-select",{attrs:{clearable:"",placeholder:"请选择计划类型"},model:{value:t.newPlan.planType,callback:function(e){t.$set(t.newPlan,"planType",e)},expression:"newPlan.planType"}},t._l(t.planTypes,(function(t){return n("el-option",{key:t.id,attrs:{label:t.id,value:t.id}})})),1),n("p",{staticStyle:{marginBottom:"6px",marginTop:"10px"}},[t._v("请上传测试计划说明文档")]),n("el-upload",{ref:"newPlanUploader",staticClass:"upload-demo",attrs:{action:"","auto-upload":!1,"file-list":t.fileList}},[n("el-button",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},attrs:{size:"small"}},[t._v("点击上传")])],1)],1),n("CCard",[n("CCardBody",[n("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 a=e.item;return[n("td",[n("CBadge",{staticStyle:{fontSize:"14px",height:"25px","line-height":"20px"},attrs:{color:t.getBadge(a.state)}},[t._v(" "+t._s(t._f("planStateFilter")(a.state))+" ")])],1)]}},{key:"type",fn:function(e){var a=e.item;return[n("td",[t._v(" "+t._s(a.type?a.type:"未设置")+" ")])]}},{key:"opt_details",fn:function(e){var a=e.item,r=e.index;return[t.checkPerm("CHECK")?n("td",{staticClass:"py-2"},[n("CButton",{staticStyle:{width:"50px"},attrs:{color:"success",variant:"outline",square:"",size:"sm"},on:{click:function(e){return t.gotoPlan(a,r)}}},[t._v(" 查看 ")])],1):t._e()]}},{key:"opt_copy",fn:function(e){var a=e.item,r=e.index;return[t.checkPerm("COPY")?n("td",{staticClass:"py-2"},[n("CButton",{staticStyle:{width:"50px"},attrs:{color:"primary",variant:"outline",square:"",size:"sm"},on:{click:function(e){return t.copyPlan(a,r)}}},[t._v(" 复制 ")])],1):t._e()]}},{key:"opt_delete",fn:function(e){var a=e.item,r=e.index;return[n("td",{staticClass:"py-2"},[t.checkPerm("DELETE")?n("CButton",{staticStyle:{width:"50px"},attrs:{color:"danger",variant:"outline",square:"",size:"sm"},on:{click:function(e){return t.deletePlanFirstStep(a,r)}}},[t._v(" 删除 ")]):t._e()],1)]}}])})],1)],1),n("CModal",{attrs:{show:t.deletePlanModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"danger"},on:{"update:show":function(e){t.deletePlanModal=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.deletePlanModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[n("CButton",{attrs:{color:"danger"},on:{click:function(e){t.deletePlanModal=!1}}},[t._v("取消")]),n("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:t.deletePlanNow}},[t._v("删除")])]},proxy:!0}])},[n("h5",[t._v("你确定删除该计划吗?删除后将无法查看任何与该计划的相关信息!")])])],1)},r=[],o=n("1619"),i=n("1684"),l=n("3f13"),c=n("e350"),s={name:"testPlan",data:function(){return{planList:[],planTypes:[{id:"功能测试"},{id:"性能测试"},{id:"环境适应性测试"},{id:"电磁兼容性测试"},{id:"可靠性检验"}],planFields:[{key:"title",label:"计划名称",_style:"min-width:100px"},{key:"software_name",label:"所属软件",_style:"min-width:100px"},{key:"type",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;"}],fileList:[],softwareList:[],createPlanModal:!1,newPlan:{},versions:[],deletePlanModal:!1,planSelected:{}}},computed:{},watch:{},mounted:function(){var t=this;Object(i["e"])("","","").then((function(e){t.softwareList=e})),this.getPlans()},filters:{planStateFilter:o["b"]},methods:{getBadge:function(t){switch(t){case 0:return"success";case 1:return"secondary";default:}},createNewPlan:function(){var t=this;if(this.$refs["newPlanUploader"].uploadFiles.length<1)this.$message.warning("文件数量至少为 1 !");else{var e=new FormData;this.$refs["newPlanUploader"].uploadFiles.length>=1&&this.$refs["newPlanUploader"].uploadFiles.forEach((function(t,n){e.append("files",t.raw)})),e.append("software_id",this.newPlan.softwareId),e.append("version_number",this.newPlan.version),e.append("description",this.newPlan.description),e.append("title",this.newPlan.title),e.append("creator",localStorage.getItem("userId")),e.append("type",this.newPlan.planType),Object(l["c"])(e).then((function(e){t.getPlans()})),this.createPlanModal=!1}},getPlans:function(){var t=this;Object(l["g"])().then((function(e){t.planList=Object(o["d"])(e)}))},gotoPlan:function(t){this.$router.push("/softwareTestPlanDetail/"+t.id)},copyPlan:function(){},deletePlanFirstStep:function(t){this.deletePlanModal=!0,this.planSelected=t},deletePlanNow:function(){var t=this;Object(l["d"])(this.planSelected.id).then((function(e){t.getPlans(),t.deletePlanModal=!1}))},selectTarget:function(){var t=this;Object(i["a"])(this.newPlan.softwareId).then((function(e){t.versions=e.versions}))},checkPerm:function(t){return Object(c["a"])(localStorage.getItem("identity"),t)}}},u=s,d=n("2877"),p=Object(d["a"])(u,a,r,!1,null,"2d49a94e",null);e["default"]=p.exports},b775:function(t,e,n){"use strict";var a=n("bc3a"),r=n.n(a),o=n("5c96");n("c0d6");r.a.defaults.withCredentials=!0;var i=r.a.create({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(o["Message"])({message:"服务器出错",type:"error",duration:3e3}):Object(o["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,n){"use strict";function a(t,e){var n=r[t];return n.includes(e)}n.d(e,"a",(function(){return a}));var r=[["CHECK","EDIT","DELETE","CREATE","EXECUTE","DELETE","CONFIRM","EXPORT"],["CHECK","EDIT","DELETE","CREATE","EXECUTE","DELETE","CONFIRM","EXPORT"],["CHECK","EXECUTE"]]}}]);
|