New file |
| | |
| | | <div class="layui-card"> |
| | | <div class="layui-card-header"> |
| | | <h2 class="header-title">筛查机构管理</h2> |
| | | <span class="layui-breadcrumb pull-right"> |
| | | <a href="#!home_console">首页</a> |
| | | <a><cite>筛查机构管理</cite></a> |
| | | </span> |
| | | </div> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <select id="province" placeholder="省份" lay-filter="province"> |
| | | </select> |
| | | <select id="city" placeholder="市" lay-filter="city"> |
| | | <option value="">选择市</option> |
| | | </select> |
| | | <select id="areas" placeholder="区县" lay-filter="areas"> |
| | | <option value="">选择区县</option> |
| | | </select> |
| | | <input name="hospitalName" id="hospitalName-seach" placeholder="按机构名称" type="text" |
| | | class="layui-input search-input" maxlength="50" autocomplete="off"/>  |
| | | </div> |
| | | <button id="app-btn-search" class="layui-btn icon-btn" layt="abc"><i class="layui-icon"></i>搜索 |
| | | </button> |
| | | <button id="screeningOrganization-btn-add" class="layui-btn icon-btn"><i class="layui-icon"></i>添加筛查机构 |
| | | </button> |
| | | <button id="screeningOrganization-btn-import" class="layui-btn icon-btn"><i class="layui-icon"></i>导入筛查机构 |
| | | </button> |
| | | <table class="layui-table" id="app-table" lay-filter="app-table"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <input id="hospitalId" type="hidden"/> |
| | | <!-- 表格操作列 --> |
| | | |
| | | <script type="text/html" id="doctor-table-bar"> |
| | | <button class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改 |
| | | </button> |
| | | <button class="layui-btn layui-btn-xs" lay-event="downLoad"> |
| | | 下载二维码 |
| | | </button> |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['form', 'table', 'laydate', 'util', 'config', 'upload', 'admin', 'autocomplete', 'formSelects','area'], |
| | | function () { |
| | | var form = layui.form; |
| | | var table = layui.table; |
| | | var config = layui.config; |
| | | var admin = layui.admin; |
| | | var $ = layui.jquery; |
| | | var area = layui.area; |
| | | |
| | | //省份数据加载 |
| | | area.areaData("#province", 1, "", ""); |
| | | |
| | | //装载市区数据 |
| | | form.on("select(province)", function (data) { |
| | | area.areasClear("#areas", 3); |
| | | area.areaData("#city", 2, data.value, ""); |
| | | }); |
| | | |
| | | //装载区县数据 |
| | | form.on("select(city)", function (data) { |
| | | area.areaData("#areas", 3, data.value, ""); |
| | | }); |
| | | |
| | | // 渲染表格 |
| | | table.render({ |
| | | elem: '#app-table', |
| | | url: config.base_server + 'api-opration/screeningorganizationinfo', |
| | | method: 'GET', |
| | | headers: { |
| | | 'Authorization': 'Bearer ' + config.getToken().access_token |
| | | }, |
| | | page: true, |
| | | cols: [ |
| | | [{ |
| | | field: 'organizationNo', |
| | | width: "100", |
| | | title: '机构编码', |
| | | fixed: 'left', |
| | | },{ |
| | | field: 'organizationName', |
| | | width: "150", |
| | | title: '机构名称', |
| | | align: 'center', |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | field: 'abbreviation', |
| | | width: "150", |
| | | title: '机构简称', |
| | | align: 'center', |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | field: 'sourceHospitalName', |
| | | width: "150", |
| | | align: 'center', |
| | | title: '所属医院', |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | field: 'areaCode', |
| | | width: "200", |
| | | align: 'center', |
| | | title: '所属区域', |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | field: 'contactName', |
| | | width: "150", |
| | | sort: true, |
| | | align: 'center', |
| | | title: '联系人', |
| | | }, |
| | | { |
| | | field: 'contactNumber', |
| | | width: "150", |
| | | sort: true, |
| | | align: 'center', |
| | | title: '联系电话', |
| | | }, |
| | | { |
| | | field: 'remarks', |
| | | width: "250", |
| | | sort: true, |
| | | align: 'center', |
| | | title: '说明', |
| | | }, |
| | | { |
| | | width: "200", |
| | | align: 'center', |
| | | toolbar: '#doctor-table-bar', |
| | | title: '操作', |
| | | fixed: 'right' |
| | | } |
| | | ] |
| | | ], |
| | | done: function (res, curr, count) { |
| | | permissionsInput(res, config); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // 搜索按钮点击事件 |
| | | $('#app-btn-search').click(function () { |
| | | var province = $('#province').val(); |
| | | var city = $("#city").val(); |
| | | var area = $('#areas').val(); |
| | | var sourceHospitalName = $('#hospitalName-seach').val(); |
| | | table.reload('app-table', { |
| | | where: { |
| | | province: province, |
| | | city: city, |
| | | area: area, |
| | | sourceHospitalName:sourceHospitalName |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 添加按钮点击事件 |
| | | $('#screeningOrganization-btn-add').click(function () { |
| | | showEditModel_add("添加"); |
| | | }); |
| | | |
| | | var showEditModel_add = function (title, data) { |
| | | admin.putTempData('t_screeningOrganization', data); |
| | | admin.popupCenter({ |
| | | title: title, |
| | | path: 'pages/keaigao/screeningOrganization_form.html', |
| | | area: '600px', |
| | | offset: '0px', |
| | | finish: function () { |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // 工具条点击事件 |
| | | table.on('tool(app-table)', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | if (layEvent === 'downLoad') { |
| | | var url = config.base_server + "api-opration/screeningorganizationinfo/downLoad"; |
| | | // 下载二维码 |
| | | // 获取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 data = JSON.stringify({"url": data.qrCode,"no":data.organizationNo}); |
| | | |
| | | // 返回 |
| | | xmlResquest.onload = function() { |
| | | if (this.status == 200) { |
| | | var fileName = "002.png"; |
| | | 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(data); |
| | | |
| | | } else if (layEvent === 'edit') { |
| | | showEditModel_add("编辑", data); |
| | | } |
| | | }); |
| | | |
| | | function downLoad(url) { |
| | | window.open(url); |
| | | } |
| | | |
| | | // 导入按钮点击事件 |
| | | $('#screeningOrganization-btn-import').click(function () { |
| | | showEditModel_import("导入"); |
| | | }); |
| | | |
| | | var showEditModel_import = function (title, data) { |
| | | admin.popupCenter({ |
| | | title: title, |
| | | path: 'pages/keaigao/importScreeningOrganization.html', |
| | | area: '600px', |
| | | offset: '0px', |
| | | finish: function () { |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | }); |
| | | </script> |