import{E as M,S as N,s as D}from"./index.CL7yl-Wb.js";import{e as O,j as R}from"./api.RkBqaXeZ.js";import{a as $,r as u,_ as F,q as G,aj as s,J as v,o as _,K as l,S as o,b as f,c as I,R as J,a9 as K,P as p}from"./vue.D1BjjNmv.js";import{_ as P}from"./_plugin-vue_export-helper.DlAUqK2U.js";const Q={class:"weight-input"},z={style:{"margin-top":"10px"}},A=$({__name:"BatchCompetencyTagsDialog",props:{crudExpose:{type:Object,required:!0}},setup(h,{expose:w}){const k=h,i=u(!1),g=u([]),y=u([]),d=F({competency_tags:[]}),b=async()=>{var a;try{const e=await O({page:1,limit:50});e.code===2e3&&((a=e.data)!=null&&a.items)&&(y.value=e.data.items)}catch(e){console.error("获取胜任力标签列表失败:",e)}},x=async a=>{g.value=a.map(e=>e.id),await b(),i.value=!0},C=()=>{d.competency_tags.push({id:void 0,weight:100,importance:1,remark:""})},U=a=>{d.competency_tags.splice(a,1)},B=async()=>{if(d.competency_tags.some(a=>!a.id)){M.warning("请选择胜任力标签");return}try{const a=d.competency_tags.map(m=>({...m,weight:m.weight}));(await R({question_ids:g.value,competency_tags:a,tenant_id:N.get("tenant_id")})).code===2e3&&(D("批量更新胜任力标签成功"),i.value=!1,k.crudExpose.doRefresh(),d.competency_tags=[])}catch(a){console.error("批量更新胜任力标签失败",a)}};return G(()=>{b()}),w({open:x}),(a,e)=>{const m=s("el-option"),T=s("el-select"),c=s("el-table-column"),V=s("el-input-number"),E=s("el-input"),r=s("el-button"),S=s("el-table"),j=s("el-form-item"),q=s("el-form"),L=s("el-dialog");return _(),v(L,{modelValue:i.value,"onUpdate:modelValue":e[1]||(e[1]=t=>i.value=t),title:"批量绑定胜任力标签",width:"60%"},{footer:l(()=>[o(r,{onClick:e[0]||(e[0]=t=>i.value=!1)},{default:l(()=>e[5]||(e[5]=[p("取消")])),_:1}),o(r,{type:"primary",onClick:B},{default:l(()=>e[6]||(e[6]=[p("确定")])),_:1})]),default:l(()=>[o(q,{model:d,"label-width":"120px"},{default:l(()=>[o(j,{label:"胜任力标签"},{default:l(()=>[o(S,{data:d.competency_tags,border:"",style:{width:"100%"}},{default:l(()=>[o(c,{label:"标签",width:"200"},{default:l(({row:t})=>[o(T,{modelValue:t.id,"onUpdate:modelValue":n=>t.id=n,filterable:"",placeholder:"请选择胜任力标签",style:{width:"100%"}},{default:l(()=>[(_(!0),I(J,null,K(y.value,n=>(_(),v(m,{key:n.id,label:n.name,value:n.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1}),o(c,{label:"权重",width:"100"},{default:l(({row:t})=>[f("div",Q,[o(V,{modelValue:t.weight,"onUpdate:modelValue":n=>t.weight=n,min:0,max:100,step:1,precision:0,controls:!1,style:{width:"calc(100% - 20px)"}},null,8,["modelValue","onUpdate:modelValue"]),e[2]||(e[2]=f("span",{class:"percent-sign"},"%",-1))])]),_:1}),o(c,{label:"重要性",width:"100"},{default:l(({row:t})=>[o(V,{modelValue:t.importance,"onUpdate:modelValue":n=>t.importance=n,min:1,controls:!1,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),o(c,{label:"备注"},{default:l(({row:t})=>[o(E,{modelValue:t.remark,"onUpdate:modelValue":n=>t.remark=n,placeholder:"请输入备注"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),o(c,{label:"操作",width:"80",fixed:"right"},{default:l(({$index:t})=>[o(r,{type:"danger",link:"",onClick:n=>U(t)},{default:l(()=>e[3]||(e[3]=[p("删除")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"]),f("div",z,[o(r,{type:"primary",onClick:C},{default:l(()=>e[4]||(e[4]=[p("添加标签")])),_:1})])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}}),Z=P(A,[["__scopeId","data-v-e81fee30"]]);export{Z as default};
