server-items-detail.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  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. console.log(item,"item",type);
  981. if (this.scList == 0&&item.code == '6'&& vm.docInfo.doctorType != '1') {
  982. this.$confirm('提示该居民近一年没有进行冠心病风险评估,请先进行评估,再进行随访登记', '提示', {
  983. confirmButtonText: '确定',
  984. cancelButtonText: '取消',
  985. type: 'warning'
  986. }).then(function () {
  987. top.layer.open({
  988. type: 2,
  989. area: ['820px', '648px'],
  990. shade: 0.5,
  991. title: 'ASCVD风险评估',
  992. fixed: true, //不固定
  993. maxmin: true,
  994. closeBtn: 1,
  995. shift: 5,
  996. shadeClose: false, //点击遮罩关闭层
  997. content:
  998. `../../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`
  999. })
  1000. })
  1001. } else {
  1002. var planids, recordId
  1003. if (this.islimit) {
  1004. planids = item.id
  1005. } else {
  1006. planids = item.id
  1007. recordId = item.recordId
  1008. }
  1009. this.viewDetail(planids, type, recordId)
  1010. }
  1011. },
  1012. getList: function () {
  1013. var vm = this
  1014. var params = {
  1015. doctor: vm.docInfo1.code,
  1016. diseaseType: vm.service.disease,
  1017. type: '',
  1018. patientName: '',
  1019. patientCode: vm.patientcode,
  1020. isDanger: '',
  1021. pageNo: 1,
  1022. pageSize: 1,
  1023. filterType: 1,
  1024. isAscvd: vm.service.disease == '3' ? 1 : ''
  1025. }
  1026. rehaAPI.getList(params).then(function (res) {
  1027. vm.scList = res.data
  1028. })
  1029. },
  1030. viewDetail: function (planids, type, recordId) {
  1031. var vm = this
  1032. if (!planids) {
  1033. layer.msg('无服务项', { icon: 5 })
  1034. return
  1035. }
  1036. if (type == 1) {
  1037. // 单个服务项
  1038. var s = '../../rehabilitation/html/guide_the_message.html?planid=' + planids + '&pId=' + vm.planid + '&patient=' + vm.patientcode + '&patientName=' + vm.patientname
  1039. if (recordId) {
  1040. s += '&recordId=' + recordId
  1041. }
  1042. layer.open({
  1043. type: 2,
  1044. area: ['800px', '700px'],
  1045. shade: 0.5,
  1046. title: '服务项目内容',
  1047. fixed: true, //不固定
  1048. maxmin: true,
  1049. closeBtn: 1,
  1050. shift: 5,
  1051. shadeClose: false, //点击遮罩关闭层
  1052. content: s,
  1053. end: function () {
  1054. // 未点击确定按钮,点击关闭按钮
  1055. vm.initData() // 刷新
  1056. }
  1057. })
  1058. return
  1059. }
  1060. layer.open({
  1061. // 康复计划的所有服务项
  1062. type: 2,
  1063. area: ['800px', '700px'],
  1064. shade: 0.5,
  1065. title: '服务项目内容',
  1066. fixed: true, //不固定
  1067. maxmin: true,
  1068. closeBtn: 1,
  1069. shift: 5,
  1070. shadeClose: false, //点击遮罩关闭层
  1071. content:
  1072. '../../rehabilitation/html/service_item_content.html?planids=' +
  1073. planids +
  1074. '&planId=' +
  1075. vm.planid +
  1076. '&patient=' +
  1077. vm.patientcode +
  1078. '&patientName=' +
  1079. vm.patientname +
  1080. '&disease=' +
  1081. vm.service.disease +
  1082. '&scLenght=' +
  1083. vm.scList.length,
  1084. end: function () {
  1085. vm.initData()
  1086. }
  1087. })
  1088. },
  1089. onClose: function () {
  1090. this.$emit('onclose')
  1091. },
  1092. qwapp: function () {
  1093. layer.msg('请前往app处理', { icon: 5 })
  1094. },
  1095. getContent: function (value, type) {
  1096. var res = value
  1097. if (type == 2 || type == 9) {
  1098. res = "<img src='" + httpRequest.getImgUrl(res) + "' width='100px'>"
  1099. } else if (type == 3) {
  1100. res = '【语音】'
  1101. } else if (type == 19) {
  1102. res = '【聊天记录】'
  1103. } else if (type == 12) {
  1104. res = '【视频】'
  1105. }
  1106. return res
  1107. },
  1108. previewImg: function (url) {
  1109. imgShow('#outerdiv', '#innerdiv', '#bigimg', url)
  1110. },
  1111. toDoorDialog() {
  1112. var vm = this
  1113. top.layer.open({
  1114. type: 2,
  1115. area: ['850px', '700px'],
  1116. shade: 0.5,
  1117. title: '代预约',
  1118. fixed: true, //不固定
  1119. maxmin: true,
  1120. closeBtn: 1,
  1121. // shift: 5,
  1122. shadeClose: false, //点击遮罩关闭层
  1123. content: `../../rehabilitation/html/toDoorService.html?patient=${this.patientcode}&detailId=${this.plandetailid}`,
  1124. end: function () {
  1125. vm.getServiceItem()
  1126. }
  1127. })
  1128. }
  1129. }
  1130. })
  1131. function imgShow(outerdiv, innerdiv, bigimg, _this) {
  1132. var src = _this.attr('src') //获取当前点击的pimg元素中的src属性
  1133. $(bigimg).attr('src', src) //设置#bigimg元素的src属性
  1134. /*获取当前点击图片的真实大小,并显示弹出层及大图*/
  1135. $('<img/>')
  1136. .attr('src', src)
  1137. .load(function () {
  1138. var windowW = $(window).width() //获取当前窗口宽度
  1139. var windowH = $(window).height() //获取当前窗口高度
  1140. var realWidth = this.width //获取图片真实宽度
  1141. var realHeight = this.height //获取图片真实高度
  1142. var imgWidth, imgHeight
  1143. var scale = 0.8 //缩放尺寸,当图片真实宽度和高度大于窗口宽度和高度时进行缩放
  1144. if (realHeight > windowH * scale) {
  1145. //判断图片高度
  1146. imgHeight = windowH * scale //如大于窗口高度,图片高度进行缩放
  1147. imgWidth = (imgHeight / realHeight) * realWidth //等比例缩放宽度
  1148. if (imgWidth > windowW * scale) {
  1149. //如宽度扔大于窗口宽度
  1150. imgWidth = windowW * scale //再对宽度进行缩放
  1151. }
  1152. } else if (realWidth > windowW * scale) {
  1153. //如图片高度合适,判断图片宽度
  1154. imgWidth = windowW * scale //如大于窗口宽度,图片宽度进行缩放
  1155. imgHeight = (imgWidth / realWidth) * realHeight //等比例缩放高度
  1156. } else {
  1157. //如果图片真实高度和宽度都符合要求,高宽不变
  1158. imgWidth = realWidth
  1159. imgHeight = realHeight
  1160. }
  1161. $(bigimg).css('width', imgWidth) //以最终的宽度对图片缩放
  1162. var w = (windowW - imgWidth) / 2 //计算图片与窗口左边距
  1163. var h = (windowH - imgHeight) / 2 //计算图片与窗口上边距
  1164. $(innerdiv).css({ 'top': h, 'left': w }) //设置#innerdiv的top和left属性
  1165. $(outerdiv).fadeIn('fast') //淡入显示#outerdiv及.pimg
  1166. })
  1167. $(outerdiv).click(function () {
  1168. //再次点击淡出消失弹出层
  1169. $(this).fadeOut('fast')
  1170. })
  1171. }