import{d as e,r as a,o as l,j as s,b as o,e as t,k as n,w as u,m as d,F as r,f as c,l as i,q as m,i as p,c as v,t as f,h as _}from"./index-z4UiUMlV.js";import{g as h,a as g,p as k,s as y,d as b}from"./index.Wwo-uIrA.js";import{_ as w}from"./_plugin-vue_export-helper.BCo6x5W8.js";const C=w(e({__name:"m-flow",setup(e){const w=a(!1),C=a([]),V=a({}),x=a([]);l((()=>{U(),h("/process").then((e=>{200===e.code&&(x.value=e.data.map((e=>({text:e.name,value:e.id}))))}))}));const U=()=>{h("/craftFlows").then((e=>{200===e.code&&(C.value=e.data)}))},F=()=>{history.back()},O=()=>{V.value={processes:[{}]},w.value=!0},j=()=>{V.value.id?g("/craftFlows",V.value).then((e=>{200===e.code&&(U(),w.value=!1,m("提交成功！"))})):k("/craftFlows",V.value).then((e=>{200===e.code&&(U(),w.value=!1,m("提交成功！"))}))},q=a(!1),z=a(),S=a([]),J=e=>{V.value.processes[z.value].id=e.selectedOptions[0].value,V.value.processes[z.value].name=e.selectedOptions[0].text,N()},N=()=>{q.value=!1},R=()=>{S.value=x.value};return(e,a)=>{const l=s("van-nav-bar"),h=p,g=s("van-field"),k=s("van-radio"),x=s("van-radio-group"),D=s("van-icon"),E=s("van-checkbox"),I=s("van-cell-group"),L=s("van-button"),A=s("van-form"),B=s("van-popup"),G=s("van-picker");return o(),t(r,null,[n(h,{class:"flex"},{default:u((()=>[n(l,{title:"工艺流程维护","left-text":"返回","left-arrow":"","right-text":"新增",onClickLeft:F,onClickRight:O}),n(h,{class:"content"},{default:u((()=>[n(h,{class:"grid-container"},{default:u((()=>[n(h,{class:"grid-item"},{default:u((()=>[d("工艺流程名称")])),_:1}),n(h,{class:"grid-item"},{default:u((()=>[d("操作")])),_:1})])),_:1}),(o(!0),t(r,null,c(C.value,((e,a)=>(o(),v(h,{class:"grid-container",key:a},{default:u((()=>[n(h,{class:"grid-item"},{default:u((()=>[d(f(e.name),1)])),_:2},1024),n(h,{class:"grid-item"},{default:u((()=>[i("span",{style:{color:"#35a5f7"},onClick:a=>(e=>{V.value=JSON.parse(JSON.stringify(e)),w.value=!0})(e)},"编辑",8,["onClick"]),d("    "),i("span",{style:{color:"red"},onClick:a=>(e=>{y({title:"提示",message:"是否确认删除？"}).then((()=>{let a="/craftFlows/"+e.id;b(a).then((e=>{200===e.code&&(U(),m("删除成功！"))}))})).catch((()=>{}))})(e)},"删除 ",8,["onClick"])])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1}),n(B,{show:w.value,"onUpdate:show":a[4]||(a[4]=e=>w.value=e),style:{width:"90%"},round:""},{default:u((()=>[n(h,null,{default:u((()=>[i("h3",{style:{"text-align":"center"}},"新增工艺流程"),n(A,{onSubmit:j},{default:u((()=>[n(I,{inset:""},{default:u((()=>[n(g,{modelValue:V.value.name,"onUpdate:modelValue":a[0]||(a[0]=e=>V.value.name=e),name:"工艺流程名称",label:"工艺流程名称",colon:"","label-width":"7em",rules:[{required:!0,message:"请填写"}]},null,8,["modelValue"]),n(g,{name:"工序流程类型",label:"工序流程类型",colon:"","label-width":"7em",class:"b-a",rules:[{required:!0,message:"请填写"}]},{input:u((()=>[n(x,{modelValue:V.value.type,"onUpdate:modelValue":a[1]||(a[1]=e=>V.value.type=e),direction:"horizontal"},{default:u((()=>[n(k,{name:"常规"},{default:u((()=>[d("常规")])),_:1}),n(k,{name:"回修"},{default:u((()=>[d("回修")])),_:1})])),_:1},8,["modelValue"])])),_:1}),i("p",null,"请选择对应工序"),(o(!0),t(r,null,c(V.value.processes,((e,l)=>(o(),v(h,{key:l,class:"a-b"},{default:u((()=>[0===l?(o(),v(D,{key:0,name:"add",color:"red",size:"25",onClick:a[2]||(a[2]=e=>V.value.processes.push({}))})):_("",!0),0!=l?(o(),v(D,{key:1,name:"clear",color:"red",size:"25",onClick:e=>V.value.processes.splice(l,1)},null,8,["onClick"])):_("",!0),n(g,{modelValue:e.name,"onUpdate:modelValue":a=>e.name=a,name:"工序",label:"工序","label-align":"right",readonly:"",colon:"","label-width":"2.5em",class:"bor",onClick:e=>(e=>{q.value=!0,z.value=e})(l),rules:[{required:!0,message:"请填写"}]},null,8,["modelValue","onUpdate:modelValue","onClick"]),n(E,{modelValue:e.necessary,"onUpdate:modelValue":a=>e.necessary=a,name:!1,style:{"margin-left":"15rpx"}},{default:u((()=>[d("不可跳过")])),_:2},1032,["modelValue","onUpdate:modelValue"])])),_:2},1024)))),128))])),_:1}),n(h,{class:"a-c"},{default:u((()=>[n(L,{type:"danger",onClick:a[3]||(a[3]=e=>w.value=!1)},{default:u((()=>[d("取消")])),_:1}),n(L,{type:"primary","native-type":"submit"},{default:u((()=>[d("确认")])),_:1})])),_:1})])),_:1})])),_:1})])),_:1},8,["show"]),n(B,{show:q.value,"onUpdate:show":a[5]||(a[5]=e=>q.value=e),round:"",position:"bottom",onOpen:R},{default:u((()=>[n(G,{"show-toolbar":"",columns:S.value,onConfirm:J,onCancel:N,ref:"pickerRef"},null,8,["columns"])])),_:1},8,["show"])],64)}}}),[["__scopeId","data-v-d28aaded"]]);export{C as default};
