import{d as e,r as a,q as l,j as t,b as n,c as s,w as o,k as d,e as u,f as r,F as i,i as m,G as c,m as p,t as f,l as v,h as b}from"./index-z4UiUMlV.js";import{a as y}from"./uni-app.es.DihD-zYh.js";import{g as V}from"./index.Wwo-uIrA.js";import{_ as h}from"./_plugin-vue_export-helper.BCo6x5W8.js";const w=h(e({__name:"history",props:{item:{}},setup(e){const h=a(),w=a({}),_=a([]);y((async e=>{if(e)try{if(h.value=JSON.parse(e.item),"门店"!==h.value.sd||h.value.processes)w.value=h.value.processes;else{let e=await V("/flowBind");if(200===e.code){let a=e.data.find((e=>e.craftName===h.value.craft)).flows.find((e=>"仅现货"===e.bind));if(a){let e="/craftFlows/byName?name="+a.name,t=await V(e);200===t.code?w.value=t.data:l("暂无此工艺！")}else l("暂无此工艺！")}}V("/tracking/getLog?id="+h.value.id).then((e=>{if(200===e.code){w.value.processes.forEach((a=>{if(!a.id){let l=e.data.find((e=>e.details.zt==a.name));l&&(a.rq=l.details.form.czrq,e.data=e.data.concat(l.details.trackingLog))}})),w.value.processes.forEach((a=>{let l=e.data.find((e=>e.details.zt==a.name));l&&(a.rq=l.details.form.czrq,_.value=_.value.concat(l.details.list))}));let a=e.data.find((e=>"待出厂"===e.details.zt));w.value.processes[w.value.processes.length-1].rq=a.details.form.czrq;let l=e.data.find((e=>"已出厂"===e.details.zt));_.value=_.value.concat(a.details.list).concat(l.details.list),_.value.map((e=>{e.pic&&(e.pic=[{url:e.pic}]),e.blank&&(e.contentType=e.blank)}))}}))}catch(a){console.error("Failed to parse item JSON:",a)}}));const g=()=>{window.history.back()};return(e,a)=>{const l=t("van-nav-bar"),y=t("van-field"),V=m,k=t("van-cell-group"),q=t("van-uploader");return n(),s(V,{class:"flex"},{default:o((()=>[d(l,{title:"工序详情","left-text":"返回","left-arrow":"",onClickLeft:g}),d(V,{class:"content"},{default:o((()=>[d(k,{inset:""},{default:o((()=>[d(y,{modelValue:h.value.craft,"onUpdate:modelValue":a[0]||(a[0]=e=>h.value.craft=e),name:"工艺名称",label:"工艺名称",colon:"","label-width":"5em",readonly:""},null,8,["modelValue"]),d(y,{modelValue:h.value.craftCmt.name,"onUpdate:modelValue":a[1]||(a[1]=e=>h.value.craftCmt.name=e),name:"工艺要求",label:"工艺要求",colon:"","label-width":"5em",readonly:""},null,8,["modelValue"]),d(y,{modelValue:h.value.innerComment,"onUpdate:modelValue":a[2]||(a[2]=e=>h.value.innerComment=e),name:"内部备注",label:"内部备注",colon:"","label-width":"5em",readonly:""},null,8,["modelValue"]),d(y,{name:"工艺流程",label:"工艺流程",colon:"","label-width":"5em",readonly:""}),d(V,{class:"grid-container"},{default:o((()=>[(n(!0),u(i,null,r(w.value.processes,((e,a)=>(n(),s(V,{class:"grid-item",key:a},{default:o((()=>[d(V,{class:c(e.id?"btn1":"btn2")},{default:o((()=>[p(f(e.name),1)])),_:2},1032,["class"]),v("p",null,f(e.rq),1)])),_:2},1024)))),128))])),_:1})])),_:1}),d(k,{inset:""},{default:o((()=>[(n(!0),u(i,null,r(_.value,((e,a)=>(n(),s(V,{key:a},{default:o((()=>["Select"===e.type?(n(),s(y,{key:0,modelValue:e.value,"onUpdate:modelValue":a=>e.value=a,name:e.name,label:e.name,colon:"",class:"bor","label-width":"5em",readonly:"",rules:e.necessary?[{required:!0,message:"请选择"}]:[]},null,8,["modelValue","onUpdate:modelValue","name","label","rules"])):b("",!0),"Input"===e.type?(n(),u(i,{key:1},[e.contentType.find((e=>"Text"==e))?(n(),s(y,{key:0,modelValue:e.value,"onUpdate:modelValue":a=>e.value=a,name:e.name,label:e.name,colon:"",class:"bor-n","label-width":"5em",readonly:"",rules:e.necessary?[{required:!0,message:"请填写"}]:[]},null,8,["modelValue","onUpdate:modelValue","name","label","rules"])):b("",!0),e.contentType.find((e=>"File"==e))?(n(),s(y,{key:1,name:"uploader",label:e.name,"label-width":"5em",colon:"",rules:e.necessary?[{required:!0,message:"请上传"}]:[]},{input:o((()=>[d(q,{modelValue:e.pic,"onUpdate:modelValue":a=>e.pic=a,multiple:"","max-count":1,readonly:"",deletable:!1},null,8,["modelValue","onUpdate:modelValue"])])),_:2},1032,["label","rules"])):b("",!0)],64)):b("",!0)])),_:2},1024)))),128))])),_:1})])),_:1})])),_:1})}}}),[["__scopeId","data-v-96ffc2be"]]);export{w as default};
