1 |
- import{W as p,B as g,C as m,s as f}from"./index.DJRppC5x.js";import{G as y,B as w,c as b,D as v,U as x,A as R,d as q}from"./api.C3bqGSnk.js";import{a as d}from"./authFunction.B20B8nzx.js";import{S as s,P as c,aj as h}from"./vue.D1BjjNmv.js";const C=function({crudExpose:i,context:l}){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:async e=>await q(e),addRequest:async({form:e})=>await R(e),editRequest:async({form:e,row:t})=>(e.id=t.id,await x(e)),delRequest:async({row:e})=>await v(e.id)},pagination:{show:!0},search:{show:!0,autoSearch:!1,buttons:{search:{size:"small",col:{span:3}},reset:{size:"small",col:{span:3}}}},actionbar:{buttons:{add:{size:"small",show:d("role:Create"),click:()=>{l.router.push("/position/create")}},batchBindTags:{text:"批量绑定标签",type:"primary",size:"small",show:!1,order:2,click:()=>{const e=l.selectedRows||[];if(console.log("选中的行:",e),!e||e.length===0){m("请先选择要操作的职位");return}console.log("context",l),l.openBatchTagsDialog(e)}},batchPublish:{text:"批量修改状态",type:"primary",size:"small",show:!0,order:3,click:()=>{const e=l.selectedRows||[];if(console.log("选中的行:",e),!e||e.length===0){m("请先选择要操作的职位");return}l.openBatchStatusDialog(e)}}}},rowHandle:{fixed:"right",width:320,buttons:{view:{show:!1,iconRight:"View",type:"text"},edit:{text:"查看",show:d("role:Update"),iconRight:"Edit",type:"text",click:e=>{l.router.push(`/position/detail?id=${e.row.id}`)}},remove:{show:d("role:Delete"),iconRight:"Delete",type:"text"},qrcode:{text:"分享",type:"text",iconRight:"Share",click:e=>{l.generateQRCode(e.row)},order:4},publish:{text:"发布",type:"text",iconRight:"",show:g(({row:e})=>e.status===0),click:e=>{l.publishPosition(e.row)}}}},form:{col:{span:24},labelWidth:"100px",wrapper:{is:"el-dialog",width:"600px"}},table:{remove:{confirmMessage:"确定要删除这个职位吗?删除后无法恢复!"},onSelectionChange:e=>{l.selectedRows=e,console.log("选择变化:",e)}},columns:{_selection:{title:"选择",form:{show:!1},column:{type:"selection",align:"center",width:50,fixed:"left",columnSetDisabled:!0}},id:{title:"ID",column:{show:!1},search:{show:!1},form:{show:!1}},title:{title:"职位名称",search:{show:!0,size:"small",col:{span:3}},column:{minWidth:120,sortable:"custom"},form:{rules:[{required:!0,message:"角色名称必填"}],component:{placeholder:"请输入角色名称"}}},job_type:{title:"职位类型",search:{show:!0,size:"small",col:{span:3}},type:"dict-select",column:{width:100},dict:p({data:[{value:0,label:"全职"},{value:1,label:"兼职"},{value:2,label:"实习"},{value:3,label:"其他"}]}),form:{rules:[{required:!0,message:"职位类型必填"}],component:{placeholder:"职位类型"}}},competency_tags:{title:"胜任力标签",search:{show:!0,size:"small",col:{span:3},component:{props:{multiple:!1,filterable:!0}}},type:"dict-select",column:{show:!1,minWidth:180,component:{name:"fs-component",render:({row:e})=>{if(!e.competency_tags||e.competency_tags.length===0)return s("span",null,[c("-")]);const t=e.competency_tags.slice(0,2),u=e.competency_tags.length-2;return s("div",{style:"display: flex; gap: 4px; align-items: center;"},[t.map(a=>s(h("el-tag"),{key:a.id,type:"warning",effect:"plain",size:"mini",style:"overflow: hidden; text-overflow: ellipsis; white-space: nowrap;",title:a.name},{default:()=>[a.name.length>4?a.name.slice(0,4)+"...":a.name]})),u>0&&s(h("el-tooltip"),{placement:"top",effect:"light","popper-class":"tag-tooltip"},{default:()=>s(h("el-tag"),{type:"info",effect:"plain",size:"mini"},{default:()=>[c("+"),u]}),content:()=>s("div",null,[s("div",{style:"font-weight: bold; margin-bottom: 5px"},[c("剩余"),u,c("个标签:")]),e.competency_tags.slice(2).map(a=>s("div",{key:a.id,style:"margin: 3px 0"},[a.name]))])})])}}},dict:p({getData:async()=>(await y({page:1,limit:30,tenant_id:1})).data.items,label:"name",value:"id"}),form:{rules:[{required:!0,message:"胜任力标签必填"}]}},salary_range:{title:"薪资范围",search:{show:!1,size:"small",col:{span:3}},column:{minWidth:100},form:{rules:[{required:!0,message:"薪资范围必填"}],component:{placeholder:"请输入薪资范围"}}},location:{title:"工作地点",search:{type:"input",show:!0,size:"small",col:{span:3}},column:{minWidth:120,formatter:({row:e})=>{if(typeof e.location=="string"&&e.location.startsWith("["))try{return JSON.parse(e.location.replace(/'/g,'"')).join(" ")}catch(t){return console.error("解析location失败:",t),e.location}return Array.isArray(e.location)?e.location.join(" "):e.province&&e.city?e.province+" "+e.city+(e.district?" "+e.district:""):e.location||""}},form:{component:{name:"el-input",props:{options:[{value:"上海市",label:"上海市",children:[{value:"浦东新区",label:"浦东新区",children:[{value:"张江",label:"张江"},{value:"金桥",label:"金桥"},{value:"陆家嘴",label:"陆家嘴"}]},{value:"徐汇区",label:"徐汇区",children:[{value:"漕河泾",label:"漕河泾"},{value:"徐家汇",label:"徐家汇"}]}]},{value:"北京市",label:"北京市",children:[{value:"海淀区",label:"海淀区",children:[{value:"中关村",label:"中关村"},{value:"上地",label:"上地"}]},{value:"朝阳区",label:"朝阳区",children:[{value:"CBD",label:"CBD"},{value:"望京",label:"望京"}]}]}],props:{expandTrigger:"hover",checkStrictly:!1},placeholder:"请选择工作地点",clearable:!0,showAllLevels:!0},on:{change:e=>{console.log("地址选择变化:",e)}}},valueResolve:e=>{e.location&&Array.isArray(e.location)&&e.location.length>0&&(e.province=e.location[0],e.city=e.location[1]||"",e.district=e.location[2]||"",e.location=e.location.join(" "))},valueBuilder:e=>{if(e.province&&e.city)e.location=[e.province,e.city],e.district&&e.location.push(e.district);else if(typeof e.location=="string"&&e.location){const t=e.location.split(" ");t.length>0&&(e.location=t)}}}},department:{title:"所属部门",search:{show:!1,size:"small",col:{span:3}},column:{minWidth:100},form:{rules:[{required:!0,message:"所属部门必填"}],component:{placeholder:"请输入所属部门"}}},status:{title:"状态",search:{show:!0,size:"small",col:{span:3}},type:"dict-select",column:{minWidth:100},dict:p({data:[{value:0,label:"未发布"},{value:1,label:"已发布"},{value:2,label:"已过期"}]}),form:{rules:[{required:!0,message:"职位类型必填"}]}},end_date:{title:"截止日期",type:"datetime",search:{show:!0,size:"small",col:{span:3}},column:{show:!1,minWidth:150,sortable:"custom"},form:{rules:[{required:!0,message:"截止日期必填"}],component:{type:"datetime",valueFormat:"YYYY-MM-DD HH:mm:ss",placeholder:"请选择截止日期"}}},requirements:{title:"职位要求",search:{show:!1,size:"small",col:{span:3}},column:{show:!1,showOverflowTooltip:!0,width:120,sortable:"custom",formatter:({row:e})=>{const t=document.createElement("div");return t.innerHTML=e.requirements||"",t.textContent||t.innerText||""}},form:{component:{type:"textarea",rows:4}}},description:{title:"职位描述",search:{show:!1},column:{show:!1,showOverflowTooltip:!0,width:120,sortable:"custom",formatter:({row:e})=>{const t=document.createElement("div");return t.innerHTML=e.description||"",t.textContent||t.innerText||""}},form:{component:{type:"textarea",rows:4}}},province:{title:"省份",column:{show:!1},form:{show:!1}},city:{title:"城市",column:{show:!1},form:{show:!1}},district:{title:"区域",column:{show:!1},form:{show:!1}}}}}},S=i=>({batchUpdateTags:async(n,r)=>{try{(await w({position_ids:n,tag_ids:r,tenant_id:1})).code===2e3&&(f("批量更新标签成功"),i.doRefresh())}catch(o){console.error("批量更新标签失败",o)}}}),W=i=>({batchUpdateStatus:async(n,r)=>{try{(await b({job_ids:n,status:r,tenant_id:1})).code===2e3&&(f("批量修改状态成功"),i.doRefresh())}catch(o){console.error("批量修改状态失败",o)}}});export{C as createCrudOptions,W as useBatchUpdateStatus,S as useBatchUpdateTags};
|