chakantuanduimuban.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>查看指导模板</title>
  6. <meta name="format-detection" content="telephone=no" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  8. <meta name="apple-mobile-web-app-capable" content="yes" />
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  10. <link rel="stylesheet" href="../iconfont/iconfont.css" />
  11. <link rel="stylesheet" type="text/css" href="../../../css/mui.min.css"/>
  12. <link rel="stylesheet" href="../../../common/cross/css/cross.css" type="text/css">
  13. <link rel="stylesheet" href="../../../common/cross/css/cross.ui.css" type="text/css" />
  14. <link rel="stylesheet" type="text/css" href="../../../common/cross/css/ui.all.css"/>
  15. <style type="text/css">
  16. .bgc-17b3ec{background-color: #17b3ec;}
  17. .bgc-ffa54b{background-color: #ffa54b;}
  18. .btn_group{position: fixed; bottom: 10px; width: 100%; z-index:2;}
  19. .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;}
  20. .pop-btns{width: 100%;position: fixed;left: 0;bottom: -300px;z-index: 991;transition: all .5s;}
  21. .pop-main.active{display:block}
  22. .pop-btns.active{bottom: 0;}
  23. .pop-btn{width: 90%;margin: 0 auto;padding: 15px;text-align: center;background: #fff;font-size: 14px;}
  24. .pop-edit-btn{/*margin-bottom: 10px;*/border-bottom: 1px solid #DCDCDC;}
  25. .pop-del-btn{margin-bottom: 10px;}
  26. .pop-cancel-btn{color: #ff6a56;margin-bottom: 20px;}
  27. .pop-tis{color: #ccc;border-bottom: 1px solid #dcdcdc;}
  28. .content p{word-wrap: break-word;}
  29. </style>
  30. </head>
  31. <body class="bgc-fff">
  32. <div class="h45">
  33. <div class="demo-comtop">
  34. <a class="mui-action-back"></a>
  35. <h1>健康指导模板</h1>
  36. </div>
  37. </div>
  38. <div class="content ptb10 plr10" style="margin-bottom: 72px;">
  39. </div>
  40. <div class="c-row mtb10 btn_group c-hide" id="btn_group1">
  41. <div class="c-50 c-t-center pl10">
  42. <a class="c-btn c-f16 bgc-ffa54b c-btn-full c-btn-radius delete_btn">删除模板</a>
  43. </div>
  44. <div class="c-50 c-t-center pr10">
  45. <a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius edit_btn">编辑模板</a>
  46. </div>
  47. </div>
  48. <!--<div class="c-row mtb10 btn_group c-hide" id="btn_group2">
  49. <div class="c-100 c-t-center plr10">
  50. <a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius use_btn">引用模板</a>
  51. </div>
  52. </div>-->
  53. <div class="c-row mtb10 btn_group c-hide" id="btn_group3">
  54. <div class="c-50 c-t-center pl10">
  55. <a class="c-btn c-f16 bgc-ffa54b c-btn-full c-btn-radius edit_btn">编辑模板</a>
  56. </div>
  57. <div class="c-50 c-t-center pr10">
  58. <a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius send_btn">立即发送</a>
  59. </div>
  60. </div>
  61. <div class="pop-main"></div>
  62. <div class="pop-btns">
  63. <div class="pop-btn pop-tis">删除后无法恢复,是否确认删除?</div>
  64. <div class="pop-btn pop-edit-btn">仅在<span class="del-team-name"></span>删除</div>
  65. <div class="pop-btn pop-del-btn">在所有团队删除</div>
  66. <div class="pop-btn pop-cancel-btn">取消</div>
  67. </div>
  68. </body>
  69. <script type="text/html" id="content_tmp">
  70. <h2 class="c-f16 c-bold c-333 c-t-center">{{title}}</h2>
  71. <div class="c-row">
  72. <div class="c-50">
  73. <span class="c-f12 c-909090">{{createTime}}</span>
  74. </div>
  75. <div class="c-50 c-t-right">
  76. <span class="c-f12 c-909090">使用次数:{{useTimes}}</span>
  77. </div>
  78. </div>
  79. <p class="c-f14 c-333" id="content_text"></p>
  80. {{each imagesUrl as it}}
  81. <div>
  82. <img src="{{it | setPhoto}}" width="100%">
  83. </div>
  84. {{/each}}
  85. </script>
  86. <script src="../../../js/jquery/2.1.3/jquery.js"></script>
  87. <script src="../../../js/mui.min.js"></script>
  88. <script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
  89. <script src="../../../js/underscore.js"></script>
  90. <script src="../../../js/template.js" type="text/javascript" charset="utf-8"></script>
  91. <script src="../../../js/app.js" type="text/javascript" charset="utf-8"></script>
  92. <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css"/>
  93. <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js" type="text/javascript" charset="utf-8"></script>
  94. <script type="text/javascript">
  95. var code="",
  96. reference,
  97. patiCode,
  98. tId,
  99. tName,
  100. content_details,
  101. teamsLen,
  102. inTeams,
  103. docInfo,
  104. is_sys = false;
  105. var $popMain = $('.pop-main'),
  106. $popBtns = $('.pop-btns'),
  107. $popCancelBtn = $('.pop-cancel-btn'),
  108. $popEditBtn = $('.pop-edit-btn'),
  109. $popDelBtn = $('.pop-del-btn');
  110. mui.init();
  111. mui.plusReady(function(){
  112. docInfo = JSON.parse(plus.storage.getItem("docInfo"));
  113. var self = plus.webview.currentWebview();
  114. code = self.code;
  115. reference = self.reference;
  116. is_sys = self.is_sys;
  117. teamsLen = self.teamsLen;
  118. tId = self.tId;
  119. tName = self.tName;
  120. console.log(tName);
  121. $('.del-team-name').html(tName);
  122. patiCode = self.patiCode;
  123. //团队个数小于1
  124. // if (teamsLen <= 1) {
  125. // $popEditBtn.css('margin-bottom','10px');
  126. // $popDelBtn.hide();
  127. // }
  128. if(reference == "mine"){
  129. // if(is_sys){
  130. // $("#btn_group2").show();
  131. // }else{
  132. // $("#btn_group1").show();
  133. // }
  134. }else{
  135. $("#btn_group3").show();
  136. }
  137. getDetail();
  138. bindEvents();
  139. });
  140. function getDetail(){
  141. var url = "doctor/team/guidance/getTeamGuidanceDetail";
  142. sendGet(url,{teamTemplateCode: code,teamId:tId}, null, function(res){
  143. if(res.status == 200){
  144. var regN = /\n/g;
  145. var regRN = /\r\n/g;
  146. var content = res.guidanceDetail.content.replace(/ /g, "&nbsp;");
  147. if (res.guidanceDetail.imagesUrl != '') {
  148. res.guidanceDetail.imagesUrl = res.guidanceDetail.imagesUrl.split(',');
  149. }
  150. content = content.replace(regN,"<br/>");
  151. content_details = res.guidanceDetail;
  152. inTeams = res.guidanceDetail.teamList;
  153. if (inTeams.length <= 1) {
  154. $popEditBtn.css('margin-bottom','10px');
  155. $popDelBtn.hide();
  156. }
  157. var html = template('content_tmp', res.guidanceDetail);
  158. $(".content").empty().append(html);
  159. $("#content_text").html(content);
  160. if(reference == "mine"){
  161. if (docInfo.isLeader == '1' || docInfo.code == res.guidanceDetail.creater) {
  162. $("#btn_group1").show();
  163. }
  164. }
  165. }
  166. }, true);
  167. }
  168. //删除团队模板
  169. function delMDDataOfTeams (params) {
  170. var url = 'doctor/team/guidance/deleteTeamGuidance';
  171. sendGet( url, params, null, function (res) {
  172. if (res.status == 200) {
  173. mui.toast('删除成功!');
  174. var self = plus.webview.currentWebview(),
  175. opener = self.opener();
  176. if(opener){
  177. opener.reload(true);
  178. mui.back();
  179. }
  180. } else {
  181. mui.toast(res.msg)
  182. }
  183. });
  184. }
  185. function bindEvents(){
  186. //显示弹窗
  187. $(".delete_btn").on('click', function(){
  188. $popMain.addClass('active');
  189. $popBtns.addClass('active');
  190. });
  191. //仅在xx团队删除
  192. $popEditBtn.on('click', function() {
  193. var params = { deleteAll: 0, guidanceCode: code, teamId:tId};
  194. delMDDataOfTeams(params);
  195. });
  196. //在所有团队删除
  197. $popDelBtn.on('click', function() {
  198. var params = { deleteAll: 1, guidanceCode: code};
  199. delMDDataOfTeams(params);
  200. });
  201. //关闭弹窗
  202. $popCancelBtn.on('click', function() {
  203. $popMain.removeClass('active');
  204. $popBtns.removeClass('active');
  205. });
  206. //关闭弹窗
  207. $popMain.on('click',function () {
  208. $popMain.removeClass('active');
  209. $popBtns.removeClass('active');
  210. });
  211. $(".edit_btn").on('tap', function(){
  212. openWebview('bianjituanduimuban.html',{
  213. reference: reference,
  214. is_sys: true,
  215. code: code,
  216. patiCode: patiCode,
  217. content_details: content_details,
  218. teamList: inTeams,
  219. teamId: tId
  220. });
  221. });
  222. $(".send_btn").on('tap', function(){
  223. //团队模板发送时只和医生点击哪个团队中的模板有关,指导绑定的另外的团队没有关系
  224. var chooseTeam = _.find(inTeams, {teamId: parseInt(tId)}),
  225. arr = [];
  226. arr.push(chooseTeam);
  227. dialog({
  228. content: "发出后无法变更,是否确认发送给居民?",
  229. okValue: "继续发送",
  230. ok: function(){
  231. var url = "doctor/team/guidance/sendTeamGuidance",
  232. params = {
  233. patient: patiCode,
  234. content: content_details.content,
  235. guidanceCode: code || "",
  236. images: content_details.imagesUrl ? content_details.imagesUrl.join(","):"",
  237. // teamId: JSON.stringify(inTeams)
  238. teamId: JSON.stringify(arr) //发送患者时,只和当前选中的团队有关系
  239. };
  240. plus.nativeUI.showWaiting();
  241. sendPost(url, params, null, function(res){
  242. if (res.status == 200) {
  243. mui.toast("发送成功!");
  244. var self = plus.webview.currentWebview(),
  245. opener = self.opener(),
  246. pre_opener = self.opener().opener();
  247. if(opener.id == "jkzd"){ //自己的模板详情
  248. if(pre_opener.id == "guidance_info"){
  249. mui.fire(pre_opener.opener(), "update");
  250. pre_opener.opener().show();
  251. mui.later(function(){
  252. pre_opener.close();
  253. opener.close();
  254. self.close();
  255. }, 300);
  256. }else{
  257. mui.fire(pre_opener, "update");
  258. pre_opener.show();
  259. mui.later(function(){
  260. opener.close();
  261. self.close();
  262. }, 300);
  263. }
  264. }else{ //系统模板详情
  265. var pre_pre_opener = pre_opener.opener();
  266. if(pre_pre_opener.id == "guidance_info"){
  267. mui.fire(pre_pre_opener.opener(), "update");
  268. pre_pre_opener.opener().show();
  269. mui.later(function(){
  270. pre_pre_opener.close();
  271. opener.close();
  272. pre_opener.close();
  273. self.close();
  274. }, 300);
  275. }else{
  276. mui.fire(pre_pre_opener, "update");
  277. pre_pre_opener.show();
  278. mui.later(function(){
  279. opener.close();
  280. pre_opener.close();
  281. self.close();
  282. }, 300);
  283. }
  284. }
  285. }else{
  286. mui.toast(res.msg)
  287. }
  288. plus.nativeUI.closeWaiting();
  289. }, 'POST', '', true);
  290. },
  291. cancelValue: "不了,谢谢",
  292. cancel: function(){}
  293. }).showModal();
  294. });
  295. //引用模板
  296. // $(".use_btn").on('click', function(){
  297. // openWebview('edit_guidance.html',{
  298. // reference: reference,
  299. // is_sys: is_sys,
  300. // code: code,
  301. // patiCode: patiCode,
  302. // content_details: content_details
  303. // });
  304. // });
  305. }
  306. template.helper("setPhoto", function(p) {
  307. return getImgUrl(p);
  308. });
  309. </script>
  310. </html>