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

index.vue 75KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597
  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="setting">设置</el-button>
  7. <el-button type="primary" @click="DeleteStaffSchedule">清除</el-button>
  8. <el-button type="primary" @click="copyStaffSchedule">复制</el-button>
  9. <el-button type="primary" icon="el-icon-printer" @click="toPrint">打印</el-button>
  10. </div>
  11. </div>
  12. <div class="app-container">
  13. <div class="cell clearfix">
  14. <el-input
  15. size="small"
  16. style="width: 150px;"
  17. class="filter-item"
  18. v-model.trim="keywords"
  19. placeholder="请输入医护人员姓名"
  20. @keyup.enter.native='toSearch'
  21. />
  22. <el-button
  23. size="small"
  24. class="filter-item"
  25. type="primary"
  26. icon="el-icon-search"
  27. @click="toSearch"
  28. >搜索</el-button
  29. >
  30. <el-select style="margin-left:10px;width:150px;" v-model="typeValue" placeholder="请选择" @change="changeOption">
  31. <el-option
  32. v-for="item in options"
  33. :key="item.value"
  34. :label="item.label"
  35. :value="item.value">
  36. </el-option>
  37. </el-select>
  38. <el-button @click="lastclick" type="text" style="margin:0 10px;">&lt;上一周({{ weekNum - 1 }})</el-button>
  39. <div class="dateBox">{{ weekDayArr[0] }}-{{ weekDayArr[6] }}({{ weekNum }})</div>
  40. <el-button @click="nextclick" type="text" style="margin:0 10px;">下一周({{ weekNum + 1 }})&gt;</el-button>
  41. </div>
  42. <div class="schedulingTable" style="display:flex;justify-content: space-between;">
  43. <div style="width: 70%">
  44. <el-table :data="tableData" border :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)', color: '#606266'}" :row-style="{ color: '#303133' }" @cell-click="clickThis" :cell-style="tableCellStyle">
  45. <el-table-column prop="name" label="医护姓名" style="width:16%" align="center">
  46. <template slot-scope="scope">
  47. <span>{{scope.row.user_name}}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column :label="'周一\n(' + weekDayArr[0] + ')'" style="width:200px" align="center">
  51. <template slot-scope="scope">
  52. <div @click="hangdleClick(scope.row,scope.$index,0)">
  53. <el-dropdown trigger="click" @command="changeSchedule">
  54. <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,1) == 2' style="color:red">
  55. <span>{{ getClass(scope.row.user_name,1) }}</span><i v-if="getTimestamp(weekDayArr[0])>=timeNow && scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  56. </span>
  57. <span class="el-dropdown-link" v-else>
  58. <span>{{ getClass(scope.row.user_name,1) }}</span><i v-if="getTimestamp(weekDayArr[0])>=timeNow && scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  59. </span>
  60. <el-dropdown-menu slot="dropdown" >
  61. <el-dropdown-item :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[0])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  62. </el-dropdown-menu>
  63. </el-dropdown>
  64. </div>
  65. </template>
  66. </el-table-column>
  67. <el-table-column prop="name" :label="'周二\n(' + weekDayArr[1] + ')'" style="width:14%" align="center">
  68. <template slot-scope="scope">
  69. <div @click="hangdleClick(scope.row,scope.$index,1)">
  70. <el-dropdown trigger="click" @command="changeSchedule">
  71. <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,2) == 2' style="color:red">
  72. <span>{{ getClass(scope.row.user_name,2) }}</span><i v-if="getTimestamp(weekDayArr[1])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  73. </span>
  74. <span class="el-dropdown-link" v-else>
  75. <span>{{ getClass(scope.row.user_name,2) }}</span><i v-if="getTimestamp(weekDayArr[1])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  76. </span>
  77. <el-dropdown-menu slot="dropdown" >
  78. <el-dropdown-item :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[1])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  79. </el-dropdown-menu>
  80. </el-dropdown>
  81. </div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column prop="name" :label="'周三\n(' + weekDayArr[2] + ')'" style="width:14%" align="center">
  85. <template slot-scope="scope">
  86. <div @click="hangdleClick(scope.row,scope.$index,2)">
  87. <el-dropdown trigger="click" @command="changeSchedule">
  88. <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,3) == 2' style="color:red">
  89. <span>{{ getClass(scope.row.user_name,3) }}</span><i v-if="getTimestamp(weekDayArr[2])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  90. </span>
  91. <span class="el-dropdown-link" v-else>
  92. <span>{{ getClass(scope.row.user_name,3) }}</span><i v-if="getTimestamp(weekDayArr[2])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  93. </span>
  94. <el-dropdown-menu slot="dropdown" >
  95. <el-dropdown-item :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[2])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  96. </el-dropdown-menu>
  97. </el-dropdown>
  98. </div>
  99. </template>
  100. </el-table-column>
  101. <el-table-column prop="name" :label="'周四\n(' + weekDayArr[3] + ')'" style="width:14%" align="center">
  102. <template slot-scope="scope">
  103. <div @click="hangdleClick(scope.row,scope.$index,3)">
  104. <el-dropdown trigger="click" @command="changeSchedule">
  105. <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,4) == 2' style="color:red">
  106. <span>{{ getClass(scope.row.user_name,4) }}</span><i v-if="getTimestamp(weekDayArr[3])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  107. </span>
  108. <span class="el-dropdown-link" v-else>
  109. <span>{{ getClass(scope.row.user_name,4) }}</span><i v-if="getTimestamp(weekDayArr[3])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" 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" :disabled="getTimestamp(weekDayArr[3])<timeNow?true:false" 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="'周五\n(' + weekDayArr[4] + ')'" style="width:14%" align="center">
  119. <template slot-scope="scope">
  120. <div @click="hangdleClick(scope.row,scope.$index,4)">
  121. <el-dropdown trigger="click" @command="changeSchedule">
  122. <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,5) == 2' style="color:red">
  123. <span>{{ getClass(scope.row.user_name,5) }}</span><i v-if="getTimestamp(weekDayArr[4])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  124. </span>
  125. <span class="el-dropdown-link" v-else>
  126. <span>{{ getClass(scope.row.user_name,5) }}</span><i v-if="getTimestamp(weekDayArr[4])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  127. </span>
  128. <el-dropdown-menu slot="dropdown" >
  129. <el-dropdown-item :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[4])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  130. </el-dropdown-menu>
  131. </el-dropdown>
  132. </div>
  133. </template>
  134. </el-table-column>
  135. <el-table-column prop="name" :label="'周六\n(' + weekDayArr[5] + ')'" style="width:14%" align="center">
  136. <template slot-scope="scope">
  137. <div @click="hangdleClick(scope.row,scope.$index,5)">
  138. <el-dropdown trigger="click" @command="changeSchedule">
  139. <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,6) == 2' style="color:red">
  140. <span>{{ getClass(scope.row.user_name,6) }}</span><i v-if="getTimestamp(weekDayArr[5])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  141. </span>
  142. <span class="el-dropdown-link" v-else>
  143. <span>{{ getClass(scope.row.user_name,6) }}</span><i v-if="getTimestamp(weekDayArr[5])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  144. </span>
  145. <el-dropdown-menu slot="dropdown" >
  146. <el-dropdown-item :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[5])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  147. </el-dropdown-menu>
  148. </el-dropdown>
  149. </div>
  150. </template>
  151. </el-table-column>
  152. <el-table-column prop="name" :label="'周日\n(' + weekDayArr[6] + ')'" style="width:14%" align="center">
  153. <template slot-scope="scope">
  154. <div @click="hangdleClick(scope.row,scope.$index,6)">
  155. <el-dropdown trigger="click" @command="changeSchedule">
  156. <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,0) == 2' style="color:red">
  157. <span>{{ getClass(scope.row.user_name,0) }}</span><i v-if="getTimestamp(weekDayArr[6])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  158. </span>
  159. <span class="el-dropdown-link" v-else>
  160. <span>{{ getClass(scope.row.user_name,0) }}</span><i v-if="getTimestamp(weekDayArr[6])>=timeNow&&scope.row.admin_user_id!=1000000?true:false" class="el-icon-arrow-down el-icon--right"></i>
  161. </span>
  162. <el-dropdown-menu slot="dropdown" >
  163. <el-dropdown-item :command="item.id" icon="el-icon-plus" :disabled="getTimestamp(weekDayArr[6])<timeNow?true:false" v-for="(item,index) in schedulelist" :key="index">{{item.class_name}}</el-dropdown-item>
  164. </el-dropdown-menu>
  165. </el-dropdown>
  166. </div>
  167. </template>
  168. </el-table-column>
  169. </el-table>
  170. </div>
  171. <div class="classBox">
  172. <div class="classTitle">班种</div>
  173. <div class="classMain">
  174. <div class="classMainBox">
  175. <p v-for="(item,index) in schedulelist" :key="index">
  176. {{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> )
  177. </p>
  178. </div>
  179. <el-checkbox style="text-align:center;padding-bottom: 10px;" v-model="isChecked" @change="toContinuous">连续排班</el-checkbox>
  180. </div>
  181. </div>
  182. </div>
  183. <el-dialog
  184. title="复制排班"
  185. width="600px"
  186. :visible.sync="newVisible"
  187. >
  188. <el-form :model="form" ref="form" label-width="90px" :rules="rules">
  189. <el-form-item label="复制到 : " required prop="copyWeek">
  190. <el-select v-model="form.copyWeek" placeholder="请选择">
  191. <el-option
  192. v-for="item in typeOptions"
  193. :key="item.value"
  194. :label="item.label"
  195. :value="item.value">
  196. </el-option>
  197. </el-select>
  198. </el-form-item>
  199. </el-form>
  200. <div slot="footer" class="dialog-footer">
  201. <el-button @click="newVisible=false">取 消</el-button>
  202. <el-button type="primary" @click="submitAction('form')">保 存</el-button>
  203. </div>
  204. </el-dialog>
  205. <el-dialog
  206. title="设置"
  207. width="800px"
  208. :visible.sync="nurseVisible"
  209. :before-close="_close"
  210. >
  211. <div>
  212. <el-tabs v-model="activeName">
  213. <el-tab-pane label="护士" name="nurse">
  214. <el-table
  215. :data="nurseList"
  216. border
  217. height="250"
  218. style="width: 100%">
  219. <el-table-column align="center" prop="name" label="姓名" width="180">
  220. <template slot-scope="scope">
  221. {{scope.row.user_name}}
  222. </template>
  223. </el-table-column>
  224. <el-table-column align="center" prop="date" label="职称" width="180">
  225. <template slot-scope="scope">
  226. <span v-if="scope.row.user_title == 1">医士</span>
  227. <span v-if="scope.row.user_title == 2">医师</span>
  228. <span v-if="scope.row.user_title == 3">住院医师</span>
  229. <span v-if="scope.row.user_title == 4">主治医师</span>
  230. <span v-if="scope.row.user_title == 5">副主任医师</span>
  231. <span v-if="scope.row.user_title == 6">主任医师</span>
  232. <span v-if="scope.row.user_title == 7">护士</span>
  233. <span v-if="scope.row.user_title == 8">护师</span>
  234. <span v-if="scope.row.user_title == 9">主管护师</span>
  235. <span v-if="scope.row.user_title == 10">副主任护师</span>
  236. <span v-if="scope.row.user_title == 11">主任护师</span>
  237. <span v-if="scope.row.user_title == 12">运营专员</span>
  238. <span v-if="scope.row.user_title == 13">运营主管</span>
  239. </template>
  240. </el-table-column>
  241. <el-table-column
  242. align="center"
  243. label="排序">
  244. <template slot-scope="scope">
  245. <el-input v-model="scope.row.sort" @change="changeSort(scope.row)" placeholder="请输入内容"></el-input>
  246. </template>
  247. </el-table-column>
  248. <el-table-column
  249. align="center"
  250. label="是否排班">
  251. <template slot-scope="scope">
  252. <el-radio-group v-model="scope.row.is_sort" @change="changeRadio(scope.row)">
  253. <el-radio :label="1">是</el-radio>
  254. <el-radio :label="0">否</el-radio>
  255. </el-radio-group>
  256. </template>
  257. </el-table-column>
  258. </el-table>
  259. </el-tab-pane>
  260. <el-tab-pane label="医生" name="doctor">
  261. <el-table
  262. :data="doctorList"
  263. border
  264. height="250"
  265. style="width: 100%">
  266. <el-table-column
  267. align="center"
  268. prop="name"
  269. label="姓名"
  270. width="180">
  271. <template slot-scope="scope">
  272. {{scope.row.user_name}}
  273. </template>
  274. </el-table-column>
  275. <el-table-column align="center" prop="date" label="职称"width="180">
  276. <template slot-scope="scope">
  277. <span v-if="scope.row.user_title == 1">医士</span>
  278. <span v-if="scope.row.user_title == 2">医师</span>
  279. <span v-if="scope.row.user_title == 3">住院医师</span>
  280. <span v-if="scope.row.user_title == 4">主治医师</span>
  281. <span v-if="scope.row.user_title == 5">副主任医师</span>
  282. <span v-if="scope.row.user_title == 6">主任医师</span>
  283. <span v-if="scope.row.user_title == 7">护士</span>
  284. <span v-if="scope.row.user_title == 8">护师</span>
  285. <span v-if="scope.row.user_title == 9">主管护师</span>
  286. <span v-if="scope.row.user_title == 10">副主任护师</span>
  287. <span v-if="scope.row.user_title == 11">主任护师</span>
  288. <span v-if="scope.row.user_title == 12">运营专员</span>
  289. <span v-if="scope.row.user_title == 13">运营主管</span>
  290. </template>
  291. </el-table-column>
  292. <el-table-column
  293. align="center"
  294. label="排序">
  295. <template slot-scope="scope">
  296. <el-input v-model="scope.row.sort" placeholder="请输入内容" @change="changeSort(scope.row)"></el-input>
  297. </template>
  298. </el-table-column>
  299. <el-table-column
  300. align="center"
  301. label="是否排班">
  302. <template slot-scope="scope">
  303. <el-radio-group v-model="scope.row.is_sort" @change="changeRadio(scope.row)">
  304. <el-radio :label="1">是</el-radio>
  305. <el-radio :label="0">否</el-radio>
  306. </el-radio-group>
  307. </template>
  308. </el-table-column>
  309. </el-table>
  310. </el-tab-pane>
  311. </el-tabs>
  312. <!-- <div style="margin-top:20px;">
  313. <p style="line-height:20px;">1.默认科室所有排序在职员工账号</p>
  314. <p style="line-height:20px;">2.护士默认排序,按加入机构先后降序排序,最先加入机构的排序为1,显示在列表最下面,自定义排序,最大的序号排在最上面</p>
  315. <p style="line-height:20px;">3.职称显示与管理中旬的员工列表显示的职称一样</p>
  316. <p style="line-height:20px;">4.是否排班,默认机构所有用户是“是”,如果是否,则该用户不在医护排班列表中</p>
  317. </div> -->
  318. </div>
  319. <!-- <div slot="footer" class="dialog-footer">
  320. <el-button @click="hide">取 消</el-button>
  321. <el-button type="primary" @click="submitAction()">保 存</el-button>
  322. </div> -->
  323. </el-dialog>
  324. </div>
  325. </div>
  326. </template>
  327. <script>
  328. const moment = require('moment')
  329. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  330. import { getDoctorList,getScheduleList,addSchedule,getStaffScheduleList,getNextWeekList,getScheduleByDoctorId,toSearchScheduleList,DeleteStaffSchedule,copyStaffSchedule,UpdateContinusSchedule,SaveNurseSort,SaveIsSchedule } from '@/api/doctorSchedule'
  331. export default {
  332. components:{
  333. BreadCrumb
  334. },
  335. data(){
  336. return{
  337. crumbs: [
  338. { path: false, name: '医护排班' },
  339. { path: '/medicalScheduling/index', name: '医护排班' }
  340. ],
  341. keywords:'',
  342. options: [{
  343. value: '0',
  344. label: '全部'
  345. }, {
  346. value: '2',
  347. label: '医生'
  348. }, {
  349. value: '3',
  350. label: '护士'
  351. }],
  352. typeValue:'0',
  353. tableData: [],
  354. isChecked:true,
  355. schedulelist:[],
  356. weekNum:'',
  357. weekDayArr:[],
  358. todayDate:'',
  359. clen:7,
  360. nowYear: new Date().getFullYear(),
  361. schedule_week:0,
  362. docobj:{},
  363. class_name:"",
  364. doctorlist:[],
  365. schedule_date:"",
  366. newVisible:false,
  367. typeOptions:[],
  368. timeOptions:[],
  369. copyWeek:'',
  370. weekList: [],
  371. currentFirstDate1: '',
  372. form:{
  373. copyWeek:"",
  374. },
  375. rules: {
  376. copyWeek: [{ required: true, message: "请选择复制时间段", trigger: "blur" }],
  377. },
  378. timeNow:0,
  379. arrZero:[],
  380. arrOne:[],
  381. arrTwo:[],
  382. arrThree:[],
  383. arrFour:[],
  384. arrFive:[],
  385. arrSix:[],
  386. arrSeven:[],
  387. //
  388. nurseTableData: [{
  389. date: '2016-05-02',
  390. name: '王小虎',
  391. address: '上海市普陀区金沙江路 1518 弄'
  392. }, {
  393. date: '2016-05-04',
  394. name: '王小虎',
  395. address: '上海市普陀区金沙江路 1517 弄'
  396. }, {
  397. date: '2016-05-01',
  398. name: '王小虎',
  399. address: '上海市普陀区金沙江路 1519 弄'
  400. }, {
  401. date: '2016-05-03',
  402. name: '王小虎',
  403. address: '上海市普陀区金沙江路 1516 弄'
  404. }],
  405. nurseVisible:false,
  406. activeName:'nurse',
  407. radio:'1',
  408. nurseList:[],
  409. doctorList:[],
  410. }
  411. },
  412. methods:{
  413. search(){},
  414. toPrint(){
  415. this.$router.push({
  416. path: '/medicalScheduling/schedule/print?starttime='+this.getTimestamp(this.weekDayArr[0])+"&endtime="+this.getTimestamp(this.weekDayArr[6])+"&weekArr="+ this.weekDayArr+"&typeValue="+this.typeValue,
  417. // query: { date: date }
  418. })
  419. },
  420. getDoctorList(){
  421. getDoctorList().then(response=>{
  422. if(response.data.state == 1){
  423. var list = response.data.data.list
  424. console.log("医护列表",list)
  425. this.tableData = list
  426. this.doctorlist = list
  427. //获取班种列表
  428. this.getStaffScheduleList()
  429. var doctorlist = response.data.data.doctorlist
  430. for(let i=0;i<doctorlist.length;i++){
  431. if(doctorlist[i].sort == 0){
  432. doctorlist[i].sort = ""
  433. }
  434. }
  435. console.log('doctorlist',doctorlist)
  436. this.doctorList = doctorlist
  437. var nurselist = response.data.data.nurselist
  438. for(let i=0;i<nurselist.length;i++){
  439. if(nurselist[i].sort == 0){
  440. nurselist[i].sort = ""
  441. }
  442. }
  443. this.nurseList = nurselist
  444. }
  445. })
  446. },
  447. getScheduleList(){
  448. getScheduleList().then(response=>{
  449. if(response.data.state == 1){
  450. var schedulelist = response.data.data.scheduleList
  451. // console.log("schedulelist",schedulelist)
  452. for(let i=0;i<schedulelist.length;i++){
  453. if(schedulelist[i].timeone_type == 1){
  454. schedulelist[i].timeone_type = "当日"
  455. }
  456. if(schedulelist[i].timeone_type == 2){
  457. schedulelist[i].timeone_type = "次日"
  458. }
  459. if(schedulelist[i].timetwo_type == 1){
  460. schedulelist[i].timetwo_type = "当日"
  461. }
  462. if(schedulelist[i].timetwo_type == 2){
  463. schedulelist[i].timetwo_type = "次日"
  464. }
  465. }
  466. this.schedulelist = schedulelist
  467. }
  468. })
  469. },
  470. hangdleClick(val,index,num){
  471. // console.log("val",val)
  472. this.docobj = val
  473. if(this.getTimestamp(this.weekDayArr[num]) < this.timeNow){
  474. this.$message.error("过去日期不可以编辑")
  475. return
  476. }
  477. },
  478. clickThis(row, column, cell, event){
  479. var week = (column.label).split('');
  480. var weeks = week[0]+week[1]
  481. if(weeks == "周日"){
  482. this.schedule_week = 0
  483. this.schedule_date = this.weekDayArr[6]
  484. }
  485. if(weeks == "周一"){
  486. this.schedule_week = 1
  487. this.schedule_date = this.weekDayArr[0]
  488. }
  489. if(weeks=="周二"){
  490. this.schedule_week = 2
  491. this.schedule_date = this.weekDayArr[1]
  492. }
  493. if(weeks=="周三"){
  494. this.schedule_week = 3
  495. this.schedule_date = this.weekDayArr[2]
  496. }
  497. if(weeks=="周四"){
  498. this.schedule_week = 4
  499. this.schedule_date = this.weekDayArr[3]
  500. }
  501. if(weeks == "周五"){
  502. this.schedule_week = 5
  503. this.schedule_date = this.weekDayArr[4]
  504. }
  505. if(weeks== "周六"){
  506. this.schedule_week = 6
  507. this.schedule_date = this.weekDayArr[5]
  508. }
  509. },
  510. changeSchedule(id){
  511. var class_name = ""
  512. for(let i=0;i<this.schedulelist.length;i++){
  513. if(id == this.schedulelist[i].id){
  514. class_name = this.schedulelist[i].class_name
  515. }
  516. }
  517. let arr = [...this.tableData]
  518. // console.log("arr===",arr)
  519. for(let i=0;i<arr.length;i++){
  520. if(this.docobj.id == arr[i].id){
  521. arr[i].class_name = class_name
  522. arr[i].class_index = this.schedule_week
  523. }
  524. }
  525. // console.log("arr",arr)
  526. this.tableData = arr
  527. const params = {
  528. doctor_id:this.docobj.admin_user_id,
  529. doctor_type:this.docobj.user_type,
  530. schedule_type:id,
  531. schedule_week:this.schedule_week,
  532. start_time:this.getTimestamp(this.weekDayArr[0]),
  533. end_time:this.getTimestamp(this.weekDayArr[6]),
  534. schedule_date:this.getTimestamp(this.schedule_date)
  535. }
  536. // console.log("params",params)
  537. addSchedule(params).then(response=>{
  538. if(response.data.state == 1){
  539. var schedule = response.data.data.schedule
  540. // console.log("schedule",schedule)
  541. this.$message.success("保存成功")
  542. this.getStaffScheduleList()
  543. }
  544. })
  545. },
  546. formatDate(date){
  547. var year = date.getFullYear()+'.'
  548. var month = (date.getMonth()+1)+'.';
  549. var day = date.getDate();
  550. return year+month+day
  551. },
  552. formatDateTwo(date){
  553. var year = date.getFullYear()+'.'
  554. var month = (date.getMonth()+1)+'.';
  555. var day = date.getDate();
  556. return year+month+day
  557. },
  558. addDate(date,n){
  559. date.setDate(date.getDate()+n);
  560. return date;
  561. },
  562. //
  563. setDate(date){
  564. var week = date.getDay()-1;
  565. date = this.addDate(date,week*-1);
  566. this.currentFirstDate = new Date(date);
  567. this.currentDate = new Date(date)
  568. for(var i = 0;i<this.clen; i++){
  569. this.weekDayArr.push(this.formatDate(i==0 ? date : this.addDate(date,1)))
  570. }
  571. },
  572. //上一周
  573. lastclick(){
  574. this.weekDayArr=[]
  575. this.setDate(this.addDate(this.currentFirstDate,-7));
  576. if (this.weekNum == 1) {
  577. let year = this.nowYear - 1
  578. let month = 12
  579. let date = 31
  580. this.weekNum = this.getYearWeek(year, month, date)
  581. this.nowYear = this.nowYear - 1
  582. }
  583. this.weekNum = this.weekNum - 1
  584. this.getNextWeekList()
  585. },
  586. //下一周
  587. nextclick(){
  588. this.weekDayArr=[]
  589. this.setDate(this.addDate(this.currentFirstDate,7));
  590. this.weekNum = this.weekNum + 1
  591. if (this.weekNum == 53) {
  592. let year = this.nowYear + 1
  593. let month = 1
  594. let date = 1
  595. this.weekNum = this.getYearWeek(year, month, date)
  596. this.nowYear = this.nowYear + 1
  597. }
  598. this.getNextWeekList()
  599. },
  600. getYearWeek(year,month,date){
  601. /*
  602. dateNow是当前日期
  603. dateFirst是当年第一天
  604. dataNumber是当前日期是今年第多少天
  605. 用dataNumber + 当前年的第一天的周差距的和在除以7就是本年第几周
  606. */
  607. let dateNow = new Date(year, parseInt(month) - 1, date);
  608. let dateFirst = new Date(year, 0, 1);
  609. let dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 86400000);
  610. return Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7);
  611. },
  612. getTimestamp(time) { //把时间日期转成时间戳
  613. return (new Date(time)).getTime() / 1000
  614. },
  615. beforeHandleCommand(item,row){
  616. return {
  617. 'command': item,
  618. 'row': row
  619. }
  620. },
  621. //获取所有医护排班数据
  622. getStaffScheduleList(){
  623. const params = {
  624. start_time:this.getTimestamp(this.weekDayArr[0]),
  625. end_time:this.getTimestamp(this.weekDayArr[6])
  626. }
  627. getStaffScheduleList(params).then(response=>{
  628. if(response.data.state == 1){
  629. var staffList = response.data.data.staffList
  630. // console.log("获取所有排班",staffList)
  631. var sevenStr = ""
  632. var oneStr = ""
  633. var twoStr = ""
  634. var threeStr = ""
  635. var fourStr = ""
  636. var fiveStr = ""
  637. var sixStr = ""
  638. this.arrZero = []
  639. this.arrOne = []
  640. this.arrTwo = []
  641. this.arrThree = []
  642. this.arrFour = []
  643. this.arrFive = []
  644. this.arrSix = []
  645. for(let i=0;i<staffList.length;i++){
  646. if(staffList[i].schedule_week == 0){
  647. staffList[i].class_index = 0
  648. var arr = []
  649. this.arrZero.push(staffList[i].class_name)
  650. for(let i=0;i<this.arrZero.length;i++){
  651. if(this.arrZero[i]!=''){
  652. arr.push(this.arrZero[i])
  653. }
  654. }
  655. var countedNames = arr.reduce(function (allNames, name) {
  656. if (name in allNames) {
  657. allNames[name]++;
  658. }
  659. else {
  660. allNames[name] = 1;
  661. }
  662. return allNames;
  663. }, {});
  664. let objKey = Object.keys(countedNames)
  665. let objVal = Object.values(countedNames)
  666. var zeroStr = ''
  667. objKey.map((item,index) => {
  668. let objVal = Object.values(countedNames)
  669. zeroStr += item + objVal[index] + '\n'
  670. })
  671. sevenStr = zeroStr
  672. }
  673. if(staffList[i].schedule_week == 1){
  674. staffList[i].class_index = 1
  675. var arr = []
  676. this.arrOne.push(staffList[i].class_name)
  677. for(let i=0;i<this.arrOne.length;i++){
  678. if(this.arrOne[i]!=''){
  679. arr.push(this.arrOne[i])
  680. }
  681. }
  682. var countedNames = arr.reduce(function (allNames, name) {
  683. if (name in allNames) {
  684. allNames[name]++;
  685. }
  686. else {
  687. allNames[name] = 1;
  688. }
  689. return allNames;
  690. }, {});
  691. let objKey = Object.keys(countedNames)
  692. let objVal = Object.values(countedNames)
  693. let strOne = ''
  694. objKey.map((item,index) => {
  695. let objVal = Object.values(countedNames)
  696. strOne += item + objVal[index] + '\n'
  697. })
  698. oneStr = strOne
  699. }
  700. if(staffList[i].schedule_week == 2){
  701. staffList[i].class_index = 2
  702. var arr = []
  703. this.arrTwo.push(staffList[i].class_name)
  704. for(let i=0;i<this.arrTwo.length;i++){
  705. if(this.arrTwo[i]!=''){
  706. arr.push(this.arrTwo[i])
  707. }
  708. }
  709. var countedNames = arr.reduce(function (allNames, name) {
  710. if (name in allNames) {
  711. allNames[name]++;
  712. }
  713. else {
  714. allNames[name] = 1;
  715. }
  716. return allNames;
  717. }, {});
  718. let objKey = Object.keys(countedNames)
  719. let objVal = Object.values(countedNames)
  720. let strTwo = ''
  721. objKey.map((item,index) => {
  722. let objVal = Object.values(countedNames)
  723. strTwo += item + objVal[index] + '\n'
  724. })
  725. twoStr = strTwo
  726. }
  727. if(staffList[i].schedule_week == 3){
  728. staffList[i].class_index = 3
  729. var arr = []
  730. this.arrThree.push(staffList[i].class_name)
  731. for(let i=0;i<this.arrThree.length;i++){
  732. if(this.arrThree[i]!=''){
  733. arr.push(this.arrThree[i])
  734. }
  735. }
  736. var countedNames = arr.reduce(function (allNames, name) {
  737. if (name in allNames) {
  738. allNames[name]++;
  739. }
  740. else {
  741. allNames[name] = 1;
  742. }
  743. return allNames;
  744. }, {});
  745. let objKey = Object.keys(countedNames)
  746. let objVal = Object.values(countedNames)
  747. let strThree = ''
  748. objKey.map((item,index) => {
  749. let objVal = Object.values(countedNames)
  750. strThree += item + objVal[index] + '\n'
  751. })
  752. threeStr = strThree
  753. }
  754. if(staffList[i].schedule_week == 4){
  755. staffList[i].class_index = 4
  756. var arr = []
  757. this.arrFour.push(staffList[i].class_name)
  758. for(let i=0;i<this.arrFour.length;i++){
  759. if(this.arrFour[i]!=''){
  760. arr.push(this.arrFour[i])
  761. }
  762. }
  763. var countedNames = arr.reduce(function (allNames, name) {
  764. if (name in allNames) {
  765. allNames[name]++;
  766. }
  767. else {
  768. allNames[name] = 1;
  769. }
  770. return allNames;
  771. }, {});
  772. let objKey = Object.keys(countedNames)
  773. let objVal = Object.values(countedNames)
  774. let strFour = ''
  775. objKey.map((item,index) => {
  776. let objVal = Object.values(countedNames)
  777. strFour += item + objVal[index] + '\n'
  778. })
  779. fourStr = strFour
  780. }
  781. if(staffList[i].schedule_week == 5){
  782. staffList[i].class_index = 5
  783. var arr = []
  784. this.arrFive.push(staffList[i].class_name)
  785. for(let i=0;i<this.arrFive.length;i++){
  786. if(this.arrFive[i]!=''){
  787. arr.push(this.arrFive[i])
  788. }
  789. }
  790. var countedNames = arr.reduce(function (allNames, name) {
  791. if (name in allNames) {
  792. allNames[name]++;
  793. }
  794. else {
  795. allNames[name] = 1;
  796. }
  797. return allNames;
  798. }, {});
  799. let objKey = Object.keys(countedNames)
  800. let objVal = Object.values(countedNames)
  801. let strFive = ''
  802. objKey.map((item,index) => {
  803. let objVal = Object.values(countedNames)
  804. strFive += item + objVal[index] + '\n'
  805. })
  806. fiveStr = strFive
  807. }
  808. if(staffList[i].schedule_week == 6){
  809. staffList[i].class_index = 6
  810. var arr = []
  811. this.arrSix.push(staffList[i].class_name)
  812. for(let i=0;i<this.arrSix.length;i++){
  813. if(this.arrSix[i]!=''){
  814. arr.push(this.arrSix[i])
  815. }
  816. }
  817. var countedNames = arr.reduce(function (allNames, name) {
  818. if (name in allNames) {
  819. allNames[name]++;
  820. }
  821. else {
  822. allNames[name] = 1;
  823. }
  824. return allNames;
  825. }, {});
  826. let objKey = Object.keys(countedNames)
  827. let objVal = Object.values(countedNames)
  828. let strSix = ''
  829. objKey.map((item,index) => {
  830. let objVal = Object.values(countedNames)
  831. strSix += item + objVal[index] + '\n'
  832. })
  833. sixStr = strSix
  834. }
  835. }
  836. let tempArr = [], newArr = []
  837. for (let i = 0; i < staffList.length; i++) {
  838. if (tempArr.indexOf(staffList[i].user_name) === -1) {
  839. newArr.push({
  840. user_name: staffList[i].user_name,
  841. admin_user_id:staffList[i].admin_user_id,
  842. user_type:staffList[i].doctor_type,
  843. user_type:staffList[i].doctor_type,
  844. list: [{class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes}]
  845. })
  846. tempArr.push(staffList[i].user_name);
  847. } else {
  848. for (let j = 0; j < newArr.length; j++) {
  849. if (newArr[j].user_name == staffList[i].user_name) {
  850. newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes})
  851. }
  852. }
  853. }
  854. }
  855. let arr = [...newArr]
  856. arr.sort(this.compare('admin_user_id'))
  857. this.doctorlist.sort(this.compare('admin_user_id'))
  858. this.doctorlist.forEach((item, index) => {
  859.   if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
  860.   }else{
  861.     arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
  862.   }
  863. })
  864. arr.sort(this.compare('user_type'))
  865. let arr2 = []
  866. arr2.push({class_name:oneStr,schedule_week:1})
  867. arr2.push({class_name:twoStr,schedule_week:2})
  868. arr2.push({class_name:threeStr,schedule_week:3})
  869. arr2.push({class_name:fourStr,schedule_week:4})
  870. arr2.push({class_name:fiveStr,schedule_week:5})
  871. arr2.push({class_name:sixStr,schedule_week:6})
  872. arr2.push({class_name:zeroStr,schedule_week:0})
  873. var obj = {}
  874. obj.admin_user_id = "1000000"
  875. obj.user_name = "合计"
  876. obj.user_type = 10
  877. obj.list = arr2
  878. arr.push(obj)
  879. this.tableData = arr
  880. }
  881. })
  882. },
  883. getClass(name,index){
  884. if(name != undefined){
  885. let newClass = '';
  886. this.tableData.map(item => {
  887. if(item.user_name == name){
  888. if(item.list){
  889. item.list.map(it => {
  890. if(it.schedule_week == index){
  891. newClass = it.class_name
  892. }
  893. })
  894. }
  895. }
  896. })
  897. return newClass
  898. }
  899. },
  900. getClassAttributes(name,index){
  901. if(name != undefined){
  902. let newClass = '';
  903. this.tableData.map(item => {
  904. if(item.user_name == name){
  905. if(item.list){
  906. item.list.map(it => {
  907. if(it.schedule_week == index){
  908. newClass = it.class_attributes
  909. }
  910. })
  911. }
  912. }
  913. })
  914. return newClass
  915. }
  916. },
  917. unique(arr) {
  918. const res = new Map();
  919. return arr.filter((arr) => !res.has(arr.admin_user_id) && res.set(arr.admin_user_id, 1))
  920. },
  921. //获取上一周下一周的排班数据
  922. getNextWeekList(){
  923. const params = {
  924. start_time:this.getTimestamp(this.weekDayArr[0]),
  925. end_time:this.getTimestamp(this.weekDayArr[6])
  926. }
  927. getNextWeekList(params).then(response=>{
  928. if(response.data.state == 1){
  929. var staffList = response.data.data.staffList
  930. // console.log("上下周数据",staffList)
  931. var sevenStr = ""
  932. var oneStr = ""
  933. var twoStr = ""
  934. var threeStr = ""
  935. var fourStr = ""
  936. var fiveStr = ""
  937. var sixStr = ""
  938. this.arrZero = []
  939. this.arrOne = []
  940. this.arrTwo = []
  941. this.arrThree = []
  942. this.arrFour = []
  943. this.arrFive = []
  944. this.arrSix = []
  945. for(let i=0;i<staffList.length;i++){
  946. if(staffList[i].schedule_week == 0){
  947. staffList[i].class_index = 0
  948. var arr = []
  949. this.arrZero.push(staffList[i].class_name)
  950. for(let i=0;i<this.arrZero.length;i++){
  951. if(this.arrZero[i]!=''){
  952. arr.push(this.arrZero[i])
  953. }
  954. }
  955. var countedNames = arr.reduce(function (allNames, name) {
  956. if (name in allNames) {
  957. allNames[name]++;
  958. }
  959. else {
  960. allNames[name] = 1;
  961. }
  962. return allNames;
  963. }, {});
  964. let objKey = Object.keys(countedNames)
  965. let objVal = Object.values(countedNames)
  966. var zeroStr = ''
  967. objKey.map((item,index) => {
  968. let objVal = Object.values(countedNames)
  969. zeroStr += item + objVal[index] + '\n'
  970. })
  971. sevenStr = zeroStr
  972. }
  973. if(staffList[i].schedule_week == 1){
  974. staffList[i].class_index = 1
  975. var arr = []
  976. this.arrOne.push(staffList[i].class_name)
  977. for(let i=0;i<this.arrOne.length;i++){
  978. if(this.arrOne[i]!=''){
  979. arr.push(this.arrOne[i])
  980. }
  981. }
  982. var countedNames = arr.reduce(function (allNames, name) {
  983. if (name in allNames) {
  984. allNames[name]++;
  985. }
  986. else {
  987. allNames[name] = 1;
  988. }
  989. return allNames;
  990. }, {});
  991. let objKey = Object.keys(countedNames)
  992. let objVal = Object.values(countedNames)
  993. let strOne = ''
  994. objKey.map((item,index) => {
  995. let objVal = Object.values(countedNames)
  996. strOne += item + objVal[index] + '\n'
  997. })
  998. oneStr = strOne
  999. }
  1000. if(staffList[i].schedule_week == 2){
  1001. staffList[i].class_index = 2
  1002. var arr = []
  1003. this.arrTwo.push(staffList[i].class_name)
  1004. for(let i=0;i<this.arrTwo.length;i++){
  1005. if(this.arrTwo[i]!=''){
  1006. arr.push(this.arrTwo[i])
  1007. }
  1008. }
  1009. var countedNames = arr.reduce(function (allNames, name) {
  1010. if (name in allNames) {
  1011. allNames[name]++;
  1012. }
  1013. else {
  1014. allNames[name] = 1;
  1015. }
  1016. return allNames;
  1017. }, {});
  1018. let objKey = Object.keys(countedNames)
  1019. let objVal = Object.values(countedNames)
  1020. let strTwo = ''
  1021. objKey.map((item,index) => {
  1022. let objVal = Object.values(countedNames)
  1023. strTwo += item + objVal[index] + '\n'
  1024. })
  1025. twoStr = strTwo
  1026. }
  1027. if(staffList[i].schedule_week == 3){
  1028. staffList[i].class_index = 3
  1029. var arr = []
  1030. this.arrThree.push(staffList[i].class_name)
  1031. for(let i=0;i<this.arrThree.length;i++){
  1032. if(this.arrThree[i]!=''){
  1033. arr.push(this.arrThree[i])
  1034. }
  1035. }
  1036. var countedNames = arr.reduce(function (allNames, name) {
  1037. if (name in allNames) {
  1038. allNames[name]++;
  1039. }
  1040. else {
  1041. allNames[name] = 1;
  1042. }
  1043. return allNames;
  1044. }, {});
  1045. let objKey = Object.keys(countedNames)
  1046. let objVal = Object.values(countedNames)
  1047. let strThree = ''
  1048. objKey.map((item,index) => {
  1049. let objVal = Object.values(countedNames)
  1050. strThree += item + objVal[index] + '\n'
  1051. })
  1052. threeStr = strThree
  1053. }
  1054. if(staffList[i].schedule_week == 4){
  1055. staffList[i].class_index = 4
  1056. var arr = []
  1057. this.arrFour.push(staffList[i].class_name)
  1058. for(let i=0;i<this.arrFour.length;i++){
  1059. if(this.arrFour[i]!=''){
  1060. arr.push(this.arrFour[i])
  1061. }
  1062. }
  1063. var countedNames = arr.reduce(function (allNames, name) {
  1064. if (name in allNames) {
  1065. allNames[name]++;
  1066. }
  1067. else {
  1068. allNames[name] = 1;
  1069. }
  1070. return allNames;
  1071. }, {});
  1072. let objKey = Object.keys(countedNames)
  1073. let objVal = Object.values(countedNames)
  1074. let strFour = ''
  1075. objKey.map((item,index) => {
  1076. let objVal = Object.values(countedNames)
  1077. strFour += item + objVal[index] + '\n'
  1078. })
  1079. fourStr = strFour
  1080. }
  1081. if(staffList[i].schedule_week == 5){
  1082. staffList[i].class_index = 5
  1083. var arr = []
  1084. this.arrFive.push(staffList[i].class_name)
  1085. for(let i=0;i<this.arrFive.length;i++){
  1086. if(this.arrFive[i]!=''){
  1087. arr.push(this.arrFive[i])
  1088. }
  1089. }
  1090. var countedNames = arr.reduce(function (allNames, name) {
  1091. if (name in allNames) {
  1092. allNames[name]++;
  1093. }
  1094. else {
  1095. allNames[name] = 1;
  1096. }
  1097. return allNames;
  1098. }, {});
  1099. let objKey = Object.keys(countedNames)
  1100. let objVal = Object.values(countedNames)
  1101. let strFive = ''
  1102. objKey.map((item,index) => {
  1103. let objVal = Object.values(countedNames)
  1104. strFive += item + objVal[index] + '\n'
  1105. })
  1106. fiveStr = strFive
  1107. }
  1108. if(staffList[i].schedule_week == 6){
  1109. staffList[i].class_index = 6
  1110. var arr = []
  1111. this.arrSix.push(staffList[i].class_name)
  1112. for(let i=0;i<this.arrSix.length;i++){
  1113. if(this.arrSix[i]!=''){
  1114. arr.push(this.arrSix[i])
  1115. }
  1116. }
  1117. var countedNames = arr.reduce(function (allNames, name) {
  1118. if (name in allNames) {
  1119. allNames[name]++;
  1120. }
  1121. else {
  1122. allNames[name] = 1;
  1123. }
  1124. return allNames;
  1125. }, {});
  1126. let objKey = Object.keys(countedNames)
  1127. let objVal = Object.values(countedNames)
  1128. let strSix = ''
  1129. objKey.map((item,index) => {
  1130. let objVal = Object.values(countedNames)
  1131. strSix += item + objVal[index] + '\n'
  1132. })
  1133. sixStr = strSix
  1134. }
  1135. }
  1136. let tempArr = [], newArr = []
  1137. for (let i = 0; i < staffList.length; i++) {
  1138. if (tempArr.indexOf(staffList[i].user_name) === -1) {
  1139. newArr.push({
  1140. user_name: staffList[i].user_name,
  1141. admin_user_id:staffList[i].admin_user_id,
  1142. user_type:staffList[i].doctor_type,
  1143. list: [{class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes}]
  1144. })
  1145. tempArr.push(staffList[i].user_name);
  1146. } else {
  1147. for (let j = 0; j < newArr.length; j++) {
  1148. if (newArr[j].user_name == staffList[i].user_name) {
  1149. newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes})
  1150. }
  1151. }
  1152. }
  1153. }
  1154. let arr = [...newArr]
  1155. arr.sort(this.compare('admin_user_id'))
  1156. this.doctorlist.sort(this.compare('admin_user_id'))
  1157. this.doctorlist.forEach((item, index) => {
  1158.   if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
  1159.   }else{
  1160.     arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
  1161.     // console.log("arr",arr)
  1162.   }
  1163. })
  1164. arr.sort(this.compare('user_type'))
  1165. let arr2 = []
  1166. arr2.push({class_name:oneStr,schedule_week:1})
  1167. arr2.push({class_name:twoStr,schedule_week:2})
  1168. arr2.push({class_name:threeStr,schedule_week:3})
  1169. arr2.push({class_name:fourStr,schedule_week:4})
  1170. arr2.push({class_name:fiveStr,schedule_week:5})
  1171. arr2.push({class_name:sixStr,schedule_week:6})
  1172. arr2.push({class_name:zeroStr,schedule_week:0})
  1173. var obj = {}
  1174. obj.admin_user_id = "1000000"
  1175. obj.user_name = "合计"
  1176. obj.user_type = 10
  1177. obj.list = arr2
  1178. arr.push(obj)
  1179. this.tableData = arr
  1180. }
  1181. })
  1182. },
  1183. changeOption(id){
  1184. const params = {
  1185. start_time:this.getTimestamp(this.weekDayArr[0]),
  1186. end_time:this.getTimestamp(this.weekDayArr[6]),
  1187. doctor_id:id
  1188. }
  1189. getScheduleByDoctorId(params).then(response=>{
  1190. if(response.data.state == 1){
  1191. var staffList = response.data.data.staffList
  1192. // console.log("staffList",staffList)
  1193. let tempArr = [], newArr = []
  1194. for (let i = 0; i < staffList.length; i++) {
  1195. if (tempArr.indexOf(staffList[i].user_name) === -1) {
  1196. newArr.push({
  1197. user_type:staffList[i].doctor_type,
  1198. user_name: staffList[i].user_name,
  1199. admin_user_id:staffList[i].admin_user_id,
  1200. list: [{class_name:staffList[i].class_name,schedule_week:staffList[i].schedule_week}]
  1201. })
  1202. tempArr.push(staffList[i].user_name);
  1203. } else {
  1204. for (let j = 0; j < newArr.length; j++) {
  1205. if (newArr[j].user_name == staffList[i].user_name) {
  1206. newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week, user_type:staffList[i].doctor_type})
  1207. }
  1208. }
  1209. }
  1210. }
  1211. if(id == 0){
  1212. let arr = [...newArr]
  1213. arr.sort(this.compare('admin_user_id'))
  1214. this.doctorlist.sort(this.compare('admin_user_id'))
  1215. this.doctorlist.forEach((item, index) => {
  1216.   if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
  1217.   }else{
  1218.     arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
  1219.     // console.log("arr",arr)
  1220.   }
  1221. })
  1222. arr.sort(this.compare('user_type'))
  1223. this.tableData = arr
  1224. }
  1225. if(id == 2){
  1226. let arr = [...newArr]
  1227. arr.sort(this.compare('admin_user_id'))
  1228. this.doctorlist.sort(this.compare('admin_user_id'))
  1229. let newDoctor = []
  1230. this.doctorlist.map(item => {
  1231. if (item.user_type == 2) {
  1232. newDoctor.push(item)
  1233. }
  1234. })
  1235. newDoctor.map((item, index) => {
  1236. if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
  1237.   }else{
  1238.     arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: []})
  1239.     // console.log("arr",arr)
  1240.   }
  1241. })
  1242. this.tableData = arr
  1243. }
  1244. if(id == 3){
  1245. let arr = [...newArr]
  1246. arr.sort(this.compare('admin_user_id'))
  1247. this.doctorlist.sort(this.compare('admin_user_id'))
  1248. let newDoctor = []
  1249. this.doctorlist.map(item => {
  1250. if (item.user_type == 3) {
  1251. newDoctor.push(item)
  1252. }
  1253. })
  1254. newDoctor.map((item, index) => {
  1255. if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
  1256.   }else{
  1257.     arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: []})
  1258.     // console.log("arr",arr)
  1259.   }
  1260. })
  1261. this.tableData = arr
  1262. }
  1263. }
  1264. })
  1265. },
  1266. toSearch(){
  1267. const params = {
  1268. user_name: this.keywords,
  1269. start_time:this.getTimestamp(this.weekDayArr[0]),
  1270. end_time:this.getTimestamp(this.weekDayArr[6])
  1271. }
  1272. toSearchScheduleList(params).then(response=>{
  1273. if(response.data.state == 1){
  1274. var staffList = response.data.data.staffList
  1275. // console.log("搜索",staffList)
  1276. let tempArr = [], newArr = []
  1277. for (let i = 0; i < staffList.length; i++) {
  1278. if (tempArr.indexOf(staffList[i].user_name) === -1) {
  1279. newArr.push({
  1280. user_name: staffList[i].user_name,
  1281. admin_user_id:staffList[i].admin_user_id,
  1282. list: [{class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes}]
  1283. })
  1284. tempArr.push(staffList[i].user_name);
  1285. } else {
  1286. for (let j = 0; j < newArr.length; j++) {
  1287. if (newArr[j].user_name == staffList[i].user_name) {
  1288. newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week,user_type:staffList[i].doctor_type,class_attributes:staffList[i].class_attributes})
  1289. }
  1290. }
  1291. }
  1292. }
  1293. if(this.keywords != ''){
  1294. this.tableData = newArr
  1295. }else{
  1296. let arr = [...newArr]
  1297. arr.sort(this.compare('admin_user_id'))
  1298. this.doctorlist.sort(this.compare('admin_user_id'))
  1299. this.doctorlist.forEach((item, index) => {
  1300.   if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
  1301.   }else{
  1302.     arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: []})
  1303.     // console.log("arr",arr)
  1304.   }
  1305. })
  1306. this.tableData = arr
  1307. }
  1308. }
  1309. })
  1310. },
  1311. DeleteStaffSchedule(){
  1312. const params = {
  1313. start_time:this.getTimestamp(this.weekDayArr[0]),
  1314. end_time:this.getTimestamp(this.weekDayArr[6])
  1315. }
  1316. this.$confirm(
  1317. '是否要清除当周排班? <br>清除后,信息将无法恢复',
  1318. '删除提示',
  1319. {
  1320. dangerouslyUseHTMLString: true,
  1321. confirmButtonText: '确定',
  1322. cancelButtonText: '取消',
  1323. type: 'warning'
  1324. }
  1325. ).then(()=>{
  1326. DeleteStaffSchedule(params).then(response=>{
  1327. if(response.data.state == 1){
  1328. var msg = response.data.data.msg
  1329. this.$message.success("清除成功")
  1330. this.getStaffScheduleList()
  1331. }
  1332. })
  1333. })
  1334. },
  1335. copyStaffSchedule(){
  1336. this.newVisible = true
  1337. // const params = {
  1338. // start_time:this.getTimestamp(this.weekDayArr[0]),
  1339. // end_time:this.getTimestamp(this.weekDayArr[6])
  1340. // }
  1341. // copyStaffSchedule(params).then(response=>{
  1342. // if(response.data.state == 1){
  1343. // var msg = response.data.data.msg
  1344. // console.log("msg",msg)
  1345. // this.$message.success("复制成功")
  1346. // }else{
  1347. // this.$message.error("排班已存在")
  1348. // }
  1349. // })
  1350. },
  1351. toContinuous(){
  1352. var is_status = 0
  1353. if(this.isChecked == false){
  1354. is_status = 0
  1355. }
  1356. if(this.isChecked == true){
  1357. is_status = 1
  1358. }
  1359. const params = {
  1360. is_status:is_status
  1361. }
  1362. UpdateContinusSchedule(params).then(response=>{
  1363. if(response.data.state == 1){
  1364. var schedule = response.data.data.schedule
  1365. this.$message.success("保存成功")
  1366. }
  1367. })
  1368. },
  1369. setDate1 (date) {
  1370. var week = date.getDay() - 1
  1371. date = this.addDate(date, week * -1)
  1372. this.currentDate = new Date(date)
  1373. let arr1 = []
  1374. for (var i = 0; i < this.clen; i++) {
  1375. arr1.push(this.formatDate(i == 0 ? date : this.addDate(date, 1)))
  1376. }
  1377. this.weekList.push(arr1)
  1378. let num = this.weekNum
  1379. this.currentFirstDate1 = num + 1
  1380. },
  1381. submitAction(formName){
  1382. var label = ""
  1383. for(let i=0;i<this.timeOptions.length;i++){
  1384. if(this.form.copyWeek == this.timeOptions[i].value){
  1385. label = this.timeOptions[i].label
  1386. }
  1387. }
  1388. var start = label.split('~')
  1389. var copy_startime = this.getTimestamp(start[0])
  1390. var copy_endtime = this.getTimestamp(start[1])
  1391. const params = {
  1392. start_time:this.getTimestamp(this.weekDayArr[0]),
  1393. end_time:this.getTimestamp(this.weekDayArr[6]),
  1394. copy_startime:copy_startime,
  1395. copy_endtime:copy_endtime,
  1396. }
  1397. this.$refs[formName].validate(valid=>{
  1398. if(valid){
  1399. copyStaffSchedule(params).then(response=>{
  1400. if(response.data.state == 1){
  1401. var msg = response.data.data.msg
  1402. this.$message.success("复制成功")
  1403. this.newVisible = false
  1404. }else{
  1405. this.$message.error("排班已存在")
  1406. }
  1407. })
  1408. }
  1409. })
  1410. },
  1411. compare(property){
  1412. return function(a,b){
  1413. var value1 = a[property];
  1414. var value2 = b[property];
  1415. return value2 - value1;
  1416. }
  1417. },
  1418. tableCellStyle (row, rowIndex, column) {
  1419. var week = (row.column.label).split('');
  1420. var weeks = 0
  1421. if (week.length == 13) {
  1422. weeks = week[4]+week[5]+week[6]+week[7]+week[8]+week[9]+week[10]+week[11]
  1423. }
  1424. if (week.length == 14) {
  1425. weeks = week[4]+week[5]+week[6]+week[7]+week[8]+week[9]+week[10]+week[11]+week[12]
  1426. }
  1427. // console.log("week",week)
  1428. // console.log("weeks",weeks)
  1429. var weekdate = this.getTimestamp(weeks)
  1430. if(weekdate < this.timeNow){
  1431. return 'background-color:#e5e5e5;'
  1432. }
  1433. },
  1434. setting(){
  1435. this.nurseVisible = true
  1436. },
  1437. _close: function(done) {
  1438. done();
  1439. },
  1440. changeSort(val){
  1441. console.log('val',val)
  1442. const params = {
  1443. sort:parseInt(val.sort),
  1444. id:val.id,
  1445. }
  1446. console.log("params",params)
  1447. // SaveNurseSort(params).then(response=>{
  1448. // if(response.data.state == 1){
  1449. // var role = response.data.data.role
  1450. // this.$message.success("保存成功")
  1451. // this.getDoctorList()
  1452. // }
  1453. // })
  1454. },
  1455. changeRadio(val){
  1456. console.log("val",val)
  1457. const params = {
  1458. id:val.id,
  1459. is_sort:val.is_sort,
  1460. }
  1461. // SaveIsSchedule(params).then(response=>{
  1462. // if(response.data.state == 1){
  1463. // var role = response.data.data.role
  1464. // this.$message.success("保存成功")
  1465. // this.getDoctorList()
  1466. // }
  1467. // })
  1468. }
  1469. },
  1470. created(){
  1471. //获取医护人员
  1472. this.getDoctorList()
  1473. //获取班种
  1474. this.getScheduleList()
  1475. let year = new Date().getFullYear()
  1476. let month = new Date().getMonth() + 1
  1477. let date = new Date().getDate()
  1478. this.weekNum = this.getYearWeek(year,month,date)
  1479. this.todayDate=this.formatDate(new Date())
  1480. this.setDate(new Date())
  1481. for (var i = 0; i <= 9; i++) {
  1482. this.setDate1(this.addDate(this.currentDate, 7))
  1483. }
  1484. let newNum = 0
  1485. for(let i = 0; i < this.weekList.length; i++){
  1486. if(this.weekNum + i + 1 <= 53){
  1487. let num = this.weekNum + i + 1
  1488. let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + num + ')'
  1489. this.typeOptions.push({value:i,label:str})
  1490. let stt = this.weekList[i][0] +"~"+this.weekList[i][6]
  1491. this.timeOptions.push({value:i,label:stt})
  1492. }else{
  1493. newNum++
  1494. let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + newNum + ')'
  1495. this.typeOptions.push({value:i,label:str})
  1496. let stt = this.weekList[i][0] +"~"+this.weekList[i][6]
  1497. this.timeOptions.push({value:i,label:stt})
  1498. }
  1499. }
  1500. var now = moment().locale('zh-cn').format('YYYY-MM-DD 00:00:00')
  1501. this.timeNow = this.getTimestamp(now)
  1502. }
  1503. }
  1504. </script>
  1505. <style lang="scss" scoped>
  1506. .dateBox{
  1507. border: 1px solid #DCDFE6;
  1508. height: 36px;
  1509. line-height: 36px;
  1510. text-align: center;
  1511. padding: 0 10px;
  1512. border-radius: 4px;
  1513. }
  1514. .classBox{
  1515. width:28%;
  1516. height: 100%;
  1517. border: 1px solid #d0d3da;
  1518. .classTitle{
  1519. height: 42px;
  1520. text-align: center;
  1521. line-height: 42px;
  1522. background-color: rgb(245, 247, 250);
  1523. color: rgb(96, 98, 102);
  1524. font-weight:bold;
  1525. }
  1526. .classMain{
  1527. height: 400px;
  1528. padding: 0 0 0 20px;
  1529. display: flex;
  1530. justify-content: space-between;
  1531. flex-direction: column;
  1532. >div>p{
  1533. line-height: 30px;
  1534. color: rgb(48, 49, 51);
  1535. }
  1536. .classMainBox{
  1537. height: 350px;
  1538. overflow-y: auto;
  1539. }
  1540. }
  1541. }
  1542. </style>
  1543. <style lang="scss">
  1544. .schedulingTable{
  1545. .el-table .cell {
  1546. white-space: pre-line;/*保留换行符*/
  1547. }
  1548. }
  1549. </style>