import{D as h,U as p,G as i,A as f}from"./api.ssM5yC3w.js";import{I as w,W as n,F as b,s as y,am as o}from"./index.CL7yl-Wb.js";import{aH as g}from"./vue.D1BjjNmv.js";import{G as v}from"./api.lw1qFwrE.js";const C=function({crudExpose:c}){const u=g();let s=[];const d=async e=>{const t=await i(e);return t.data&&(s=t.data.results),t},m=async({form:e,row:t})=>(e.id=t.id,await p(e)),r=async({row:e})=>await h(e.tenant_id);return{crudOptions:{toolbar:{buttons:{search:{show:!1},refresh:{show:!1},compact:{show:!1},export:{text:"导出",type:"primary",size:"small",icon:"upload",circle:!1,display:!0,show:!1},columns:{show:!1}}},request:{pageRequest:d,addRequest:async({form:e})=>{try{if(s.find(l=>l.code===e.code))throw o("企业编码已存在，请使用其他编码"),new Error("企业编码重复");if(s.length===0){const l=await i({page:1,page_size:1e3,code:e.code});if(l.data&&l.data.length>0)throw o("企业编码已存在，请使用其他编码"),new Error("企业编码重复")}const a=await f(e);return a.data&&s.push(a.data),a}catch(t){throw t.message==="企业编码重复"||o("新增企业失败，请稍后重试"),t}},editRequest:m,delRequest:r},search:{col:{span:3},show:!0,autoSearch:!1,buttons:{search:{size:"small"},reset:{size:"small"}}},actionbar:{buttons:{add:{size:"small",show:!0}}},rowHandle:{fixed:"right",width:260,buttons:{view:{size:"small",text:"详细信息",iconRight:"View",type:"text",show:!0},viewContract:{size:"small",text:"查看合约",iconRight:"",type:"text",show:!0,click:async({row:e})=>{(await v({tenant_id:e.id,page:1,page_size:10})).data.forEach(a=>{console.log(a.tenant,e.tenant_id),a.tenant==e.tenant_id&&(console.log(a),u.push({path:"/system/contract/preview",query:{file:a.document_link,contractName:a.contract_name}}))})}},edit:{size:"small",type:"text",show:!0},remove:{iconRight:"Delete",size:"small",type:"text",show:!0,click:async e=>{try{await b.confirm(`确定要删除企业"${e.row.name}"吗？此操作不可撤销。`,"删除确认",{confirmButtonText:"确定删除",cancelButtonText:"取消",type:"warning",confirmButtonClass:"el-button--danger"}),await r(e),y("删除成功"),c.doRefresh()}catch(t){t!=="cancel"&&o("删除失败")}}}}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},code:{title:"企业编码",type:"input",search:{show:!0},form:{rules:[{required:!0,message:"企业编码必填"}],component:{placeholder:"请输入企业编码"}},column:{minWidth:120}},name:{title:"企业名称",search:{show:!0},type:"input",form:{rules:[{required:!0,message:"企业名称必填"}],component:{placeholder:"请输入企业名称"}},column:{minWidth:120}},company_size:{title:"企业规模",type:"dict-select",search:{show:!0},form:{component:{placeholder:"请选择企业规模"}},column:{minWidth:100},dict:n({data:[{value:1,label:"1-10人"},{value:2,label:"11-50人"},{value:3,label:"51-200人"},{value:4,label:"201-500人"},{value:5,label:"501-1000人"},{value:6,label:"1000人以上"}]})},company_address:{title:"企业地址",type:"input",search:{show:!1},form:{component:{placeholder:"请输入企业地点"}},column:{minWidth:120}},industry:{title:"行业",type:"dict-select",search:{show:!0},form:{component:{placeholder:"请选择行业"}},column:{minWidth:100},dict:n({data:[{value:1,label:"互联网/软件"},{value:2,label:"金融/保险"},{value:3,label:"制造业"},{value:4,label:"教育培训"},{value:5,label:"医疗健康"},{value:6,label:"房地产/建筑"},{value:7,label:"零售/电商"},{value:8,label:"餐饮/酒店"},{value:9,label:"物流/运输"},{value:10,label:"咨询服务"},{value:11,label:"媒体/广告"},{value:12,label:"能源/化工"},{value:13,label:"政府机构"},{value:14,label:"非营利组织"},{value:15,label:"其他"}]})},status:{title:"状态",search:{show:!0},type:"dict-select",form:{component:{placeholder:"请选择状态"}},column:{minWidth:120},dict:n({data:[{value:1,label:"服务中"},{value:2,label:"试用中"},{value:0,label:"已停用"}]})},published_jobs_count:{title:"岗位数",type:"number",column:{minWidth:90},form:{component:{step:1,precision:0,min:0,max:w(({form:e})=>({1:10,2:50,3:200,4:500,5:1e3,6:999999})[e.company_size]??999999)},rules:[{required:!0,message:"岗位数必填"},{validator:(e,t,a,l)=>{if(t==null||t==="")return a();if(!Number.isInteger(t))return a(new Error("岗位数必须为整数"));a()}}]}},update_datetime:{title:"数据更新时间",type:"datetime",column:{minWidth:150},form:{show:!1}}}}}};export{C as createCrudOptions};
