(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["eefa5b2e"],{"244b":function(t,e,n){},3830:function(t,e,n){"use strict";var a=n("244b"),i=n.n(a);i.a},"76c6":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",{staticClass:"full-height bg-white page-content content padding-20 add-edit-maintenance-plan scrollbar"},[n("q-form",{ref:"myForm",staticClass:"dialog-content form-inline block no-padding full-height",attrs:{greedy:""},on:{submit:t.onSubmit,reset:t.onReset}},[n("div",{staticClass:"overflow-hidden-x scrollbar",staticStyle:{height:"calc(100% - 40px)"}},[n("deviceInfo",{ref:"deviceInfo",tag:"components",attrs:{title:"设备信息"},on:{getDevice:t.getDevice}}),n("q-separator",{staticClass:"qa-line"}),n("maintenance-info",{ref:"maintenanceInfo",attrs:{title:"保养信息"}},[n("part-table",{ref:"partTableRef",attrs:{slot:"part"},slot:"part"})],1)],1),n("q-separator",{staticStyle:{flex:"0"}}),n("div",{staticClass:"dialog-footer text-center margin-t-10"},[n("q-btn",{staticClass:"q-mr-md",attrs:{outline:"",label:"取消",color:"primary",type:"reset"}}),n("q-btn",{attrs:{unelevated:"",label:"确认",color:"primary",type:"submit"}})],1)],1),n("q-inner-loading",{staticStyle:{"z-index":"99"},attrs:{showing:t.isLoading}},[n("q-spinner-gears",{attrs:{size:"50px",color:"primary"}})],1)],1)},i=[],r=(n("456d"),n("8a81"),n("9986"),n("8e6e"),n("c973")),s=n.n(r),o=n("9523"),c=n.n(o),l=n("a34a"),f=n.n(l),d=(n("6d67"),n("d25f"),n("2fdb"),n("6762"),n("b54a"),n("c18d")),p=n("2ef0"),u=n.n(p),h=n("8bfe"),m=n("2f62"),g=n("a608"),b=n("ca08");function v(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function w(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?v(Object(n),!0).forEach((function(e){c()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var y={name:"add-maintenance-plan",components:{PartTable:b["a"],deviceInfo:d["a"],maintenanceInfo:h["a"]},data:function(){return{isLoading:!1,deviceList:[],cloneData:[],workShopId:null,shiftsId:null}},computed:w({},Object(m["c"])(["footprint"])),methods:w({refreshData:function(){this.cloneData=[],this.deviceList=[],this.workShopId=null,this.shiftsId=null,this.$refs.deviceInfo.refreshData(),this.$refs.maintenanceInfo.refreshData();var t=this;this.$nextTick((function(){t.$refs.myForm.resetValidation()}))},onSubmit:function(){var t=this.deviceList.map((function(t){return t.id})),e=this.$refs.partTableRef.tableData,n=w(w(w({},this.uniqDeviceData(t)),this.$refs.maintenanceInfo.setData()),{},{spareParts:e.map((function(t){return{count:t.count,sparePartId:t.id}}))});u.a.isEmpty(e)||!e.some((function(t){return""===t.count}))?u.a.isEmpty(this.deviceList)?this.$message.warning("请添加设备"):u.a.isEmpty(n.assignedDate)?this.$message.warning("请选择派单时间"):2!==n.assignedCriteria||n.assignedOperatorIds.length?u.a.isEmpty(n.programId)?this.$message.warning("请添加保养项目"):this.onAddPlan(n):this.$message.warning("请选择指定人员"):this.$message.warning("请填写数量")},getDevice:function(t){this.deviceList=t;var e=u.a.get(t[0],"workShopId","");this.workShopId===e&&""!==this.workShopId||(this.workShopId=e,this.$refs.maintenanceInfo.getShiftsList(this.workShopId,this.shiftsId))},uniqDeviceData:function(t){return{deviceIds:t}},onReset:function(){var t=this.footprint.filter((function(t){return!t.link.includes("add-maintenance-plan")}));this.set_footprint(t),this.refreshData(),this.$router.push({path:"/main/repair/maintenance-plan"})},onAddPlan:function(t){var e=this;return s()(f.a.mark((function n(){var a;return f.a.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.prev=0,e.isLoading=!0,n.next=4,Object(g["a"])(t);case 4:a=n.sent,a.success&&(e.isLoading=!1,e.onReset(),e.$message.success("新增成功")),n.next=11;break;case 8:n.prev=8,n.t0=n["catch"](0),e.isLoading=!1;case 11:case"end":return n.stop()}}),n,null,[[0,8]])})))()}},Object(m["d"])({set_footprint:"SET_FOOTPRINT"})),mounted:function(){}},I=y,O=(n("3830"),n("2877")),D=Object(O["a"])(I,a,i,!1,null,"768f031e",null);e["default"]=D.exports}}]);