PageSourceSearch

https://taiwansla.org/_next/static/chunks/7196.7ce86dd709aa22da.js

js taiwansla.org collected 2026-10-08 06:43:22 UTC 11,749 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7196],{17196:function(e,l,a){a.r(l),a.d(l,{default:function(){return D}});var n=a(57437),o=a(16463),r=a(2265),i=a(91656),t=a(60042),s=a(89431),d=a(38815),u=a(83441),m=a(62737),c=a.n(m),g=a(43033),f=a(75686),v=a(23486),h=a(73907),x=a(60507);a(62432);var p=a(50219),U=a(34363),C=a(645),I=a(78314),b=a(14687),y=a(78708);function D(e){var l,a,m,D,j;let{searchParams:N,type:w}=e,L=(0,o.useRouter)(),F=(0,i.TL)(),G=(0,i.CG)(e=>e.user),[T,z]=(0,r.useState)(null),[S,A]=(0,r.useState)(new Date),E={languageCode:null!==(a=N.languageCode)&&void 0!==a?a:"zh",languageGroup:null,enabled:1,layerChildID:null,title:"",content:"",imgUrl:{url:null,file:null},seoTitle:"",seoContent:"",seoImgUrl:{url:null,file:null},fileUrl:{url:null,file:null}},{handleSubmit:K,getValues:k,setValue:R,reset:_,trigger:H,yup:Y,setSchema:Z,errors:M,setting:O}=(0,s.D)({defaultValues:E}),[V,q]=(0,r.useState)({lang:{},obj:{},languageGroup:{}});(0,r.useEffect)(()=>{Z(Y.object({languageCode:p.eo,layerChildID:p.ij,title:p.eo,seoContent:p.eo}).required())},[]),(0,s.mS)(async e=>{F((0,t.eE)(!0)),await (0,x.R7)(100);let l=await d.lD.getLayerThreeChildList({data:{page:-1,type:w},options:{signal:e}}),a={Response:1};N.languageGroup&&(a=await d.lD.getLayerThreeLeafList({data:{languageGroup:N.languageGroup,type:w,_ts:new Date},options:{signal:e}}));let{data:n}=l;1===l.Response&&q(n=n.reduce((e,l)=>(e.lang[l.languageCode]||(e.lang[l.languageCode]=[]),e.lang[l.languageCode].push(l),e.obj[l.layerChildID]=l,e.languageGroup[l.languageGroup]||(e.languageGroup[l.languageGroup]={}),e.languageGroup[l.languageGroup][l.languageCode]||(e.languageGroup[l.languageGroup][l.languageCode]=l),e),{lang:{},obj:{},languageGroup:{}}));let{data:o}=a;if(1===a.Response&&N.languageGroup){var r,i,s,m;let l=o.reduce((e,l)=>({...e,[l.languageCode]:l}),{}),a=null!==(r=l[N.languageCode])&&void 0!==r?r:null;if(z(l),!a){let e=l.zh;e&&_({...E,layerChildID:null==n?void 0:null===(s=n.languageGroup[null==n?void 0:null===(m=n.obj[e.layerChildID])||void 0===m?void 0:m.languageGroup])||void 0===s?void 0:null===(i=s[N.languageCode])||void 0===i?void 0:i.layerChildID}),F((0,t.eE)(!1));return}let d=null;if(a.imgUrlStorageFilename){let{blobUrl:l=null}=await (0,U.r)({path:"/".concat(a.imgUrlStorageFilename),signal:e});d=l}let u=null;if(a.seoImgUrlStorageFilename){let{blobUrl:l=null}=await (0,U.r)({path:"/".concat(a.seoImgUrlStorageFilename),signal:e});u=l}let c=null;if(a.fileUrlStorageFilename){let{blobUrl:l=null}=await (0,U.r)({path:"/".concat(a.fileUrlStorageFilename),signal:e});c=l}let g=(0,x.G3)(E,a);g.imgUrl={url:d,file:null},g.seoImgUrl={url:u,file:null},g.fileUrl={url:c,file:null},g.content&&(g.content=(0,I.m)({html:g.content})),_(g)}if((0,u.oH)({data:[l,a],action:e=>{F((0,t.fz)({severity:"error",summary:e,detail:""}))}})){F((0,t.eE)(!1));return}F((0,t.eE)(!1))},[]);let B=g.A.menu.find(e=>e.type===w),$=(null==B?void 0:B.isDownload)===!0,J=async e=>{var l,a,n,o,r,i,s,u,m,g,f,v,h,p,U,C,b,y,D,j,G;let z;F((0,t.eE)(!0));let S=[];if(((null===(l=e.imgUrl)||void 0===l?void 0:l.url)===-1||(null===(a=e.imgUrl)||void 0===a?void 0:a.file))&&(null==T?void 0:null===(n=T[N.languageCode])||void 0===n?void 0:n.imgUrl)&&S.push({f
1ileIndexID:T[N.languageCode].imgUrl,referenceTable:"layerThreeLeaf",referenceColumn:"imgUrl",referenceID:T[N.languageCode].layerLeafID}),((null===(o=e.seoImgUrl)||void 0===o?void 0:o.url)===-1||(null===(r=e.seoImgUrl)||void 0===r?void 0:r.file))&&(null==T?void 0:null===(i=T[N.languageCode])||void 0===i?void 0:i.seoImgUrl)&&S.push({fileIndexID:T[N.languageCode].seoImgUrl,referenceTable:"layerThreeLeaf",referenceColumn:"seoImgUrl",referenceID:T[N.languageCode].layerLeafID}),$&&((null===(s=e.fileUrl)||void 0===s?void 0:s.url)===-1||(null===(u=e.fileUrl)||void 0===u?void 0:u.file))&&(null==T?void 0:null===(m=T[N.languageCode])||void 0===m?void 0:m.fileUrl)&&S.push({fileIndexID:T[N.languageCode].fileUrl,referenceTable:"layerThreeLeaf",referenceColumn:"fileUrl",referenceID:T[N.languageCode].layerLeafID}),null==T?void 0:null===(g=T[N.languageCode])||void 0===g?void 0:g.content){let{deleteList:l}=(0,I.U)({html:e.content,oldHtml:null==T?void 0:null===(b=T[N.languageCode])||void 0===b?void 0:b.content});if(l.length>0)for(let e of l)S.push({fileIndexID:e.fileIndexID,referenceTable:e.refTable||"layerThreeLeaf",referenceColumn:e.refColumn||"content",referenceID:"undefined"===e.refID?null==T?void 0:null===(y=T[N.languageCode])||void 0===y?void 0:y.layerLeafID:e.refID})}if(S.length>0)for(let e of S){let l=await d.Kc.deleteFile({fileIndexID:e.fileIndexID,referenceTable:e.referenceTable,referenceColumn:e.referenceColumn,referenceID:e.referenceID});if(1!==l.Response){F((0,t.fz)({severity:"error",summary:"刪除檔案失敗",detail:null!==(D=l.message)&&void 0!==D?D:""})),F((0,t.eE)(!1));return}}let A={...e};if(A.date&&(A.date=A.date?c()(A.date).format("YYYY-MM-DD HH:mm:ss"):""),(null===(f=e.imgUrl)||void 0===f?void 0:f.url)===-1?A.imgUrl=null:delete A.imgUrl,(null===(v=e.seoImgUrl)||void 0===v?void 0:v.url)===-1?A.seoImgUrl=null:delete A.seoImgUrl,$||(null===(h=e.fileUrl)||void 0===h?void 0:h.url)===-1?A.fileUrl=null:delete A.fileUrl,e.content){let{html:l}=(0,I.U)({html:e.content,oldHtml:null==T?void 0:null===(j=T[N.languageCode])||void 0===j?void 0:j.content});A.content=l}if(!(0,x.IS)(A,null!==(G=null==T?void 0:T[N.languageCode])&&void 0!==G?G:{})&&!(null===(p=e.imgUrl)||void 0===p?void 0:p.file)&&!(null===(U=e.seoImgUrl)||void 0===U?void 0:U.file)&&!($&&(null===(C=e.fileUrl)||void 0===C?void 0:C.file))){F((0,t.fz)({severity:"warn",summary:"無變更資料",detail:""})),F((0,t.eE)(!1)),L.push("/back/".concat(w,"/leaf"),{scroll:!1});return}(null==T?void 0:T[N.languageCode])?z=d.lD.updateLayerThreeLeaf({path:"/".concat(T[N.languageCode].layerLeafID),data:A}):((null==T?void 0:T.zh)&&(A={...A,order:T.zh.order,enabled:T.zh.enabled}),z=d.lD.setLayerThreeLeaf({data:{...A,...N}})),z.then(l=>{let{Response:a,data:n,message:o}=l;if(1===a){var r,i,s;let l=(null==T?void 0:T[N.languageCode])?T[N.languageCode].layerLeafID:n[0],a=[];(null===(r=e.imgUrl)||void 0===r?void 0:r.file)&&a.push({file:e.imgUrl.file,column:"imgUrl"}),(null===(i=e.seoImgUrl)||void 0===i?void 0:i.file)&&a.push({file:e.seoImgUrl.file,column:"seoImgUrl"}),$&&(null===(s=e.fileUrl)||void 0===s?void 0:s.file)&&a.push({file:e.fileUrl.file,column:"fileUrl"}),a.length>0?P({filesToUpload:a,dataid:l}):Q()}else F((0,t.fz)({severity:"error",summary:"儲存失敗",detail:null!=o?o:""})),F((0,t.eE)(!1))})},P=async e=>{let{filesToUpload:l,dataid:a}=e;for(let e of(await (0,x.R7)(1e3),l)){let l=new FormData;l.append("data",e.file);let o=await d.Kc.uploadImg({path:"/layerThreeLeaf/".concat(e.column,"/").concat(a),data:l});if(1!==o.Response){var n;F((0,t.fz)({severity:"error",summary:"上傳檔案失敗",detail:null!==(n=o.message)&&void 0!==n?n:""})),F((0,t.eE)(!1));return}}Q()},Q=()=>{F((0,t.fz)({severity:"success",summary:"儲存成功",detail:""})),L.push("/back/".concat(w,"/leaf"),{scroll:!1})};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("form",{onSubmit:K(J),className:"formgrid grid",children:[(0,n.jsxs)("div",{className:"flex flex-column align-items-start sm:flex-row sm:align-items-center field col-12",children:[(0,n.jsxs)("label",{htmlFor:"languageCode",className:(0,b.AK)({"p-error":M.languageCode},"col-12 sm:col-2 text-left sm:text-right mb-1 sm:mb-0"),children:[(0,n.jsx)("span",{className:"text-red-400 mr-1",children:"*"}),"語言"]}),(0,n.jsx)("div",{className:"col-12 sm:col-10 lg:col-5 md:col-8",children:(0,n.jsx)(h.F0,{setting:O,data:{name:"languageCode",options:null!==(m=G.languageList.data)&&void 0!==m?m:[],optionLabel:"name",optionValue:"languageCode",showClear:!1,disabled:!0}})})]}),(0,n.jsxs)("div",{className:"flex flex-column align-items-start sm:flex-row sm:align-items-center field col-12",children:[(0,n.jsxs)("label",{htmlFor:"layerChildID",className:(0,b.AK)({"p-error":M.layerChildID},"col-12 sm:col-2 text-left sm:text-right mb-1 sm:mb-0"),children:[(0,n.jsx)("span",{className:"text-red-400 mr-1",children:"*"}),g.Z.menu.zh["".concat(w,"_child")]]}),(0,n.jsx)("div",{className:"col-12 sm:col-10 lg:col-5 md:col-8",children:(0,n.jsx)(h.F0,{setting:O,data:{name:"layerChildID",options:null!==(j=V.lang[null!==(D=N.languageCode)&&void 0!==D?D:"zh"])&&void 0!==j?j:[],optionLabel:"title",optionValue:"layerChildID",filter:!0,filterBy:"title",disabled:N.languageGroup}})})]}),(0,n.jsxs)("div",{className:"flex flex-column align-items-start sm:flex-row sm:align-items-center field col-12",children:[(0,n.jsxs)("label",{htmlFor:"title",className:(0,b.AK)({"p-error":M.title}
1,"col-12 sm:col-2 text-left sm:text-right mb-1 sm:mb-0"),children:[(0,n.jsx)("span",{className:"text-red-400 mr-1",children:"*"}),"標題"]}),(0,n.jsx)("div",{className:"col-12 sm:col-10 lg:col-5 md:col-8",children:(0,n.jsx)(h.d$,{setting:O,data:{name:"title"}})})]}),(0,n.jsxs)("div",{className:"flex flex-column align-items-start sm:flex-row field col-12",children:[(0,n.jsx)("label",{htmlFor:"imgUrl",className:(0,b.AK)({"p-error":M.imgUrl},"col-12 sm:col-2 text-left sm:text-right mb-1 sm:mb-0 sm:mt-2"),children:"封面圖"}),(0,n.jsx)("div",{className:"col-12 sm:col-10 lg:col-5 md:col-8",children:(0,n.jsx)(f.Z,{columnName:"imgUrl",fileData:k("imgUrl"),changeAction:e=>{let{data:l}=e;R("imgUrl",l),H("imgUrl")},deleteAction:()=>{R("imgUrl",{url:-1,file:null}),H("imgUrl")}})})]}),(0,n.jsxs)("div",{className:"flex flex-column align-items-start sm:flex-row field col-12",children:[(0,n.jsxs)("label",{htmlFor:"seoContent",className:(0,b.AK)({"p-error":M.seoContent},"col-12 sm:col-2 text-left sm:text-right mb-1 sm:mb-0 sm:mt-2"),children:[(0,n.jsx)("span",{className:"text-red-400 mr-1",children:"*"}),"簡介"]}),(0,n.jsx)("div",{className:"col-12 sm:col-10",children:(0,n.jsx)(h.HI,{setting:O,data:{name:"seoContent"}})})]}),(0,n.jsxs)("div",{className:"flex flex-column align-items-start sm:flex-row field col-12",children:[(0,n.jsx)("label",{htmlFor:"content",className:(0,b.AK)({"p-error":M.content},"col-12 sm:col-2 text-left sm:text-right mb-1 sm:mb-0 sm:mt-2"),children:"產品內容"}),(0,n.jsx)("div",{className:"col-12 sm:col-10",children:(0,n.jsx)(v.Z,{table:"layerThreeLeaf",column:"content",recordId:null==T?void 0:null===(l=T[N.languageCode])||void 0===l?void 0:l.layerLeafID,value:k("content"),onChange:e=>{R("content",e),H("content")}})})]}),(()=>{var e,l;let a=g.A.menu.find(e=>e.type===w);return(null==a?void 0:a.isDownload)===!0&&(0,n.jsxs)("div",{className:"flex flex-column align-items-start sm:flex-row field col-12",children:[(0,n.jsx)("label",{htmlFor:"fileUrl",className:(0,b.AK)({"p-error":M.fileUrl},"col-12 sm:col-2 text-left sm:text-right mb-1 sm:mb-0 sm:mt-2"),children:"檔案上傳"}),(0,n.jsx)("div",{className:"col-12 sm:col-10 lg:col-5 md:col-8",children:(0,n.jsx)("div",{className:"mb-1",children:(0,n.jsx)(f.Z,{columnName:"fileUrl",fileData:k("fileUrl"),changeAction:e=>{let{data:l}=e;R("fileUrl",l),H("fileUrl")},deleteAction:()=>{R("fileUrl",{url:-1,file:null}),H("fileUrl")},downloadUrl:(null==T?void 0:null===(e=T[N.languageCode])||void 0===e?void 0:e.fileUrlStorageFilename)?"".concat("/api/","getFile/").concat(T[N.languageCode].fileUrlStorageFilename):null,downloadFileName:null==T?void 0:null===(l=T[N.languageCode])||void 0===l?void 0:l.fileUrlStorageFilename,accept:C._0.DOCUMENT_ONLY})})})]})})(),(0,n.jsxs)("div",{className:"field col-12 text-right",children:[(0,n.jsx)(y.z,{type:"button",label:"取消",className:"p-button-secondary p-button-sm p-button-outlined ml-auto px-3",onClick:()=>L.push("/back/".concat(w,"/leaf"),{scroll:!1})}),(0,n.jsx)(y.z,{type:"submit",label:"儲存",className:"p-button-main p-button-sm ml-2 px-3"})]})]})})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.