Scheduling.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. <template>
  2. <view style="width: 100%;height: 100%;">
  3. <!-- 选择周 -->
  4. <u-select v-model="show" :list="list" @confirm="choiceNew"></u-select>
  5. <!-- 选择医院 -->
  6. <u-select v-model="hospitalshow" mode="single-column" :list="hospitalList" @confirm="confirmhospital"></u-select>
  7. <!-- 新增-->
  8. <view>
  9. <view style="padding: 30rpx 35rpx;color: #666666;" class="flex justify-between ">
  10. <view @click="show = true">
  11. <text style="margin-right: 20rpx;">选择排班周</text>
  12. <u-icon name="arrow-down" color="#666666" size="28" v-if="!show"></u-icon>
  13. <u-icon name="arrow-up" color="#666666" size="28" v-else></u-icon>
  14. </view>
  15. <view @click="hospitalshow = true">
  16. <text style="margin-right: 20rpx;">选择排班医院</text>
  17. <u-icon name="arrow-down" color="#666666" size="28" v-if="!hospitalshow"></u-icon>
  18. <u-icon name="arrow-up" color="#666666" size="28" v-else></u-icon>
  19. </view>
  20. </view>
  21. <view class="flex justify-around align-center" style="height: 100rpx;width: 100%;background-color: #fff;font-size: 28rpx;font-weight: bold;border-bottom: 1rpx solid #cecece;">
  22. <text>{{time==''?'请选择排班时间':time}}\n</text>
  23. <text>{{hospital==''?'请选择排班医院':hospital}}</text>
  24. </view>
  25. <!-- 标题 -->
  26. <view class="flex" style="background-color: #FFFFFF;">
  27. <!-- 时间 -->
  28. <view class="title" style="width: 20%;">时间</view>
  29. <u-line color="#cecece" direction="col" />
  30. <!-- 上午 -->
  31. <view class="title" style="width: 26%;">上午</view>
  32. <u-line color="#cecece" direction="col" />
  33. <!-- 下午 -->
  34. <view class="title" style="width: 26%;">下午</view>
  35. <u-line color="#cecece" direction="col" />
  36. <!-- 晚上 -->
  37. <view class="title" style="width: 26%;">晚上</view>
  38. </view>
  39. <!-- 表格一条内容 循环七遍-->
  40. <view v-for="(item,index) in hospitalWeek" :key='index'>
  41. <u-line color="#cecece" />
  42. <!-- 星期一 -->
  43. <view class="flex" style="background-color: #FFFFFF;">
  44. <view class="content" style="width: 20%;font-weight: bold;">
  45. <view>
  46. <view style="text-align: center;">{{item.value}}</view>
  47. <view style="text-align: center;">{{item.title}}</view>
  48. </view>
  49. </view>
  50. <u-checkbox-group style="width: 80%;height: 100%;">
  51. <view class="flex justify-around align-center" style="padding: 40rpx 0;">
  52. <u-checkbox v-model="hitem.checked" v-for="(hitem, hindex) in item.hospital" :key="hindex" :disabled="hitem.disabled"
  53. @change="horg(index,hindex)"></u-checkbox>
  54. </view>
  55. </u-checkbox-group>
  56. </view>
  57. </view>
  58. </view>
  59. <view style="height: 200rpx;"></view>
  60. <!-- 保存 -->
  61. <view class="bottomButton" @click="modalShow=!modalShow">
  62. 保存
  63. </view>
  64. <u-modal v-model="modalShow" content="确定要保存?" @confirm="bc" :show-cancel-button="true"></u-modal>
  65. <u-modal v-model="remindshow" content="这天是法定节假日,确定要排班吗?" @confirm="remindshow=remind=false" :show-cancel-button="true"></u-modal>
  66. </view>
  67. </template>
  68. <script>
  69. export default {
  70. data() {
  71. return {
  72. //标题上显示的医院。也就是当前选中医院
  73. hospital: '',
  74. hosptialId: '',
  75. //标题上显示的
  76. time:'',
  77. //弹窗
  78. modalShow: false,
  79. //切换历史和新增
  80. old: false,
  81. //新增的排班选择 最多排四周
  82. show: false,
  83. list: [{
  84. value: '0',
  85. label: '2020.10.26 - 2020-11-1'
  86. }, {
  87. value: '1',
  88. label: '2020.11.2 - 2020-11-8'
  89. }, {
  90. value: '2',
  91. label: '2020.11.9 - 2020-11-15'
  92. }, {
  93. value: '3',
  94. label: '2020.11.16 - 2020-11-22'
  95. }],
  96. //新增一周的数据 title不可更改 value日期 其余 上 下 晚
  97. hospitalWeek: [{
  98. title: '周一',
  99. value: '10-26',
  100. hospital: [{
  101. name: '早上',
  102. organization_id: 0,
  103. checked: false,
  104. disabled: false
  105. }, {
  106. organization_id: 0,
  107. name: '下午',
  108. checked: false,
  109. disabled: false
  110. }, {
  111. name: '晚上',
  112. organization_id: 0,
  113. checked: false,
  114. disabled: false
  115. }],
  116. }, {
  117. title: '周二',
  118. value: '10-27',
  119. hospital: [{
  120. name: '早上',
  121. organization_id: 0,
  122. checked: false,
  123. disabled: false
  124. }, {
  125. name: '下午',
  126. organization_id: 0,
  127. checked: false,
  128. disabled: false
  129. }, {
  130. name: '晚上',
  131. organization_id: 0,
  132. checked: false,
  133. disabled: false
  134. }],
  135. }, {
  136. title: '周三',
  137. value: '10-28',
  138. hospital: [{
  139. name: '早上',
  140. organization_id: 0,
  141. checked: false,
  142. disabled: false
  143. }, {
  144. name: '下午',
  145. organization_id: 0,
  146. checked: false,
  147. disabled: false
  148. }, {
  149. name: '晚上',
  150. organization_id: 0,
  151. checked: false,
  152. disabled: false
  153. }],
  154. }, {
  155. title: '周四',
  156. value: '10-29',
  157. hospital: [{
  158. name: '早上',
  159. organization_id: 0,
  160. checked: false,
  161. disabled: false
  162. }, {
  163. name: '下午',
  164. organization_id: 0,
  165. checked: false,
  166. disabled: false
  167. }, {
  168. name: '晚上',
  169. organization_id: 0,
  170. checked: false,
  171. disabled: false
  172. }],
  173. }, {
  174. title: '周五',
  175. value: '10-30',
  176. hospital: [{
  177. name: '早上',
  178. organization_id: 0,
  179. checked: false,
  180. disabled: false
  181. }, {
  182. name: '下午',
  183. organization_id: 0,
  184. checked: false,
  185. disabled: false
  186. }, {
  187. name: '晚上',
  188. organization_id: 0,
  189. checked: false,
  190. disabled: false
  191. }],
  192. }, {
  193. title: '周六',
  194. value: '10-31',
  195. hospital: [{
  196. name: '早上',
  197. organization_id: 0,
  198. checked: false,
  199. disabled: false
  200. }, {
  201. name: '下午',
  202. organization_id: 0,
  203. checked: false,
  204. disabled: false
  205. }, {
  206. name: '晚上',
  207. organization_id: 0,
  208. checked: false,
  209. disabled: false
  210. }],
  211. }, {
  212. title: '周日',
  213. value: '11-01',
  214. hospital: [{
  215. name: '早上',
  216. organization_id: 0,
  217. checked: false,
  218. disabled: false
  219. }, {
  220. name: '下午',
  221. organization_id: 0,
  222. checked: false,
  223. disabled: false
  224. }, {
  225. name: '晚上',
  226. organization_id: 0,
  227. checked: false,
  228. disabled: false
  229. }],
  230. }],
  231. saveList: [{
  232. title: '周一',
  233. value: '10-26',
  234. hospital: [{
  235. name: '早上',
  236. organization_id: 0,
  237. checked: true,
  238. disabled: true
  239. }, {
  240. organization_id: 0,
  241. name: '下午',
  242. checked: false
  243. }, {
  244. name: '晚上',
  245. organization_id: 0,
  246. checked: false
  247. }],
  248. }, {
  249. title: '周二',
  250. value: '10-27',
  251. hospital: [{
  252. name: '早上',
  253. organization_id: 0,
  254. checked: false
  255. }, {
  256. name: '下午',
  257. organization_id: 0,
  258. checked: false
  259. }, {
  260. name: '晚上',
  261. organization_id: 0,
  262. checked: false
  263. }],
  264. }, {
  265. title: '周三',
  266. value: '10-28',
  267. hospital: [{
  268. name: '早上',
  269. organization_id: 0,
  270. checked: false
  271. }, {
  272. name: '下午',
  273. organization_id: 0,
  274. checked: false
  275. }, {
  276. name: '晚上',
  277. organization_id: 0,
  278. checked: false
  279. }],
  280. }, {
  281. title: '周四',
  282. value: '10-29',
  283. hospital: [{
  284. name: '早上',
  285. organization_id: 0,
  286. checked: false
  287. }, {
  288. name: '下午',
  289. organization_id: 0,
  290. checked: false
  291. }, {
  292. name: '晚上',
  293. organization_id: 0,
  294. checked: false
  295. }],
  296. }, {
  297. title: '周五',
  298. value: '10-30',
  299. hospital: [{
  300. name: '早上',
  301. organization_id: 0,
  302. checked: false
  303. }, {
  304. name: '下午',
  305. organization_id: 0,
  306. checked: false
  307. }, {
  308. name: '晚上',
  309. organization_id: 0,
  310. checked: false
  311. }],
  312. }, {
  313. title: '周六',
  314. value: '10-31',
  315. hospital: [{
  316. name: '早上',
  317. organization_id: 0,
  318. checked: false
  319. }, {
  320. name: '下午',
  321. organization_id: 0,
  322. checked: false
  323. }, {
  324. name: '晚上',
  325. organization_id: 0,
  326. checked: false
  327. }],
  328. }, {
  329. title: '周日',
  330. value: '11-01',
  331. hospital: [{
  332. name: '早上',
  333. organization_id: 0,
  334. checked: false
  335. }, {
  336. name: '下午',
  337. organization_id: 0,
  338. checked: false
  339. }, {
  340. name: '晚上',
  341. organization_id: 0,
  342. checked: false
  343. }],
  344. }],
  345. //选择医院
  346. hospitalList: [],
  347. hospitalshow: false,
  348. //当前点击的位置
  349. position: {
  350. day: '',
  351. time: '' //1早2下3晚
  352. },
  353. //选择排班提醒
  354. remind: true,
  355. remindshow: false
  356. }
  357. },
  358. methods: {
  359. cliold: async function(e) {
  360. let times = e[0].label;
  361. times = times.split(" 至 ");
  362. let startime = times[0];
  363. let endtime = times[1];
  364. let weekArr = this.getDateStr(startime, endtime, 0);
  365. let res = await this.$request.post("doctor/getLinsDetail", {
  366. 'start_date': startime,
  367. 'end_date': endtime
  368. });
  369. console.log('老得:', this.oldWeek);
  370. console.log('新的', res.data);
  371. if (res.status == 0) {
  372. if (typeof res.data.list[0] != undefined && typeof res.data[0] != 'undefined') {
  373. let data = res.data.list;
  374. let arr = [];
  375. for (let i = 0; i < this.oldWeek.length; i++) {
  376. for (let p = 0; p < data.length; p++) {
  377. if (this.oldWeek[i].value == data[p].schedule_date) {
  378. this.oldWeek[i].morning = data[p].type.zao ? data[p].type.zao : '暂无';
  379. this.oldWeek[i].afternoon = data[p].type.xia ? data[p].type.xia : '暂无';
  380. this.oldWeek[i].night = data[p].type.wan ? data[p].type.wan : '暂无';
  381. }
  382. }
  383. }
  384. } else {
  385. for (let i = 0; i < this.oldWeek.length; i++) {
  386. this.oldWeek[i].morning = '暂无';
  387. this.oldWeek[i].afternoon = '暂无';
  388. this.oldWeek[i].night = '暂无';
  389. }
  390. }
  391. }
  392. },
  393. getDateStr(startDate, endDate, dayLength) {
  394. var str = startDate;
  395. for (var i = 0;; i++) {
  396. var getDate = this.getTargetDate(startDate, dayLength);
  397. startDate = getDate;
  398. if (getDate <= endDate) {
  399. str += ',' + getDate;
  400. } else {
  401. break;
  402. }
  403. }
  404. let dates = str.split(',');
  405. let arr = [];
  406. let obj;
  407. for (let i = 0; i < 7; i++) {
  408. obj = {
  409. title: this.getweeks(dates[i]),
  410. value: dates[i].substring(5),
  411. morning: '暂无',
  412. afternoon: '暂无',
  413. night: '暂无',
  414. }
  415. arr.push(obj)
  416. }
  417. this.oldWeek = arr
  418. },
  419. getweeks(date) {
  420. var weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  421. var dateStr = date;
  422. var myDate = new Date(Date.parse(dateStr.replace(/-/g, "/")));
  423. return weekDay[myDate.getDay()]
  424. },
  425. // startDate: 开始时间;dayLength:每隔几天,0-代表获取每天,1-代表日期间隔一天
  426. getTargetDate(date, dayLength) {
  427. dayLength = dayLength + 1;
  428. var tempDate = new Date(date);
  429. tempDate.setDate(tempDate.getDate() + dayLength);
  430. var year = tempDate.getFullYear();
  431. var month = tempDate.getMonth() + 1 < 10 ? "0" + (tempDate.getMonth() + 1) : tempDate.getMonth() + 1;
  432. var day = tempDate.getDate() < 10 ? "0" + tempDate.getDate() : tempDate.getDate();
  433. return year + "-" + month + "-" + day;
  434. },
  435. //点击新增周
  436. choiceNew(e) {
  437. this.hospitalWeek.map(val => {
  438. val.hospital[0].disabled = false;
  439. val.hospital[1].disabled = false;
  440. val.hospital[2].disabled = false;
  441. })
  442. console.log(e)
  443. this.time = e[0].label
  444. var bData = new Date();
  445. bData.setTime(bData.getTime() + 24 * 60 * 60 * 1000 * (8 - bData.getDay() + (7 * e[0].value)))
  446. for (let i = 0; i < 7; i++) {
  447. var week = (bData.getMonth() + 1) + "-" + this.Appendzero(bData.getDate());
  448. bData.setTime(bData.getTime() + 24 * 60 * 60 * 1000 * 1);
  449. this.hospitalWeek[i].value = week
  450. this.saveList[i].schedule_date = '2020-' + week
  451. }
  452. this.getTemplate()
  453. },
  454. //提示是节假日,每次进入页面只会提示一次
  455. festival(day, time) {
  456. if (day > 4 && this.remind) {
  457. this.remindshow = true
  458. }
  459. this.position.day = day
  460. this.position.time = time
  461. this.hospitalshow = true
  462. },
  463. /**
  464. * 选择医院逻辑
  465. * @author 刘远航
  466. * @param {Object} e
  467. */
  468. confirmhospital: async function(e) {
  469. if(this.hospital == ''){
  470. this.hospital = e[0].label
  471. this.confirmhospital(e)
  472. this.hosptialId = e[0].value;
  473. this.getTemplate()
  474. }
  475. console.log('选择医院:',e[0])
  476. console.log('zhi:',this.hospital)
  477. //保存上一次操作并更换操作的医院
  478. this.hosptialId = e[0].value;
  479. this.hospital = e[0].label
  480. for (let i = 0; i < this.hospitalWeek.length; i++) {
  481. for (let k = 0; k < this.hospitalWeek[i].hospital.length; k++) {
  482. if (this.hospitalWeek[i].hospital[k].organization_id != 0 && this.hospitalWeek[i].hospital[k].organization_id !=
  483. this.hosptialId) {
  484. this.hospitalWeek[i].hospital[k]['disabled'] = true;
  485. } else {
  486. if (this.hospitalWeek[i].hospital[k].flag == undefined || this.hospitalWeek[i].hospital[k].flag == 'undefined' ||
  487. this.hospitalWeek[i].hospital[k].flag == false) {
  488. this.hospitalWeek[i].hospital[k]['disabled'] = false;
  489. }
  490. }
  491. }
  492. }
  493. },
  494. /**
  495. * 提交方法
  496. * @author Liu Yh
  497. * @param {Object} e
  498. */
  499. bc: async function(e) {
  500. console.log('hospitalWeek', this.hospitalWeek)
  501. let that = this;
  502. let forms = JSON.stringify(that.saveList);
  503. console.log("forms", that.saveList)
  504. let res = await that.$request.post("doctor/scheduling", {
  505. data: forms
  506. });
  507. if (res.status == 0) {
  508. uni.showToast({
  509. duration: 2000,
  510. title: '排班成功'
  511. })
  512. uni.switchTab({
  513. url: '/pages/index/index'
  514. })
  515. } else {
  516. uni.showModal({
  517. duration: 2000,
  518. title: res.message,
  519. })
  520. }
  521. },
  522. //获取时间
  523. getTime() {
  524. var week = [{
  525. value: 1,
  526. label: ''
  527. }, {
  528. value: 2,
  529. label: ''
  530. }, {
  531. value: 3,
  532. label: ''
  533. }, {
  534. value: 4,
  535. label: ''
  536. }]
  537. //直接获取这周五的时间,然后遍历 给选择器
  538. var aData = new Date();
  539. aData.setTime(aData.getTime() + 24 * 60 * 60 * 1000 * (7 - aData.getDay()))
  540. for (let i = 0; i < 4; i++) {
  541. aData.setTime(aData.getTime() + 24 * 60 * 60 * 1000 * 1)
  542. var week1 = aData.getFullYear() + "." + (aData.getMonth() + 1) + "." + this.Appendzero(aData.getDate());
  543. console.log('第', i + 1, '个周一的时间', week1) //周一的时间
  544. //周日
  545. aData.setTime(aData.getTime() + 24 * 60 * 60 * 1000 * (aData.getDay() + 5))
  546. var week2 = aData.getFullYear() + "." + (aData.getMonth() + 1) + "." + this.Appendzero(aData.getDate());
  547. console.log('第', i + 1, '个周日的时间', week2) //周日的时间
  548. this.list[i].label = week1 + ' - ' + week2 //给选择器数组
  549. }
  550. //直接获取下周一时间,给表格
  551. var bData = new Date();
  552. bData.setTime(bData.getTime() + 24 * 60 * 60 * 1000 * (8 - bData.getDay()))
  553. for (let i = 0; i < 7; i++) {
  554. var week = (bData.getMonth() + 1) + "-" + this.Appendzero(bData.getDate());
  555. console.log('号:', week)
  556. bData.setTime(bData.getTime() + 24 * 60 * 60 * 1000 * 1);
  557. this.hospitalWeek[i].value = week
  558. this.saveList[i].schedule_date = '2020-' + week
  559. }
  560. // this.getTemplate()
  561. // var date = new Date();
  562. // var seperator1 = "-";
  563. // var seperator2 = ":";
  564. // //以下代码依次是获取当前时间的年月日时分秒
  565. // var year = date.getFullYear();
  566. // var month = date.getMonth() + 1;
  567. // var strDate = date.getDate();
  568. // var minute = date.getMinutes();
  569. // var hour = date.getHours();
  570. // var second = date.getSeconds();
  571. // //固定时间格式
  572. // if (month >= 1 && month <= 9) {
  573. // month = "0" + month;
  574. // }
  575. // if (strDate >= 0 && strDate <= 9) {
  576. // strDate = "0" + strDate;
  577. // }
  578. // var currentdate = year + seperator1 + month + seperator1 + strDate
  579. // var dateArray = nowTime.split("-");
  580. // var date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
  581. // var week = "星期" + "日一二三四五六".charAt(date.getDay());
  582. // this.nowWeek = week // 赋值本地数据
  583. // alert(week)
  584. // return currentdate;
  585. },
  586. /**
  587. * @author Liu Yh
  588. * 时间补0
  589. * @param {Object} obj
  590. */
  591. Appendzero(obj) {
  592. if (obj < 10) return "0" + "" + obj;
  593. else return obj;
  594. },
  595. /**
  596. * @author Liu Yh
  597. * 获取信息模板
  598. */
  599. getTemplate: async function() {
  600. for (let i = 0; i < this.hospitalWeek.length; i++) {
  601. for (let k = 0; k < this.hospitalWeek[i].hospital.length; k++) {
  602. this.hospitalWeek[i].hospital[0]['disabled'] = false;
  603. this.hospitalWeek[i].hospital[1]['disabled'] = false;
  604. this.hospitalWeek[i].hospital[2]['disabled'] = false;
  605. this.hospitalWeek[i].hospital[0].organization_id = 0;
  606. this.hospitalWeek[i].hospital[1].organization_id = 0;
  607. this.hospitalWeek[i].hospital[2].organization_id = 0;
  608. this.hospitalWeek[i].hospital[0].checked = false;
  609. this.hospitalWeek[i].hospital[1].checked = false;
  610. this.hospitalWeek[i].hospital[2].checked = false;
  611. }
  612. }
  613. // let that = this;
  614. let startTime = '2020-' + this.hospitalWeek[0].value;
  615. let endTime = '2020-' + this.hospitalWeek[6].value;
  616. let res = await this.$request.post("doctor/getLinsDetail", {
  617. 'start_date': startTime,
  618. 'end_date': endTime
  619. });
  620. console.log(res.data);
  621. if (res.status == 0) {
  622. if (typeof res.data.list[0] != undefined && typeof res.data.list[0] != 'undefined') {
  623. let data = res.data.list;
  624. let arr = [];
  625. for (let i = 0; i < this.hospitalWeek.length; i++) {
  626. for (let p = 0; p < data.length; p++) {
  627. if (this.hospitalWeek[i].value == data[p].schedule_date) {
  628. this.saveList[i].hospital[0].organization_id = data[p].type.zao_id;
  629. this.saveList[i].hospital[1].organization_id = data[p].type.xia_id;
  630. this.saveList[i].hospital[2].organization_id = data[p].type.wan_id;
  631. this.hospitalWeek[i].hospital[0].organization_id = data[p].type.zao_id;
  632. this.hospitalWeek[i].hospital[1].organization_id = data[p].type.xia_id;
  633. this.hospitalWeek[i].hospital[2].organization_id = data[p].type.wan_id;
  634. this.hospitalWeek[i].hospital[0].checked = data[p].type.zao_id == 0 ? false : true;
  635. this.hospitalWeek[i].hospital[1].checked = data[p].type.xia_id == 0 ? false : true;
  636. this.hospitalWeek[i].hospital[2].checked = data[p].type.wan_id == 0 ? false : true;
  637. // this.hospitalWeek[i].hospital[0]['flag'] = data[p].type.zao_flag;
  638. // this.hospitalWeek[i].hospital[1]['flag'] = data[p].type.xia_flag;
  639. // this.hospitalWeek[i].hospital[2]['flag'] = data[p].type.wan_flag;
  640. }
  641. }
  642. }
  643. for (let i = 0; i < this.hospitalWeek.length; i++) {
  644. for (let k = 0; k < this.hospitalWeek[i].hospital.length; k++) {
  645. if (this.hospitalWeek[i].hospital[k].organization_id != 0 && this.hospitalWeek[i].hospital[k].organization_id !=
  646. this.hosptialId) {
  647. this.hospitalWeek[i].hospital[k]['disabled'] = true;
  648. }
  649. }
  650. }
  651. } else {
  652. for (let i = 0; i < this.hospitalWeek.length; i++) {
  653. this.saveList[i].hospital[0].organization_id = 0;
  654. this.saveList[i].hospital[1].organization_id = 0;
  655. this.saveList[i].hospital[2].organization_id = 0;
  656. this.hospitalWeek[i].hospital[0].checked = false;
  657. this.hospitalWeek[i].hospital[1].checked = false;
  658. this.hospitalWeek[i].hospital[2].checked = false;
  659. }
  660. }
  661. }
  662. },
  663. /**
  664. * change事件
  665. * @author Liu Yh
  666. * @param {Object} index
  667. * @param {Object} hindex
  668. */
  669. horg(index, hindex) {
  670. if (this.hosptialId == '' || this.time == '') {
  671. uni.showModal({
  672. title: '先选择医院否则无法提交',
  673. })
  674. return false;
  675. }
  676. if (this.hospitalWeek[index].hospital[hindex].organization_id != 0 && this.hospitalWeek[index].hospital[hindex].organization_id !=
  677. this.hosptialId) {
  678. this.hospitalWeek[index].hospital[hindex]['disabled'] = true;
  679. } else {
  680. this.hospitalWeek[index].hospital[hindex]['disabled'] = false;
  681. }
  682. if (!this.hospitalWeek[index].hospital[hindex]['checked'] == false) {
  683. this.hospitalWeek[index].hospital[hindex].organization_id = 0
  684. } else {
  685. this.hospitalWeek[index].hospital[hindex].organization_id = this.hosptialId;
  686. }
  687. var saveList = this.saveList
  688. var lists;
  689. let yeares = new Date().toISOString().slice(0, 4);
  690. // 医院的id
  691. saveList[index].hospital[hindex].organization_id = this.hospitalWeek[index].hospital[hindex].organization_id;
  692. // 是否选中 因为是change不同步所以区反
  693. saveList[index].hospital[hindex].checked = !this.hospitalWeek[index].hospital[hindex].checked;
  694. // 日期
  695. saveList[index].value = yeares + '-' + this.hospitalWeek[index].value
  696. },
  697. /**
  698. * 获取医院
  699. */
  700. gethospitalList: async function() {
  701. let that = this;
  702. let res = await that.$request.post("doctor/organizationList");
  703. if (res.status == 0) {
  704. that.hospitalList = res.data
  705. }
  706. console.log('医院', res);
  707. }
  708. },
  709. onLoad() {
  710. this.gethospitalList();
  711. this.getTime();
  712. // this.getOldList();
  713. // this.cliold()
  714. console.log(this.time)
  715. this.time = this.list[0].label
  716. },
  717. }
  718. </script>
  719. <style>
  720. page {
  721. background-color: #f0f0f0
  722. }
  723. .title {
  724. display: flex;
  725. justify-content: center;
  726. align-items: center;
  727. padding: 30rpx 0;
  728. font-weight: bold;
  729. }
  730. .content {
  731. display: flex;
  732. justify-content: center;
  733. align-items: center;
  734. padding: 30rpx 0;
  735. }
  736. /* 底部按钮 */
  737. .bottomButton {
  738. position: fixed;
  739. bottom: 0;
  740. left: 0;
  741. width: 100%;
  742. height: 100rpx;
  743. display: flex;
  744. align-items: center;
  745. justify-content: center;
  746. background-color: #0000ff;
  747. color: #FFFFFF;
  748. z-index: 1;
  749. }
  750. </style>