server-items-detail.js 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180
  1. var currentGMT = new Date() //当前时间GMT
  2. function showSuccessMessage(msg) {
  3. layer.msg(msg, {
  4. icon: 1
  5. })
  6. }
  7. function showSuccessMessage(msg) {
  8. layer.msg(msg, {
  9. icon: 1
  10. })
  11. }
  12. function showErrorMessage(msg) {
  13. layer.msg(msg, {
  14. icon: 5
  15. })
  16. }
  17. function showWarningMessage(msg) {
  18. layer.msg(msg, {
  19. icon: 2
  20. })
  21. }
  22. function showInfoMessage(msg) {
  23. layer.msg(msg, {
  24. icon: 6
  25. })
  26. }
  27. var previewLayerIndex, followupLayerIndex, KFZDlayerIndex
  28. function closeFollowUpLayer(planDetaiId, relationCode, flag) {
  29. if ($.isArray(relationCode)) {
  30. $.each(relationCode, function (index, item) {
  31. _vm.saveRehabilitationOperateRecord(planDetaiId, 6, item, flag)
  32. })
  33. } else {
  34. _vm.saveRehabilitationOperateRecord(planDetaiId, 6, relationCode, flag)
  35. }
  36. layer.close(followupLayerIndex)
  37. }
  38. function closeKFZDlayer(planDetaiId, relationRecordId) {
  39. layer.close(KFZDlayerIndex)
  40. _vm.saveRehabilitationOperateRecord(planDetaiId, 5)
  41. }
  42. function closeKFZD() {
  43. layer.close(KFZDlayerIndex)
  44. _vm.initData()
  45. }
  46. var _vm
  47. Vue.component('server-items-detail', {
  48. template:
  49. '<div class="p15 ui-grid ui-grid-vertical" style="height:calc(100%);position: relative;">\
  50. <div class="icon-group">\
  51. <i class="icon-edit el-icon-edit-outline mr15" @click="goToEditConfig"></i>\
  52. <i class="icon-close el-icon-close" @click="onClose"></i>\
  53. </div>\
  54. <div class="c-t-center c-f18 c-333 mt15">服务内容-{{service.title}}</div>\
  55. <div class="c-t-center c-f17 c-666 mt10">{{patientname}}患者{{service.title}}计划</div>\
  56. <div class="c-333 ptb10 c-f17 mt10">指导留言</div>\
  57. <div @click="zdly(service)">\
  58. <div class="c-f14 c-666" v-if="!message.isImg" >{{message.content}}</div>\
  59. <div class="mt10" v-else><img :src="message.content" @click.stop="previewImg(message.content)" style="width:60px;height:60px;" :data-preview-src="message.content" data-preview-group="1"/></div>\
  60. </div>\
  61. <div v-if="islimit" class="mtb10 ui-grid">\
  62. <div class="ui-col-1">\
  63. <i class="icon icon-prev icon-20" @click="preMonth"></i>\
  64. <span class="currentDay">{{currentDay}}</span>\
  65. <i class="icon icon-next icon-20" @click="nextMonth"></i></span>\
  66. </div>\
  67. <div class="pull-right switch-list" style="text-align:center">\
  68. <span class="rili" :class="{active:(tabStatus==1)}" @click="tabStatus=1"><i class="icon icon-rili icon-20"></i></span>\
  69. <span class="shijianzhou" :class="{active:(tabStatus==2)}" @click="tabStatus=2"><i class="icon icon-liebiao icon-20"></i></span>\
  70. </div>\
  71. </div>\
  72. <div v-if="islimit&&tabStatus==1" class="ui-col-1" style="overflow: hidden; overflow-y: scroll;">\
  73. <div class="calendar-week">\
  74. <div class="flex-box text-center">\
  75. <div class="flex-box-item">周一</div>\
  76. <div class="flex-box-item">周二</div>\
  77. <div class="flex-box-item">周三</div>\
  78. <div class="flex-box-item">周四</div>\
  79. <div class="flex-box-item">周五</div>\
  80. <div class="flex-box-item">周六</div>\
  81. <div class="flex-box-item">周日</div>\
  82. </div>\
  83. </div>\
  84. <div class="calendar-days">\
  85. <div v-for="items in calendarData" class="flex-box">\
  86. <div class="calendar-day" v-for="item in items" @click="viewDetail(item.planDetailIds)" :is-future="item.future">\
  87. <span class="day-number">{{item.day}}</span>\
  88. <div class="task-icon">\
  89. <i v-if="item.myTaskFlag" class="icon icon-flag icon-20"></i>\
  90. <i v-if="item.finishFlag" class="icon icon-check"></i>\
  91. </div>\
  92. <div class="coloured-box">\
  93. <span v-if="item.specialist" class="coloured-ribbon coloured-ribbon-blue">专<br />科</span>\
  94. <span v-if="item.family" class="coloured-ribbon coloured-ribbon-green">家<br />医</span>\
  95. </div>\
  96. <div class="progress-box">\
  97. <div class="progress" :style="{opacity:item.specialist?\'1\':\'0\'}">\
  98. <span>{{(item.specialist && item.specialist.finish)}}/{{(item.specialist && item.specialist.all)}}</span>\
  99. <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" :style="{width: (item.specialist?(item.specialist.finish/item.specialist.all):0)*100+\'%\'}"></div>\
  100. </div>\
  101. <div class="progress" :style="{opacity:item.family?\'1\':\'0\'}">\
  102. <span>{{(item.family && item.family.finish)}}/{{(item.family && item.family.all)}}</span>\
  103. <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="2" aria-valuemin="0" aria-valuemax="100" :style="{width: (item.family?(item.family.finish/item.family.all):0)*100+\'%\'}"></div>\
  104. </div>\
  105. <p v-if="!item.noService" class="mb0 f12" :class="{\'visibility-hide\':!curTask}" style="line-height: 1;">{{curTaskName || \'&emsp;\'}}</p>\
  106. </div>\
  107. <p v-if="item.noService" class="no-server">无服务项</p>\
  108. </div>\
  109. </div>\
  110. </div>\
  111. </div>\
  112. <div v-show="tabStatus==2" class="ui-col-1 mt10" style="overflow-y: auto">\
  113. <div class="time-axis">\
  114. <div>\
  115. <table class="table">\
  116. <tr>\
  117. <th style="padding-right: 50px;text-align: right;">时间</th>\
  118. <th>项目</th>\
  119. <th>执行人员</th>\
  120. <th>执行地点</th>\
  121. <th class="text-center">相关记录</th>\
  122. <th class="text-center">状态</th>\
  123. </tr>\
  124. <tr v-for="item in timeAxisData" :is-future="item.future">\
  125. <td class="time text-right time-box">\
  126. <p class="mb5">{{item.date}}</p>\
  127. <p class="mb0">{{item.time}}</p>\
  128. <span class="cur-status">{{item.html}}</span>\
  129. </td>\
  130. <td class="project-name mw400">\
  131. <p class="mt10">{{item.name}}</p>\
  132. <p class="ellipsis mb0">{{item.content}}</p>\
  133. </td>\
  134. <td class="executor">{{item.doctorName}}</td>\
  135. <td class="place-of-execution">{{item.hospitalName}}</td>\
  136. <td class="view-task" @click="onViewDetail(item,1)">查看</td>\
  137. <td class="task-status" :class="item.future==-1?\'c-ff3b30\':(item.status==0?\'c-666\':\'\')">{{item.status==0?\'未完成\':(item.status==1?\'已完成\':\'已预约\')}}</td>\
  138. </tr>\
  139. <tr v-if="!timeAxisData.length">\
  140. <td colspan="6" class="f16 ptb10 text-center">\
  141. <img src="../../../images/wushuju_img.png" class="mt50"/>\
  142. <p class="c-666">暂无数据</p>\
  143. </td>\
  144. </tr>\
  145. </table>\
  146. </div>\
  147. </div>\
  148. </div>\
  149. <div v-if="docInfo.doctorType==1" class="c-t-center mt15">\
  150. <button v-if="!islimit&&service.executeDoctorCode!=docInfo.uid" class="btn btn-12b7f5" @click="zdly(service)">指导留言</button>\
  151. </div>\
  152. <div v-else-if="!islimit" class="c-t-center mt15">\
  153. <button class="btn btn-12b7f5" @click="zdly(service)">查看留言</button>\
  154. <button v-if="service.type==\'1\'" class="btn btn-yuyue" @click="addCompleteRecord()">添加完成记录</button>\
  155. <button v-if="service.type==\'4\'" class="btn btn-yuyue" @click="sendSpecialistWeixinMessage(planDetaiId,4)">发送提醒</button>\
  156. <button v-if="service.type==\'4\'" class="btn btn-12b7f5" @click="toDoorDialog">代预约</button>\
  157. <button v-if="service.type==\'5\'" class="btn btn-yuyue" @click="kfzd()">发送康复指导</button>\
  158. <button v-if="service.type==\'6\'" class="btn btn-yuyue" @click="sfjh()">创建随访计划</button>\
  159. <button v-if="service.type==\'7\'" class="btn btn-yuyue" @click="sendSpecialistWeixinMessage(planDetaiId,7)">发送提醒</button>\
  160. <button v-if="service.type==\'7\'" class="btn btn-12b7f5" @click="qwapp">代预约</button>\
  161. </div>\
  162. <div id="completeRecord" style="display: none; padding: 15px 15px 0;">\
  163. <div class="note-info pt10">\
  164. <p class="f14 c-333">服务完成笔记</p>\
  165. <textarea class="form-control" style="resize: none;" rows="4" placeholder="可备注您的服务记录" v-model="node"></textarea>\
  166. </div>\
  167. <div class="note-info ptb10">\
  168. <p class="f14 c-333">相关记录</p>\
  169. <ul class="upload-box">\
  170. <li class="flex-box" v-for="(img,index) in upImgs">\
  171. <div class="upload-img-box">\
  172. <img :src="img.baseUrl" @click="previewImg(img.baseUrl)"/>\
  173. </div>\
  174. <a class="delete-img" @click="deleteImg(index)">&times;</a>\
  175. </li>\
  176. <li class="flex-box" v-if="upImgs.length<5">\
  177. <span class="add-img">+</span>\
  178. <input type="file" @change="upLoadImgToBase64" class="upload-img" />\
  179. </li>\
  180. </ul>\
  181. </div>\
  182. </div>\
  183. </div>',
  184. props: ['patientname', 'patientcode', 'planid', 'plandetailid'],
  185. data: function () {
  186. return {
  187. scList: [],
  188. patientInfo: {},
  189. ynow: currentGMT.getFullYear(), //年份
  190. mnow: currentGMT.getMonth(), //月份(比实际少一个月---0开始至11)
  191. dnow: currentGMT.getDate(), //当前日
  192. currentDay: null, //带中文格式的当前年月
  193. calendarData: [], //日历数据
  194. timeAxisData: [], //时间轴数据
  195. tabStatus: 1,
  196. title: '',
  197. docInfo: JSON.parse(window.localStorage.getItem('wlyyAgent')),
  198. docInfo1: JSON.parse(window.localStorage.getItem('docInfo')),
  199. upImgs: [],
  200. upImgArr: [],
  201. imgData: {
  202. accept: 'image/gif, image/jpeg, image/png, image/jpg'
  203. },
  204. node: '',
  205. layerIndex: undefined,
  206. planDetaiId: '',
  207. service: {
  208. relationRecordImg: {},
  209. messageList: {}
  210. },
  211. message: { isImg: false, content: '' },
  212. islimit: false,
  213. relationRecordId: null
  214. }
  215. },
  216. watch: {
  217. tabStatus: function () {
  218. if (this.islimit) {
  219. this.goToLoadData(true)
  220. }
  221. }
  222. },
  223. mounted: function () {
  224. _vm = this
  225. this.initData()
  226. },
  227. methods: {
  228. initData: function () {
  229. var vm = this
  230. this.planDetaiId = this.plandetailid
  231. this.getServiceItem()
  232. },
  233. getServiceItem: function () {
  234. var vm = this
  235. var loadding = top.layer.load(0, {
  236. shade: false
  237. }) //0代表加载的风格,支持0-2
  238. rehaAPI
  239. .serviceItem({
  240. planDetailId: vm.planDetaiId
  241. })
  242. .then(function (res) {
  243. top.layer.close(loadding)
  244. if (res.status == 200) {
  245. vm.service = res.data
  246. vm.getPatientInfo(vm.service.patient)
  247. var isZK = vm.docInfo.doctorType == 1 ? true : false
  248. vm.service.isZK = isZK
  249. if (vm.service.isMyTask == 1) {
  250. //执行者
  251. vm.service.isCK = true //无法显示按钮
  252. if (vm.docInfo.uid == vm.service.specialistDoctorCode) {
  253. //说明我自己是创建者
  254. vm.service.isCK = false
  255. vm.service.isCreate = true
  256. }
  257. } else {
  258. if (vm.docInfo.uid == vm.service.specialistDoctorCode) {
  259. //说明我自己是创建者
  260. vm.service.isCreate = true
  261. }
  262. }
  263. if (vm.service.frequencyCode) {
  264. vm.islimit = true
  265. vm.goToLoadData(true)
  266. vm.monDetail()
  267. } else {
  268. vm.islimit = false
  269. vm.tabStatus = 2
  270. vm.selectByPlanDetaiId()
  271. }
  272. vm.getList()
  273. vm.selectByGuidance()
  274. vm.$forceUpdate()
  275. } else {
  276. showErrorMessage(res.msg)
  277. }
  278. })
  279. },
  280. // 获取康复计划服务项的指导留言
  281. selectByGuidance: function () {
  282. var vm = this
  283. var params = {
  284. planId: vm.planid,
  285. itemCode: vm.service.type
  286. }
  287. rehaAPI.selectByGuidance(params).then(function (res) {
  288. if (res.status == 200) {
  289. var messageIndex = _.findIndex(res.data, { doctor_type: 1 })
  290. if (messageIndex > -1) {
  291. var message = res.data[messageIndex]
  292. var contentType = message.content_type
  293. if (contentType == 2 || contentType == 9) {
  294. vm.message.isImg = true
  295. }
  296. vm.message.content = vm.getContent(message.content, message.content_type)
  297. } else {
  298. vm.message.content = '无'
  299. }
  300. } else {
  301. showErrorMessage(res.msg)
  302. }
  303. })
  304. },
  305. goToEditConfig: function () {
  306. var vm = this
  307. location.href = '../../recover/html/new_recover.html?patient=' + vm.patientcode + '&isEditConfig=true&planId=' + vm.planid + '&planDetailId=' + vm.planDetaiId
  308. },
  309. closeAllLayer: function (name, planDetaiId, type, relationCode, flag) {
  310. if (name == '预览康复指导') {
  311. layer.close()
  312. }
  313. },
  314. // 提醒患者 num 1康复指导2康复下转3复诊提醒4上门服务提醒5家签提醒
  315. sendSpecialistWeixinMessage: function (planDetaiId, type) {
  316. var vm = this
  317. var text = ''
  318. var patientName = vm.patientname
  319. var patientCode = vm.patientcode
  320. if (type == 4) {
  321. // 上门服务
  322. text = '请问您是否确认提醒' + patientName + '居民预约上门护理服务?'
  323. } else if (type == 7) {
  324. // 康复复诊
  325. text = '请问您是否确认提醒' + patientName + '居民进行复诊?'
  326. }
  327. var current = layer.confirm(
  328. text,
  329. {
  330. btn: ['确定', '取消'],
  331. title: '提示'
  332. },
  333. function (index) {
  334. var _type = type == 4 ? 4 : type == 7 ? 3 : ''
  335. var loading = layer.load(0, { shade: false })
  336. var params = {
  337. patient: patientCode,
  338. doctor: vm.docInfo.uid,
  339. type: _type,
  340. relationCode: planDetaiId,
  341. planId: vm.planid
  342. }
  343. rehaAPI.sendSpecialistWeixinMessage(params).then(function (res) {
  344. layer.close(loading)
  345. if (res.status == 200) {
  346. showSuccessMessage('提交成功!')
  347. if (_type == 3 || _type == 4) {
  348. // 提醒患者后,即认为是已完成
  349. vm.saveRehabilitationOperateRecord(planDetaiId, type)
  350. }
  351. } else {
  352. showErrorMessage(res.msg)
  353. }
  354. })
  355. layer.close(current) //再执行关闭
  356. }
  357. )
  358. },
  359. // 添加完成记录
  360. addCompleteRecord: function () {
  361. var vm = this
  362. var detailId = this.planDetaiId
  363. var type = vm.service.type
  364. $('#completeRecord').css('display', 'block')
  365. this.layerIndex = layer.open({
  366. type: 1,
  367. area: ['500px', '450px'],
  368. shade: 0.5,
  369. title: '添加完成记录',
  370. btn: ['确定', '关闭'], //只是为了演示
  371. shadeClose: false, //点击遮罩关闭层
  372. content: $('#completeRecord'),
  373. yes: function () {
  374. vm.saveRehabilitationOperateRecord(detailId, 1)
  375. layer.close(vm.layerIndex)
  376. }
  377. })
  378. },
  379. monDetail: function () {
  380. this.currentDay = this.ynow + '年' + (this.mnow + 1) + '月'
  381. },
  382. is_leap: function (year) {
  383. //判断是否为闰年
  384. return year % 100 == 0 ? (res = year % 400 == 0 ? 1 : 0) : (res = year % 4 == 0 ? 1 : 0)
  385. },
  386. preMonth: function () {
  387. //上一个月
  388. if (this.mnow <= 0) {
  389. this.mnow = 11
  390. this.ynow = this.ynow - 1
  391. } else {
  392. this.mnow--
  393. }
  394. this.monDetail()
  395. this.goToLoadData(true)
  396. },
  397. getPreMouth: function () {
  398. var pMnow, pYnow
  399. if (this.mnow <= 0) {
  400. pMnow = 11
  401. pYnow = this.ynow - 1
  402. } else {
  403. pMnow = this.mnow - 1
  404. pYnow = this.ynow
  405. }
  406. var m_days = new Array(31, 28 + this.is_leap(pYnow), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) //每个月的天数
  407. return {
  408. days: m_days[pMnow],
  409. date: pYnow + '-' + (++pMnow >= 10 ? pMnow : '0' + pMnow)
  410. }
  411. },
  412. nextMonth: function () {
  413. //下一个月
  414. if (this.mnow >= 11) {
  415. this.mnow = 0
  416. this.ynow = this.ynow + 1
  417. } else {
  418. this.mnow++
  419. }
  420. this.monDetail()
  421. this.goToLoadData(true)
  422. },
  423. getNextMouth: function () {
  424. var nMnow, nYnow
  425. if (this.mnow >= 11) {
  426. nMnow = 0
  427. nYnow = this.ynow + 1
  428. } else {
  429. nMnow = this.mnow + 1
  430. nYnow = this.ynow
  431. }
  432. var m_days = new Array(31, 28 + this.is_leap(nYnow), 31, 30, 31, 01, 31, 31, 30, 31, 30, 31) //每个月的天数
  433. return {
  434. days: m_days[nMnow],
  435. date: nYnow + '-' + (++nMnow >= 10 ? nMnow : '0' + nMnow)
  436. }
  437. },
  438. goToLoadData: function (flag) {
  439. //flag是否更新数据
  440. this.tabStatus == 1 && (!this.calendarData.length || flag) && this.calendar()
  441. this.tabStatus == 2 && (!this.timeAxisData.length || flag) && this.timeAxis()
  442. },
  443. calendar: function () {
  444. var nlstr = new Date(this.ynow, this.mnow, 1) //当月第一天
  445. var firstday = nlstr.getDay() - 1 //第一天星期几,默认是周日 我们改成周一
  446. firstday = firstday == -1 ? 6 : firstday //如果是-1,说明当月的第一天是周日
  447. var m_days = new Array(31, 28 + this.is_leap(this.ynow), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) //每个月的天数
  448. var tr_str = Math.ceil((m_days[this.mnow] + firstday) / 7) //当前月天数+第一天是星期几的数值 获得 表格行数
  449. var c_days = m_days[this.mnow] //当前月份的天数
  450. var p_arr = this.getPreMouth()
  451. var n_arr = this.getNextMouth()
  452. var i, k, idx, date_str
  453. var dataArr = [] //天数/年月
  454. for (i = 0; i < tr_str; i++) {
  455. //表格的行
  456. for (k = 0; k < 7; k++) {
  457. //表格每行的单元格
  458. idx = i * 7 + k //单元格自然序列号
  459. date_str = idx - firstday + 1 //计算日期
  460. var __ym
  461. if (date_str <= 0) {
  462. //过滤无效日期(小于等于零的、大于月总天数的)
  463. date_str = date_str + p_arr['days'] //当前日期+上个月的天数就是上个月的日期
  464. __ym = p_arr['date']
  465. } else if (date_str > c_days) {
  466. date_str = date_str - c_days //下个月的日期就是这个月的天数-当月的天数
  467. __ym = n_arr['date']
  468. } else {
  469. __ym = this.ynow + '-' + (this.mnow >= 9 ? '' : '0') + (this.mnow + 1)
  470. }
  471. dataArr.push({
  472. day: date_str,
  473. date: __ym
  474. })
  475. }
  476. }
  477. this.__Data = dataArr
  478. this.calenderPlanDetail()
  479. },
  480. // 日历有计划数据处理
  481. planHandleData: function (data, day, mounth) {
  482. var item = data
  483. item.day = day
  484. if (mounth) {
  485. item.mounth = mounth
  486. }
  487. var finishFlag = false
  488. var sFlag = false
  489. var fFlag = false
  490. if (item.specialist) {
  491. if (item.specialist.all == item.specialist.finish) {
  492. sFlag = true
  493. }
  494. } else {
  495. sFlag = true
  496. }
  497. if (item.family) {
  498. if (item.family.all == item.family.finish) {
  499. fFlag = true
  500. }
  501. } else {
  502. fFlag = true
  503. }
  504. finishFlag = sFlag && fFlag
  505. item.finishFlag = finishFlag
  506. return item
  507. },
  508. calenderPlanDetail: function () {
  509. var vm = this
  510. var __days = vm.__Data
  511. var lastDay = __days.concat().pop().day
  512. lastDay = lastDay > 9 ? lastDay : '0' + lastDay
  513. if (vm.searchTask || vm.status || vm.status == 0) {
  514. vm.isFastSearch = true
  515. } else {
  516. vm.isFastSearch = false
  517. }
  518. var params = {
  519. executeStartTime: vm.isFastSearch ? '' : __days[0].date + '-' + __days[0].day + ' 00:00:00', //日历开始时间(格式:yyyy-MM-dd HH:mm:ss)
  520. executeEndTime: vm.isFastSearch ? '' : __days.concat().pop().date + '-' + lastDay + ' 23:59:59', //日历结束时间(格式:yyyy-MM-dd HH:mm:ss)
  521. planId: vm.planid, //计划id
  522. searchTask: vm.service.type, //快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访)
  523. status: null //任务状态(0未完成,1已完成,2已预约)
  524. }
  525. rehaAPI.calendarPlanDetail(params).then(function (res) {
  526. vm.curTask = vm.searchTask
  527. vm.curTaskName = vm.searchTaskName
  528. vm.calendarData = []
  529. var list = []
  530. if (res.status == 200) {
  531. var data = res.data
  532. // 快速查找
  533. if (vm.isFastSearch) {
  534. vm.searchData = []
  535. var searchData0 = [],
  536. searchData1 = [],
  537. searchData2 = []
  538. for (var setM = 1; setM <= 12; setM++) {
  539. var _setM = setM > 9 ? setM : '0' + setM,
  540. _setY = new Date().getFullYear()
  541. var data0 = [],
  542. data1 = [],
  543. data2 = []
  544. for (var i in data) {
  545. var getY = i.split('-')[0],
  546. getM = i.split('-')[1],
  547. getD = i.split('-')[2]
  548. // 去年
  549. if (_setY - 1 == getY && _setM == getM) {
  550. var item = vm.planHandleData(data[i], getD, getM)
  551. data0.push(item)
  552. data.length && data.splice(i, 1)
  553. } else if (_setY == getY && _setM == getM) {
  554. // 今年
  555. var item = vm.planHandleData(data[i], getD, getM)
  556. data1.push(item)
  557. data.length && data.splice(i, 1)
  558. } else if (_setY + 1 == getY && _setM == getM) {
  559. // 明年
  560. var item = vm.planHandleData(data[i], getD, getM)
  561. data2.push(item)
  562. data.length && data.splice(i, 1)
  563. }
  564. }
  565. if (data0.length) {
  566. var dataSort = vm.daysSort(data0)
  567. var addlen = (dataSort.length + 1) % 7 ? (dataSort.length + 1) % 7 : 7
  568. for (var i = 0; i < 7 - addlen; i++) {
  569. dataSort.push({
  570. noService: true
  571. })
  572. }
  573. searchData0.push(dataSort)
  574. }
  575. if (data1.length) {
  576. var dataSort = vm.daysSort(data1)
  577. var addlen = (dataSort.length + 1) % 7 ? (dataSort.length + 1) % 7 : 7
  578. for (var i = 0; i < 7 - addlen; i++) {
  579. dataSort.push({
  580. noService: true
  581. })
  582. }
  583. searchData1.push(dataSort)
  584. }
  585. if (data2.length) {
  586. var dataSort = vm.daysSort(data2)
  587. var addlen = (dataSort.length + 1) % 7 ? (dataSort.length + 1) % 7 : 7
  588. for (var i = 0; i < 7 - addlen; i++) {
  589. dataSort.push({
  590. noService: true
  591. })
  592. }
  593. searchData2.push(dataSort)
  594. }
  595. }
  596. if (searchData0.length) {
  597. vm.searchData.push(searchData0)
  598. }
  599. if (searchData1.length) {
  600. vm.searchData.push(searchData1)
  601. }
  602. if (searchData2.length) {
  603. vm.searchData.push(searchData2)
  604. }
  605. return false
  606. }
  607. // 正常日历
  608. var _currentTimeStamp = +new Date(new Date().setHours(0, 0, 0, 0))
  609. for (var i in __days) {
  610. var _key = __days[i].date + '-' + (__days[i].day > 9 ? __days[i].day : '0' + __days[i].day)
  611. var item = {
  612. noService: true,
  613. day: __days[i].day
  614. }
  615. for (var j in data) {
  616. if (_key == j) {
  617. item = vm.planHandleData(data[j], __days[i].day)
  618. data.length && data.splice(j, 1)
  619. break
  620. }
  621. }
  622. var thatTime = +new Date(_key) - 8 * 60 * 60 * 1000
  623. var future = _currentTimeStamp > thatTime ? 0 : _currentTimeStamp == thatTime ? 1 : 2
  624. item.future = future
  625. list.push(item)
  626. // vm.calendarData.push(item);
  627. }
  628. vm.calendarData = vm.chunkFunction(list, 7)
  629. }
  630. })
  631. },
  632. chunkFunction: function (arr, size) {
  633. let changeIndex = 0
  634. let secondArr = []
  635. while (changeIndex < arr.length) {
  636. secondArr.push(arr.slice(changeIndex, (changeIndex += size)))
  637. }
  638. return secondArr
  639. },
  640. //时间轴请求
  641. timeAxis: function () {
  642. var m_days = new Array(31, 28 + this.is_leap(this.ynow), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) //每个月的天数
  643. var c_days = m_days[this.mnow] //当前月份的天数
  644. var __ym = this.ynow + '-' + (this.mnow >= 9 ? '' : '0') + (this.mnow + 1)
  645. var dataArr = [] //天数/年月
  646. for (; c_days > 0; c_days--) {
  647. dataArr.push({
  648. day: c_days,
  649. date: __ym
  650. })
  651. }
  652. this.__xData = dataArr
  653. this.calendarPlanDetailList()
  654. },
  655. //限频次 时间轴请求
  656. calendarPlanDetailList: function () {
  657. var vm = this
  658. var __days = vm.__xData
  659. var lastDay = __days.concat().pop().day
  660. lastDay = lastDay > 9 ? lastDay : '0' + lastDay
  661. var params = {
  662. executeEndTime: __days[0].date + '-' + __days[0].day + ' 23:59:59', //日历开始时间(格式:yyyy-MM-dd HH:mm:ss)
  663. executeStartTime: __days.concat().pop().date + '-' + lastDay + ' 00:00:00', //日历结束时间(格式:yyyy-MM-dd HH:mm:ss)
  664. planId: vm.planid, //计划id
  665. searchTask: vm.service.type, // 服务项
  666. status: null //任务状态(0未完成,1已完成,2已预约)
  667. }
  668. rehaAPI.calendarPlanDetailList(params).then(function (res) {
  669. if (res.status == 200) {
  670. // var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
  671. var list =
  672. _.map(res.data || {}, function (o) {
  673. // var _time=o.executeTime.split(' ');
  674. // var thatTime=+new Date(_time[0]);
  675. // var future=_currentTimeStamp>thatTime?0:(_currentTimeStamp==thatTime?1:2);
  676. // (o.status==0 && _currentTimeStamp>thatTime) && (future=-1)
  677. // var _html=o.status==2?'预':(future==-1?'逾':'');
  678. // _html=future==1?'今':_html;
  679. // if(_html=='预') future=3;
  680. var _time = o.executeTime.split(' ')
  681. var _html = ''
  682. var d = new Date(o.execute_time)
  683. if (d.format('yyyy-MM-dd') == new Date().format('yyyy-MM-dd')) {
  684. o.firstSort = '1'
  685. future = 1
  686. _html = '今'
  687. if (o.status) {
  688. o.secondSort = '2'
  689. } else {
  690. o.secondSort = '1'
  691. }
  692. } else if (d > new Date()) {
  693. o.firstSort = '3'
  694. future = 2
  695. if (o.status) {
  696. o.secondSort = '2'
  697. } else {
  698. o.secondSort = '1'
  699. }
  700. } else {
  701. o.firstSort = '2'
  702. future = 0
  703. if (o.status == 0) {
  704. future = -1
  705. _html = '逾'
  706. o.secondSort = '1'
  707. } else {
  708. o.secondSort = '2'
  709. }
  710. }
  711. o.html = _html
  712. o.date = _time[0]
  713. o.time = _time[1]
  714. o.future = future
  715. o.doctorName = o.doctor_name
  716. o.hospitalName = o.hospital_name
  717. return o
  718. }) || []
  719. var nowTime = new Date().getTime()
  720. vm.timeAxisData = _.sortBy(list, function (o) {
  721. return o.firstSort + o.secondSort + nowTime / o.execute_time
  722. })
  723. } else {
  724. showErrorMessage(res.msg)
  725. }
  726. })
  727. },
  728. //不限频次 时间轴请求
  729. selectByPlanDetaiId: function () {
  730. var vm = this
  731. var params = {
  732. planId: this.planid,
  733. code: vm.service.type,
  734. page: 1,
  735. pagesize: 10000
  736. }
  737. rehaAPI.selectByPlanDetaiId(params).then(function (res) {
  738. if (res.status == 200) {
  739. var list =
  740. _.map(res.data.list || {}, function (o) {
  741. var _time = o.completeTime.split(' ')
  742. var _html = ''
  743. var d = new Date(o.completeTime)
  744. if (d.format('yyyy-MM-dd') == new Date().format('yyyy-MM-dd')) {
  745. o.firstSort = '1'
  746. future = 1
  747. _html = '今'
  748. if (o.status) {
  749. o.secondSort = '2'
  750. } else {
  751. o.secondSort = '1'
  752. }
  753. } else if (d > new Date()) {
  754. o.firstSort = '3'
  755. future = 2
  756. if (o.status) {
  757. o.secondSort = '2'
  758. } else {
  759. o.secondSort = '1'
  760. }
  761. } else {
  762. o.firstSort = '2'
  763. future = 0
  764. if (o.status == 0) {
  765. future = -1
  766. _html = '逾'
  767. o.secondSort = '1'
  768. } else {
  769. o.secondSort = '2'
  770. }
  771. }
  772. o.html = _html
  773. o.date = _time[0]
  774. o.time = _time[1]
  775. o.future = future
  776. o.hospitalName = o.hosiptalName
  777. return o
  778. }) || []
  779. var nowTime = new Date().getTime()
  780. vm.timeAxisData = _.sortBy(list, function (o) {
  781. return o.firstSort + o.secondSort + nowTime / o.execute_time
  782. })
  783. } else {
  784. showErrorMessage(res.msg)
  785. }
  786. })
  787. },
  788. zdly: function (data) {
  789. var vm = this
  790. var otherCode, otherName
  791. var planDetailId = vm.plandetailid
  792. if (vm.docInfo.doctorType == 1) {
  793. if (docInfo.uid == data.specialistDoctorCode) {
  794. //当前医生为创建计划的专科医生,与全科医生聊天
  795. otherCode = data.familyDoctorCode
  796. otherName = data.familyDoctorName
  797. } else {
  798. //当前医生为专科,当前医生不是创建计划的专科医生,没反应
  799. return false
  800. }
  801. } else {
  802. otherCode = data.specialistDoctorCode
  803. otherName = data.specialistDoctorName
  804. }
  805. top.layer.open({
  806. type: 2,
  807. area: ['660px', '600px'],
  808. shade: 0.5,
  809. title: '指导留言',
  810. fixed: true, //不固定
  811. maxmin: true,
  812. closeBtn: 1,
  813. shift: 5,
  814. shadeClose: false, //点击遮罩关闭层
  815. content: '../../consulting/html/consulting.html?otherCode=' + otherCode + '&otherName=' + encodeURI(otherName) + '&planDetailId=' + planDetailId,
  816. end: function () {
  817. // 未点击确定按钮,点击关闭按钮
  818. vm.initData()
  819. }
  820. })
  821. },
  822. //康复指导
  823. kfzd: function () {
  824. var vm = this
  825. KFZDlayerIndex = layer.open({
  826. type: 2,
  827. // offset: ['100px'], //右下角弹出
  828. area: ['660px', '650px'],
  829. shade: 0.5,
  830. title: '康复指导',
  831. fixed: true, //不固定
  832. maxmin: true,
  833. closeBtn: 1,
  834. shift: 5,
  835. shadeClose: false, //点击遮罩关闭层
  836. content:
  837. '../../rehabilitation/html/rehabilitation_guidance.html?patient=' + vm.patientcode + '&planDetaiId=' + vm.planDetaiId + '&planId=' + vm.planid + '&isRecordId=true',
  838. end: function () {
  839. // 未点击确定按钮,点击关闭按钮
  840. vm.initData()
  841. }
  842. })
  843. },
  844. // 康复随访计划
  845. sfjh: function () {
  846. var vm = this
  847. followupLayerIndex = layer.open({
  848. type: 2,
  849. // offset: ['100px'], //右下角弹出
  850. area: ['660px', '650px'],
  851. shade: 0.5,
  852. title: '随访计划',
  853. fixed: true, //不固定
  854. maxmin: true,
  855. closeBtn: 1,
  856. shift: 5,
  857. shadeClose: false, //点击遮罩关闭层
  858. content: '../../followup/html/followup_newplan.html?patient=' + vm.patientcode + '&planDetaiId=' + vm.planDetaiId + '&planId=' + vm.planid,
  859. end: function () {
  860. // 未点击确定按钮,点击关闭按钮
  861. vm.initData()
  862. }
  863. })
  864. },
  865. upLoadImgToBase64: function () {
  866. var vm = this
  867. var img1 = event.target.files[0]
  868. var reader = new FileReader()
  869. var type = img1.type //文件的类型,判断是否是图片
  870. var size = img1.size //文件的大小,判断图片的大小
  871. if (this.imgData.accept.indexOf(type) == -1) {
  872. alert('请选择我们支持的图片格式!')
  873. return false
  874. }
  875. if (size > 3145728) {
  876. alert('请选择3M以内的图片!')
  877. return false
  878. }
  879. reader.readAsDataURL(img1)
  880. reader.onload = function (e) {
  881. vm.upImgs.push({
  882. baseUrl: e.target.result
  883. })
  884. vm.upImgArr.push(img1)
  885. vm.uploadImg(vm.upImgArr)
  886. }
  887. },
  888. //上传图片
  889. uploadImg: function (data) {
  890. var vm = this
  891. var len = data.length
  892. if (len == 0) {
  893. return
  894. } else {
  895. var file = data[len - 1]
  896. var formData = new FormData()
  897. formData.append('file', file)
  898. rehaAPI.upload(formData).then(function (res) {
  899. if (res.status == 200) {
  900. vm.upImgs[len - 1].img = res.data
  901. data.pop()
  902. vm.$forceUpdate()
  903. vm.uploadImg(data)
  904. } else {
  905. layer.msg(res.msg, {
  906. icon: 5
  907. })
  908. }
  909. })
  910. }
  911. },
  912. saveRehabilitationOperateRecord: function (planDetailId, type, relationCode, flag) {
  913. var vm = this
  914. var patientName = vm.patientname
  915. var patientCode = vm.patientcode
  916. var _image = []
  917. for (var i in vm.upImgs) {
  918. _image.push(vm.upImgs[i].img)
  919. }
  920. var params = {
  921. rehabilitationDetailId: planDetailId,
  922. node: vm.node || '',
  923. patientCode: patientCode,
  924. doctorCode: vm.docInfo.uid,
  925. relationRecordType: type,
  926. relationRecordCode: '',
  927. relationRecordImg: '',
  928. status: flag && flag == 2 ? 1 : 0, // 改记录的状态
  929. relationCode: relationCode, //业务id
  930. flag: flag //标记(1随访2临时随访)
  931. }
  932. rehaAPI.saveRehabilitationOperateRecord({ dataJson: JSON.stringify(params) }).then(function (res) {
  933. if (res.status == 200) {
  934. if (type == 1) {
  935. vm.updateNoteAndImageRehabilitationOperate(planDetailId)
  936. } else if (type == 6) {
  937. vm.updateRelationCodeByDetailId(planDetailId, relationCode)
  938. } else {
  939. vm.updateNoteAndImageRehabilitationOperate(planDetailId)
  940. }
  941. } else {
  942. showErrorMessage(res.msg)
  943. }
  944. })
  945. },
  946. getPatientInfo(code) {
  947. var vm = this
  948. httpRequest.post('doctor/patient_label_info/patient', { data: { patient: code } }).then(function (res) {
  949. vm.patientInfo = res.data
  950. })
  951. },
  952. updateNoteAndImageRehabilitationOperate: function (planDetailId, relationCode) {
  953. var vm = this
  954. var _image = []
  955. for (var i in vm.upImgs) {
  956. _image.push(vm.upImgs[i].img)
  957. }
  958. var params = {
  959. planDetailId: planDetailId,
  960. node: vm.node || '',
  961. image: JSON.stringify(_image) || ''
  962. }
  963. if (relationCode) {
  964. params['relationCode'] = relationCode
  965. }
  966. var loadding = top.layer.load(0, {
  967. shade: false
  968. }) //0代表加载的风格,支持0-2
  969. rehaAPI.updateNoteAndImageRehabilitationOperate(params).then(function (res) {
  970. top.layer.close(loadding)
  971. if (res.status == 200) {
  972. vm.initData()
  973. } else {
  974. showErrorMessage(res.msg)
  975. }
  976. })
  977. },
  978. onViewDetail: function (item, type) {
  979. var vm = this
  980. if (this.scList == 0) {
  981. this.$confirm('提示该居民近一年没有进行冠心病风险评估,请先进行评估,再进行随访登记', '提示', {
  982. confirmButtonText: '确定',
  983. cancelButtonText: '取消',
  984. type: 'warning'
  985. }).then(function () {
  986. top.layer.open({
  987. type: 2,
  988. area: ['820px', '648px'],
  989. shade: 0.5,
  990. title: 'ASCVD风险评估',
  991. fixed: true, //不固定
  992. maxmin: true,
  993. closeBtn: 1,
  994. shift: 5,
  995. shadeClose: false, //点击遮罩关闭层
  996. content:
  997. `../../jbsc/html/questionnaire.html?fliter_code=6bcd306aaafb4e4381071346d86fadbb1&fliter_title=ASCVD风险评估&resident_code=${vm.patientInfo.code}&resident_name=${vm.patientInfo.name}&surveyStatus=2&age=${vm.patientInfo.age}&noswitch=1`
  998. })
  999. })
  1000. } else {
  1001. var planids, recordId
  1002. if (this.islimit) {
  1003. planids = item.id
  1004. } else {
  1005. planids = item.id
  1006. recordId = item.recordId
  1007. }
  1008. this.viewDetail(planids, type, recordId)
  1009. }
  1010. },
  1011. getList: function () {
  1012. var vm = this
  1013. var params = {
  1014. doctor: vm.docInfo1.code,
  1015. diseaseType: vm.service.disease,
  1016. type: '',
  1017. patientName: '',
  1018. patientCode: vm.patientcode,
  1019. isDanger: '',
  1020. pageNo: 1,
  1021. pageSize: 1,
  1022. filterType: 1,
  1023. isAscvd: vm.service.disease == '3' ? 1 : ''
  1024. }
  1025. rehaAPI.getList(params).then(function (res) {
  1026. vm.scList = res.data
  1027. })
  1028. },
  1029. viewDetail: function (planids, type, recordId) {
  1030. var vm = this
  1031. if (!planids) {
  1032. layer.msg('无服务项', { icon: 5 })
  1033. return
  1034. }
  1035. if (type == 1) {
  1036. // 单个服务项
  1037. var s = '../../rehabilitation/html/guide_the_message.html?planid=' + planids + '&pId=' + vm.planid + '&patient=' + vm.patientcode + '&patientName=' + vm.patientname
  1038. if (recordId) {
  1039. s += '&recordId=' + recordId
  1040. }
  1041. layer.open({
  1042. type: 2,
  1043. area: ['800px', '700px'],
  1044. shade: 0.5,
  1045. title: '服务项目内容',
  1046. fixed: true, //不固定
  1047. maxmin: true,
  1048. closeBtn: 1,
  1049. shift: 5,
  1050. shadeClose: false, //点击遮罩关闭层
  1051. content: s,
  1052. end: function () {
  1053. // 未点击确定按钮,点击关闭按钮
  1054. vm.initData() // 刷新
  1055. }
  1056. })
  1057. return
  1058. }
  1059. layer.open({
  1060. // 康复计划的所有服务项
  1061. type: 2,
  1062. area: ['800px', '700px'],
  1063. shade: 0.5,
  1064. title: '服务项目内容',
  1065. fixed: true, //不固定
  1066. maxmin: true,
  1067. closeBtn: 1,
  1068. shift: 5,
  1069. shadeClose: false, //点击遮罩关闭层
  1070. content:
  1071. '../../rehabilitation/html/service_item_content.html?planids=' +
  1072. planids +
  1073. '&planId=' +
  1074. vm.planid +
  1075. '&patient=' +
  1076. vm.patientcode +
  1077. '&patientName=' +
  1078. vm.patientname +
  1079. '&disease=' +
  1080. vm.service.disease +
  1081. '&scLenght=' +
  1082. vm.scList.length,
  1083. end: function () {
  1084. vm.initData()
  1085. }
  1086. })
  1087. },
  1088. onClose: function () {
  1089. this.$emit('onclose')
  1090. },
  1091. qwapp: function () {
  1092. layer.msg('请前往app处理', { icon: 5 })
  1093. },
  1094. getContent: function (value, type) {
  1095. var res = value
  1096. if (type == 2 || type == 9) {
  1097. res = "<img src='" + httpRequest.getImgUrl(res) + "' width='100px'>"
  1098. } else if (type == 3) {
  1099. res = '【语音】'
  1100. } else if (type == 19) {
  1101. res = '【聊天记录】'
  1102. } else if (type == 12) {
  1103. res = '【视频】'
  1104. }
  1105. return res
  1106. },
  1107. previewImg: function (url) {
  1108. imgShow('#outerdiv', '#innerdiv', '#bigimg', url)
  1109. },
  1110. toDoorDialog() {
  1111. var vm = this
  1112. top.layer.open({
  1113. type: 2,
  1114. area: ['850px', '700px'],
  1115. shade: 0.5,
  1116. title: '代预约',
  1117. fixed: true, //不固定
  1118. maxmin: true,
  1119. closeBtn: 1,
  1120. // shift: 5,
  1121. shadeClose: false, //点击遮罩关闭层
  1122. content: `../../rehabilitation/html/toDoorService.html?patient=${this.patientcode}&detailId=${this.plandetailid}`,
  1123. end: function () {
  1124. vm.getServiceItem()
  1125. }
  1126. })
  1127. }
  1128. }
  1129. })
  1130. function imgShow(outerdiv, innerdiv, bigimg, _this) {
  1131. var src = _this.attr('src') //获取当前点击的pimg元素中的src属性
  1132. $(bigimg).attr('src', src) //设置#bigimg元素的src属性
  1133. /*获取当前点击图片的真实大小,并显示弹出层及大图*/
  1134. $('<img/>')
  1135. .attr('src', src)
  1136. .load(function () {
  1137. var windowW = $(window).width() //获取当前窗口宽度
  1138. var windowH = $(window).height() //获取当前窗口高度
  1139. var realWidth = this.width //获取图片真实宽度
  1140. var realHeight = this.height //获取图片真实高度
  1141. var imgWidth, imgHeight
  1142. var scale = 0.8 //缩放尺寸,当图片真实宽度和高度大于窗口宽度和高度时进行缩放
  1143. if (realHeight > windowH * scale) {
  1144. //判断图片高度
  1145. imgHeight = windowH * scale //如大于窗口高度,图片高度进行缩放
  1146. imgWidth = (imgHeight / realHeight) * realWidth //等比例缩放宽度
  1147. if (imgWidth > windowW * scale) {
  1148. //如宽度扔大于窗口宽度
  1149. imgWidth = windowW * scale //再对宽度进行缩放
  1150. }
  1151. } else if (realWidth > windowW * scale) {
  1152. //如图片高度合适,判断图片宽度
  1153. imgWidth = windowW * scale //如大于窗口宽度,图片宽度进行缩放
  1154. imgHeight = (imgWidth / realWidth) * realHeight //等比例缩放高度
  1155. } else {
  1156. //如果图片真实高度和宽度都符合要求,高宽不变
  1157. imgWidth = realWidth
  1158. imgHeight = realHeight
  1159. }
  1160. $(bigimg).css('width', imgWidth) //以最终的宽度对图片缩放
  1161. var w = (windowW - imgWidth) / 2 //计算图片与窗口左边距
  1162. var h = (windowH - imgHeight) / 2 //计算图片与窗口上边距
  1163. $(innerdiv).css({ 'top': h, 'left': w }) //设置#innerdiv的top和left属性
  1164. $(outerdiv).fadeIn('fast') //淡入显示#outerdiv及.pimg
  1165. })
  1166. $(outerdiv).click(function () {
  1167. //再次点击淡出消失弹出层
  1168. $(this).fadeOut('fast')
  1169. })
  1170. }