const ENTRY_SOURCE_KEY="entrySource",ENTRY_SOURCE_MY="my",AUTH_REDIRECT_DONE_KEY="authRedirectDone",H5_LAST_AUTH_USER_ID_KEY="H5_LAST_AUTH_USER_ID",H5_LAST_AUTH_TOKEN_KEY="H5_LAST_AUTH_TOKEN",H5_LAST_AUTH_SESSION_ID_KEY="H5_LAST_AUTH_SESSION_ID",H5_LAST_AUTH_TIME_KEY="H5_LAST_AUTH_TIME",H5_SESSION_REFRESH_COOLDOWN_MS=3e5;let miniProgramSessionRefreshPromise=null;function getUrlParams(){const t={},e=new URLSearchParams(window.location.search);for(const[n,o]of e)t[n]=decodeURIComponent(o);return t}function isAuthPage(t=window.location.pathname){return/\/(login|autoLogin)\.html$/i.test(t||"")}function getCurrentPageUrl(){return`${window.location.origin}${window.location.pathname}${window.location.search}`}function getUrlAuthToken(t=getUrlParams()){return t.yhsbToken||t.onlineToken||t.mdToken||""}function getStoredAuthToken(t=getUrlParams()){const e=getUrlAuthToken(t);if(e)return e;const n=localStorage.getItem("userInfo");if(n)try{const t=JSON.parse(n),e=t?.yhsbToken||t?.onlineToken||"";if(e)return e}catch(t){console.warn("解析 userInfo 获取 token 失败:",t)}return localStorage.getItem("yhsbToken")||localStorage.getItem("onlineToken")||""}function isMiniProgramMessageEntry(t=getUrlParams()){return"miniprogram"===t.from&&"my"!==t.entrySource&&"1"!==t.authRedirectDone&&!isAuthPage()}function handleMessageEntryAuthRedirect(){const t=getUrlParams();if(!isMiniProgramMessageEntry(t))return!1;const e=getCurrentPageUrl(),n=getStoredAuthToken(t),o=n?"autoLogin":"login",a=new URLSearchParams({entryScene:"message",redirect:e});n&&a.set("yhsbToken",n),t.JSESSIONID&&a.set("JSESSIONID",t.JSESSIONID),t.userId&&a.set("userId",t.userId),t.xm&&a.set("xm",t.xm);const i=`/page/${o}.html?${a.toString()}`;return console.log("🔐 检测到消息直达页面,准备跳转认证页:",{authPage:o,redirectUrl:e,hasToken:!!n}),window.location.replace(i),!0}function getDeviceInfo(){const t=getUrlParams();let e=t.devId||"",n=t.sbmc||"";if(!e||!n){const t=localStorage.getItem("deviceInfo");if(t)try{const o=JSON.parse(t);e=e||o.deviceId||"",n=n||o.model||"",console.log("🔄 从localStorage获取设备信息:",{deviceId:e,model:n})}catch(t){console.warn("解析localStorage中的设备信息失败:",t)}}if(e&&n){const t={deviceId:e,model:n};localStorage.setItem("deviceInfo",JSON.stringify(t))}return{deviceId:e,model:n}}function getJSessionId(){let t=getUrlParams().JSESSIONID;if(t||(t=localStorage.getItem("JSESSIONID")),!t){const e=document.cookie.split(";");for(let n of e){const[e,o]=n.trim().split("=");if("JSESSIONID"===e){t=o;break}}}return console.log("🔍 获取JSESSIONID:",{fromLocalStorage:localStorage.getItem("JSESSIONID"),fromURL:getUrlParams().JSESSIONID,final:t}),t||""}function saveJSessionId(t){t&&(localStorage.setItem("JSESSIONID",t),document.cookie=`JSESSIONID=${encodeURIComponent(t)}; path=/; SameSite=Lax`,console.log("✅ H5 JSESSIONID已保存:",t))}function readStoredUserInfo(){const t=localStorage.getItem("userInfo");if(!t)return{};try{return JSON.parse(t)||{}}catch(t){return console.warn("解析 userInfo 失败:",t),{}}}function normalizeAuthUserId(t){return null==t?"":String(t).trim()}function getMiniProgramUrlAuthState(){const t=getUrlParams();return{params:t,token:getUrlAuthToken(t),urlUserId:normalizeAuthUserId(t.userId)}}function syncMiniProgramAuthFromUrl(){const{params:t,token:e,urlUserId:n}=getMiniProgramUrlAuthState();if(e||t.userId||t.xm){const o=readStoredUserInfo(),a=normalizeAuthUserId(o.yhid||o.userId),i=t.JSESSIONID||"",s=localStorage.getItem("JSESSIONID")||o.sessId||o.JSESSIONID||o.jsessionId||"",r=n&&a&&n!==a,l=i&&s&&String(i)!==String(s);window.__MINI_AUTH_STATE__={hadStoredUser:!!localStorage.getItem("userInfo"),hasUrlToken:!!e,isDifferentUrlUser:!!r,isDifferentUrlSession:!!l};const c={...o,yhsbToken:t.yhsbToken||t.mdToken||(r?"":o.yhsbToken),onlineToken:t.onlineToken||(r?"":o.onlineToken),sessId:i||(r?"":o.sessId),yhid:n||o.yhid,userId:n||o.userId,xm:t.xm||(r?"":o.xm)};localStorage.setItem("userInfo",JSON.stringify(c)),c.yhsbToken&&localStorage.setItem("yhsbToken",c.yhsbToken),c.onlineToken&&localStorage.setItem("onlineToken",c.onlineToken),console.log("✅ 已同步小程序URL登录态到H5:",{hasToken:!(!c.yhsbToken&&!c.onlineToken),hasSession:!!c.sessId,userId:c.yhid||c.userId||""})}t.JSESSIONID&&saveJSessionId(t.JSESSIONID)}function shouldRefreshSessionForUrlUser(){const{token:t,urlUserId:e}=getMiniProgramUrlAuthState();if(!e||!t)return!1;const n=normalizeAuthUserId(localStorage.getItem("H5_LAST_AUTH_USER_ID")),o=readStoredUserInfo(),a=normalizeAuthUserId(o.yhid||o.userId);if(!n)return!0;if(e!==n)return!0;if(a&&e!==a)return!0;const i=localStorage.getItem("H5_LAST_AUTH_TOKEN")||"";if(i&&i!==t)return!0;const s=getJSessionId(),r=localStorage.getItem("H5_LAST_AUTH_SESSION_ID")||"";return!s||!(!r||s===r)}function hasFreshMiniProgramSession(t,e){if(shouldRefreshSessionForUrlUser())return!1;const n=Date.parse(localStorage.getItem("H5_LAST_AUTH_TIME")||"");if(!Number.isFinite(n))return!1;const o=Date.now()-n;return o>=0&&o<3e5}function unwrapMiniProgramLoginData(t){return t&&"object"==typeof t?t.data&&"object"==typeof t.data?t.data:t.result&&"object"==typeof t.result?t.result:t:t}function clearMiniProgramSessionAuth(){localStorage.removeItem("userInfo"),localStorage.removeItem("JSESSIONID"),localStorage.removeItem("yhsbToken"),localStorage.removeItem("onlineToken"),localStorage.removeItem("H5_LAST_AUTH_USER_ID"),localStorage.removeItem("H5_LAST_AUTH_TOKEN"),localStorage.removeItem("H5_LAST_AUTH_SESSION_ID"),localStorage.removeItem("H5_LAST_AUTH_TIME"),document.cookie="JSESSIONID=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT"}async function doMiniProgramSessionRefresh(t,e,n={}){if("undefined"==typeof axios)throw new Error("axios未加载,无法刷新H5会话");const o=getDeviceInfo(),a=`${window.location.origin}/service?ssServ=ssLogin&wdConfirmationCaptchaService=0&mdToken=${encodeURIComponent(t)}&devId=${encodeURIComponent(o.deviceId||"")}&sbmc=${encodeURIComponent(o.model||"")}`,i=new URLSearchParams;i.append("mdToken",t),console.log("H5_SESSION_REFRESH_START",{page:n.page||"",service:n.service||"",urlUserId:e,hasToken:!!t});const s=unwrapMiniProgramLoginData((await axios.post(a,i,{headers:{"Content-Type":"application/x-www-form-urlencoded"},timeout:3e4,withCredentials:!0})).data);if(!s||"object"!=typeof s)throw new Error("自动登录响应数据无效");if(1===s.errorcode||"UNAUTHORIZED"===s.error||String(s.msg||s.message||"").includes("失败"))throw new Error(s.msg||s.message||"自动登录失败");const r=normalizeAuthUserId(s.yhid||s.userId||s.ryid);if(r&&r!==e)throw new Error("自动登录返回账号与当前小程序账号不一致");const l=s.sessId||s.JSESSIONID||s.jsessionId||"",c=readStoredUserInfo(),d=r||e,u={...c,devId:s.devId||c.devId,sbmc:s.sbmc||c.sbmc,sessId:l||c.sessId,JSESSIONID:l||c.JSESSIONID,jsessionId:l||c.jsessionId,userId:d,yhid:d,yhm:s.yhm||c.yhm,xm:s.xm||c.xm,yhsbToken:s.yhsbToken||t,onlineToken:s.onlineToken||c.onlineToken||"",syList:s.sylist||s.syList||c.syList};return userManager.saveUserInfo(u),u.yhsbToken&&localStorage.setItem("yhsbToken",u.yhsbToken),u.onlineToken&&localStorage.setItem("onlineToken",u.onlineToken),l&&saveJSessionId(l),localStorage.setItem("H5_LAST_AUTH_USER_ID",d),localStorage.setItem("H5_LAST_AUTH_TOKEN",t),localStorage.setItem("H5_LAST_AUTH_SESSION_ID",l),localStorage.setItem("H5_LAST_AUTH_TIME",(new Date).toISOString()),window.__MINI_AUTH_STATE__={...window.__MINI_AUTH_STATE__||{},lastRefreshUserId:d,lastRefreshSuccess:!0},console.log("H5_SESSION_REFRESH_SUCCESS",{page:n.page||"",service:n.service||"",userId:d,hasSession:!!l}),{refreshed:!0,userId:d,sessionId:l}}async function ensureMiniProgramSessionFresh(t={}){const{token:e,urlUserId:n}=getMiniProgramUrlAuthState(),o=!0===t.force,a=readStoredUserInfo(),i=normalizeAuthUserId(a.yhid||a.userId),s=normalizeAuthUserId(localStorage.getItem("H5_LAST_AUTH_USER_ID"));return console.log("H5_SESSION_REFRESH_CHECK",{page:t.page||"",service:t.service||"",urlUserId:n,storedUserId:i,lastAuthUserId:s,hasToken:!!e,force:o}),n&&e?o&&hasFreshMiniProgramSession(e,n)?(console.log("H5_SESSION_REFRESH_SKIP_RECENT",{page:t.page||"",service:t.service||"",urlUserId:n}),{refreshed:!1,skipped:!0,reason:"RECENT_SESSION"}):o||shouldRefreshSessionForUrlUser()?(o&&console.log("H5_SESSION_REFRESH_FORCE",{page:t.page||"",service:t.service||"",urlUserId:n}),miniProgramSessionRefreshPromise||(miniProgramSessionRefreshPromise=doMiniProgramSessionRefresh(e,n,t).catch(e=>{throw console.error("H5_SESSION_REFRESH_FAIL",{page:t.page||"",service:t.service||"",urlUserId:n,message:e?.message||String(e)}),clearMiniProgramSessionAuth(),e}).finally(()=>{miniProgramSessionRefreshPromise=null}),miniProgramSessionRefreshPromise)):(console.log("H5_SESSION_REFRESH_SKIP_SAME_USER",{page:t.page||"",service:t.service||"",urlUserId:n}),{refreshed:!1,skipped:!0,reason:"SAME_USER"}):{refreshed:!1,skipped:!0,reason:"NO_URL_AUTH"}}function getMockWechatCode(){return"h5_mock_code_"+Date.now()}const userManager={saveUserInfo(t){console.log("💾 H5保存用户信息:",t),localStorage.setItem("userInfo",JSON.stringify(t));const e=t?.sessId||t?.JSESSIONID||t?.jsessionId||"";e&&saveJSessionId(e)},getSavedUserInfo(){const t=localStorage.getItem("userInfo");return t?JSON.parse(t):null},checkLoginStatus(){const t=localStorage.getItem("userInfo"),e=localStorage.getItem("JSESSIONID");return console.log("🔍 H5检查登录状态:",{hasUserInfo:!!t,hasJSessionId:!!e}),{isLoggedIn:!(!t||!e),userInfo:t?JSON.parse(t):null,jsessionId:e}},clearLoginInfo(){localStorage.removeItem("userInfo"),localStorage.removeItem("JSESSIONID"),localStorage.removeItem("deviceInfo"),console.log("🧹 已清除登录信息")}};function getImageUrl(t){if(!t)return"";if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("blob:"))return t;return(window.request?.defaults?.baseURL||window.location.origin)+"/service?ssServ=dlByHttp&type=img&path="+t}function getFileUrl(t){if(!t)return"";if(t.startsWith("http://")||t.startsWith("https://"))return t;return(window.request?.defaults?.baseURL||window.location.origin)+"/service?ssServ=dlByHttp&type=file&path="+t}function formatDate(t,e="YYYY-MM-DD HH:mm:ss"){if(!t)return console.log("formatDate: 时间字符串为空"),"";if(console.log("formatDate 输入:",t,"格式要求:",e),"undefined"==typeof dayjs)return console.error("❌ dayjs 未加载,无法格式化时间"),t;const n=String(t).replace(/[\u202F\u00A0]/g," ").replace(/\s+/g," ").trim();console.log("清理后的字符串:",n);let o=null;try{const t=new Date(n);isNaN(t.getTime())||(o=dayjs(t),console.log("✅ 使用 Date 解析成功"))}catch(t){console.warn("Date 解析失败:",t)}if(o&&o.isValid()||(o=dayjs(n),console.log("尝试使用 dayjs 直接解析")),console.log("dayjs 解析结果 isValid:",o?o.isValid():"null"),!o||!o.isValid())return console.warn("⚠️ 无效的日期格式:",t),"";const a=o.format(e);return console.log("格式化结果:",a),a}window.ENTRY_SOURCE_KEY="entrySource",window.ENTRY_SOURCE_MY="my",window.getUrlParams=getUrlParams,window.isAuthPage=isAuthPage,window.getCurrentPageUrl=getCurrentPageUrl,window.getUrlAuthToken=getUrlAuthToken,window.getStoredAuthToken=getStoredAuthToken,window.isMiniProgramMessageEntry=isMiniProgramMessageEntry,window.handleMessageEntryAuthRedirect=handleMessageEntryAuthRedirect,window.getDeviceInfo=getDeviceInfo,window.getJSessionId=getJSessionId,window.saveJSessionId=saveJSessionId,window.getMiniProgramUrlAuthState=getMiniProgramUrlAuthState,window.shouldRefreshSessionForUrlUser=shouldRefreshSessionForUrlUser,window.ensureMiniProgramSessionFresh=ensureMiniProgramSessionFresh,window.syncMiniProgramAuthFromUrl=syncMiniProgramAuthFromUrl,window.syncAuthFromMiniProgramUrl=syncMiniProgramAuthFromUrl,window.getMockWechatCode=getMockWechatCode,window.userManager=userManager,window.getImageUrl=getImageUrl,window.getFileUrl=getFileUrl,window.formatDate=formatDate,window.SS.utils||(window.SS.utils={}),window.SS.utils.getImageUrl=getImageUrl,window.SS.utils.getFileUrl=getFileUrl,window.SS.utils.formatDate=formatDate,syncMiniProgramAuthFromUrl(),console.log("✅ H5公共工具已加载");const toastManager={toastElement:null,toastTimer:null,show(t,e=3e3,n="info"){if(this.hide(),this.toastElement=document.createElement("div"),this.toastElement.className=`h5-toast h5-toast-${n}`,this.toastElement.textContent=t,!document.getElementById("h5-toast-style")){const t=document.createElement("style");t.id="h5-toast-style",t.textContent="\n .h5-toast {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n padding: 12px 20px;\n border-radius: 6px;\n font-size: 14px;\n z-index: 10001;\n max-width: 80%;\n text-align: center;\n opacity: 0;\n transition: opacity 0.3s ease;\n }\n .h5-toast.show {\n opacity: 1;\n }\n .h5-toast-info {\n background: rgba(0, 0, 0, 0.8);\n color: white;\n }\n .h5-toast-success {\n background: rgba(40, 167, 69, 0.9);\n color: white;\n }\n .h5-toast-warning {\n background: rgba(255, 193, 7, 0.9);\n color: #212529;\n }\n .h5-toast-error {\n background: rgba(220, 53, 69, 0.9);\n color: white;\n }\n ",document.head.appendChild(t)}document.body.appendChild(this.toastElement),setTimeout(()=>{this.toastElement.classList.add("show")},10),this.toastTimer=setTimeout(()=>{this.hide()},e)},hide(){this.toastTimer&&(clearTimeout(this.toastTimer),this.toastTimer=null),this.toastElement&&(this.toastElement.classList.remove("show"),setTimeout(()=>{this.toastElement&&this.toastElement.parentNode&&document.body.removeChild(this.toastElement),this.toastElement=null},300))}};function showToastEffect(t,e=3e3,n="info"){toastManager.show(t,e,n)}window.showToastEffect=showToastEffect,window.toastManager=toastManager,console.log("✅ H5 Toast工具已加载");const env={baseUrl:window.location.protocol+"//"+window.location.host||"https://m.hfdcschool.com"},getSessionIdFromResponseData=t=>t&&"object"==typeof t&&(t.sessId||t.JSESSIONID||t.jsessionId)||"",loadingManager={loadingCount:0,loadingTimer:null,loadingElement:null,show(t={}){const e={title:"加载中...",mask:!0,delay:300,...t};this.loadingCount>0||(this.loadingTimer=setTimeout(()=>{this.loadingCount>0&&this.createLoadingElement(e.title)},e.delay)),this.loadingCount++},createLoadingElement(t){if(this.loadingElement)return;this.loadingElement=document.createElement("div"),this.loadingElement.className="h5-loading-mask",this.loadingElement.innerHTML=`\n
\n `;const e=document.createElement("style");e.textContent="\n .h5-loading-mask {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n }\n .h5-loading-content {\n background: white;\n padding: 20px;\n border-radius: 8px;\n text-align: center;\n min-width: 120px;\n }\n .h5-loading-spinner {\n width: 30px;\n height: 30px;\n border: 3px solid #f3f3f3;\n border-top: 3px solid #40ac6d;\n border-radius: 50%;\n animation: h5-spin 1s linear infinite;\n margin: 0 auto 10px;\n }\n @keyframes h5-spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n .h5-loading-text {\n color: #333;\n font-size: 14px;\n }\n ",document.head.appendChild(e),document.body.appendChild(this.loadingElement)},hide(){this.loadingCount=Math.max(0,this.loadingCount-1),0===this.loadingCount&&(this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null),this.loadingElement&&(document.body.removeChild(this.loadingElement),this.loadingElement=null))},forceHide(){this.loadingCount=0,this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null),this.loadingElement&&(document.body.removeChild(this.loadingElement),this.loadingElement=null)}},request={async get(t,e={},n={}){return this.request(t,"GET",e,n)},async post(t,e={},n={}){return this.request(t,"POST",e,n)},async put(t,e={},n={}){return this.request(t,"PUT",e,n)},async delete(t,e={},n={}){return this.request(t,"DELETE",e,n)},async request(t,e,n,o={}){let a;a=!1!==o.loading&&{show:!0,title:"加载中...",mask:!0,delay:300,timeout:66e4,..."object"==typeof o.loading?o.loading:{}};const i={timeout:66e4,...o.request},s=!1!==a&&!1!==a.show;s&&loadingManager.show(a);const r=getDeviceInfo(),l=r.deviceId||"",c=r.model||"",d=t.includes("?")?"&":"?",u=`${t}${d}devId=${l}&sbmc=${c}`;let m=null;s&&a.timeout&&(m=setTimeout(()=>{loadingManager.hide(),void 0!==showToastEffect&&showToastEffect("请求超时",3e3,"error")},a.timeout));try{const t={url:`${env.baseUrl}${u}`,method:e.toLowerCase(),timeout:i.timeout,headers:{},withCredentials:!0};if("GET"===e.toUpperCase())t.params=n;else if(o.formData){t.headers["Content-Type"]="application/x-www-form-urlencoded";const e=new URLSearchParams;Object.keys(n).forEach(t=>{const o=n[t];Array.isArray(o)?o.forEach(n=>{e.append(t,n)}):e.append(t,o)}),t.data=e}else t.headers["Content-Type"]="application/json",t.data=n;const a=await axios(t),s=getSessionIdFromResponseData(a.data);if(s&&"function"==typeof saveJSessionId&&saveJSessionId(s),m&&clearTimeout(m),a.data&&a.data.msg&&a.data.msg.includes("页面执行时错误"))throw new Error("服务器处理错误");if(a.data&&a.data.msg&&a.data.msg.includes("没有服务授权"))throw handleH5NoServiceAuth(a.data.msg),new Error(a.data.msg);if(a&&(1===a.data.errorcode||"登录已失效,请重新登录"===a.data.msg||"登录过期"===a.data.message||"UNAUTHORIZED"===a.data.error))throw console.log("H5检测到登录过期,触发自动登录",a),handleH5LoginExpired(),new Error(a.msg||"登录过期");return{data:a.data}}catch(t){m&&clearTimeout(m);let e="请求失败";throw e=t.response?`请求失败: ${t.response.status}`:t.request?"网络连接失败":t.message||"未知错误",void 0!==showToastEffect&&showToastEffect(e,3e3,"error"),t}finally{s&&loadingManager.hide()}}},handleH5LoginExpired=()=>{console.log("🔒 H5处理登录过期");const t=localStorage.getItem("userInfo");let e="";if(t)try{e=JSON.parse(t).yhsbToken}catch(t){console.error("解析用户信息失败:",t)}e?request.post(`/service?ssServ=ssLogin&wdConfirmationCaptchaService=0&mdToken=${e}`,{mdToken:e},{loading:!1}).then(t=>{if(t&&t.data){console.log("✅ H5自动登录成功");const e={devId:t.data.devId,sbmc:t.data.sbmc,sessId:t.data.sessId,userId:t.data.userId,xm:t.data.xm,yhsbToken:t.data.yhsbToken,onlineToken:t.data.onlineToken};window.h5UserApi&&window.h5UserApi.saveUserInfo(e),"function"==typeof callNative&&callNative("loginSuccess","H5自动登录成功",{success:!0,userInfo:e,isAutoLogin:!0}),setTimeout(()=>window.location.reload(),1e3)}}).catch(t=>{console.error("❌ H5自动登录失败:",t),window.location.href="/page/login.html?from=expired"}):(console.log("⚠️ 未找到yhsbToken,跳转登录页面"),window.location.href="/page/login.html?from=expired")},handleH5NoServiceAuth=t=>{setTimeout(()=>{"function"==typeof callNative?callNative("noServiceAuth","没有服务授权",{error:!0,message:t,action:"goBack"}):window.history.length>1?window.history.back():window.close()},1500)};window.request=request,window.handleH5LoginExpired=handleH5LoginExpired,window.handleH5NoServiceAuth=handleH5NoServiceAuth,console.log("✅ H5 Request工具已加载");const h5UserApi={async accountLogin(t,e){try{console.log("🔐 H5账号登录开始:",t);const n=getDeviceInfo(),o={...n,deviceId:`(${t.yhm})${n.model}`};localStorage.setItem("deviceInfo",JSON.stringify(o));const a=t.wechatCode||getMockWechatCode(),i={...t,wechatCode:a};console.log("📤 发送登录请求:",i);const s=request.post(`/service?ssServ=ssLogin&yhm=${t.yhm}&mm=${t.mm}&wechatCode=${a}`,i,{loading:!1,request:{timeout:15e3}}),r=await s;return console.log("✅ H5登录请求成功:",r),e&&e(),r}catch(t){throw console.error("❌ H5登录请求失败:",t),e&&e(),t}},autoLogin:async t=>(console.log("🔄 H5自动登录:",t),request.post(`/service?ssServ=ssLogin&mdToken=${t.mdToken}`,t,{loading:!1})),async wechatLogin(t,e){try{console.log("🔐 H5微信登录开始:",t);const n=t.code||getMockWechatCode(),o={...t,code:n},a=request.post("/service?ssServ=ssLogin",o,{loading:!1,request:{timeout:15e3}}),i=await a;return console.log("✅ H5微信登录成功:",i),e&&e(),i}catch(t){throw console.error("❌ H5微信登录失败:",t),e&&e(),t}},getUserInfo:async t=>(console.log("👤 H5获取用户信息:",t),request.get(`/service?ssServ=user.getUserInfo&userId=${t}`,{},{loading:!1})),async logout(){console.log("🚪 H5用户登出");try{return userManager.clearLoginInfo(),console.log("✅ H5登出成功"),{success:!0}}catch(t){throw console.error("❌ H5登出失败:",t),t}},checkLoginStatus:()=>userManager.checkLoginStatus(),saveUserInfo:t=>userManager.saveUserInfo(t),getSavedUserInfo:()=>userManager.getSavedUserInfo()};window.h5UserApi=h5UserApi,console.log("✅ H5 UserApi已加载"),window.ValidatorRules={notNull:{validate:t=>null!=t&&""!==t,message:"{field}不能为空"},email:{validate:t=>!t||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),message:"{field}格式不正确"},number:{validate:t=>!t||!isNaN(t)&&"number"==typeof Number(t),message:"{field}必须是数字"},minLength:{validate:(t,e)=>!t||String(t).length>=e,message:"{field}长度不能小于{min}个字符"},maxLength:{validate:(t,e)=>!t||String(t).length<=e,message:"{field}长度不能超过{max}个字符"},idCard:{validate:function(t,e){if(e.relField){const n=document.querySelector(`[name="${e.relField}"]`),o=n?.value,a={1:this.validateIdCard,6:this.validateHkIdCard,7:this.validateMacauIdCard,8:this.validateTaiwanPass,10:this.validateForeignerCard};if(!o||""===o)return!0;const i=a[o];return!i||i(t)}return this.validateIdCard(t)},message:"{field}格式不正确",validateIdCard:t=>!t||/^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dX]$/.test(t),validateHkIdCard:t=>!t||(/^[A-Z]{1,2}[0-9]{6}\([0-9A]\)$/.test(t)||/^H[0-9]{8}$/.test(t)),validateMacauIdCard:t=>!t||(/^[157][0-9]{6}\([0-9]\)$/.test(t)||/^MA[0-9]{8}$/.test(t)),validateTaiwanPass:t=>!t||/^[0-9]{8}$/.test(t),validateForeignerCard:t=>!t||/^[A-Z]{3}\d{6}$/.test(t)},custom:{validate:function(t,e){if(!e.validate)return!0;let n;if(e.relField){const t=document.querySelector(`[name="${e.relField}"]`);n=t?.value}const o=e.validate(t,n);return o&&"object"==typeof o?(this.message=o.message,o.valid):o},message:"{field}验证失败"}};const findParentTd=t=>{let e=t.parentElement;for(;e&&"TD"!==e.tagName;)e=e.parentElement;return e},isSameTd=(t,e)=>{const n=findParentTd(t),o=findParentTd(e);return n&&n===o};class ValidationManager{constructor(){this.validations=new Map,this.dependRules=new Map}add(t,e,n={},o=1){Array.isArray(e)||(e=[e]);const a=this._parseRule(t);if(a){if(e.forEach(t=>{this.validations.has(t)||this.validations.set(t,[]),this.validations.get(t).push({rule:a,options:{msgPrfx:n.msgPrfx||t,...n},priority:o})}),n.relField){const t=document.querySelector(`[name="${n.relField}"]`);t&&t.addEventListener("change",()=>{this.validateField(field)})}this.initRequiredMarks(),this.notifyComponentsUpdate(),ssVm.bindForm(".form-container")}}validateField(t){const e=document.querySelector(`[name="${t}"]`);if(!e)return{valid:!0};const n=findParentTd(e);if(!n)return{valid:!0};const o=Array.from(n.querySelectorAll("[name]")).map(t=>t.getAttribute("name")).filter(t=>this.validations.has(t));let a=[],i=!1;for(const t of o){const e=document.querySelector(`[name="${t}"]`).value;e&&""!==e.trim()||(i=!0);const n=this._doValidate(t);n.valid||-1!==a.indexOf(n.message)||a.push(n.message)}const s=this.dependRules.get(t);if(s){const{dependField:e,rules:n}=s,o=document.querySelector(`[name="${e}"]`);if(o){const e=n[o.value];e&&this.validations.set(t,[{rule:window.ValidatorRules[e],options:{msgPrfx:t,required:!0}}])}}let r=n.querySelector(".required");(i||a.length>0)&&!r?(r=document.createElement("div"),r.className="required",n.appendChild(r)):!i&&0===a.length&&r&&r.remove();if(!(null!==n.querySelector(".ss-input")||null!==n.querySelector(".ss-mobile-component"))){let t=n.querySelector(".err-tip");!t&&a.length>0?(t=document.createElement("div"),t.className="err-tip",t.style.position="absolute",t.style.zIndex="1",t.innerHTML=`\n ${a.join(";")}
\n ${a.join(";")}
\n `,n.appendChild(t)):t&&0===a.length?t.remove():t&&a.length>0&&(t.querySelector(".tip").textContent=a.join(";"),t.querySelector(".tip-more").textContent=a.join(";"))}return{valid:0===a.length,message:a.join(";")}}validateAll(){const t=[];for(const e of this.validations.keys()){const n=this.validateField(e);n.valid||t.push({field:e,message:n.message})}return{valid:0===t.length,errors:t}}_parseRule(t){const e=t.split("."),n=e[e.length-1];return ValidatorRules[n]}bindForm(t){const e=new MutationObserver(n=>{const o=document.querySelector(t);o&&!o._bound&&($(o).on("submit",t=>{t.preventDefault();const e=this.validateAll();return e.valid?(alert("表单校验通过!"),!0):(e.errors.forEach(t=>{const e=document.querySelector(`[name="${t.field}"]`);if(e){const n=new Event("input",{bubbles:!0});e.dispatchEvent(n);const o=e.closest(".input-container")?.querySelector(".err-tip");o&&(o.querySelector(".tip").textContent=t.message,o.querySelector(".tip-more").textContent=t.message)}}),!1)}),o._bound=!0,e.disconnect())});e.observe(document.body,{childList:!0,subtree:!0})}remove(t){Array.isArray(t)||(t=[t]),t.forEach(t=>{this.validations.has(t)&&this.validations.delete(t)})}_doValidate(t){const e=this.validations.get(t);if(!e)return{valid:!0};const n=document.querySelector(`[name="${t}"]`);if(!n)return{valid:!0};const o=n.value;for(const{rule:t,options:n}of e){if(n.required&&(!o||""===o.trim()))return{valid:!1,message:`${n.msgPrfx}不能为空`};if(!t.validate(o,n)){let e=t.message;return e=e.replace("{field}",n.msgPrfx),Object.keys(n).forEach(t=>{e=e.replace(`{${t}}`,n[t])}),{valid:!1,message:e}}}return{valid:!0}}initRequiredMarks(){const t=new Set;for(const[e,n]of this.validations.entries()){const n=document.querySelector(`[name="${e}"]`);if(!n)continue;const o=findParentTd(n);if(!o||t.has(o))continue;t.add(o);if(Array.from(o.querySelectorAll("[name]")).map(t=>t.getAttribute("name")).filter(t=>this.validations.has(t)).length>0){let t=o.querySelector(".required");t||(t=document.createElement("div"),t.className="required",o.appendChild(t))}}}validateFieldSilent(t){const e=this.validations.get(t);if(!e)return{valid:!0};const n=document.querySelector(`[name="${t}"]`);if(!n)return{valid:!0};const o=n.value;for(const{rule:t,options:n}of e){if(n.required&&(!o||""===o.trim()))return{valid:!1};if(!o&&!n.required)return{valid:!0};if(!t.validate(o,n))return{valid:!1}}return{valid:!0}}isRequired(t){const e=this.validations.get(t);return!!e&&e.some(({rule:t,options:e})=>e.required||t===ValidatorRules.notNull)}notifyComponentsUpdate(){document.querySelectorAll("input[name]").forEach(t=>{const e=new CustomEvent("ssvm-rules-updated",{bubbles:!0,detail:{fieldName:t.getAttribute("name")}});t.dispatchEvent(e)})}}window.ssVm=window.ssVm||new ValidationManager;const normalizeObjpResultEntries=t=>t?Array.isArray(t)?t.map(t=>{if(!t||"object"!=typeof t)return null;const e=Object.entries(t)[0];return e?{value:e[0],label:e[1]}:null}).filter(Boolean):"object"==typeof t?Object.entries(t).map(([t,e])=>({value:t,label:e})):[]:[],findObjpResultLabel=(t,e)=>{const n=String(e),o=normalizeObjpResultEntries(t).find(t=>String(t.value)===n);return o?o.label:void 0},getDictTranslation=async(t,e,n,o,a)=>{try{console.log(`🔍 获取字典翻译 [${t}:${e}]`);const i=await request.post("/service?ssServ=loadObjpOpt&objectpickerdropdown1=1",{objectpickerparam:JSON.stringify({input:"false",codebook:t}),objectpickertype:2,objectpickervalue:e},{loading:!1,formData:!0});console.log(`字典翻译 [${t}:${e}] API返回:`,i);let s=e;i&&i.data&&i.data.result&&(s=findObjpResultLabel(i.data.result,e)||e,console.log(`字典翻译结果: ${e} -> ${s}`)),o.set(n,s),a&&a()}catch(a){console.error(`字典翻译失败 [${t}:${e}]:`,a),o.set(n,e)}},formatFieldValue=(t,e,n)=>{if(!t||!t.field||void 0===t.value)return"";const{field:o,value:a}=t;if(null==a||""===a)return"";if(o.cbName){const t=`${o.cbName}_${a}`;return e.has(t)?e.get(t):(n&&n(o.cbName,a,t,e),a)}return o.fmt?h5FormatDate(a,o.fmt):"date"===o.type||o.name.toLowerCase().includes("date")||o.name.toLowerCase().includes("time")?h5FormatDate(a):"number"===o.type&&"number"==typeof a?a.toLocaleString():"boolean"===o.type||"boolean"==typeof a?a?"是":"否":String(a)},normalizeDateInput=t=>null==t?"":String(t).replace(/ /g," ").replace(/[\u00A0\u1680\u180E\u2000-\u200D\u202F\u205F\u3000]/g," ").replace(/(\d)(AM|PM)$/i,"$1 $2").replace(/\s+/g," ").trim(),parseSpecialDateFormat=t=>{try{const e=normalizeDateInput(t),n=/^(\w{3})\s+(\d{1,2}),\s+(\d{4}),\s+(\d{1,2}):(\d{2}):(\d{2})\s+(AM|PM)$/i,o=e.match(n);if(!o)return null;const[,a,i,s,r,l,c,d]=o,u=String(d).toUpperCase(),m={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11}[a];if(void 0===m)return null;let p=parseInt(r);return"PM"===u&&12!==p?p+=12:"AM"===u&&12===p&&(p=0),{year:parseInt(s),month:m,day:parseInt(i),hour:p,minute:parseInt(l),second:parseInt(c)}}catch(e){return console.warn("解析特殊日期格式失败:",t,e),null}},formatDateObject=(t,e)=>{const{year:n,month:o,day:a,hour:i,minute:s,second:r}=t;return e.replace(/YYYY/g,n).replace(/yyyy/g,n).replace(/MM/g,String(o+1).padStart(2,"0")).replace(/DD/g,String(a).padStart(2,"0")).replace(/dd/g,String(a).padStart(2,"0")).replace(/HH/g,String(i).padStart(2,"0")).replace(/hh/g,String(i).padStart(2,"0")).replace(/mm/g,String(s).padStart(2,"0")).replace(/ss/g,String(r).padStart(2,"0"))},h5FormatDate=(t,e="YYYY-MM-DD HH:mm:ss")=>{if(!t)return"";try{const n=normalizeDateInput(t);console.log("🔧 h5FormatDate 开始处理:",n,"目标格式:",e);const o=parseSpecialDateFormat(n);if(o){console.log("🔧 手动解析成功:",o);const t=formatDateObject(o,e);return console.log("✅ 手动格式化结果:",t),t}if("undefined"!=typeof window&&window.dayjs){const t=window.dayjs(n);if(console.log("🔧 使用 Day.js 解析:",t.isValid(),t.toString()),t.isValid()){const n=t.format(e);return console.log("✅ Day.js 格式化结果:",n),n}}console.log("🔧 Day.js 未加载,使用原生 Date");const a=new Date(n);if(console.log("🔧 解析后的日期对象:",a,"是否有效:",!isNaN(a.getTime())),isNaN(a.getTime()))return console.warn("❌ 无效日期格式:",n),n;const i=a.getFullYear(),s=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0"),l=String(a.getHours()).padStart(2,"0"),c=String(a.getMinutes()).padStart(2,"0"),d=String(a.getSeconds()).padStart(2,"0");let u=e.replace(/YYYY/g,i).replace(/yyyy/g,i).replace(/MM/g,s).replace(/DD/g,r).replace(/dd/g,r).replace(/HH/g,l).replace(/hh/g,l).replace(/mm/g,c).replace(/ss/g,d);return console.log(`日期格式化: ${t} -> ${u} (格式: ${e})`),u}catch(n){return console.error("日期格式化异常:",t,e,n),t}},formatFieldValueAsync=async(t,e)=>{if(!t||!t.field)return t?.value||"";const{field:n,value:o}=t;if(null==o||""===o)return"";if(n.fmt)try{console.log(`🕐 格式化时间字段 [${n.name}]:`,o,"格式:",n.fmt),console.log("🔧 调用 h5FormatDate 前...");const t=h5FormatDate(o,n.fmt);return console.log("🔧 调用 h5FormatDate 后,结果:",t),console.log("✅ 时间格式化结果:",t),t}catch(t){return console.error("❌ 时间格式化失败:",n.name,o,t),o}if(n.cbName){const t=`${n.cbName}_${o}`;if(e&&e.has(t))return e.get(t);try{const a=await request.post("/service?ssServ=loadObjpOpt&objectpickerdropdown1=1",{objectpickerparam:JSON.stringify({input:"false",codebook:n.cbName}),objectpickertype:2,objectpickervalue:o},{loading:!1,formData:!0});if(a&&a.data&&a.data.result){const n=findObjpResultLabel(a.data.result,o);return n?(e&&e.set(t,n),n):o}}catch(t){console.warn("字典转换失败:",n.cbName,o,t)}return o}return 3===n.type&&n.fmt?h5FormatDate(o,n.fmt):2===n.type&&"number"==typeof o?o.toLocaleString():o.toString()},getDictOptions=async(t,e)=>{const n=`options_${t}`;if(e&&e.has(n))return e.get(n);try{console.log(`🔍 获取字典选项 [${t}]`);const o=await request.post("/service?ssServ=loadObjpOpt&objectpickerdropdown1=1",{objectpickerparam:JSON.stringify({input:"false",codebook:t}),objectpickertype:1,objectpickersearchAll:1},{loading:!1,formData:!0});if(console.log(`字典选项 [${t}] API返回:`,o),o&&o.data&&o.data.result){const t=normalizeObjpResultEntries(o.data.result).map(({value:t,label:e})=>({n:e,v:t}));return e&&e.set(n,t),t}return[]}catch(e){return console.error(`❌ 获取字典选项失败 [${t}]:`,e),[]}},DEFAULT_LIST_THUMB="skin/easy/image/default-personalPhoto.png",IMAGE_FIELD_NAME_SET=new Set(["thn","zjzwj","yszwj","yzjzwj","sltwj","tpwj","thumb","image"]),isImageField=t=>{if(!t||"object"!=typeof t)return!1;const e=String(t.type||"").toLowerCase(),n=String(t.name||"").toLowerCase();return"img"===e||IMAGE_FIELD_NAME_SET.has(n)},readImagePath=t=>null==t?"":"string"==typeof t?t.trim():String(t).trim(),resolveListImageUrl=t=>{const e=readImagePath(t);return e?e.startsWith("http")||e.startsWith("blob:")?e:window.SS.utils?.getImageUrl?.(e)||e:window.SS.utils?.getImageUrl?.(DEFAULT_LIST_THUMB)||DEFAULT_LIST_THUMB},pickObjectThumbPath=t=>{if(!t||"object"!=typeof t)return"";const e=["thn","thumb","image","zjzwj","yszwj","yzjzwj","sltwj","tpwj"];for(const n of e){const e=readImagePath(t[n]);if(e)return e}const n=[t.first,t.second];for(const t of n)if(t&&t.field&&isImageField(t.field)){const e=readImagePath(t.value);if(e)return e}if(Array.isArray(t.third))for(const e of t.third)if(Array.isArray(e))for(const t of e)if(t&&t.field&&isImageField(t.field)){const e=readImagePath(t.value);if(e)return e}return""},formatObjectList=async(t,e)=>{if(!Array.isArray(t))return[];const n=[];for(const o of t){const t={...o};let a=pickObjectThumbPath(o);if(o.first?isImageField(o.first.field)?a=a||readImagePath(o.first.value):t.firstDisplay=await formatFieldValueAsync(o.first,e):o.title&&"object"==typeof o.title&&void 0!==o.title.val?o.title.fmt?t.firstDisplay=h5FormatDate(o.title.val,o.title.fmt):t.firstDisplay=void 0===o.title.val||null===o.title.val?"":String(o.title.val):"string"==typeof o.title&&(t.firstDisplay=o.title),o.second)isImageField(o.second.field)?a=a||readImagePath(o.second.value):t.secondDisplay=await formatFieldValueAsync(o.second,e);else{const e=o.abs??o.desc??o.summary;null!=e&&(t.secondDisplay=String(e))}if(o.third&&Array.isArray(o.third)){t.thirdDisplay=[];for(const n of o.third){const o=[];for(const t of n){if(isImageField(t?.field)){a=a||readImagePath(t.value);continue}const n=await formatFieldValueAsync(t,e);o.push({...t,displayValue:n})}t.thirdDisplay.push(o)}t.thirdDisplay=t.thirdDisplay.filter(t=>Array.isArray(t)&&t.length>0)}else if(Array.isArray(o.catList)){const n=[];for(const t of o.catList){const o={field:{desc:String(t?.desc||""),fmt:t?.fmt||""},value:t?.val},a=await formatFieldValueAsync(o,e);n.push({field:{desc:String(t?.desc||"")},value:t?.val,displayValue:a})}t.thirdDisplay=[n]}t.thumbPath=a,t.thumbUrl=a?resolveListImageUrl(a):"",n.push(t)}return n};function setPageName(t){window.H5_PAGE_NAME=t}function checkEnvironment(){return"undefined"!=typeof wx&&wx.miniProgram}function parseUrlParams(t){const e={};return t&&t.substring(1).split("&").forEach(t=>{const[n,o]=t.split("=");n&&o&&(e[decodeURIComponent(n)]=decodeURIComponent(o))}),e}function checkResult(t){const e=window.location.search;if(console.log("🔍 检查URL参数:",e),e){const n=parseUrlParams(e);if(console.log("🔍 解析的参数:",n),n.result)try{const e=JSON.parse(decodeURIComponent(n.result));console.log("🔍 解析的结果数据:",e),t&&t(e)}catch(t){console.error("解析结果数据失败:",t)}else console.log("🔍 URL中没有result参数")}else console.log("🔍 URL中没有查询参数")}function callNative(t,e="",n=null){if(!checkEnvironment())return void console.error("❌ 不在微信小程序环境");const o={action:t,message:e||"",source:window.H5_PAGE_NAME};if(n&&"object"==typeof n)try{const t=JSON.stringify(n);o.data=encodeURIComponent(t),console.log("📦 数据编码:",{original:n,json:t,encoded:o.data})}catch(t){return void console.error("❌ JSON序列化失败:",t)}const a=[];Object.keys(o).forEach(t=>{void 0!==o[t]&&null!==o[t]&&("data"===t?a.push(`${t}=${o[t]}`):a.push(`${t}=${encodeURIComponent(o[t])}`))});const i=`/pages/common/h5-controller?${a.join("&")}`;console.log("🎛️ 跳转到控制器:",i),wx.miniProgram.navigateTo({url:i,success:t=>{console.log("✅ 成功跳转到控制器",t)},fail:o=>{console.error("❌ 控制器调用失败,尝试降级方案:",o),fallbackUrlCommunication(t,e,n)}})}function fallbackUrlCommunication(t,e="",n=null){console.log("🔄 使用降级通信方案");const o={h5_action:t,h5_message:e,timestamp:Date.now()};if(n&&"object"==typeof n)try{o.h5_data=encodeURIComponent(JSON.stringify(n))}catch(t){console.error("❌ 数据编码失败:",t)}const a=parseUrlParams(window.location.search);Object.keys(a).forEach(t=>{t.startsWith("h5_")||t.startsWith("mp_")||"timestamp"===t||(o[t]=a[t])});const i=`${window.location.origin}${window.location.pathname}`,s=[];Object.keys(o).forEach(t=>{void 0!==o[t]&&null!==o[t]&&s.push(`${encodeURIComponent(t)}=${encodeURIComponent(o[t])}`)});const r=`${i}?${s.join("&")}`;console.log("🔄 降级跳转URL:",r),window.location.href=r}function scanCode(t="扫描二维码"){return callNative("scanCode",t)}function chooseImage(t="选择图片"){return callNative("chooseImage",t)}function makePhoneCall(t,e="拨打电话"){return callNative("makePhoneCall",e,{phoneNumber:t})}function setStorage(t,e,n="设置存储数据"){return callNative("setStorage",n,{key:t,value:e})}function getStorage(t,e="获取存储数据"){return callNative("getStorage",e,{key:t})}function goBack(t="返回小程序"){return callNative("goBack",t)}function navigateTo(t,e={}){const n=Object.keys(e).length>0?"?"+Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t])}`).join("&"):"";window.location.href=`./${t}.html${n}`}function saveData(t,e){try{const n=`h5_${window.H5_PAGE_NAME}_${t}`;localStorage.setItem(n,JSON.stringify(e)),console.log("💾 数据已保存:",n)}catch(t){console.error("保存数据失败:",t)}}function loadData(t,e=null){try{const e=`h5_${window.H5_PAGE_NAME}_${t}`,n=localStorage.getItem(e);if(n)return JSON.parse(n)}catch(t){console.error("加载数据失败:",t)}return e}function clearData(t){try{const e=`h5_${window.H5_PAGE_NAME}_${t}`;localStorage.removeItem(e),console.log("🗑️ 数据已清除:",e)}catch(t){console.error("清除数据失败:",t)}}function defaultResultHandler(t){const{action:e,success:n,result:o,error:a}=t;n?console.log(`✅ ${e} 操作成功`,o):console.error(`❌ ${e} 操作失败`,a)}function initPage(t,e){setPageName(t),checkEnvironment();checkResult(e||defaultResultHandler)}function showToastEffect(t,e=2e3,n="success"){const o={success:"rgba(40, 167, 69, 0.9)",error:"rgba(220, 53, 69, 0.9)",warning:"rgba(255, 193, 7, 0.9)",info:"rgba(23, 162, 184, 0.9)"},a=document.createElement("div");a.textContent=t,a.style.cssText=`\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: ${o[n]||o.success};\n color: white;\n padding: 12px 24px;\n border-radius: 8px;\n z-index: 9999;\n font-size: 14px;\n pointer-events: none;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);\n `,document.body.appendChild(a),setTimeout(()=>{a.parentNode&&a.parentNode.removeChild(a)},e)}function showLoading(t="加载中..."){const e=document.createElement("div");if(e.innerHTML=`\n \n `,e.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.7);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n font-size: 14px;\n ",!document.querySelector("#loading-style")){const t=document.createElement("style");t.id="loading-style",t.textContent="\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ",document.head.appendChild(t)}return document.body.appendChild(e),function(){e.parentNode&&e.parentNode.removeChild(e)}}function formatDate(t,e="YYYY-MM-DD HH:mm:ss"){const n=new Date(t),o=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),i=String(n.getDate()).padStart(2,"0"),s=String(n.getHours()).padStart(2,"0"),r=String(n.getMinutes()).padStart(2,"0"),l=String(n.getSeconds()).padStart(2,"0");return e.replace("YYYY",o).replace("MM",a).replace("DD",i).replace("HH",s).replace("mm",r).replace("ss",l)}window.H5FieldFormatter={getDictTranslation,formatFieldValue,formatFieldValueAsync,formatDate:h5FormatDate,getDictOptions,formatObjectList,pickObjectThumbPath,resolveListImageUrl},window.getDictTranslation=getDictTranslation,window.formatFieldValue=formatFieldValue,window.formatFieldValueAsync=formatFieldValueAsync,window.getDictOptions=getDictOptions,window.formatObjectList=formatObjectList,window.pickObjectThumbPath=pickObjectThumbPath,window.resolveListImageUrl=resolveListImageUrl,console.log("✅ H5字段格式化工具加载完成"),window.H5_PAGE_NAME=window.H5_PAGE_NAME||"default";const NAV_IGNORED_KEYS=new Set(["function","pageList","pluginList","children","options"]);function pickPrimitiveParams(t={}){const e={};return Object.entries(t).forEach(([t,n])=>{if(NAV_IGNORED_KEYS.has(t))return;if(null==n||""===n)return;const o=typeof n;"string"!==o&&"number"!==o&&"boolean"!==o||(e[t]=n)}),e}function normalizeParamScalar(t){if(null==t)return"";const e=String(t).trim();return e?e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e:""}function mergeParamPayload(t,e){if(null==e||""===e)return;if("object"==typeof e&&!Array.isArray(e))return void Object.entries(e).forEach(([e,n])=>{if(null==n||""===n)return;const o=typeof n;"string"!==o&&"number"!==o&&"boolean"!==o||(t[e]=n)});if("string"!=typeof e)return;const n=e.trim();if(n){try{const e=JSON.parse(n);if(e&&"object"==typeof e&&!Array.isArray(e))return void mergeParamPayload(t,e)}catch(t){}n.split(",").forEach(e=>{const n=String(e||"").trim();if(!n)return;const o=n.indexOf(":");if(o<=0)return;const a=normalizeParamScalar(n.slice(0,o)),i=normalizeParamScalar(n.slice(o+1));a&&i&&(t[a]=i)})}}const NavigationManager={goTo(t,e={},n={}){try{const o=new URLSearchParams(window.location.search);Object.keys(e).forEach(t=>{void 0!==e[t]&&null!==e[t]&&o.set(t,encodeURIComponent(e[t]))}),n.needRefresh&&o.set("_needRefresh","1");const a=`${t}.html?${o.toString()}`;console.log("🔗 导航到:",a),console.log("📋 传递参数:",Object.fromEntries(o)),window.location.href=a}catch(t){console.error("❌ 页面导航失败:",t),"undefined"!=typeof showToast?showToast("页面跳转失败","error"):alert("页面跳转失败")}},goToFromButton(t){const e=t&&"object"==typeof t?t:{},n=e.function&&"object"==typeof e.function?e.function:{},o=n.dest||e.dest,a=(()=>{const t=String(o||"").trim();return t?t.startsWith("mp_")?t:`mp_${t}`:""})();if(console.log("goToFromButton:",a),!a)return console.warn("按钮没有配置跳转页面:",t),!1;const i={...pickPrimitiveParams(e),...pickPrimitiveParams(n),dest:String(o||"").trim(),ssDest:String(o||"").trim(),title:n.desc||n.title||e.desc||e.title||e.buttonName||e.name||"",service:n.servName||e.servName||e.service||""};mergeParamPayload(i,e.param),mergeParamPayload(i,n.param),mergeParamPayload(i,e.parm),mergeParamPayload(i,n.parm);const s=String(n.param_name||e.param_name||"").trim(),r=void 0!==n.param_value?n.param_value:e.param_value;return s&&null!=r&&""!==r&&(i[s]=r),this.goTo(a,i,{needRefresh:!0}),!0},goBack(t={}){try{const e=new URLSearchParams(window.location.search);"1"===e.get("_needRefresh")&&!1!==t.refreshParent&&this.notifyParentRefresh(),window.history.length>1?window.history.back():NavigationManager.goBack()}catch(t){console.error("❌ 页面返回失败:",t),"undefined"!=typeof showToast&&showToast("页面返回失败","error")}},notifyParentRefresh(){try{const t={timestamp:Date.now(),action:"refresh",source:window.location.pathname};localStorage.setItem("_pageRefreshNotify",JSON.stringify(t)),window.dispatchEvent(new StorageEvent("storage",{key:"_pageRefreshNotify",newValue:JSON.stringify(t)})),console.log("📢 通知父页面刷新")}catch(t){console.error("❌ 通知父页面刷新失败:",t)}},onRefreshNotify(t){if("function"!=typeof t)return void console.warn("刷新回调必须是函数");const e=e=>{if("_pageRefreshNotify"===e.key&&e.newValue)try{const n=JSON.parse(e.newValue);console.log("📢 收到页面刷新通知:",n),t(n),localStorage.removeItem("_pageRefreshNotify")}catch(t){console.error("❌ 处理刷新通知失败:",t)}};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},refreshCurrentPage(t){"function"==typeof t?(console.log("🔄 刷新当前页面数据"),t()):window.location.reload()},getUrlParam(t){const e=new URLSearchParams(window.location.search);if(t){const n=e.get(t);return n?decodeURIComponent(n):null}const n={};for(const[t,o]of e)n[t]=decodeURIComponent(o);return n}};window.NavigationManager=NavigationManager,window.goTo=NavigationManager.goTo.bind(NavigationManager),window.goBack=NavigationManager.goBack.bind(NavigationManager),window.getUrlParam=NavigationManager.getUrlParam.bind(NavigationManager),console.log("✅ H5页面导航工具加载完成"),function(){const{ref:t,createApp:e,watch:n,inject:o,onMounted:a,onBeforeUnmount:i,computed:s,nextTick:r}=Vue;async function l(t){if(window.SS&&"function"==typeof window.SS.ensureOptionalAssets)return window.SS.ensureOptionalAssets(t);throw new Error(`可选资源加载器未就绪: ${t}`)}async function c(t,e="image",n){try{window.showToast?.("上传中...","loading");const o=new FormData,a=n||(t instanceof Blob?"file":t.name);o.append("fileEdit",t,a),o.append("application","");const i="image"===e?"img":"file",s=await window.request.post(`/service?ssServ=ulByHttp&type=${i}`,o,{loading:!1});if(s?.data?.fileList?.[0]?.path){const t=s.data.fileList[0].path;return window.showToast?.("上传成功","success"),t}throw new Error("上传返回数据格式错误")}catch(t){throw console.error("上传失败:",t),window.showToast?.("上传失败,请重试","error"),t}}const d={name:"SsCommonIcon",props:{class:{type:String,required:!0}},setup(t){const{h:e}=Vue;return()=>e("i",{class:t.class+" common-icon"})}},u={name:"SsInput",inheritAttrs:!1,props:{modelValue:{type:[String,Number],default:""},name:{type:String,default:""},placeholder:{type:String,default:"请输入"},errTip:{type:String,default:""}},emits:["update:modelValue","input","blur","change","focus"],setup(e,{emit:i}){const s=t(e.modelValue||""),r=t({hasError:!1,errorMessage:"",isRequired:!1,isEmpty:!0,hasInteracted:!1,isSubmitMode:!1}),l=o("onInput",null),c=o("onBlur",null),d=()=>{window.ssVm&&e.name&&(r.value.isRequired=window.ssVm.isRequired(e.name))},u=()=>{const t=document.querySelector(`input[name="${e.name}"]`);if(t){const e=t.closest("td");e&&(e.classList.remove("td-required","td-error"),r.value.hasError&&r.value.hasInteracted?e.classList.add("td-error"):r.value.isRequired&&r.value.isEmpty&&e.classList.add("td-required"))}},m=t=>{if(window.ssVm&&e.name){const n=window.ssVm.validateField(e.name);return r.value.hasError=!n.valid,r.value.errorMessage=n.message||"",r.value.isEmpty=!t||""===t.trim(),setTimeout(u,0),n}return{valid:!0,message:""}};n(()=>e.modelValue,t=>{s.value=t,m(t)}),a(()=>{d(),m(s.value);const t=document.querySelector(`input[name="${e.name}"]`);t&&t.addEventListener("ssvm-rules-updated",()=>{console.log(`收到规则更新通知: ${e.name}`),d(),m(s.value),u()}),setTimeout(()=>{u()},200)});return{inputValue:s,validationState:r,handleInput:t=>{const e=t.target.value;s.value=e,r.value.hasInteracted=!0,i("update:modelValue",e),i("input",t),m(e),l&&l(t)},handleBlur:t=>{r.value.hasInteracted=!0,i("blur",t),m(s.value),c&&c(t)},handleFocus:t=>{i("focus",t)}}},template:'\n\t\t\x3c!-- 移动端简化的错误提示 - 显示在输入框右下角 --\x3e\n \n {{ validationState.errorMessage }}\n
\n \n \n\n
\n '},m={name:"Icon",props:{name:{type:String,required:!0},color:{type:String,default:"#000"},size:{type:[Number,String],default:32}},emits:["click"],setup:(t,{emit:e})=>({iconClass:s(()=>t.name),iconStyle:s(()=>({color:t.color,fontSize:parseInt(t.size)/2+"px",verticalAlign:"middle"})),handleClick:t=>{e("click",t)}}),template:'\n\t\t\t \n\t\t'},p={name:"SsCard",props:{item:{type:Object,default:()=>({})}},emits:["click","buttonClick"],setup(e,{emit:n}){const o=t(!1),r=t(0),l=t(0),c=t(0),d=t(!1),u=t(!1),m=s(()=>Array.isArray(e.item?.swipeActions)?e.item.swipeActions.filter(Boolean):[]),p=s(()=>m.value.length>0),g=[{backgroundColor:"#357cdf",color:"#fff"},{backgroundColor:"#94bfff",color:"#000000"},{backgroundColor:"#e0edff",color:"#000000"}],h=s(()=>p.value?66*m.value.length:0),f=s(()=>e.item?.buttons&&Array.isArray(e.item.buttons)&&e.item.buttons.length>0),v=s(()=>e.item?.buttons&&e.item.buttons.length>1),S=s(()=>e.item?.buttons&&1===e.item.buttons.length),y=s(()=>({transform:`translateX(-${r.value}px)`})),w=s(()=>({width:`${h.value}px`})),b=s(()=>({backgroundColor:(I(0)||{}).backgroundColor||"#357cdf",opacity:r.value>0?0:1})),I=t=>{const e=Math.min(Number(t||0),g.length-1);return g[e]||g[0]},k=()=>{r.value=0,d.value=!1},x=()=>{o.value=!1},T=()=>{k()},E=(t,a)=>{o.value=!1,k(),t.onclick&&"function"==typeof t.onclick&&t.onclick(),n("buttonClick",{button:t,index:a,item:e.item})};return a(()=>{document.addEventListener("closeAllCardMenus",x),document.addEventListener("closeAllCardSwipes",T)}),i(()=>{document.removeEventListener("closeAllCardMenus",x),document.removeEventListener("closeAllCardSwipes",T)}),{showButtonMenu:o,swipeActions:m,hasSwipeActions:p,hasButtons:f,isMultipleButtons:v,isSingleButton:S,cardContentStyle:y,actionPaneStyle:w,swipeIndicatorStyle:b,getSwipeActionStyle:I,handleCardClick:()=>{u.value?u.value=!1:d.value?k():o.value?o.value=!1:n("click")},handleSettingClick:()=>{if(S.value)E(e.item.buttons[0],0);else if(v.value){const t=o.value;document.dispatchEvent(new CustomEvent("closeAllCardMenus")),o.value=!t}},handleTouchStart:t=>{if(!p.value)return;const e=t.touches&&t.touches[0];e&&(l.value=e.clientX,c.value=e.clientY,u.value=!1,document.dispatchEvent(new CustomEvent("closeAllCardSwipes")))},handleTouchMove:t=>{if(!p.value)return;const e=t.touches&&t.touches[0];if(!e)return;const n=e.clientX-l.value,o=e.clientY-c.value;if(Math.abs(o)>Math.abs(n)||Math.abs(n)<8)return;u.value=!0;const a=d.value?h.value-n:-n;r.value=Math.max(0,Math.min(h.value,a))},handleTouchEnd:()=>{p.value&&(r.value>h.value/2?p.value&&(r.value=h.value,d.value=!0):k(),setTimeout(()=>{u.value=!1},0))},handleButtonClick:E}},template:'\n\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\x3c!-- 功能说明:卡片左滑露出记录操作按钮(如“变动”),替代齿轮菜单入口 by xu 2026-03-06 --\x3e\n\t\t\t\t\t\n\t\t\t\t\t\t{{ btn.title || btn.text || btn.desc }}\n\t\t\t\t\t \n\t\t\t\t
\n\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\x3c!-- 右上角设置按钮 - 只有buttons且长度>0时显示 --\x3e\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\x3c!-- 按钮弹窗菜单 - 只有多个按钮时显示 --\x3e\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\x3c!-- 卡片内容 --\x3e\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t'},g={name:"SsSearchButton",props:{text:{type:String,default:"增加"},disabled:{type:Boolean,default:!1},height:{type:[String,Number],default:"36px"},preIcon:{type:String,default:""},suffixIcon:{type:String,default:""},iconSize:{type:[String,Number],default:"32"},iconColor:{type:String,default:"#585d6e"},customStyle:{type:Object,default:()=>({})},href:{type:String,default:""},options:{type:Array,default:()=>[]}},emits:["click","optionClick"],setup(e,{emit:n}){const o=t(!1),i=s(()=>e.options&&Array.isArray(e.options)&&e.options.length>0),r=s(()=>e.options&&e.options.length>1),l=s(()=>e.options&&1===e.options.length),c=s(()=>({height:"number"==typeof e.height?`${e.height}px`:e.height,...e.customStyle})),d=(t,e)=>{o.value=!1,t.onclick&&"function"==typeof t.onclick&&t.onclick(),n("optionClick",{option:t,index:e})},u=()=>{o.value=!1};return a(()=>{document.addEventListener("closeAllButtonMenus",u)}),{showOptionsMenu:o,hasOptions:i,hasMultipleOptions:r,isSingleOption:l,buttonStyle:c,handleClick:()=>{if(i.value){if(l.value)d(e.options[0],0);else if(r.value){const t=o.value;document.dispatchEvent(new CustomEvent("closeAllButtonMenus")),o.value=!t}}else n("click")},handleOptionClick:d}},template:'\n\t\t\t\n\t\t'};let h=null;const f={name:"SsSelect",props:{options:{type:Array,default:()=>[]},mapping:{type:Object,default:()=>({text:"n",value:"v"})},modelValue:{type:[String,Number],default:""},placeholder:{type:String,default:"请选择"},validation:{type:Object,default:()=>({enable:!1,message:""})},disabled:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},width:{type:String,default:"100%"},minWidth:{type:String,default:"unset"},cb:{type:String,default:""},url:{type:String,default:"/service?ssServ=loadObjpOpt&objectpickerdropdown1=1"},inp:{type:[Boolean,String],default:!1},filter:{type:[Object,String],default:null},autoSelectFirst:{type:Boolean,default:!1}},emits:["update:modelValue","change","search","clear","loaded"],setup(e,{emit:o}){const l=t(!1),c=t(null),d=t(null),u=t({}),m=t(null),p=t(e.modelValue),g=t(""),f=t(""),v=t([]),S=t(!1),y=t(""),w=t(!1),b=s(()=>!0===e.inp||"true"===e.inp),I=t=>{if(null==t)return"";if("number"==typeof t)return`${t}px`;return String(t).trim()},k=s(()=>{const t=I(e.width);return!!t&&("100%"!==t&&"auto"!==t)}),x=s(()=>!!String(e.cb||"").trim()),T=s(()=>Array.isArray(e.options)&&e.options.length>0?e.options:x.value?v.value:[]),E=t=>{if(!t||"object"!=typeof t)return"";const n=t[e.mapping.text];return null==n?"":String(n)},A=()=>T.value.find(t=>t?.[e.mapping.value]===p.value),_=()=>{if(!b.value)return;const t=A();g.value=t?E(t):"",f.value="",w.value=!1},C=s(()=>{const t=Array.isArray(T.value)?T.value:[];if(!b.value||w.value)return t;const e=String(f.value||"").trim().toLowerCase();return e?t.filter(t=>E(t).toLowerCase().includes(e)):t}),U=()=>{if(k.value)return void(y.value="");const t=[e.placeholder].concat((Array.isArray(T.value)?T.value:[]).map(t=>t?.[e.mapping.text])).map(t=>null==t?"":String(t).trim()).filter(Boolean);if(!t.length||"undefined"==typeof document)return void(y.value="");const n=c.value?.querySelector?.(".select-text")||c.value,o=n?window.getComputedStyle(n):null,a=o?.fontSize||"16px",i=o?.fontWeight||"400",s=o?.fontFamily||"sans-serif",r=document.createElement("canvas").getContext("2d");if(!r)return;r.font=`${i} ${a} ${s}`;const l=t.reduce((t,e)=>Math.max(t,r.measureText(e).width),0);y.value=`${Math.max(88,Math.ceil(l+52))}px`},M=async()=>{if(x.value&&window.request&&"function"==typeof window.request.post){S.value=!0;try{const t=(()=>{if(!e.filter)return{};if("object"==typeof e.filter)return e.filter;if("string"==typeof e.filter)try{const t=JSON.parse(e.filter);return t&&"object"==typeof t?t:{}}catch(t){return{}}return{}})(),n={input:String(b.value),codebook:String(e.cb||""),...t},a={objectpickerparam:JSON.stringify(n),objectpickertype:1,objectpickersearchAll:1};"xyByBj"===String(e.cb||"")&&t.bjid&&(n.cascadingLevel="bjid,ryid",a.objectpickerparam=JSON.stringify(n),a.upperValue=t.bjid);const i=await window.request.post(e.url||"/service?ssServ=loadObjpOpt&objectpickerdropdown1=1",a,{loading:!1,formData:!0}),s=(t=>{const e=t||{};return Array.isArray(e.resultList)?e.resultList.map(t=>t&&"object"==typeof t?t:{n:String(t||""),v:String(t||"")}):Array.isArray(e.result)?e.result.map(t=>{if(!t||"object"!=typeof t)return null;const e=Object.entries(t)[0];return e?{n:e[1],v:e[0]}:null}).filter(Boolean):e.result&&"object"==typeof e.result?Object.keys(e.result).map(t=>({n:e.result[t],v:t})):Array.isArray(e.objectList)?e.objectList.map(t=>t&&"object"==typeof t?t:{n:String(t||""),v:String(t||"")}):[]})(i&&i.data?i.data:null);v.value=s,o("loaded",s),(t=>{if(!e.autoSelectFirst)return;if(!Array.isArray(t)||0===t.length)return;if(void 0!==p.value&&null!==p.value&&""!==p.value)return;const n=t[0];if(!n||"object"!=typeof n)return;const a=n[e.mapping.value];null!=a&&""!==a&&(p.value=a,o("update:modelValue",a),o("change",a),_())})(s),l.value||_()}catch(t){v.value=[],o("loaded",[]),console.error("[ss-select] loadRemoteOptions failed",e.cb,t)}finally{S.value=!1}}},D=s(()=>!!e.loading||S.value),N=s(()=>{const t={},n=I(e.width),o=I(e.minWidth);return t.maxWidth="100%",k.value&&(t.width=n),o&&"unset"!==o?t.minWidth=`min(${o}, 100%)`:y.value&&(t.minWidth=`min(${y.value}, 100%)`),t}),j=s(()=>{if(!p.value)return e.placeholder;const t=A();return t?E(t):e.placeholder}),O=()=>{if(!b.value)return;const t=A(),e=t?E(t):"";f.value||g.value!==e||(g.value=""),f.value=g.value,w.value=!1},P=async()=>{await r();const t=c.value,e=d.value;if(!t||!e)return;const n=t.getBoundingClientRect(),o=document.documentElement.clientWidth||window.innerWidth,a=document.documentElement.clientHeight||window.innerHeight,i=12,s=Math.min(e.scrollHeight||300,320),l=a-n.bottom-i-6,m=n.top-i-6,p=ll,g=Math.max(p?m:l,80),h=Math.min(320,g),f=p?Math.max(i,n.top-h-6):Math.min(a-i-h,n.bottom+6),v=Math.min(o-24,Math.max(n.width,260)),S=Math.max(i,Math.min(n.left,o-i-v));u.value={display:"block",position:"fixed",fontSize:"14px",lineHeight:"20px",top:`${f}px`,left:`${S}px`,minWidth:`${Math.min(n.width,o-24)}px`,maxWidth:o-24+"px",maxHeight:`${Math.max(80,h)}px`,width:`${v}px`,overflowY:"auto",overflowX:"hidden",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",zIndex:1e4},await r();const y=e.getBoundingClientRect();y.right>o-i&&(u.value={...u.value,left:`${Math.max(i,o-i-y.width)}px`})},L=(t=!1)=>{e.disabled||(h&&h!==$&&h({restoreInput:!0}),w.value=t,l.value=!0,h=$,P())},$=({restoreInput:t=!0}={})=>{l.value=!1,w.value=!1,h===$&&(h=null),t&&_()},R=()=>{e.disabled||(l.value?$():L(!1))},H=t=>{c.value?.contains(t.target)||d.value?.contains(t.target)||$()},V=()=>{l.value&&P()};return n(()=>e.modelValue,t=>{p.value=t,l.value||_()},{immediate:!0}),n(()=>e.options,t=>{x.value||(o("loaded",Array.isArray(t)?t:[]),l.value||_())}),n(()=>[e.cb,e.url,e.filter],()=>{x.value&&M()}),n(()=>[e.placeholder,e.width,e.minWidth,T.value.map(t=>t?.[e.mapping.text]).join("||")],()=>{U()},{immediate:!0}),n(()=>T.value,()=>{l.value||_()},{deep:!0}),a(()=>{document.addEventListener("click",H),window.addEventListener("resize",V),window.addEventListener("scroll",V,!0),M(),!x.value&&Array.isArray(e.options)&&o("loaded",e.options),_(),U()}),i(()=>{h===$&&(h=null),document.removeEventListener("click",H),window.removeEventListener("resize",V),window.removeEventListener("scroll",V,!0)}),{containerRef:c,optionsRef:d,optionsStyle:u,inputRef:m,isOpen:l,selectedValue:p,searchKeyword:g,canInput:b,filteredOptions:C,finalLoading:D,displayText:j,selectContainerStyle:N,handleContainerClick:()=>{e.disabled||b.value||R()},handleTextClick:()=>{e.disabled||(b.value?(O(),L(!1),m.value&&m.value.focus()):R())},handleInputFocus:()=>{!e.disabled&&b.value&&(O(),L(!1))},handleInput:t=>{const e=t?.target?.value||"";g.value=e,f.value=e,w.value=!1,l.value=!0,P(),o("search",e)},handleArrowClick:()=>{e.disabled||(b.value?(f.value="",w.value=!0,l.value=!0,P()):R())},selectOption:t=>{const n=t[e.mapping.value];p.value=n,g.value=E(t),f.value="",w.value=!1,l.value=!1,o("update:modelValue",n),o("change",n)}}},template:'\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t \n\t\t\t\t\t\t{{ displayText }} \n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t \n\t\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t加载中... \n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t无选项\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{{ option[mapping.text] }}\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t \n\t\t\t
\n\t\t'},v={name:"SsBottom",props:{showShyj:{type:Boolean,default:!1},shyjTitle:{type:String,default:"审核意见"},shyjPlaceholder:{type:String,default:"请输入审核意见"},divider:{type:Boolean,default:!0},buttons:{type:Array,default:()=>[{text:"取消",action:"cancel"},{text:"保存并提交",action:"submit"}]}},emits:["button-click","update:shyjValue"],setup(e,{emit:n}){const o=t(""),a=t(-1);return{reason:o,activeButtonIndex:a,handleButtonClick:(t,e)=>{n("button-click",{action:t.action,button:t,index:e,shyjValue:o.value})},handleShyjInput:t=>{const e=t.target.value;o.value=e,n("update:shyjValue",e)},handleButtonMouseDown:t=>{a.value=t},handleButtonMouseUp:()=>{a.value=-1},handleMouseLeave:()=>{a.value=-1},getButtonStyle:t=>{const e={};return t.backgroundColor&&(e.backgroundColor=t.backgroundColor),t.color&&(e.color=t.color),e},getButtonActiveStyle:t=>{const e={};return t.clickBgColor?e.backgroundColor=t.clickBgColor:t.backgroundColor&&(e.backgroundColor=t.backgroundColor),t.clickColor?e.color=t.clickColor:t.color&&(e.color=t.color),e}}},template:'\n\t\t\t\n\t\t\t\t\x3c!-- 审核意见区域 --\x3e\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{{ shyjTitle }} \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\x3c!-- 按钮区域 --\x3e\n\t\t\t\t
\n\t\t\t
\n\t\t'},S={name:"SsVerify",props:{verifyList:{type:Array,required:!0}},setup(t){const e=()=>{const t=document.querySelector(".group-item-last-open");if(console.log("lastOpenGroup",t),t){const e=t.querySelectorAll(".verify-node-container");if(e.length){let n=0;if(1===e.length){const t=e[0].offsetHeight;n=e[0].offsetTop+t/2-15}else{const t=e[e.length-1];n=t.offsetTop+t.offsetHeight/2-15}console.log("节点信息:",{节点总数:e.length,计算后的高度:n,最后节点top:e[e.length-1]?.offsetTop,最后节点高度:e[e.length-1]?.offsetHeight}),t.style.setProperty("--group-line-height",`${n}px`)}}};return a(()=>{setTimeout(()=>{e()},100)}),{toggleOpen:t=>{t.open=!t.open,setTimeout(()=>{e()},50)}}},render(){const{h:t}=Vue;return t("div",{class:"verify-nodes"},this.verifyList.map((e,n)=>t("div",{key:n,class:{"group-item":!0,"group-item-last-open":n===this.verifyList.length-1&&e.open}},[t("div",{class:"group-item-title",onClick:()=>this.toggleOpen(e)},[t("div",{class:"icon"},[t("i",{class:e.open?"common-icon-folder-open common-icon":"common-icon-folder-close common-icon"}),t("div",{class:"num",style:{top:e.open?"60%":"55%"}},e.children?.length||0)]),t("div",{class:"name"},e.groupName)]),e.open&&e.children?.length>0?t("div",{class:"group-item-children"},e.children.map((e,n)=>t(y,{key:n,item:e,isGroup:!0}))):null])))}},y={name:"SsVerifyNode",props:{item:{type:Object,required:!0},isGroup:{type:Boolean,default:!1}},render(){const{h:t}=Vue;return t("div",{class:"verify-node-container"},[t("div",{class:"info"},[t("div",{class:"avatar"},[t("img",{src:this.item.thumb,style:{width:"50px",height:"50px",borderRadius:"50%"}})]),t("div",{class:"desc"},[t("div",this.item.name),t("div",this.item.role)]),t("div",{class:"link"},[t("div",[this.item.video?t("i",{class:"common-icon-video common-icon"}):null,this.item.link?t("i",{class:"common-icon-paper-clip common-icon"}):null])])]),t("div",{class:{description:!0,link:this.isGroup},attrs:{"data-num":"3"}},[t("div",this.item.description)]),t("div",{class:"time"},this.item.time)])}},w={name:"SsOnoffButton",props:{name:{type:String,required:!0},label:{type:String,required:!0},value:{type:[String,Number],required:!0},width:{type:String,default:""},modelValue:{type:[String,Number,Array],default:""},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(t,{emit:e}){const n=t=>{if(!t)return[];if(Array.isArray(t))return t.map(t=>t.toString());const e=t.toString().replace(/^,+/,"");return e.includes("|")?e.split("|"):e.includes(",")?e.split(","):e?[e]:[]};return{isChecked:s(()=>{if(t.multiple){return n(t.modelValue).includes(t.value.toString())}return t.modelValue===t.value}),toggleSelect:()=>{if(!t.disabled)if(t.multiple){const o=n(t.modelValue);let a;a=-1===o.indexOf(t.value.toString())?[...o,t.value.toString()]:o.filter(e=>e!==t.value.toString());const i=a.join(",");e("update:modelValue",i),e("change",i,a)}else e("update:modelValue",t.value),e("change",t.value)}}},template:'\n\t\t\t \n\t\t\t'},b={name:"SsDatetimePicker",props:{mode:{type:String,default:"date"},placeholder:{type:String,default:"请选择日期"},modelValue:{type:String,default:""},minDate:{type:String,default:""},maxDate:{type:String,default:""},name:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change","confirm","cancel","open","close"],setup(e,{emit:o}){const a=t(!1),i=t(!1),r=t("date"),l=t=>{try{const e=window.parent&&window.parent.__mpObjInpSetBottomVisible;"function"==typeof e&&e(!1!==t)}catch(t){}};n([a,i],([t,e],[n,a])=>{const i=!(!t&&!e),s=!(!n&&!a);if(!s&&i)return o("open"),void l(!1);s&&!i&&(o("close"),l(!0))});const c=t([]),d=t(["12","00"]),u=t(""),m=s(()=>{if(!e.modelValue)return e.placeholder;try{const t=new Date(e.modelValue);if(isNaN(t.getTime()))return e.modelValue;const n=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0");return"time"===e.mode?`${i}:${s}`:"datetime"===e.mode?`${n}-${o}-${a} ${i}:${s}`:`${n}-${o}-${a}`}catch(t){return e.modelValue}});n(()=>e.modelValue,t=>{if(console.log("📅 modelValue 变化:",t),t)try{const e=new Date(t);isNaN(e.getTime())||(c.value=[e.getFullYear(),e.getMonth()+1,e.getDate()],console.log("📅 转换为数组:",c.value))}catch(e){console.warn("Invalid date:",t)}else{const t=new Date;c.value=[t.getFullYear(),t.getMonth()+1,t.getDate()]}},{immediate:!0});const p=s(()=>e.minDate?new Date(e.minDate):void 0),g=s(()=>e.maxDate?new Date(e.maxDate):void 0);return{showPicker:a,showTimePicker:i,currentDateArray:c,currentTimeArray:d,displayText:m,openPicker:()=>{e.disabled||(a.value=!0)},onConfirm:t=>{console.log("📅 Vant Picker confirm 原始值:",t,"mode:",e.mode);try{const n=t.selectedValues||t;if(console.log("📅 selectedValues:",n),"time"===e.mode){if(Array.isArray(n)&&n.length>=2){const[t,e]=n,i=`${t.padStart(2,"0")}:${e.padStart(2,"0")}`;console.log("🕐 转换后的时间字符串:",i),o("update:modelValue",i),o("change",i),o("confirm",i),o("close"),l(!0),a.value=!1}}else if(Array.isArray(n)&&n.length>=3){const[t,s,c]=n,d=`${t}-${s.padStart(2,"0")}-${c.padStart(2,"0")}`;"datetime"===e.mode?(u.value=d,a.value=!1,i.value=!0,r.value="time"):(o("update:modelValue",d),o("change",d),o("confirm",d),o("close"),l(!0),a.value=!1)}}catch(t){console.error("Picker conversion error:",t)}},onTimeConfirm:t=>{try{const e=t.selectedValues||t;if(Array.isArray(e)&&e.length>=2){const[t,n]=e,a=`${u.value} ${t.padStart(2,"0")}:${n.padStart(2,"0")}`;o("update:modelValue",a),o("change",a),o("confirm",a),o("close"),l(!0)}}catch(t){console.error("Time conversion error:",t)}i.value=!1,r.value="date"},onTimeCancel:()=>{o("cancel"),i.value=!1},onCancel:()=>{o("cancel"),a.value=!1},minDateObj:p,maxDateObj:g}},template:'\n\t\t\t \n\t\t\t \x3c!-- 隐藏的input用于ssVm校验 --\x3e\n\t\t\t
\n\n\t\t\t
\n\t\t\t {{ displayText }} \n\t\t\t
\n\n\t\t\t \x3c!-- 日期选择器 --\x3e\n\t\t\t
\n\t\t\t \n\t\t\t \n\t\t\t \n\n\t\t\t \x3c!-- 时间选择器(datetime 模式的第二步) --\x3e\n\t\t\t
\n\t\t\t \n\t\t\t \n\t\t\t
\n\t\t\t'},I={name:"SsConfirm",props:{modelValue:{type:Boolean,default:!1},title:{type:String,default:"确认"},content:{type:String,default:""},maskClosable:{type:Boolean,default:!0}},emits:["update:modelValue","confirm","cancel","close"],setup(t,{emit:e}){n(()=>t.modelValue,t=>{console.log("🔔 SsConfirm modelValue 变化:",t),t?document.body.classList.add("modal-open"):document.body.classList.remove("modal-open")},{immediate:!0});const o=()=>{console.log("🚪 关闭确认弹窗"),e("update:modelValue",!1),e("close")};return{onMask:()=>{console.log("👆 点击了遮罩层"),t.maskClosable&&o()},onCancel:()=>{console.log("❌ 点击了取消按钮"),e("cancel"),o()},onConfirm:()=>{console.log("✅ 点击了确认按钮,触发 confirm 事件"),e("confirm"),o()}}},template:'\n\t\t\t \n\t\t\t
\n\t\t\t
\n\t\t\t \n\t\t\t \n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t 取消 \n\t\t\t 确认 \n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t'},k={name:"SsImageCropper",props:{show:{type:Boolean,default:!1},src:{type:String,required:!0},shape:{type:String,required:!0},aspectRatio:{type:Number,default:1},outputWidth:{type:Number,default:300},outputHeight:{type:Number,default:300}},emits:["update:show","confirm","cancel"],setup(e,{emit:o}){const a=t(null);n(()=>e.show,t=>{t?Vue.nextTick(()=>{i().catch(t=>{console.error("图片裁剪组件初始化失败:",t)})}):s()}),n(()=>e.src,()=>{e.show&&Vue.nextTick(()=>{i().catch(t=>{console.error("图片裁剪组件重新初始化失败:",t)})})});const i=async()=>{window.Cropper||await l("cropper");const t=document.getElementById("ss-image-cropper-img");if(!t||!window.Cropper)return;s();const n=document.querySelector(".ss-image-cropper-container");n&&("circle"===e.shape?(n.classList.add("crop-shape-circle"),n.classList.remove("crop-shape-square")):(n.classList.add("crop-shape-square"),n.classList.remove("crop-shape-circle"))),a.value=new window.Cropper(t,{aspectRatio:e.aspectRatio,viewMode:1,dragMode:"move",autoCropArea:.8,restore:!1,guides:!1,center:!1,highlight:!1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!1,minContainerWidth:window.innerWidth,minContainerHeight:window.innerHeight-50})},s=()=>{a.value&&(a.value.destroy(),a.value=null)};return{handleCropAction:t=>{"cancel"===t.action?(o("update:show",!1),o("cancel")):"confirm"===t.action&&(()=>{if(!a.value)return;a.value.getCroppedCanvas({width:e.outputWidth,height:e.outputHeight,imageSmoothingEnabled:!0,imageSmoothingQuality:"high",fillColor:"#fff"}).toBlob(t=>{o("update:show",!1),o("confirm",t)},"image/jpeg",.9)})()}}},template:'\n\t\t\t\n\t\t\t\t\x3c!-- 左上角尺寸显示 --\x3e\n\t\t\t\t
\n\t\t\t\t\t长: {{ outputWidth }}px 宽: {{ outputHeight }}px\n\t\t\t\t
\n\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- 使用 ss-bottom 组件 --\x3e\n\t\t\t\t
\n\t\t\t
\n\t\t'},x={name:"SsUploadImage",props:{modelValue:{type:[String,Array],default:""},max:{type:Number,default:1},disabled:{type:Boolean,default:!1},width:{type:[Number,String],required:!0},height:{type:[Number,String],required:!0},shape:{type:String,required:!0},aspectRatio:{type:Number,default:void 0},outputWidth:{type:Number,default:300},outputHeight:{type:Number,default:300}},emits:["update:modelValue","updated"],setup(e,{emit:o}){const a=t(!1),i=t(""),r=t([]);n(()=>e.modelValue,t=>{1===e.max?r.value=t?[t]:[]:r.value=Array.isArray(t)?[...t]:t?[t]:[]},{immediate:!0});const l=s(()=>r.value.length({width:"number"==typeof e.width?`${e.width}px`:e.width,height:"number"==typeof e.height?`${e.height}px`:e.height,borderRadius:"circle"===e.shape?"50%":"8px"})),u=t=>{1===e.max?o("update:modelValue",t[0]||""):o("update:modelValue",t)};return{imageList:r,canAddMore:l,itemStyle:d,showCropper:a,tempImageSrc:i,getImageUrl:t=>t?t.startsWith("http")||t.startsWith("blob:")?t:window.SS.utils?.getImageUrl?.(t)||t:"/static/images/yishuzhao_nv.svg",selectImage:()=>{if(e.disabled||!l.value)return;const t=document.createElement("input");t.type="file",t.accept="image/*",t.onchange=t=>{const e=t.target.files[0];if(e){const t=new FileReader;t.onload=t=>{i.value=t.target.result,a.value=!0},t.readAsDataURL(e)}},t.click()},deleteImage:t=>{const e=r.value.filter((e,n)=>n!==t);u(e)},handleCropConfirm:async t=>{try{const e=await c(t,"image","image.jpg"),n=[...r.value,e];u(n),o("updated",e)}catch(t){console.error("上传失败:",t)}},handleCropCancel:()=>{i.value=""}}},template:'\n\t\t\t\n\t\t\t\t\x3c!-- 图片列表 --\x3e\n\t\t\t\t
\n\t\t\t\t\t\x3c!-- 已上传的图片 --\x3e\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\x3c!-- 删除按钮 --\x3e\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\n\t\t\t\t\t\x3c!-- 添加按钮 --\x3e\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
{{ imageList.length }}/{{ max }}
\n\t\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- 裁剪组件 --\x3e\n\t\t\t\t
\n\t\t\t
\n\t\t'},T={name:"SsCarCard",props:{carData:{type:Object,default:()=>({})},status:{type:String,default:"available",validator:t=>["available","reserved","disabled"].includes(t)}},emits:["click","select"],setup:(t,{emit:e})=>({statusClass:s(()=>`status-${t.status}`),getImageUrl:t=>t?t.startsWith("http")||t.startsWith("blob:")?t:window.SS.utils?.getImageUrl?.(t)||t:"/static/images/default-car.png",handleCardClick:()=>{"disabled"!==t.status&&(e("click",t.carData),e("select",t.carData))}}),template:'\n\t\t\t\n\t\t\t\t\x3c!-- 第一行:车辆名称 --\x3e\n\t\t\t\t
\n\t\t\t\t\t{{ carData.name || \'别克GL8\' }}\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- 第二行:左右结构 --\x3e\n\t\t\t\t
\n\t\t\t\t\t\x3c!-- 左边:车辆图片 --\x3e\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\n\t\t\t\t\t\x3c!-- 右边:车辆信息 --\x3e\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{{ carData.wph }}\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{{ wp.mc }} : {{ wp.sz || wp.zf }}\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{{ carData.type || \'商务车\' }}\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t'},E={name:"SsSubTab",props:{tabList:{type:Array,required:!0},activeIndex:{type:Number,default:0},baseParams:{type:Object,default:()=>({})}},emits:["tab-change"],setup(e,{emit:o}){const a=t(e.activeIndex),i=t(""),s=t=>{const n=e.tabList[t];if(!n||!n.dest)return;const o=`mp_${n.dest}.html`,a=n.service||n.servName||e.baseParams.service||e.baseParams.ssServ||"",s=n.dest||e.baseParams.dest||e.baseParams.ssDest||"",r=n.param||n.parm||e.baseParams.param||e.baseParams.parm||"",l=new URLSearchParams({...e.baseParams,service:a,dest:s,ssServ:a,ssDest:s,param:r,parm:r});i.value=`/page/${o}?${l.toString()}`,console.log("🔄 切换到Tab:",n.desc||n.title,"加载页面:",i.value)};n(()=>e.activeIndex,t=>{a.value=t,s(t)},{immediate:!0}),n(()=>e.tabList,()=>{e.tabList.length>0&&0===a.value&&s(0)},{immediate:!0});return{currentTab:a,currentTabUrl:i,handleTabClick:t=>{a.value!==t&&(a.value=t,s(t),o("tab-change",{index:t,tab:e.tabList[t]}))}}},template:'\n\t\t\t\n\t\t\t\t\x3c!-- Tab 栏 --\x3e\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t{{ tab.desc || tab.title }}\n\t\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- 内容区域 --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t'},A={name:"SsUploadFile",props:{modelValue:{type:[String,Array],default:""},max:{type:Number,default:1},disabled:{type:Boolean,default:!1},accept:{type:String,default:".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar"},maxSize:{type:Number,default:5}},emits:["update:modelValue","uploaded"],setup(e,{emit:o}){const a=t([]);n(()=>e.modelValue,t=>{1===e.max?a.value=t?[{path:t,name:r(t)}]:[]:Array.isArray(t)?a.value=t.map(t=>({path:t,name:r(t)})):a.value=t?[{path:t,name:r(t)}]:[]},{immediate:!0});const i=s(()=>a.value.length{if(!t)return"";const e=t.split("/");return e[e.length-1]},l=t=>{const n=t.map(t=>t.path);1===e.max?o("update:modelValue",n[0]||""):o("update:modelValue",n)};return{fileList:a,canAddMore:i,getFileIcon:t=>({pdf:"icon-pdf",doc:"icon-word",docx:"icon-word",xls:"icon-excel",xlsx:"icon-excel",txt:"icon-txt",zip:"icon-zip",rar:"icon-zip"}[t.split(".").pop().toLowerCase()]||"icon-wenjian"),selectFile:()=>{if(e.disabled||!i.value)return;const t=document.createElement("input");t.type="file",t.accept=e.accept,t.onchange=async t=>{const n=t.target.files[0];if(!n)return;if(n.size/1024/1024>e.maxSize)window.showToast?.(`文件大小不能超过${e.maxSize}MB`,"error");else try{const t=await c(n,"file",n.name),e=[...a.value,{path:t,name:n.name}];l(e),o("uploaded",t)}catch(t){console.error("文件上传失败:",t)}},t.click()},deleteFile:t=>{const e=a.value.filter((e,n)=>n!==t);l(e)},downloadFile:t=>{const e=window.SS.utils?.getFileUrl?.(t.path)||window.getFileUrl?.(t.path)||t.path;window.open(e,"_blank")}}},template:'\n\t\t\t\n\t\t\t\t\x3c!-- 文件列表 --\x3e\n\t\t\t\t
\n\t\t\t\t\t\x3c!-- 已上传的文件 --\x3e\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{{ file.name }} \n\t\t\t\t\t\t
\n\t\t\t\t\t\t\x3c!-- 文件操作按钮 --\x3e\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- 添加按钮 --\x3e\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t \n\t\t\t\t\t
\n\t\t\t\t\t
上传文件 ({{ fileList.length }}/{{ max }}) \n\t\t\t\t\t
支持格式: {{ accept }},最大{{ maxSize }}MB \n\t\t\t\t
\n\t\t\t
\n\t\t'},_={name:"SsEditor",props:{modelValue:{type:String,default:""},name:{type:String,default:"mswj"},url:{type:String,default:""},height:{type:[Number,String],default:280},placeholder:{type:String,default:"请输入内容"},readonly:{type:Boolean,default:!1},uploadUrl:{type:String,default:"/service?ssServ=ulByHttp"},param:{type:Object,default:()=>({})}},emits:["update:modelValue","ready","change"],setup(e,{emit:o}){const s=`ss-editor-${Date.now()}-${Math.floor(1e4*Math.random())}`,r=t(""),c=t(null),d=t(e.param?.button?.val||""),u=e.param?.button?.desc||"附件",m=e.param?.mode,p=async()=>{if(!e.param?.button?.cmsUpdUrl)return void console.warn("未配置附件编辑地址 cmsUpdUrl");const t=await(async()=>d.value?d.value:e.param?.button?.cmsAddUrl?new Promise(t=>{$.ajax({type:"post",url:e.param.button.cmsAddUrl,async:!1,data:{name:"fjid",ssNrObjName:"sh",ssNrObjId:""},success:e=>{d.value=e||"",t(d.value)},error:()=>t("")})}):"")();if(!t)return;const n=`&nrid=T-${t}&objectId=${t}&objectName=${encodeURIComponent(u)}&callback=${window.fjidCallbackName||""}`;window.SS&&"function"==typeof window.SS.openDialog&&window.SS.openDialog({src:e.param.button.cmsUpdUrl+n,headerTitle:"编辑",width:900,high:664,zIndex:51})};return a(async()=>{try{await(async()=>{if(window.Jodit&&window.Jodit.make||await l("jodit"),!window.Jodit||!window.Jodit.make)return void console.error("Jodit 未加载,无法初始化 ss-editor");const t=e.uploadUrl.includes("?")?`${e.uploadUrl}&type=img`:`${e.uploadUrl}?type=img`,n=window.Jodit.make(`#${s}`,{height:e.height,placeholder:e.placeholder,readonly:e.readonly,language:"zh_cn",showXPathInStatusbar:!1,showCharsCounter:!1,showWordsCounter:!1,allowResizeY:!1,toolbarSticky:!1,statusbar:!1,uploader:{url:t,format:"json",method:"POST",filesVariableName:t=>`imgs[${t}]`,isSuccess:t=>0===t?.code||!!t?.data,getMessage:t=>t?.msg||"上传失败",process:t=>t?.data?.url||t?.data?.path||"",contentType:()=>!1},controls:{customLinkButton:{name:"link",tooltip:"附件",exec:()=>{p()}}},buttons:["fullsize","bold","italic","underline","|","font","fontsize","|","left","center","right","|","ul","ol","|","image","table","customLinkButton","|","undo","redo"],buttonsMD:["bold","italic","underline","|","image","customLinkButton","|","dots"],buttonsSM:["bold","italic","|","image","customLinkButton","|","dots"],buttonsXS:["bold","|","dots"]});n.value=r.value||"",n.events.on("change",()=>{r.value=n.value||"",o("change",r.value)}),c.value=n,o("ready",n)})()}catch(t){console.error("ss-editor 初始化失败:",t)}await(async()=>{if(e.url&&e.modelValue)try{const t=new URLSearchParams;m&&t.append("mode",m),t.append("path",e.modelValue);const n=await window.axios.post(e.url,t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}}),a=n?.data?.content||"";a&&(r.value=a,c.value&&(c.value.value=a));const i=n?.data?.path;i&&o("update:modelValue",i)}catch(t){console.error("ss-editor 回显内容加载失败:",t)}})()}),n(()=>e.readonly,t=>{c.value&&"function"==typeof c.value.setReadOnly&&c.value.setReadOnly(t)}),i(()=>{c.value&&"function"==typeof c.value.destruct&&c.value.destruct()}),{editorElementId:s,editorContent:r,fjid:d}},template:'\n\t\t\t\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t \n\t\t\t\t \n\t\t\t\t\n\t\t\t
\n\t\t'};window.SS.dom.initializeFormApp=function(t){const{el:n,...o}=t,a=e({...o});a.component("SsInput",u),a.component("SsBottom",v),a.component("SsCard",p),a.component("SsSearchButton",g),a.component("SsSelect",f),a.component("Icon",m);const i=window.vant||window.Vant;if(console.log("🔍 检查 Vant:",{hasVant:!!window.vant,hasVantCap:!!window.Vant,vantLib:!!i,vantKeys:i?Object.keys(i).slice(0,20):[],hasPopup:i?.Popup,hasDatetimePicker:i?.DatetimePicker,hasDatePicker:i?.DatePicker,hasTimePicker:i?.TimePicker,allKeys:i?Object.keys(i):[]}),i)try{a.use(i),console.log("✅ Vant 全部组件注册成功")}catch(t){console.error("❌ Vant 组件注册失败:",t);try{a.component("van-popup",i.Popup),a.component("van-datetime-picker",i.DatetimePicker),console.log("✅ Vant 手动注册成功")}catch(t){console.error("❌ Vant 手动注册也失败:",t)}}else console.warn("⚠️ Vant 未加载");a.component("ss-verify",S),a.component("ss-verify-node",y),a.component("ss-common-icon",d),a.component("ss-onoff-button",w),a.component("ss-datetime-picker",b),a.component("ss-confirm",I),a.component("ss-image-cropper",k),a.component("ss-upload-image",x),a.component("ss-upload-file",A),a.component("ss-car-card",T),a.component("ss-sub-tab",E),a.component("ss-editor",_),a.component("SsEditor",_);const s=a.mount(n);return s.data=o.data(),s}}();