You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
11 KiB
2 lines
11 KiB
|
2 weeks ago
|
import{s as e,B as a,b as l,h as t,r as s,c as i,w as o,m as n,o as d,d as r,e as u,t as c,j as f,f as m,i as _,F as y,p as h,I as g,C as p,l as b,x as v}from"./index-aGYdYpDa.js";import{c as w,u as k,s as x}from"./api.qV-fdkUH.js";import{_ as C}from"./_plugin-vue_export-helper.BCo6x5W8.js";const N=C({data:()=>({isViewMode:!1,stockQty:"",countQty:"",remark:"",photo:"",photos:[],material_info_id:"",firstCategory:"-",secondCategory:"-",categoryName:"-",materialName:"-",materialCode:"-",materialType:"-",materialSpec:"-",materialSize:"-",unit:"-",batchNumber:"-",sequenceNumber:"-",waitNum:"-",productionDate:"-",storageDate:"-",materialStatus:"-",reserveMethod:"-",warehouseName:"-",shelfName:"-",shelfLayer:"-",levelCategory:"-",propertyInfo:"-",isFixedAsset:"-",fixedAssetCode:"-",reserveYears:"-",storageRequirement:"-",maintenanceRequirement:"-",maintenanceFrequency:"-",material_infos_plan_id:"",materialId:""}),onLoad(a){this.isViewMode="1"===a.view,this.date=this.getToday(),this.materialId=a.code,console.log("materialId:",this.materialId),this.materialId&&w(this.materialId).then((a=>{if(console.log("response:",a),a.data){const e=a.data;this.material_info_id=e.wuzibianma_material_infos_wuzibianma_relation.id;const l=e.wuzibianma_material_infos_wuzibianma_relation||{},t=l.fenlei_detail||{},s=e.wuzizhuangtai_detail||{},i=e.chubeifangshi_detail||{},o=e.dengjifenlei_detail||{},n=e.chanquanxinxi_detail||{},d=e.materialstorages||{},r=e.shelfs||{},u=e.equipment_maintain_config||{},c=e.material_info_type||"";if(c){const e=c.split("-");this.firstCategory=e[0]||"-",this.secondCategory=e.length>1?e[1]:e[0]||"-"}this.categoryName=t.name||"-",this.materialName=e.zichanmingcheng||"-",this.materialCode=e.wuzibianma||"-",this.materialType=e.wuzileixing||"-",this.materialSpec=l.guigexinghao||e.guigexinghao||"-",this.materialSize=l.wuziguige||"-",this.unit=l.jiliangdanwei||e.jiliangdanwei||"-",this.batchNumber=e.rukupici||"-",this.stockQty=e.zaikushuliang||e.inventorys_total||"0",this.sequenceNumber=e.shunxuhao||"-",this.waitNum=e.wait_num||"-",this.productionDate=e.shengchanriqi||"-",this.storageDate=e.rukuriqi||"-",this.materialStatus=s.value||"-",this.reserveMethod=i.value||"-",this.warehouseName=d.cangkumingcheng||"-",this.shelfName=r.huojiamingcheng||"-",this.shelfLayer=e.huojiaceng||"-",this.levelCategory=o.value||"-",this.propertyInfo=n.value||"-",this.isFixedAsset=e.shifouweigudingzichan||"-",this.fixedAssetCode=e.gudingzichanbianma||"-",this.reserveYears=e.chubeinianxian||"-",this.storageRequirement=e.cunfangyaoqiu||"-",this.maintenanceRequirement=e.weihuyaoqiu||"-",this.maintenanceFrequency=u.name||"-",this.material_infos_plan_id=e.material_infos_plan_id||""}else e({title:"未获取到物资信息",icon:"none"})})).catch((()=>{e({title:"获取物资信息失败",icon:"none"})}))},methods:{getToday(){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`},choosePhoto(){this.photos.length>=3?e({title:"最多上传3张照片",icon:"none"}):a({count:3-this.photos.length,success:e=>{this.photos=[...this.photos,...e.tempFilePaths]}})},deletePhoto(e){this.photos.splice(e,1)},async submit(){if(!this.countQty)return void e({title:"请输入盘点数量",icon:"none"});if(!/^(0|[1-9][0-9]*)$/.test(this.countQty))return void e({title:"盘点数量必须为0或正整数",icon:"none"});l({title:"提交中..."});let a=[];for(let l=0;l<this.photos.length;l++)try{const e=await k(this.photos[l]);e&&e.id&&a.push(e.id)}catch(o){return t(),void e({title:"图片上传失败",icon:"none"})}const i={status:"1",inventorys_id:this.materialId,check_num:this.countQty,remark:this.remark,file_ids:a};console.log("data:",i),x(i).then((a=>{console.log("res:",a),t(),!a||a.data&&void 0!==a.data.errcode?e({title:a.data.errmsg||"提交失败",icon:"none"}):(e({title:"盘点提交成功",icon:"success"}),setTimeout((()=>{s({url:"/pages/index/index"})}),1200))})).catch((()=>{t(),e({title:"提交失败",icon:"none"})}))}}},[["render",function(e,a,l,t,s,w){const k=h,x=n,C=g,N=p,q=v,z=b;return d(),i(x,{cl
|