import{d as e,r as a,o as l,j as o,b as t,e as n,k as s,w as u,m as d,F as i,f,l as c,q as r,i as m,c as v,t as p,h as w}from"./index-z4UiUMlV.js";import{g as _,a as h,p as k}from"./index.Wwo-uIrA.js";import{_ as b}from"./_plugin-vue_export-helper.BCo6x5W8.js";const g=b(e({__name:"processOldzmd",setup(e){const b=a(!1),g=a([]),C=a(!1),y=a({flows:[{}]}),x=a();a([]),a([]);const V=()=>{if(y.value.id){let e={id:y.value.id,craftName:y.value.name,flows:y.value.flows};h("/flowBind",e).then((e=>{200===e.code&&(O(),b.value=!1,r("修改成功！"))}))}else{let e={craftName:y.value.name,flows:y.value.flows};k("/flowBind",e).then((e=>{200===e.code&&(O(),b.value=!1,r("修改成功！"))}))}},U=()=>{b.value=!1},j=()=>{history.back()},N=()=>{b.value=!0},O=()=>{g.value=[],_("/fabric/craft/info").then((e=>{200===e.code&&_("/flowBind").then((a=>{200===a.code&&e.data.forEach((e=>{let l=a.data.find((a=>a.craftName===e.name));l?g.value.push({id:l.id,name:l.craftName,flows:l.flows}):g.value.push({name:e.name,flows:[{bind:"通用"}]})}))}))}))},z=a(),B=e=>{y.value.flows[z.value].id=e.selectedOptions[0].value,y.value.flows[z.value].name=e.selectedOptions[0].text,E()},E=()=>{C.value=!1},R=()=>{q.value=F.value},q=a([]),F=a([]);return l((()=>{O(),_("/craftFlows").then((e=>{200===e.code&&(F.value=e.data.map((e=>({text:e.name,value:e.id}))))}))})),(e,a)=>{const l=o("van-nav-bar"),r=m,_=o("van-icon"),h=o("van-field"),k=o("van-radio"),O=o("van-radio-group"),F=o("van-cell-group"),L=o("van-form"),D=o("van-button"),I=o("van-popup"),A=o("van-picker");return t(),n(i,null,[s(r,{class:"flex"},{default:u((()=>[s(l,{title:"工艺维护","left-text":"返回","left-arrow":"",onClickLeft:j,onClickRight:N}),s(r,{class:"grid-container"},{default:u((()=>[s(r,{class:"grid-item"},{default:u((()=>[d("工艺名称")])),_:1}),s(r,{class:"grid-item"},{default:u((()=>[d("操作")])),_:1})])),_:1}),s(r,{class:"content"},{default:u((()=>[(t(!0),n(i,null,f(g.value,((e,a)=>(t(),v(r,{class:"grid-container",key:a},{default:u((()=>[s(r,{class:"grid-item"},{default:u((()=>[d(p(e.name),1)])),_:2},1024),s(r,{class:"grid-item",onClick:a=>(e=>{y.value=e,b.value=!0})(e),style:{color:"#02a7f0"}},{default:u((()=>[d("编辑")])),_:2},1032,["onClick"])])),_:2},1024)))),128))])),_:1})])),_:1}),s(I,{show:b.value,"onUpdate:show":a[1]||(a[1]=e=>b.value=e),style:{width:"100%"}},{default:u((()=>[s(r,{class:"flex"},{default:u((()=>[s(l,{title:"工艺维护","left-text":"返回","left-arrow":"",onClickLeft:U}),s(r,{class:"content"},{default:u((()=>[s(L,{ref_key:"formRef",ref:x,required:"auto"},{default:u((()=>[s(F,null,{default:u((()=>[c("p",null,"绑定工序流程"),(t(!0),n(i,null,f(y.value.flows,((e,l)=>(t(),v(r,{key:l,class:"a-b"},{default:u((()=>[0===l?(t(),v(_,{key:0,name:"add",color:"red",size:"25",onClick:a[0]||(a[0]=e=>y.value.flows.push({bind:"通用"}))})):w("",!0),0!=l?(t(),v(_,{key:1,name:"clear",color:"red",size:"25",onClick:e=>y.value.flows.splice(l,1)},null,8,["onClick"])):w("",!0),s(h,{modelValue:e.name,"onUpdate:modelValue":a=>e.name=a,name:"工序流程",label:"工序流程","label-align":"right",readonly:"",colon:"","label-width":"5em",class:"bor",onClick:e=>(e=>{C.value=!0,z.value=e})(l)},null,8,["modelValue","onUpdate:modelValue","onClick"]),s(O,{modelValue:e.bind,"onUpdate:modelValue":a=>e.bind=a,onClick:e=>(e=>{y.value.flows.forEach(((a,l)=>{a.bind=l!=e?"通用":"仅现货"}))})(l)},{default:u((()=>[s(k,{name:"仅现货"},{default:u((()=>[d("现货单使用")])),_:1})])),_:2},1032,["modelValue","onUpdate:modelValue","onClick"])])),_:2},1024)))),128))])),_:1})])),_:1},512)])),_:1}),s(r,{style:{display:"flex","justify-content":"space-between",padding:"0 30px","margin-top":"15px"}},{default:u((()=>[s(D,{type:"primary",block:"",onClick:V},{default:u((()=>[d("保存")])),_:1})])),_:1})])),_:1})])),_:1},8,["show"]),s(I,{show:C.value,"onUpdate:show":a[2]||(a[2]=e=>C.value=e),round:"",position:"bottom",onOpen:R},{default:u((()=>[s(A,{"show-toolbar":"",columns:q.value,onConfirm:B,onCancel:E,ref:"pickerRef"},null,8,["columns"])])),_:1},8,["show"])],64)}}}),[["__scopeId","data-v-40105d94"]]);export{g as default};
