| 1 |
- import{d as $,i as _,y as z,l as N,q as L,r as i,o as P,b as M,w as a,C as H,c as t,B as T,a as J,s as K,e as c,f as y,F as Q,h as F,D as G,S as X,x as V,I as Y,t as Z,p as ee,j as te,_ as oe}from"./index-3b8b93f4.js";import{p as U}from"./index-519a55fb.js";import"./CusNavigation.vue_vue_type_style_index_0_scoped_5e63f475_lang-c9f54a72.js";import{C as ae}from"./CusNavigation-0a2cb184.js";import{R as ne}from"./ReloadOutlined-79e30c0a.js";const le=$({__name:"Add",emits:["onSuccess"],setup(v,{expose:b,emit:k}){const d=_(null),f=_(!1),u=_(!0),n=z({id:void 0,name:"",description:""}),p=function(){let s="";u.value?s="/product/add":s="/product/edit",U({url:s,data:n},o=>{console.log(o),T.info(o.msg),x(),k("onSuccess",o)})},O=s=>{var o;console.log("handleOK",s),(o=d.value)==null||o.validate().then(()=>{console.log("11"),p()},()=>{console.log("22")})},w=()=>{f.value=!0},x=()=>{f.value=!1},I=()=>{var s;u.value=!0,H(n),(s=d.value)==null||s.clearValidate(),w()},C=s=>{var o;u.value=!1,Object.assign(n,s),(o=d.value)==null||o.clearValidate(),w()};return N(()=>{console.log("onMounted")}),L(()=>{console.log("onUnmounted")}),b({add:I,update:C}),(s,o)=>{const R=i("a-input"),S=i("a-form-item"),e=i("a-textarea"),l=i("a-form"),g=i("a-modal");return P(),M(g,{title:"添加产品",visible:f.value,"onUpdate:visible":o[2]||(o[2]=r=>f.value=r),maskClosable:!1,width:480,cancelText:"取消",okText:"确定",onOk:O},{default:a(()=>[t(l,{ref_key:"formRef",ref:d,model:n,name:"basic","label-align":"left","label-col":{span:4},"wrapper-col":{span:20},autocomplete:"off",layout:"vertical"},{default:a(()=>[t(S,{"wrapper-col":{offset:0,span:24},label:"产品名称",name:"name",rules:[{required:!0,message:"请输入产品名称!"}]},{default:a(()=>[t(R,{size:"large",value:n.name,"onUpdate:value":o[0]||(o[0]=r=>n.name=r)},null,8,["value"])]),_:1}),t(S,{"wrapper-col":{offset:0,span:24},label:"描述",name:"description",rules:[{required:!1,message:"请输入产品描述!"}]},{default:a(()=>[t(e,{value:n.description,"onUpdate:value":o[1]||(o[1]=r=>n.description=r),placeholder:"请输入描述","allow-clear":""},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible"])}}}),j=v=>(ee("data-v-f9b2cff5"),v=v(),te(),v),se={class:"cus-animation",style:{height:"100%",width:"100%",padding:"16px 20px",display:"flex","flex-direction":"column"}},ie={style:{display:"flex","justify-content":"space-between","align-items":"flex-end"}},ce={style:{display:"flex"}},de=j(()=>c("span",null,"添加",-1)),re=["onClick"],ue=["onClick"],pe=j(()=>c("a",{style:{"margin-left":"26px"}},"删除",-1)),fe=$({__name:"Index",setup(v){const b=_(null),k=z({x:1300}),d=z({pageSize:20,current:1,size:"default",showSizeChanger:!0,showQuickJumper:!0,showTotal:function(e){return`共 ${e} 条数据`},onChange:function(e,l){console.log("111",e,l),this.current=e,this.pageSize=l,p()}}),f=_([]),u=_(!1),n=z({size:20,page:1,sort:"createtime",order:"desc",keyWord:""}),p=()=>{u.value=!0,n.size=d.pageSize,n.page=d.current,U({url:"/product/search",data:n},e=>{console.log(e),d.total=e.total,f.value=e.data,u.value=!1},e=>{T.error(e),u.value=!1})},O=()=>{C.push("/"+F+"/product/common")},w=function(){d.current=1,p()},x=_(null),I=e=>{var l;console.log(e),(l=x.value)==null||l.add()},C=J(),s=e=>{console.log(e),C.push("/"+F+"/product/detail/"+e.code)},o=e=>{console.log(e);const l={id:e.id};U({url:"/product/delete",data:l},g=>{console.log(g),T.info(g.msg),p()})},R=e=>{var l;console.log(e),(l=x.value)==null||l.update(e)},S=e=>{console.log(e),p()};return N(()=>{var e;k.y=((e=b.value)==null?void 0:e.clientHeight)-113,p()}),(e,l)=>{const g=i("a-button"),r=i("a-tooltip"),q=i("a-input"),A=i("a-form-item"),D=i("a-form"),h=i("a-table-column"),W=i("a-popconfirm"),E=i("a-table");return P(),K(Q,null,[c("div",se,[t(y(ae),{title:"产品"}),c("div",ie,[c("div",ce,[t(g,{type:"primary",style:{"margin-right":"10px",background:"#0058FF"},onClick:I},{icon:a(()=>[t(y(G))]),default:a(()=>[de]),_:1}),t(D,{layout:"inline",model:n},{default:a(()=>[t(A,null,{default:a(()=>[t(q,{allowClear:"",value:n.keyWord,"onUpdate:value":l[0]||(l[0]=m=>n.keyWord=m),placeholder:"请输入要查询的内容",style:{width:"280px"}},{suffix:a(()=>[t(r,{title:"点击搜索",onClick:w},{default:a(()=>[t(y(X),{style:{color:"rgba(0, 0, 0, 0.45)"}})]),_:1})]),_:1},8,["value"])]),_:1})]),_:1},8,["model"])]),c("div",null,[t(r,{onClick:O},{title:a(()=>[V("通用功能")]),default:a(()=>[t(y(Y),{style:{"font-size":"16px","margin-right":"20px"}})]),_:1}),t(r,{onClick:p,placement:"topLeft"},{title:a(()=>[V("刷新列表")]),default:a(()=>[t(y(ne),{style:{"font-size":"16px"}})]),_:1})])]),c("div",{ref_key:"table_container",ref:b,style:{"margin-top":"9px","border-top":"1px solid #eee",display:"flex","flex-direction":"column",overflow:"hidden",height:"0px","flex-grow":"1"}},[t(E,{"data-source":f.value,pagination:d,scroll:k,bordered:!0,loading:u.value,size:"middle"},{default:a(()=>[t(h,{title:"序号",width:60,fixed:"left",align:"center"},{default:a(({index:m})=>[c("div",null,Z(m+1),1)]),_:1}),t(h,{title:"名称","data-index":"name",width:300,fixed:"left",align:"center"}),t(h,{title:"描述","data-index":"description","min-width":200}),t(h,{title:"创建时间","data-index":"createtime",width:200}),t(h,{title:"操作",width:200,fixed:"right"},{default:a(({record:m})=>[c("div",null,[c("a",{onClick:B=>s(m)},"查看",8,re),c("a",{style:{"margin-left":"26px"},onClick:B=>R(m)},"编辑",8,ue),t(W,{title:"确定删除?",okText:"确定",cancelText:"取消",onConfirm:B=>o(m)},{default:a(()=>[pe]),_:2},1032,["onConfirm"])])]),_:1})]),_:1},8,["data-source","pagination","scroll","loading"])],512)]),t(le,{ref_key:"addRef",ref:x,onOnSuccess:S},null,512)],64)}}});const he=oe(fe,[["__scopeId","data-v-f9b2cff5"]]);export{he as default};
|