import{A as _,_ as Z,r as f,C as M,D as Q,e as i,E as S,o as h,c as X,f as t,h as l,G as b,J as k,m,i as n,H as Y,k as R,K as ee,B as te,p as ae,q as ne,v as le}from"./index-C1_1_QXk.js";function oe(a){return _({url:"/djl-role/manufacturer/query/list",method:"get",params:a})}function re(a){return _({url:"/djl-role/manufacturer/check/name",method:"get",params:a})}function U(a){return _({url:"/djl-role/manufacturer/check/occupied",method:"get",params:a})}function ie(a){return _({url:"/djl-role/manufacturer/insert",method:"post",data:a})}function ue(a){return _({url:"/djl-role/manufacturer/update",method:"post",data:a})}function se(a){return _({url:"/djl-role/manufacturer/delete",method:"post",data:a})}const de=a=>(ae("data-v-0121472a"),a=a(),ne(),a),ce={class:"app-container"},me={class:"tips"},pe=de(()=>R("br",null,null,-1)),fe={class:"dialog-footer"},_e=te({name:"Post"}),ge=Object.assign(_e,{setup(a){const{proxy:u}=le(),P=f([]),c=f(!1),C=f(!0);f(!0);const x=f(0),y=f(""),D=M({form:{},queryParams:{page:1,limit:10,name:"",phoneNumber:"",openId:""},rules:{name:[{required:!0,message:"请输入厂商名称",trigger:"blur"},{validator:E,trigger:"blur"}]}});function E(o,e,d){if(e!=""){var $=/^[\u0391-\uFFE5A-Za-z0-9-\s]+$/;$.test(e)||d(new Error("名称中不能含有特殊字符"))}re({name:e,id:s.value.id}).then(V=>{V.data?d():d(new Error("名称重复"))})}const{queryParams:g,form:s,rules:I}=Q(D);function v(){C.value=!0,oe(g.value).then(o=>{P.value=o.data,x.value=o.count,C.value=!1})}function N(){s.value={},c.value=!0,y.value="新增",u.$refs.postRef!==void 0&&u.$refs.postRef.resetFields()}function q(){c.value=!1}function B(o){U({id:o.id}).then(e=>{e.data?u.$modal.msgWarning("厂商被引用，无法编辑名称"):(s.value={...o},c.value=!0,y.value="编辑",u.$refs.postRef!==void 0&&u.$refs.postRef.resetFields())})}function W(){u.$refs.postRef.validate(o=>{o&&(s.value.id?ue(s.value).then(e=>{u.$modal.msgSuccess(e.code),c.value=!1,v()}):ie(s.value).then(e=>{u.$modal.msgSuccess(e.code),c.value=!1,v()}))})}function z(o){U({id:o.id}).then(e=>{e.data?u.$modal.msgWarning("厂商被引用，无法删除"):u.$modal.confirm('是否确认删除厂商为"'+o.name+'"的数据项？').then(function(){return se({id:o.id})}).then(()=>{v(),u.$modal.msgSuccess("删除成功")}).catch(()=>{})})}return v(),(o,e)=>{const d=i("el-button"),$=i("el-col"),V=i("el-row"),p=i("el-table-column"),A=i("el-table"),L=i("pagination"),O=i("WarningFilled"),G=i("el-icon"),j=i("el-input"),F=i("el-form-item"),H=i("el-form"),J=i("el-dialog"),w=S("hasPermi"),K=S("loading");return h(),X("div",ce,[t(V,{gutter:10,class:"mb8"},{default:l(()=>[t($,{span:1.5},{default:l(()=>[b((h(),k(d,{type:"primary",plain:"",icon:"Plus",onClick:N},{default:l(()=>[m("新增")]),_:1})),[[w,["manufacturer:add"]]])]),_:1})]),_:1}),b((h(),k(A,{data:n(P)},{default:l(()=>[t(p,{label:"名称",align:"center",prop:"name"}),t(p,{label:"备注",align:"center",prop:"remark"}),t(p,{label:"创建时间",align:"center",prop:"create_time"}),t(p,{label:"更新时间",align:"center",prop:"update_time"}),t(p,{label:"操作",width:"180",align:"center","class-name":"small-padding fixed-width"},{default:l(({row:r})=>[b((h(),k(d,{link:"",type:"primary",onClick:T=>B(r),icon:"EditPen"},{default:l(()=>[m("编辑")]),_:2},1032,["onClick"])),[[w,["manufacturer:edit"]]]),b((h(),k(d,{link:"",type:"primary",onClick:T=>z(r),icon:"Delete"},{default:l(()=>[m("删除")]),_:2},1032,["onClick"])),[[w,["manufacturer:del"]]])]),_:1})]),_:1},8,["data"])),[[K,n(C)]]),b(t(L,{total:n(x),page:n(g).page,"onUpdate:page":e[0]||(e[0]=r=>n(g).page=r),limit:n(g).limit,"onUpdate:limit":e[1]||(e[1]=r=>n(g).limit=r),onPagination:v},null,8,["total","page","limit"]),[[Y,n(x)>0]]),t(J,{title:n(y),modelValue:n(c),"onUpdate:modelValue":e[4]||(e[4]=r=>ee(c)?c.value=r:null),width:"550px","append-to-body":""},{footer:l(()=>[R("div",fe,[t(d,{type:"primary",onClick:W},{default:l(()=>[m("确 定")]),_:1}),t(d,{onClick:q},{default:l(()=>[m("取 消")]),_:1})])]),default:l(()=>[R("p",me,[t(G,{size:"14px"},{default:l(()=>[t(O)]),_:1}),m(" 厂商名称唯一，被引用后不能删除，请确保您输入的名称正确无误。"),pe,m(" 输入规则：区域名+厂商缩写+特征（选填），例如：上海市嘉定区京东商城售后部。 ")]),t(H,{ref:"postRef",model:n(s),rules:n(I),"label-width":"80px"},{default:l(()=>[t(F,{label:"厂商名称",prop:"name"},{default:l(()=>[t(j,{modelValue:n(s).name,"onUpdate:modelValue":e[2]||(e[2]=r=>n(s).name=r),maxlength:"25",placeholder:"请输入厂商名称"},null,8,["modelValue"])]),_:1}),t(F,{label:"备注",prop:"remark"},{default:l(()=>[t(j,{autosize:{minRows:4},modelValue:n(s).remark,"onUpdate:modelValue":e[3]||(e[3]=r=>n(s).remark=r),type:"textarea",autocomplete:"off",maxlength:"200","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"])])}}}),he=Z(ge,[["__scopeId","data-v-0121472a"]]);export{he as default};
