| | |
| | | </div> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar"> |
| | | <input id="app-edit-search" class="layui-input search-input" type="text" placeholder="请输入公司名称" />  |
| | | <input id="app-edit-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="user-btn-add" class="layui-btn icon-btn"><i class="layui-icon"></i>添加</button> |
| | | <button id="user-btn-add" class="layui-btn icon-btn permissions" permissions="syscompany-edit"><i class="layui-icon"></i>添加</button> |
| | | </div> |
| | | |
| | | <!-- 数据表格 --> |
| | |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="company-table-bar"> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看详情</a> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">编辑</a> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del">删除</a> |
| | | <a class="layui-btn layui-btn-xs permissions" permissions="syscompany-edit" lay-event="edit">编辑</a> |
| | | <a class="layui-btn layui-btn-xs permissions" permissions="syscompany-del" lay-event="del">删除</a> |
| | | </script> |
| | | <!-- 表格状态列 --> |
| | | <script type="text/html" id="company-tpl-state"> |
| | | <input type="checkbox" lay-filter="company-tpl-state" value="{{d.id}}" lay-skin="switch" lay-text="正常|以停用" |
| | | <input type="checkbox" lay-filter="company-tpl-state" value="{{d.id}}" lay-skin="switch" lay-text="正常|已停用" |
| | | {{d.enabled==true?'checked':''}}/> |
| | | </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> |
| | | <div class="layui-input-block"> |
| | | <select id="tenantId" name="tenantId" placeholder="选择一个应用" > |
| | | <select id="tenantId" name="tenantId" placeholder="选择一个应用" lay-verify="required" required > |
| | | <option value="">-请选择-</option> |
| | | </select> |
| | | </div> |
| | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">选择组织</label> |
| | | <div class="layui-input-block"> |
| | | <select id="orgId" name="orgId" placeholder="选择一个应用" > |
| | | <select id="orgId" name="orgId" placeholder="选择一个应用" lay-verify="required" required > |
| | | <option value="">-请选择-</option> |
| | | </select> |
| | | </div> |
| | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">所在地区</label> |
| | | <div class="layui-input-block"> |
| | | <select id="sheng" name="companyArea" placeholder="省份" lay-filter="sheng"> |
| | | <input name="companyProvince" id="companyProvince" type="hidden" class="layui-input" maxlength="20"/> |
| | | <select id="sheng" placeholder="省份" lay-filter="sheng" ay-verify="required" required> |
| | | <option value="">-请选择-</option> |
| | | </select> |
| | | <select id="shi" name="companyArea" placeholder="城市" lay-filter="shi"> |
| | | <input name="companyCity" id="companyCity" type="hidden" class="layui-input" maxlength="20"/> |
| | | <select id="shi" placeholder="城市" lay-filter="shi" ay-verify="required" required> |
| | | <option value="">-请选择-</option> |
| | | </select> |
| | | <select id="xian" name="companyArea" placeholder="区县" > |
| | | <input name="companyArea" id="companyArea" type="hidden" class="layui-input" maxlength="20"/> |
| | | <select id="xian" placeholder="区县"lay-filter="xian" ay-verify="required" required> |
| | | <option value="">-请选择-</option> |
| | | </select> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="layui-form-item model-form-footer"> |
| | | <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button> |
| | | <button class="layui-btn" id="sure" lay-filter="user-form-submit" lay-submit>保存</button> |
| | | <button class="layui-btn permissions" permissions="syscompany-edit" id="sure" lay-filter="user-form-submit" lay-submit>保存</button> |
| | | </div> |
| | | </form> |
| | | </script> |
| | |
| | | }) |
| | | form.render(); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, 'Post'); |
| | | |
| | |
| | | page: true, |
| | | cols: [[ |
| | | { type: 'numbers' }, |
| | | { field: 'companyName', width: 180, sort: true, title: '公司名称' }, |
| | | { field: 'sheng', width: 200, sort: true, title: '省' }, |
| | | { field: 'shi', width: 180, sort: true, title: '市' }, |
| | | { field: 'xian', width: 300, sort: true, title: '区县' }, |
| | | { field: 'companyTel', width: 250, align: 'center', sort: true, title: '联系方式' }, |
| | | { field: 'tenantId', width: 250, align: 'center', sort: true, title: '应用' }, |
| | | { field: 'enabled', width: 250, align: 'center', templet: '#company-tpl-state', sort: true, title: '状态' }, |
| | | { field: 'createTime', width: 250, sort: true, title: '时间', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy年MM月dd日 HH:mm:ss')}}</div>" }, |
| | | { field: 'id', width: 250, align: 'center', toolbar: '#company-table-bar', sort: true, title: '操作' }, |
| | | ]] |
| | | { field: 'companyName', width: 180, title: '公司名称' }, |
| | | { field: 'companyProvince', width: 200, title: '省' }, |
| | | { field: 'companyCity', width: 180, title: '市' }, |
| | | { field: 'companyArea', width: 300, title: '区县' }, |
| | | { field: 'companyTel', width: 250, align: 'center', title: '联系方式' }, |
| | | { field: 'tenantId', width: 250, align: 'center', title: '应用' }, |
| | | { field: 'enabled', width: 250, align: 'center', templet: '#company-tpl-state', title: '状态' }, |
| | | { field: 'createTime', width: 250, title: '时间', templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm')}}</div>" }, |
| | | { field: 'id', width: 250, align: 'center', toolbar: '#company-table-bar', title: '操作' }, |
| | | ]], |
| | | done:function(res){ |
| | | permissionsInput(res,config); |
| | | } |
| | | }); |
| | | |
| | | // 修改company状态 |
| | |
| | | }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.msg(data.msg, { icon: 1, time: 500 }); |
| | | //table.reload('table-user', {}); |
| | | layer.msg(data.msg, { icon: 1, time: 2000 }); |
| | | table.reload('table-user', {}); |
| | | } 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'); |
| | | } |
| | |
| | | * |
| | | */ |
| | | //获取省份 |
| | | var getSheng = function (obj, id) { |
| | | var sheng = {}; |
| | | var getSheng = function (obj, id, checkValue) { |
| | | admin.req('api-user/sysarea/getListByMap', { area_leveltype: obj }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 === data.code) { |
| | | let selected = false; |
| | | clientsAll = data.data; |
| | | sheng = data.data; |
| | | $.each(data.data, function (index, item) { |
| | | if (config.clientId === item.clientId) { |
| | | if (checkValue == item.areaName) { |
| | | selected = true; |
| | | } else { |
| | | selected = false; |
| | | } |
| | | //往下拉菜单里添加元素 |
| | | $('#' + id).append(new Option(item.areaName, item.id, false, selected)); |
| | | $('#' + id).append(new Option(item.areaName, item.id, true, selected)); |
| | | }) |
| | | form.render(); |
| | | form.render('select', id); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, 'GET'); |
| | | } |
| | | form.on('select(sheng)', function (data) { |
| | | $.each(sheng, function (index, item) { |
| | | if (data.value == item.id) { |
| | | $("#companyProvince").val(item.areaName); |
| | | } |
| | | }) |
| | | |
| | | //补充市的数据 |
| | | getShi_and_xian(data.value, "shi"); |
| | | }); |
| | | |
| | | form.on('select(shi)', function (data) { |
| | | $.each(shi_name, function (index, item) { |
| | | if (data.value == item.id) { |
| | | $("#companyCity").val(item.areaName); |
| | | } |
| | | }) |
| | | //补充县的数据 |
| | | getShi_and_xian(data.value, "xian"); |
| | | }); |
| | | |
| | | var getShi_and_xian = function (obj, id) { |
| | | form.on('select(xian)', function (data) { |
| | | $.each(xian_name, function (index, item) { |
| | | if (data.value == item.id) { |
| | | $("#companyArea").val(item.areaName); |
| | | } |
| | | }) |
| | | }); |
| | | var shi_name = {}; |
| | | var xian_name = {}; |
| | | var getShi_and_xian = function (obj, id, checkValue) { |
| | | admin.req('api-user/sysarea/getListByMap', { area_parent_id: obj }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 === data.code) { |
| | | let selected = false; |
| | | $('#' + id).empty(); |
| | | // |
| | | if (id == "shi") { |
| | | shi_name = data.data |
| | | $("#companyCity").val(shi_name[0].areaName); |
| | | } |
| | | if (id == "xian") { |
| | | xian_name = data.data |
| | | $("#companyArea").val(xian_name[0].areaName); |
| | | } |
| | | |
| | | $.each(data.data, function (index, item) { |
| | | if (config.clientId === item.clientId) { |
| | | if (checkValue === item.areaName) { |
| | | selected = true; |
| | | } else { |
| | | selected = false; |
| | |
| | | }) |
| | | form.render(); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, 'GET'); |
| | | } |
| | |
| | | }) |
| | | form.render(); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, 'GET'); |
| | | } |
| | |
| | | }) |
| | | form.render(); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, 'GET'); |
| | | } |
| | |
| | | admin.req('api-user/syscompany/' + obj.data.id, {}, 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 }); |
| | | table.reload('app-table', {}); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, 'delete'); |
| | | }); |
| | |
| | | //将组织填充 |
| | | getorganization(); |
| | | //将省份填充 |
| | | getSheng(1, "sheng"); |
| | | getSheng(1, "sheng", data.companyProvince); |
| | | // getSheng(2, "shi"); |
| | | // getSheng(3, "xian"); |
| | | //图片 |
| | |
| | | $('#sure').hide(); |
| | | } |
| | | form.val('app-form', data); |
| | | $('#sheng').val(data.shengId); |
| | | //将市填充 |
| | | var shengId = ""; |
| | | $.each(sheng, function (index, item) { |
| | | if (data.companyProvince === item.areaName) { |
| | | shengId = item.id; |
| | | } |
| | | }) |
| | | if (data.companyCity) { |
| | | getShi_and_xian(shengId, "shi", data.companyCity) |
| | | } |
| | | var shiId = ""; |
| | | |
| | | getShi_and_xian(data.shengId,"shi") |
| | | $('#shi').val(data.shiId); |
| | | |
| | | getShi_and_xian(data.shiId,"xian") |
| | | $('#xian').val(data.xianId); |
| | | |
| | | $.each(shi_name, function (index, item) { |
| | | if (data.companyCity === item.areaName) { |
| | | shiId = item.id; |
| | | } |
| | | }) |
| | | if (data.companyArea) { |
| | | getShi_and_xian(shiId, "xian", data.companyArea) |
| | | } |
| | | $('#app-form').attr('method', 'POST'); |
| | | } else { |
| | | |
| | |
| | | layer.closeAll(); |
| | | table.reload('app-table', {}); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, "POST"); |
| | | return false; |