| | |
| | | </div> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar"> |
| | | <input id="orgName-search" class="layui-input search-input" type="text" placeholder="请输入名称" />  |
| | | <button id="app-btn-search" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button> |
| | | <button id="organization-add" class="layui-btn icon-btn"><i class="layui-icon"></i>添加</button> |
| | | <input id="orgName-search" class="layui-input search-input" type="text" placeholder="按名称" />  |
| | | <button id="app-btn-search" class="layui-btn icon-btn permissions" permissions="sysorganization-list"><i class="layui-icon"></i>搜索</button> |
| | | <!-- <button id="organization-add" class="layui-btn icon-btn permissions" permissions="sysorganization-edit"><i class="layui-icon"></i>添加</button> --> |
| | | </div> |
| | | |
| | | <!-- 数据表格 --> |
| | |
| | | |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="organization-table-bar"> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> |
| | | <!-- <a class="layui-btn layui-btn-primary layui-btn-xs permissions" permissions="sysorganization-edit" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs permissions" permissions="sysorganization-del" lay-event="del">删除</a> --> |
| | | </script> |
| | | |
| | | <!-- 表格状态列 --> |
| | |
| | | |
| | | <!-- 表单弹窗 --> |
| | | <script type="text/html" id="app-model"> |
| | | <form id="app-form" lay-filter="app-form" class="layui-form model-form"> |
| | | <form id="app-form" lay-filter="app-form" class="layui-form model-form" autocomplete="off"> |
| | | <input name="id" type="hidden"/> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">请选择:</label> |
| | |
| | | page: false, |
| | | cols: [[ |
| | | { type: 'numbers' }, |
| | | { field: 'orgName', align: 'right', title: '组织名称' }, |
| | | { field: 'orgName', minWidth: 200, title: '组织名称' }, |
| | | { |
| | | field: 'orgAttr', align: 'right', title: '所属类型', templet: function (d) { |
| | | //节点属性(集团/公司/部门等,取值0,1,2,3,4) |
| | | if (d.orgAttr == 0) { |
| | | return "集团"; |
| | | } else if (d.orgAttr == 1) { |
| | | return "公司"; |
| | | return "公司/医院"; |
| | | } else if (d.orgAttr == 2) { |
| | | return "部门"; |
| | | return "部门/科室"; |
| | | } else { |
| | | return "子部门/子科室"; |
| | | } |
| | | } |
| | | }, |
| | | { field: 'enabled', align: 'right', sort: true, templet: '#organization-tpl-state', title: '状态' }, |
| | | { toolbar: '#organization-table-bar', align: 'right', align: 'center', title: '操作' } |
| | | ]] |
| | | // { field: 'enabled', align: 'right', sort: true, templet: '#organization-tpl-state', title: '状态' }, |
| | | // { toolbar: '#organization-table-bar', align: 'right', align: 'center', title: '操作' } |
| | | ]], |
| | | done: function (res) { |
| | | permissionsInput(res,config); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | |
| | | if (layEvent === 'edit') { // 查看详情 |
| | | showEditModel(data); |
| | | } else if (layEvent === 'del') { |
| | | layer.confirm('确定删除此菜单吗?', function () { |
| | | layer.confirm('确定删除此组织吗?', function () { |
| | | layer.load(2); |
| | | let tenantId = $('#menu_clients').val(); |
| | | admin.req('api-user/sysorganization/' + obj.data.id + '?tenantId=' + tenantId, {}, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 === data.code) { |
| | | layer.msg(data.msg, { icon: 1, time: 500 }); |
| | | layer.msg(data.msg, { icon: 1, time: 2000 }); |
| | | renderTable({ tenantId: tenantId }); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, 'DELETE'); |
| | | }); |
| | |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | |
| | | layer.msg(data.msg, { icon: 1, time: 500 }); |
| | | layer.msg(data.msg, { icon: 1, time: 2000 }); |
| | | renderTable({ access_token: config.clientId, is_del: 0 }); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | $(obj.elem).prop('checked', !obj.elem.checked); |
| | | form.render('checkbox'); |
| | | } |
| | | }, 'GET'); |
| | | }); |
| | | // 添加按钮点击事件 |
| | | $('#organization-add').click(function () { |
| | | // 添加按钮点击事件 |
| | | $('#organization-add').click(function () { |
| | | showEditModel(); |
| | | }); |
| | | // 表单提交事件 |
| | |
| | | admin.req('api-user/sysorganization', JSON.stringify(data.field), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | // layer.msg(data.msg, { icon: 1, time: 500 }); |
| | | // layer.msg(data.msg, { icon: 1, time: 2000 }); |
| | | layer.closeAll(); |
| | | // treetable.reload('organization-table', {}); |
| | | renderTable({ access_token: config.clientId, is_del: 0 }); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, "POST"); |
| | | return false; |
| | |
| | | } |
| | | }); |
| | | if (keyword !== '' && searchCount === 0) { |
| | | layer.msg("没有匹配结果", { icon: 5, time: 500 }); |
| | | layer.msg("没有匹配结果", { icon: 5, time: 2000 }); |
| | | } else { |
| | | treetable.expandAll('#organization-table'); |
| | | } |
| | |
| | | { name: '标签邮件', id: 13 }] |
| | | }]; |
| | | if (0 === data.code) { |
| | | console.log(JSON.stringify(data.data)) |
| | | tree({ |
| | | elem: "#orgParentId-tree", |
| | | nodes: data.data, |
| | |
| | | //将数据赋值 |
| | | $("#orgParentId").val(node.id) |
| | | $("#orgParentName").val(node.name) |
| | | $("#orgLevel").val(node.level+1) |
| | | $("#orgLevel").val(node.level + 1) |
| | | form.render('select'); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, 'get'); |
| | | } |