1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3050cccd"],{"16c2":function(t,e,i){},b58d:function(t,e,i){"use strict";i("16c2")},deb2:function(t,e,i){"use strict";i.r(e);var o=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"app-container"},[i("div",{staticClass:"scheduling_head"},[i("div",{staticClass:"head_lable"},[t._v("产品编号:")]),t._l(t.liveroomList,(function(e,o){return i("div",{key:o,staticClass:"scheduling_tab",class:t.activeName==e.id?"active":"",on:{click:function(e){return t.handleClick(o)}}},[t._v(" "+t._s(e.name)+" ")])})),i("el-button",{staticStyle:{"margin-left":"210px"},attrs:{type:"primary"},on:{click:t.handleEdit}},[t._v("编辑")])],2),i("div",{staticClass:"scheduling_tab_pana"},t._l(t.roomWorksList,(function(e){return i("div",{staticClass:"table-list"},[i("div",{staticClass:"table-list_item"},[i("div",{staticClass:"tit"},[t._v(" "+t._s(e.date)+" ")])]),i("div",{staticClass:"table-list_item"},[i("div",{staticClass:"tit"},[t._v(" "+t._s(e.date_name)),i("i",{staticClass:"el-icon-circle-plus",on:{click:function(i){return t.handleAdds("",e.date)}}})])]),t._l(e.work,(function(o){return i("div",{staticClass:"table-list-box"},[i("div",{staticClass:"border",on:{dblclick:function(i){return t.handleAdds(o,e.date)}}},[i("div",{staticStyle:{"margin-bottom":"10px"}},[t._v(" AM "+t._s(t.extractTime(o.start))+"~"+t._s(t.extractTime(o.end))+" ")]),i("div",[t._v("主播:"+t._s(o.zhubo.name))]),i("div",[t._v("中控:"+t._s(o.zhongkong.name))]),i("div",[t._v("路线:"+t._s(o.route?o.route:"无"))])])])}))],2)})),0),t.addOrUpdateVisible?i("liveroom-update",{ref:"addOrUpdate",on:{update:t.saveProducts}}):t._e(),t.roomVisible?i("roomWorksUpdate",{ref:"roomUpdate",attrs:{title:t.title},on:{update:t.saveRoomWorks}}):t._e()],1)},r=[],a=i("5530"),s=i("c7eb"),n=i("1da1"),l=(i("99af"),i("ac1f"),i("466d"),i("b775"));function c(){return Object(l["a"])({url:"/admin/liveroom/index",method:"get"})}function d(t){return Object(l["a"])({url:"/admin/liveroom/roomWorks",method:"get",params:{live_room_id:t}})}function u(t){return Object(l["a"])({url:"/admin/liveroom/availableZhubo",method:"get",params:t})}function m(t){return Object(l["a"])({url:"/admin/liveroom/saveProducts",method:"post",data:t})}function f(t){return Object(l["a"])({url:"/admin/liveroom/saveRoomWorks",method:"post",data:t})}var h=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("el-dialog",{attrs:{title:"编辑直播间",visible:t.dialogVisible,width:"30%","before-close":t.handleClose},on:{"update:visible":function(e){t.dialogVisible=e}}},[i("el-form",{ref:"form",attrs:{model:t.form,"label-width":"80px"}},[i("el-form-item",{attrs:{label:"直播间id",prop:"product_ids"}},[i("el-input",{model:{value:t.form.product_ids,callback:function(e){t.$set(t.form,"product_ids",e)},expression:"form.product_ids"}})],1)],1),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(e){t.dialogVisible=!1}}},[t._v("取 消")]),i("el-button",{attrs:{type:"primary"},on:{click:t.handleEdit}},[t._v("确 定")])],1)],1)},v=[],p={props:{},data:function(){return{dialogVisible:!1,form:{product_ids:"",live_room_id:""}}},methods:{init:function(t,e){this.dialogVisible=!0,this.form.product_ids=e,this.form.live_room_id=t,console.log(this.form)},handleClose:function(){this.dialogVisible=!1},handleEdit:function(){this.dialogVisible=!1,this.$emit("update",this.form)}}},b=p,_=i("2877"),g=Object(_["a"])(b,h,v,!1,null,"545e3cb5",null),k=g.exports,x=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("el-dialog",{attrs:{title:t.title,visible:t.dialogVisible,width:"30%","before-close":t.handleClose},on:{"update:visible":function(e){t.dialogVisible=e}}},[i("el-form",{ref:"form",attrs:{rules:t.rules,model:t.form,"label-width":"80px"}},[i("el-form-item",{attrs:{label:"直播间",prop:"live_room_id"}},[i("el-select",{attrs:{placeholder:"请选择直播间"},model:{value:t.form.live_room_id,callback:function(e){t.$set(t.form,"live_room_id",e)},expression:"form.live_room_id"}},t._l(t.liveroomList,(function(t){return i("el-option",{attrs:{label:t.name,value:t.id}})})),1)],1),i("el-form-item",{attrs:{label:"时间"}},[i("el-time-select",{attrs:{placeholder:"起始时间","picker-options":{start:"08:00",step:"00:15",end:"24:00"}},model:{value:t.startTime,callback:function(e){t.startTime=e},expression:"startTime"}}),i("el-time-select",{attrs:{placeholder:"结束时间","picker-options":{start:"08:00",step:"00:15",end:"24:00",minTime:t.startTime}},on:{change:t.handleDate},model:{value:t.endTime,callback:function(e){t.endTime=e},expression:"endTime"}})],1),i("el-form-item",{attrs:{label:"主播",prop:"zhubo_id"}},[i("el-select",{attrs:{placeholder:"请选择主播"},model:{value:t.form.zhubo_id,callback:function(e){t.$set(t.form,"zhubo_id",e)},expression:"form.zhubo_id"}},t._l(t.zhuboList,(function(t){return i("el-option",{attrs:{label:t.name,value:t.id,disabled:t.disabled}})})),1)],1),i("el-form-item",{attrs:{label:"中控",prop:"zhongkong_id"}},[i("el-select",{attrs:{placeholder:"请选择中控"},model:{value:t.form.zhongkong_id,callback:function(e){t.$set(t.form,"zhongkong_id",e)},expression:"form.zhongkong_id"}},t._l(t.zhongkongList,(function(t){return i("el-option",{attrs:{label:t.name,value:t.id,disabled:t.disabled}})})),1)],1),i("el-form-item",{attrs:{label:"路线"}},[i("el-input",{model:{value:t.form.route,callback:function(e){t.$set(t.form,"route",e)},expression:"form.route"}})],1)],1),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(e){t.dialogVisible=!1}}},[t._v("取 消")]),i("el-button",{attrs:{type:"primary"},on:{click:t.handleEdit}},[t._v("确 定")])],1)],1)},w=[],O={props:{title:{type:String,default:"添加排班"}},data:function(){return{dialogVisible:!1,startTime:"",endTime:"",form:{live_room_id:"",start:"",end:"",zhubo_id:"",zhongkong_id:"",route:""},zhuboList:[],zhongkongList:[],liveroomList:[],dayDate:"",rules:{live_room_id:[{required:!0,message:"请选择直播间",trigger:"change"}],zhongkong_id:[{required:!0,message:"请选择中控",trigger:"change"}],zhubo_id:[{required:!0,message:"请选择主播",trigger:"change"}]}}},watch:{form:function(){this.handleDate()}},methods:{extractTime:function(t){var e=/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,i=t.match(e);if(!i)throw new Error("不匹配");return"".concat(i[4],":").concat(i[5])},init:function(t,e,i){var o=this;this.dialogVisible=!0,this.$nextTick((function(r){o.$refs["form"].resetFields(),o.dayDate=i,o.form=e.id?e:{live_room_id:"",start:"",end:"",zhubo_id:"",zhongkong_id:""},o.form.live_room_id=t,o.startTime=e.id?o.extractTime(o.form.start):"",o.endTime=e.id?o.extractTime(o.form.end):"",console.log(o.startTime),console.log(o.endTime)})),this.liveroom()},liveroom:function(){var t=this;return Object(n["a"])(Object(s["a"])().mark((function e(){var i,o;return Object(s["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,c();case 3:i=e.sent,o=i.data,t.liveroomList=o,e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](0),console.log(e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})))()},handleClose:function(){this.dialogVisible=!1},handleDate:function(){var t=this;this.form.end="".concat(this.dayDate," ").concat(this.endTime,":00"),this.form.start="".concat(this.dayDate," ").concat(this.startTime,":00"),this.form.end&&this.form.start&&(u(Object(a["a"])(Object(a["a"])({},this.form),{},{type:2})).then((function(e){t.zhuboList=e.data})),u(Object(a["a"])(Object(a["a"])({},this.form),{},{type:3})).then((function(e){t.zhongkongList=e.data})))},handleEdit:function(){this.dialogVisible=!1,this.$emit("update",this.form)}}},T=O,j=Object(_["a"])(T,x,w,!1,null,"e99f666c",null),C=j.exports,z={name:"Scheduling",data:function(){return{list:[],activeName:"",listLoading:!0,title:"添加排班",listQuery:{page:1,limit:20,title:"",status:""},total:0,dialogVisible:!1,dialogType:"new",liveroomList:[],roomWorksList:[],product_ids:"",live_room_id:"",addOrUpdateVisible:!1,roomVisible:!1}},components:{liveroomUpdate:k,roomWorksUpdate:C},mounted:function(){var t=this;return Object(n["a"])(Object(s["a"])().mark((function e(){return Object(s["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.liveroom();case 2:t.roomWorks();case 3:case"end":return e.stop()}}),e)})))()},methods:{extractTime:function(t){var e=/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,i=t.match(e);if(!i)throw new Error("不匹配");return"".concat(i[4],":").concat(i[5],":").concat(i[6])},isCurrentTimeAfter:function(t){var e=new Date(t),i=new Date;return i>=e},liveroom:function(){var t=this;return Object(n["a"])(Object(s["a"])().mark((function e(){var i,o;return Object(s["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,c();case 3:i=e.sent,o=i.data,t.liveroomList=o,t.activeName=t.liveroomList[0].id+"",t.live_room_id=t.liveroomList[0].id,t.product_ids=t.liveroomList[0].product_ids,e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](0),console.log(e.t0);case 14:case"end":return e.stop()}}),e,null,[[0,11]])})))()},roomWorks:function(){var t=this;return Object(n["a"])(Object(s["a"])().mark((function e(){var i,o;return Object(s["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d(t.live_room_id);case 3:i=e.sent,o=i.data,t.roomWorksList=o,e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](0),console.log(e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})))()},handleClick:function(t){var e=this.liveroomList[t],i=e.id,o=e.product_ids;this.live_room_id=i,this.product_ids=o,this.activeName=i+"",this.roomWorks()},handleEdit:function(){var t=this;this.addOrUpdateVisible=!0,this.$nextTick((function(){t.$refs["addOrUpdate"].init(t.live_room_id,t.product_ids)}))},handleAdds:function(t,e){var i=this;if(console.log(t),this.title=t.id?"编辑排班":"添加排班",t.id&&this.isCurrentTimeAfter(t.start))return this.$message.error("当前时间无法编辑");this.roomVisible=!0,this.$nextTick((function(){i.$refs["roomUpdate"].init(i.live_room_id,Object(a["a"])({},t),e)}))},saveProducts:function(t){var e=this;this.liveroom(),m(t).then((function(t){e.$message({message:"直播间编辑成功",type:"success"})}))},saveRoomWorks:function(t){var e=this;f(t).then((function(t){e.roomWorks(),e.$message({message:"添加排班成功",type:"success"})}))},handleAdd:function(){}}},V=z,$=(i("b58d"),Object(_["a"])(V,o,r,!1,null,"97931c7e",null));e["default"]=$.exports}}]); |