Files
weiyu/deploy/server/admin/p__Dashboard__Service__Customer__index.741b6a6d.async.js
jack ning 37aa0ee8a7 update
2025-07-18 15:36:13 +08:00

1 line
35 KiB
JavaScript

"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[9555],{15722:function(e,t,s){s.d(t,{Z:function(){return d}});var r=s(73743),a=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 a.createElement(i.Z,(0,r.Z)({},e,{ref:t,icon:n}))};var d=a.forwardRef(o)},59993:function(e,t,s){var r=s(69578),a=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,r.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,r=t.getFieldValue(e.name||[]);return(0,g.jsx)(d.Z,(0,a.Z)((0,a.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,r),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,r=(0,n.Z)(e,m);return(0,g.jsx)(c.Z,(0,a.Z)({valueType:f,fieldProps:t,filedConfig:{valueType:f},proFieldProps:s},r))};M.Password=function(e){var t=e.fieldProps,s=e.proFieldProps,i=(0,n.Z)(e,p),o=(0,u.useState)(!1),d=(0,r.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,a.Z)({valueType:"password",fieldProps:(0,a.Z)((0,a.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,a.Z)({valueType:"password",fieldProps:t,proFieldProps:s,filedConfig:{valueType:f}},i))},M.displayName="ProFormComponent",t.Z=M},44517:function(e,t,s){var r=s(7657),a=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,a.Z)(e,d);return(0,o.jsx)(i.Z,(0,r.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 xe}});var r=s(75002),a=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,a.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,a.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,a.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,a.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),U=s(2484),L=s(46336),R=s(99898),O=s(17966),E=s(34353),z=s(41994),N=s(28977),q=s.n(N),D=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,r=e.open,n=e.onClose,i=e.onSubmit,o=(0,a.useIntl)(),l=J.A.useForm(),u=p()(l,1)[0],c=K.Z.Text;(0,D.useEffect)((function(){r&&(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())}),[r,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)(R.Z,{children:[(0,H.jsx)(E.ZP,{onClick:n,children:(0,H.jsx)(a.FormattedMessage,{id:"cancel",defaultMessage:"取消"})}),(0,H.jsx)(E.ZP,{type:"primary",onClick:function(){u.validateFields().then((function(e){var r=d()(d()({},e),t&&s?{uid:s.uid}:{});i(r)}))},children:(0,H.jsx)(a.FormattedMessage,{id:"submit",defaultMessage:"提交"})})]});return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(G.Z,{title:g,onClose:n,open:r,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)(a.FormattedMessage,{id:"nickname",defaultMessage:"昵称"}),":"]})," ",s.nickname||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"email",defaultMessage:"邮箱"}),":"]})," ",s.email||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"mobile",defaultMessage:"手机"}),":"]})," ",s.mobile||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"description",defaultMessage:"描述"}),":"]})," ",s.description||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"notes",defaultMessage:"备注"}),":"]})," ",s.notes||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"extra",defaultMessage:"额外信息"}),":"]})," ",s.extra||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"createdAt",defaultMessage:"创建时间"}),":"]})," ",s.createdAt||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(c,{strong:!0,children:[(0,H.jsx)(a.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)(a.FormattedMessage,{id:"nickname",defaultMessage:"昵称"}),rules:[{required:!0,message:"请输入客户昵称"}]}),(0,H.jsx)(X.Z,{name:"email",label:(0,H.jsx)(a.FormattedMessage,{id:"email",defaultMessage:"邮箱"}),rules:[{type:"email",message:"请输入有效的邮箱地址"}]}),(0,H.jsx)(X.Z,{name:"mobile",label:(0,H.jsx)(a.FormattedMessage,{id:"mobile",defaultMessage:"手机"})}),(0,H.jsx)(Y.Z,{name:"description",label:(0,H.jsx)(a.FormattedMessage,{id:"description",defaultMessage:"描述"})}),(0,H.jsx)(Y.Z,{name:"notes",label:(0,H.jsx)(a.FormattedMessage,{id:"notes",defaultMessage:"备注"})}),(0,H.jsx)(Y.Z,{name:"extra",label:(0,H.jsx)(a.FormattedMessage,{id:"extra",defaultMessage:"额外信息"})})]})})})},Q=["current","pageSize"],W=[{dataIndex:"index",valueType:"indexBorder",width:48,fixed:"left"},{title:(0,H.jsx)(a.FormattedMessage,{id:"uid",defaultMessage:"Uid"}),dataIndex:"uid",hideInSearch:!0,fixed:"left",ellipsis:!0},{title:(0,H.jsx)(a.FormattedMessage,{id:"nickname",defaultMessage:"Nickname"}),dataIndex:"nickname",copyable:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"customer.nickname.tooltip"})},{title:(0,H.jsx)(a.FormattedMessage,{id:"email",defaultMessage:"Email"}),dataIndex:"email",hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"customer.email.tooltip"})},{title:(0,H.jsx)(a.FormattedMessage,{id:"mobile",defaultMessage:"Mobile"}),dataIndex:"mobile",copyable:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"customer.mobile.tooltip"})},{title:(0,H.jsx)(a.FormattedMessage,{id:"description",defaultMessage:"Description"}),dataIndex:"description",hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"customer.description.tooltip"})},{title:(0,H.jsx)(a.FormattedMessage,{id:"createdAt",defaultMessage:"createdAt"}),key:"createdAt",dataIndex:"createdAt",sorter:!0,hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"customer.createdAt.tooltip"}),render:function(e,t,s,r){return q()(t.createdAt).format("YYYY-MM-DD HH:mm:ss")}}],_=function(e){e.isSuperUser;var t=(0,a.useIntl)(),s=(0,D.useRef)(),r=(0,D.useState)(1),n=p()(r,2),o=n[0],l=n[1],c=(0,D.useState)(10),m=p()(c,2),j=m[0],y=m[1],F=(0,k.u)((function(e){return e.currentOrg})),Z=(0,D.useState)({}),N=p()(Z,2),q=N[0],J=N[1],X=(0,D.useState)(0),Y=p()(X,2),K=Y[0],G=Y[1],_=(0,D.useState)([]),$=p()(_,2),ee=$[0],te=$[1],se=(0,D.useState)([]),re=p()(se,2),ae=(re[0],re[1]),ne=(0,D.useState)(!1),ie=p()(ne,2),oe=ie[0],de=ie[1],le=(0,D.useState)(!1),ue=p()(le,2),ce=ue[0],ge=ue[1],me=(0,D.useState)(),pe=p()(me,2),fe=pe[0],xe=pe[1],Me=function(){var e=g()(u()().mark((function e(r){var a,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()({},r),{},{uid:fe.uid,orgUid:null==F?void 0:F.uid}));case 4:a=e.sent,e.next=10;break;case 7:return e.next=9,v(d()(d()({},r),{},{orgUid:null==F?void 0:F.uid}));case 9:a=e.sent;case 10:200===a.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(a.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,r){return(0,H.jsxs)(R.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)}(r)}})}),(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)}(r)}})}),(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 r;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:(r=g()(u()().mark((function r(){var a,n;return u()().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,w({uid:e.uid,orgUid:null==F?void 0:F.uid});case 3:200===(a=r.sent).code?(f.yw.success(t.formatMessage({id:"delete.success",defaultMessage:"删除成功!"})),null===(n=s.current)||void 0===n||n.reload()):f.yw.error(a.message||t.formatMessage({id:"delete.failed",defaultMessage:"删除失败!"})),r.next=11;break;case 7:r.prev=7,r.t0=r.catch(0),console.error("删除客户出错:",r.t0),f.yw.error(t.formatMessage({id:"delete.failed",defaultMessage:"删除失败!"}));case 11:case"end":return r.stop()}}),r,null,[[0,7]])}))),function(){return r.apply(this,arguments)})})}(r)}})})]})}}]),ve=function(){var e=g()(u()().mark((function e(t,s,r){var a,n;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("handleExportExcel",t,s,r),a=localStorage.getItem(M.LA8),n=d()({orgUid:(null==F?void 0:F.uid)||"",accessToken:a||"",exportType:t},q),"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!==r&&(n.pageNumber=String(s),n.pageSize=String(r)),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,r){return e.apply(this,arguments)}}(),ye=function(e){for(var t=[],s=1e3,r=Math.ceil(e/s),a=function(){var r=n,a=n*s+1,i=Math.min((n+1)*s,e);t.push({key:"export-".concat(n),label:"".concat(a,"-").concat(i," (").concat(i-a+1,"条)"),onClick:function(){return ve("range",r,s)}})},n=0;n<r;n++)a();return t},be={selectedRowKeys:ee,onChange:function(e,t){te(e),ae(t)}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(L.Z,{columns:je,actionRef:s,cardBordered:!0,rowSelection:be,scroll:{x:1300},request:function(){var e=g()(u()().mark((function e(t,s,r){var a,n,o,c,g,m,p,x;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.current,n=t.pageSize,o=i()(t,Q),l(a),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:a-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,r){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)(U.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 re.apply(this,arguments)}function re(){return(re=g()(u()().mark((function e(t){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,a.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 ae(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,a.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,a.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,a.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(41313),ce=s(88638),ge=function(e){var t,s=e.isEdit,r=e.browse,n=e.open,i=e.onClose,o=e.onSubmit,l=(0,a.useIntl)(),u=ce.Z.useForm(),c=p()(u,1)[0],g=K.Z.Text;(0,D.useEffect)((function(){var e;n&&(s&&r?c.setFieldsValue({url:r.url||"",title:r.title||"",referrer:r.referrer||"",ipAddress:r.ipAddress||"",deviceType:r.deviceType||"",operatingSystem:r.operatingSystem||"",browser:r.browser||"",screenResolution:r.screenResolution||"",duration:r.duration||"",pageLoadTime:r.pageLoadTime||"",geoLocation:r.geoLocation||"",sessionId:r.sessionId||"",userAgent:r.userAgent||"",utmSource:r.utmSource||"",utmMedium:r.utmMedium||"",utmCampaign:r.utmCampaign||"",status:(null===(e=r.visitor)||void 0===e?void 0:e.status)||"",eventData:r.eventData||""}):c.resetFields())}),[n,s,r,c]);var m=s?l.formatMessage({id:"browse.edit",defaultMessage:"编辑客户"}):l.formatMessage({id:"browse.create",defaultMessage:"新增客户"}),f=r&&!s,x=f?null:(0,H.jsxs)(R.Z,{children:[(0,H.jsx)(E.ZP,{onClick:i,children:(0,H.jsx)(a.FormattedMessage,{id:"cancel",defaultMessage:"取消"})}),(0,H.jsx)(E.ZP,{type:"primary",onClick:function(){c.validateFields().then((function(e){var t=d()(d()({},e),s&&r?{uid:r.uid}:{});o(t)}))},children:(0,H.jsx)(a.FormattedMessage,{id:"submit",defaultMessage:"提交"})})]});return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(G.Z,{title:m,onClose:i,open:n,width:500,extra:x,children:f&&r?(0,H.jsxs)("div",{children:[(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"url",defaultMessage:"URL"}),":"]})," ",r.url||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"title",defaultMessage:"标题"}),":"]})," ",r.title||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"referrer",defaultMessage:"来源"}),":"]})," ",r.referrer||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"ipAddress",defaultMessage:"IP地址"}),":"]})," ",r.ipAddress||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"deviceType",defaultMessage:"设备类型"}),":"]})," ",r.deviceType||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"operatingSystem",defaultMessage:"操作系统"}),":"]})," ",r.operatingSystem||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"browser",defaultMessage:"浏览器"}),":"]})," ",r.browser||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"screenResolution",defaultMessage:"屏幕分辨率"}),":"]})," ",r.screenResolution||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"duration",defaultMessage:"停留时长"}),":"]})," ",r.duration?"".concat(r.duration,"秒"):"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"pageLoadTime",defaultMessage:"页面加载时间"}),":"]})," ",r.pageLoadTime?"".concat(r.pageLoadTime,"毫秒"):"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"geoLocation",defaultMessage:"地理位置"}),":"]})," ",r.geoLocation||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"sessionId",defaultMessage:"会话ID"}),":"]})," ",r.sessionId||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"userAgent",defaultMessage:"User-Agent"}),":"]})," ",r.userAgent||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"utmSource",defaultMessage:"UTM来源"}),":"]})," ",r.utmSource||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"utmMedium",defaultMessage:"UTM媒介"}),":"]})," ",r.utmMedium||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"utmCampaign",defaultMessage:"UTM活动"}),":"]})," ",r.utmCampaign||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"browse.status",defaultMessage:"状态"}),":"]})," ",(null===(t=r.visitor)||void 0===t?void 0:t.status)||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"eventData",defaultMessage:"事件数据"}),":"]})," ",r.eventData||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"createdAt",defaultMessage:"创建时间"}),":"]})," ",r.createdAt||"-"]}),(0,H.jsxs)("div",{style:{marginBottom:16},children:[(0,H.jsxs)(g,{strong:!0,children:[(0,H.jsx)(a.FormattedMessage,{id:"updatedAt",defaultMessage:"更新时间"}),":"]})," ",r.updatedAt||"-"]})]}):(0,H.jsxs)(J.A,{form:c,name:"browseForm",submitter:!1,children:[(0,H.jsx)(X.Z,{name:"url",label:(0,H.jsx)(a.FormattedMessage,{id:"url",defaultMessage:"URL"}),rules:[{required:!0,message:"请输入访问的URL"}]}),(0,H.jsx)(X.Z,{name:"title",label:(0,H.jsx)(a.FormattedMessage,{id:"title",defaultMessage:"标题"}),rules:[{required:!0,message:"请输入页面标题"}]}),(0,H.jsx)(X.Z,{name:"referrer",label:(0,H.jsx)(a.FormattedMessage,{id:"referrer",defaultMessage:"来源"}),placeholder:"来源页面URL"}),(0,H.jsx)(X.Z,{name:"ipAddress",label:(0,H.jsx)(a.FormattedMessage,{id:"ipAddress",defaultMessage:"IP地址"})}),(0,H.jsx)(X.Z,{name:"deviceType",label:(0,H.jsx)(a.FormattedMessage,{id:"deviceType",defaultMessage:"设备类型"}),placeholder:"desktop/mobile/tablet"}),(0,H.jsx)(X.Z,{name:"operatingSystem",label:(0,H.jsx)(a.FormattedMessage,{id:"operatingSystem",defaultMessage:"操作系统"})}),(0,H.jsx)(X.Z,{name:"browser",label:(0,H.jsx)(a.FormattedMessage,{id:"browser",defaultMessage:"浏览器"})}),(0,H.jsx)(X.Z,{name:"screenResolution",label:(0,H.jsx)(a.FormattedMessage,{id:"screenResolution",defaultMessage:"屏幕分辨率"}),placeholder:"如 1920x1080"}),(0,H.jsx)(X.Z,{name:"duration",label:(0,H.jsx)(a.FormattedMessage,{id:"duration",defaultMessage:"停留时长(秒)"}),fieldProps:{type:"number"}}),(0,H.jsx)(X.Z,{name:"pageLoadTime",label:(0,H.jsx)(a.FormattedMessage,{id:"pageLoadTime",defaultMessage:"页面加载时间(毫秒)"}),fieldProps:{type:"number"}}),(0,H.jsx)(X.Z,{name:"geoLocation",label:(0,H.jsx)(a.FormattedMessage,{id:"geoLocation",defaultMessage:"地理位置"})}),(0,H.jsx)(X.Z,{name:"sessionId",label:(0,H.jsx)(a.FormattedMessage,{id:"sessionId",defaultMessage:"会话ID"})}),(0,H.jsx)(Y.Z,{name:"userAgent",label:(0,H.jsx)(a.FormattedMessage,{id:"userAgent",defaultMessage:"User-Agent"})}),(0,H.jsx)(X.Z,{name:"utmSource",label:(0,H.jsx)(a.FormattedMessage,{id:"utmSource",defaultMessage:"UTM来源"})}),(0,H.jsx)(X.Z,{name:"utmMedium",label:(0,H.jsx)(a.FormattedMessage,{id:"utmMedium",defaultMessage:"UTM媒介"})}),(0,H.jsx)(X.Z,{name:"utmCampaign",label:(0,H.jsx)(a.FormattedMessage,{id:"utmCampaign",defaultMessage:"UTM活动"})}),(0,H.jsx)(X.Z,{name:"status",label:(0,H.jsx)(a.FormattedMessage,{id:"browse.status",defaultMessage:"状态"}),placeholder:"默认为 ONLINE"}),(0,H.jsx)(Y.Z,{name:"eventData",label:(0,H.jsx)(a.FormattedMessage,{id:"eventData",defaultMessage:"事件数据"}),placeholder:"JSON格式的事件信息"})]})})})},me=["current","pageSize"],pe=[{dataIndex:"index",valueType:"indexBorder",width:48,fixed:"left"},{title:(0,H.jsx)(a.FormattedMessage,{id:"uid",defaultMessage:"Uid"}),dataIndex:"uid",hideInSearch:!0,fixed:"left",ellipsis:!0},{title:(0,H.jsx)(a.FormattedMessage,{id:"url",defaultMessage:"URL"}),dataIndex:"url",copyable:!0,ellipsis:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.url.tooltip",defaultMessage:"访问的URL地址"}),render:function(e,t){return t.url?(0,H.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url}):"-"}},{title:(0,H.jsx)(a.FormattedMessage,{id:"title",defaultMessage:"标题"}),dataIndex:"title",ellipsis:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.title.tooltip",defaultMessage:"页面标题"})},{title:(0,H.jsx)(a.FormattedMessage,{id:"referrer",defaultMessage:"来源"}),dataIndex:"referrer",ellipsis:!0,hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.referrer.tooltip",defaultMessage:"来源页面URL"}),render:function(e,t){return t.referrer?(0,H.jsx)("a",{href:t.referrer,target:"_blank",rel:"noopener noreferrer",children:t.referrer}):"-"}},{title:(0,H.jsx)(a.FormattedMessage,{id:"deviceType",defaultMessage:"设备类型"}),dataIndex:"deviceType",hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.deviceType.tooltip",defaultMessage:"设备类型(desktop/mobile/tablet)"})},{title:(0,H.jsx)(a.FormattedMessage,{id:"browser",defaultMessage:"浏览器"}),dataIndex:"browser",hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.browser.tooltip",defaultMessage:"浏览器类型"})},{title:(0,H.jsx)(a.FormattedMessage,{id:"duration",defaultMessage:"停留时长"}),dataIndex:"duration",hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.duration.tooltip",defaultMessage:"停留时长(秒)"}),render:function(e,t){return t.duration?"".concat(t.duration,"秒"):"-"}},{title:(0,H.jsx)(a.FormattedMessage,{id:"ipAddress",defaultMessage:"IP地址"}),dataIndex:"ipAddress",copyable:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.ipAddress.tooltip",defaultMessage:"访客IP地址"})},{title:(0,H.jsx)(a.FormattedMessage,{id:"geoLocation",defaultMessage:"地理位置"}),dataIndex:"geoLocation",hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.geoLocation.tooltip",defaultMessage:"访客地理位置"})},{title:(0,H.jsx)(a.FormattedMessage,{id:"status",defaultMessage:"状态"}),dataIndex:"status",hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.status.tooltip",defaultMessage:"访客状态"}),render:function(e,t){var s,r,n;return"ONLINE"===(null===(s=t.visitor)||void 0===s?void 0:s.status)?(0,H.jsx)(ue.Z,{color:"green",children:(0,H.jsx)(a.FormattedMessage,{id:"visitor.status.online"})}):"OFFLINE"===(null===(r=t.visitor)||void 0===r?void 0:r.status)?(0,H.jsx)(ue.Z,{color:"red",children:(0,H.jsx)(a.FormattedMessage,{id:"visitor.status.offline"})}):"BLOCKED"===(null===(n=t.visitor)||void 0===n?void 0:n.status)?(0,H.jsx)(ue.Z,{color:"black",children:(0,H.jsx)(a.FormattedMessage,{id:"visitor.status.blocked"})}):(0,H.jsx)(ue.Z,{color:"default",children:(0,H.jsx)(a.FormattedMessage,{id:"visitor.status.unknown"})})}},{title:(0,H.jsx)(a.FormattedMessage,{id:"createdAt",defaultMessage:"访问时间"}),key:"createdAt",dataIndex:"createdAt",sorter:!0,hideInSearch:!0,tooltip:(0,H.jsx)(a.FormattedMessage,{id:"browse.createdAt.tooltip",defaultMessage:"访问时间"}),render:function(e,t,s,r){return q()(t.createdAt).format("YYYY-MM-DD HH:mm:ss")}}],fe=function(e){e.isSuperUser;var t=(0,a.useIntl)(),s=(0,D.useRef)(),r=(0,D.useState)(1),n=p()(r,2),o=n[0],l=n[1],c=(0,D.useState)(10),m=p()(c,2),h=m[0],j=m[1],v=(0,k.u)((function(e){return e.currentOrg})),y=(0,D.useState)({}),b=p()(y,2),F=b[0],w=b[1],Z=(0,D.useState)(0),N=p()(Z,2),q=N[0],J=N[1],X=(0,D.useState)([]),Y=p()(X,2),K=Y[0],G=Y[1],V=(0,D.useState)([]),Q=p()(V,2),W=(Q[0],Q[1]),_=(0,D.useState)(!1),$=p()(_,2),ee=$[0],te=$[1],re=(0,D.useState)(!1),ne=p()(re,2),oe=ne[0],le=ne[1],ue=(0,D.useState)(),ce=p()(ue,2),fe=ce[0],xe=ce[1],Me=function(){var e=g()(u()().mark((function e(r){var a,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()({},r),{},{uid:fe.uid,orgUid:null==v?void 0:v.uid}));case 4:a=e.sent,e.next=10;break;case 7:return e.next=9,ae(d()(d()({},r),{},{orgUid:null==v?void 0:v.uid}));case 9:a=e.sent;case 10:200===a.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(a.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(pe,[{title:t.formatMessage({id:"actions",defaultMessage:"Actions"}),valueType:"option",key:"option",width:180,fixed:"right",render:function(e,r){return(0,H.jsxs)(R.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)}(r)}})}),(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)}(r)}})}),(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 r;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:(r=g()(u()().mark((function r(){var a,n;return u()().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,de({uid:e.uid,orgUid:null==v?void 0:v.uid});case 3:200===(a=r.sent).code?(f.yw.success(t.formatMessage({id:"delete.success",defaultMessage:"删除成功!"})),null===(n=s.current)||void 0===n||n.reload()):f.yw.error(a.message||t.formatMessage({id:"delete.failed",defaultMessage:"删除失败!"})),r.next=11;break;case 7:r.prev=7,r.t0=r.catch(0),console.error("删除客户出错:",r.t0),f.yw.error(t.formatMessage({id:"delete.failed",defaultMessage:"删除失败!"}));case 11:case"end":return r.stop()}}),r,null,[[0,7]])}))),function(){return r.apply(this,arguments)})})}(r)}})})]})}}]),ve=function(){var e=g()(u()().mark((function e(t,s,r){var a,n;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("handleExportExcel",t,s,r),a=localStorage.getItem(M.LA8),n=d()({orgUid:(null==v?void 0:v.uid)||"",accessToken:a||"",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!==r&&(n.pageNumber=String(s),n.pageSize=String(r)),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,r){return e.apply(this,arguments)}}(),ye=function(e){for(var t=[],s=1e3,r=Math.ceil(e/s),a=function(){var r=n,a=n*s+1,i=Math.min((n+1)*s,e);t.push({key:"export-".concat(n),label:"".concat(a,"-").concat(i," (").concat(i-a+1,"条)"),onClick:function(){return ve("range",r,s)}})},n=0;n<r;n++)a();return t},be={selectedRowKeys:K,onChange:function(e,t){G(e),W(t)}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(L.Z,{columns:je,actionRef:s,cardBordered:!0,rowSelection:be,scroll:{x:2500},request:function(){var e=g()(u()().mark((function e(t,s,r){var a,n,o,c,g,m,p,x;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.current,n=t.pageSize,o=i()(t,me),l(a),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:a-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,r){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")}}],q>0&&(q<=1e3?e.push({key:"export-all",icon:(0,H.jsx)(A.Z,{}),label:t.formatMessage({id:"export.all",defaultMessage:"导出全部"})+" (".concat(q,"条)"),onClick:function(){return ve("all")}}):e.push({key:"export-range",icon:(0,H.jsx)(A.Z,{}),label:t.formatMessage({id:"export.range",defaultMessage:"分段导出"})+" (".concat(q,"条)"),children:ye(q)})),[(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)(U.Z,{})]})},"exportOperations")];var e}}),(0,H.jsx)(ge,{isEdit:oe,browse:fe,open:ee,onClose:function(){return te(!1)},onSubmit:Me})]})},xe=function(){var e=(0,a.useIntl)(),t=[{key:"visitor",label:e.formatMessage({id:"visitor.tab.all"}),children:(0,H.jsx)(te.Z,{isSuperUser:!1})},{key:"black",label:e.formatMessage({id:"visitor.tab.black"}),children:(0,H.jsx)($.Z,{isSuperUser:!1})},{key:"blackip",label:e.formatMessage({id:"visitor.tab.blackip"}),children:(0,H.jsx)(ee.Z,{isSuperUser:!1})},{key:"customer",label:e.formatMessage({id:"customer"}),children:(0,H.jsx)(_,{isSuperUser:!1})},{key:"browse",label:e.formatMessage({id:"browse.tab.all"}),children:(0,H.jsx)(fe,{isSuperUser:!1})}];return(0,H.jsx)(r.Z,{defaultActiveKey:"visitor",items:t,style:{margin:10}})}}}]);