mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-05-17 20:57:51 +00:00
1 line
34 KiB
JavaScript
1 line
34 KiB
JavaScript
"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[9555],{15722:function(e,t,s){s.d(t,{Z:function(){return d}});var a=s(73743),r=s(44194),n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},i=s(54183),o=function(e,t){return r.createElement(i.Z,(0,a.Z)({},e,{ref:t,icon:n}))};var d=r.forwardRef(o)},59993:function(e,t,s){var a=s(69578),r=s(7657),n=s(75101),i=s(81424),o=s(88638),d=s(1784),l=s(34573),u=s(44194),c=s(47563),g=s(31549),m=["fieldProps","proFieldProps"],p=["fieldProps","proFieldProps"],f="text",x=function(e){var t=(0,i.Z)(e.open||!1,{value:e.open,onChange:e.onOpenChange}),s=(0,a.Z)(t,2),n=s[0],l=s[1];return(0,g.jsx)(o.Z.Item,{shouldUpdate:!0,noStyle:!0,children:function(t){var s,a=t.getFieldValue(e.name||[]);return(0,g.jsx)(d.Z,(0,r.Z)((0,r.Z)({getPopupContainer:function(e){return e&&e.parentNode?e.parentNode:e},onOpenChange:function(e){return l(e)},content:(0,g.jsxs)("div",{style:{padding:"4px 0"},children:[null===(s=e.statusRender)||void 0===s?void 0:s.call(e,a),e.strengthText?(0,g.jsx)("div",{style:{marginTop:10},children:(0,g.jsx)("span",{children:e.strengthText})}):null]}),overlayStyle:{width:240},placement:"rightTop"},e.popoverProps),{},{open:n,children:e.children}))}})},M=function(e){var t=e.fieldProps,s=e.proFieldProps,a=(0,n.Z)(e,m);return(0,g.jsx)(c.Z,(0,r.Z)({valueType:f,fieldProps:t,filedConfig:{valueType:f},proFieldProps:s},a))};M.Password=function(e){var t=e.fieldProps,s=e.proFieldProps,i=(0,n.Z)(e,p),o=(0,u.useState)(!1),d=(0,a.Z)(o,2),m=d[0],M=d[1];return null!=t&&t.statusRender&&i.name?(0,g.jsx)(x,{name:i.name,statusRender:null==t?void 0:t.statusRender,popoverProps:null==t?void 0:t.popoverProps,strengthText:null==t?void 0:t.strengthText,open:m,onOpenChange:M,children:(0,g.jsx)("div",{children:(0,g.jsx)(c.Z,(0,r.Z)({valueType:"password",fieldProps:(0,r.Z)((0,r.Z)({},(0,l.Z)(t,["statusRender","popoverProps","strengthText"])),{},{onBlur:function(e){var s;null==t||null===(s=t.onBlur)||void 0===s||s.call(t,e),M(!1)},onClick:function(e){var s;null==t||null===(s=t.onClick)||void 0===s||s.call(t,e),M(!0)}}),proFieldProps:s,filedConfig:{valueType:f}},i))})}):(0,g.jsx)(c.Z,(0,r.Z)({valueType:"password",fieldProps:t,proFieldProps:s,filedConfig:{valueType:f}},i))},M.displayName="ProFormComponent",t.Z=M},44517:function(e,t,s){var a=s(7657),r=s(75101),n=s(44194),i=s(47563),o=s(31549),d=["fieldProps","proFieldProps"],l=function(e,t){var s=e.fieldProps,n=e.proFieldProps,l=(0,r.Z)(e,d);return(0,o.jsx)(i.Z,(0,a.Z)({ref:t,valueType:"textarea",fieldProps:s,proFieldProps:n},l))};t.Z=n.forwardRef(l)},34861:function(e,t,s){s.r(t),s.d(t,{default:function(){return fe}});var a=s(75002),r=s(43906),n=s(84176),i=s.n(n),o=s(73193),d=s.n(o),l=s(90819),u=s.n(l),c=s(89933),g=s.n(c),m=s(45332),p=s.n(m),f=s(55567),x=s(39686),M=s(18232);function h(e){return j.apply(this,arguments)}function j(){return(j=g()(u()().mark((function e(t){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,r.request)("/api/v1/customer/query/org",{method:"GET",params:d()(d()({},t),{},{channel:M.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(e){return y.apply(this,arguments)}function y(){return(y=g()(u()().mark((function e(t){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,r.request)("/api/v1/customer/create",{method:"POST",data:d()(d()({},t),{},{channel:M.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(e){return F.apply(this,arguments)}function F(){return(F=g()(u()().mark((function e(t){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,r.request)("/api/v1/customer/update",{method:"POST",data:d()(d()({},t),{},{channel:M.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w(e){return Z.apply(this,arguments)}function Z(){return(Z=g()(u()().mark((function e(t){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,r.request)("/api/v1/customer/delete",{method:"POST",data:d()(d()({},t),{},{channel:M.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var k=s(9942),S=s(81343),T=s(15722),P=s(5321),I=s(59304),C=s(54881),A=s(11090),B=s(10162),R=s(2484),U=s(46336),L=s(99898),O=s(17966),E=s(34353),z=s(41994),q=s(28977),D=s.n(q),N=s(44194),J=s(48792),X=s(59993),Y=s(44517),K=s(68060),G=s(75843),H=s(31549),V=function(e){var t=e.isEdit,s=e.customer,a=e.open,n=e.onClose,i=e.onSubmit,o=(0,r.useIntl)(),l=J.A.useForm(),u=p()(l,1)[0],c=K.Z.Text;(0,N.useEffect)((function(){a&&(t&&s?u.setFieldsValue({nickname:s.nickname||"",email:s.email||"",mobile:s.mobile||"",description:s.description||"",notes:s.notes||"",extra:s.extra||"",channel:s.channel||""}):u.resetFields())}),[a,t,s,u]);var g=t?o.formatMessage({id:"customer.edit",defaultMessage:"编辑客户"}):o.formatMessage({id:"customer.create",defaultMessage:"新增客户"}),m=s&&!t,f=m?null:(0,H.jsxs)(L.Z,{children:[(0,H.jsx)(E.ZP,{onClick:n,children:(0,H.jsx)(r.FormattedMessage,{id:"cancel",defaultMessage:"取消"})}),(0,H.jsx)(E.ZP,{type:"primary",onClick:function(){u.validateFields().then((function(e){var a=d()(d()({},e),t&&s?{uid:s.uid}:{});i(a)}))},children:(0,H.jsx)(r.FormattedMessage,{id:"submit",defaultMessage:"提交"})})]});return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(G.Z,{title:g,onClose:n,open:a,width:500,extra:f,children:m&&s?(0,H.jsxs)("div",{children:[(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"nickname",defaultMessage:"昵称"}),":"]})," ",s.nickname||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"email",defaultMessage:"邮箱"}),":"]})," ",s.email||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"mobile",defaultMessage:"手机"}),":"]})," ",s.mobile||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"description",defaultMessage:"描述"}),":"]})," ",s.description||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"notes",defaultMessage:"备注"}),":"]})," ",s.notes||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"extra",defaultMessage:"额外信息"}),":"]})," ",s.extra||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"createdAt",defaultMessage:"创建时间"}),":"]})," ",s.createdAt||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"updatedAt",defaultMessage:"更新时间"}),":"]})," ",s.updatedAt||"-"]})]}):(0,H.jsxs)(J.A,{form:u,name:"customerForm",submitter:!1,children:[(0,H.jsx)(X.Z,{name:"nickname",label:(0,H.jsx)(r.FormattedMessage,{id:"nickname",defaultMessage:"昵称"}),rules:[{required:!0,message:"请输入客户昵称"}]}),(0,H.jsx)(X.Z,{name:"email",label:(0,H.jsx)(r.FormattedMessage,{id:"email",defaultMessage:"邮箱"}),rules:[{type:"email",message:"请输入有效的邮箱地址"}]}),(0,H.jsx)(X.Z,{name:"mobile",label:(0,H.jsx)(r.FormattedMessage,{id:"mobile",defaultMessage:"手机"})}),(0,H.jsx)(Y.Z,{name:"description",label:(0,H.jsx)(r.FormattedMessage,{id:"description",defaultMessage:"描述"})}),(0,H.jsx)(Y.Z,{name:"notes",label:(0,H.jsx)(r.FormattedMessage,{id:"notes",defaultMessage:"备注"})}),(0,H.jsx)(Y.Z,{name:"extra",label:(0,H.jsx)(r.FormattedMessage,{id:"extra",defaultMessage:"额外信息"})})]})})})},Q=["current","pageSize"],W=[{dataIndex:"index",valueType:"indexBorder",width:48,fixed:"left"},{title:(0,H.jsx)(r.FormattedMessage,{id:"uid",defaultMessage:"Uid"}),dataIndex:"uid",hideInSearch:!0,fixed:"left",ellipsis:!0},{title:(0,H.jsx)(r.FormattedMessage,{id:"nickname",defaultMessage:"Nickname"}),dataIndex:"nickname",copyable:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"customer.nickname.tooltip"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"email",defaultMessage:"Email"}),dataIndex:"email",hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"customer.email.tooltip"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"mobile",defaultMessage:"Mobile"}),dataIndex:"mobile",copyable:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"customer.mobile.tooltip"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"description",defaultMessage:"Description"}),dataIndex:"description",hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"customer.description.tooltip"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"createdAt",defaultMessage:"createdAt"}),key:"createdAt",dataIndex:"createdAt",sorter:!0,hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"customer.createdAt.tooltip"}),render:function(e,t,s,a){return D()(t.createdAt).format("YYYY-MM-DD HH:mm:ss")}}],$=function(e){e.isSuper;var t=(0,r.useIntl)(),s=(0,N.useRef)(),a=(0,N.useState)(1),n=p()(a,2),o=n[0],l=n[1],c=(0,N.useState)(10),m=p()(c,2),j=m[0],y=m[1],F=(0,k.u)((function(e){return e.currentOrg})),Z=(0,N.useState)({}),q=p()(Z,2),D=q[0],J=q[1],X=(0,N.useState)(0),Y=p()(X,2),K=Y[0],G=Y[1],$=(0,N.useState)([]),_=p()($,2),ee=_[0],te=_[1],se=(0,N.useState)([]),ae=p()(se,2),re=(ae[0],ae[1]),ne=(0,N.useState)(!1),ie=p()(ne,2),oe=ie[0],de=ie[1],le=(0,N.useState)(!1),ue=p()(le,2),ce=ue[0],ge=ue[1],me=(0,N.useState)(),pe=p()(me,2),fe=pe[0],xe=pe[1],Me=function(){var e=g()(u()().mark((function e(a){var r,n;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!ce||!fe){e.next=7;break}return e.next=4,b(d()(d()({},a),{},{uid:fe.uid,orgUid:null==F?void 0:F.uid}));case 4:r=e.sent,e.next=10;break;case 7:return e.next=9,v(d()(d()({},a),{},{orgUid:null==F?void 0:F.uid}));case 9:r=e.sent;case 10:200===r.code?(f.yw.success(ce?t.formatMessage({id:"update.success",defaultMessage:"更新成功!"}):t.formatMessage({id:"create.success",defaultMessage:"创建成功!"})),de(!1),null===(n=s.current)||void 0===n||n.reload()):f.yw.error(r.message||t.formatMessage({id:"operation.failed",defaultMessage:"操作失败!"})),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(0),console.error("提交客户表单出错:",e.t0),f.yw.error(t.formatMessage({id:"operation.failed",defaultMessage:"操作失败!"}));case 17:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(t){return e.apply(this,arguments)}}(),he=function(){xe(void 0),ge(!1),de(!0)},je=[].concat(W,[{title:t.formatMessage({id:"actions",defaultMessage:"Actions"}),valueType:"option",key:"option",width:180,fixed:"right",render:function(e,a){return(0,H.jsxs)(L.Z,{children:[(0,H.jsx)(O.Z,{title:t.formatMessage({id:"view",defaultMessage:"查看"}),children:(0,H.jsx)(E.ZP,{type:"text",icon:(0,H.jsx)(P.Z,{}),onClick:function(){return function(e){xe(e),ge(!1),de(!0)}(a)}})}),(0,H.jsx)(O.Z,{title:t.formatMessage({id:"edit",defaultMessage:"编辑"}),children:(0,H.jsx)(E.ZP,{type:"text",icon:(0,H.jsx)(I.Z,{}),onClick:function(){return function(e){xe(e),ge(!0),de(!0)}(a)}})}),(0,H.jsx)(O.Z,{title:t.formatMessage({id:"delete",defaultMessage:"删除"}),children:(0,H.jsx)(E.ZP,{type:"text",danger:!0,icon:(0,H.jsx)(C.Z,{}),onClick:function(){return function(e){var a;x.Z.confirm({title:t.formatMessage({id:"customer.delete.confirm",defaultMessage:"确定要删除该客户吗?"}),icon:(0,H.jsx)(T.Z,{}),content:t.formatMessage({id:"customer.delete.confirm.content",defaultMessage:"删除后将无法恢复,请谨慎操作!"}),onOk:(a=g()(u()().mark((function a(){var r,n;return u()().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,w({uid:e.uid,orgUid:null==F?void 0:F.uid});case 3:200===(r=a.sent).code?(f.yw.success(t.formatMessage({id:"delete.success",defaultMessage:"删除成功!"})),null===(n=s.current)||void 0===n||n.reload()):f.yw.error(r.message||t.formatMessage({id:"delete.failed",defaultMessage:"删除失败!"})),a.next=11;break;case 7:a.prev=7,a.t0=a.catch(0),console.error("删除客户出错:",a.t0),f.yw.error(t.formatMessage({id:"delete.failed",defaultMessage:"删除失败!"}));case 11:case"end":return a.stop()}}),a,null,[[0,7]])}))),function(){return a.apply(this,arguments)})})}(a)}})})]})}}]),ve=function(){var e=g()(u()().mark((function e(t,s,a){var r,n;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("handleExportExcel",t,s,a),r=localStorage.getItem(M.LA8),n=d()({orgUid:(null==F?void 0:F.uid)||"",accessToken:r||"",exportType:t},D),"current"===t?(n.pageNumber=String(o-1),n.pageSize=String(j)):"all"===t?(n.pageNumber="0",n.pageSize="1000"):"range"===t&&void 0!==s&&void 0!==a&&(n.pageNumber=String(s),n.pageSize=String(a)),window.open((0,S.kG)()+"/api/v1/customer/export?"+new URLSearchParams(n).toString());case 5:case"end":return e.stop()}}),e)})));return function(t,s,a){return e.apply(this,arguments)}}(),ye=function(e){for(var t=[],s=1e3,a=Math.ceil(e/s),r=function(){var a=n,r=n*s+1,i=Math.min((n+1)*s,e);t.push({key:"export-".concat(n),label:"".concat(r,"-").concat(i," (").concat(i-r+1,"条)"),onClick:function(){return ve("range",a,s)}})},n=0;n<a;n++)r();return t},be={selectedRowKeys:ee,onChange:function(e,t){te(e),re(t)}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(U.Z,{columns:je,actionRef:s,cardBordered:!0,rowSelection:be,scroll:{x:1300},request:function(){var e=g()(u()().mark((function e(t,s,a){var r,n,o,c,g,m,p,x;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.current,n=t.pageSize,o=i()(t,Q),l(r),y(n),J(o),c=void 0,g=void 0,s&&Object.keys(s).length>0&&(m=Object.keys(s)[0],c=m,g="ascend"===s[m]?"ascend":"descend"),p=d()(d()({pageNumber:r-1,pageSize:n,orgUid:null==F?void 0:F.uid},o),{},{sortBy:c,sortDirection:g}),e.next=10,h(p);case 10:return x=e.sent,console.log("queryCustomersByOrg response:",x,p),200===x.code?G(x.data.totalElements):f.yw.error(x.message),e.abrupt("return",{data:x.data.content,success:!0,total:x.data.totalElements});case 14:case"end":return e.stop()}}),e)})));return function(t,s,a){return e.apply(this,arguments)}}(),editable:{type:"multiple"},rowKey:"uid",search:{labelWidth:"auto"},pagination:{showQuickJumper:!0,onChange:function(e,t){l(e),y(t),console.log("page:",e,"size:",t)}},dateFormatter:"string",headerTitle:"客户列表",toolBarRender:function(){return e=[{key:"export-current",icon:(0,H.jsx)(A.Z,{}),label:t.formatMessage({id:"export.current",defaultMessage:"导出当前页"}),onClick:function(){return ve("current")}}],K>0&&(K<=1e3?e.push({key:"export-all",icon:(0,H.jsx)(A.Z,{}),label:t.formatMessage({id:"export.all",defaultMessage:"导出全部"})+" (".concat(K,"条)"),onClick:function(){return ve("all")}}):e.push({key:"export-range",icon:(0,H.jsx)(A.Z,{}),label:t.formatMessage({id:"export.range",defaultMessage:"分段导出"})+" (".concat(K,"条)"),children:ye(K)})),[(0,H.jsx)(E.ZP,{type:"primary",icon:(0,H.jsx)(B.Z,{}),onClick:he,children:t.formatMessage({id:"add",defaultMessage:"新增"})},"add"),(0,H.jsx)(z.Z,{menu:{items:e},placement:"bottom",children:(0,H.jsxs)(E.ZP,{type:"primary",icon:(0,H.jsx)(A.Z,{}),children:[t.formatMessage({id:"export",defaultMessage:"导出"}),(0,H.jsx)(R.Z,{})]})},"exportOperations")];var e}}),(0,H.jsx)(V,{isEdit:ce,customer:fe,open:oe,onClose:function(){return de(!1)},onSubmit:Me})]})},_=s(21349),ee=s(91034),te=s(96981);function se(e){return ae.apply(this,arguments)}function ae(){return(ae=g()(u()().mark((function e(t){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,r.request)("/api/v1/browse/query/org",{method:"GET",params:d()(d()({},t),{},{channel:M.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(e){return ne.apply(this,arguments)}function ne(){return(ne=g()(u()().mark((function e(t){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,r.request)("/api/v1/browse/create",{method:"POST",data:d()(d()({},t),{},{channel:M.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ie(e){return oe.apply(this,arguments)}function oe(){return(oe=g()(u()().mark((function e(t){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,r.request)("/api/v1/browse/update",{method:"POST",data:d()(d()({},t),{},{channel:M.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function de(e){return le.apply(this,arguments)}function le(){return(le=g()(u()().mark((function e(t){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,r.request)("/api/v1/browse/delete",{method:"POST",data:d()(d()({},t),{},{channel:M.XtJ})}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ue=s(88638),ce=function(e){var t=e.isEdit,s=e.browse,a=e.open,n=e.onClose,i=e.onSubmit,o=(0,r.useIntl)(),l=ue.Z.useForm(),u=p()(l,1)[0],c=K.Z.Text;(0,N.useEffect)((function(){a&&(t&&s?u.setFieldsValue({url:s.url||"",title:s.title||"",referrer:s.referrer||"",ipAddress:s.ipAddress||"",deviceType:s.deviceType||"",operatingSystem:s.operatingSystem||"",browser:s.browser||"",screenResolution:s.screenResolution||"",duration:s.duration||"",pageLoadTime:s.pageLoadTime||"",geoLocation:s.geoLocation||"",sessionId:s.sessionId||"",userAgent:s.userAgent||"",utmSource:s.utmSource||"",utmMedium:s.utmMedium||"",utmCampaign:s.utmCampaign||"",status:s.status||"",eventData:s.eventData||""}):u.resetFields())}),[a,t,s,u]);var g=t?o.formatMessage({id:"browse.edit",defaultMessage:"编辑客户"}):o.formatMessage({id:"browse.create",defaultMessage:"新增客户"}),m=s&&!t,f=m?null:(0,H.jsxs)(L.Z,{children:[(0,H.jsx)(E.ZP,{onClick:n,children:(0,H.jsx)(r.FormattedMessage,{id:"cancel",defaultMessage:"取消"})}),(0,H.jsx)(E.ZP,{type:"primary",onClick:function(){u.validateFields().then((function(e){var a=d()(d()({},e),t&&s?{uid:s.uid}:{});i(a)}))},children:(0,H.jsx)(r.FormattedMessage,{id:"submit",defaultMessage:"提交"})})]});return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(G.Z,{title:g,onClose:n,open:a,width:500,extra:f,children:m&&s?(0,H.jsxs)("div",{children:[(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"url",defaultMessage:"URL"}),":"]})," ",s.url||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"title",defaultMessage:"标题"}),":"]})," ",s.title||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"referrer",defaultMessage:"来源"}),":"]})," ",s.referrer||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"ipAddress",defaultMessage:"IP地址"}),":"]})," ",s.ipAddress||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"deviceType",defaultMessage:"设备类型"}),":"]})," ",s.deviceType||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"operatingSystem",defaultMessage:"操作系统"}),":"]})," ",s.operatingSystem||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"browser",defaultMessage:"浏览器"}),":"]})," ",s.browser||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"screenResolution",defaultMessage:"屏幕分辨率"}),":"]})," ",s.screenResolution||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"duration",defaultMessage:"停留时长"}),":"]})," ",s.duration?"".concat(s.duration,"秒"):"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"pageLoadTime",defaultMessage:"页面加载时间"}),":"]})," ",s.pageLoadTime?"".concat(s.pageLoadTime,"毫秒"):"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"geoLocation",defaultMessage:"地理位置"}),":"]})," ",s.geoLocation||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"sessionId",defaultMessage:"会话ID"}),":"]})," ",s.sessionId||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"userAgent",defaultMessage:"User-Agent"}),":"]})," ",s.userAgent||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"utmSource",defaultMessage:"UTM来源"}),":"]})," ",s.utmSource||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"utmMedium",defaultMessage:"UTM媒介"}),":"]})," ",s.utmMedium||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"utmCampaign",defaultMessage:"UTM活动"}),":"]})," ",s.utmCampaign||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"browse.status",defaultMessage:"状态"}),":"]})," ",s.status||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"eventData",defaultMessage:"事件数据"}),":"]})," ",s.eventData||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"createdAt",defaultMessage:"创建时间"}),":"]})," ",s.createdAt||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(r.FormattedMessage,{id:"updatedAt",defaultMessage:"更新时间"}),":"]})," ",s.updatedAt||"-"]})]}):(0,H.jsxs)(J.A,{form:u,name:"browseForm",submitter:!1,children:[(0,H.jsx)(X.Z,{name:"url",label:(0,H.jsx)(r.FormattedMessage,{id:"url",defaultMessage:"URL"}),rules:[{required:!0,message:"请输入访问的URL"}]}),(0,H.jsx)(X.Z,{name:"title",label:(0,H.jsx)(r.FormattedMessage,{id:"title",defaultMessage:"标题"}),rules:[{required:!0,message:"请输入页面标题"}]}),(0,H.jsx)(X.Z,{name:"referrer",label:(0,H.jsx)(r.FormattedMessage,{id:"referrer",defaultMessage:"来源"}),placeholder:"来源页面URL"}),(0,H.jsx)(X.Z,{name:"ipAddress",label:(0,H.jsx)(r.FormattedMessage,{id:"ipAddress",defaultMessage:"IP地址"})}),(0,H.jsx)(X.Z,{name:"deviceType",label:(0,H.jsx)(r.FormattedMessage,{id:"deviceType",defaultMessage:"设备类型"}),placeholder:"desktop/mobile/tablet"}),(0,H.jsx)(X.Z,{name:"operatingSystem",label:(0,H.jsx)(r.FormattedMessage,{id:"operatingSystem",defaultMessage:"操作系统"})}),(0,H.jsx)(X.Z,{name:"browser",label:(0,H.jsx)(r.FormattedMessage,{id:"browser",defaultMessage:"浏览器"})}),(0,H.jsx)(X.Z,{name:"screenResolution",label:(0,H.jsx)(r.FormattedMessage,{id:"screenResolution",defaultMessage:"屏幕分辨率"}),placeholder:"如 1920x1080"}),(0,H.jsx)(X.Z,{name:"duration",label:(0,H.jsx)(r.FormattedMessage,{id:"duration",defaultMessage:"停留时长(秒)"}),fieldProps:{type:"number"}}),(0,H.jsx)(X.Z,{name:"pageLoadTime",label:(0,H.jsx)(r.FormattedMessage,{id:"pageLoadTime",defaultMessage:"页面加载时间(毫秒)"}),fieldProps:{type:"number"}}),(0,H.jsx)(X.Z,{name:"geoLocation",label:(0,H.jsx)(r.FormattedMessage,{id:"geoLocation",defaultMessage:"地理位置"})}),(0,H.jsx)(X.Z,{name:"sessionId",label:(0,H.jsx)(r.FormattedMessage,{id:"sessionId",defaultMessage:"会话ID"})}),(0,H.jsx)(Y.Z,{name:"userAgent",label:(0,H.jsx)(r.FormattedMessage,{id:"userAgent",defaultMessage:"User-Agent"})}),(0,H.jsx)(X.Z,{name:"utmSource",label:(0,H.jsx)(r.FormattedMessage,{id:"utmSource",defaultMessage:"UTM来源"})}),(0,H.jsx)(X.Z,{name:"utmMedium",label:(0,H.jsx)(r.FormattedMessage,{id:"utmMedium",defaultMessage:"UTM媒介"})}),(0,H.jsx)(X.Z,{name:"utmCampaign",label:(0,H.jsx)(r.FormattedMessage,{id:"utmCampaign",defaultMessage:"UTM活动"})}),(0,H.jsx)(X.Z,{name:"status",label:(0,H.jsx)(r.FormattedMessage,{id:"browse.status",defaultMessage:"状态"}),placeholder:"默认为 ONLINE"}),(0,H.jsx)(Y.Z,{name:"eventData",label:(0,H.jsx)(r.FormattedMessage,{id:"eventData",defaultMessage:"事件数据"}),placeholder:"JSON格式的事件信息"})]})})})},ge=["current","pageSize"],me=[{dataIndex:"index",valueType:"indexBorder",width:48,fixed:"left"},{title:(0,H.jsx)(r.FormattedMessage,{id:"uid",defaultMessage:"Uid"}),dataIndex:"uid",hideInSearch:!0,fixed:"left",ellipsis:!0},{title:(0,H.jsx)(r.FormattedMessage,{id:"url",defaultMessage:"URL"}),dataIndex:"url",copyable:!0,ellipsis:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.url.tooltip",defaultMessage:"访问的URL地址"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"title",defaultMessage:"标题"}),dataIndex:"title",ellipsis:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.title.tooltip",defaultMessage:"页面标题"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"referrer",defaultMessage:"来源"}),dataIndex:"referrer",ellipsis:!0,hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.referrer.tooltip",defaultMessage:"来源页面URL"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"deviceType",defaultMessage:"设备类型"}),dataIndex:"deviceType",hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.deviceType.tooltip",defaultMessage:"设备类型(desktop/mobile/tablet)"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"browser",defaultMessage:"浏览器"}),dataIndex:"browser",hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.browser.tooltip",defaultMessage:"浏览器类型"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"duration",defaultMessage:"停留时长"}),dataIndex:"duration",hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.duration.tooltip",defaultMessage:"停留时长(秒)"}),render:function(e,t){return t.duration?"".concat(t.duration,"秒"):"-"}},{title:(0,H.jsx)(r.FormattedMessage,{id:"ipAddress",defaultMessage:"IP地址"}),dataIndex:"ipAddress",copyable:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.ipAddress.tooltip",defaultMessage:"访客IP地址"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"geoLocation",defaultMessage:"地理位置"}),dataIndex:"geoLocation",hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.geoLocation.tooltip",defaultMessage:"访客地理位置"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"browse.status",defaultMessage:"状态"}),dataIndex:"status",hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.status.tooltip",defaultMessage:"浏览状态"})},{title:(0,H.jsx)(r.FormattedMessage,{id:"createdAt",defaultMessage:"访问时间"}),key:"createdAt",dataIndex:"createdAt",sorter:!0,hideInSearch:!0,tooltip:(0,H.jsx)(r.FormattedMessage,{id:"browse.createdAt.tooltip",defaultMessage:"访问时间"}),render:function(e,t,s,a){return D()(t.createdAt).format("YYYY-MM-DD HH:mm:ss")}}],pe=function(e){e.isSuper;var t=(0,r.useIntl)(),s=(0,N.useRef)(),a=(0,N.useState)(1),n=p()(a,2),o=n[0],l=n[1],c=(0,N.useState)(10),m=p()(c,2),h=m[0],j=m[1],v=(0,k.u)((function(e){return e.currentOrg})),y=(0,N.useState)({}),b=p()(y,2),F=b[0],w=b[1],Z=(0,N.useState)(0),q=p()(Z,2),D=q[0],J=q[1],X=(0,N.useState)([]),Y=p()(X,2),K=Y[0],G=Y[1],V=(0,N.useState)([]),Q=p()(V,2),W=(Q[0],Q[1]),$=(0,N.useState)(!1),_=p()($,2),ee=_[0],te=_[1],ae=(0,N.useState)(!1),ne=p()(ae,2),oe=ne[0],le=ne[1],ue=(0,N.useState)(),pe=p()(ue,2),fe=pe[0],xe=pe[1],Me=function(){var e=g()(u()().mark((function e(a){var r,n;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!oe||!fe){e.next=7;break}return e.next=4,ie(d()(d()({},a),{},{uid:fe.uid,orgUid:null==v?void 0:v.uid}));case 4:r=e.sent,e.next=10;break;case 7:return e.next=9,re(d()(d()({},a),{},{orgUid:null==v?void 0:v.uid}));case 9:r=e.sent;case 10:200===r.code?(f.yw.success(oe?t.formatMessage({id:"update.success",defaultMessage:"更新成功!"}):t.formatMessage({id:"create.success",defaultMessage:"创建成功!"})),te(!1),null===(n=s.current)||void 0===n||n.reload()):f.yw.error(r.message||t.formatMessage({id:"operation.failed",defaultMessage:"操作失败!"})),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(0),console.error("提交客户表单出错:",e.t0),f.yw.error(t.formatMessage({id:"operation.failed",defaultMessage:"操作失败!"}));case 17:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(t){return e.apply(this,arguments)}}(),he=function(){xe(void 0),le(!1),te(!0)},je=[].concat(me,[{title:t.formatMessage({id:"actions",defaultMessage:"Actions"}),valueType:"option",key:"option",width:180,fixed:"right",render:function(e,a){return(0,H.jsxs)(L.Z,{children:[(0,H.jsx)(O.Z,{title:t.formatMessage({id:"view",defaultMessage:"查看"}),children:(0,H.jsx)(E.ZP,{type:"text",icon:(0,H.jsx)(P.Z,{}),onClick:function(){return function(e){xe(e),le(!1),te(!0)}(a)}})}),(0,H.jsx)(O.Z,{title:t.formatMessage({id:"edit",defaultMessage:"编辑"}),children:(0,H.jsx)(E.ZP,{type:"text",icon:(0,H.jsx)(I.Z,{}),onClick:function(){return function(e){xe(e),le(!0),te(!0)}(a)}})}),(0,H.jsx)(O.Z,{title:t.formatMessage({id:"delete",defaultMessage:"删除"}),children:(0,H.jsx)(E.ZP,{type:"text",danger:!0,icon:(0,H.jsx)(C.Z,{}),onClick:function(){return function(e){var a;x.Z.confirm({title:t.formatMessage({id:"browse.delete.confirm",defaultMessage:"确定要删除该客户吗?"}),icon:(0,H.jsx)(T.Z,{}),content:t.formatMessage({id:"browse.delete.confirm.content",defaultMessage:"删除后将无法恢复,请谨慎操作!"}),onOk:(a=g()(u()().mark((function a(){var r,n;return u()().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,de({uid:e.uid,orgUid:null==v?void 0:v.uid});case 3:200===(r=a.sent).code?(f.yw.success(t.formatMessage({id:"delete.success",defaultMessage:"删除成功!"})),null===(n=s.current)||void 0===n||n.reload()):f.yw.error(r.message||t.formatMessage({id:"delete.failed",defaultMessage:"删除失败!"})),a.next=11;break;case 7:a.prev=7,a.t0=a.catch(0),console.error("删除客户出错:",a.t0),f.yw.error(t.formatMessage({id:"delete.failed",defaultMessage:"删除失败!"}));case 11:case"end":return a.stop()}}),a,null,[[0,7]])}))),function(){return a.apply(this,arguments)})})}(a)}})})]})}}]),ve=function(){var e=g()(u()().mark((function e(t,s,a){var r,n;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("handleExportExcel",t,s,a),r=localStorage.getItem(M.LA8),n=d()({orgUid:(null==v?void 0:v.uid)||"",accessToken:r||"",exportType:t},F),"current"===t?(n.pageNumber=String(o-1),n.pageSize=String(h)):"all"===t?(n.pageNumber="0",n.pageSize="1000"):"range"===t&&void 0!==s&&void 0!==a&&(n.pageNumber=String(s),n.pageSize=String(a)),window.open((0,S.kG)()+"/api/v1/browse/export?"+new URLSearchParams(n).toString());case 5:case"end":return e.stop()}}),e)})));return function(t,s,a){return e.apply(this,arguments)}}(),ye=function(e){for(var t=[],s=1e3,a=Math.ceil(e/s),r=function(){var a=n,r=n*s+1,i=Math.min((n+1)*s,e);t.push({key:"export-".concat(n),label:"".concat(r,"-").concat(i," (").concat(i-r+1,"条)"),onClick:function(){return ve("range",a,s)}})},n=0;n<a;n++)r();return t},be={selectedRowKeys:K,onChange:function(e,t){G(e),W(t)}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(U.Z,{columns:je,actionRef:s,cardBordered:!0,rowSelection:be,scroll:{x:2500},request:function(){var e=g()(u()().mark((function e(t,s,a){var r,n,o,c,g,m,p,x;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.current,n=t.pageSize,o=i()(t,ge),l(r),j(n),w(o),c=void 0,g=void 0,s&&Object.keys(s).length>0&&(m=Object.keys(s)[0],c=m,g="ascend"===s[m]?"ascend":"descend"),p=d()(d()({pageNumber:r-1,pageSize:n,orgUid:null==v?void 0:v.uid},o),{},{sortBy:c,sortDirection:g}),e.next=10,se(p);case 10:return x=e.sent,console.log("queryBrowsesByOrg response:",x,p),200===x.code?J(x.data.totalElements):f.yw.error(x.message),e.abrupt("return",{data:x.data.content,success:!0,total:x.data.totalElements});case 14:case"end":return e.stop()}}),e)})));return function(t,s,a){return e.apply(this,arguments)}}(),editable:{type:"multiple"},rowKey:"uid",search:{labelWidth:"auto"},pagination:{showQuickJumper:!0,onChange:function(e,t){l(e),j(t),console.log("page:",e,"size:",t)}},dateFormatter:"string",headerTitle:"客户列表",toolBarRender:function(){return e=[{key:"export-current",icon:(0,H.jsx)(A.Z,{}),label:t.formatMessage({id:"export.current",defaultMessage:"导出当前页"}),onClick:function(){return ve("current")}}],D>0&&(D<=1e3?e.push({key:"export-all",icon:(0,H.jsx)(A.Z,{}),label:t.formatMessage({id:"export.all",defaultMessage:"导出全部"})+" (".concat(D,"条)"),onClick:function(){return ve("all")}}):e.push({key:"export-range",icon:(0,H.jsx)(A.Z,{}),label:t.formatMessage({id:"export.range",defaultMessage:"分段导出"})+" (".concat(D,"条)"),children:ye(D)})),[(0,H.jsx)(E.ZP,{type:"primary",icon:(0,H.jsx)(B.Z,{}),onClick:he,children:t.formatMessage({id:"add",defaultMessage:"新增"})},"add"),(0,H.jsx)(z.Z,{menu:{items:e},placement:"bottom",children:(0,H.jsxs)(E.ZP,{type:"primary",icon:(0,H.jsx)(A.Z,{}),children:[t.formatMessage({id:"export",defaultMessage:"导出"}),(0,H.jsx)(R.Z,{})]})},"exportOperations")];var e}}),(0,H.jsx)(ce,{isEdit:oe,browse:fe,open:ee,onClose:function(){return te(!1)},onSubmit:Me})]})},fe=function(){var e=(0,r.useIntl)(),t=[{key:"visitor",label:e.formatMessage({id:"visitor.tab.all"}),children:(0,H.jsx)(te.Z,{isSuper:!1})},{key:"black",label:e.formatMessage({id:"visitor.tab.black"}),children:(0,H.jsx)(_.Z,{isSuper:!1})},{key:"blackip",label:e.formatMessage({id:"visitor.tab.blackip"}),children:(0,H.jsx)(ee.Z,{isSuper:!1})},{key:"customer",label:e.formatMessage({id:"customer"}),children:(0,H.jsx)($,{isSuper:!1})},{key:"browse",label:e.formatMessage({id:"browse.tab.all"}),children:(0,H.jsx)(pe,{isSuper:!1})}];return(0,H.jsx)(a.Z,{defaultActiveKey:"visitor",items:t,style:{margin:10}})}}}]); |