You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
8.9KB

  1. import{G as Y,E as Z,r as f,a6 as I,o as ee,V as le,b as g,c as i,L as _,h as o,e as U,f as a,d as v,F as x,H as V,t as te,i as M,u as w,s as ae}from"./index-dd5fae99.js";import{f as m}from"./expertStore-7d1ebc1f.js";const oe={class:"card-header flex justify-between"},se={__name:"ruleFormCom",props:{modelValue:{type:Array,default:[{count:"",otherTag:"",expertRegionList:[],expertType:"",intentionRegion:{},expertSource:"",professionalLevel:"",goodAt:"",technicalExpertise:"",industrySector:""}]},modelModifiers:{}},emits:["update:modelValue"],setup($,{expose:J}){const{dictList:y}=Y(Z.dictStore),S=f([]),P=f({multiple:!0}),{proxy:j}=ae(),c=I($,"modelValue");ee(async()=>{const e=await le({regionCode:330500,regionLevel:2}),l=[];l.push(e.data),S.value=G(l),await T("technical_expertise"),await T("industry_sector"),await T("expert_source"),await T("good_at"),await T("other")});const G=e=>e.map(n=>{const s={};if(s.value=n.unionCode,s.label=n.name,n.children&&n.children.length){s.children=n.children.map(r=>({value:r.unionCode,label:r.name}));const d=G(n.children);s.children=[...d]}return s}),q=()=>{if(c.value.length>=5){j.$message.warning("最多添加5个规则");return}c.value.push({})},H=e=>{c.value.splice(e,1)},A=f([]),D=f([]),k=f([]),N=f([]),B=f([]),T=async e=>{if(e==="technical_expertise"&&A.value.length===0){const l=await m({rootTagCodeList:[e]});A.value=b(l)[0].children}else if(e==="industry_sector"&&D.value.length===0){const l=await m({rootTagCodeList:[e]});D.value=b(l)[0].children}else if(e==="expert_source"&&k.value.length===0){const l=await m({rootTagCodeList:[e]});k.value=b(l)[0].children}else if(e==="good_at"&&N.value.length===0){const l=await m({rootTagCodeList:[e]});N.value=b(l)[0].children}else if(e==="other"&&B.value.length===0){const l=await m({rootTagCodeList:[e]});B.value=b(l)[0].children}},b=e=>e==null?void 0:e.map(n=>{const s={};if(s.value=n.parentCode+"##"+n.unionCode,s.label=n.tagName,n.children&&n.children.length){s.children=n.children.map(r=>({value:r.parentCode+"##"+r.unionCode,label:r.tagName}));const d=b(n.children);s.children=[...d]}return s});J({handleParmas:O});function O(){const e=c.value.map(l=>({inviteType:1,id:l.id||"",count:l.count,expertDicts:W(l),expertRegionList:z(l),...K(l),expertTags:Q(l),formEditJson:JSON.stringify(l)}));return console.log(e),e}function z(e){return e.expertRegionList&&Array.isArray(e.expertRegionList)&&e.expertRegionList.length>0?e.expertRegionList.map(l=>({regionCode:l[1].split("##")[0],regionLevel:l[1].split("##")[2]})):[]}function K(e){return e.intentionRegion&&Array.isArray(e.intentionRegion)&&e.intentionRegion.length>1?{intentionRegionCode:e.intentionRegion[1].split("##")[0],intentionRegionLevel:e.intentionRegion[1].split("##")[2]}:{}}function Q(e){const l=[];return e.otherTag&&l.push({tagType:"other",expertTag:"other",tagCodes:[e.otherTag.split("##")[2]]}),e.expertSource&&l.push({tagType:"other",expertTag:"expert_source",tagCodes:[e.expertSource.split("##")[2]]}),e.goodAt&&l.push({tagType:"good_at",expertTag:"good_at",tagCodes:[e.goodAt.split("##")[2]]}),e.industrySector&&Array.isArray(e.industrySector)&&e.industrySector.length>1&&l.push({tagGeneralType:"industry_sector",expertTag:"industry_sector",tagCodes:[e.industrySector[1].split("##")[2]]}),e.technicalExpertise&&Array.isArray(e.technicalExpertise)&&e.technicalExpertise.length>1&&(e.technicalExpertise.length===2?l.push({tagGeneralType:"technical_expertise",expertTag:"technical_expertise",tagCodes:[e.technicalExpertise[1].split("##")[2]]}):e.technicalExpertise.length===3&&l.push({tagGeneralType:"technical_expertise",expertTag:"technical_expertise",tagCodes:[e.technicalExpertise[2].split("##")[2]]})),l}function W(e){const l=[];return e.expertType&&l.push({expertDict:"expert_type",dictCodes:[e.expertType]}),e.professionalLevel&&l.push({expertDict:"title_level",dictCodes:[e.professionalLevel]}),l}function X(e){return[{required:!0,message:"",trigger:"blur",validator(l,n,s){c.value[e].count?s():s(new Error(""))}}]}return(e,l)=>{const n=g("el-button"),s=g("el-input-number"),d=g("el-form-item"),r=g("el-col"),R=g("el-row"),C=g("el-option"),L=g("el-select"),E=g("el-cascader"),F=g("el-card");return i(),_(F,{class:"mb-16",shadow:"never"},{header:o(()=>l[0]||(l[0]=[U("div",{class:"card-header"},[U("span",null,"抽取信息")],-1)])),default:o(()=>[a(R,{gutter:20},{default:o(()=>[a(r,{span:24},{default:o(()=>[a(d,{label:"抽取规则"},{default:o(()=>[(i(!0),v(x,null,V(c.value,(u,p)=>(i(),_(F,{key:p,class:"box-card w-full mb-8"},{header:o(()=>[U("div",oe,[U("span",null,"规则"+te(p+1),1),a(n,{type:"danger",plain:"",icon:"Delete",disabled:c.value.length===1,onClick:t=>H(p)},{default:o(()=>l[1]||(l[1]=[M(" 删除规则 ")])),_:2},1032,["disabled","onClick"])])]),default:o(()=>[a(R,{class:"mt-8",gutter:10},{default:o(()=>[a(r,{span:8},{default:o(()=>[a(d,{label:"邀请数量","label-width":100,prop:`randomRules${p}.count`,rules:X(p)},{default:o(()=>[a(s,{modelValue:c.value[p].count,"onUpdate:modelValue":t=>c.value[p].count=t,placeholder:"请输入",min:1,controls:!1,step:1,"step-strictly":""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop","rules"])]),_:2},1024)]),_:2},1024),a(R,{gutter:10,class:"mt-8"},{default:o(()=>[a(r,{span:8},{default:o(()=>[a(d,{label:"其他标签","label-width":100},{default:o(()=>[a(L,{modelValue:c.value[p].otherTag,"onUpdate:modelValue":t=>c.value[p].otherTag=t,class:"w-full",clearable:"",placeholder:"请选择"},{default:o(()=>[(i(!0),v(x,null,V(B.value,t=>(i(),_(C,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024),a(r,{span:8},{default:o(()=>[a(d,{label:"专家级别","label-width":100},{default:o(()=>[a(E,{modelValue:u.expertRegionList,"onUpdate:modelValue":t=>u.expertRegionList=t,clearable:"",options:S.value,placeholder:"请选择",class:"w-full",props:P.value},null,8,["modelValue","onUpdate:modelValue","options","props"])]),_:2},1024)]),_:2},1024),a(r,{span:8},{default:o(()=>[a(d,{label:"内外围","label-width":100},{default:o(()=>[a(L,{modelValue:u.expertType,"onUpdate:modelValue":t=>u.expertType=t,placeholder:"请选择",class:"w-full",clearable:""},{default:o(()=>[(i(!0),v(x,null,V(w(y)&&w(y).length&&w(y).find(t=>t.dictionaryName==="expert_type").dictionaryList,(t,h)=>(i(),_(C,{key:h,label:t.describe,value:t.dictionaryCode},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024)]),_:2},1024),a(R,{gutter:10,class:"mt-8"},{default:o(()=>[a(r,{span:8},{default:o(()=>[a(d,{label:"履职意向","label-width":100},{default:o(()=>[a(E,{modelValue:u.intentionRegion,"onUpdate:modelValue":t=>u.intentionRegion=t,options:S.value,class:"w-full",clearable:""},null,8,["modelValue","onUpdate:modelValue","options"])]),_:2},1024)]),_:2},1024),a(r,{span:8},{default:o(()=>[a(d,{label:"专家来源","label-width":100},{default:o(()=>[a(L,{modelValue:u.expertSource,"onUpdate:modelValue":t=>u.expertSource=t,class:"w-full",placeholder:"请选择",clearable:""},{default:o(()=>[(i(!0),v(x,null,V(k.value,(t,h)=>(i(),_(C,{key:h,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024),a(r,{span:8},{default:o(()=>[a(d,{label:"职称级别","label-width":100},{default:o(()=>[a(L,{modelValue:u.professionalLevel,"onUpdate:modelValue":t=>u.professionalLevel=t,class:"w-full",placeholder:"请选择",clearable:""},{default:o(()=>[(i(!0),v(x,null,V(w(y)&&w(y).length&&w(y).find(t=>t.dictionaryName==="title_level").dictionaryList,(t,h)=>(i(),_(C,{key:h,label:t.describe,value:t.dictionaryCode},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024)]),_:2},1024),a(R,{gutter:10,class:"mt-8"},{default:o(()=>[a(r,{span:8},{default:o(()=>[a(d,{label:"擅长方向","label-width":100},{default:o(()=>[a(L,{modelValue:u.goodAt,"onUpdate:modelValue":t=>u.goodAt=t,class:"w-full",placeholder:"请选择",clearable:""},{default:o(()=>[(i(!0),v(x,null,V(N.value,(t,h)=>(i(),_(C,{key:h,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024),a(r,{span:8},{default:o(()=>[a(d,{label:"技术专长","label-width":100},{default:o(()=>[a(E,{modelValue:u.technicalExpertise,"onUpdate:modelValue":t=>u.technicalExpertise=t,options:A.value,placeholder:"请选择",class:"w-full",clearable:""},null,8,["modelValue","onUpdate:modelValue","options"])]),_:2},1024)]),_:2},1024),a(r,{span:8},{default:o(()=>[a(d,{label:"行业领域","label-width":100},{default:o(()=>[a(E,{modelValue:u.industrySector,"onUpdate:modelValue":t=>u.industrySector=t,options:D.value,placeholder:"请选择",class:"w-full",clearable:""},null,8,["modelValue","onUpdate:modelValue","options"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128)),a(n,{class:"w-full",type:"primary",icon:"plus",plain:"",onClick:q},{default:o(()=>l[2]||(l[2]=[M("添加规则 ")])),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}};export{se as default};