month_Scheduling.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. <template>
  2. <view style="width: 100%;height: 100%;">
  3. <!--医院列表 -->
  4. <u-select v-model="hospitalListShow" :list="hospitalList" @confirm="setSelectHospital"></u-select>
  5. <u-select v-model="timeShow" mode="mutil-column-auto" :list="timeList" @confirm="yearConfirm" :default-value="defaultIndex"></u-select>
  6. <!--日视图弹出层-->
  7. <u-popup v-model="popupShow" mode="bottom" border-radius="50" @close="closePopup">
  8. <!-- <view style="margin: 20rpx 0;" class="flex justify-center align-center">
  9. <u-icon name="arrow-down" @click="close()"></u-icon>
  10. </view> -->
  11. <!-- 标题按钮 -->
  12. <view class="flex justify-center align-center" style="padding: 30rpx 0;font-size: 38rpx;font-weight: bold;">
  13. <text style="flex-grow: 1;text-align: center;">{{day}}日排班详情</text>
  14. </view>
  15. <view v-if="monthList[day+empty-1].mon==0&&monthList[day+empty-1].aft==0&&monthList[day+empty-1].nig==0" style="height: 500rpx;"
  16. class="flex justify-center align-center">
  17. <view style="width: 80%;">
  18. <u-button shape="circle" :custom-style="otherStyle" @click="modify(0)">暂无排班 点击新增</u-button>
  19. </view>
  20. </view>
  21. <!-- 上下晚显示 -->
  22. <view class="flex justify-center align-center" style="" v-else>
  23. <view style="width: 80%;margin: 20rpx 0;text-align: center;font-size: 38rpx;">
  24. <view :class="monthList[day+empty-1].mon==0 ? 'nullStyle' : monthList[day+empty-1].mon==1 ? 'monStyle' :'otherStyle' "
  25. @click="modify(1)">上午</view>
  26. <text>{{hospitalTimes.zao.amStartTime}} 至 {{hospitalTimes.zao.amEndTime}}</text>
  27. <view :class="monthList[day+empty-1].aft==0 ? 'nullStyle' : monthList[day+empty-1].aft==1 ? 'aftStyle' :'otherStyle' "
  28. @click="modify(2)">下午</view>
  29. <text>{{hospitalTimes.zhong.pmStartTime}} 至 {{hospitalTimes.zhong.pmEndTime}}</text>
  30. <view :class="monthList[day+empty-1].nig==0 ? 'nullStyle' : monthList[day+empty-1].nig==1 ? 'nigStyle' :'otherStyle' "
  31. @click="modify(3)">晚上</view>
  32. <text>{{hospitalTimes.wan.nightStartTime}} 至 {{hospitalTimes.wan.nightEndTime}}</text>
  33. </view>
  34. </view>
  35. <view style="height: 100rpx;background-color: #007AFF;color: #FFF;font-size: 36rpx;" class="flex justify-center align-center"
  36. @click="close()">
  37. 保 存
  38. </view>
  39. </u-popup>
  40. <!-- 顶部标题和按钮 -->
  41. <view class="flex justify-between align-center" style="margin: 40rpx 28rpx;">
  42. <view style="flex-grow: 2;" class="drop-down" @click="timeShow=true ">
  43. <text>{{year}}年{{month+1}}月</text>
  44. <u-icon name="arrow-down-fill" size="32" color="#848484" v-show="!timeShow"></u-icon>
  45. <u-icon name="arrow-up-fill" size="32" color="#848484" v-show="timeShow"></u-icon>
  46. </view>
  47. <view class="flex justify-around align-center" style="flex-grow: 3;">
  48. <view class="drop-down" @click="hospitalListShow=!hospitalListShow">
  49. <text>{{hospital}}</text>
  50. <u-icon name="arrow-down-fill" size="32" color="#848484" v-show="!hospitalListShow"></u-icon>
  51. <u-icon name="arrow-up-fill" size="32" color="#848484" v-show="hospitalListShow"></u-icon>
  52. </view>
  53. <view style="background-color: #5555ff; padding: 8rpx;border-radius: 5rpx;">
  54. <u-icon name="list-dot" size="38" color="#fff" @click="jumpWeek"></u-icon>
  55. </view>
  56. </view>
  57. </view>
  58. <view>
  59. <!-- 一排星期 -->
  60. <view class="flex justify-around align-center" style="height: 80rpx;background-color: #CCE6FF;">
  61. <text v-for="item,index in weekList" :key="index" style="font-size: 28rpx;">{{item.text}}</text>
  62. </view>
  63. <view class="flex flex-wrap ">
  64. <view class="" style="width: 14%;padding: 0 0 20rpx 0;font-size: 32rpx;font-weight: 590;height: auto;font-weight: bold;"
  65. v-for="item,index in monthList" :key="index" @click="setDay(index,item.text)">
  66. <view class="flex justify-center align-center" :style="!item.select?
  67. 'height: 100rpx;width: 100rpx;border-radius:50%;font-weight: bold;'
  68. :'height: 100rpx;width: 100rpx;border-radius:50%;background:#00aaff;color:#fff;font-weight: bold;'">{{item.text}}</view>
  69. <!-- 排班情况 -->
  70. <view style="color: #FFF;text-align: center;font-size: 28rpx;">
  71. <view :style="item.mon > 0?'opacity:1.0':'opacity:0.0'">
  72. <view :style="item.mon==1?
  73. 'margin: 5rpx 10rpx;background:#00aaff;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0;'
  74. :'margin: 5rpx 10rpx;background:#cccccc;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0'">上午</view>
  75. </view>
  76. <view :style="item.aft > 0?'opacity:1.0':'opacity:0.0'">
  77. <view :style="item.aft==1?
  78. 'margin: 5rpx 10rpx;background:#ffaa00;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0;'
  79. :'margin: 5rpx 10rpx;background:#cccccc;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0'">下午</view>
  80. </view>
  81. <view :style="item.nig > 0?'opacity:1.0':'opacity:0.0'">
  82. <view :style="item.nig==1?
  83. 'margin: 5rpx 10rpx;background:#55aa00;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0;'
  84. :'margin: 5rpx 10rpx;background:#cccccc;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0'">晚上</view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. <!-- <view class="bottomButton" @click="paiban">
  91. 保存
  92. </view> -->
  93. </view>
  94. </template>
  95. <script>
  96. export default {
  97. onLoad() {
  98. this.$nextTick(function() {
  99. // this.getListTime()
  100. this.getHostail()
  101. this.getNowTime()
  102. this.getMonthList();
  103. // this.getMonthList();
  104. // this.getNowmonth()
  105. console.log("排班数据", this.schedulingList)
  106. })
  107. },
  108. onShow() {
  109. this.defaultIndex = [0, 0]
  110. this.getNowTime()
  111. if (this.refresh) {
  112. this.monthList.splice(0, this.monthList.length);
  113. this.schedulingList.splice(0, this.schedulingList.length);
  114. this.$nextTick(function() {
  115. this.getHostail()
  116. this.getMonthList();
  117. })
  118. this.refresh = false
  119. }
  120. },
  121. data() {
  122. return {
  123. //保存医院下标
  124. defaultIndex: [0, 0],
  125. refresh: false,
  126. timeShow: false,
  127. timeList: [],
  128. year: 0, //年
  129. month: 0, //月
  130. day: 0, //日
  131. empty: 0, // 一号前面有几个空
  132. load: false, //控制加载,从年视图返回执行onshow
  133. popupShow: false, //控制弹窗弹出层
  134. weekList: [{
  135. text: "日"
  136. }, {
  137. text: "一"
  138. }, {
  139. text: "二"
  140. }, {
  141. text: "三"
  142. }, {
  143. text: "四"
  144. }, {
  145. text: "五"
  146. }, {
  147. text: "六"
  148. }],
  149. monthList: [], //这个月的数据,不要动
  150. hospital: "", //现在选中的医院
  151. hospitalID: "1", //选中的医院ID
  152. hospitalListShow: false, //控制医院选择器
  153. hospitalTimes: 0,
  154. // 医院列表
  155. hospitalList: [],
  156. saveDayType: {
  157. mon: 0,
  158. aft: 0,
  159. nig: 0
  160. },
  161. // 一个月的排班数据 从一号开始
  162. //下标0为一号,值为医院ID
  163. // 没有排班记录为0
  164. schedulingList: [],
  165. mothonStart: '',
  166. mothonEnd: '',
  167. // 弹出层数据
  168. //空按钮样式
  169. nullStyle: {
  170. backgroundColor: '#FFF',
  171. color: '#000',
  172. fontWeight: "bold",
  173. margin: '20rpx 0 10rpx 0'
  174. },
  175. saveDay: 0,
  176. }
  177. },
  178. methods: {
  179. closePopup() {
  180. this.saveDayType.mon = 0
  181. this.saveDayType.aft = 0
  182. this.saveDayType.nig = 0
  183. },
  184. close: async function() {
  185. this.popupShow = false;
  186. let SaveLists = [];
  187. let SaveDate = JSON.parse(JSON.stringify(this.saveDay));
  188. console.log('修改数据:', this.saveDayType)
  189. console.log(this.saveDay)
  190. if (this.saveDay != 0) {
  191. if (this.hospitalID != 0) {
  192. // if (this.saveDayType.mon == this.hospitalID) {
  193. // SaveLists.push(1)
  194. // } else if (this.saveDayType.mon == 0) {
  195. // SaveLists.push(0)
  196. // }
  197. // if (this.saveDayType.aft == this.hospitalID) {
  198. // SaveLists.push(2)
  199. // } else if (this.saveDayType.aft == 0) {
  200. // SaveLists.push(0)
  201. // }
  202. // if (this.saveDayType.nig == this.hospitalID) {
  203. // SaveLists.push(3)
  204. // } else if (this.saveDayType.nig == 0) {
  205. // SaveLists.push(0)
  206. // }
  207. // if (SaveLists.length != 0) {
  208. if (this.saveDayType.length != 0) {
  209. // let s = SaveLists.join(",");
  210. let s = this.saveDayType;
  211. if (typeof s == 'object') {
  212. s = JSON.stringify(s);
  213. }
  214. let tj = {
  215. 'schedule_date': SaveDate.date,
  216. 'week': SaveDate.week,
  217. 'type': s,
  218. 'organization_id': this.hospitalID,
  219. }
  220. let res = await this.$request.post("doctor/saveDay", tj);
  221. if (res.status == 0) {
  222. uni.showToast({
  223. title: "修改成功!",
  224. })
  225. SaveLists = [];
  226. this.saveDay = 0;
  227. SaveDate = 0;
  228. }
  229. }
  230. } else {
  231. uni.showModal({
  232. title: '请选择医院'
  233. })
  234. }
  235. }
  236. },
  237. /**
  238. * 获取接口医院
  239. * 渲染颜色
  240. * */
  241. getHostail: async function() {
  242. let res = await this.$request.post("doctor/organizationList");
  243. if (res.status == 0) {
  244. let data = res.data;
  245. let newList = [];
  246. if (data.length == 0) {
  247. uni.showModal({
  248. title: '请先认证医院',
  249. success: function(res) {
  250. if (res.confirm) {
  251. uni.redirectTo({
  252. url: "/pages/login/doctorRenzheng"
  253. })
  254. } else {
  255. uni.navigateBack({
  256. delta: 1
  257. })
  258. }
  259. }
  260. })
  261. } else {
  262. for (let i = 0; i < data.length; i++) {
  263. newList.push({
  264. value: data[i].value,
  265. label: data[i].label,
  266. })
  267. }
  268. }
  269. console.log('机构获取,', res);
  270. this.hospitalList = newList;
  271. this.getListTime(this.hospitalList[0].value)
  272. this.hospital = this.hospitalList[0].label
  273. this.hospitalID = this.hospitalList[0].value + ""
  274. // let day = new Date();
  275. // let a = day.getDate()
  276. // for (let x = 0; x < this.monthList.length - this.empty; x++) {
  277. // this.monthList[x + this.empty].mon = this.schedulingList[x].mon == "0" ? 0 : this.schedulingList[x].mon == this.hospitalID &&
  278. // this.overdue(x) ?
  279. // 1 : 2
  280. // this.monthList[x + this.empty].aft = this.schedulingList[x].aft == "0" ? 0 : this.schedulingList[x].aft == this.hospitalID &&
  281. // this.overdue(x) ?
  282. // 1 : 2
  283. // this.monthList[x + this.empty].nig = this.schedulingList[x].nig == "0" ? 0 : this.schedulingList[x].nig == this.hospitalID &&
  284. // this.overdue(x) ?
  285. // 1 : 2
  286. // }
  287. // for (let x = 0; x < this.monthList.length - this.empty - a; x++) {
  288. // this.monthList[x + this.empty - a].mon = this.schedulingList[x - a].mon == "0" ? 0 : 2
  289. // this.monthList[x + this.empty - a].aft = this.schedulingList[x - a].aft == "0" ? 0 : 2
  290. // this.monthList[x + this.empty - a].nig = this.schedulingList[x - a].nig == "0" ? 0 : 2
  291. // }
  292. }
  293. },
  294. /**
  295. * 判断时间 过去显示灰
  296. * */
  297. overdue(day) {
  298. let date = new Date();
  299. if (this.year == date.getFullYear() && this.month == date.getMonth() && day + 1 <= date.getDate()) {
  300. return false
  301. } else {
  302. return true
  303. }
  304. },
  305. getMonthList: async function() {
  306. console.log("请求数据", this.mothonStart, this.mothonEnd)
  307. let res = await this.$request.post("doctor/monthDetail", {
  308. 'start_day': this.mothonStart,
  309. 'end_day': this.mothonEnd
  310. });
  311. console.log("收到数据", res)
  312. if (res.status == 0) {
  313. let data = res.data;
  314. let newList = [];
  315. let date = new Date()
  316. date.setFullYear(this.year, this.month + 1, 0);
  317. console.log('请求数据的接口,需要查看这个月有几天', date.getDate())
  318. for (let i = 0,j = 0; i < date.getDate(); i++) {
  319. // console.log("数组长度",data.length ,"i",i,"j",j,data[j].schedule_date.substr(-2))
  320. if (data.length > j) {
  321. if (data[j].schedule_date.substr(-2) == i + 1) {
  322. this.schedulingList.push({
  323. mon: data[j].ident.zao,
  324. aft: data[j].ident.xia,
  325. nig: data[j].ident.wan
  326. })
  327. j++
  328. } else {
  329. this.schedulingList.push({
  330. mon: 0,
  331. aft: 0,
  332. nig: 0
  333. })
  334. }
  335. } else {
  336. this.schedulingList.push({
  337. mon: 0,
  338. aft: 0,
  339. nig: 0
  340. })
  341. }
  342. }
  343. console.log("渲染后的数组",this.schedulingList)
  344. this.getNowmonth() //渲染方法
  345. } else {
  346. uni.showModal({
  347. title: '请求错误'
  348. })
  349. }
  350. },
  351. /**
  352. * 获取现在的日期
  353. * */
  354. getNowTime() {
  355. var d = new Date();
  356. this.year = d.getFullYear()
  357. this.month = d.getMonth()
  358. this.day = d.getDate()
  359. this.mothonStart = this.year + '-' + (this.month + 1) + '-' + '01'
  360. d.setFullYear(this.year, this.month + 1, 0);
  361. this.mothonEnd = this.year + '-' + (this.month + 1) + '-' + d.getDate()
  362. let yearList = [] //一年的月份
  363. for (let x = 1; x < 13; x++) {
  364. yearList.push({
  365. label: x + "月",
  366. value: x,
  367. extra: x - 1
  368. })
  369. }
  370. this.timeList.splice(0, this.timeList.length)
  371. for (let x = 0; x < 3; x++) {
  372. this.timeList.push({
  373. label: (this.year + x) + "年",
  374. value: this.year + x,
  375. extra: x,
  376. children: yearList.slice(0)
  377. })
  378. }
  379. this.timeList[0].children.splice(0, d.getMonth()) //删除之前的月份
  380. },
  381. /**
  382. * 拿到一个月的数据
  383. * */
  384. getNowmonth() {
  385. let oneDayTime = 24 * 60 * 60 * 1000; //固定数据 一天的时长
  386. var date = new Date()
  387. this.day = date.getDate()
  388. date.setFullYear(this.year, this.month, 1); //这个月的一号
  389. for (let b = 0; b < date.getDay(); b++) {
  390. this.monthList.push({
  391. text: "",
  392. select: false
  393. })
  394. }
  395. this.empty = date.getDay()
  396. date.setFullYear(this.year, this.month + 1, 0); //查看这个月有几天
  397. //接口用到的开始时间和结束时间
  398. this.mothonStart = this.year + '-' + (this.month + 1) + '-' + '01'
  399. this.mothonEnd = this.year + '-' + (this.month + 1) + '-' + date.getDate()
  400. for (let c = 0; c < date.getDate(); c++) {
  401. let months = (this.month + 1);
  402. if (months < 10) {
  403. months = "0" + months;
  404. }
  405. let days = (c + 1);
  406. if (days < 10) {
  407. days = "0" + days;
  408. }
  409. this.monthList.push({
  410. text: c + 1,
  411. date: this.year + '-' + months + '-' + days,
  412. week: this.getWeekList(this.year + '-' + months + '-' + days),
  413. select: false,
  414. //判断方法,通过判断是不是选中的医院ID
  415. //0没有排班,1有排班,2有排班,但不是这个医院
  416. mon: this.schedulingList[c].mon == "0" ? 0 : this.schedulingList[c].mon == this.hospitalID && this.overdue(c) ?
  417. 1 : 2,
  418. aft: this.schedulingList[c].aft == "0" ? 0 : this.schedulingList[c].aft == this.hospitalID && this.overdue(c) ?
  419. 1 : 2,
  420. nig: this.schedulingList[c].nig == "0" ? 0 : this.schedulingList[c].nig == this.hospitalID && this.overdue(c) ?
  421. 1 : 2
  422. })
  423. }
  424. console.log(this.monthList)
  425. },
  426. getWeekList(strs) {;
  427. var weekDay = [7, 1, 2, 3, 4, 5, 6];
  428. let times = strs.replace(/-/g, '/');
  429. var myDate = new Date(Date.parse(times));
  430. return weekDay[myDate.getDay()];
  431. },
  432. getimePate(str) {
  433. var date = new Date(str.replace(/-/g, '/'));
  434. return Date.parse(date);
  435. },
  436. getListTime: async function(org_id) {
  437. let res = await this.$request.post('doctor/getOrgTimes', {
  438. org_id: org_id
  439. });
  440. let newLists = [];
  441. if (res.status == 0) {
  442. if (res.data.length == 0) {
  443. uni.showModal({
  444. title: '请先去设置排班',
  445. success: function(res) {
  446. if (res.confirm) {
  447. uni.redirectTo({
  448. url: "/pages/service/more"
  449. })
  450. } else {
  451. uni.navigateBack({
  452. delta: 1
  453. })
  454. }
  455. }
  456. })
  457. return false;
  458. } else {
  459. this.hospitalTimes = res.data;
  460. console.log('时间:', this.hospitalTimes)
  461. }
  462. }
  463. },
  464. /**
  465. * 切换医院
  466. * */
  467. setSelectHospital(e) {
  468. this.getListTime(e[0].value)
  469. this.hospital = e[0].label
  470. this.hospitalID = e[0].value + ""
  471. console.log('月份:', this.monthList);
  472. for (let x = 0; x < this.monthList.length - this.empty; x++) {
  473. this.monthList[x + this.empty].mon = this.schedulingList[x].mon == "0" ? 0 : this.schedulingList[x].mon == this
  474. .hospitalID && this.overdue(x) ?
  475. 1 : 2
  476. this.monthList[x + this.empty].aft = this.schedulingList[x].aft == "0" ? 0 : this.schedulingList[x].aft == this
  477. .hospitalID && this.overdue(x) ?
  478. 1 : 2
  479. this.monthList[x + this.empty].nig = this.schedulingList[x].nig == "0" ? 0 : this.schedulingList[x].nig == this
  480. .hospitalID && this.overdue(x) ?
  481. 1 : 2
  482. }
  483. },
  484. /**
  485. * 点击对应日期
  486. * */
  487. setDay(index, text) {
  488. // 获取当前日期
  489. var date = new Date();
  490. // 获取当前月份
  491. var nowMonth = date.getMonth() + 1;
  492. // 获取当前是几号
  493. var strDate = date.getDate();
  494. // 添加分隔符“-”
  495. var seperator = "-";
  496. // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期
  497. var nowDate = date.getFullYear() + seperator + nowMonth + seperator + strDate
  498. if (this.getimePate(nowDate) >= this.getimePate(this.monthList[index].date)) {
  499. uni.showModal({
  500. title: '只能修改今天之后的数据!'
  501. })
  502. return false;
  503. }
  504. if (index >= this.empty) {
  505. this.monthList.map(val => {
  506. val.select = false
  507. })
  508. this.saveDayType.mon = this.schedulingList[index - this.empty].mon;
  509. this.saveDayType.aft = this.schedulingList[index - this.empty].aft;
  510. this.saveDayType.nig = this.schedulingList[index - this.empty].nig;
  511. this.monthList[index].select = true
  512. this.day = text
  513. this.popupShow = true
  514. }
  515. },
  516. /**
  517. * 跳转到年视图
  518. * */
  519. jumpYear() {
  520. setTimeout(function() {
  521. uni.navigateTo({
  522. url: "year_Scheduling"
  523. })
  524. }, 300)
  525. },
  526. /**
  527. * 确认选择年月
  528. * */
  529. yearConfirm(e) {
  530. console.log("选择了年月", e)
  531. this.defaultIndex[0] = e[0].extra
  532. this.defaultIndex[1] = e[1].extra
  533. this.year = e[0].value
  534. this.month = e[1].value - 1
  535. let d = new Date();
  536. this.mothonStart = this.year + '-' + (this.month + 1) + '-' + '01'
  537. d.setFullYear(this.year, this.month + 1, 0);
  538. this.mothonEnd = this.year + '-' + (this.month + 1) + '-' + d.getDate()
  539. this.monthList.splice(0, this.monthList.length);
  540. this.schedulingList.splice(0, this.schedulingList.length);
  541. this.$nextTick(function() {
  542. this.getHostail()
  543. this.getMonthList();
  544. this.day = 0
  545. })
  546. },
  547. /**
  548. * 日视图按钮点击
  549. * id 1早上 2下午 3晚上
  550. * */
  551. modify(id) {
  552. this.saveDay = this.monthList[this.day + this.empty - 1];
  553. if (id == 0) {
  554. this.monthList[this.day + this.empty - 1].mon = 1 //
  555. this.schedulingList[this.day - 1].mon = this.hospitalID
  556. this.saveDayType.mon = this.hospitalID;
  557. this.monthList[this.day + this.empty - 1].aft = 1 //
  558. this.schedulingList[this.day - 1].aft = this.hospitalID
  559. this.saveDayType.aft = this.hospitalID;
  560. this.monthList[this.day + this.empty - 1].nig = 1 //
  561. this.schedulingList[this.day - 1].nig = this.hospitalID
  562. this.saveDayType.nig = this.hospitalID;
  563. } else {
  564. switch (id) {
  565. case 1:
  566. if (this.monthList[this.day + this.empty - 1].mon == 1) { //当这个按钮状态为1 选择了医院且是当前医院
  567. this.monthList[this.day + this.empty - 1].mon = 0 //就取消选择
  568. this.schedulingList[this.day - 1].mon = 0
  569. this.saveDayType.mon = 0;
  570. } else if (this.monthList[this.day + this.empty - 1].mon == 0) {
  571. this.monthList[this.day + this.empty - 1].mon = 1 //
  572. this.schedulingList[this.day - 1].mon = this.hospitalID
  573. this.saveDayType.mon = this.hospitalID;
  574. }
  575. break;
  576. case 2:
  577. if (this.monthList[this.day + this.empty - 1].aft == 1) { //当这个按钮状态为1 选择了医院且是当前医院
  578. this.monthList[this.day + this.empty - 1].aft = 0 //就取消选择
  579. this.schedulingList[this.day - 1].aft = 0
  580. this.saveDayType.aft = 0;
  581. } else if (this.monthList[this.day + this.empty - 1].aft == 0) {
  582. this.monthList[this.day + this.empty - 1].aft = 1 //
  583. this.schedulingList[this.day - 1].aft = this.hospitalID
  584. this.saveDayType.aft = this.hospitalID;
  585. }
  586. break;
  587. case 3:
  588. if (this.monthList[this.day + this.empty - 1].nig == 1) { //当这个按钮状态为1 选择了医院且是当前医院
  589. this.monthList[this.day + this.empty - 1].nig = 0 //就取消选择
  590. this.schedulingList[this.day - 1].nig = 0
  591. this.saveDayType.nig = 0;
  592. } else if (this.monthList[this.day + this.empty - 1].nig == 0) {
  593. this.monthList[this.day + this.empty - 1].nig = 1 //
  594. this.schedulingList[this.day - 1].nig = this.hospitalID
  595. this.saveDayType.nig = this.hospitalID;
  596. }
  597. break;
  598. }
  599. // this.saveDay = this.monthList[this.day + this.empty - 1];
  600. console.log('选择的日期:', this.monthList[this.day + this.empty - 1]);
  601. console.log('ID:', id);
  602. // this.$forceUpdate();
  603. }
  604. },
  605. /**
  606. * 跳转周视图
  607. * */
  608. jumpWeek() {
  609. uni.navigateTo({
  610. url: 'week_Scheduling'
  611. })
  612. },
  613. }
  614. }
  615. </script>
  616. <style>
  617. /* 下拉按钮 */
  618. .drop-down {
  619. border: 1rpx solid #AAAAAA;
  620. font-size: 32rpx;
  621. flex-grow: 1;
  622. margin-right: 30rpx;
  623. border-radius: 15rpx;
  624. display: flex;
  625. justify-content: space-between;
  626. align-items: center;
  627. padding: 10rpx 15rpx;
  628. }
  629. /* //空按钮样式 */
  630. .nullStyle {
  631. text-align: center;
  632. padding: 10rpx 0;
  633. border: 0.3rpx solid #909399;
  634. background-color: #FFF;
  635. border-radius: 30rpx;
  636. color: #000;
  637. font-weight: bold;
  638. margin: 20rpx 0 10rpx 0;
  639. }
  640. ,
  641. /* //上午按钮样式 */
  642. .monStyle {
  643. text-align: center;
  644. padding: 10rpx 0;
  645. border: 0.3rpx solid #5667c8;
  646. background-color: #5667c8;
  647. border-radius: 30rpx;
  648. color: #fff;
  649. fontWeight: bold;
  650. margin: 20rpx 0 10rpx 0;
  651. }
  652. ,
  653. /* //下午按钮样式 */
  654. .aftStyle {
  655. text-align: center;
  656. padding: 10rpx 0;
  657. color: #FFF;
  658. border-radius: 30rpx;
  659. border: 0.3rpx solid #ec9d75;
  660. background-color: #ec9d75;
  661. color: #fff;
  662. font-weight: bold;
  663. margin: 20rpx 0 10rpx 0;
  664. }
  665. ,
  666. /* //晚上按钮样式 */
  667. .nigStyle {
  668. text-align: center;
  669. padding: 10rpx 0;
  670. border: 0.3rpx solid #55aa7f;
  671. background-color: #55aa7f;
  672. color: #fff;
  673. border-radius: 30rpx;
  674. font-weight: bold;
  675. margin: 20rpx 0 10rpx 0;
  676. }
  677. ,
  678. /* //其他医院按钮样式 */
  679. .otherStyle {
  680. text-align: center;
  681. padding: 10rpx 0;
  682. border: 0.3rpx solid #989898;
  683. background-color: #989898;
  684. border-radius: 30rpx;
  685. color: #fff;
  686. font-weight: bold;
  687. margin: 20rpx 0 10rpx 0;
  688. }
  689. </style>