123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>查看指导模板</title>
- <meta name="format-detection" content="telephone=no" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <link rel="stylesheet" href="../iconfont/iconfont.css" />
- <link rel="stylesheet" type="text/css" href="../../../css/mui.min.css"/>
- <link rel="stylesheet" href="../../../common/cross/css/cross.css" type="text/css">
- <link rel="stylesheet" href="../../../common/cross/css/cross.ui.css" type="text/css" />
- <link rel="stylesheet" type="text/css" href="../../../common/cross/css/ui.all.css"/>
- <style type="text/css">
- .bgc-17b3ec{background-color: #17b3ec;}
- .bgc-ffa54b{background-color: #ffa54b;}
- .btn_group{position: fixed; bottom: 10px; width: 100%; z-index:2;}
- .pop-main{display:none;position: fixed;left: 0;top: 0;right: 0;bottom: 0;background: rgba(0,0,0,0.6);z-index: 990;transition: all 1s;}
- .pop-btns{width: 100%;position: fixed;left: 0;bottom: -300px;z-index: 991;transition: all .5s;}
- .pop-main.active{display:block}
- .pop-btns.active{bottom: 0;}
- .pop-btn{width: 90%;margin: 0 auto;padding: 15px;text-align: center;background: #fff;font-size: 14px;}
- .pop-edit-btn{/*margin-bottom: 10px;*/border-bottom: 1px solid #DCDCDC;}
- .pop-del-btn{margin-bottom: 10px;}
- .pop-cancel-btn{color: #ff6a56;margin-bottom: 20px;}
- .pop-tis{color: #ccc;border-bottom: 1px solid #dcdcdc;}
- .content p{word-wrap: break-word;}
- </style>
- </head>
- <body class="bgc-fff">
- <div class="h45">
- <div class="demo-comtop">
- <a class="mui-action-back"></a>
- <h1>健康指导模板</h1>
- </div>
- </div>
- <div class="content ptb10 plr10" style="margin-bottom: 72px;">
- </div>
-
- <div class="c-row mtb10 btn_group c-hide" id="btn_group1">
- <div class="c-50 c-t-center pl10">
- <a class="c-btn c-f16 bgc-ffa54b c-btn-full c-btn-radius delete_btn">删除模板</a>
- </div>
- <div class="c-50 c-t-center pr10">
- <a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius edit_btn">编辑模板</a>
- </div>
- </div>
- <!--<div class="c-row mtb10 btn_group c-hide" id="btn_group2">
- <div class="c-100 c-t-center plr10">
- <a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius use_btn">引用模板</a>
- </div>
- </div>-->
- <div class="c-row mtb10 btn_group c-hide" id="btn_group3">
- <div class="c-50 c-t-center pl10">
- <a class="c-btn c-f16 bgc-ffa54b c-btn-full c-btn-radius edit_btn">编辑模板</a>
- </div>
- <div class="c-50 c-t-center pr10">
- <a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius send_btn">立即发送</a>
- </div>
- </div>
-
-
-
- <div class="pop-main"></div>
- <div class="pop-btns">
- <div class="pop-btn pop-tis">删除后无法恢复,是否确认删除?</div>
- <div class="pop-btn pop-edit-btn">仅在<span class="del-team-name"></span>删除</div>
- <div class="pop-btn pop-del-btn">在所有团队删除</div>
- <div class="pop-btn pop-cancel-btn">取消</div>
- </div>
-
- </body>
- <script type="text/html" id="content_tmp">
- <h2 class="c-f16 c-bold c-333 c-t-center">{{title}}</h2>
- <div class="c-row">
- <div class="c-50">
- <span class="c-f12 c-909090">{{createTime}}</span>
- </div>
- <div class="c-50 c-t-right">
- <span class="c-f12 c-909090">使用次数:{{useTimes}}</span>
- </div>
-
- </div>
- <p class="c-f14 c-333" id="content_text"></p>
- {{each imagesUrl as it}}
- <div>
- <img src="{{it | setPhoto}}" width="100%">
- </div>
- {{/each}}
- </script>
- <script src="../../../js/jquery/2.1.3/jquery.js"></script>
- <script src="../../../js/mui.min.js"></script>
- <script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
- <script src="../../../js/underscore.js"></script>
- <script src="../../../js/template.js" type="text/javascript" charset="utf-8"></script>
- <script src="../../../js/app.js" type="text/javascript" charset="utf-8"></script>
- <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css"/>
- <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js" type="text/javascript" charset="utf-8"></script>
- <script type="text/javascript">
- var code="",
- reference,
- patiCode,
- tId,
- tName,
- content_details,
- teamsLen,
- inTeams,
- docInfo,
- is_sys = false;
-
- var $popMain = $('.pop-main'),
- $popBtns = $('.pop-btns'),
- $popCancelBtn = $('.pop-cancel-btn'),
- $popEditBtn = $('.pop-edit-btn'),
- $popDelBtn = $('.pop-del-btn');
-
- mui.init();
- mui.plusReady(function(){
- docInfo = JSON.parse(plus.storage.getItem("docInfo"));
- var self = plus.webview.currentWebview();
- code = self.code;
- reference = self.reference;
- is_sys = self.is_sys;
- teamsLen = self.teamsLen;
- tId = self.tId;
- tName = self.tName;
- console.log(tName);
- $('.del-team-name').html(tName);
- patiCode = self.patiCode;
- //团队个数小于1
- // if (teamsLen <= 1) {
- // $popEditBtn.css('margin-bottom','10px');
- // $popDelBtn.hide();
- // }
- if(reference == "mine"){
- // if(is_sys){
- // $("#btn_group2").show();
- // }else{
- // $("#btn_group1").show();
- // }
- }else{
- $("#btn_group3").show();
- }
- getDetail();
- bindEvents();
- });
-
- function getDetail(){
- var url = "doctor/team/guidance/getTeamGuidanceDetail";
- sendGet(url,{teamTemplateCode: code,teamId:tId}, null, function(res){
- if(res.status == 200){
- var regN = /\n/g;
- var regRN = /\r\n/g;
- var content = res.guidanceDetail.content.replace(/ /g, " ");
- if (res.guidanceDetail.imagesUrl != '') {
- res.guidanceDetail.imagesUrl = res.guidanceDetail.imagesUrl.split(',');
- }
- content = content.replace(regN,"<br/>");
- content_details = res.guidanceDetail;
- inTeams = res.guidanceDetail.teamList;
- if (inTeams.length <= 1) {
- $popEditBtn.css('margin-bottom','10px');
- $popDelBtn.hide();
- }
- var html = template('content_tmp', res.guidanceDetail);
- $(".content").empty().append(html);
- $("#content_text").html(content);
- if(reference == "mine"){
- if (docInfo.isLeader == '1' || docInfo.code == res.guidanceDetail.creater) {
- $("#btn_group1").show();
- }
- }
- }
- }, true);
- }
- //删除团队模板
- function delMDDataOfTeams (params) {
- var url = 'doctor/team/guidance/deleteTeamGuidance';
- sendGet( url, params, null, function (res) {
- if (res.status == 200) {
- mui.toast('删除成功!');
- var self = plus.webview.currentWebview(),
- opener = self.opener();
- if(opener){
- opener.reload(true);
- mui.back();
- }
- } else {
- mui.toast(res.msg)
- }
- });
- }
-
- function bindEvents(){
- //显示弹窗
- $(".delete_btn").on('click', function(){
- $popMain.addClass('active');
- $popBtns.addClass('active');
- });
- //仅在xx团队删除
- $popEditBtn.on('click', function() {
- var params = { deleteAll: 0, guidanceCode: code, teamId:tId};
- delMDDataOfTeams(params);
- });
- //在所有团队删除
- $popDelBtn.on('click', function() {
- var params = { deleteAll: 1, guidanceCode: code};
- delMDDataOfTeams(params);
- });
- //关闭弹窗
- $popCancelBtn.on('click', function() {
- $popMain.removeClass('active');
- $popBtns.removeClass('active');
- });
- //关闭弹窗
- $popMain.on('click',function () {
- $popMain.removeClass('active');
- $popBtns.removeClass('active');
- });
-
- $(".edit_btn").on('tap', function(){
- openWebview('bianjituanduimuban.html',{
- reference: reference,
- is_sys: true,
- code: code,
- patiCode: patiCode,
- content_details: content_details,
- teamList: inTeams,
- teamId: tId
- });
- });
-
- $(".send_btn").on('tap', function(){
- //团队模板发送时只和医生点击哪个团队中的模板有关,指导绑定的另外的团队没有关系
- var chooseTeam = _.find(inTeams, {teamId: parseInt(tId)}),
- arr = [];
- arr.push(chooseTeam);
- dialog({
- content: "发出后无法变更,是否确认发送给居民?",
- okValue: "继续发送",
- ok: function(){
- var url = "doctor/team/guidance/sendTeamGuidance",
- params = {
- patient: patiCode,
- content: content_details.content,
- guidanceCode: code || "",
- images: content_details.imagesUrl ? content_details.imagesUrl.join(","):"",
- // teamId: JSON.stringify(inTeams)
- teamId: JSON.stringify(arr) //发送患者时,只和当前选中的团队有关系
- };
- plus.nativeUI.showWaiting();
- sendPost(url, params, null, function(res){
- if (res.status == 200) {
- mui.toast("发送成功!");
- var self = plus.webview.currentWebview(),
- opener = self.opener(),
- pre_opener = self.opener().opener();
-
- if(opener.id == "jkzd"){ //自己的模板详情
- if(pre_opener.id == "guidance_info"){
- mui.fire(pre_opener.opener(), "update");
- pre_opener.opener().show();
- mui.later(function(){
- pre_opener.close();
- opener.close();
- self.close();
- }, 300);
- }else{
- mui.fire(pre_opener, "update");
- pre_opener.show();
- mui.later(function(){
- opener.close();
- self.close();
- }, 300);
- }
- }else{ //系统模板详情
- var pre_pre_opener = pre_opener.opener();
- if(pre_pre_opener.id == "guidance_info"){
- mui.fire(pre_pre_opener.opener(), "update");
- pre_pre_opener.opener().show();
- mui.later(function(){
- pre_pre_opener.close();
- opener.close();
- pre_opener.close();
- self.close();
- }, 300);
- }else{
- mui.fire(pre_pre_opener, "update");
- pre_pre_opener.show();
- mui.later(function(){
- opener.close();
- pre_opener.close();
- self.close();
- }, 300);
- }
-
- }
- }else{
- mui.toast(res.msg)
- }
- plus.nativeUI.closeWaiting();
- }, 'POST', '', true);
- },
- cancelValue: "不了,谢谢",
- cancel: function(){}
- }).showModal();
- });
-
-
-
-
- //引用模板
- // $(".use_btn").on('click', function(){
- // openWebview('edit_guidance.html',{
- // reference: reference,
- // is_sys: is_sys,
- // code: code,
- // patiCode: patiCode,
- // content_details: content_details
- // });
- // });
- }
-
- template.helper("setPhoto", function(p) {
- return getImgUrl(p);
- });
- </script>
- </html>
|