Agriculture-front-end/dist/assets/index.01b22005.js

2 lines
16 KiB
JavaScript

import{G as e,u as l,r as a,I as t,ak as u,U as o,a2 as d,d as s,T as n,o as r,c as i,e as p,w as m,l as c,f,J as v,K as b,j as h,V as y,W as g,k as _,n as k,M as V,m as w,A as x,v as I}from"./index.e5c8b0d6.js";import{e as U,l as N,f as C,h as S,r as $,i as R,j as T,k as D}from"./user.cbff96c4.js";const q={class:"app-container"},K={class:"head-container"},P={class:"head-container"},M={class:"dialog-footer"},j=c("div",{class:"el-upload__text"},[k("将文件拖到此处,或"),c("em",null,"点击上传")],-1),z={class:"el-upload__tip text-center"},Y={class:"el-upload__tip"},B=c("span",null,"仅允许导入xls、xlsx格式文件。",-1),E={class:"dialog-footer"},O=e({name:"User"}),A=Object.assign(O,{setup(e){const O=l(),{proxy:A}=I(),{sys_normal_disable:F,sys_user_sex:G}=A.useDict("sys_normal_disable","sys_user_sex"),H=a([]),J=a(!1),L=a(!0),Q=a(!0),W=a([]),X=a(!0),Z=a(!0),ee=a(0),le=a(""),ae=a([]),te=a(""),ue=a(void 0),oe=a(void 0),de=a([]),se=a([]),ne=t({open:!1,title:"",isUploading:!1,updateSupport:0,headers:{Authorization:"Bearer "+u()},url:"http://36.134.44.75:6901/system/user/importData"}),re=a([{key:0,label:"用户编号",visible:!0},{key:1,label:"用户名称",visible:!0},{key:2,label:"用户昵称",visible:!0},{key:3,label:"部门",visible:!0},{key:4,label:"手机号码",visible:!0},{key:5,label:"状态",visible:!0},{key:6,label:"创建时间",visible:!0}]),ie=t({form:{},queryParams:{pageNum:1,pageSize:10,userName:void 0,phonenumber:void 0,status:void 0,deptId:void 0},rules:{userName:[{required:!0,message:"用户名称不能为空",trigger:"blur"},{min:2,max:20,message:"用户名称长度必须介于 2 和 20 之间",trigger:"blur"}],nickName:[{required:!0,message:"用户昵称不能为空",trigger:"blur"}],password:[{required:!0,message:"用户密码不能为空",trigger:"blur"},{min:5,max:20,message:"用户密码长度必须介于 5 和 20 之间",trigger:"blur"}],email:[{type:"email",message:"请输入正确的邮箱地址",trigger:["blur","change"]}],phonenumber:[{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:"请输入正确的手机号码",trigger:"blur"}]}}),{queryParams:pe,form:me,rules:ce}=o(ie),fe=(e,l)=>!e||-1!==l.label.indexOf(e);function ve(){L.value=!0,N(A.addDateRange(pe.value,ae.value)).then((e=>{L.value=!1,H.value=e.rows,ee.value=e.total}))}function be(e){pe.value.deptId=e.id,he()}function he(){pe.value.pageNum=1,ve()}function ye(){ae.value=[],A.resetForm("queryRef"),pe.value.deptId=void 0,A.$refs.tree.setCurrentKey(null),he()}function ge(e){const l=e.userId||W.value;A.$modal.confirm('是否确认删除用户编号为"'+l+'"的数据项?').then((function(){return C(l)})).then((()=>{ve(),A.$modal.msgSuccess("删除成功")})).catch((()=>{}))}function _e(){A.download("system/user/export",{...pe.value},`user_${(new Date).getTime()}.xlsx`)}function ke(e){W.value=e.map((e=>e.userId)),X.value=1!=e.length,Z.value=!e.length}function Ve(){ne.title="用户导入",ne.open=!0}function we(){A.download("system/user/importTemplate",{},`user_template_${(new Date).getTime()}.xlsx`)}d(te,(e=>{A.$refs.deptTreeRef.filter(e)}));const xe=(e,l,a)=>{ne.isUploading=!0},Ie=(e,l,a)=>{ne.open=!1,ne.isUploading=!1,A.$refs.uploadRef.handleRemove(l),A.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>"+e.msg+"</div>","导入结果",{dangerouslyUseHTMLString:!0}),ve()};function Ue(){A.$refs.uploadRef.submit()}function Ne(){me.value={userId:void 0,deptId:void 0,userName:void 0,nickName:void 0,password:void 0,phonenumber:void 0,email:void 0,sex:void 0,status:"0",remark:void 0,postIds:[],roleIds:[]},A.resetForm("userRef")}function Ce(){J.value=!1,Ne()}function Se(){Ne(),R().then((e=>{de.value=e.posts,se.value=e.roles,J.value=!0,le.value="添加用户",me.value.password=oe.value}))}function $e(e){Ne();const l=e.userId||W.value;R(l).then((e=>{me.value=e.data,de.value=e.posts,se.value=e.roles,me.value.postIds=e.postIds,me.value.roleIds=e.roleIds,J.value=!0,le.value="修改用户",me.password=""}))}function Re(){A.$refs.userRef.validate((e=>{e&&(null!=me.value.userId?T(me.value).then((e=>{A.$modal.msgSuccess("修改成功"),J.value=!1,ve()})):D(me.value).then((e=>{A.$modal.msgSuccess("新增成功"),J.value=!1,ve()})))}))}return U().then((e=>{ue.value=e.data})),ve(),(e,l)=>{const a=s("el-input"),t=s("el-tree"),u=s("el-col"),o=s("el-form-item"),d=s("el-option"),I=s("el-select"),U=s("el-date-picker"),N=s("el-button"),C=s("el-form"),R=s("right-toolbar"),T=s("el-row"),D=s("el-table-column"),W=s("el-switch"),oe=s("el-tooltip"),ie=s("el-table"),Ne=s("pagination"),Te=s("el-tree-select"),De=s("el-radio"),qe=s("el-radio-group"),Ke=s("el-dialog"),Pe=s("upload-filled"),Me=s("el-icon"),je=s("el-checkbox"),ze=s("el-link"),Ye=s("el-upload"),Be=n("hasPermi"),Ee=n("loading");return r(),i("div",q,[p(T,{gutter:20},{default:m((()=>[p(u,{span:4,xs:24},{default:m((()=>[c("div",K,[p(a,{modelValue:f(te),"onUpdate:modelValue":l[0]||(l[0]=e=>v(te)?te.value=e:null),placeholder:"请输入部门名称",clearable:"","prefix-icon":"Search",style:{"margin-bottom":"20px"}},null,8,["modelValue"])]),c("div",P,[p(t,{data:f(ue),props:{label:"label",children:"children"},"expand-on-click-node":!1,"filter-node-method":fe,ref:"deptTreeRef","node-key":"id","highlight-current":"","default-expand-all":"",onNodeClick:be},null,8,["data"])])])),_:1}),p(u,{span:20,xs:24},{default:m((()=>[b(p(C,{model:f(pe),ref:"queryRef",inline:!0,"label-width":"68px"},{default:m((()=>[p(o,{label:"用户名称",prop:"userName"},{default:m((()=>[p(a,{modelValue:f(pe).userName,"onUpdate:modelValue":l[1]||(l[1]=e=>f(pe).userName=e),placeholder:"请输入用户名称",clearable:"",style:{width:"240px"},onKeyup:h(he,["enter"])},null,8,["modelValue","onKeyup"])])),_:1}),p(o,{label:"手机号码",prop:"phonenumber"},{default:m((()=>[p(a,{modelValue:f(pe).phonenumber,"onUpdate:modelValue":l[2]||(l[2]=e=>f(pe).phonenumber=e),placeholder:"请输入手机号码",clearable:"",style:{width:"240px"},onKeyup:h(he,["enter"])},null,8,["modelValue","onKeyup"])])),_:1}),p(o,{label:"状态",prop:"status"},{default:m((()=>[p(I,{modelValue:f(pe).status,"onUpdate:modelValue":l[3]||(l[3]=e=>f(pe).status=e),placeholder:"用户状态",clearable:"",style:{width:"240px"}},{default:m((()=>[(r(!0),i(y,null,g(f(F),(e=>(r(),_(d,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1}),p(o,{label:"创建时间",style:{width:"308px"}},{default:m((()=>[p(U,{modelValue:f(ae),"onUpdate:modelValue":l[4]||(l[4]=e=>v(ae)?ae.value=e:null),"value-format":"YYYY-MM-DD",type:"daterange","range-separator":"-","start-placeholder":"开始日期","end-placeholder":"结束日期"},null,8,["modelValue"])])),_:1}),p(o,null,{default:m((()=>[p(N,{type:"primary",icon:"Search",onClick:he},{default:m((()=>[k("搜索")])),_:1}),p(N,{icon:"Refresh",onClick:ye},{default:m((()=>[k("重置")])),_:1})])),_:1})])),_:1},8,["model"]),[[V,f(Q)]]),p(T,{gutter:10,class:"mb8"},{default:m((()=>[p(u,{span:1.5},{default:m((()=>[b((r(),_(N,{type:"primary",plain:"",icon:"Plus",onClick:Se},{default:m((()=>[k("新增")])),_:1})),[[Be,["system:user:add"]]])])),_:1},8,["span"]),p(u,{span:1.5},{default:m((()=>[b((r(),_(N,{type:"success",plain:"",icon:"Edit",disabled:f(X),onClick:$e},{default:m((()=>[k("修改")])),_:1},8,["disabled"])),[[Be,["system:user:edit"]]])])),_:1},8,["span"]),p(u,{span:1.5},{default:m((()=>[b((r(),_(N,{type:"danger",plain:"",icon:"Delete",disabled:f(Z),onClick:ge},{default:m((()=>[k("删除")])),_:1},8,["disabled"])),[[Be,["system:user:remove"]]])])),_:1},8,["span"]),p(u,{span:1.5},{default:m((()=>[b((r(),_(N,{type:"info",plain:"",icon:"Upload",onClick:Ve},{default:m((()=>[k("导入")])),_:1})),[[Be,["system:user:import"]]])])),_:1},8,["span"]),p(u,{span:1.5},{default:m((()=>[b((r(),_(N,{type:"warning",plain:"",icon:"Download",onClick:_e},{default:m((()=>[k("导出")])),_:1})),[[Be,["system:user:export"]]])])),_:1},8,["span"]),p(R,{showSearch:f(Q),"onUpdate:showSearch":l[5]||(l[5]=e=>v(Q)?Q.value=e:null),onQueryTable:ve,columns:f(re)},null,8,["showSearch","columns"])])),_:1}),b((r(),_(ie,{data:f(H),onSelectionChange:ke},{default:m((()=>[p(D,{type:"selection",width:"50",align:"center"}),f(re)[0].visible?(r(),_(D,{label:"用户编号",align:"center",key:"userId",prop:"userId"})):w("",!0),f(re)[1].visible?(r(),_(D,{label:"用户名称",align:"center",key:"userName",prop:"userName","show-overflow-tooltip":!0})):w("",!0),f(re)[2].visible?(r(),_(D,{label:"用户昵称",align:"center",key:"nickName",prop:"nickName","show-overflow-tooltip":!0})):w("",!0),f(re)[3].visible?(r(),_(D,{label:"部门",align:"center",key:"deptName",prop:"dept.deptName","show-overflow-tooltip":!0})):w("",!0),f(re)[4].visible?(r(),_(D,{label:"手机号码",align:"center",key:"phonenumber",prop:"phonenumber",width:"120"})):w("",!0),f(re)[5].visible?(r(),_(D,{label:"状态",align:"center",key:"status"},{default:m((e=>[p(W,{modelValue:e.row.status,"onUpdate:modelValue":l=>e.row.status=l,"active-value":"0","inactive-value":"1",onChange:l=>function(e){let l="0"===e.status?"启用":"停用";A.$modal.confirm('确认要"'+l+'""'+e.userName+'"用户吗?').then((function(){return S(e.userId,e.status)})).then((()=>{A.$modal.msgSuccess(l+"成功")})).catch((function(){e.status="0"===e.status?"1":"0"}))}(e.row)},null,8,["modelValue","onUpdate:modelValue","onChange"])])),_:1})):w("",!0),f(re)[6].visible?(r(),_(D,{key:6,label:"创建时间",align:"center",prop:"createTime",width:"160"},{default:m((l=>[c("span",null,x(e.parseTime(l.row.createTime)),1)])),_:1})):w("",!0),p(D,{label:"操作",align:"center",width:"150","class-name":"small-padding fixed-width"},{default:m((e=>[1!==e.row.userId?(r(),_(oe,{key:0,content:"修改",placement:"top"},{default:m((()=>[b(p(N,{link:"",type:"primary",icon:"Edit",onClick:l=>$e(e.row)},null,8,["onClick"]),[[Be,["system:user:edit"]]])])),_:2},1024)):w("",!0),1!==e.row.userId?(r(),_(oe,{key:1,content:"删除",placement:"top"},{default:m((()=>[b(p(N,{link:"",type:"primary",icon:"Delete",onClick:l=>ge(e.row)},null,8,["onClick"]),[[Be,["system:user:remove"]]])])),_:2},1024)):w("",!0),1!==e.row.userId?(r(),_(oe,{key:2,content:"重置密码",placement:"top"},{default:m((()=>[b(p(N,{link:"",type:"primary",icon:"Key",onClick:l=>{return a=e.row,void A.$prompt('请输入"'+a.userName+'"的新密码',"提示",{confirmButtonText:"确定",cancelButtonText:"取消",closeOnClickModal:!1,inputPattern:/^.{5,20}$/,inputErrorMessage:"用户密码长度必须介于 5 和 20 之间"}).then((({value:e})=>{$(a.userId,e).then((l=>{A.$modal.msgSuccess("修改成功,新密码是:"+e)}))})).catch((()=>{}));var a}},null,8,["onClick"]),[[Be,["system:user:resetPwd"]]])])),_:2},1024)):w("",!0),1!==e.row.userId?(r(),_(oe,{key:3,content:"分配角色",placement:"top"},{default:m((()=>[b(p(N,{link:"",type:"primary",icon:"CircleCheck",onClick:l=>function(e){const l=e.userId;O.push("/system/user-auth/role/"+l)}(e.row)},null,8,["onClick"]),[[Be,["system:user:edit"]]])])),_:2},1024)):w("",!0)])),_:1})])),_:1},8,["data"])),[[Ee,f(L)]]),b(p(Ne,{total:f(ee),page:f(pe).pageNum,"onUpdate:page":l[6]||(l[6]=e=>f(pe).pageNum=e),limit:f(pe).pageSize,"onUpdate:limit":l[7]||(l[7]=e=>f(pe).pageSize=e),onPagination:ve},null,8,["total","page","limit"]),[[V,f(ee)>0]])])),_:1})])),_:1}),p(Ke,{title:f(le),modelValue:f(J),"onUpdate:modelValue":l[19]||(l[19]=e=>v(J)?J.value=e:null),width:"600px","append-to-body":""},{footer:m((()=>[c("div",M,[p(N,{type:"primary",onClick:Re},{default:m((()=>[k("确 定")])),_:1}),p(N,{onClick:Ce},{default:m((()=>[k("取 消")])),_:1})])])),default:m((()=>[p(C,{model:f(me),rules:f(ce),ref:"userRef","label-width":"80px"},{default:m((()=>[p(T,null,{default:m((()=>[p(u,{span:12},{default:m((()=>[p(o,{label:"用户昵称",prop:"nickName"},{default:m((()=>[p(a,{modelValue:f(me).nickName,"onUpdate:modelValue":l[8]||(l[8]=e=>f(me).nickName=e),placeholder:"请输入用户昵称",maxlength:"30"},null,8,["modelValue"])])),_:1})])),_:1}),p(u,{span:12},{default:m((()=>[p(o,{label:"归属部门",prop:"deptId"},{default:m((()=>[p(Te,{modelValue:f(me).deptId,"onUpdate:modelValue":l[9]||(l[9]=e=>f(me).deptId=e),data:f(ue),props:{value:"id",label:"label",children:"children"},"value-key":"id",placeholder:"请选择归属部门","check-strictly":""},null,8,["modelValue","data"])])),_:1})])),_:1})])),_:1}),p(T,null,{default:m((()=>[p(u,{span:12},{default:m((()=>[p(o,{label:"手机号码",prop:"phonenumber"},{default:m((()=>[p(a,{modelValue:f(me).phonenumber,"onUpdate:modelValue":l[10]||(l[10]=e=>f(me).phonenumber=e),placeholder:"请输入手机号码",maxlength:"11"},null,8,["modelValue"])])),_:1})])),_:1}),p(u,{span:12},{default:m((()=>[p(o,{label:"邮箱",prop:"email"},{default:m((()=>[p(a,{modelValue:f(me).email,"onUpdate:modelValue":l[11]||(l[11]=e=>f(me).email=e),placeholder:"请输入邮箱",maxlength:"50"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),p(T,null,{default:m((()=>[p(u,{span:12},{default:m((()=>[null==f(me).userId?(r(),_(o,{key:0,label:"用户名称",prop:"userName"},{default:m((()=>[p(a,{modelValue:f(me).userName,"onUpdate:modelValue":l[12]||(l[12]=e=>f(me).userName=e),placeholder:"请输入用户名称",maxlength:"30"},null,8,["modelValue"])])),_:1})):w("",!0)])),_:1}),p(u,{span:12},{default:m((()=>[null==f(me).userId?(r(),_(o,{key:0,label:"用户密码",prop:"password"},{default:m((()=>[p(a,{modelValue:f(me).password,"onUpdate:modelValue":l[13]||(l[13]=e=>f(me).password=e),placeholder:"请输入用户密码",type:"password",maxlength:"20","show-password":""},null,8,["modelValue"])])),_:1})):w("",!0)])),_:1})])),_:1}),p(T,null,{default:m((()=>[p(u,{span:12},{default:m((()=>[p(o,{label:"用户性别"},{default:m((()=>[p(I,{modelValue:f(me).sex,"onUpdate:modelValue":l[14]||(l[14]=e=>f(me).sex=e),placeholder:"请选择"},{default:m((()=>[(r(!0),i(y,null,g(f(G),(e=>(r(),_(d,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1})])),_:1}),p(u,{span:12},{default:m((()=>[p(o,{label:"状态"},{default:m((()=>[p(qe,{modelValue:f(me).status,"onUpdate:modelValue":l[15]||(l[15]=e=>f(me).status=e)},{default:m((()=>[(r(!0),i(y,null,g(f(F),(e=>(r(),_(De,{key:e.value,label:e.value},{default:m((()=>[k(x(e.label),1)])),_:2},1032,["label"])))),128))])),_:1},8,["modelValue"])])),_:1})])),_:1})])),_:1}),p(T,null,{default:m((()=>[p(u,{span:12},{default:m((()=>[p(o,{label:"岗位"},{default:m((()=>[p(I,{modelValue:f(me).postIds,"onUpdate:modelValue":l[16]||(l[16]=e=>f(me).postIds=e),multiple:"",placeholder:"请选择"},{default:m((()=>[(r(!0),i(y,null,g(f(de),(e=>(r(),_(d,{key:e.postId,label:e.postName,value:e.postId,disabled:1==e.status},null,8,["label","value","disabled"])))),128))])),_:1},8,["modelValue"])])),_:1})])),_:1}),p(u,{span:12},{default:m((()=>[p(o,{label:"角色"},{default:m((()=>[p(I,{modelValue:f(me).roleIds,"onUpdate:modelValue":l[17]||(l[17]=e=>f(me).roleIds=e),multiple:"",placeholder:"请选择"},{default:m((()=>[(r(!0),i(y,null,g(f(se),(e=>(r(),_(d,{key:e.roleId,label:e.roleName,value:e.roleId,disabled:1==e.status},null,8,["label","value","disabled"])))),128))])),_:1},8,["modelValue"])])),_:1})])),_:1})])),_:1}),p(T,null,{default:m((()=>[p(u,{span:24},{default:m((()=>[p(o,{label:"备注"},{default:m((()=>[p(a,{modelValue:f(me).remark,"onUpdate:modelValue":l[18]||(l[18]=e=>f(me).remark=e),type:"textarea",placeholder:"请输入内容"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1})])),_:1},8,["model","rules"])])),_:1},8,["title","modelValue"]),p(Ke,{title:f(ne).title,modelValue:f(ne).open,"onUpdate:modelValue":l[22]||(l[22]=e=>f(ne).open=e),width:"400px","append-to-body":""},{footer:m((()=>[c("div",E,[p(N,{type:"primary",onClick:Ue},{default:m((()=>[k("确 定")])),_:1}),p(N,{onClick:l[21]||(l[21]=e=>f(ne).open=!1)},{default:m((()=>[k("取 消")])),_:1})])])),default:m((()=>[p(Ye,{ref:"uploadRef",limit:1,accept:".xlsx, .xls",headers:f(ne).headers,action:f(ne).url+"?updateSupport="+f(ne).updateSupport,disabled:f(ne).isUploading,"on-progress":xe,"on-success":Ie,"auto-upload":!1,drag:""},{tip:m((()=>[c("div",z,[c("div",Y,[p(je,{modelValue:f(ne).updateSupport,"onUpdate:modelValue":l[20]||(l[20]=e=>f(ne).updateSupport=e)},null,8,["modelValue"]),k("是否更新已经存在的用户数据 ")]),B,p(ze,{type:"primary",underline:!1,style:{"font-size":"12px","vertical-align":"baseline"},onClick:we},{default:m((()=>[k("下载模板")])),_:1})])])),default:m((()=>[p(Me,{class:"el-icon--upload"},{default:m((()=>[p(Pe)])),_:1}),j])),_:1},8,["headers","action","disabled"])])),_:1},8,["title","modelValue"])])}}});export{A as default};