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
9.2KB

  1. import{C as Y,B as Z,r as f,a5 as I,o as ee,D as le,c as g,e as i,G as _,i as o,g as U,h as a,f as b,F as v,H as V,t as te,j as M,u as w,q as ae}from"./index.69f54c6b.js";import{f as m}from"./expertStore.1ad40109.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([]),q=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}),P=()=>{if(c.value.length>=5){J.$message.warning("\u6700\u591A\u6DFB\u52A05\u4E2A\u89C4\u5219");return}c.value.push({})},H=e=>{c.value.splice(e,1)},D=f([]),A=f([]),k=f([]),N=f([]),B=f([]),T=async e=>{if(e==="technical_expertise"&&D.value.length===0){const l=await m({rootTagCodeList:[e]});D.value=x(l)[0].children}else if(e==="industry_sector"&&A.value.length===0){const l=await m({rootTagCodeList:[e]});A.value=x(l)[0].children}else if(e==="expert_source"&&k.value.length===0){const l=await m({rootTagCodeList:[e]});k.value=x(l)[0].children}else if(e==="good_at"&&N.value.length===0){const l=await m({rootTagCodeList:[e]});N.value=x(l)[0].children}else if(e==="other"&&B.value.length===0){const l=await m({rootTagCodeList:[e]});B.value=x(l)[0].children}},x=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=x(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=>({expertRegionCode:l[1].split("##")[0],expertRegionLevel: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,"\u62BD\u53D6\u4FE1\u606F")],-1)])),default:o(()=>[a(R,{gutter:20},{default:o(()=>[a(r,{span:24},{default:o(()=>[a(d,{label:"\u62BD\u53D6\u89C4\u5219"},{default:o(()=>[(i(!0),b(v,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,"\u89C4\u5219"+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(" \u5220\u9664\u89C4\u5219 ")])),_:2},1032,["disabled","onClick"])])]),default:o(()=>[a(R,{class:"mt-8",gutter:10},{default:o(()=>[a(r,{span:8},{default:o(()=>[a(d,{label:"\u9080\u8BF7\u6570\u91CF","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:"\u8BF7\u8F93\u5165",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:"\u5176\u4ED6\u6807\u7B7E","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:"\u8BF7\u9009\u62E9"},{default:o(()=>[(i(!0),b(v,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:"\u4E13\u5BB6\u7EA7\u522B","label-width":100},{default:o(()=>[a(E,{modelValue:u.expertRegionList,"onUpdate:modelValue":t=>u.expertRegionList=t,clearable:"",options:S.value,placeholder:"\u8BF7\u9009\u62E9",class:"w-full",props:q.value},null,8,["modelValue","onUpdate:modelValue","options","props"])]),_:2},1024)]),_:2},1024),a(r,{span:8},{default:o(()=>[a(d,{label:"\u5185\u5916\u56F4","label-width":100},{default:o(()=>[a(L,{modelValue:u.expertType,"onUpdate:modelValue":t=>u.expertType=t,placeholder:"\u8BF7\u9009\u62E9",class:"w-full",clearable:""},{default:o(()=>[(i(!0),b(v,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:"\u5C65\u804C\u610F\u5411","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:"\u4E13\u5BB6\u6765\u6E90","label-width":100},{default:o(()=>[a(L,{modelValue:u.expertSource,"onUpdate:modelValue":t=>u.expertSource=t,class:"w-full",placeholder:"\u8BF7\u9009\u62E9",clearable:""},{default:o(()=>[(i(!0),b(v,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:"\u804C\u79F0\u7EA7\u522B","label-width":100},{default:o(()=>[a(L,{modelValue:u.professionalLevel,"onUpdate:modelValue":t=>u.professionalLevel=t,class:"w-full",placeholder:"\u8BF7\u9009\u62E9",clearable:""},{default:o(()=>[(i(!0),b(v,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:"\u64C5\u957F\u65B9\u5411","label-width":100},{default:o(()=>[a(L,{modelValue:u.goodAt,"onUpdate:modelValue":t=>u.goodAt=t,class:"w-full",placeholder:"\u8BF7\u9009\u62E9",clearable:""},{default:o(()=>[(i(!0),b(v,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:"\u6280\u672F\u4E13\u957F","label-width":100},{default:o(()=>[a(E,{modelValue:u.technicalExpertise,"onUpdate:modelValue":t=>u.technicalExpertise=t,options:D.value,placeholder:"\u8BF7\u9009\u62E9",class:"w-full",clearable:""},null,8,["modelValue","onUpdate:modelValue","options"])]),_:2},1024)]),_:2},1024),a(r,{span:8},{default:o(()=>[a(d,{label:"\u884C\u4E1A\u9886\u57DF","label-width":100},{default:o(()=>[a(E,{modelValue:u.industrySector,"onUpdate:modelValue":t=>u.industrySector=t,options:A.value,placeholder:"\u8BF7\u9009\u62E9",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:P},{default:o(()=>l[2]||(l[2]=[M("\u6DFB\u52A0\u89C4\u5219 ")])),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}};export{se as default};