数通互联化工云平台
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
6.1 KiB

4 months ago
import{a as n,f as i,q as r,d as T,ax as q,r as D,y as L,w as G,c as p,b as m,e as d,h as u,H as $,F as w,g as x,$ as M,I as J,a7 as f,aq as R,ap as Y,aj as Z,aG as z,S as K,ab as Q,ac as W,p as X,m as ee,_ as oe}from"./index-e450010e.js";import{c as le,d as te,s as ae}from"./index-a04a5857.js";import B from"./jiahaoyuan-5a7520a8.js";const ne={viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em"},se=r("path",{fill:"currentColor",d:"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"},null,-1),de=[se];function ie(_,S){return n(),i("svg",ne,[...de])}const re={name:"ep-minus",render:ie},ce=[{id:2,name:"行政组织"},{id:3,name:"分部"}],ue=[{id:1,name:"人力资源"}],A=_=>(X("data-v-4b648469"),_=_(),ee(),_),pe={class:"scrollbar-flex-content"},me={class:"form_box"},fe=["onClick"],_e={class:"scrollbar-demo-item wordecnters"},he=A(()=>r("div",{class:"word_box"},"此区域用于添加条件字段",-1)),ye={class:"form_box"},ge=["onClick"],be={class:"scrollbar-demo-items wordecnters"},Ve=A(()=>r("div",{class:"word_box"},"此区域用于添加取值字段",-1)),we={class:"dialog-footer"},xe=T({__name:"setupmatrixfield",props:{fieldShow:{type:Boolean,default:!1},matrixcont:{type:Object,default(){return{}}}},emits:["update:fieldShow"],setup(_,{emit:S}){const h=_,U=S,t=q({factor:[{id:0,name:"",types:2,condition:1,pinyin:"",isedit:!1,pyedit:!1}],outcome:[{id:0,name:"",types:1,condition:2,pinyin:"",isedit:!1,pyedit:!1}]}),N=D(!1),v=L({get:()=>h.fieldShow,set:l=>{U("update:fieldShow",l)}});function k(){U("update:fieldShow",!1),P()}function P(){t.factor.splice(0,t.factor.length),t.outcome.splice(0,t.outcome.length),V(1),V(2)}function V(l){l==1?t.factor.push({id:0,name:"",types:2,condition:1,pinyin:"",isedit:!0,pyedit:!1}):t.outcome.push({id:0,name:"",types:1,condition:2,pinyin:"",isedit:!0,pyedit:!1})}function I(l){te({name:l.name}).then(a=>{a.data!=""?l.pinyin=a.data:l.pinyin=l.name})}G(()=>h.fieldShow,()=>{h.fieldShow&&le({id:h.matrixcont.id}).then(({data:l})=>{l.factor&&l.factor.length>0&&(t.factor.splice(0,t.factor.length),t.factor=l.factor),l.outcome&&l.outcome.length>0&&(t.outcome.splice(0,t.outcome.length),t.outcome=l.outcome)})});function O(){if(t.factor.length<1)return f({showClose:!0,message:"矩阵条件字段不能为空!",type:"error"}),!1;if(t.outcome.length<1)return f({showClose:!0,message:"矩阵取值字段不能为空!",type:"error"}),!1;let l=new Array,a=new Array,y=!1;if(t.factor.forEach(s=>{l.push(s.pinyin),a.push(s.name),(s.pinyin==""||s.name=="")&&(y=!0)}),y)return f({showClose:!0,message:"矩阵条件字段有未填写的项目!",type:"error"}),!1;let g=!1;if(t.outcome.forEach(s=>{l.push(s.pinyin),a.push(s.name),(s.pinyin==""||s.name=="")&&(g=!0)}),g)return f({showClose:!0,message:"矩阵取值字段有未填写的项目!",type:"error"}),!1;let c=Array.from(new Set(l));if(Array.from(new Set(a)).length!=a.length)return f({showClose:!0,message:"矩阵字段有重复的名称!",type:"error"}),!1;if(c.length!=l.length)return f({showClose:!0,message:"矩阵字段有重复的拼音!",type:"error"}),!1;ae({id:h.matrixcont.id,factor:t.factor,outcome:t.outcome}).then(s=>{f.success("编辑成功"),k()})}function E(l,a){a==1?t.factor.splice(l,1):t.outcome.splice(l,1)}return(l,a)=>{const y=R,g=Y,c=Z,C=re,s=z,j=K,F=Q,H=W;return n(),p(H,{modelValue:u(v),"onUpdate:modelValue":a[2]||(a[2]=e=>J(v)?v.value=e:null),"custom-class":"dialog_box",title:"设置矩阵字段","before-close":k,width:"50%"},{footer:m(()=>[r("div",we,[d(F,{type:"primary",loading:u(N),onClick:O},{default:m(()=>[$("确 定")]),_:1},8,["loading"]),d(F,{onClick:k},{default:m(()=>[$("取 消")]),_:1})])]),default:m(()=>[d(j,null,{default:m(()=>[r("div",pe,[(n(!0),i(w,null,x(u(t).factor,(e,b)=>(n(),i("div",{key:b,class:"scrollbar-demo-item"},[r("div",me,[d(g,{modelValue:e.types,"onUpdate:modelValue":o=>e.types=o,clearable:"",placeholder:"用工关系",disabled:e.pyedit},{default:m(()=>[(n(!0),i(w,null,x(u(ce),o=>(n(),p(y,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])