1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2c8f5038"],{1619:function(e,t,n){"use strict";function r(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=a(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw i}}}}function a(e,t){if(e){if("string"===typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e){var t,n=[],a=r(e);try{for(a.s();!(t=a.n()).done;){var o=t.value,i=o.create_time.split("T")[0],s=o.create_time.split("T")[1].slice(0,8);o.create_time=i+" "+s;var l=o.update_time.split("T")[0],c=o.update_time.split("T")[1].slice(0,8);o.update_time=l+" "+c,n.push(o)}}catch(u){a.e(u)}finally{a.f()}return n}function s(e){var t=e.split("T")[0],n=(e.split("T")[1]+" ").slice(0,8);return t+" "+n}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"无"}}n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return l})),n.d(t,"d",(function(){return c}))},1684:function(e,t,n){"use strict";n.d(t,"e",(function(){return a})),n.d(t,"a",(function(){return o})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return s})),n.d(t,"b",(function(){return l}));var r=n("b775");function a(e,t,n){return Object(r["a"])({url:"/v1/software",method:"GET",params:{name:e,type:t,sort:n}})}function o(e){return Object(r["a"])({url:"/v1/software/".concat(e),method:"GET"})}function i(e,t){return Object(r["a"])({url:"/v1/software/".concat(e,"/edit"),method:"POST",data:t})}function s(e){return Object(r["a"])({url:"/v1/software/".concat(e),method:"DELETE"})}function l(e){return Object(r["a"])({url:"/v1/software/",method:"POST",data:e})}},"3f13":function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return s})),n.d(t,"e",(function(){return l}));var r=n("b775");function a(e){return Object(r["a"])({url:"/v1/test-plans/",method:"POST",data:e})}function o(e){return Object(r["a"])({url:"/v1/test-plans/".concat(e),method:"GET"})}function i(e){return Object(r["a"])({url:"/v1/test-plans/".concat(e),method:"DELETE"})}function s(e,t){return Object(r["a"])({url:"/v1/test-plans/".concat(e,"/edit"),method:"POST",data:t})}function l(e,t,n,a,o){return Object(r["a"])({url:"/v1/test-plans/",method:"GET",params:{creator_id:e,title:t,state:n,software_id:a,sort:o}})}},"90c2":function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return s})),n.d(t,"f",(function(){return l})),n.d(t,"e",(function(){return c}));var r=n("b775");function a(e){return Object(r["a"])({url:"/v1/test-tasks/",method:"POST",data:e})}function o(e){return Object(r["a"])({url:"/v1/test-tasks/".concat(e),method:"GET"})}function i(e){return Object(r["a"])({url:"/v1/test-tasks/".concat(e),method:"DELETE"})}function s(e,t){return Object(r["a"])({url:"/v1/test-tasks/".concat(e,"/edit"),method:"POST",data:t})}function l(e,t,n,a,o){return Object(r["a"])({url:"/v1/test-tasks/",method:"GET",params:{executor_id:a,title:e,state:t,software_id:n,sort:o}})}function c(e,t){return Object(r["a"])({url:"/v1/test-tasks/".concat(e,"/case-file/execute"),method:"POST",data:t})}},b775:function(e,t,n){"use strict";var r=n("bc3a"),a=n.n(r),o=n("5c96");n("c0d6");a.a.defaults.withCredentials=!0;var i=a.a.create({baseURL:"/api",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(o["Message"])({message:"服务器出错",type:"error",duration:3e3}):Object(o["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},c24f:function(e,t,n){"use strict";n.d(t,"c",(function(){return a})),n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i})),n.d(t,"e",(function(){return s})),n.d(t,"d",(function(){return l}));var r=n("b775");function a(e){return Object(r["a"])({url:"/v1/users/login",method:"POST",data:e})}function o(e){return Object(r["a"])({url:"/v1/users/",method:"GET",params:{user_id:e}})}function i(e){return Object(r["a"])({url:"/v1/users/".concat(e),method:"GET"})}function s(e,t){return Object(r["a"])({url:"/v1/users/".concat(e,"/edit"),method:"POST",data:t})}function l(e){return Object(r["a"])({url:"/v1/users/",method:"POST",data:e})}},cdf2:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("CCard",[n("CCardHeader",[e._v("测试任务管理")]),e.checkPerm("CREATE")?n("CCardBody",[n("CButton",{staticStyle:{width:"100px"},attrs:{block:"",color:"primary"},on:{click:function(t){e.createTaskModal=!0}}},[e._v("+新建")])],1):e._e()],1),n("CModal",{attrs:{show:e.createTaskModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"primary"},on:{"update:show":function(t){e.createTaskModal=t}},scopedSlots:e._u([{key:"header",fn:function(){return[n("h6",{staticClass:"modal-title"},[e._v("新建测试任务")]),n("CButtonClose",{staticClass:"text-white",on:{click:function(t){e.createTaskModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[n("CButton",{attrs:{color:"danger"},on:{click:function(t){e.createTaskModal=!1}}},[e._v("取消")]),n("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:e.createNewTask}},[e._v("新建")])]},proxy:!0}])},[n("CInput",{attrs:{label:"名称",placeholder:"请输入测试任务名称"},model:{value:e.newTask.title,callback:function(t){e.$set(e.newTask,"title",t)},expression:"newTask.title"}}),n("CInput",{attrs:{label:"描述",placeholder:"输入测试任务描述"},model:{value:e.newTask.description,callback:function(t){e.$set(e.newTask,"description",t)},expression:"newTask.description"}}),n("p",{staticStyle:{marginBottom:"10px",marginTop:"10px"}},[e._v("所属软件")]),n("el-select",{staticStyle:{width:"100%"},attrs:{clearable:"",placeholder:"请选择软件"},on:{change:e.selectSoftware},model:{value:e.newTask.softwareId,callback:function(t){e.$set(e.newTask,"softwareId",t)},expression:"newTask.softwareId"}},e._l(e.softwareList,(function(e){return n("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1),n("p",{staticStyle:{marginBottom:"10px",marginTop:"10px"}},[e._v("所属计划")]),n("el-select",{staticStyle:{width:"100%"},attrs:{clearable:"",placeholder:"请选择版本"},model:{value:e.newTask.plan,callback:function(t){e.$set(e.newTask,"plan",t)},expression:"newTask.plan"}},e._l(e.plans,(function(e){return n("el-option",{key:e.id,attrs:{label:e.title,value:e.id}})})),1),n("p",{staticStyle:{marginBottom:"10px",marginTop:"10px"}},[e._v("负责人")]),n("el-tree",{attrs:{data:e.groupList,"show-checkbox":"","node-key":"id","default-expand-all":"","expand-on-click-node":!1,props:e.defaultProps},on:{"check-change":e.handleCheckChange}}),n("p",{staticStyle:{marginBottom:"6px",marginTop:"10px"}},[e._v("请上传测试任务说明文档")]),n("el-upload",{ref:"newTaskUploader",staticClass:"upload-demo",attrs:{action:"","auto-upload":!1,multiple:!0,"file-list":e.fileList}},[n("el-button",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},attrs:{size:"small"}},[e._v("点击上传")]),n("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[e._v("文件大小限制不超过20M")])],1)],1),n("CCard",[n("CCardBody",[n("CDataTable",{attrs:{items:e.taskList,fields:e.taskFields,"items-per-page":8,tableFilter:{label:"搜索",placeholder:"输入任意信息检索"},noItemsView:{noResults:"无结果",noItems:"无测试任务"},hover:"",pagination:{doubleArrows:!0,align:"center"}},scopedSlots:e._u([{key:"state",fn:function(t){var r=t.item;return[n("td",[n("CBadge",{staticStyle:{fontSize:"14px",height:"25px","line-height":"20px"},attrs:{color:e.getBadge(r.state)}},[e._v(" "+e._s(e._f("taskStateFilter")(r.state))+" ")])],1)]}},{key:"opt_details",fn:function(t){var r=t.item,a=t.index;return[e.checkPerm("CHECK")?n("td",{staticClass:"py-2"},[n("CButton",{staticStyle:{width:"50px"},attrs:{color:"success",variant:"outline",square:"",size:"sm"},on:{click:function(t){return e.gotoTask(r,a)}}},[e._v(" 查看 ")])],1):e._e()]}},{key:"opt_delete",fn:function(t){var r=t.item,a=t.index;return[e.checkPerm("DELETE")?n("td",{staticClass:"py-2"},[n("CButton",{staticStyle:{width:"50px"},attrs:{color:"danger",variant:"outline",square:"",size:"sm"},on:{click:function(t){return e.deleteTaskFirstStep(r,a)}}},[e._v(" 删除 ")])],1):e._e()]}}])})],1)],1),n("CModal",{attrs:{show:e.deleteTaskModal,"no-close-on-backdrop":!0,centered:!0,title:"Modal title 2",size:"lg",color:"danger"},on:{"update:show":function(t){e.deleteTaskModal=t}},scopedSlots:e._u([{key:"header",fn:function(){return[n("h6",{staticClass:"modal-title"},[e._v("删除测试任务")]),n("CButtonClose",{staticClass:"text-white",on:{click:function(t){e.deleteTaskModal=!1}}})]},proxy:!0},{key:"footer",fn:function(){return[n("CButton",{attrs:{color:"danger"},on:{click:function(t){e.deleteTaskModal=!1}}},[e._v("取消")]),n("CButton",{staticStyle:{backgroundColor:"rgb(50,31,219)",color:"white"},on:{click:e.deleteTaskNow}},[e._v("删除")])]},proxy:!0}])},[n("h5",[e._v("你确定删除该任务吗?删除后将无法查看任何与该任务的相关信息!")])])],1)},a=[],o=n("1619"),i=n("90c2"),s=n("1684"),l=n("3f13"),c=n("e350"),u=n("c24f");function d(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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 o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw o}}}}function f(e,t){if(e){if("string"===typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var p={name:"testTask",filters:{taskStateFilter:o["d"]},data:function(){return{createTaskModal:!1,deleteTaskModal:!1,defaultProps:{children:"children",label:"label"},newTask:{},taskList:[],groupList:[{id:1,label:"Level one 1",children:[{id:4,label:"Level two 1-1",children:[{id:9,label:"Level three 1-1-1"},{id:10,label:"Level three 1-1-2"}]}]},{id:2,label:"Level one 2",children:[{id:5,label:"Level two 2-1"},{id:6,label:"Level two 2-2"}]},{id:3,label:"Level one 3",children:[{id:7,label:"Level two 3-1"},{id:8,label:"Level two 3-2"}]}],value:[],idValue:[],taskFields:[{key:"title",label:"任务名称",_style:"min-width:100px"},{key:"description",label:"描述",_style:"min-width:200px"},{key:"software_name",label:"所属软件",_style:"min-width:100px"},{key:"version",label:"所属版本",_style:"min-width:100px"},{key:"plan_name",label:"所属计划",_style:"min-width:200px"},{key:"state",label:"状态",sorter:!1,filter:!1,_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_delete",label:"",_style:"min-width:10px;"}],versions:[],softwareId:"",plans:[],softwareList:[],userList:[],fileList:[],checkedList:[]}},mounted:function(){var e=this;this.softwareId=localStorage.getItem("softwareId"),this.getTasks("","","",localStorage.getItem("userId"),""),Object(s["e"])("","","").then((function(t){e.softwareList=t})),Object(u["b"])(localStorage.getItem("userId")).then((function(t){console.log(t,"userList testTask outside");var n=[];t.groupList.map((function(e){var t={};t.id=e.groupName,t.label=e.groupName,t.children=e.userList.map((function(e){return{id:e.userid,label:e.username}})),n.push(t)})),console.log(n,"tmpArr"),e.groupList=n}))},computed:{},watch:{},methods:{handleCheckChange:function(e,t,n){if(console.log(e,t,n),t)e.children||this.checkedList.includes(e.id)||(this.checkedList.push(e.id),console.log(this.checkedList,"push checkedList"));else if(!e.children&&this.checkedList.includes(e.id)){console.log("include this.checkedList",this.checkedList);var r=this.checkedList.indexOf(e.id);console.log(r,"index"),this.checkedList.splice(r,1),console.log(this.checkedList)}console.log(this.checkedList,"checkedList")},getTasks:function(e,t,n,r,a){var s=this;Object(i["f"])(e,t,n,r,a).then((function(e){s.taskList=Object(o["c"])(e)}))},getBadge:function(e){switch(e){case 0:return"secondary";case 1:return"success";case 2:return"primary";default:}},gotoTask:function(e,t){localStorage.setItem("softwareId",e.software_id),localStorage.setItem("taskId",e.id),this.$router.push("/softwareTestTaskDetail/"+e.id)},deleteTaskFirstStep:function(e,t){this.deleteTaskModal=!0,this.taskSelected=e},deleteTaskNow:function(){var e=this;this.deleteTaskModal=!1,Object(i["c"])(this.taskSelected.id).then((function(t){e.getTasks("","","",localStorage.getItem("userId"),"")}))},createNewTask:function(){var e=this;if(""!=this.newTask.title&&""!=this.newTask.description&&""!=this.newTask.softwareId&&""!=this.newTask.plan&&this.newTask.userList!=[])if(this.$refs["newTaskUploader"].uploadFiles.length<1)this.$message.warning("文件数量至少为 1 !");else{var t,n,r=new FormData,a="",o=d(this.checkedList);try{for(o.s();!(n=o.n()).done;){var s=n.value;a+="&&"+s}}catch(l){o.e(l)}finally{o.f()}a=a.slice(2),r.append("executors",a),this.$refs["newTaskUploader"].uploadFiles.length>=1&&this.$refs["newTaskUploader"].uploadFiles.forEach((function(n,a){if(t=n.size/1024/1024<20,!t)return e.$message.info("单个文件大小不能超过20M"),!1;r.append("files",n.raw)})),r.append("title",this.newTask.title),r.append("description",this.newTask.description),r.append("plan_id",this.newTask.plan),Object(i["b"])(r).then((function(t){for(var n in e.createTaskModal=!1,e.newTask)delete e.newTask[n];e.getTasks("","","",localStorage.getItem("userId"),"")}))}else this.$message.warning("请完整填写任务信息!")},checkTaskDetail:function(e){Object(i["a"])(e).then((function(e){}))},selectSoftware:function(){var e=this;Object(l["e"])("","","",this.newTask.softwareId,"").then((function(t){e.plans=t}))},checkPerm:function(e){return Object(c["a"])(localStorage.getItem("identity"),e)},onChange:function(e){console.log(e,"onchange"),console.log(this.value,"onchange")},selectAll:function(e,t){var n=this;console.log(e,t,"val, id, 全选");var r=this.groupList.find((function(e){return e.groupName===t}));console.log("全选后selectOption",r);var a=r.userList.map((function(e){return e.username}));console.log("全选后arr",a);var o=r.userList.map((function(e){return e.userid}));console.log("全选后idarr",o),e?(a.forEach((function(e){n.value.includes(e)||n.value.push(e)})),o.forEach((function(e){n.idValue.includes(e)||n.idValue.push(e)}))):(this.value.forEach((function(e,t){a.includes(e)&&n.value.splice(t,1,"")})),this.idValue.forEach((function(e,t){o.includes(e)&&n.idValue.splice(t,1,"")}))),this.value=this.value.filter((function(e){return""!==e})),this.idValue=this.idValue.filter((function(e){return""!==e})),console.log(this.idValue,"this.idValue"),console.log(this.value,"this.value")},changeSelect:function(e){console.log(e,"select val")}}},k=p,m=n("2877"),v=Object(m["a"])(k,r,a,!1,null,"4fd5f234",null);t["default"]=v.exports},e350:function(e,t,n){"use strict";function r(e,t){var n=a[e];return n.includes(t)}n.d(t,"a",(function(){return r}));var a=[["CHECK","EDIT","DELETE","CREATE","EXECUTE","DELETE","CONFIRM","EXPORT"],["CHECK","EDIT","DELETE","CREATE","EXECUTE","DELETE","CONFIRM","EXPORT"],["CHECK","EXECUTE"]]}}]);
|