Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

index.vue 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <div style="display:flex;align-items:center">
  6. <el-button type="primary" @click="DeleteStaffSchedule">清除</el-button>
  7. <el-button type="primary" @click="copyStaffSchedule">复制</el-button>
  8. <el-button type="primary" icon="el-icon-printer" @click="toPrint">打印</el-button>
  9. </div>
  10. </div>
  11. <div class="app-container">
  12. <div class="cell clearfix">
  13. <el-input
  14. size="small"
  15. style="width: 150px;"
  16. class="filter-item"
  17. v-model.trim="keywords"
  18. placeholder="请输入医护人员姓名"
  19. />
  20. <el-button
  21. size="small"
  22. class="filter-item"
  23. type="primary"
  24. icon="el-icon-search"
  25. @click="toSearch"
  26. >搜索</el-button
  27. >
  28. <el-select style="margin-left:10px;width:150px;" v-model="typeValue" placeholder="请选择" @change="changeOption">
  29. <el-option
  30. v-for="item in options"
  31. :key="item.value"
  32. :label="item.label"
  33. :value="item.value">
  34. </el-option>
  35. </el-select>
  36. <el-button @click="lastclick" type="text" style="margin:0 10px;">&lt;上一周({{ weekNum - 1 }})</el-button>
  37. <div class="dateBox">{{ weekDayArr[0] }}-{{ weekDayArr[6] }}({{ weekNum }})</div>
  38. <el-button @click="nextclick" type="text" style="margin:0 10px;">下一周({{ weekNum + 1 }})&gt;</el-button>
  39. </div>
  40. <div style="display:flex;justify-content: space-between;">
  41. <div style="width: 70%">
  42. <el-table :data="tableData" border :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)', color: '#606266'}" :row-style="{ color: '#303133' }" @cell-click="clickThis">
  43. <el-table-column prop="name" label="医护姓名" style="width:16%" align="center">
  44. <template slot-scope="scope">
  45. {{scope.row.user_name}}
  46. </template>
  47. </el-table-column>
  48. <el-table-column :label="'周一 (' + weekDayArr[0] + ')'" style="width:200px" align="center">
  49. <template slot-scope="scope">
  50. <div @click="hangdleClick(scope.row,scope.$index)">
  51. <el-dropdown trigger="click" @command="changeSchedule">
  52. <span class="el-dropdown-link">
  53. <span v-if="scope.row.class_index == 1">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
  54. </span>
  55. <el-dropdown-menu slot="dropdown" >
  56. <el-dropdown-item :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  57. </el-dropdown-menu>
  58. </el-dropdown>
  59. </div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column prop="name" :label="'周二 (' + weekDayArr[1] + ')'" style="width:14%" align="center">
  63. <template slot-scope="scope">
  64. <div @click="hangdleClick(scope.row,scope.$index)">
  65. <el-dropdown trigger="click" @command="changeSchedule">
  66. <span class="el-dropdown-link">
  67. <span v-if="scope.row.class_index == 2">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
  68. </span>
  69. <el-dropdown-menu slot="dropdown" >
  70. <el-dropdown-item :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  71. </el-dropdown-menu>
  72. </el-dropdown>
  73. </div>
  74. </template>
  75. </el-table-column>
  76. <el-table-column prop="name" :label="'周三 (' + weekDayArr[2] + ')'" style="width:14%" align="center">
  77. <template slot-scope="scope">
  78. <div @click="hangdleClick(scope.row,scope.$index)">
  79. <el-dropdown trigger="click" @command="changeSchedule">
  80. <span class="el-dropdown-link">
  81. <span v-if="scope.row.class_index == 3">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
  82. </span>
  83. <el-dropdown-menu slot="dropdown" >
  84. <el-dropdown-item :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  85. </el-dropdown-menu>
  86. </el-dropdown>
  87. </div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column prop="name" :label="'周四 (' + weekDayArr[3] + ')'" style="width:14%" align="center">
  91. <template slot-scope="scope">
  92. <div @click="hangdleClick(scope.row,scope.$index)">
  93. <el-dropdown trigger="click" @command="changeSchedule">
  94. <span class="el-dropdown-link">
  95. <span v-if="scope.row.class_index ==4">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
  96. </span>
  97. <el-dropdown-menu slot="dropdown" >
  98. <el-dropdown-item :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  99. </el-dropdown-menu>
  100. </el-dropdown>
  101. </div>
  102. </template>
  103. </el-table-column>
  104. <el-table-column prop="name" :label="'周五 (' + weekDayArr[4] + ')'" style="width:14%" align="center">
  105. <template slot-scope="scope">
  106. <div @click="hangdleClick(scope.row,scope.$index)">
  107. <el-dropdown trigger="click" @command="changeSchedule">
  108. <span class="el-dropdown-link">
  109. <span v-if="scope.row.class_index == 5">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
  110. </span>
  111. <el-dropdown-menu slot="dropdown" >
  112. <el-dropdown-item :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  113. </el-dropdown-menu>
  114. </el-dropdown>
  115. </div>
  116. </template>
  117. </el-table-column>
  118. <el-table-column prop="name" :label="'周六 (' + weekDayArr[5] + ')'" style="width:14%" align="center">
  119. <template slot-scope="scope">
  120. <div @click="hangdleClick(scope.row,scope.$index)">
  121. <el-dropdown trigger="click" @command="changeSchedule">
  122. <span class="el-dropdown-link">
  123. <span v-if="scope.row.class_index==6">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
  124. </span>
  125. <el-dropdown-menu slot="dropdown" >
  126. <el-dropdown-item :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  127. </el-dropdown-menu>
  128. </el-dropdown>
  129. </div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column prop="name" :label="'周日 (' + weekDayArr[6] + ')'" style="width:14%" align="center">
  133. <template slot-scope="scope">
  134. <div @click="hangdleClick(scope.row,scope.$index)">
  135. <el-dropdown trigger="click" @command="changeSchedule">
  136. <span class="el-dropdown-link">
  137. <span v-if="scope.row.class_index == 0">{{scope.row.class_name}}</span><i class="el-icon-arrow-down el-icon--right"></i>
  138. </span>
  139. <el-dropdown-menu slot="dropdown" >
  140. <el-dropdown-item :command="item.id" icon="el-icon-plus" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  141. </el-dropdown-menu>
  142. </el-dropdown>
  143. </div>
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. </div>
  148. <div class="classBox">
  149. <div class="classTitle">班种</div>
  150. <div class="classMain">
  151. <div v-for="(item,index) in schedulelist" :key="index">
  152. <p>
  153. {{item.class_name}}&nbsp;({{item.timeone_start}}~{{item.timeone_type}}{{item.timeone_end}} <span v-if="item.timetwo_start!=''">{{item.timetwo_start}}~{{item.timetwo_type}}{{item.timetwo_end}}</span> )
  154. </p>
  155. </div>
  156. <el-checkbox style="text-align:center" v-model="isChecked" @change="toContinuous">连续排班</el-checkbox>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </template>
  163. <script>
  164. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  165. import { getDoctorList,getScheduleList,addSchedule,getStaffScheduleList,getNextWeekList,getScheduleByDoctorId,toSearchScheduleList,DeleteStaffSchedule,copyStaffSchedule,UpdateContinusSchedule } from '@/api/doctorSchedule'
  166. export default {
  167. components:{
  168. BreadCrumb
  169. },
  170. data(){
  171. return{
  172. crumbs: [
  173. { path: false, name: '医护排班' },
  174. { path: '/medicalScheduling/index', name: '医护排班' }
  175. ],
  176. keywords:'',
  177. options: [{
  178. value: '1',
  179. label: '全部'
  180. }, {
  181. value: '2',
  182. label: '医生'
  183. }, {
  184. value: '3',
  185. label: '护士'
  186. }],
  187. typeValue:'1',
  188. tableData: [],
  189. isChecked:true,
  190. schedulelist:[],
  191. weekNum:'',
  192. weekDayArr:[],
  193. todayDate:'',
  194. clen:7,
  195. nowYear: new Date().getFullYear(),
  196. schedule_week:0,
  197. docobj:{},
  198. class_name:"",
  199. doctorlist:[],
  200. schedule_date:"",
  201. }
  202. },
  203. methods:{
  204. search(){},
  205. toPrint(){
  206. this.$router.push({
  207. path: '/medicalScheduling/schedule/print?starttime='+this.getTimestamp(this.weekDayArr[0])+"&endtime="+this.getTimestamp(this.weekDayArr[6]),
  208. // query: { date: date }
  209. })
  210. },
  211. getDoctorList(){
  212. getDoctorList().then(response=>{
  213. if(response.data.state == 1){
  214. var list = response.data.data.list
  215. console.log("医护列表",list)
  216. this.tableData = list
  217. this.doctorlist = list
  218. //获取班种列表
  219. this.getStaffScheduleList()
  220. }
  221. })
  222. },
  223. getScheduleList(){
  224. getScheduleList().then(response=>{
  225. if(response.data.state == 1){
  226. var schedulelist = response.data.data.scheduleList
  227. console.log("schedulelist",schedulelist)
  228. for(let i=0;i<schedulelist.length;i++){
  229. if(schedulelist[i].timeone_type == 1){
  230. schedulelist[i].timeone_type = "当日"
  231. }
  232. if(schedulelist[i].timeone_type == 2){
  233. schedulelist[i].timeone_type = "次日"
  234. }
  235. if(schedulelist[i].timetwo_type == 1){
  236. schedulelist[i].timetwo_type = "当日"
  237. }
  238. if(schedulelist[i].timetwo_type == 2){
  239. schedulelist[i].timetwo_type = "次日"
  240. }
  241. }
  242. this.schedulelist = schedulelist
  243. }
  244. })
  245. },
  246. hangdleClick(val,index){
  247. this.docobj = val
  248. },
  249. clickThis(row, column, cell, event){
  250. // console.log("row",row)
  251. // console.log("column",column)
  252. // console.log("日期",this.weekDayArr)
  253. var week = (column.label).split('');
  254. var weeks = week[0]+week[1]
  255. console.log("weeks",weeks)
  256. if(weeks == "周日"){
  257. this.schedule_week = 0
  258. this.schedule_date = this.weekDayArr[6]
  259. }
  260. if(weeks == "周一"){
  261. this.schedule_week = 1
  262. this.schedule_date = this.weekDayArr[0]
  263. }
  264. if(weeks=="周二"){
  265. this.schedule_week = 2
  266. this.schedule_date = this.weekDayArr[1]
  267. }
  268. if(weeks=="周三"){
  269. this.schedule_week = 3
  270. this.schedule_date = this.weekDayArr[2]
  271. }
  272. if(weeks=="周四"){
  273. this.schedule_week = 4
  274. this.schedule_date = this.weekDayArr[3]
  275. }
  276. if(weeks == "周五"){
  277. this.schedule_week = 5
  278. this.schedule_date = this.weekDayArr[4]
  279. }
  280. if(weeks== "周六"){
  281. this.schedule_week = 6
  282. this.schedule_date = this.weekDayArr[5]
  283. }
  284. },
  285. changeSchedule(id){
  286. var class_name = ""
  287. for(let i=0;i<this.schedulelist.length;i++){
  288. if(id == this.schedulelist[i].id){
  289. class_name = this.schedulelist[i].class_name
  290. }
  291. }
  292. let arr = [...this.tableData]
  293. for(let i=0;i<arr.length;i++){
  294. if(this.docobj.id == arr[i].id){
  295. arr[i].class_name = class_name
  296. arr[i].class_index = this.schedule_week
  297. }
  298. }
  299. console.log("arr",arr)
  300. this.tableData = arr
  301. const params = {
  302. doctor_id:this.docobj.admin_user_id,
  303. doctor_type:this.docobj.user_type,
  304. schedule_type:id,
  305. schedule_week:this.schedule_week,
  306. start_time:this.getTimestamp(this.weekDayArr[0]),
  307. end_time:this.getTimestamp(this.weekDayArr[6]),
  308. schedule_date:this.getTimestamp(this.schedule_date)
  309. }
  310. console.log("params",params)
  311. addSchedule(params).then(response=>{
  312. if(response.data.state == 1){
  313. var schedule = response.data.data.schedule
  314. console.log("schedule",schedule)
  315. this.$message.success("保存成功")
  316. this.getStaffScheduleList()
  317. }
  318. })
  319. },
  320. formatDate(date){
  321. var year = date.getFullYear()+'.'
  322. var month = (date.getMonth()+1)+'.';
  323. var day = date.getDate();
  324. return year+month+day
  325. },
  326. formatDateTwo(date){
  327. var year = date.getFullYear()+'.'
  328. var month = (date.getMonth()+1)+'.';
  329. var day = date.getDate();
  330. return year+month+day
  331. },
  332. addDate(date,n){
  333. date.setDate(date.getDate()+n);
  334. return date;
  335. },
  336. //
  337. setDate(date){
  338. var week = date.getDay()-1;
  339. date = this.addDate(date,week*-1);
  340. this.currentFirstDate = new Date(date);
  341. for(var i = 0;i<this.clen; i++){
  342. this.weekDayArr.push(this.formatDate(i==0 ? date : this.addDate(date,1)))
  343. }
  344. },
  345. //上一周
  346. lastclick(){
  347. this.weekDayArr=[]
  348. this.setDate(this.addDate(this.currentFirstDate,-7));
  349. this.weekNum = this.weekNum - 1
  350. if(this.weekNum - 1 == 0){
  351. let year = this.nowYear - 1
  352. let month = 12
  353. let date = 31
  354. this.weekNum = this.getYearWeek(year,month,date)
  355. this.nowYear = this.nowYear - 1
  356. }
  357. this.getNextWeekList()
  358. },
  359. //下一周
  360. nextclick(){
  361. this.weekDayArr=[]
  362. this.setDate(this.addDate(this.currentFirstDate,7));
  363. this.weekNum = this.weekNum + 1
  364. if(this.weekNum + 1 == 54){
  365. let year = this.nowYear + 1
  366. let month = 1
  367. let date = 1
  368. this.weekNum = this.getYearWeek(year,month,date)
  369. this.nowYear = this.nowYear + 1
  370. }
  371. this.getNextWeekList()
  372. },
  373. getYearWeek(year,month,date){
  374. /*
  375. dateNow是当前日期
  376. dateFirst是当年第一天
  377. dataNumber是当前日期是今年第多少天
  378. 用dataNumber + 当前年的第一天的周差距的和在除以7就是本年第几周
  379. */
  380. let dateNow = new Date(year, parseInt(month) - 1, date);
  381. let dateFirst = new Date(year, 0, 1);
  382. let dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 86400000);
  383. return Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7);
  384. },
  385. getTimestamp(time) { //把时间日期转成时间戳
  386. return (new Date(time)).getTime() / 1000
  387. },
  388. beforeHandleCommand(item,row){
  389. return {
  390. 'command': item,
  391. 'row': row
  392. }
  393. },
  394. //获取所有医护排班数据
  395. getStaffScheduleList(){
  396. const params = {
  397. start_time:this.getTimestamp(this.weekDayArr[0]),
  398. end_time:this.getTimestamp(this.weekDayArr[6])
  399. }
  400. getStaffScheduleList(params).then(response=>{
  401. if(response.data.state == 1){
  402. var staffList = response.data.data.staffList
  403. for(let i=0;i<staffList.length;i++){
  404. if(staffList[i].schedule_week == 0){
  405. staffList[i].class_index = 0
  406. }
  407. if(staffList[i].schedule_week == 1){
  408. staffList[i].class_index = 1
  409. }
  410. if(staffList[i].schedule_week == 2){
  411. staffList[i].class_index = 2
  412. }
  413. if(staffList[i].schedule_week == 3){
  414. staffList[i].class_index = 3
  415. }
  416. if(staffList[i].schedule_week == 4){
  417. staffList[i].class_index = 4
  418. }
  419. if(staffList[i].schedule_week == 5){
  420. staffList[i].class_index = 5
  421. }
  422. if(staffList[i].schedule_week == 6){
  423. staffList[i].class_index = 6
  424. }
  425. }
  426. // console.log("staffList--------",staffList)
  427. // if(staffList.length == 0){
  428. // this.tableData = this.doctorlist
  429. // }else{
  430. // this.tableData = []
  431. // this.tableData = staffList
  432. // }
  433. }
  434. })
  435. },
  436. //获取上一周下一周的排班数据
  437. getNextWeekList(){
  438. const params = {
  439. start_time:this.getTimestamp(this.weekDayArr[0]),
  440. end_time:this.getTimestamp(this.weekDayArr[6])
  441. }
  442. getNextWeekList(params).then(response=>{
  443. if(response.data.state == 1){
  444. var staffList = response.data.data.staffList
  445. console.log("上下周数据",staffList)
  446. }
  447. })
  448. },
  449. changeOption(id){
  450. const params = {
  451. start_time:this.getTimestamp(this.weekDayArr[0]),
  452. end_time:this.getTimestamp(this.weekDayArr[6]),
  453. doctor_id:id
  454. }
  455. getScheduleByDoctorId(params).then(response=>{
  456. if(response.data.state == 1){
  457. var staffList = response.data.data.staffList
  458. console.log("staffList",staffList)
  459. }
  460. })
  461. },
  462. toSearch(){
  463. console.log("医护人员姓名",this.keywords)
  464. var id = 0
  465. for(let i = 0 ;i<this.doctorlist.length;i++){
  466. if(this.keywords == this.doctorlist[i].user_name){
  467. id = this.doctorlist[i].admin_user_id
  468. }
  469. }
  470. const params = {
  471. doctor_id:id,
  472. start_time:this.getTimestamp(this.weekDayArr[0]),
  473. end_time:this.getTimestamp(this.weekDayArr[6])
  474. }
  475. toSearchScheduleList(params).then(response=>{
  476. if(response.data.state == 1){
  477. var staffList = response.data.data.staffList
  478. console.log("stafflist",staffList)
  479. }
  480. })
  481. },
  482. DeleteStaffSchedule(){
  483. const params = {
  484. start_time:this.getTimestamp(this.weekDayArr[0]),
  485. end_time:this.getTimestamp(this.weekDayArr[6])
  486. }
  487. console.log("params",params)
  488. this.$confirm(
  489. '是否要清除当周排班? <br>清除后,信息将无法恢复',
  490. '删除提示',
  491. {
  492. dangerouslyUseHTMLString: true,
  493. confirmButtonText: '确定',
  494. cancelButtonText: '取消',
  495. type: 'warning'
  496. }
  497. ).then(()=>{
  498. DeleteStaffSchedule(params).then(response=>{
  499. if(response.data.state == 1){
  500. var msg = response.data.data.msg
  501. this.$message.success("清除成功")
  502. this.getStaffScheduleList()
  503. }
  504. })
  505. })
  506. },
  507. copyStaffSchedule(){
  508. const params = {
  509. start_time:this.getTimestamp(this.weekDayArr[0]),
  510. end_time:this.getTimestamp(this.weekDayArr[6])
  511. }
  512. copyStaffSchedule(params).then(response=>{
  513. if(response.data.state == 1){
  514. var msg = response.data.data.msg
  515. console.log("msg",msg)
  516. this.$message.success("复制成功")
  517. }else{
  518. this.$message.error("排班已存在")
  519. }
  520. })
  521. },
  522. toContinuous(){
  523. var is_status = 0
  524. if(this.isChecked == false){
  525. is_status = 0
  526. }
  527. if(this.isChecked == true){
  528. is_status = 1
  529. }
  530. const params = {
  531. is_status:is_status
  532. }
  533. UpdateContinusSchedule(params).then(response=>{
  534. if(response.data.state == 1){
  535. var schedule = response.data.data.schedule
  536. console.log("schedule",schedule)
  537. this.$message.success("保存成功")
  538. }
  539. })
  540. }
  541. },
  542. created(){
  543. //获取医护人员
  544. this.getDoctorList()
  545. //获取班种
  546. this.getScheduleList()
  547. let year = new Date().getFullYear()
  548. let month = new Date().getMonth() + 1
  549. let date = new Date().getDate()
  550. this.weekNum = this.getYearWeek(year,month,date)
  551. this.todayDate=this.formatDate(new Date())
  552. this.setDate(new Date())
  553. }
  554. }
  555. </script>
  556. <style lang="scss" scoped>
  557. .dateBox{
  558. border: 1px solid #DCDFE6;
  559. height: 36px;
  560. line-height: 36px;
  561. text-align: center;
  562. padding: 0 10px;
  563. border-radius: 4px;
  564. }
  565. .classBox{
  566. width:25%;
  567. height: 100%;
  568. border: 1px solid #EBEEF5;
  569. .classTitle{
  570. height: 42px;
  571. text-align: center;
  572. line-height: 42px;
  573. background-color: rgb(245, 247, 250);
  574. color: rgb(96, 98, 102);
  575. font-weight:bold;
  576. }
  577. .classMain{
  578. height: 400px;
  579. padding: 0 20px;
  580. display: flex;
  581. justify-content: space-between;
  582. flex-direction: column;
  583. >div>p{
  584. line-height: 30px;
  585. }
  586. }
  587. }
  588. </style>