12 |
- import{E as e,m as a,n as l,k as t,l as i,I as s,v as o,r as n,C as r,A as c,B as d,o as p}from"../element-plus/element-plus.DqqeXZzT.js";import{d as u,j as m,Y as h,w as v,r as b,o as g,c as f,T as _,K as y,a as w,S as C,U as I,a9 as k,J as j,u as D,R as V,ba as B,b8 as x,L as S,Q as E,i as z,ah as R,M,a2 as T,ae as N}from"../@vue/@vue.lccsL1Mu.js";import{A as P}from"../api/api.BtQEnbVN.js";import{_ as U,h as A,g as F}from"../../assets/index-DYMYfyXS.js";import{t as K}from"../await-to-js/await-to-js.BuwTFY8y.js";import{M as O,h as L,a as J,c as Q}from"../staticTools/staticTools.BUMUrNJJ.js";import{c as Y}from"../vue-clipboard3/vue-clipboard3.CQOAoICA.js";import"../lodash-es/lodash-es.LxYfApIs.js";import"../async-validator/async-validator.DSgsWN2H.js";import"../@vueuse/@vueuse.D2YafqsA.js";import"../dayjs/dayjs.D4rZQhfm.js";import"../axios/axios.CUN3se9v.js";import"../@ctrl/@ctrl.D2oWfImC.js";import"../@popperjs/@popperjs.D3lHDW-0.js";import"../escape-html/escape-html.J6B7JOz4.js";import"../normalize-wheel-es/normalize-wheel-es.Erkn7R64.js";import"../vue-router/vue-router.D86bYXwF.js";import"../pinia/pinia.DodrAXQg.js";import"../vue-demi/vue-demi.Dq6ymT-8.js";import"../pinia-plugin-persist/pinia-plugin-persist.Cjrd7Wf_.js";import"../@element-plus/@element-plus.BWbqilIf.js";import"../echarts/echarts.C_nC9ACL.js";import"../tslib/tslib.DduEQve-.js";import"../zrender/zrender.XYf_pgl8.js";import"../clipboard/clipboard.D1vou_7m.js";const q={class:"content"},G={class:"form-item"},H={class:"item-label"},W={class:"form-item"},X=(e=>(B("data-v-577b2a1d"),e=e(),x(),e))((()=>w("span",{class:"item-label"},"媒体账户",-1))),Z={class:"footer"},$=V("取消"),ee=V("确定"),ae=U(u({__name:"batchEditDialog",props:{dialogVisible:{type:Boolean,default:()=>!1},batchEditIds:{type:Array,default:()=>[]}},emits:["confirm","cancel"],setup(s,{emit:o}){const n=s,r=m((()=>"批量修改媒体账户")),c=h({account_id:""});v((()=>n.dialogVisible),(e=>{e&&d()}));const d=async()=>{console.log("handleInitForm => "),S(),c.account_id=""},p=()=>{o("cancel")},u=async()=>{try{await V(),await B(),o("confirm")}catch(e){console.log(e)}},V=()=>new Promise(((a,l)=>{const{account_id:t}=c;""===t?(e.warning("请选择媒体账户"),l("校验未通过")):a("校验通过")})),B=async()=>{const a=P.miniprogram_appletBatchEdit,l={ap_ids:n.batchEditIds,account_id:c.account_id},[t,i]=await K(A.post(a,l));return t||"0"!==i?.errNo||!1===i?.rst?(e.error(t?.message||i?.errMsg||"操作失败"),Promise.reject()):!0===i?.rst?(e.success("修改成功"),Promise.resolve()):void 0},x=b([]),S=async()=>{const a=P.account_listToSelect,[l,t]=await K(A.get(a));if(l||"0"!==t?.errNo)return e.error(l?.message||t?.errMsg||"操作失败");x.value=[...t?.rst]};return(e,s)=>{const o=a,d=l,m=t,h=i;return g(),f("div",null,[_(h,{"model-value":n.dialogVisible,"before-close":p,"show-close":!0,title:D(r),width:"550px"},{default:y((()=>[w("div",q,[w("div",G,[w("span",H,"已选定"+C(n.batchEditIds.length)+"个小程序",1)]),w("div",W,[X,_(d,{modelValue:c.account_id,"onUpdate:modelValue":s[0]||(s[0]=e=>c.account_id=e),placeholder:"请选择媒体账户",clearable:"",filterable:!0},{default:y((()=>[(g(!0),f(I,null,k(x.value,(e=>(g(),j(o,{key:e.id,label:e.account_id,value:e.account_id},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])]),w("div",Z,[_(m,{onClick:p},{default:y((()=>[$])),_:1}),_(m,{type:"primary",onClick:u},{default:y((()=>[ee])),_:1})])])),_:1},8,["model-value","title"])])}}}),[["__scopeId","data-v-577b2a1d"]]),le=e=>(B("data-v-32bb25f7"),e=e(),x(),e),te={class:"content"},ie={class:"form-item"},se=le((()=>w("span",{class:"item-label"},"获取模板文件",-1))),oe=V("点击下载"),ne={class:"form-item"},re=le((()=>w("span",{class:"item-label",style:{"margin-top":"-10px"}},"导入文件",-1))),ce=V("点击上传"),de=le((()=>w("span",{class:"tips"},"只能上传xlsx文件",-1))),pe={class:"footer"},ue=V("取消"),me=V("确定"),he=U(u({__name:"batchImportDialog",props:{dialogVisible:{type:Boolean,default:()=>!1}},emits:["confirm","cancel"],setup(a,{emit:l}){const n=a,r=m((()=>"批量导入小程序")),c=b(!1);h({file:""});const d=b(P.miniprogram_appletImport),p=b({admin_id:F("admin_id"),ttl:Number(F("ttl")),sign:F("sign")}),u=b(),C=b([]),I=()=>{u.value.clearFiles()},k=e=>{I(),u.value.handleStart(e[0])},j=(a,t,i)=>{c.value=!1,"0"===a.errNo&&!0===a.rst?(e.success("导入成功"),I(),l("confirm")):e.error("上传失败,请检查文件模板")},V=a=>{c.value=!1,e.error("上传失败,请检查文件模板")};v((()=>n.dialogVisible),(e=>{e&&B()}));const B=async()=>{console.log("handleInitForm => ")},x=()=>{I(),l("cancel")},E=async()=>{try{await z(),c.value=!0,u.value.submit()}catch(e){console.log(e)}},z=()=>new Promise(((a,l)=>{C.value.length?a("校验通过"):(e.warning("请选择导入文件"),l("校验未通过"))})),R=()=>{window.open(O,"_blank")};return(e,a)=>{const l=t,m=s,h=i,v=o;return g(),f("div",null,[_(h,{"model-value":n.dialogVisible,"before-close":x,"show-close":!0,title:D(r),width:"550px"},{default:y((()=>[S((g(),f("div",null,[w("div",te,[w("div",ie,[se,_(l,{type:"primary",onClick:R},{default:y((()=>[oe])),_:1})]),w("div",ne,[re,_(m,{ref_key:"uploadRef",ref:u,class:"upload-wrap",action:d.value,data:p.value,name:"file",limit:1,"auto-upload":!1,accept:".xlsx","on-success":j,"on-error":V,"on-exceed":k,"file-list":C.value,"onUpdate:file-list":a[0]||(a[0]=e=>C.value=e)},{default:y((()=>[_(l,{type:"primary"},{default:y((()=>[ce])),_:1}),de])),_:1},8,["action","data","file-list"])])]),w("div",pe,[_(l,{onClick:x,disabled:c.value},{default:y((()=>[ue])),_:1},8,["disabled"]),_(l,{type:"primary",onClick:E,disabled:c.value},{default:y((()=>[me])),_:1},8,["disabled"])])])),[[v,c.value]])])),_:1},8,["model-value","title"])])}}}),[["__scopeId","data-v-32bb25f7"]]),ve={class:"content"},be={key:0,class:"form-item"},ge={class:"item-tips"},fe=(e=>(B("data-v-7d265683"),e=e(),x(),e))((()=>w("div",{class:"form-item"},[w("span",{class:"item-tips"},"删除操作将自动解除广告与小程序之间的关联,不影响已有广告中的小程序设置, 确认删除?")],-1))),_e={class:"footer"},ye=V("取消"),we=V("确定"),Ce=U(u({__name:"batchDeleteDialog",props:{dialogVisible:{type:Boolean,default:()=>!1},batchDeleteIds:{type:Array,default:()=>[]}},emits:["confirm","cancel"],setup(a,{emit:l}){const s=a,o=m((()=>"提示"));v((()=>s.dialogVisible),(e=>{e&&n()}));const n=async()=>{},r=()=>{l("cancel")},c=async()=>{try{await d(),await p(),l("confirm")}catch(e){console.log(e)}},d=()=>new Promise(((e,a)=>{e("校验通过")})),p=async()=>{const a=P.miniprogram_appletBatchDel,l={ap_ids:s.batchDeleteIds},[t,i]=await K(A.post(a,l));return t||"0"!==i?.errNo||!1===i?.rst?(e.error(t?.message||i?.errMsg||"操作失败"),Promise.reject()):!0===i?.rst?(e.success("删除成功"),Promise.resolve()):void 0};return(e,a)=>{const l=t,n=i;return g(),f("div",null,[_(n,{"model-value":s.dialogVisible,"before-close":r,"show-close":!0,title:D(o),width:"550px"},{default:y((()=>[w("div",ve,[s.batchDeleteIds.length>1?(g(),f("div",be,[w("span",ge,"已选定"+C(s.batchDeleteIds.length)+"个小程序",1)])):E("",!0),fe]),w("div",_e,[_(l,{onClick:r},{default:y((()=>[ye])),_:1}),_(l,{type:"primary",onClick:c},{default:y((()=>[we])),_:1})])])),_:1},8,["model-value","title"])])}}}),[["__scopeId","data-v-7d265683"]]);const Ie=e=>(B("data-v-d81469ac"),e=e(),x(),e),ke={class:"filter-wrap"},je={class:"filter-item"},De=Ie((()=>w("span",{class:"label"},"媒体账户:",-1))),Ve={class:"filter-item"},Be=Ie((()=>w("span",{class:"label"},"搜索:",-1))),xe={class:"filter-item"},Se=V("清空"),Ee={class:"page-wrap"},ze={class:"btns-wrap"},Re={class:"selected-text ml-10"},Me=V("已选择"),Te={class:"highlight"},Ne=V("条"),Pe=V("删除"),Ue={class:"applink-wrap"},Ae={class:"link"},Fe={class:"pagination-wrap"},Ke=U(u({__name:"index",setup(i){const s=h({batchImport:{label:"批量导入小程序",value:"batchImport"},options:[{label:"批量修改媒体账户",value:"batchEdit"},{label:"批量删除",value:"batchDelete"}]}),u=e=>e&&"batchImport"===e?me():e&&"batchEdit"===e?ce():e&&"batchDelete"===e?te():void 0,v=b(!1),B=h({accountIdOptions:[]}),x=h({list:[],total:0}),E=h({account_id:"",keyword:"",page:1,page_size:20}),U=async()=>{const a=P.miniprogram_appletList,l={account_id:E.account_id,keyword:E.keyword,page:E.page,page_size:E.page_size};v.value=!0;const[t,i]=await K(A.get(a,l));if(v.value=!1,t||"0"!==i?.errNo)return e.error(t?.message||i?.errMsg||"操作失败");x.list=[...i?.rst?.data],x.total=i?.rst?.pageInfo?.total},F=()=>{E.page=1,U()},O=e=>{E.page=e,U()},q=()=>{E.account_id="",E.keyword="",F()},{multipleTableRef:G,multipleSelection:H,isSelected:W,handleSelectionChange:X,handleClearSelection:Z,handleSetCurrentRowSelected:$}=function(){const e=b(),a=b([]),l=m((()=>!!a.value.length));return{multipleTableRef:e,multipleSelection:a,isSelected:l,handleSelectionChange:e=>{a.value=e},handleClearSelection:()=>{e.value.clearSelection()},handleSetCurrentRowSelected:a=>{e.value.toggleRowSelection(a,!0)}}}(),{batchDeleteDialogVisible:ee,currentBatchDeleteIds:le,handleBatchDelete:te,onClickDeleteRow:ie,onConfirmBatchDelete:se,onCancelBatchDelete:oe}=function(a,l,t,i,s){const o=b(!1),n=b([]),r=()=>{if(!a.value)return e.warning("请选择微信小程序");n.value=l.value.map((e=>e.id)),o.value=!0};return{batchDeleteDialogVisible:o,currentBatchDeleteIds:n,handleBatchDelete:r,onClickDeleteRow:e=>{t(),i(e),r()},onConfirmBatchDelete:()=>{o.value=!1,n.value=[],t(),s()},onCancelBatchDelete:()=>{o.value=!1,n.value=[]}}}(W,H,Z,$,q),{batchEditDialogVisible:ne,currentBatchEditIds:re,handleBatchEdit:ce,onConfirmBatchEdit:de,onCancelBatchEdit:pe}=function(a,l,t,i){const s=b(!1),o=b([]);return{batchEditDialogVisible:s,currentBatchEditIds:o,handleBatchEdit:()=>{if(!a.value)return e.warning("请选择微信小程序");o.value=l.value.map((e=>e.id)),s.value=!0},onConfirmBatchEdit:()=>{s.value=!1,o.value=[],t(),i()},onCancelBatchEdit:()=>{s.value=!1,o.value=[]}}}(W,H,Z,q),{batchImportDialogVisible:ue,handleBatchImport:me,onConfirmBatchImport:ve,onCancelBatchImport:be}=function(e,a){const l=b(!1);return{batchImportDialogVisible:l,handleBatchImport:()=>{l.value=!0},onConfirmBatchImport:()=>{l.value=!1,e(),a()},onCancelBatchImport:()=>{l.value=!1}}}(Z,q);return z((()=>{(async()=>{const a=P.account_listToSelect,[l,t]=await K(A.get(a));if(l||"0"!==t?.errNo)return e.error(l?.message||t?.errMsg||"操作失败");B.accountIdOptions=[...t?.rst]})(),U()})),(i,m)=>{const h=a,b=l,z=t,P=n,U=d,A=N("DocumentCopy"),Z=p,$=r,te=c,ce=o;return S((g(),f("div",null,[w("div",ke,[w("div",je,[De,_(b,{class:"w-200",modelValue:E.account_id,"onUpdate:modelValue":m[0]||(m[0]=e=>E.account_id=e),placeholder:"全部",filterable:"",clearable:"",onChange:F},{default:y((()=>[(g(!0),f(I,null,k(B.accountIdOptions,(e=>(g(),j(h,{key:e.id,label:e.account_id,value:e.account_id},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])]),w("div",Ve,[Be,_(P,{class:"w-200",modelValue:E.keyword,"onUpdate:modelValue":m[1]||(m[1]=e=>E.keyword=e),modelModifiers:{trim:!0},placeholder:"请输入",maxlength:"50",clearable:"",onKeyup:R(T(F,["prevent","stop"]),["enter","native"])},{append:y((()=>[_(z,{icon:"Search",onClick:F})])),_:1},8,["modelValue","onKeyup"])]),w("div",xe,[_(z,{type:"primary",size:"default",text:"",onClick:q},{default:y((()=>[Se])),_:1})])]),w("div",Ee,[w("div",ze,[_(z,{type:"primary",size:"default",onClick:m[2]||(m[2]=e=>u(s.batchImport.value))},{default:y((()=>[V(C(s.batchImport.label),1)])),_:1}),_(b,{class:"w-100 ml-10",placeholder:"批量操作",disabled:!D(W)},{default:y((()=>[(g(!0),f(I,null,k(s.options,(e=>(g(),j(h,{key:e.value,label:e.label,value:e.value,onClick:a=>u(e.value)},null,8,["label","value","onClick"])))),128))])),_:1},8,["disabled"]),S(w("div",Re,[Me,w("span",Te,C(D(H)?.length||0),1),Ne],512),[[M,D(W)]])]),_($,{ref_key:"multipleTableRef",ref:G,"row-key":"id",data:x.list,border:"","header-row-style":D(L),"header-cell-style":D(J),"cell-style":D(Q),onSelectionChange:D(X)},{default:y((()=>[_(U,{align:"center",type:"selection","reserve-selection":"",width:"55",fixed:"left"}),_(U,{align:"center",prop:"appname",label:"小程序名称","min-width":"100"}),_(U,{align:"center",label:"操作","min-width":"100"},{default:y((({row:e})=>[_(z,{type:"primary",size:"small",text:"",onClick:a=>D(ie)(e)},{default:y((()=>[Pe])),_:2},1032,["onClick"])])),_:1}),_(U,{align:"center",prop:"appid",label:"小程序ID","min-width":"100"}),_(U,{align:"center",prop:"applink",label:"小程序链接","min-width":"200"},{default:y((({row:a})=>[w("div",Ue,[w("div",Ae,C(a.applink),1),_(Z,{class:"icon",onClick:l=>(async a=>{if(!a)return!1;const{toClipboard:l}=Y(),[t]=await K(l(a));if(t)return e.error("复制失败,请重试");e.success("复制成功")})(a.applink)},{default:y((()=>[_(A)])),_:2},1032,["onClick"])])])),_:1}),_(U,{align:"center",prop:"remarks",label:"备注","min-width":"100"}),_(U,{align:"center",prop:"account_id",label:"媒体账户","min-width":"100"}),_(U,{align:"center",prop:"username",label:"创建人员","min-width":"100"}),_(U,{align:"center",prop:"created_at",label:"创建时间","min-width":"150"})])),_:1},8,["data","header-row-style","header-cell-style","cell-style","onSelectionChange"]),w("div",Fe,[_(te,{"current-page":E.page,"onUpdate:current-page":m[3]||(m[3]=e=>E.page=e),"page-size":E.page_size,"onUpdate:page-size":m[4]||(m[4]=e=>E.page_size=e),total:x.total,background:"",layout:"total, prev, pager, next",onCurrentChange:O},null,8,["current-page","page-size","total"])])]),_(ae,{dialogVisible:D(ne),batchEditIds:D(re),onConfirm:D(de),onCancel:D(pe)},null,8,["dialogVisible","batchEditIds","onConfirm","onCancel"]),_(Ce,{dialogVisible:D(ee),batchDeleteIds:D(le),onConfirm:D(se),onCancel:D(oe)},null,8,["dialogVisible","batchDeleteIds","onConfirm","onCancel"]),_(he,{dialogVisible:D(ue),onConfirm:D(ve),onCancel:D(be)},null,8,["dialogVisible","onConfirm","onCancel"])])),[[ce,v.value]])}}}),[["__scopeId","data-v-d81469ac"]]);export{Ke as default};
|