"use strict";(self["webpackChunktft_mes"]=self["webpackChunktft_mes"]||[]).push([[5304],{8027:function(t,e,a){a.d(e,{Z:function(){return u}});var r=function(){var t=this,e=t._self._c;return e("div",[e("el-tag",{attrs:{size:"medium",type:t.tagType}},[t._v(t._s(t.showName))])],1)},i=[],o={name:"statusTag",props:{injectData:{type:Object,default:()=>({})}},data(){return{tagType:"",showName:"",list:JSON.parse(localStorage.getItem("publicList")).enabledVoList}},mounted(){this.init()},methods:{init(){1===this.injectData.enabled?this.tagType="":this.tagType="warning",this.list&&this.list.map((t=>{t.dataCode===this.injectData.enabled&&(this.showName=t.dataName)}))}},watch:{injectData(t,e){e.enabled!==t.enabled&&this.init()}}},n=o,s=a(1001),l=(0,s.Z)(n,r,i,!1,null,null,null),u=l.exports},5304:function(t,e,a){a.r(e),a.d(e,{default:function(){return I}});var r=function(){var t=this,e=t._self._c;return e("div",[e("el-row",{staticClass:"main-box",attrs:{gutter:10}},[e("el-col",{attrs:{span:4}},[e("div",{staticClass:"left-box"},[e("el-tree",{attrs:{data:t.treeData,"node-key":"id",props:t.defaultProps,"default-expand-all":"",draggable:"","allow-drop":t.allowDrop,"allow-drag":t.allowDrag,"highlight-current":!0},on:{"node-drag-end":t.handleDragEnd,"node-click":t.clickDevice}})],1)]),e("el-col",{attrs:{span:20}},[e("div",{staticClass:"right-box"},[e("search-bar",{ref:"searchBarForm",attrs:{formConfigs:t.formConfig},on:{headBtnClick:t.buttonClick}}),e("base-table",{attrs:{page:t.listQuery.current,limit:t.listQuery.size,"table-props":t.tableProps,"table-data":t.tableData,"max-height":t.tableH}},[t.tableBtn.length?e("method-btn",{attrs:{slot:"handleBtn",width:80,label:"操作",fixed:"right","method-list":t.tableBtn},on:{clickBtn:t.handleClick},slot:"handleBtn"}):t._e()],1),e("pagination",{attrs:{page:t.listQuery.current,limit:t.listQuery.size,total:t.total},on:{"update:page":function(e){return t.$set(t.listQuery,"current",e)},"update:limit":function(e){return t.$set(t.listQuery,"size",e)},pagination:function(e){return t.getList()}}})],1),e("base-dialog",{attrs:{dialogTitle:t.addOrEditTitle,dialogVisible:t.centervisible,"before-close":t.handleCancel},on:{cancel:t.handleCancel,confirm:t.handleConfirm}},[e("device-add",{ref:"deviceAdd",on:{successSubmit:t.successSubmit}})],1)],1)],1)],1)},i=[],o=function(){var t=this,e=t._self._c;return e("el-form",{ref:"form",staticClass:"device-add",attrs:{rules:t.rules,"label-width":"100px",model:t.form}},[e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"产线",prop:"proLineId"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"产线"},on:{change:t.getUnitModule},model:{value:t.form.proLineId,callback:function(e){t.$set(t.form,"proLineId",e)},expression:"form.proLineId"}},t._l(t.productionLineList,(function(t){return e("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})})),1)],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"单元",prop:"unitId"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"单元"},on:{change:t.getEqCode},model:{value:t.form.unitId,callback:function(e){t.$set(t.form,"unitId",e)},expression:"form.unitId"}},t._l(t.unitModuleList,(function(t){return e("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})})),1)],1)],1)],1),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"设备名称",prop:"name"}},[e("el-input",{attrs:{placeholder:"设备名称"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"设备规格",prop:"spec"}},[e("el-input",{attrs:{placeholder:"设备规格"},model:{value:t.form.spec,callback:function(e){t.$set(t.form,"spec",e)},expression:"form.spec"}})],1)],1)],1),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"设备编码",prop:"code"}},[e("el-input",{attrs:{placeholder:"设备编码",disabled:""},model:{value:t.form.code,callback:function(e){t.$set(t.form,"code",e)},expression:"form.code"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"基础寿命",prop:"baseLife"}},[e("el-input-number",{staticStyle:{width:"100%"},attrs:{placeholder:"基础寿命",min:0,max:999999999,precision:2},model:{value:t.form.baseLife,callback:function(e){t.$set(t.form,"baseLife",e)},expression:"form.baseLife"}})],1)],1)],1),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"购买价格/万元",prop:"price"}},[e("el-input-number",{staticStyle:{width:"100%"},attrs:{placeholder:"购买价格/万元",min:0,max:999999999,precision:2},model:{value:t.form.price,callback:function(e){t.$set(t.form,"price",e)},expression:"form.price"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"供应商",prop:"supplier"}},[e("el-input",{attrs:{placeholder:"供应商"},model:{value:t.form.supplier,callback:function(e){t.$set(t.form,"supplier",e)},expression:"form.supplier"}})],1)],1)],1),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"采购日期",prop:"purchaseDate"}},[e("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"date",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd",placeholder:"采购日期"},model:{value:t.form.purchaseDate,callback:function(e){t.$set(t.form,"purchaseDate",e)},expression:"form.purchaseDate"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"生产日期",prop:"productDate"}},[e("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"date",placeholder:"生产日期",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd"},model:{value:t.form.productDate,callback:function(e){t.$set(t.form,"productDate",e)},expression:"form.productDate"}})],1)],1)],1),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"备注",prop:"remark"}},[e("el-input",{attrs:{placeholder:"备注"},model:{value:t.form.remark,callback:function(e){t.$set(t.form,"remark",e)},expression:"form.remark"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{directives:[{name:"show",rawName:"v-show",value:t.isEdit,expression:"isEdit"}],attrs:{label:"状态",prop:"enabled"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"状态"},model:{value:t.form.enabled,callback:function(e){t.$set(t.form,"enabled",e)},expression:"form.enabled"}},t._l(t.stateList,(function(t,a){return e("el-option",{key:a,attrs:{label:t.dataName,value:t.dataCode}})})),1)],1)],1)],1),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"设备图片",prop:"imgId"}},[t.deviceImg?e("div",{staticClass:"img-box",staticStyle:{position:"relative"}},[e("el-image",{staticClass:"avatar",attrs:{src:t.deviceImg,"preview-src-list":t.srcList}}),e("i",{staticClass:"el-icon-circle-close avatar-close-icon",on:{click:function(e){return t.clearImg()}}})],1):e("el-upload",{staticClass:"device-uploader",attrs:{data:t.dataObj,name:"files",action:t.uploadApi,"show-file-list":!1,"on-success":t.handleAvatarSuccess,"before-upload":t.beforeAvatarUpload,headers:{token:t.token}}},[e("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1)],1)],1)],1)},n=[],s=a(910),l=a(5591),u=a(1836),d=a(381),c=a.n(d),m={name:"ConsumablesAdd",data(){return{form:{id:"",proLineId:"",unitId:"",name:"",spec:"",code:"",baseLife:"",price:"",imgId:"",supplier:"",purchaseDate:c()().format("YYYY-MM-DD"),productDate:c()().format("YYYY-MM-DD"),remark:"",enabled:1},deviceImg:"",srcList:[],rules:{proLineId:[{required:!0,message:"请选择产线",trigger:"change"}],unitId:[{required:!0,message:"请选择单元",trigger:"change"}],name:[{required:!0,message:"请输入设备名称",trigger:"blur"}],spec:[{required:!0,message:"请输入设备规格",trigger:"blur"}],code:[{required:!0,message:"请输入设备编码",trigger:"blur"}]},isEdit:!1,productionLineList:JSON.parse(localStorage.getItem("publicList")).proLineVoList,stateList:JSON.parse(localStorage.getItem("publicList")).enabledVoList,unitModuleList:[],uploadApi:l.WQ,token:(0,u.LP)(),dataObj:{typeCode:"equipmentImage"}}},methods:{init(t){t?(this.form.id=t,this.isEdit=!0,(0,s.xf)({id:t}).then((t=>{0===t.code&&(this.form.proLineId=t.data.proLineId,(0,s._)(this.form.proLineId).then((t=>{this.unitModuleList=t.data||[]})),this.form.unitId=t.data.unitId,this.form.name=t.data.name,this.form.spec=t.data.spec,this.form.code=t.data.code,this.form.baseLife=t.data.baseLife,this.form.price=t.data.price,this.form.imgId=t.data.imgId,t.data.imgId&&(this.deviceImg="http://tft.mes.picaiba.com/api/common/attachment/downloadFile?type=0&attachmentId="+t.data.imgId,this.srcList=[this.deviceImg]),this.form.supplier=t.data.supplier,this.form.purchaseDate=t.data.purchaseDate?t.data.purchaseDate:"",this.form.productDate=t.data.productDate?t.data.productDate:"",this.form.remark=t.data.remark,this.form.enabled=t.data.enabled)}))):(this.form.id="",this.isEdit=!1)},getUnitModule(t){(0,s._)(t).then((t=>{this.unitModuleList=t.data||[],this.form.unitId="",this.form.code=""}))},getEqCode(){if(this.form.proLineId&&this.form.unitId){let t="";this.unitModuleList&&this.unitModuleList.map((e=>{e.id===this.form.unitId&&(t=e.sequence)})),(0,s.ER)({proLineId:this.form.proLineId,sequence:t}).then((t=>{this.form.code=t.data}))}},submitForm(){this.$refs["form"].validate((t=>{if(!t)return!1;this.isEdit?(0,s.oW)({...this.form}).then((t=>{0===t.code&&(this.$message({message:"操作成功",type:"success",duration:1500}),this.$emit("successSubmit"))})):(0,s.ag)({...this.form}).then((t=>{0===t.code&&(this.$message({message:"操作成功",type:"success",duration:1500}),this.$emit("successSubmit"))}))}))},formClear(){this.$refs.form.resetFields(),this.deviceImg="",this.srcList=[],this.unitModuleList=[]},handleAvatarSuccess(t){this.form.imgId=t.data[0].id,this.deviceImg="http://tft.mes.picaiba.com/api/common/attachment/downloadFile?type=0&attachmentId="+t.data[0].id,this.srcList=[this.deviceImg]},clearImg(){this.deviceImg="",this.srcList=[],this.form.imgId=""},beforeAvatarUpload(t){const e="image/jpeg"===t.type,a=t.size/1024/1024<2;return e||this.$message.error("上传头像图片只能是 JPG / PNG格式!"),a||this.$message.error("上传头像图片大小不能超过 2MB!"),e&&a}}},p=m,f=a(1001),h=(0,f.Z)(p,o,n,!1,null,"0a02c89e",null),b=h.exports,g=a(475),y=a(8027);const v=[{prop:"proLineId",label:"产线",filter:(0,g.fW)("proLineVoList"),width:100},{prop:"unitName",label:"单元",width:150},{prop:"name",label:"设备名称",width:150},{prop:"spec",label:"设备规格",width:150},{prop:"code",label:"设备编码",width:150},{prop:"status",label:"设备状态",width:120,subcomponent:y.Z},{prop:"baseLife",label:"基础寿命",width:100},{prop:"price",label:"购买价格/万元",width:140},{prop:"supplier",label:"供应商",width:150},{prop:"purchaseDate",label:"采购日期",minWidth:120},{prop:"productDate",label:"生产日期",minWidth:120},{prop:"creatorName",label:"登记人",width:120},{prop:"createTime",label:"登记时间",filter:g.g6,minWidth:160},{prop:"remark",label:"备注",width:150}],L=[{type:"edit",btnName:"编辑"}];var C={name:"DeviceConfig",components:{DeviceAdd:b},data(){return{treeData:[],defaultProps:{children:"children",label:"name"},formConfig:[{type:"input",label:"设备规格",placeholder:"设备规格",param:"spec"},{type:"input",label:"设备编码",placeholder:"设备编码",param:"code"},{type:"button",btnName:"查询",name:"search",color:"primary"},{type:"separate"},{type:"button",btnName:"新增",name:"add",color:"success",plain:!0}],tableProps:v,tableData:[],tableBtn:L,tableH:(0,g.NC)(275),total:0,listQuery:{current:1,size:20},centervisible:!1,addOrEditTitle:""}},mounted(){window.addEventListener("resize",(()=>{this.tableH=(0,g.NC)(275)})),this.getTree(),this.getList()},methods:{getTree(){(0,l.SI)().then((t=>{this.treeData=t.data}))},getList(){(0,s.$0)({...this.listQuery}).then((t=>{0===t.code&&(this.total=t.data.total,this.tableData=t.data.records)}))},handleDragEnd(t){let e=t.data.parent,a=[];for(let r=0;r{this.$message({message:"操作成功",type:"success",duration:1500,onClose:()=>{}}),this.getTree()}))},allowDrop(t,e,a){return t.data.parent===e.data.parent&&3===e.level&&"inner"!==a},allowDrag(t){return t.data.isAllowDrag},clickDevice(t){t.children||(this.$refs.searchBarForm.resetForm(),this.listQuery.spec="",this.listQuery.code="",this.listQuery.id=t.id,this.listQuery.current=1,this.getList())},buttonClick(t){switch(console.log(t),t.btnName){case"search":this.listQuery.spec=t.spec,this.listQuery.code=t.code,this.listQuery.id="",this.listQuery.current=1,this.getList();break;default:this.addOrEditTitle="新增",this.centervisible=!0,this.$nextTick((()=>{this.$refs.deviceAdd.init()}))}},handleClick(t){"edit"===t.type&&(this.addOrEditTitle="编辑",this.$nextTick((()=>{this.$refs.deviceAdd.init(t.data.id)})),this.centervisible=!0)},handleCancel(){this.$refs.deviceAdd.formClear(),this.centervisible=!1,this.addOrEditTitle=""},handleConfirm(){this.$refs.deviceAdd.submitForm()},successSubmit(){this.handleCancel(),this.getList(),this.getTree()}}},D=C,w=(0,f.Z)(D,r,i,!1,null,"50aec75c",null),I=w.exports},5591:function(t,e,a){a.d(e,{FH:function(){return s},Hp:function(){return u},JQ:function(){return n},SI:function(){return o},Vx:function(){return d},WQ:function(){return p},b6:function(){return c},iv:function(){return i},jL:function(){return l},m:function(){return m}});var r=a(8859);function i(){return(0,r.Z)({url:"/common/getList",method:"post"})}function o(){return(0,r.Z)({url:"/common/getTreeData",method:"post"})}function n(t){return(0,r.Z)({url:"/common/updateEqSeq",method:"post",data:t})}function s(t){return(0,r.Z)({url:"/common/attachment/downloadFile",method:"get",responseType:"blob",params:t,timeout:6e4})}function l(t){return(0,r.Z)({url:"/common/getFpyData",method:"post",data:t})}function u(t){return(0,r.Z)({url:"/common/getAlarmData",method:"post",data:t})}function d(t){return(0,r.Z)({url:"/common/getCapacityData",method:"post",data:t})}function c(t){return(0,r.Z)({url:"/common/getProductData",method:"post",data:t})}function m(t){return(0,r.Z)({url:"/common/getMaterialData",method:"post",data:t})}const p="/api/common/attachment/uploadFileFormData"},910:function(t,e,a){a.d(e,{$0:function(){return k},A0:function(){return I},D0:function(){return n},ER:function(){return M},Kl:function(){return w},ME:function(){return d},Or:function(){return g},P4:function(){return u},Py:function(){return c},Qj:function(){return C},Sc:function(){return h},Sl:function(){return y},WZ:function(){return f},Wj:function(){return l},Zs:function(){return i},_:function(){return S},_1:function(){return v},ag:function(){return Z},b8:function(){return b},dN:function(){return m},fZ:function(){return p},jF:function(){return o},oW:function(){return x},qT:function(){return L},sU:function(){return s},tb:function(){return D},xf:function(){return $}});var r=a(8859);function i(t){return(0,r.Z)({url:"/basic/account/page",method:"post",data:t})}function o(t){return(0,r.Z)({url:"/basic/account/add",method:"post",data:t})}function n(t){return(0,r.Z)({url:"/basic/account/get",method:"post",data:t})}function s(t){return(0,r.Z)({url:"/basic/account/update",method:"post",data:t})}function l(t){return(0,r.Z)({url:"/basic/sparePartsConfiguration/page",method:"post",data:t})}function u(t){return(0,r.Z)({url:"/basic/sparePartsConfiguration/add",method:"post",data:t})}function d(t){return(0,r.Z)({url:"/basic/sparePartsConfiguration/get",method:"post",data:t})}function c(t){return(0,r.Z)({url:"/basic/sparePartsConfiguration/update",method:"post",data:t})}function m(t){return(0,r.Z)({url:"/basic/sparePartsConfiguration/getNameList",method:"post",data:t})}function p(t){return(0,r.Z)({url:"/basic/sparePartsConfiguration/getModelList",method:"post",data:t})}function f(t){return(0,r.Z)({url:"/basic/consumableConfiguration/page",method:"post",data:t})}function h(t){return(0,r.Z)({url:"/basic/consumableConfiguration/add",method:"post",data:t})}function b(t){return(0,r.Z)({url:"/basic/consumableConfiguration/get",method:"post",data:t})}function g(t){return(0,r.Z)({url:"/basic/consumableConfiguration/update",method:"post",data:t})}function y(t){return(0,r.Z)({url:"/basic/consumableConfiguration/getMaterialList",method:"post",data:t})}function v(t){return(0,r.Z)({url:"/basic/consumableConfiguration/materialList",method:"post",data:t})}function L(t){return(0,r.Z)({url:"/basic/sideLibraryConfiguration/page",method:"post",data:t})}function C(t){return(0,r.Z)({url:"/basic/sideLibraryConfiguration/add",method:"post",data:t})}function D(t){return(0,r.Z)({url:"/basic/sideLibraryConfiguration/get",method:"post",data:t})}function w(t){return(0,r.Z)({url:"/basic/sideLibraryConfiguration/update",method:"post",data:t})}function I(t){return(0,r.Z)({url:"/basic/sideLibraryConfiguration/list",method:"post",data:t})}function k(t){return(0,r.Z)({url:"/basic/equipmentConfiguration/page",method:"post",data:t})}function Z(t){return(0,r.Z)({url:"/basic/equipmentConfiguration/add",method:"post",data:t})}function $(t){return(0,r.Z)({url:"/basic/equipmentConfiguration/get",method:"post",data:t})}function x(t){return(0,r.Z)({url:"/basic/equipmentConfiguration/update",method:"post",data:t})}function S(t){return(0,r.Z)({url:"/basic/equipmentConfiguration/getUnitList",method:"post",formState:!0,data:t})}function M(t){return(0,r.Z)({url:"/basic/equipmentConfiguration/getEqCode",method:"post",data:t})}}}]);