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

1 lines
5.4 KiB

import{r as a,I as _,o as T,B as m,a as w,c as D,l as n,w as B,h as L,L as x,m as i}from"./index-ea7eee8a.js";const C={__name:"user",setup(E){const p=L(),r=a(),u=a({list:[{type:"input",control:{modelValue:"",placeholder:"请输入登录名称"},config:{},name:"userName",item:{label:"登录名称"}},{type:"input",control:{modelValue:"",placeholder:"请输入昵称"},config:{},name:"nickName",item:{label:"昵称"}},{type:"input",control:{modelValue:"",placeholder:"请输入手机号码"},config:{},name:"phone",item:{label:"手机号"}},{type:"select",control:{modelValue:"",appendToBody:!0},options:[],config:{optionsType:2,optionsFun:"status"},name:"status",item:{label:"用户状态"}},{type:"select",control:{modelValue:[],appendToBody:!0},options:[],config:{optionsType:1,optionsFun:"roleList",method:"post",label:"name",value:"id"},name:"role",item:{label:"角色"}},{type:"button",control:{label:"查询",type:"primary",key:"submit"},config:{}},{type:"button",control:{label:"清空",key:"reset"},config:{}}],form:{size:"default"},config:{}}),f=a({columns:[{label:"多选",type:"selection"},{label:"序号",type:"index",width:"70px"},{label:"登录名称",prop:"userName"},{label:"昵称",prop:"nickName"},{label:"手机号码",prop:"phone"},{label:"角色",prop:"role"},{label:"状态",prop:"status",config:{dictKey:"status",tagList:{1:"success",0:"info"}}},{prop:"dateTime",label:"创建时间",config:{formatter:"{y}-{m}-{d} {h}:{i}:{s}"}},{label:"操作",prop:"__control"}],config:{openType:"dialog"},operateBtn:[{label:"编辑",key:"edit"},{label:"删除",key:"del"}],controlBtn:[{label:"新增",key:"add",type:"primary",size:"small",icon:"plus"},{label:"批量删除",key:"del",type:"danger",size:"small",icon:"delete"}],treeData:{show:!0,treeProps:{props:{label:"name"}},name:"department",method:"post",requestUrl:"deptList",afterResponse:"transformDataToChild"}}),d=a(),y=a({list:[{type:"input",control:{modelValue:"",placeholder:"请输入用户名称"},config:{},name:"userName",item:{label:"用户名称"},customRules:[{type:"required",message:"请输入用户名称",trigger:"blur"}]},{type:"input",control:{modelValue:"",placeholder:"请输入用户昵称"},config:{},name:"nickName",item:{label:"用户昵称"}},{type:"password",control:{modelValue:"",placeholder:"请输入登录密码"},config:{},name:"password",item:{label:"登录密码"},customRules:[{type:"required",message:"请输入登录密码",trigger:"blur"}]},{type:"password",control:{modelValue:"",placeholder:"请输入确认登录密码"},config:{},name:"password2",item:{label:"确认密码",rules:[{validator:(e,l,t)=>{const s=getuserFormValueByName("password");console.log(s),l===""?t(new Error("请输入密码")):l!==s?t(new Error("两次密码不一样")):t()},trigger:"change"}]},customRules:[{type:"required",message:"请输入确认密码",trigger:"blur"}]},{type:"input",control:{modelValue:"",placeholder:"请输入手机号码"},config:{},name:"phone",item:{label:"手机号码"},customRules:[{type:"mobile",message:"请输入手机号码",trigger:"blur"}]},{type:"treeSelect",control:{modelValue:"",data:[],renderAfterExpand:!1},config:{optionsType:1,optionsFun:"deptList",method:"post",afterResponse:"transformDataToChild"},name:"department",item:{label:"归属部门"}},{type:"select",control:{modelValue:"",appendToBody:!0},options:[],config:{optionsType:0},name:"post",item:{label:"岗位"}},{type:"radio",control:{modelValue:1},options:[],config:{optionsType:2,optionsFun:"status"},name:"status",item:{label:"状态"}},{type:"select",control:{modelValue:[],appendToBody:!0,multiple:!0},options:[],config:{optionsType:1,optionsFun:"roleList",method:"post",label:"name",value:"id",transformData:"string"},name:"role",item:{label:"角色"}},{type:"textarea",control:{modelValue:""},config:{span:24},name:"remark",item:{label:"备注"}},{type:"div",control:{},config:{span:24,textAlign:"center"},list:[{type:"button",control:{label:"确定",type:"primary",key:"submit"},config:{span:0}},{type:"button",control:{label:"取消",key:"reset"},config:{span:0}}]}],form:{size:"default",class:"form-row-2",labelWidth:"100px",name:"userForm"},config:{}}),o=_({visible:!1,title:"",formType:1,dict:{},editId:""}),b=(e,l)=>{if(e.key==="add"||e.key==="edit"){const t=x(l);o.visible=!0,o.title=e.key==="add"?"新增":"编辑",o.formType=e.key==="add"?1:2,o.editId=t&&t.id,e.key==="edit"&&m(()=>{console.log(t),typeof t.role=="string"?t.role=t.role.split(","):t.role=[],t.password2=t.password,d.value.setValue(t)})}},g=e=>(e.role&&(e.role=e.role.join(",")),o.formType===2&&(e.id=o.editId),delete e.password2,e),h=e=>{e==="success"&&(c(),r.value.getListData())},c=()=>{o.visible=!1,o.editId=""},k=e=>{e==="reset"&&c()};return T(()=>{p.query.role&&r.value.setSearchFormValue({role:parseInt(p.query.role)}),m(()=>{r.value.getListData()})}),(e,l)=>{const t=i("ak-list"),s=i("ak-form"),V=i("el-dialog");return w(),D("div",null,[n(t,{ref_key:"tableListEl",ref:r,requestUrl:"userList",deleteUrl:"userDelete",searchData:u.value,tableData:f.value,onBtnClick:b,autoLoad:!1},null,8,["searchData","tableData"]),n(V,{"destroy-on-close":"",modelValue:o.visible,"onUpdate:modelValue":l[0]||(l[0]=v=>o.visible=v),title:o.title,width:"600px"},{default:B(()=>[n(s,{ref_key:"formEl",ref:d,formData:y.value,dict:o.dict,type:o.formType,addUrl:"userSave",editUrl:"userEdit",beforeSubmit:g,afterSubmit:h,onBtnClick:k},null,8,["formData","dict","type"])]),_:1},8,["modelValue","title"])])}}};export{C as default};