| | |
| | | <div class="layui-card"> |
| | | <div class="layui-card-header"> |
| | | <h2 class="header-title">合作商客户对接信息表</h2> |
| | | <h2 class="header-title">合作商客户对接管理</h2> |
| | | <span class="layui-breadcrumb pull-right"> |
| | | <a href="#!console">首页</a> |
| | | <a><cite>合作商客户对接信息表</cite></a> |
| | | <a href="#!console">首页</a> |
| | | <a><cite>合作商客户对接管理</cite></a> |
| | | </span> |
| | | </div> |
| | | |
| | |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar"> |
| | | 搜索: |
| | | <input id="partnerDockingInfo-edit-value" class="layui-input search-input" type="text" placeholder="输入关键字"/>  |
| | | <button id="partnerDockingInfo-btn-search" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button> |
| | | <button id="partnerDockingInfo-btn-add" class="layui-btn icon-btn"><i class="layui-icon"></i>添加</button> |
| | | <input id="partnerName-search" class="layui-input search-input" type="text" placeholder="按合作商名称" />  |
| | | <input id="hospitalName-search" class="layui-input search-input" type="text" placeholder="按医院名称" />  |
| | | <button id="partnerDockingInfo-btn-search" class="layui-btn icon-btn permissions" |
| | | permissions="partnerDockingInfo-list"><i class="layui-icon"></i>搜索</button> |
| | | <button id="partnerDockingInfo-btn-add" class="layui-btn icon-btn permissions" |
| | | permissions="partnerDockingInfo-edit"><i class="layui-icon"></i>添加</button> |
| | | </div> |
| | | |
| | | <!-- 数据表格 --> |
| | | <table class="layui-table" id="partnerDockingInfo-table" lay-filter="partnerDockingInfo-table"></table> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="partnerDockingInfo-table-bar"> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs permissions" permissions="partnerDockingInfo-edit" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs permissions" permissions="partnerDockingInfo-del" lay-event="del">删除</a> |
| | | <a class="layui-btn layui-btn-xs permissions" permissions="partnerDockingInfo-download" lay-event="download">下载数据库脚本</a> |
| | | |
| | | </script> |
| | | <!-- 表格状态列 --> |
| | | <script type="text/html" id="partnerDockingInfo-status"> |
| | | <input type="checkbox" lay-filter="partnerDockingInfo-status" value="{{d.id}}" lay-skin="switch" lay-text="启用|暂停" |
| | | {{d.dockingStatus==1?'checked':''}} class="permissions" permissions="partnerDockingInfo-status"/> |
| | | </script> |
| | | |
| | | <!-- 新增/修改表单弹窗 --> |
| | | <script type="text/html" id="partnerDockingInfo-model"> |
| | | <form id="partnerDockingInfo-form" lay-filter="partnerDockingInfo-form" class="layui-form model-form"> |
| | | <input name="id" type="hidden"/> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" style="width: 100px;">合作商名称</label> |
| | | <div class="layui-input-inline" style="width: 200px;"> |
| | | <!-- <input name="partnerName" id="partnerName" placeholder="请输入合作商名称" lay-verify="required" required |
| | | type="text" class="layui-input" maxlength="100" style="width: 200px;"/> --> |
| | | <select id="partnerId" name="partnerId" lay-filter="partnerId" placeholder="请选择合作商" |
| | | lay-verify="required" required > |
| | | <option value="">-请选择合作商-</option> |
| | | </select> |
| | | <input type="hidden" name="partnerName" id="partnerName"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" style="width: 100px;">医院名称</label> |
| | | <div class="layui-input-block" style="width: 250px;"> |
| | | <input name="hospitalName" id="hospitalName" placeholder="请输入医院名称"lay-verify="required" required |
| | | type="text" class="layui-input" maxlength="100" style="width: 200px;"/> |
| | | <input type="hidden" name="hospitalId" id="hospitalId"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" style="width: 100px;">科室</label> |
| | | <div class="layui-input-inline" style="width: 200px;"> |
| | | <select id="departmentId" name="departmentId" lay-filter="departmentId" placeholder="请选择科室" |
| | | lay-verify="required" required > |
| | | <option value="">-请选择科室-</option> |
| | | </select> |
| | | <input name="departmentName" id="departmentName" type="hidden" /> |
| | | </div> |
| | | </div> |
| | | <!-- 对接类型,默认为1:影像版API--> |
| | | <!-- <input name="dockingType" id="partnerType" type="hidden" value="1" /> --> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" style="width: 100px;">对接类型</label> |
| | | <div class="layui-input-inline"style="width: 200px;"> |
| | | <input name="dockingTypeName" id="partnerTypeName" type="hidden" value="1" /> |
| | | <select name="dockingType" id="partnerType" lay-filter="dockingType" |
| | | style="width: 50px;"> |
| | | <option value="">请选择</option> |
| | | <option value="1" selected>影像版API</option> |
| | | <option value="2">妇幼版API</option> |
| | | |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" style="width:100px" >对接系统版本</label> |
| | | <div class="layui-input-block" style="width:250px;"> |
| | | <input name="dockingVersion" lay-verify="required" required type="text" class="layui-input" maxlength="30" style="width: 200px;"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" style="width:100px" >服务器机器码</label> |
| | | <div class="layui-input-block" style="width:250px;"> |
| | | <input name="serverMachineCode" type="text" class="layui-input" maxlength="100" style="width: 200px;"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" style="width: 100px;">安装人</label> |
| | | <div class="layui-input-block" style="width: 250px;"> |
| | | <input name="operationName" lay-verify="required" required type="text" class="layui-input" maxlength="30"style="width: 200px;"/> |
| | | </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="partnerDockingInfo-form-submit" permissions=" |
| | | partnerDocking-edit" lay-submit>保存 |
| | | </button> |
| | | </div> |
| | | </form> |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['form', 'table', 'util', 'config', 'admin'], function () { |
| | | layui.use(['form', 'table', 'util', 'config', 'admin', 'autocomplete', 'laydate'], function () { |
| | | var form = layui.form; |
| | | var table = layui.table; |
| | | var config = layui.config; |
| | | var layer = layui.layer; |
| | | var util = layui.util; |
| | | var admin = layui.admin; |
| | | var laydate = layui.laydate; |
| | | var autocomplete = layui.autocomplete; |
| | | var $ = layui.jquery; |
| | | |
| | | // 添加按钮点击事件 |
| | | $('#partnerDockingInfo-btn-add').click(function () { |
| | | showEditModel(undefined, 1); |
| | | }); |
| | | //// 刷新 |
| | | // $('#docto-templete-btn-update').click(function () { |
| | | // table.reload('app-table', { where: {} }); |
| | | // }); |
| | | |
| | | //渲染表格 |
| | | table.render({ |
| | | elem: '#partnerDockingInfo-table', |
| | | url: config.base_server + 'api-oprationcenter/parterdockinginfo/list', |
| | | where: { |
| | | access_token: config.getToken().access_token |
| | | }, |
| | | url: config.base_server + 'api-opration/partnerdockinginfo', |
| | | method: 'GET', |
| | | headers: { 'Authorization': 'Bearer ' + config.getToken().access_token }, |
| | | page: true, |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'id', sort: true, title: 'ID',width: 80}, |
| | | {field: 'name', sort: true, title: 'name'}, |
| | | {field: 'code', sort: true, title: 'code'}, |
| | | {align: 'center', toolbar: '#partnerDockingInfo-table-bar', title: '操作',width: 250} |
| | | { field: 'partnerName', align: 'center', width: '10%', title: '合作商名称' }, |
| | | { field: 'hospitalName', align: 'center', width: '15%', title: '医院名称' }, |
| | | { field: 'departmentName', align: 'center', width: '7%', title: '科室名称' }, |
| | | { |
| | | field: 'dockingType', align: 'center', width: '7%', title: '对接类型', templet: function (d) { |
| | | if (d.dockingType == null) { |
| | | return ""; |
| | | } else if (d.dockingType == 1) { |
| | | return "影像版API"; |
| | | } else if (d.dockingType == 2) { |
| | | return "妇幼版API"; |
| | | } else { |
| | | return ""; |
| | | } |
| | | } |
| | | }, |
| | | { field: 'dockingVersion', align: 'center', width: '5%', title: '对接版本' }, |
| | | { field: 'dockingStatus', align: 'center', width: '7%', templet: '#partnerDockingInfo-status', title: '状态' }, |
| | | { field: 'serverMachineCode', align: 'center', width: '10%', title: '服务器机器码' }, |
| | | { field: 'accessKey', align: 'center', width: '10%', title: 'AccessKey' }, |
| | | { field: 'operationName', align: 'center', width: '7%', title: '对接操作人' }, |
| | | { field: 'operationTime', align: 'center', width: '7%', title: '对接日期', templet: "<div>{{layui.util.toDateString(d.operationTime, 'yyyy/MM/dd')}}</div>" }, |
| | | { field: 'Id', align: 'center', toolbar: '#partnerDockingInfo-table-bar', title: '操作', width: '15%', fixed: 'right' } |
| | | ]] |
| | | |
| | | }); |
| | | |
| | | // 工具条点击事件 |
| | | table.on('tool(partnerDockingInfo-table)', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | if (layEvent === 'edit') { // 查看详情 |
| | | showEditModel(data, 2); |
| | | } else if (layEvent === 'del') { |
| | | layer.confirm('确定删除此合作商客户对接信息吗?', function (i) { |
| | | layer.close(i); |
| | | layer.load(2); |
| | | admin.req('api-opration/partnerdockinginfo/' + obj.data.id, {}, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.msg(data.msg, { icon: 1, time: 2000 }); |
| | | table.reload('partnerDockingInfo-table', {}); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, 'delete'); |
| | | }); |
| | | } else if (layEvent == 'download') { |
| | | |
| | | var url = config.base_server + "api-opration/partnerdockinginfo/downloaddb/"; |
| | | // 获取XMLHttpRequest |
| | | var xmlResquest = new XMLHttpRequest(); |
| | | // 发起请求 |
| | | xmlResquest.open("POST", url, true); |
| | | |
| | | // 设置请求头类型 |
| | | xmlResquest.setRequestHeader("Content-type", "application/json"); |
| | | xmlResquest.setRequestHeader("Authorization", "Bearer " + config.getToken().access_token); |
| | | xmlResquest.responseType = "blob"; |
| | | var jsondata = JSON.stringify(obj.data); |
| | | |
| | | // 返回 |
| | | xmlResquest.onload = function () { |
| | | if (this.status == 200) { |
| | | var fileName = data.hospitalName+data.departmentName+".sql"; |
| | | var blob = this.response; |
| | | var a = document.createElement('a'); |
| | | a.innerHTML = fileName; |
| | | // 指定生成的文件名 |
| | | a.download = fileName; |
| | | a.href = URL.createObjectURL(blob); |
| | | document.body.appendChild(a); |
| | | var evt = document.createEvent("MouseEvents"); |
| | | evt.initEvent("click", false, false); |
| | | a.dispatchEvent(evt); |
| | | document.body.removeChild(a); |
| | | } |
| | | }; |
| | | xmlResquest.send(jsondata); |
| | | |
| | | |
| | | } |
| | | }); |
| | | |
| | | // 搜索按钮点击事件 |
| | | $('#partnerDockingInfo-btn-search').click(function () { |
| | | var partnerName = $('#partnerName-search').val(); |
| | | var hospitalName = $('#hospitalName-search').val(); |
| | | table.reload('partnerDockingInfo-table', { where: { partnerName: partnerName, hospitalName: hospitalName }, page: { curr: 1 } }); |
| | | }); |
| | | |
| | | // 修改客户对接状态 |
| | | form.on('switch(partnerDockingInfo-status)', function (obj) { |
| | | layer.load(2); |
| | | admin.req('api-opration/partnerdockinginfo/updatestatus', JSON.stringify({ |
| | | id: obj.elem.value, |
| | | dockingStatus: obj.elem.checked ? 1 : 2 |
| | | }), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.msg(data.msg, { icon: 1, time: 2000 }); |
| | | table.reload('app-tablepartnerDockingInfo-table', {}); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | $(obj.elem).prop('checked', !obj.elem.checked); |
| | | form.render('checkbox'); |
| | | } |
| | | }, 'POST'); |
| | | }); |
| | | |
| | | |
| | | //合作商选择赋值 |
| | | form.on("select(partnerId)", function (data) { |
| | | $("#partnerName").val(data.elem[data.elem.selectedIndex].text); |
| | | }) |
| | | |
| | | |
| | | //赋值对接类型ID |
| | | form.on("select(dockingType)", function (data) { |
| | | $("#dockingTypeName").val(data.elem[data.elem.selectedIndex].text); |
| | | }); |
| | | |
| | | //新增 和 更新 科室触发的事件 |
| | | form.on('select(departmentId)', function () { |
| | | //将部门名称赋值 |
| | | $('#departmentName').val($(this)[0].innerHTML); |
| | | }); |
| | | |
| | | // 表单提交事件 |
| | | form.on('submit(partnerDockingInfo-form-submit)', function (data) { |
| | | layer.load(2); |
| | | admin.req('api-opration/partnerdockinginfo', JSON.stringify(data.field), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | // layer.msg(data.msg, { icon: 1, time: 2000 }); |
| | | layer.closeAll(); |
| | | table.reload('partnerDockingInfo-table', {}); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 2000 }); |
| | | } |
| | | }, "POST"); |
| | | return false; |
| | | }); |
| | | |
| | | // // 显示编辑弹窗 |
| | | var showEditModel = function (data, index) { |
| | | var title = ""; |
| | | if (index == 1) { |
| | | title = "新增"; |
| | | } else if (index == 2) { |
| | | title = "修改"; |
| | | } |
| | | layer.open({ |
| | | type: 1, |
| | | title: title, |
| | | area: '550px', |
| | | offset: '120px', |
| | | content: $('#partnerDockingInfo-model').html(), |
| | | success: function () { |
| | | $('#partnerDockingInfo-form')[0].reset(); |
| | | $('#partnerDockingInfo-form').attr('method', 'POST'); |
| | | if (data) { |
| | | // if (index == 1) { |
| | | // $('#sure').hide(); |
| | | // } |
| | | |
| | | //加载合作商列表信息 |
| | | loadPartnerInfoList(data.partnerId); |
| | | |
| | | //重新装载科室 |
| | | getdepartment(data.hospitalId); |
| | | |
| | | form.val('partnerDockingInfo-form', data); |
| | | |
| | | form.render(); |
| | | |
| | | } else { |
| | | //加载合作商列表信息 |
| | | loadPartnerInfoList(); |
| | | } |
| | | |
| | | //自动完成-医院名称 |
| | | autocomplete.render({ |
| | | elem: $('#hospitalName')[0], |
| | | url: config.base_server + 'api-user/syshospital/findByName', |
| | | keywordsName: 'hospitalName', //查询关键字名称 |
| | | template_val: '{{d.hospitalName}}', //选择后文本框显示的数据字段 |
| | | template_txt: "<div class='layui-table-cell'>{{d.hospitalName}}</div>", //下拉列表模板 |
| | | onselect: function (resp) { |
| | | $("#hospitalId").val(resp.id); |
| | | //重新装载科室 |
| | | getdepartment(resp.id); |
| | | } |
| | | }); |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#operationTime' //指定元素 |
| | | , type: 'datetime' |
| | | }); |
| | | |
| | | |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | |
| | | |
| | | //加载合作商信息列表 |
| | | var loadPartnerInfoList = function (selectVal) { |
| | | admin.req('api-opration/partnerinfo', { |
| | | limit: 100, |
| | | page: 1 |
| | | }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 === data.code) { |
| | | if (data.data.length > 0) { |
| | | $.each(data.data, function (index, item) { |
| | | //往下拉菜单里添加元素 |
| | | $('#partnerId').append(new Option(item.partnerName, item.id, |
| | | false, (!strUtil.isEmpty(selectVal) && selectVal == item.id))); |
| | | }); |
| | | |
| | | } |
| | | } else { |
| | | layer.msg(data.msg, { |
| | | icon: 2, |
| | | time: 2000 |
| | | }); |
| | | } |
| | | }, 'get'); |
| | | } |
| | | |
| | | //获取科室 |
| | | var getdepartment = function (data) { |
| | | admin.req('api-user/sysdepartment/findListByHospitalId', { |
| | | id: data |
| | | }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 === data.code) { |
| | | //department = data.data; |
| | | $('#departmentId').empty(); |
| | | if (data.data.length > 0) { |
| | | $('#departmentName').val(data.data[0].departmentName); |
| | | } |
| | | $.each(data.data, function (index, item) { |
| | | //往下拉菜单里添加元素 |
| | | $('#departmentId').append(new Option(item.departmentName, item.id, |
| | | false, false)); |
| | | form.render('select', 'partnerDockingInfo-form'); |
| | | }) |
| | | form.render(); |
| | | } else { |
| | | layer.msg(data.msg, { |
| | | icon: 2, |
| | | time: 2000 |
| | | }); |
| | | } |
| | | }, 'get'); |
| | | } |
| | | }); |
| | | </script> |