import{r as s,H as m,K as w}from"./index.ad3efb29.js";import"./elementPlus.4833989a.js";import{B as f,U as a,S as r}from"./vue.adf17aba.js";import"./echarts.72dc8373.js";const o="/api/ad_manage/auth_manage/";function x(e){return s({url:o,method:"get",params:e})}function y(e){return s({url:o,method:"post",data:e})}function g(e){return s({url:o+e.id+"/",method:"put",data:e})}function b(e){return s({url:o+e+"/",method:"delete",data:{id:e}})}const D=function({crudExpose:e,context:n}){const{showDialog:u}=n,i=async t=>await x(t),l=async({form:t,row:h})=>(t.id=h.id,await g(t)),c=async({row:t})=>await b(t.id),d=async({form:t})=>await y(t);f("$hasPermissions");const{compute:p}=w();return{crudOptions:{table:{height:800},container:{fixedHeight:!1},actionbar:{show:!0,buttons:{add:{text:"xxx",show:!1},create:{text:"添加店铺",type:"primary",show:!0,click(){u("ad")}}}},search:{show:!1},toolbar:{buttons:{search:{show:!0},compact:{show:!1}}},request:{pageRequest:i,addRequest:d,editRequest:l,delRequest:c},rowHandle:{fixed:"right",width:80,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"text",text:null,show:!1},remove:{iconRight:"Delete",type:"text",text:null,show:!1},custom:{type:"text",text:"SP授权",disabled:p(t=>t.row.ad_auth===1&&t.row.sp_auth===1),click(t){u("sp",t.row)}}}},columns:{custom_shop_name:{title:"亚马逊店铺名称"},advertiser_id:{title:"店铺ID"},region:{title:"区域",type:"dict-select",dict:m({data:[{label:"北美洲",value:1},{label:"欧洲",value:2},{label:"亚洲",value:3}]})},country_code:{title:"站点"},type:{title:"店铺类型"},ad_auth:{title:"广告API授权",column:{cellRender(t){return t.value===1?a("span",{style:"color: green"},[r("已授权")]):a("span",{style:"color: red"},[r("未授权")])}}},sp_auth:{title:"SP-API授权",column:{cellRender(t){return t.value===1?a("span",{style:"color: green"},[r("已授权")]):a("span",{style:"color: red"},[r("未授权")])}}}}}}};export{D as createCrudOptions};
