| | |
| | | </span> |
| | | </div> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar">  |
| | | <input id="hospital-search-value" class="layui-input search-input" type="text" placeholder="输入医院名" />  |
| | | <button id="contract-btn-search" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button> |
| | | <div class="layui-form toolbar"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline" style="margin-bottom: -25px;">  |
| | | <input id="hospital-search-value" class="layui-input search-input" type="text" placeholder="按医院名" |
| | | autocomplete="off" width="400px" /></div>  |
| | | <button id="contract-btn-search" class="layui-btn icon-btn permissions" permissions="contract-list" |
| | | style="margin-bottom: -25px;"><i class="layui-icon"></i>搜索</button> |
| | | </div> |
| | | <table class="layui-table" id="contract-table" lay-filter="contract-table"></table> |
| | | </div> |
| | | <table class="layui-table" id="contract-table" lay-filter="contract-table"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <input id="hospitalId" type="hidden" /> |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="contract-table-bar"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看产品</a> |
| | | <!-- <a class="layui-btn layui-btn-danger layui-btn-xs permissions" permissions="contract-del" lay-event="del">删除</a> --> |
| | | <a class="layui-btn layui-btn-xs permissions" permissions="contract-edit" lay-event="edit">修改</a> |
| | | <a class=" layui-btn layui-btn-primary layui-btn-xs permissions" permissions="productorderdetail-save" |
| | | lay-event="detail">查看套餐</a> |
| | | </script> |
| | | <!-- 表格状态列 --> |
| | | <script type="text/html" id="contract-tpl-state"> |
| | |
| | | <table class="layui-table" id="contract-table-detail" lay-filter="contract-table-detail"></table> |
| | | </script> |
| | | <script> |
| | | layui.use(['table', 'util', 'admin', 'config', 'form'], function () { |
| | | layui.use(['table', 'util', 'admin', 'config', 'form', 'autocomplete'], function () { |
| | | let table = layui.table; |
| | | let util = layui.util; |
| | | let admin = layui.admin; |
| | | let form = layui.form; |
| | | let laydate = layui.laydate; |
| | | let config = layui.config; |
| | | var autocomplete = layui.autocomplete; |
| | | var $ = layui.jquery; |
| | | |
| | | //自动完成-医院名称 |
| | | autocomplete.render({ |
| | | elem: $('#hospital-search-value')[0], |
| | | keywordsName: 'hospitalName',//查询关键字名称 |
| | | url: config.base_server + 'api-user/syshospital/findByName', |
| | | template_val: '{{d.hospitalName}}',//选择后文本框显示的数据字段 |
| | | template_txt: "<div class='layui-table-cell'>{{d.hospitalName}}</div>",//下拉列表模板 |
| | | onselect: function (resp) { |
| | | $("#hospitalId").val(resp.id); |
| | | } |
| | | }); |
| | | |
| | | // 渲染表格 |
| | | var renderTable = function () { |
| | |
| | | page: true, |
| | | cols: [[ |
| | | { field: 'hospitalName', width: 300, title: '医院名称' }, |
| | | { field: 'departmentName', width: 100, title: '科室名称' }, |
| | | { field: 'departmentName', width: 200, title: '科室名称' }, |
| | | { field: 'contractNo', width: 150, title: '合同编号' }, |
| | | { field: 'contractTitle', width: 150, title: '合同名' }, |
| | | { field: 'contractBeginTime', width: 150, title: '合同生效时间',templet:function(d) |
| | | { field: 'contractTitle', width: 200, title: '合同名' }, |
| | | { |
| | | return new Date(d.contractBeginTime).dateFormat("yyyy/MM/dd"); |
| | | } |
| | | field: 'contractBeginTime', width: 120, title: '合同生效时间', templet: function (d) { |
| | | return new Date(d.contractBeginTime).dateFormat("yyyy/MM/dd"); |
| | | } |
| | | }, |
| | | { field: 'contractEndTime', width: 150, title: '合同到期时间',templet:function(d){ |
| | | return new Date(d.contractEndTime).dateFormat("yyyy/MM/dd"); |
| | | } }, |
| | | { field: 'contractTime', width: 180, title: '合同签订时间',templet:function(d){ |
| | | return new Date(d.contractTime).dateFormat("yyyy/MM/dd hh:mm:ss"); |
| | | } }, |
| | | { field: 'enabled', width: 120, templet: '#contract-tpl-state', sort: true, title: '状态' }, |
| | | { field: 'createTime', width: 160, sort: true, title: '创建时间' }, |
| | | { align: 'center', width: 150, toolbar: '#contract-table-bar', title: '操作' } |
| | | ]] |
| | | { |
| | | field: 'contractEndTime', width: 120, title: '合同到期时间', templet: function (d) { |
| | | return new Date(d.contractEndTime).dateFormat("yyyy/MM/dd"); |
| | | } |
| | | }, |
| | | { |
| | | field: 'contractTime', width: 120, title: '合同签订时间', templet: function (d) { |
| | | if(d.contractTime==null){ |
| | | return new Date(d.createTime).dateFormat("yyyy/MM/dd"); |
| | | } |
| | | return new Date(d.contractTime).dateFormat("yyyy/MM/dd"); |
| | | } |
| | | }, |
| | | // { field: 'enabled', width: 120, templet: '#contract-tpl-state', sort: true, title: '状态' }, |
| | | { |
| | | field: 'createTime', width: 160, title: '创建时间', templet: function (d) { |
| | | return new Date(d.createTime).dateFormat("yyyy-MM-dd hh:mm"); |
| | | } |
| | | }, |
| | | { |
| | | align: 'center', width: 150, toolbar: '#contract-table-bar', title: '操作', |
| | | fixed: 'right' |
| | | } |
| | | ]], |
| | | done: function (res) { |
| | | permissionsInput(res, config); |
| | | } |
| | | }); |
| | | } |
| | | renderTable(); |
| | | |
| | | // 修改状态 |
| | | form.on('switch(contract-tpl-state)', function (obj) { |
| | | layer.load(2); |
| | | admin.req('api-opration/contract/updateEnabled', { |
| | | id: obj.elem.value, |
| | | enabled: obj.elem.checked ? true : false |
| | | }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.msg(data.msg, { icon: 1, time: 500 }); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | $(obj.elem).prop('checked', !obj.elem.checked); |
| | | form.render('checkbox'); |
| | | } |
| | | }, 'GET'); |
| | | }); |
| | | |
| | | // 工具条点击事件 |
| | | table.on('tool(contract-table)', function (obj) { |
| | | if (obj.event === 'del') { // 删除 |
| | | layer.confirm('确定要删除吗?', function (i) { |
| | | layer.confirm('确定要删除合同及关联套餐吗?', function (i) { |
| | | layer.close(i); |
| | | layer.load(2); |
| | | admin.req('api-opration/contract/' + obj.data.id, {}, function (data) { |
| | | layer.closeAll('loading'); |
| | | layer.msg(data.msg, { icon: 1, time: 500 }, function () { |
| | | |
| | | layer.msg(data.msg, { icon: 1, time: 2000 }, function () { |
| | | renderTable(); |
| | | }); |
| | | obj.del(); |
| | | }, 'DELETE'); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | showModel(obj.data.id); |
| | | else if (obj.event === 'edit') { |
| | | //修改 |
| | | updateModel(obj.data); |
| | | } else if (obj.event === 'detail') { |
| | | //充值记录列表 |
| | | showModel(obj.data); |
| | | } |
| | | }); |
| | | |
| | | // 搜索按钮点击事件 |
| | | $('#contract-btn-search').click(function () { |
| | | var hospitalName = $('#hospital-search-value').val(); |
| | | table.reload('contract-table', { where: { hospitalName: hospitalName} }); |
| | | if (strUtil.isEmpty(hospitalName)) { |
| | | $("#hospitalId").val(""); |
| | | } |
| | | table.reload('contract-table', { |
| | | where: { hospitalId: $("#hospitalId").val() }, |
| | | page: { |
| | | curr: 1 |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | var showModel=function(orderId){ |
| | | layer.open({ |
| | | type:1, |
| | | title:'查看产品', |
| | | area: '1200px', |
| | | offset: '100px', |
| | | content: $('#contract-model').html(), |
| | | success:function(){ |
| | | table.render({ |
| | | elem: '#contract-table-detail', |
| | | url: config.base_server + 'api-opration/productorderdetail', |
| | | method: 'GET', |
| | | where:{'orderId':orderId}, |
| | | headers: { 'Authorization': 'Bearer ' + config.getToken().access_token }, |
| | | page: true, |
| | | limit:5, |
| | | limits:[5,10], |
| | | cols: [[ |
| | | { field: 'proName', width: 300, title: '产品名称' }, |
| | | { field: 'ailightCount', width: 150, title: '读片量' }, |
| | | { field: 'recordCount', width: 100, title: '报告量' }, |
| | | { field: 'isShare', width: 150, title: '是否共享',templet:function(d) |
| | | { |
| | | if(d.isShare) |
| | | return '共享' |
| | | else |
| | | return '私有' |
| | | } |
| | | }, |
| | | { field: 'proBegintime', width: 150, title: '开始时间',templet:function(d){ |
| | | return new Date(d.proBegintime).dateFormat("yyyy/MM/dd"); |
| | | } }, |
| | | { field: 'proEndtime', width: 180, title: '结束时间',templet:function(d){ |
| | | return new Date(d.proEndtime).dateFormat("yyyy/MM/dd hh:mm:ss"); |
| | | } }, |
| | | { field: 'createTime', width: 160, sort: true, title: '创建时间' } |
| | | ]] |
| | | var showModel = function (data) { |
| | | layer.open({ |
| | | type: 1, |
| | | title: '查看产品', |
| | | area: '1200px', |
| | | offset: '100px', |
| | | content: $('#contract-model').html(), |
| | | success: function () { |
| | | table.render({ |
| | | elem: '#contract-table-detail', |
| | | url: config.base_server + 'api-opration/productorderdetail/all', |
| | | method: 'GET', |
| | | where: { orderId: data.id,enabled: 1}, |
| | | headers: { 'Authorization': 'Bearer ' + config.getToken().access_token }, |
| | | page: true, |
| | | limit: 10, |
| | | limits: [5, 10], |
| | | cols: [[ |
| | | { field: 'proName', width: 300, title: '产品名称' }, |
| | | { field: 'ailightCount', width: 150, title: '读片量' }, |
| | | { field: 'ailightCount', width: 150, title: '读片使用量' ,templet: function (d) { |
| | | return d.orderAilightCount-d.ailightCount; |
| | | } |
| | | }, |
| | | { field: 'recordCount', width: 100, title: '报告量' }, |
| | | { |
| | | field: 'isShare', width: 150, title: '是否共享', templet: function (d) { |
| | | if (d.isShare) |
| | | return '共享' |
| | | else |
| | | return '私有' |
| | | } |
| | | }, |
| | | { |
| | | field: 'proBegintime', width: 150, title: '开始时间', templet: function (d) { |
| | | return new Date(d.proBegintime).dateFormat("yyyy/MM/dd"); |
| | | } |
| | | }, |
| | | { |
| | | field: 'proEndtime', width: 180, title: '结束时间', templet: function (d) { |
| | | return new Date(d.proEndtime).dateFormat("yyyy/MM/dd"); |
| | | } |
| | | }, |
| | | { field: 'createTime', width: 160, sort: true, title: '创建时间' } |
| | | ]] |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | var updateModel = function (data) { |
| | | //修改充值记录 |
| | | admin.putTempData("t_hospital", data); |
| | | admin.popupCenter({ |
| | | title: '修改合同', |
| | | path: 'pages/opration/rechargeupdate.html', |
| | | area: '1200px', |
| | | offset: '0px', |
| | | finish: function () { |
| | | $('#hospita-btn-search').click(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | </script> |