index.2abe8fc8.js 6.8 KB

1
  1. import{_ as N}from"./page-search.vue_vue_type_script_setup_true_lang.e284bf07.js";import{u as z}from"./use-page-search.da34a19a.js";import{aI as V,aJ as f,aK as j,b as q,p as m,a3 as $,x as H,k as p,ac as K,K as J,o as I,h as W,A as r,j as n,l as R,aL as S,y as X,c as Y,f as s,F as G}from"./index.4d3e3847.js";import{c as Q,r as Z}from"./column-helper.adef10ea.js";import{u as ee,_ as te}from"./use-page-modal.88aec721.js";import{P as oe}from"./page-content.1fdb6363.js";import{u as ne}from"./useAsync.24db85a6.js";import{a as ae}from"./useNav.afbe69e0.js";import{i as ue}from"./validate.93ab4ac7.js";import"./basic-form.114da3ff.js";import"./basic-form.vue_vue_type_style_index_0_scoped_d6f0d2ed_lang.3165143d.js";import"./image.7849d972.js";import"./hooks.428ba1c3.js";import"./index.a5d44002.js";import"./responseHandle.db1518c7.js";import"./xlsx.ed122d16.js";const se={formItems:[{field:"status",type:"select",placeholder:"\u72B6\u6001",options:Q(V)},{field:"username",type:"input",placeholder:"\u8D26\u53F7"}]},M=se,{VITE_PROXY_DOMAIN_REAL:w}=j();async function le(o={}){return f.request("post",`${w}admin/adminAdd`,{data:o})}async function re(o={}){return f.request("post",`${w}admin/adminList`,{data:o})}async function ie(o={}){return f.request("post",`${w}admin/adminRead`,{data:o})}async function de(o={}){return f.request("post",`${w}admin/adminEdit`,{data:o})}async function ce(o={}){return f.request("post",`${w}admin/adminStatus`,{data:o})}async function pe(o={}){return f.request("post",`${w}admin/adminDelete`,{data:o})}async function T(o={}){return f.request("post",`${w}admin/adminChangePasswod`,{data:o})}const me=[{type:"selection",width:55,hide:({checkList:o})=>!o.includes("\u52FE\u9009\u5217")},{label:"\u5E8F\u53F7",type:"index",width:70,hide:({checkList:o})=>!o.includes("\u5E8F\u53F7\u5217")},{label:"\u8D26\u53F7",prop:"username"},{label:"\u89D2\u8272",prop:"role_name"},{label:"\u72B6\u6001",prop:"status",...Z(V)},{label:"\u521B\u5EFA\u65F6\u95F4",width:160,prop:"addtime"},{label:"\u64CD\u4F5C",fixed:"right",width:200,slot:"operation"}],fe={title:"\u8FD0\u8425\u8D26\u53F7",columns:me,apis:{httpAdd:le,httpList:re,httpUpdate:de,httpStatus:ce,httpDelete:pe,httpChangePwd:T}},we=fe,ge={title:"\u8FD0\u8425\u8D26\u53F7",width:"900px",colLayout:{span:24},itemStyle:{},contact:"account",labelWidth:"100px",formItems:[{field:"username",type:"input",label:"\u8D26\u53F7",placeholder:"\u8D26\u53F7",rules:[{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u8D26\u53F7"}]},{field:"role_id",type:"select",label:"\u89D2\u8272",placeholder:"\u89D2\u8272",options:[],rules:[{required:!0,trigger:"change",message:"\u8BF7\u9009\u62E9\u89D2\u8272"}]},{field:"card_id",type:"checkbox",label:"\u5361\u7C7B\u578B",placeholder:"\u5361\u7C7B\u578B",options:[],rules:[{required:!0,trigger:"change",message:"\u8BF7\u9009\u62E9\u5361\u7C7B\u578B"}]}]},Ce=ge,_e=q({__name:"resetPassword",props:{itemId:{type:String,default:""},showModel:{type:Boolean,default:!1}},emits:["cancel","refresh"],setup(o,{emit:F}){const v=o,{logout:E}=ae(),b=m("default"),B=m(),i=m(!1),D=m(""),u=$({id:"",new_password:"",confirmPassword:""}),k=$({new_password:[{required:!0,validator:(t,e,a)=>{e===""?a(new Error("\u65B0\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A\uFF01")):ue(e)?a():a(new Error("\u65B0\u5BC6\u7801\u53EA\u80FD\u80FD\u4E3A\u7EAF\u6570\u5B57\uFF01"))},trigger:"blur"}],confirmPassword:[{required:!0,validator:(t,e,a)=>{e===""?a(new Error("\u786E\u8BA4\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A\uFF01")):u.new_password!==e?a(new Error("\u786E\u8BA4\u5BC6\u7801\u4E0E\u65B0\u5BC6\u7801\u4E0D\u4E00\u81F4\uFF01")):a()},trigger:"blur"}]}),y=async t=>{!t||await t.validate(async(e,a)=>{if(e){if(c.value===!0)return;c.value=!0;let l=Object.assign({},u);l.id="36";const{code:d,message:A}=await T(l);c.value=!1,d===0?(S.success("\u5BC6\u7801\u4FEE\u6539\u6210\u529F\uFF01"),i.value=!1,F("refresh")):d>100&&d<140?(i.value=!1,E()):S.error(A)}})},g=async t=>{!t||(t.clearValidate(),t.resetFields(),await X(async()=>{u.id=D.value,u.new_password="",u.confirmPassword=""}))},h=()=>{i.value=!1,F("cancel")},c=m(!0);async function C(){c.value=!0,await g(B.value),c.value=!1}return H(()=>v.showModel,()=>{const{showModel:t,itemId:e}=v;i.value=t,i.value&&(D.value=e,C())}),(t,e)=>{const a=p("el-input"),l=p("el-form-item"),d=p("el-col"),A=p("el-row"),P=p("el-button"),U=p("el-form"),O=p("el-dialog"),L=K("loading");return J((I(),W(O,{"close-on-press-escape":!1,modelValue:i.value,"onUpdate:modelValue":e[3]||(e[3]=_=>i.value=_),"append-to-body":"",width:"900px",title:"\u4FEE\u6539\u5BC6\u7801",onClose:h},{default:r(()=>[n(U,{ref_key:"ruleFormRef",ref:B,model:u,rules:k,"label-width":"90px",style:{"margin-top":"-10px"},class:"demo-ruleForm",size:b.value,"status-icon":""},{default:r(()=>[n(A,null,{default:r(()=>[n(d,{span:8},{default:r(()=>[n(l,{label:"\u65B0\u5BC6\u7801",prop:"new_password"},{default:r(()=>[n(a,{modelValue:u.new_password,"onUpdate:modelValue":e[0]||(e[0]=_=>u.new_password=_),placeholder:"\u65B0\u5BC6\u7801"},null,8,["modelValue"])]),_:1})]),_:1}),n(d,{span:8},{default:r(()=>[n(l,{label:"\u786E\u8BA4\u5BC6\u7801",prop:"confirmPassword"},{default:r(()=>[n(a,{modelValue:u.confirmPassword,"onUpdate:modelValue":e[1]||(e[1]=_=>u.confirmPassword=_),maxlength:11,placeholder:"\u786E\u8BA4\u5BC6\u7801"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),n(d,{span:24,class:"clear"},{default:r(()=>[n(P,{type:"primary",class:"fr",style:{margin:"0 0 0 16px"},onClick:e[2]||(e[2]=_=>y(B.value))},{default:r(()=>[R("\u4FDD\u5B58")]),_:1}),n(P,{class:"fr",style:{margin:"0 0 0 16px"},onClick:h},{default:r(()=>[R("\u5173\u95ED")]),_:1})]),_:1})]),_:1},8,["model","rules","size"])]),_:1},8,["modelValue"])),[[L,c.value]])}}}),Ve=q({__name:"index",setup(o){const{pageContentRef:F,handleResetClick:v,handleSearchClick:E}=z(void 0,void 0,M),{pageModalRef:b,handleUpdateData:B,handleCreateData:i,handlePreviewData:D,handleConfrim:x,defaultInfo:u}=ee({pageContentRef:F}),k=ne(),y=m(""),g=m(!1);async function h(C,t){const{id:e}=C,{code:a,data:l,message:d}=await ie({id:e});k({code:a,message:d,handler:()=>{l.card_id=l.card_id.toString(),t==="preview"&&D(l),t==="update"&&B(l)}})}function c(C){y.value=C,g.value=!0}return(C,t)=>(I(),Y(G,null,[n(s(N),{"form-config":s(M),onSearchBtnClick:s(E),onResetBtnClick:s(v)},null,8,["form-config","onSearchBtnClick","onResetBtnClick"]),n(s(oe),{ref_key:"pageContentRef",ref:F,"content-config":s(we),onCreateBtnClick:s(i),onPreviewBtnClick:t[0]||(t[0]=e=>h(e,"preview")),onUpdateBtnClick:t[1]||(t[1]=e=>h(e,"update")),onChangePwdBtnClick:t[2]||(t[2]=({id:e})=>c(e))},null,8,["content-config","onCreateBtnClick"]),n(s(te),{ref_key:"pageModalRef",ref:b,"modal-config":s(Ce),"default-info":s(u),onConfirmBtnClick:s(x)},null,8,["modal-config","default-info","onConfirmBtnClick"]),n(_e,{itemId:y.value,"show-model":g.value,onRefresh:t[3]||(t[3]=e=>g.value=!1),onCancel:t[4]||(t[4]=e=>g.value=!1)},null,8,["itemId","show-model"])],64))}});export{Ve as default};