yxk_pc_mdh/gyhl/static/js/111.136f98cd0cc17971cbff.js

1 line
16 KiB
JavaScript

webpackJsonp([111],{"/cnf":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a("5P9n"),i={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"sys-box repair-box"},[a("div",{staticClass:"sys-operate"},[a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.back()}}},[e._v(e._s(e.config.cancelText))]),e._v(" "),a("el-button",{attrs:{type:"primary",disabled:e.isDisabled},on:{click:function(t){return e.tempSave("form")}}},[e._v("暂存")]),e._v(" "),a("el-button",{attrs:{type:"primary",disabled:e.isDisabled},on:{click:function(t){return e.save("form")}}},[e._v("提交")])],1),e._v(" "),a("div",{staticClass:"sys-form"},[a("el-divider",{attrs:{"content-position":"left"}},[e._v("维修记录")]),e._v(" "),a("el-form",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"form",attrs:{"label-width":"120px",model:e.formData,rules:e.ruleForm}},[a("div",{staticClass:"flex"},[a("el-form-item",{staticClass:"form-inline form-half",attrs:{label:"实际开工时间",prop:"startTime"}},[a("el-date-picker",{attrs:{type:"datetime",placeholder:"选择实际开工时间","value-format":"yyyy-MM-dd HH:mm:ss"},model:{value:e.formData.startTime,callback:function(t){e.$set(e.formData,"startTime",t)},expression:"formData.startTime"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline form-half",attrs:{label:"实际完工时间",prop:"endTime"}},[a("el-date-picker",{attrs:{type:"datetime",placeholder:"选择实际完工时间","value-format":"yyyy-MM-dd HH:mm:ss"},model:{value:e.formData.endTime,callback:function(t){e.$set(e.formData,"endTime",t)},expression:"formData.endTime"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline form-half",attrs:{label:"故障类型"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择"},model:{value:e.formData.type,callback:function(t){e.$set(e.formData,"type",t)},expression:"formData.type"}},e._l(e.hitchList,function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})}),1)],1),e._v(" "),a("el-form-item",{staticClass:"form-half",attrs:{label:"停机时长(小时)"}},[a("el-input-number",{attrs:{placeholder:"停机时长",min:0},model:{value:e.formData.offHour,callback:function(t){e.$set(e.formData,"offHour",t)},expression:"formData.offHour"}})],1)],1),e._v(" "),a("el-form-item",{attrs:{label:"故障原因",prop:"cause"}},[a("el-input",{attrs:{type:"textarea",autosize:{minRows:4},placeholder:"请简要描述故障原因"},model:{value:e.formData.cause,callback:function(t){e.$set(e.formData,"cause",t)},expression:"formData.cause"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"维修方案"}},[a("el-input",{attrs:{type:"textarea",autosize:{minRows:4},placeholder:"请简要填写维修方案"},model:{value:e.formData.solution,callback:function(t){e.$set(e.formData,"solution",t)},expression:"formData.solution"}})],1),e._v(" "),a("div",{staticClass:"flex"},[a("el-form-item",{staticClass:"form-inline",attrs:{label:"维修工时(小时)"}},[a("el-input-number",{staticStyle:{width:"103%"},attrs:{placeholder:"维修工时",min:0},model:{value:e.formData.manHour,callback:function(t){e.$set(e.formData,"manHour",t)},expression:"formData.manHour"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"工时费(元)"}},[a("el-input-number",{staticStyle:{width:"103%"},attrs:{min:0},model:{value:e.formData.manHourCost,callback:function(t){e.$set(e.formData,"manHourCost",t)},expression:"formData.manHourCost"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"维修费(元)"}},[a("el-input-number",{staticStyle:{width:"103%"},attrs:{placeholder:"维修费用",disabled:"",min:0},model:{value:e.formData.cost,callback:function(t){e.$set(e.formData,"cost",t)},expression:"formData.cost"}})],1)],1),e._v(" "),a("el-form-item",{attrs:{label:"使用状况",prop:"usage"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{filterable:"",clearable:"",placeholder:"请选择使用状况"},model:{value:e.formData.usage,callback:function(t){e.$set(e.formData,"usage",t)},expression:"formData.usage"}},e._l(e.deviceStatusList,function(e){return a("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"完工拍照"}},[a("el-upload",{directives:[{name:"loading",rawName:"v-loading.lock",value:e.fullscreenLoading,expression:"fullscreenLoading",modifiers:{lock:!0}}],ref:"upload",attrs:{accept:".png,.jpg,.jpeg",action:e.uploadUrl,"list-type":"picture-card","on-preview":e.handlePictureCardPreview,"on-success":e.uploadSuccess,"on-remove":e.handleRemove,"file-list":e.repairRecordImages,"auto-upload":e.auto_upload,"on-change":e.onChange}},[a("i",{staticClass:"el-icon-plus"})])],1),e._v(" "),a("el-divider",{attrs:{"content-position":"left"}},[e._v("使用备件")]),e._v(" "),a("el-form-item",{attrs:{label:""}},[a("div",{staticClass:"sys-operate"},[a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.choosePartsVisible=!0}}},[e._v("选择备件")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.removePart()}}},[e._v("删除")])],1),e._v(" "),a("el-table",{attrs:{data:e.parts,"header-cell-style":{fontWeight:"normal",textAlign:"center",backgroundColor:"#eceff4",color:"#222"},border:""},on:{"selection-change":e.handlePartChange}},[a("el-table-column",{attrs:{type:"selection",width:"55",align:"center"}}),e._v(" "),a("el-table-column",{attrs:{prop:"serialNo",label:"备件编号",align:"center"}}),e._v(" "),a("el-table-column",{attrs:{prop:"name",width:"200",align:"center","show-overflow-tooltip":"",label:"备件名称"}}),e._v(" "),a("el-table-column",{attrs:{prop:"specification",align:"center","show-overflow-tooltip":"",label:"备件型号"}}),e._v(" "),a("el-table-column",{attrs:{prop:"amount",align:"center",width:"120",label:"使用数量"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-input-number",{staticClass:"inputClass",staticStyle:{width:"100%"},attrs:{min:0,size:"small","controls-position":"right"},model:{value:t.row.amount,callback:function(a){e.$set(t.row,"amount",a)},expression:"scope.row.amount"}})]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"price",align:"center",width:"120",label:"单价(元)"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-input-number",{staticClass:"inputClass",staticStyle:{width:"100%"},attrs:{min:0,size:"small","controls-position":"right"},model:{value:t.row.price,callback:function(a){e.$set(t.row,"price",a)},expression:"scope.row.price"}})]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"unitUomName",align:"center",label:"单位"}}),e._v(" "),a("el-table-column",{attrs:{prop:"desc","show-overflow-tooltipalign":"",label:"备注"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-input",{staticClass:"inputClass",staticStyle:{width:"100%"},attrs:{size:"small","controls-position":"right"},model:{value:t.row.desc,callback:function(a){e.$set(t.row,"desc",a)},expression:"scope.row.desc"}})]}}])})],1)],1)],1)],1),e._v(" "),a("el-dialog",{attrs:{visible:e.dialogVisible},on:{"update:visible":function(t){e.dialogVisible=t}}},[a("img",{attrs:{width:"100%",src:e.dialogImageUrl,alt:""}})]),e._v(" "),a("ChooseParts",{attrs:{visible:e.choosePartsVisible},on:{"update:visible":function(t){e.choosePartsVisible=t},change:e.getPart}})],1)},staticRenderFns:[]};var s=function(e){a("hPqz"),a("oWaH")},o=a("VU/8")(r.a,i,!1,s,"data-v-1aaae304",null);t.default=o.exports},"5P9n":function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify__=__webpack_require__("mvHQ"),__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify__),__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_slicedToArray__=__webpack_require__("d7EF"),__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_slicedToArray___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_slicedToArray__),__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise__=__webpack_require__("//Fk"),__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise__),__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_assign__=__webpack_require__("woOf"),__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_assign___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_assign__),__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends__=__webpack_require__("Dd8w"),__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends__),__WEBPACK_IMPORTED_MODULE_5__components_System_dialogChooseParts__=__webpack_require__("CdUU"),__WEBPACK_IMPORTED_MODULE_6_vuex__=__webpack_require__("NYxO"),__WEBPACK_IMPORTED_MODULE_7__utils_config_js__=__webpack_require__("bzuE"),__WEBPACK_IMPORTED_MODULE_8__api_base_js__=__webpack_require__("Dod7"),__WEBPACK_IMPORTED_MODULE_9__utils_conversion_js__=__webpack_require__("Xnfr"),__WEBPACK_IMPORTED_MODULE_10_element_ui__=__webpack_require__("zL8q"),__WEBPACK_IMPORTED_MODULE_10_element_ui___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_element_ui__);__webpack_exports__.a={name:"repair_handle",components:{ChooseParts:__WEBPACK_IMPORTED_MODULE_5__components_System_dialogChooseParts__.a},data:function(){return{fullscreenLoading:!1,auto_upload:!1,uploadUrl:__WEBPACK_IMPORTED_MODULE_8__api_base_js__.a.uploadUrl,ftpPrefix:__WEBPACK_IMPORTED_MODULE_8__api_base_js__.a.ftpPrefix,formDetail:{},formData:{targetList:[],taglocationappearanceImage:[],type:null,manHour:0,cost:0,offHour:0,manHourCost:0},totalUpkeepCost:"",eventId:"",ruleForm:{startTime:[{required:!0,message:"请选择实际开工时间",trigger:"change"}],endTime:[{required:!0,message:"请选择实际完工时间",trigger:"change"}],cause:[{required:!0,message:"请简要描述故障原因",trigger:"blur"}],usage:[{required:!0,message:"请选择使用状况",trigger:"change"}]},getUserList:[],hitchList:[],deviceStatusList:[],tableData:[],initFilePaths:[],dialogVisible:!1,choosePartsVisible:!1,parts:[],choosePartss:[],dialogImageUrl:"",loading:!1,isDisabled:!1,repairRecordImages:[],redirect:"",config:__WEBPACK_IMPORTED_MODULE_7__utils_config_js__.a}},mounted:function(){this.eventId=this.$route.query.id,this.$route.query.redirect&&(this.redirect=this.$route.query.redirect),this.updateTagNav(this.$route),this.initialize(),this.getDetail()},watch:{formData:{handler:function(e){if(this.parts){var t=0;this.parts.forEach(function(e){t+=e.amount*e.price}),this.totalUpkeepCost=t,this.formData.cost=this.totalUpkeepCost+e.manHourCost}},deep:!0},parts:{handler:function(e){console.log(e);var t=0;this.parts.forEach(function(e){t+=e.amount*e.price}),this.totalUpkeepCost=t,this.totalUpkeepCost=t,this.formData.sparePartsCost=t,console.log(this.totalUpkeepCost),this.formData.cost=this.totalUpkeepCost+this.formData.manHourCost},deep:!0}},methods:__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default()({},Object(__WEBPACK_IMPORTED_MODULE_6_vuex__.d)({removeTagNav:"tagNav/removeTagNav",updateTagNav:"tagNav/updateTagNav"}),{getDetail:function(){var e=this;this.loading=!0,this.$api.repairCheckAPI.getRecordDetailByEventId(this.eventId).then(function(t){if(0===t.code&&t.recordDetail&&(e.formData=__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_assign___default()({},e.formData,t.recordDetail.recordInfo),e.formData.usage=t.recordDetail.recordInfo.usageId,t.recordDetail.mapList&&t.recordDetail.mapList.forEach(function(t){var a={id:t.partId,serialNo:t.code,specification:t.type,num:t.amount,unitUomName:t.unitName,price:t.price,defaultFacilityName:t.facilityName,amount:t.amount,name:t.name,desc:t.content};e.parts.push(a)}),t.recordDetail.repairRecordImage&&t.recordDetail.repairRecordImage.length>0)){e.repairRecordImages=[];for(var a=0;a<t.recordDetail.repairRecordImage.length;a++){var r={name:t.recordDetail.repairRecordImage[a].id,url:e.ftpPrefix+t.recordDetail.repairRecordImage[a].filePath};e.repairRecordImages.push(r),e.formData.taglocationappearanceImage.push(t.recordDetail.repairRecordImage[a].filePath)}}e.loading=!1})},initialize:function(){var e=this;__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default.a.all([this.$api.commonAPI.getUsers(),this.$api.dictAPI.getDictsByType("device_malfunction"),this.$api.dictAPI.getDictsByType("device_status")]).then(function(t){var a=__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_slicedToArray___default()(t,3),r=a[0],i=a[1],s=a[2];0===r.code&&(e.getUserList=r.datas),0===i.code&&(e.hitchList=i.datas,e.hitchList&&(e.formData.type=e.hitchList[0].id)),0===s.code&&(e.deviceStatusList=s.datas)}).catch(function(e){console.log(e)})},back:function(){this.removeTagNav({path:this.$route.path,title:this.$route.meta.name}),this.$router.go(-1)},save_back:function(){this.removeTagNav({path:this.$route.path,title:this.$route.meta.name}),this.redirect?this.$router.push({path:this.redirect,query:{id:this.eventId,t:Date.now()}}):this.$router.push({path:"/wwbx/index",query:{activeName:"second",t:Date.now()}})},tempSave:function(e){var t=this;if(null!=this.parts&&this.parts.length>0){var a=[];this.parts.forEach(function(e){var t=parseInt(e.amount),r="";e.desc&&(r=e.desc);var i={partId:e.id,amount:t,content:r,price:e.price};a.push(i)}),this.formData.partIdArray=__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify___default()(a)}this.$refs[e].validate(function(e){if(!e)return!1;t.formData.eventId=t.eventId,t.isDisabled||(t.isDisabled=!0,t.$api.repairCheckAPI.addRepairRecordTS(t.formData).then(function(e){t.isDisabled=!1,0===e.code?(t.$message({message:e.msg,type:"success"}),t.save_back()):t.$message({message:e.msg,type:"error"})}))})},save:function(e){var t=this;if(null!=this.parts&&this.parts.length>0){var a=[];this.parts.forEach(function(e){var t=parseInt(e.amount),r={partId:e.id,amount:t,content:e.desc,price:e.price};a.push(r)}),this.formData.partIdArray=__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify___default()(a)}this.$refs[e].validate(function(e){if(!e)return!1;t.formData.eventId=t.eventId,t.isDisabled||(t.isDisabled=!0,t.$api.repairCheckAPI.addRepairRecord(t.formData).then(function(e){t.isDisabled=!1,0===e.code?(t.$message({message:e.msg,type:"success"}),t.save_back()):t.$message({message:e.msg,type:"error"})}))})},httpRequest:function httpRequest(upload,name){var _this=this,xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=function(){if(4==xmlhttp.readyState)if(200==xmlhttp.status){_this.fullscreenLoading=!1;var data=eval("("+xmlhttp.responseText+")");0==data.code?(upload.filePath=data.filePath,_this.formData.taglocationappearanceImage.push(data.filePath)):(_this.$message.error("上传失败"),_this.$refs.upload.uploadFiles.splice(_this.$refs.upload.uploadFiles.length-1,1))}else _this.fullscreenLoading=!1,_this.$message.error("上传失败"),_this.$refs.upload.uploadFiles.splice(_this.$refs.upload.uploadFiles.length-1,1)};var tempFormData=new FormData;tempFormData.append("file",upload,name),xmlhttp.open("POST",this.uploadUrl,!0),xmlhttp.send(tempFormData)},onChange:function(e,t){if(e=e.raw,!/image\/\w+/.test(e.type))return this.$message({message:"只能上传图片",type:"warning"}),this.$refs.upload.uploadFiles.splice(this.$refs.upload.uploadFiles.length-1,1),!1;this.fullscreenLoading=!0;var a=this;__WEBPACK_IMPORTED_MODULE_9__utils_conversion_js__.a.compressAccurately(e,400).then(function(t){t.size?a.httpRequest(t,e.name):(a.$message.error("压缩图片失败"),a.fullscreenLoading=!1,a.$refs.upload.uploadFiles.splice(a.$refs.upload.uploadFiles.length-1,1))})},getPart:function(e){var t=this;e&&e.forEach(function(e){console.log(e),t.$set(e,"amount",0),t.$set(e,"price",e.salePrice),e.only=Date.now(),t.parts.push(e)})},removePart:function(){var e=this;this.chooseParts&&this.chooseParts.forEach(function(t){var a=e.parts.findIndex(function(e){if(e.only==t.only)return!0});e.parts.splice(a,1)})},handlePartChange:function(e){this.chooseParts=e},handleRemove:function(e,t){if(e.raw)this.formData.taglocationappearanceImage.splice(this.formData.taglocationappearanceImage.indexOf(e.raw.filePath),1);else{var a=this.formData.taglocationappearanceImage.indexOf(e.url.substr(1));this.formData.taglocationappearanceImage.splice(a,1)}},uploadSuccess:function(e,t){"操作成功"===e.msg&&this.formData.taglocationappearanceImage.push(e.filePath)},handlePictureCardPreview:function(e){this.dialogImageUrl=e.url,this.dialogVisible=!0}})}},hPqz:function(e,t){},oWaH:function(e,t){}});