import{r as s,W as y,a7 as l}from"./index.CL7yl-Wb.js";import{a as d}from"./authFunction.D75vbqds.js";import{r as v,t as x}from"./vue.D1BjjNmv.js";const u="/api/system/column/";function D(t){return s({url:u,method:"get",params:t})}function q(t){return s({url:u,method:"post",data:t})}function R(t){return s({url:u+t.id+"/",method:"put",data:t})}function S(t){return s({url:u+t+"/",method:"delete",data:{id:t}})}function M(t){return s({url:u+"multiple_delete/",method:"delete",data:{keys:t}})}function C(){return s({url:"/api/system/column/get_models/",method:"get"})}const _=function({crudExpose:t,props:O,modelDialog:m,selectOptions:i,allModelData:k}){const p=async e=>{if(i.value.id)return await D({menu:i.value.id})},f=async({form:e,row:r})=>(e.id=r.id,await R(e)),h=async({row:e})=>await S(e.id),g=async({form:e})=>(e.menu=i.value.id,await q(e)),n=v([]),b=e=>{const o=t.getTableData().filter(a=>!e.includes(a));l.arrayEach(e,a=>{l.pluck(n.value,"id").includes(a.id)||(n.value=l.union(n.value,[a]))}),l.arrayEach(o,a=>{n.value=l.remove(n.value,c=>c.id!==a.id)})},w=()=>{const e=t.getBaseTableRef(),r=t.getTableData(),o=l.filter(r,a=>l.pluck(n.value,"id").includes(a.id));x(()=>{l.arrayEach(o,a=>{e.toggleRowSelection(a,!0)})})};return{selectedRows:n,crudOptions:{request:{pageRequest:p,addRequest:g,editRequest:f,delRequest:h},pagination:{show:!1},actionbar:{buttons:{add:{show:!0},auto:{text:"自动匹配",type:"success",show:d("column:Match"),click:()=>m.value=!0}}},rowHandle:{fixed:"right",buttons:{view:{show:!1},edit:{show:d("column:Update")},remove:{show:d("column:Delete")}}},form:{col:{span:24},labelWidth:"110px",wrapper:{is:"el-dialog",width:"600px"}},table:{rowKey:"id",onSelectionChange:b,onRefreshed:()=>w()},columns:{$checked:{title:"选择",form:{show:!1},column:{type:"selection",align:"center",width:"70px",columnSetDisabled:!0}},_index:{title:"序号",form:{show:!1},column:{align:"center",width:"70px",columnSetDisabled:!0,formatter:e=>{let r=e.index??1,o=t.crudBinding.value.pagination;return((o.currentPage??1)-1)*o.pageSize+r+1}}},model:{title:"model",type:"dict-select",dict:y({url:"/api/system/column/get_models/",label:"title",value:"key"}),column:{sortable:!0},form:{rules:[{required:!0,message:"必填项"}],component:{span:12,showSearch:!0,filterable:!0,filterOption(e,r){return r.label.indexOf(e)>=0||r.value.indexOf(e)>=0}}}},title:{title:"中文名",sortable:"custom",search:{show:!0},type:"text",form:{rules:[{required:!0,message:"必填项"}],component:{span:12,placeholder:"请输入中文名"}}},field_name:{title:"字段名",type:"text",search:{show:!0},column:{sortable:!0},form:{rules:[{required:!0,message:"必填项"}],component:{span:12,placeholder:"请输入字段名"}}}}}}},P=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:_},Symbol.toStringTag,{value:"Module"}));export{M as B,P as a,_ as c,C as g};
