moreplan.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. layui.use('element', function () {
  2. element = layui.element//Tab的切换功能,切换事件监听等,需要依赖element模块
  3. function Progress(dom, num) {
  4. window.setTimeout(function () {
  5. element.progress(dom, num)
  6. }, 360)
  7. }
  8. function showInfoMessage(msg) {
  9. layer.msg(msg, {
  10. icon: 6
  11. })
  12. }
  13. function conFirm(msg, num, isStop, planid, getDat) {
  14. layer.confirm('您确定要执行该操作吗?', { btn: ['确定', '取消'], title: "提示" }, function (index) {
  15. if (num == 2) {
  16. showInfoMessage("计划已完成")
  17. $("#stopBtn_"+planid).attr('disabled', true).addClass("falsebutton")
  18. } else {
  19. isStop = num == 0 ? 1 : 0
  20. }
  21. if (isStop == 0) {
  22. $("#progress_"+planid).css({
  23. "background-color": "gray"
  24. })
  25. $("#stopBtn_"+planid).html("激活计划")
  26. } else {
  27. $("#progress_"+planid).css({
  28. "background-color": "#ff9526"
  29. })
  30. $("#stopBtn_"+planid).html("终止计划")
  31. }
  32. var params = {
  33. status: isStop,
  34. planId: planid
  35. }
  36. healthAPI.updatePlanStatusById(params).then(function (res) {
  37. if (res.status == 200) {
  38. getDat()
  39. }
  40. })
  41. layer.close(index);
  42. });
  43. }
  44. var reqList = []; //记录请求的参数和url,用于后退时使用
  45. Vue.use(Vuedals.default);
  46. new Vue({
  47. el: "#app",
  48. data: {
  49. appname: "更多计划",
  50. isback: true,
  51. isrefresh: true,
  52. paticentcode: "",
  53. tablelistone: [],
  54. tablelist: [],
  55. name: "",
  56. sex: "",
  57. age: "",
  58. hospital: "",
  59. diseaseList: [],
  60. signFamilyFinishItemCount: "",
  61. signFamilyServiceRecordCount: "",
  62. signFamilyAdminTeamName: "",
  63. specialistAdminTeamName: "",
  64. specialistFinishItemCount: "",
  65. specialistServiceRecordCount: "",
  66. progress: "",
  67. specialistHospitalName: "",
  68. familyHospitalName: "",
  69. planid: "",
  70. isStop: 1 ,//
  71. patientPhoto:"",
  72. },
  73. watch: {
  74. tablelist: function (val) {
  75. this.$nextTick(function () {
  76. element.init()
  77. for (var i = 0; i < val.length; i++) {
  78. var allFinishCount = val[i].allFinishCount
  79. var allCount = val[i].allCount
  80. var isStop = val[i].status
  81. var ishospitalName = val[i].hospitalName
  82. if(ishospitalName==null){
  83. $("#hospitalName_"+val[i].id).html("暂无社区信息")
  84. }
  85. if (isStop == 2) {
  86. $("#span_font"+val[i].planId).html("已完成")
  87. $("#span_font"+val[i].planId).addClass("corg")
  88. }
  89. if (isStop == 1) {
  90. $("#span_font"+val[i].planId).html("进行中")
  91. $("#span_font"+val[i].planId).addClass("cblue")
  92. }
  93. if (isStop == 0) {
  94. $("#span_font"+val[i].planId).html("已中止")
  95. $("#span_font"+val[i].planId).addClass("cgre")
  96. $("#progress_"+val[i].planId).css({
  97. "background-color": "gray"
  98. })
  99. $("#stopBtn_"+val[i].planId).html("激活计划")
  100. }else{
  101. $("#progress_"+val[i].planId).css({
  102. "background-color": "#ff9526"
  103. })
  104. $("#stopBtn_"+val[i].planId).html("终止计划")
  105. }
  106. var progressNum = Math.ceil((allFinishCount / allCount) * 100)
  107. Progress(val[i].planId, progressNum + "%")
  108. }
  109. })
  110. },
  111. },
  112. mounted() {
  113. var vm = this
  114. vm.getDatas()
  115. EventBus.$on("back-click", function (arg) {
  116. history.go(-1);
  117. });
  118. //监听页面刷新
  119. EventBus.$on("refresh-click", function (arg) {
  120. location.reload();
  121. });
  122. },
  123. components: {
  124. vuedals: Vuedals.Component
  125. },
  126. methods: {
  127. setImgSrc: function (src) {
  128. if(!src){
  129. return "../../../images/p-female.png"
  130. }else{
  131. var str = httpRequest.getImgUrl(src)
  132. return str
  133. }
  134. },
  135. getDatas: function () {
  136. var vm = this
  137. var httpData = GetRequest()
  138. vm.paticentcode = httpData.patientCode
  139. var params = {
  140. patientCode: vm.paticentcode
  141. }
  142. healthAPI.PlanDetailList(params).then(function (res) {
  143. if (res.status == 200) {
  144. console.log(res)
  145. vm.wujilu = false
  146. vm.name = res.data.patientName
  147. vm.sex = res.data.sex
  148. vm.age = res.data.age
  149. vm.patientPhoto=res.data.patientPhoto
  150. vm.hospital = res.data.hospitalName
  151. vm.diseaseList = res.data.diseaseList
  152. vm.tablelist = _.sortBy(res.data.rehabilitationPlanList, "patientName")
  153. vm.signFamilyServiceRecordCount = res.data.signFamilyServiceRecordCount
  154. vm.signFamilyFinishItemCount = res.data.signFamilyFinishItemCount
  155. vm.signFamilyAdminTeamName = res.data.signFamilyAdminTeamName
  156. vm.specialistAdminTeamName = res.data.specialistAdminTeamName
  157. vm.specialistFinishItemCount = res.data.specialistFinishItemCount
  158. vm.specialistServiceRecordCount = res.data.specialistServiceRecordCount
  159. vm.specialistHospitalName = res.data.specialistHospitalName
  160. vm.familyHospitalName = res.data.familyHospitalName
  161. if (vm.tablelist.length == 0) {
  162. vm.wujilu = true
  163. }
  164. } else {
  165. // showErrorMessage(res.msg);
  166. }
  167. })
  168. },
  169. stop: function (data) {
  170. var vm = this
  171. vm.planid = data.planId
  172. console.log(data.planId)
  173. conFirm("确定终止该计划吗", data.status, vm.isStop, vm.planid, vm.getDatas)
  174. console.log(vm.isStop)
  175. },
  176. noOpen: function () {
  177. showInfoMessage("暂未开放")
  178. }
  179. }
  180. })
  181. });