platform-edit.e5247f.js 3.4 KB

1
  1. import{_ as G,d as H,v as Z,w as d,Z as k,z as $,r as u,aC as J,H as K,o as D,G as B,C as t,j as a,M as h,a as L,aN as x,y as P}from"./index.js";import{a as Q,e as W}from"./index.6d72fac6.js";const X=H({__name:"platform-edit",props:{itemId:{type:String,default:""},showModel:{type:Boolean,default:!1},isDetails:{type:String,default:"add"},sitem:{type:Object}},emits:["cancel","refresh"],setup(C,{emit:y}){const w=C,{logout:A}=Z(),N=d("default"),f=d(),c=d(!1),E=d(""),m=d("add"),b={id:"",nickname:"",mobile:"",companyNo:""},l=k({...b}),M=k({}),U=d([]),T=async o=>{!o||await o.validate(async(e,s)=>{if(e){if(p.value===!0)return;const n=Object.assign({},l),{code:i,message:v}=await Q(n);p.value=!1,i===0?(x.success(_.value+"\u6210\u529F\uFF01"),c.value=!1,y("refresh")):i>100&&i<140?(c.value=!1,A()):x.error(v)}})};async function j(){const o=await W({});U.value=o.data}const z=async(o,e)=>{o&&(o.clearValidate(),o.resetFields()),await P(async()=>{for(let s in l)s==="companyArr"&&e.company_relaton?m.value!=="add"?e.company_relaton.forEach(n=>{l.companyArr.push({...n,is_main:n.is_main==="1"})}):l.companyArr=[]:l[s]=e[s]})},F=()=>{c.value=!1,l.companyArr=[],y("cancel")},p=d(!0),_=d("");async function g(o){p.value=!0,_.value="\u8BBE\u7F6E\u90E8\u95E8",await j(),z(f.value,o),p.value=!1}return $(()=>w.showModel,()=>{const{showModel:o,itemId:e,isDetails:s,sitem:n}=w;c.value=o,c.value&&(E.value=e,m.value=s,g(s!=="add"?n:b))}),(o,e)=>{const s=u("el-input"),n=u("el-form-item"),i=u("el-col"),v=u("el-option"),S=u("el-select"),I=u("el-row"),V=u("el-button"),O=u("el-form"),R=u("el-dialog"),q=J("loading");return K((D(),B(R,{"close-on-press-escape":!1,"close-on-click-modal":!1,modelValue:c.value,"onUpdate:modelValue":e[4]||(e[4]=r=>c.value=r),"append-to-body":"",width:"900px",center:"",title:_.value,onClose:F},{default:t(()=>[a(O,{class:"demo-ruleForm",ref_key:"ruleFormRef",ref:f,model:l,rules:M,"label-width":"90px",size:N.value,"status-icon":""},{default:t(()=>[a(I,null,{default:t(()=>[a(i,{span:24},{default:t(()=>[a(n,{label:"\u771F\u5B9E\u59D3\u540D",prop:"nickname"},{default:t(()=>[a(s,{modelValue:l.nickname,"onUpdate:modelValue":e[0]||(e[0]=r=>l.nickname=r),disabled:m.value==="view",placeholder:"\u771F\u5B9E\u59D3\u540D"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),a(i,{span:24},{default:t(()=>[a(n,{label:"\u624B\u673A\u53F7",prop:"mobile"},{default:t(()=>[a(s,{modelValue:l.mobile,"onUpdate:modelValue":e[1]||(e[1]=r=>l.mobile=r),disabled:m.value==="view",maxlength:11,placeholder:"\u624B\u673A\u53F7"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),a(i,{span:24},{default:t(()=>[a(n,{label:"\u4E1A\u52A1\u516C\u53F8",prop:"companyNo"},{default:t(()=>[a(S,{modelValue:l.companyNo,"onUpdate:modelValue":e[2]||(e[2]=r=>l.companyNo=r)},{default:t(()=>[a(v)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),a(i,{span:24,class:"clear"},{default:t(()=>[m.value==="add"||m.value==="edit"?(D(),B(V,{key:0,type:"primary",class:"fr",style:{margin:"0 0 0 16px"},onClick:e[3]||(e[3]=r=>T(f.value)),loading:p.value},{default:t(()=>[h("\u4FDD\u5B58")]),_:1},8,["loading"])):L("v-if",!0),a(V,{class:"fr",style:{margin:"0 0 0 16px"},onClick:F},{default:t(()=>[h("\u5173\u95ED")]),_:1})]),_:1})]),_:1},8,["model","rules","size"])]),_:1},8,["modelValue","title"])),[[q,p.value]])}}});var ae=G(X,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/interest/account/platform-edit.vue"]]);export{ae as default};