yxk_pc_mdh/gyhl/static/js/152.1e275c4b597bbc1f86ac.js

1 line
18 KiB
JavaScript

webpackJsonp([152],{BkfF:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=a("mvHQ"),s=a.n(i),o=a("d7EF"),r=a.n(o),n=a("//Fk"),l=a.n(n),c=a("BO1k"),d=a.n(c),u=a("Dd8w"),f=a.n(u),m=a("GKmE"),h=a("ysqt"),p=a("OG67"),g=a("bzuE"),v={name:"ChooseProjects",props:{id:{type:String,default:""},visible:{type:Boolean,default:!1}},watch:{visible:function(e,t){e!==t&&(e&&this.initData(),this.innerVisible=e)},innerVisible:function(e,t){e!==t&&this.$emit("update:visible",e)}},data:function(){return{ruleForm:{name:[{required:!0,message:"请填写保养项目",trigger:"blur"}],function:[{required:!0,message:"请填写保养方法",trigger:"blur"}]},form:{code:"",deviceTepy:"",name:"",function:""},subsetList:[],subsetAll:[],subsetTotal:0,searchData_Subset:{pageno:1,pagesize:5},callBackData:[],innerVisible:this.visible,loading:!1,dialogLoading:!1,deviceType:[],addVisible:!1,config:g.a}},computed:{},methods:{clickRow:function(e){this.$refs.tb.toggleRowSelection(e)},initData:function(){var e=this;this.$api.dictAPI.getDictsByType("device_type").then(function(t){0===t.code&&(e.deviceType=t.datas)}),this.searchSubset()},searchSubset:function(e){var t=this;e&&(this.searchData_Subset.pageno=1),this.dialogLoading=!0,this.$api.upkeepPlanAPI.findProjects(this.searchData_Subset).then(function(e){console.log(e),t.dialogLoading=!1,0===e.code&&(t.subsetList=e.data?e.data.datas:[],t.subsetTotal=e.data?e.data.totalRows:0)})},addProject:function(){this.form={},this.addVisible=!0,this.resetFields()},save:function(e){var t=this;this.$refs[e].validate(function(e){if(!e)return!1;t.$api.upkeepPlanAPI.addProjects(t.form).then(function(e){0===e.code?(t.$message({message:e.msg,type:"success"}),t.addVisible=!1,t.searchSubset()):t.$message({message:e.msg,type:"error"})})})},ckSubsetAll:function(e){this.subsetAll=e},subsetSizeChange:function(e){this.searchData_Subset.pagesize=e,this.searchSubset()},subsetCurrentChange:function(e){this.searchData_Subset.pageno=e,this.searchSubset()},submit:function(e){var t=[];this.subsetAll.length>0&&this.subsetAll.forEach(function(e){t.push(e)}),console.log(t),this.$emit("change",t),this.innerVisible=!1},resetFields:function(){this.$refs.form&&this.$refs.form.resetFields()}}},b={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("el-dialog",{attrs:{center:"",title:"选择保养项目",visible:e.innerVisible,width:"900px"},on:{"update:visible":function(t){e.innerVisible=t}}},[a("div",[a("el-form",{attrs:{inline:""}},[a("el-form-item",{attrs:{label:"保养项目"}},[a("el-input",{attrs:{placeholder:"保养项目"},model:{value:e.searchData_Subset.name,callback:function(t){e.$set(e.searchData_Subset,"name",t)},expression:"searchData_Subset.name"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"保养方法"}},[a("el-input",{attrs:{placeholder:"保养方法"},model:{value:e.searchData_Subset.function,callback:function(t){e.$set(e.searchData_Subset,"function",t)},expression:"searchData_Subset.function"}})],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.searchSubset(1)}}},[e._v("查询")])],1)],1)],1),e._v(" "),a("div",{staticClass:"sys-table"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.dialogLoading,expression:"dialogLoading"}],ref:"tb",attrs:{data:e.subsetList,"header-cell-style":{fontWeight:"normal",textAlign:"center",backgroundColor:"#eceff4",color:"#222"}},on:{"row-click":e.clickRow,"selection-change":e.ckSubsetAll}},[a("el-table-column",{attrs:{type:"selection",width:"50",align:"center"}}),e._v(" "),a("el-table-column",{attrs:{prop:"name",label:"保养项目",align:"center"}}),e._v(" "),a("el-table-column",{attrs:{prop:"function","show-overflow-tooltip":"",label:"保养方法",align:"center"}})],1)],1),e._v(" "),a("div",{staticClass:"sys-pagination"},[a("el-pagination",{attrs:{"current-page":e.searchData_Subset.pageno,"page-sizes":[5,10,20],"page-size":e.searchData_Subset.pagesize,layout:"total, sizes, prev, pager, next, jumper",total:e.subsetTotal},on:{"update:currentPage":function(t){return e.$set(e.searchData_Subset,"pageno",t)},"update:current-page":function(t){return e.$set(e.searchData_Subset,"pageno",t)},"size-change":e.subsetSizeChange,"current-change":e.subsetCurrentChange}})],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary",loading:e.loading},on:{click:function(t){return e.submit()}}},[e._v("确定")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.innerVisible=!1}}},[e._v(e._s(e.config.cancelText))]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.addProject()}}},[e._v("增加项目")])],1)]),e._v(" "),a("el-dialog",{attrs:{center:"",title:"添加保养项目",visible:e.addVisible,width:"600px"},on:{"update:visible":function(t){e.addVisible=t}}},[a("el-form",{ref:"form",attrs:{"label-width":"90px",model:e.form,rules:e.ruleForm}},[a("el-form-item",{attrs:{label:"编号"}},[a("el-input",{attrs:{placeholder:"请填写编号"},model:{value:e.form.code,callback:function(t){e.$set(e.form,"code",t)},expression:"form.code"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"保养项目",prop:"name"}},[a("el-input",{attrs:{placeholder:"请填写保养项目"},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"保养方法",prop:"function"}},[a("el-input",{attrs:{placeholder:"请填写保养方法",autosize:{minRows:4},type:"textarea"},model:{value:e.form.function,callback:function(t){e.$set(e.form,"function",t)},expression:"form.function"}})],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.save("form")}}},[e._v("保存")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.addVisible=!1}}},[e._v(e._s(e.config.cancelText))])],1)],1)],1)},staticRenderFns:[]},D=a("VU/8")(v,b,!1,null,null,null).exports,_=a("G9gL"),y=a("3MlD"),$=a("/lKY"),x=a("NYxO"),k="/apis/mdh/scrw/add",w={name:"uscrw-add",components:{btnInput:h.a,ChooseProjects:D,dialogDnChooseContract:$.a,ChooseDevices:_.a,DialogChooseSingleUser:y.a,dialogChooseSingleParts:p.a},data:function(){return{depOptions:[],selectDeptId:[],formData:{},start_datetime:{disabledDate:function(e){return e.getTime()<Date.now()}},end_datetime:{disabledDate:function(e){return e.getTime()<Date.now()}},ruleForm:{scrq:[{required:!0,message:"请选择生产日期",trigger:"blur"}],jt:[{required:!0,message:"请选择",trigger:"change"}],wlbm:[{required:!0,message:"请选择物料",trigger:"change"}]},chooseMaterielVisible:!1,chooseDevicesVisible:!1,chooseUserVisible:!1,getUserList:[],levelList:[],tableData:[],deptList:[],chooseVisible:!1,chooseVisible1:!1,projects:[],chooseProjects:[],choosePartsVisible:!1,parts:[],choosePartss:[],loading:!1,isDisabled:!1,config:g.a}},mounted:function(){if(this.initialize(),this.$route.query.id)this.formData.id=this.$route.query.id,this.getDetail();else{var e=Object(m.f)(new Date);this.$set(this.formData,"scrq",e)}},watch:{formData:{handler:function(e,t){""==e.deviceId&&(this.formData.deviceModel="",this.formData.deviceUser="",this.formData.deviceSite="",this.formData.deviceDept="",this.formData.deviceName=""),""==e.engineerId&&(this.formData.engineerName="",this.formData.cellphone="",this.formData.deptId="",this.selectDeptId=[])},deep:!0}},methods:f()({},Object(x.d)({removeTagNav:"tagNav/removeTagNav"}),{getPart:function(e){console.log(e),e?(this.$set(this.formData,"wlid",e.id),this.$set(this.formData,"wlmc",e.name?e.name:""),this.$set(this.formData,"wlbm",e.serialNo?e.serialNo:""),this.$set(this.formData,"kz",e.imageNo?e.imageNo:""),this.$set(this.formData,"ggxh",e.specification?e.specification:"")):(this.$set(this.formData,"wlid",""),this.$set(this.formData,"wlmc",""),this.$set(this.formData,"wlbm",""),this.$set(this.formData,"kz",""),this.$set(this.formData,"ggxh",""))},getContract:function(e){console.log(e),e?(this.$set(this.formData,"xsddid",e[0].id),this.$set(this.formData,"xsdd",e[0].code?e[0].code:"")):(this.$set(this.formData,"xsdd",""),this.$set(this.formData,"xsddid",""))},setTotal:function(e){return e.num&&e.salePrice?parseFloat(e.num)*parseFloat(e.salePrice):0},treeFindPath:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!e)return[];var i=!0,s=!1,o=void 0;try{for(var r,n=d()(e);!(i=(r=n.next()).done);i=!0){var l=r.value;if(a.push(l.id),t(l))return a;if(l.children){var c=this.treeFindPath(l.children,t,a);if(c.length)return c}a.pop()}}catch(e){s=!0,o=e}finally{try{!i&&n.return&&n.return()}finally{if(s)throw o}}return[]},setDeptList:function(e){var t=!0,a=!1,i=void 0;try{for(var s,o=d()(e);!(t=(s=o.next()).done);t=!0){var r=s.value;r.hasChildren?this.setDeptList(r.children):r.children=void 0}}catch(e){a=!0,i=e}finally{try{!t&&o.return&&o.return()}finally{if(a)throw i}}},handleChange:function(e){this.formData.deptId=e.length>=1?e[e.length-1]:"",this.selectDeptId=e},getDevice:function(e){e&&(this.formData.jtid=e.id,this.formData.jt=e.name)},getUser:function(e){var t=this;e&&(this.$set(this.formData,"engineerId",e.id),this.$set(this.formData,"engineerName",e.name),this.$set(this.formData,"cellphone",e.mobile),this.getUserList.forEach(function(a){if(e.id===a.id)return t.formData.selectDeptId=a.deptId,void(t.formData.deptId=a.deptId)}),this.setDefaultDept())},getProject:function(e){var t=this;e&&e.forEach(function(e){t.projects.push(e)})},removeProject:function(){var e=this;this.chooseProjects&&this.chooseProjects.forEach(function(t){var a=e.projects.findIndex(function(e){if(e.id==t.id)return!0});e.projects.splice(a,1)})},handleProjectChange:function(e){this.chooseProjects=e},removePart:function(){var e=this;this.chooseParts&&this.chooseParts.forEach(function(t){var a=e.parts.findIndex(function(e){if(e.id==t.id)return!0});e.parts.splice(a,1)})},handlePartChange:function(e){this.chooseParts=e},initialize:function(){var e=this;l.a.all([this.$api.commonAPI.getUsers(),this.$api.commonAPI.getDeptsTree(),this.$api.dictAPI.getDictsByType("device_upkeep")]).then(function(t){var a=r()(t,3),i=a[0],s=a[1],o=a[2];0===i.code&&(e.getUserList=i.datas),0===s.code&&(e.depOptions=s.data.children,e.setDeptList(e.depOptions),e.setDefaultDept()),0===o.code&&(e.levelList=o.datas)}).catch(function(e){console.log(e)})},back:function(){this.removeTagNav({path:this.$route.path,title:this.$route.meta.name}),this.$router.push({path:"/basic/scrw",query:{t:Date.now()}})},getDetail:function(){var e=this;this.loading=!0,this.$api.upkeepPlanAPI.getOnePlanDetail(this.formData.id).then(function(t){if(0===t.code){for(var a in e.formData.deviceName=t.data.planMsg.device_name,e.formData.deviceModel=t.data.planMsg.device_model,e.formData.deviceUser=t.data.planMsg.deviceUserman,e.formData.deviceSite=t.data.planMsg.deviceSite,e.formData.deviceDept=t.data.planMsg.deviceUsedeptName?t.data.planMsg.deviceUsedeptName:"",e.formData.workOrderno=t.data.planMsg.plan_orderNo,e.formData.deviceId=t.data.planMsg.device_id,e.formData.name=t.data.planMsg.plan_name,e.formData.engineerName=t.data.planMsg.engineerName,e.formData.engineerId=t.data.planMsg.engineerId,e.formData.cellphone=t.data.planMsg.engineer_phone,e.formData.startTime=t.data.planMsg.start_time,e.formData.endTime=t.data.planMsg.end_time,e.formData.expireday=t.data.planMsg.expireday,e.formData.intervalTime=t.data.planMsg.interval_time,e.formData.content=t.data.planMsg.content,e.formData.type=t.data.planMsg.planTypeLeve,e.formData.deptId=t.data.planMsg.upkeepDeptId,e.$set(e.formData,"selectDeptId",t.data.planMsg.upkeepDeptId),e.formData)void 0==e.formData[a]&&(e.formData[a]="");e.setDefaultDept(),t.data.proMsg&&t.data.proMsg.forEach(function(t){var a={id:t.proId,name:t.name,function:t.function};e.projects.push(a)}),t.data.partMsg&&t.data.partMsg.forEach(function(t){var a={id:t.spart_id,serialNo:t.apart_code,specification:t.spart_type,num:t.amount,unitUomName:t.unit_name,salePrice:t.spart_price,defaultFacilityName:t.location_name,amount:t.money,name:t.spart_name,remark:t.remark};e.parts.push(a)})}e.loading=!1}).catch(function(t){e.loading=!1})},setDefaultDept:function(){if(this.depOptions.length>0&&this.formData.selectDeptId){var e=s()(this.formData.selectDeptId),t=this.treeFindPath(this.depOptions,function(t){return t.id===e});this.selectDeptId=JSON.parse(s()(t))}},tempSave:function(e){var t=this;this.$refs[e].validate(function(e){if(!e)return!1;t.isDisabled=!0,t.$api.yxkAPI.yxkPost(k,t.formData).then(function(e){t.isDisabled=!1,0===e.code?(t.$message({message:e.msg,type:"success"}),t.back()):t.$message({message:e.msg,type:"error"})})})},save:function(e){var t=this;this.$refs[e].validate(function(e){if(!e)return!1;t.isDisabled=!0,t.$api.yxkAPI.yxkPost(k,t.formData).then(function(e){t.isDisabled=!1,0==e.code?(t.$message({message:e.msg,type:"success"}),t.back()):t.$message({message:e.msg,type:"error"})})})}})},P={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"sys-box plan-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.save("form")}}},[e._v("提交")])],1),e._v(" "),a("div",{staticClass:"sys-form"},[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",attrs:{label:"生产任务单号",prop:"scrwdh"}},[a("el-input",{attrs:{placeholder:"生产任务单号"},model:{value:e.formData.scrwdh,callback:function(t){e.$set(e.formData,"scrwdh",t)},expression:"formData.scrwdh"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"生产日期",prop:"scrq"}},[a("el-date-picker",{attrs:{format:"yyyy-MM-dd HH:mm:ss","value-format":"yyyy-MM-dd HH:mm:ss",type:"datetime",clearable:"",placeholder:"选择日期"},model:{value:e.formData.scrq,callback:function(t){e.$set(e.formData,"scrq",t)},expression:"formData.scrq"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"设备名称",prop:"jt"}},[[a("btn-input",{attrs:{valueText:e.formData.jt,valueId:e.formData.jtid,chooseVisible:e.chooseDevicesVisible},on:{"update:valueText":function(t){return e.$set(e.formData,"jt",t)},"update:value-text":function(t){return e.$set(e.formData,"jt",t)},"update:valueId":function(t){return e.$set(e.formData,"jtid",t)},"update:value-id":function(t){return e.$set(e.formData,"jtid",t)},"update:chooseVisible":function(t){e.chooseDevicesVisible=t},"update:choose-visible":function(t){e.chooseDevicesVisible=t}}})]],2),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"物料名称",prop:"wlmc"}},[[a("btn-input",{attrs:{valueText:e.formData.wlmc,valueId:e.formData.wlid,chooseVisible:e.chooseMaterielVisible},on:{"update:valueText":function(t){return e.$set(e.formData,"wlmc",t)},"update:value-text":function(t){return e.$set(e.formData,"wlmc",t)},"update:valueId":function(t){return e.$set(e.formData,"wlid",t)},"update:value-id":function(t){return e.$set(e.formData,"wlid",t)},"update:chooseVisible":function(t){e.chooseMaterielVisible=t},"update:choose-visible":function(t){e.chooseMaterielVisible=t}}})]],2),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"物料编码",prop:"wlbm"}},[a("el-input",{attrs:{placeholder:"物料编码",disabled:""},model:{value:e.formData.wlbm,callback:function(t){e.$set(e.formData,"wlbm",t)},expression:"formData.wlbm"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"规格型号",prop:"ggxh"}},[a("el-input",{attrs:{placeholder:"规格型号",disabled:""},model:{value:e.formData.ggxh,callback:function(t){e.$set(e.formData,"ggxh",t)},expression:"formData.ggxh"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"克重(g/m)",prop:"kz"}},[a("el-input",{attrs:{placeholder:"克重",disabled:""},model:{value:e.formData.kz,callback:function(t){e.$set(e.formData,"kz",t)},expression:"formData.kz"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"卷号"}},[a("el-input",{attrs:{placeholder:"自动生成",disabled:""},model:{value:e.formData.jh,callback:function(t){e.$set(e.formData,"jh",t)},expression:"formData.jh"}})],1),e._v(" "),a("el-form-item",{staticClass:"form-inline",attrs:{label:"销售订单"}},[[a("btn-input",{attrs:{valueText:e.formData.xsdd,valueId:e.formData.xsddid,chooseVisible:e.chooseVisible1},on:{"update:valueText":function(t){return e.$set(e.formData,"xsdd",t)},"update:value-text":function(t){return e.$set(e.formData,"xsdd",t)},"update:valueId":function(t){return e.$set(e.formData,"xsddid",t)},"update:value-id":function(t){return e.$set(e.formData,"xsddid",t)},"update:chooseVisible":function(t){e.chooseVisible1=t},"update:choose-visible":function(t){e.chooseVisible1=t}}})]],2)],1),e._v(" "),a("el-form-item",{attrs:{label:"备注"}},[a("el-input",{attrs:{type:"textarea",autosize:{minRows:4},placeholder:"请简要填写备注内容"},model:{value:e.formData.remarks,callback:function(t){e.$set(e.formData,"remarks",t)},expression:"formData.remarks"}})],1)],1)],1),e._v(" "),a("dialogChooseSingleParts",{attrs:{visible:e.chooseMaterielVisible},on:{"update:visible":function(t){e.chooseMaterielVisible=t},change:e.getPart}}),e._v(" "),a("ChooseProjects",{attrs:{visible:e.chooseVisible},on:{"update:visible":function(t){e.chooseVisible=t},change:e.getProject}}),e._v(" "),a("dialogDnChooseContract",{attrs:{visible:e.chooseVisible1},on:{"update:visible":function(t){e.chooseVisible1=t},change:e.getContract}}),e._v(" "),a("ChooseDevices",{attrs:{visible:e.chooseDevicesVisible,canUsed:"canUsed"},on:{"update:visible":function(t){e.chooseDevicesVisible=t},change:e.getDevice}}),e._v(" "),a("DialogChooseSingleUser",{attrs:{visible:e.chooseUserVisible},on:{"update:visible":function(t){e.chooseUserVisible=t},change:e.getUser}})],1)},staticRenderFns:[]};var V=a("VU/8")(w,P,!1,function(e){a("Xmc7"),a("X3MV")},"data-v-def7dbaa",null);t.default=V.exports},X3MV:function(e,t){},Xmc7:function(e,t){}});