123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- /** layuiAdmin.pro-v1.2.1 LPPL License By http://www.layui.com/admin/ */
- ;
- layui.define(["table", "form"],
- function(e) {
- var i = (layui.$, layui.admin),
- t = layui.view,
- l = layui.table,
- r = layui.form;
- l.render({
- elem: "#LAY-user-manage",
- url: "./json/useradmin/webuser.js",
- cols: [[{
- type: "checkbox",
- fixed: "left"
- },
- {
- field: "id",
- width: 100,
- title: "ID",
- sort: !0
- },
- {
- field: "username",
- title: "用户名",
- minWidth: 100
- },
- {
- field: "avatar",
- title: "头像",
- width: 100,
- templet: "#imgTpl"
- },
- {
- field: "phone",
- title: "手机"
- },
- {
- field: "email",
- title: "邮箱"
- },
- {
- field: "sex",
- width: 80,
- title: "性别"
- },
- {
- field: "ip",
- title: "IP"
- },
- {
- field: "jointime",
- title: "加入时间",
- sort: !0
- },
- {
- title: "操作",
- width: 150,
- align: "center",
- fixed: "right",
- toolbar: "#table-useradmin-webuser"
- }]],
- page: !0,
- limit: 30,
- height: "full-320",
- text: "对不起,加载出现异常!"
- }),
- l.on("tool(LAY-user-manage)",
- function(e) {
- var l = e.data;
- "del" === e.event ? layer.prompt({
- formType: 1,
- title: "敏感操作,请验证口令"
- },
- function(i, t) {
- layer.close(t),
- layer.confirm("真的删除行么",
- function(i) {
- e.del(),
- layer.close(i)
- })
- }) : "edit" === e.event && i.popup({
- title: "编辑用户",
- area: ["500px", "450px"],
- id: "LAY-popup-user-add",
- success: function(e, i) {
- t(this.id).render("user/user/userform", l).done(function() {
- r.render(null, "layuiadmin-form-useradmin"),
- r.on("submit(LAY-user-front-submit)",
- function(e) {
- e.field;
- layui.table.reload("LAY-user-manage"),
- layer.close(i)
- })
- })
- }
- })
- }),
- l.render({
- elem: "#LAY-user-back-manage",
- url: "./json/useradmin/mangadmin.js",
- cols: [[{
- type: "checkbox",
- fixed: "left"
- },
- {
- field: "id",
- width: 80,
- title: "ID",
- sort: !0
- },
- {
- field: "loginname",
- title: "登录名"
- },
- {
- field: "telphone",
- title: "手机"
- },
- {
- field: "email",
- title: "邮箱"
- },
- {
- field: "role",
- title: "角色"
- },
- {
- field: "jointime",
- title: "加入时间",
- sort: !0
- },
- {
- field: "check",
- title: "审核状态",
- templet: "#buttonTpl",
- minWidth: 80,
- align: "center"
- },
- {
- title: "操作",
- width: 150,
- align: "center",
- fixed: "right",
- toolbar: "#table-useradmin-admin"
- }]],
- text: "对不起,加载出现异常!"
- }),
- l.on("tool(LAY-user-back-manage)",
- function(e) {
- var l = e.data;
- "del" === e.event ? layer.prompt({
- formType: 1,
- title: "敏感操作,请验证口令"
- },
- function(i, t) {
- layer.close(t),
- layer.confirm("确定删除此管理员?",
- function(i) {
- console.log(e),
- e.del(),
- layer.close(i)
- })
- }) : "edit" === e.event && i.popup({
- title: "编辑管理员",
- area: ["420px", "450px"],
- id: "LAY-popup-user-add",
- success: function(e, i) {
- t(this.id).render("user/administrators/adminform", l).done(function() {
- r.render(null, "layuiadmin-form-admin"),
- r.on("submit(LAY-user-back-submit)",
- function(e) {
- e.field;
- layui.table.reload("LAY-user-back-manage"),
- layer.close(i)
- })
- })
- }
- })
- }),
- l.render({
- elem: "#LAY-user-back-role",
- // url: "./json/useradmin/role.js",
- url: "/login/getUser",
- cols: [[{
- type: "checkbox",
- fixed: "left"
- },
- {
- field: "id",
- width: 80,
- title: "ID",
- sort: !0
- },
- {
- field: "name",
- title: "名称"
- },
- {
- field: "username",
- title: "账号"
- },
- {
- field: "position",
- title: "拥有权限"
- },
- {
- title: "操作",
- width: 150,
- align: "center",
- fixed: "right",
- toolbar: "#table-useradmin-admin"
- }]],
- text: "对不起,加载出现异常!"
- }),
- l.on("tool(LAY-user-back-role)",
- function(e) {
- // console.log(e)
- var l = e.data;
- "del" === e.event ? layer.confirm("确定删除此角色?",
- function(i) {
- e.del(),
- console.log(e.data);
- layui.admin.req({
- url:'/login/delUser',
- type:'post',
- data:e.data,
- dataType:'json',
- traditional:true,
- done:function (err) {
- layer.close(i)
- }
- })
- // layer.close(i)
- }) : "edit" === e.event && i.popup({
- title: "编辑角色",
- area: ["500px", "480px"],
- id: "LAY-popup-user-add",
- success: function(e, i) {
- t(this.id).render("user/administrators/roleform", l).done(function() {
- r.render(null, "layuiadmin-form-role"),
- r.on("submit(LAY-user-role-submit)",
- function(e) {
- e.field;
- // console.log(e)//编辑角色传参
- layui.admin.req({
- url:'/login/updateUser',
- data:e.field,
- dataType:'json',
- traditional:true,
- type:'post',
- done:function (err) {
- // console.log(err)
- layui.table.reload("LAY-user-back-role"),
- layer.close(i)
- }
- })
- })
- })
- }
- })
- }),
- e("useradmin", {})
- });
|