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