12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs="crumbs"></bread-crumb>
- <div style="display:flex;align-items:center">
- <el-button type="primary" @click="setting">设置</el-button>
- <el-button type="primary" @click="DeleteStaffSchedule">清除</el-button>
- <el-button type="primary" @click="copyStaffSchedule">复制</el-button>
- <el-button type="primary" icon="el-icon-printer" @click="toPrint">打印</el-button>
- <el-button type="primary" icon="el-icon-printer" @click="exportList">导出</el-button>
- </div>
- </div>
- <div class="app-container">
- <div class="cell clearfix">
- <el-input
- size="small"
- style="width: 150px;"
- class="filter-item"
- v-model.trim="keywords"
- placeholder="请输入医护人员姓名"
- @keyup.enter.native='toSearch'
- />
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- icon="el-icon-search"
- @click="toSearch"
- >搜索</el-button
- >
- <el-select style="margin-left:10px;width:150px;" v-model="typeValue" placeholder="请选择" @change="changeOption">
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- <el-button @click="lastclick" type="text" style="margin:0 10px;"><上一周({{ weekNum - 1 }})</el-button>
- <div class="dateBox">{{ weekDayArr[0] }}-{{ weekDayArr[6] }}({{ weekNum }})</div>
- <el-button @click="nextclick" type="text" style="margin:0 10px;">下一周({{ weekNum + 1 }})></el-button>
- </div>
- <div class="schedulingTable" style="display:flex;justify-content: space-between;">
- <div style="width: 70%">
- <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"
- @cell-mouse-enter="hoverMouse" @cell-mouse-leave="leavemouse">
- <!-- @cell-mouse-enter="hoverMouse" @cell-mouse-leave="leavemouse" -->
- <el-table-column prop="name" label="医护姓名" style="width:16%" align="center">
- <template slot-scope="scope">
- <span>{{scope.row.user_name}}</span>
- </template>
- </el-table-column>
- <el-table-column :label="'周一\n(' + weekDayArr[0] + ')'" style="width:200px" align="center">
- <template slot-scope="scope">
- <div v-if="name==scope.row.user_name&&column_lie =='周一' ? true:false">
- <div class="del_table_btns" v-show="scope.row.user_name=='合计'? false : true" >
- <el-button type="danger" size="mini" icon="el-icon-close"
- circle @click.stop="toClick(getClassId(scope.row.user_name,1))"
- ></el-button>
- </div>
- </div>
- <div @click="hangdleClick(scope.row,scope.$index,0)">
- <el-dropdown trigger="click" @command="changeSchedule" >
- <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,1) == 2' style="color:red">
- <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>
- </span>
- <span class="el-dropdown-link" v-else>
- <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>
- </span>
- <el-dropdown-menu slot="dropdown" >
- <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>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="name" :label="'周二\n(' + weekDayArr[1] + ')'" style="width:14%" align="center">
- <template slot-scope="scope">
- <div v-if="name==scope.row.user_name&&column_lie =='周二' ? true:false">
- <div class="del_table_btns" v-show="scope.row.user_name=='合计'? false : true">
- <el-button type="danger" size="mini" icon="el-icon-close"
- circle @click.stop="toClick(getClassId(scope.row.user_name,2))"
- ></el-button>
- </div>
- </div>
-
- <div @click="hangdleClick(scope.row,scope.$index,1)">
- <el-dropdown trigger="click" @command="changeSchedule">
- <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,2) == 2' style="color:red">
- <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>
- </span>
- <span class="el-dropdown-link" v-else>
- <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>
- </span>
- <el-dropdown-menu slot="dropdown" >
- <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>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="name" :label="'周三\n(' + weekDayArr[2] + ')'" style="width:14%" align="center">
- <template slot-scope="scope">
- <div v-if="name==scope.row.user_name&&column_lie =='周三' ? true:false">
- <div class="del_table_btns" v-show="scope.row.user_name=='合计'? false : true">
- <el-button type="danger" size="mini" icon="el-icon-close"
- circle @click.stop="toClick(getClassId(scope.row.user_name,3))"
- ></el-button>
- </div>
- </div>
- <div @click="hangdleClick(scope.row,scope.$index,2)">
- <el-dropdown trigger="click" @command="changeSchedule">
- <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,3) == 2' style="color:red">
- <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>
- </span>
- <span class="el-dropdown-link" v-else>
- <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>
- </span>
- <el-dropdown-menu slot="dropdown" >
- <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>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="name" :label="'周四\n(' + weekDayArr[3] + ')'" style="width:14%" align="center">
- <template slot-scope="scope">
- <div v-if="name==scope.row.user_name&&column_lie =='周四' ? true:false">
- <div class="del_table_btns" v-show="scope.row.user_name=='合计'? false : true">
- <el-button type="danger" size="mini" icon="el-icon-close"
- circle @click.stop="toClick(getClassId(scope.row.user_name,4))"
- ></el-button>
- </div>
- </div>
- <div @click="hangdleClick(scope.row,scope.$index,3)">
- <el-dropdown trigger="click" @command="changeSchedule">
- <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,4) == 2' style="color:red">
- <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>
- </span>
- <span class="el-dropdown-link" v-else>
- <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>
- </span>
- <el-dropdown-menu slot="dropdown" >
- <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>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="name" :label="'周五\n(' + weekDayArr[4] + ')'" style="width:14%" align="center">
- <template slot-scope="scope">
- <div v-if="name==scope.row.user_name&&column_lie =='周五' ? true:false">
- <div class="del_table_btns" v-show="scope.row.user_name=='合计'? false : true">
- <el-button type="danger" size="mini" icon="el-icon-close"
- circle @click.stop="toClick(getClassId(scope.row.user_name,5))"
- ></el-button>
- </div>
- </div>
- <div @click="hangdleClick(scope.row,scope.$index,4)">
- <el-dropdown trigger="click" @command="changeSchedule">
- <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,5) == 2' style="color:red">
- <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>
- </span>
- <span class="el-dropdown-link" v-else>
- <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>
- </span>
- <el-dropdown-menu slot="dropdown" >
- <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>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="name" :label="'周六\n(' + weekDayArr[5] + ')'" style="width:14%" align="center">
- <template slot-scope="scope">
- <div v-if="name==scope.row.user_name&&column_lie =='周六' ? true:false">
- <div class="del_table_btns" v-show="scope.row.user_name=='合计'? false : true">
- <el-button type="danger" size="mini" icon="el-icon-close"
- circle @click.stop="toClick(getClassId(scope.row.user_name,6))"
- ></el-button>
- </div>
- </div>
- <div @click="hangdleClick(scope.row,scope.$index,5)">
- <el-dropdown trigger="click" @command="changeSchedule">
- <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,6) == 2' style="color:red">
- <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>
- </span>
- <span class="el-dropdown-link" v-else>
- <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>
- </span>
- <el-dropdown-menu slot="dropdown" >
- <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>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="name" :label="'周日\n(' + weekDayArr[6] + ')'" style="width:14%" align="center">
- <template slot-scope="scope">
- <div v-if="name==scope.row.user_name&&column_lie =='周日' ? true:false">
- <div class="del_table_btns" v-show="scope.row.user_name=='合计'? false : true">
- <el-button type="danger" size="mini" icon="el-icon-close"
- circle @click.stop="toClick(getClassId(scope.row.user_name,0))"
- ></el-button>
- </div>
- </div>
- <div @click="hangdleClick(scope.row,scope.$index,6)">
- <el-dropdown trigger="click" @command="changeSchedule">
- <span class="el-dropdown-link" v-if='getClassAttributes(scope.row.user_name,0) == 2' style="color:red">
- <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>
- </span>
- <span class="el-dropdown-link" v-else>
- <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>
- </span>
- <el-dropdown-menu slot="dropdown" >
- <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>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </template>
- </el-table-column>
-
- <el-table-column prop="name" :label="'备注'" style="width:14%" align="center">
- <template slot-scope="scope">
- <div @click="toDialog(scope.row)">
- <el-input placeholder="请输入内容" v-model="scope.row.remark"></el-input>
- </div>
- </template>
- </el-table-column>
-
- </el-table>
-
- <div> 备注: <el-input type="textarea" placeholder="请输入内容"v-model="remark" style="min-height:200px" @input="changeStaffRmark"></el-input></div>
- </div>
- <div class="classBox">
- <div class="classTitle">班种</div>
- <div class="classMain">
- <div class="classMainBox">
- <p v-for="(item,index) in schedulelist" :key="index">
- {{item.class_name}} ({{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> )
- </p>
- </div>
- <el-checkbox style="text-align:center;padding-bottom: 10px;" v-model="isChecked" @change="toContinuous">连续排班</el-checkbox>
- </div>
- </div>
- </div>
- <el-dialog
- title="复制排班"
- width="600px"
- :visible.sync="newVisible"
- >
- <el-form :model="form" ref="form" label-width="90px" :rules="rules">
- <el-form-item label="复制到 : " required prop="copyWeek">
- <el-select v-model="form.copyWeek" placeholder="请选择">
- <el-option
- v-for="item in typeOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
-
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="newVisible=false">取 消</el-button>
- <el-button v-loading="copySchLoading" type="primary" @click="submitAction('form')">保 存</el-button>
- </div>
- </el-dialog>
-
- <el-dialog
- title="设置"
- width="800px"
- :visible.sync="nurseVisible"
- :before-close="_close"
- >
- <div>
- <el-tabs v-model="activeName">
- <el-tab-pane label="护士" name="nurse">
- <el-table
- :data="nurseTableData"
- border
- height="250"
- style="width: 100%">
- <el-table-column align="center" prop="name" label="姓名" width="180">
- <template slot-scope="scope">
- {{scope.row.user_name}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="date" label="职称" width="180">
- <template slot-scope="scope">
- <span v-if="scope.row.user_title == 1">医士</span>
- <span v-if="scope.row.user_title == 2">医师</span>
- <span v-if="scope.row.user_title == 3">住院医师</span>
- <span v-if="scope.row.user_title == 4">主治医师</span>
- <span v-if="scope.row.user_title == 5">副主任医师</span>
- <span v-if="scope.row.user_title == 6">主任医师</span>
- <span v-if="scope.row.user_title == 7">护士</span>
- <span v-if="scope.row.user_title == 8">护师</span>
- <span v-if="scope.row.user_title == 9">主管护师</span>
- <span v-if="scope.row.user_title == 10">副主任护师</span>
- <span v-if="scope.row.user_title == 11">主任护师</span>
- <span v-if="scope.row.user_title == 12">运营专员</span>
- <span v-if="scope.row.user_title == 13">运营主管</span>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="排序">
- <template slot-scope="scope">
- <el-input v-model="scope.row.sort" @change="changeSort(scope.row)" placeholder="请输入内容"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="是否排班">
- <template slot-scope="scope">
- <el-radio-group v-model="scope.row.is_sort" @change="changeRadio(scope.row)">
- <el-radio :label="1">是</el-radio>
- <el-radio :label="0">否</el-radio>
- </el-radio-group>
- </template>
- </el-table-column>
- </el-table>
- </el-tab-pane>
-
- <el-tab-pane label="医生" name="doctor">
- <el-table
- :data="doctorTableData"
- border
- height="250"
- style="width: 100%">
- <el-table-column
- align="center"
- prop="name"
- label="姓名"
- width="180">
- <template slot-scope="scope">
- {{scope.row.user_name}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="date" label="职称" width="180">
- <template slot-scope="scope">
- <span v-if="scope.row.user_title == 1">医士</span>
- <span v-if="scope.row.user_title == 2">医师</span>
- <span v-if="scope.row.user_title == 3">住院医师</span>
- <span v-if="scope.row.user_title == 4">主治医师</span>
- <span v-if="scope.row.user_title == 5">副主任医师</span>
- <span v-if="scope.row.user_title == 6">主任医师</span>
- <span v-if="scope.row.user_title == 7">护士</span>
- <span v-if="scope.row.user_title == 8">护师</span>
- <span v-if="scope.row.user_title == 9">主管护师</span>
- <span v-if="scope.row.user_title == 10">副主任护师</span>
- <span v-if="scope.row.user_title == 11">主任护师</span>
- <span v-if="scope.row.user_title == 12">运营专员</span>
- <span v-if="scope.row.user_title == 13">运营主管</span>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="排序">
- <template slot-scope="scope">
- <el-input v-model="scope.row.sort" placeholder="请输入内容" @change="changeSort(scope.row)"></el-input>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="是否排班">
- <template slot-scope="scope">
- <el-radio-group v-model="scope.row.is_sort" @change="changeRadio(scope.row)">
- <el-radio :label="1">是</el-radio>
- <el-radio :label="0">否</el-radio>
- </el-radio-group>
- </template>
- </el-table-column>
- </el-table>
- </el-tab-pane>
- </el-tabs>
-
- </div>
- </el-dialog>
- </div>
-
-
- <!-- <el-dialog
- title="导出排班"
- :visible.sync="exportDialogVisible"
- width="30%">
- <span>
- <div class="block">
- <span class="demonstration">月份:</span>
- <el-date-picker
- v-model="value1"
- type="week"
- format="yyyy 第 WW 周"
- placeholder="选择周">
- </el-date-picker>
- </div>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="exportList">确 定</el-button>
- </span>
- </el-dialog> -->
-
-
- <el-dialog
- title="设置备注"
- :visible.sync="dialogVisible"
- width="40%">
- <span>
- <el-input v-model="content" type="textarea"></el-input>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="saveDialog">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
-
- <script>
- const moment = require('moment')
- import BreadCrumb from '@/xt_pages/components/bread-crumb'
- import { getDoctorList,getScheduleList,addSchedule,getStaffScheduleList,getNextWeekList,getScheduleByDoctorId,toSearchScheduleList,DeleteStaffSchedule,copyStaffSchedule,UpdateContinusSchedule,SaveNurseSort,SaveIsSchedule,DeleteStaffScheduleById,saveStafScheduleRemark,getStaffScheduleRemarkList,changeStaffRmark } from '@/api/doctorSchedule'
- import { constants } from 'crypto'
- export default {
- components:{
- BreadCrumb
- },
- data(){
- return{
- copySchLoading:false,
- crumbs: [
- { path: false, name: '医护排班' },
- { path: '/medicalScheduling/index', name: '医护排班' }
- ],
- keywords:'',
- options: [{
- value: '0',
- label: '全部'
- }, {
- value: '2',
- label: '医生'
- }, {
- value: '3',
- label: '护士'
- }],
- typeValue:'0',
- tableData: [],
- isChecked:true,
- schedulelist:[],
- weekNum:'',
- weekDayArr:[],
- todayDate:'',
- clen:7,
- nowYear: new Date().getFullYear(),
- schedule_week:0,
- docobj:{},
- class_name:"",
- doctorlist:[],
- schedule_date:"",
- newVisible:false,
- typeOptions:[],
- timeOptions:[],
- copyWeek:'',
- weekList: [],
- currentFirstDate1: '',
- form:{
- copyWeek:"",
- },
- rules: {
- copyWeek: [{ required: true, message: "请选择复制时间段", trigger: "blur" }],
- },
- timeNow:0,
- arrZero:[],
- arrOne:[],
- arrTwo:[],
- arrThree:[],
- arrFour:[],
- arrFive:[],
- arrSix:[],
- arrSeven:[],
- nurseVisible:false,
- activeName:'nurse',
- radio:'1',
- nurseTableData:[],
- doctorTableData:[],
- exportDialogVisible:false,
- month_time:"",
- name:'',
- column_lie:'',
- remark:"",
- dialogVisible:false,
- content:"",
- staffObj:{}
- }
- },
- methods:{
- search(){},
- // toPrint(){
- // this.exportDialogVisible = true
- // },
- toPrint(){
- this.$router.push({
- path: '/medicalScheduling/schedule/print?starttime='+this.getTimestamp(this.weekDayArr[0])+"&endtime="+this.getTimestamp(this.weekDayArr[6])+"&weekArr="+ this.weekDayArr+"&typeValue="+this.typeValue,
- // query: { date: date }
- })
- },
- getDoctorList(){
-
- getDoctorList().then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- // console.log("医护列表",list)
- // this.tableData = list
- // let arr = []
- // list.map(item => {
- // if(item.is_sort == 1){
- // arr.push(item)
- // }
- // })
- // this.doctorlist = arr
- //获取班种列表
- this.getStaffScheduleList()
-
- var doctorlist = response.data.data.doctorlist
-
- for(let i=0;i<doctorlist.length;i++){
- if(doctorlist[i].sort == 0){
- doctorlist[i].sort = ""
- }
- }
- console.log('doctorlist',doctorlist)
- this.doctorTableData = doctorlist
- var nurselist = response.data.data.nurselist
- for(let i=0;i<nurselist.length;i++){
- if(nurselist[i].sort == 0){
- nurselist[i].sort = ""
- }
- }
- this.nurseTableData = nurselist
- }
- })
- },
- getScheduleList(){
- getScheduleList().then(response=>{
- if(response.data.state == 1){
- var schedulelist = response.data.data.scheduleList
- // console.log("schedulelist",schedulelist)
- for(let i=0;i<schedulelist.length;i++){
- if(schedulelist[i].timeone_type == 1){
- schedulelist[i].timeone_type = "当日"
- }
- if(schedulelist[i].timeone_type == 2){
- schedulelist[i].timeone_type = "次日"
- }
- if(schedulelist[i].timetwo_type == 1){
- schedulelist[i].timetwo_type = "当日"
- }
- if(schedulelist[i].timetwo_type == 2){
- schedulelist[i].timetwo_type = "次日"
- }
- }
- this.schedulelist = schedulelist
- }
- })
- },
- hangdleClick(val,index,num){
- console.log("val",val)
- this.docobj = val
- if(this.getTimestamp(this.weekDayArr[num]) < this.timeNow){
- this.$message.error("过去日期不可以编辑")
- return
- }
- },
- clickThis(row, column, cell, event){
- var week = (column.label).split('');
- var weeks = week[0]+week[1]
- if(weeks == "周日"){
- this.schedule_week = 0
- this.schedule_date = this.weekDayArr[6]
- }
- if(weeks == "周一"){
- this.schedule_week = 1
- this.schedule_date = this.weekDayArr[0]
- }
- if(weeks=="周二"){
- this.schedule_week = 2
- this.schedule_date = this.weekDayArr[1]
- }
- if(weeks=="周三"){
- this.schedule_week = 3
- this.schedule_date = this.weekDayArr[2]
- }
- if(weeks=="周四"){
- this.schedule_week = 4
- this.schedule_date = this.weekDayArr[3]
- }
- if(weeks == "周五"){
- this.schedule_week = 5
- this.schedule_date = this.weekDayArr[4]
- }
- if(weeks== "周六"){
- this.schedule_week = 6
- this.schedule_date = this.weekDayArr[5]
- }
- },
- changeSchedule(id){
- var class_name = ""
- for(let i=0;i<this.schedulelist.length;i++){
- if(id == this.schedulelist[i].id){
- class_name = this.schedulelist[i].class_name
- }
- }
- let arr = [...this.tableData]
- // console.log("arr===",arr)
- for(let i=0;i<arr.length;i++){
- if(this.docobj.id == arr[i].id){
- arr[i].class_name = class_name
- arr[i].class_index = this.schedule_week
- }
- }
- // console.log("arr",arr)
- this.tableData = arr
- const params = {
- doctor_id:this.docobj.admin_user_id,
- doctor_type:this.docobj.user_type,
- schedule_type:id,
- schedule_week:this.schedule_week,
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6]),
- schedule_date:this.getTimestamp(this.schedule_date)
- }
- // console.log("params",params)
-
- addSchedule(params).then(response=>{
- if(response.data.state == 1){
- var schedule = response.data.data.schedule
- // console.log("schedule",schedule)
- this.$message.success("保存成功")
- this.getStaffScheduleList()
- }
- })
- },
- formatDate(date){
- var year = date.getFullYear()+'.'
- var month = (date.getMonth()+1)+'.';
- var day = date.getDate();
- return year+month+day
- },
- formatDateTwo(date){
- var year = date.getFullYear()+'.'
- var month = (date.getMonth()+1)+'.';
- var day = date.getDate();
- return year+month+day
- },
- addDate(date,n){
- date.setDate(date.getDate()+n);
- return date;
- },
- //
- setDate(date){
- var week = date.getDay()-1;
- date = this.addDate(date,week*-1);
- this.currentFirstDate = new Date(date);
- this.currentDate = new Date(date)
- for(var i = 0;i<this.clen; i++){
- this.weekDayArr.push(this.formatDate(i==0 ? date : this.addDate(date,1)))
- }
- },
- //上一周
- lastclick(){
- this.weekDayArr=[]
- this.setDate(this.addDate(this.currentFirstDate,-7));
- if (this.weekNum == 1) {
- let year = this.nowYear - 1
- let month = 12
- let date = 31
- this.weekNum = this.getYearWeek(year, month, date)
- this.nowYear = this.nowYear - 1
- }
- this.weekNum = this.weekNum - 1
- this.getNextWeekList()
- this.getStaffScheduleRemarkList()
- },
- //下一周
- nextclick(){
- this.weekDayArr=[]
- this.setDate(this.addDate(this.currentFirstDate,7));
- this.weekNum = this.weekNum + 1
- if (this.weekNum == 53) {
- let year = this.nowYear + 1
- let month = 1
- let date = 1
- this.weekNum = this.getYearWeek(year, month, date)
- this.nowYear = this.nowYear + 1
- }
- this.getNextWeekList()
- this.getStaffScheduleRemarkList()
- },
-
- getYearWeek(year,month,date){
- /*
- dateNow是当前日期
- dateFirst是当年第一天
- dataNumber是当前日期是今年第多少天
- 用dataNumber + 当前年的第一天的周差距的和在除以7就是本年第几周
- */
- let dateNow = new Date(year, parseInt(month) - 1, date);
- let dateFirst = new Date(year, 0, 1);
- let dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 86400000);
- return Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7);
- },
- getTimestamp(time) { //把时间日期转成时间戳
- return (new Date(time)).getTime() / 1000
- },
- beforeHandleCommand(item,row){
- return {
- 'command': item,
- 'row': row
- }
- },
-
- //获取所有医护排班数据
- getStaffScheduleList(){
- const params = {
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6])
- }
- getStaffScheduleList(params).then(response=>{
- if(response.data.state == 1){
- var staffList = response.data.data.staffList
- // console.log("获取所有排班",staffList)
- var sevenStr = ""
- var oneStr = ""
- var twoStr = ""
- var threeStr = ""
- var fourStr = ""
- var fiveStr = ""
- var sixStr = ""
- this.arrZero = []
- this.arrOne = []
- this.arrTwo = []
- this.arrThree = []
- this.arrFour = []
- this.arrFive = []
- this.arrSix = []
-
- for(let i=0;i<staffList.length;i++){
- if(staffList[i].schedule_week == 0){
- staffList[i].class_index = 0
- var arr = []
- this.arrZero.push(staffList[i].class_name)
- for(let i=0;i<this.arrZero.length;i++){
- if(this.arrZero[i]!=''){
- arr.push(this.arrZero[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- var zeroStr = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- zeroStr += item + objVal[index] + '\n'
- })
- sevenStr = zeroStr
- }
-
- if(staffList[i].schedule_week == 1){
- staffList[i].class_index = 1
- var arr = []
- this.arrOne.push(staffList[i].class_name)
- for(let i=0;i<this.arrOne.length;i++){
- if(this.arrOne[i]!=''){
- arr.push(this.arrOne[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strOne = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strOne += item + objVal[index] + '\n'
- })
- oneStr = strOne
- }
- if(staffList[i].schedule_week == 2){
- staffList[i].class_index = 2
- var arr = []
- this.arrTwo.push(staffList[i].class_name)
- for(let i=0;i<this.arrTwo.length;i++){
- if(this.arrTwo[i]!=''){
- arr.push(this.arrTwo[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strTwo = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strTwo += item + objVal[index] + '\n'
- })
- twoStr = strTwo
- }
- if(staffList[i].schedule_week == 3){
- staffList[i].class_index = 3
- var arr = []
- this.arrThree.push(staffList[i].class_name)
- for(let i=0;i<this.arrThree.length;i++){
- if(this.arrThree[i]!=''){
- arr.push(this.arrThree[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strThree = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strThree += item + objVal[index] + '\n'
- })
- threeStr = strThree
- }
-
-
- if(staffList[i].schedule_week == 4){
- staffList[i].class_index = 4
- var arr = []
- this.arrFour.push(staffList[i].class_name)
- for(let i=0;i<this.arrFour.length;i++){
- if(this.arrFour[i]!=''){
- arr.push(this.arrFour[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strFour = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strFour += item + objVal[index] + '\n'
- })
- fourStr = strFour
- }
-
-
- if(staffList[i].schedule_week == 5){
- staffList[i].class_index = 5
-
- var arr = []
- this.arrFive.push(staffList[i].class_name)
- for(let i=0;i<this.arrFive.length;i++){
- if(this.arrFive[i]!=''){
- arr.push(this.arrFive[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strFive = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strFive += item + objVal[index] + '\n'
- })
- fiveStr = strFive
- }
-
- if(staffList[i].schedule_week == 6){
- staffList[i].class_index = 6
- var arr = []
- this.arrSix.push(staffList[i].class_name)
- for(let i=0;i<this.arrSix.length;i++){
- if(this.arrSix[i]!=''){
- arr.push(this.arrSix[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strSix = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strSix += item + objVal[index] + '\n'
- })
- sixStr = strSix
- }
- }
- console.log("staffList",staffList)
- let tempArr = [], newArr = []
- for (let i = 0; i < staffList.length; i++) {
- if (tempArr.indexOf(staffList[i].user_name) == -1) {
- newArr.push({
- id:staffList[i].id,
- user_name: staffList[i].user_name,
- admin_user_id:staffList[i].admin_user_id,
- user_type:staffList[i].doctor_type,
- is_sort:staffList[i].is_sort,
- sort:staffList[i].sort,
- 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_attributesk,id:staffList[i].id}],
- remark:staffList[i].remark
- })
- tempArr.push(staffList[i].user_name);
- } else {
- console.log("staffList",staffList[i].user_name)
- for (let j = 0; j < newArr.length; j++) {
- if (newArr[j].admin_user_id == staffList[i].admin_user_id) {
- 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,id:staffList[i].id})
- }
- }
- }
- }
-
- let arrTen = [...newArr]
- console.log("newArr22o2o2o2o2wo",arrTen)
- let newNurse = []
- let newDoctor = []
- arrTen.map(item => {
- if(item.user_type == 2){
- newDoctor.push(item)
- }
- if(item.user_type == 3){
- newNurse.push(item)
- }
- })
- //护士
- console.log("newNurse",newNurse)
- newNurse.sort(this.compare('admin_user_id'))
- let newNurseTableData = []
- this.nurseTableData.map(item => {
- if(item.is_sort == 1){
- newNurseTableData.push(item)
- }
- })
- newNurseTableData.sort(this.compare('admin_user_id'))
- console.log("newNurseTableData",newNurseTableData)
- newNurseTableData.map((item,index) => {
- if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
-
- }else{
- newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
- }
- })
- newNurse.sort(this.compare('sort'))
-
- // //医生
- newDoctor.sort(this.compare('admin_user_id'))
- let newDoctorTableData = []
- this.doctorTableData.map(item => {
- if(item.is_sort == 1){
- newDoctorTableData.push(item)
- }
- })
- newDoctorTableData.sort(this.compare('admin_user_id'))
- newDoctorTableData.map((item,index) => {
- if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
-
- }else{
- newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
- }
- })
- newDoctor.sort(this.compare('sort'))
-
-
- let arr2 = []
-
- arr2.push({class_name:oneStr,schedule_week:1})
- arr2.push({class_name:twoStr,schedule_week:2})
- arr2.push({class_name:threeStr,schedule_week:3})
- arr2.push({class_name:fourStr,schedule_week:4})
- arr2.push({class_name:fiveStr,schedule_week:5})
- arr2.push({class_name:sixStr,schedule_week:6})
- arr2.push({class_name:sevenStr,schedule_week:0})
- var obj = {}
- obj.admin_user_id = "1000000"
- obj.user_name = "合计"
- obj.user_type = 10
- obj.list = arr2
- arr2.push(obj)
-
- let data = []
-
- data.push(...newNurse)
- data.push(...newDoctor)
- data.push(obj)
- console.log("data2o2oo2o2o2o22o",data)
-
- // this.tableData = this.distinct(data)
- this.tableData = data
-
-
- }
- })
- },
- distinct(tempArr) {
- for (let i = 0; i < tempArr.length; i++) {
- for (let j = i + 1; j < tempArr.length; j++) {
- if (tempArr[i].admin_user_id == tempArr[j].admin_user_id) {
- tempArr.splice(j, 1);
- j--;
- };
- };
- };
- return tempArr;
- },
-
- getClass(name,index){
- if(name != undefined){
- let newClass = '';
- this.tableData.map(item => {
- if(item.user_name == name){
- if(item.list){
- item.list.map(it => {
- if(it.schedule_week == index){
- newClass = it.class_name
- }
- })
- }
-
- }
- })
- return newClass
- }
-
- },
- getClassId(name,index){
-
- if(name != undefined){
- let id = '';
- this.tableData.map(item => {
- if(item.user_name == name){
- if(item.list){
- item.list.map(it => {
- if(it.schedule_week == index){
- id = it.id
- }
- })
- }
-
- }
- })
- return id
- }
-
- },
- getClassAttributes(name,index){
- if(name != undefined){
- let newClass = '';
- this.tableData.map(item => {
- if(item.user_name == name){
- if(item.list){
- item.list.map(it => {
- if(it.schedule_week == index){
- newClass = it.class_attributes
- }
- })
- }
-
- }
- })
- return newClass
- }
-
- },
-
- unique(arr) {
- const res = new Map();
- return arr.filter((arr) => !res.has(arr.admin_user_id) && res.set(arr.admin_user_id, 1))
- },
-
- //获取上一周下一周的排班数据
- getNextWeekList(){
- const params = {
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6]),
- doctor_id:parseInt(this.typeValue),
- }
- console.log("params232323",params)
- getNextWeekList(params).then(response=>{
- if(response.data.state == 1){
- var staffList = response.data.data.staffList
- // console.log("上下周数据",staffList)
- var sevenStr = ""
- var oneStr = ""
- var twoStr = ""
- var threeStr = ""
- var fourStr = ""
- var fiveStr = ""
- var sixStr = ""
- this.arrZero = []
- this.arrOne = []
- this.arrTwo = []
- this.arrThree = []
- this.arrFour = []
- this.arrFive = []
- this.arrSix = []
- for(let i=0;i<staffList.length;i++){
- if(staffList[i].schedule_week == 0){
- staffList[i].class_index = 0
- var arr = []
- this.arrZero.push(staffList[i].class_name)
- for(let i=0;i<this.arrZero.length;i++){
- if(this.arrZero[i]!=''){
- arr.push(this.arrZero[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- var zeroStr = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- zeroStr += item + objVal[index] + '\n'
- })
- sevenStr = zeroStr
- }
-
- if(staffList[i].schedule_week == 1){
- staffList[i].class_index = 1
- var arr = []
- this.arrOne.push(staffList[i].class_name)
- for(let i=0;i<this.arrOne.length;i++){
- if(this.arrOne[i]!=''){
- arr.push(this.arrOne[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strOne = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strOne += item + objVal[index] + '\n'
- })
- oneStr = strOne
- }
- if(staffList[i].schedule_week == 2){
- staffList[i].class_index = 2
- var arr = []
- this.arrTwo.push(staffList[i].class_name)
- for(let i=0;i<this.arrTwo.length;i++){
- if(this.arrTwo[i]!=''){
- arr.push(this.arrTwo[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strTwo = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strTwo += item + objVal[index] + '\n'
- })
- twoStr = strTwo
- }
- if(staffList[i].schedule_week == 3){
- staffList[i].class_index = 3
- var arr = []
- this.arrThree.push(staffList[i].class_name)
- for(let i=0;i<this.arrThree.length;i++){
- if(this.arrThree[i]!=''){
- arr.push(this.arrThree[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strThree = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strThree += item + objVal[index] + '\n'
- })
- threeStr = strThree
- }
- if(staffList[i].schedule_week == 4){
- staffList[i].class_index = 4
- var arr = []
- this.arrFour.push(staffList[i].class_name)
- for(let i=0;i<this.arrFour.length;i++){
- if(this.arrFour[i]!=''){
- arr.push(this.arrFour[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strFour = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strFour += item + objVal[index] + '\n'
- })
- fourStr = strFour
- }
- if(staffList[i].schedule_week == 5){
- staffList[i].class_index = 5
-
- var arr = []
- this.arrFive.push(staffList[i].class_name)
- for(let i=0;i<this.arrFive.length;i++){
- if(this.arrFive[i]!=''){
- arr.push(this.arrFive[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strFive = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strFive += item + objVal[index] + '\n'
- })
- fiveStr = strFive
- }
- if(staffList[i].schedule_week == 6){
- staffList[i].class_index = 6
- var arr = []
- this.arrSix.push(staffList[i].class_name)
- for(let i=0;i<this.arrSix.length;i++){
- if(this.arrSix[i]!=''){
- arr.push(this.arrSix[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strSix = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strSix += item + objVal[index] + '\n'
- })
- sixStr = strSix
- }
- }
- let tempArr = [], newArr = []
- for (let i = 0; i < staffList.length; i++) {
- if (tempArr.indexOf(staffList[i].user_name) === -1) {
- newArr.push({
- user_name: staffList[i].user_name,
- admin_user_id:staffList[i].admin_user_id,
- user_type:staffList[i].doctor_type,
- is_sort:staffList[i].is_sort,
- sort:staffList[i].sort,
- 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}],
- remark:staffList[i].remark
- })
- tempArr.push(staffList[i].user_name);
- } else {
- for (let j = 0; j < newArr.length; j++) {
- if (newArr[j].user_name == staffList[i].user_name) {
- 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})
- }
- }
- }
- }
-
- let arr = [...newArr]
- let newNurse = []
- let newDoctor = []
- arr.map(item => {
- if(item.user_type == 2){
- newDoctor.push(item)
- }
- if(item.user_type == 3){
- newNurse.push(item)
- }
- })
- //护士
- newNurse.sort(this.compare('admin_user_id'))
- let newNurseTableData = []
- this.nurseTableData.map(item => {
- if(item.is_sort == 1){
- newNurseTableData.push(item)
- }
- })
- newNurseTableData.sort(this.compare('admin_user_id'))
- newNurseTableData.map((item,index) => {
- if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
-
- }else{
- newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
- }
- })
- newNurse.sort(this.compare('sort'))
-
- //医生
- newDoctor.sort(this.compare('admin_user_id'))
- let newDoctorTableData = []
- this.doctorTableData.map(item => {
- if(item.is_sort == 1){
- newDoctorTableData.push(item)
- }
- })
- newDoctorTableData.sort(this.compare('admin_user_id'))
- newDoctorTableData.map((item,index) => {
- if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
-
- }else{
- newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
- }
- })
- newDoctor.sort(this.compare('sort'))
-
-
- // arr.sort(this.compare('admin_user_id'))
- // this.doctorlist.sort(this.compare('admin_user_id'))
- // this.doctorlist.forEach((item, index) => {
- // if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
-
- // }else{
- // arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type})
- // }
- // })
- // arr.sort(this.compare('user_type'))
-
- let arr2 = []
- arr2.push({class_name:oneStr,schedule_week:1})
- arr2.push({class_name:twoStr,schedule_week:2})
- arr2.push({class_name:threeStr,schedule_week:3})
- arr2.push({class_name:fourStr,schedule_week:4})
- arr2.push({class_name:fiveStr,schedule_week:5})
- arr2.push({class_name:sixStr,schedule_week:6})
- arr2.push({class_name:sevenStr,schedule_week:0})
- var obj = {}
- obj.admin_user_id = "1000000"
- obj.user_name = "合计"
- obj.user_type = 10
- obj.list = arr2
- arr.push(obj)
- if(parseInt(this.typeValue) == 2){
- newNurse = []
- }
- if(parseInt(this.typeValue) == 3){
- newDoctor = []
- }
- let data = []
- data.push(...newNurse)
- data.push(...newDoctor)
- data.push(obj)
- this.tableData = data
- }
- })
- },
-
- changeOption(id){
- const params = {
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6]),
- doctor_id:id
- }
- getScheduleByDoctorId(params).then(response=>{
- if(response.data.state == 1){
- var staffList = response.data.data.staffList
- // console.log("staffList",staffList)
- var sevenStr = ""
- var oneStr = ""
- var twoStr = ""
- var threeStr = ""
- var fourStr = ""
- var fiveStr = ""
- var sixStr = ""
- this.arrZero = []
- this.arrOne = []
- this.arrTwo = []
- this.arrThree = []
- this.arrFour = []
- this.arrFive = []
- this.arrSix = []
- for(let i=0;i<staffList.length;i++){
- if(staffList[i].schedule_week == 0){
- staffList[i].class_index = 0
- var arr = []
- this.arrZero.push(staffList[i].class_name)
- for(let i=0;i<this.arrZero.length;i++){
- if(this.arrZero[i]!=''){
- arr.push(this.arrZero[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- var zeroStr = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- zeroStr += item + objVal[index] + '\n'
- })
- sevenStr = zeroStr
- }
- if(staffList[i].schedule_week == 1){
- staffList[i].class_index = 1
- var arr = []
- this.arrOne.push(staffList[i].class_name)
- for(let i=0;i<this.arrOne.length;i++){
- if(this.arrOne[i]!=''){
- arr.push(this.arrOne[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strOne = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strOne += item + objVal[index] + '\n'
- })
- oneStr = strOne
- }
- if(staffList[i].schedule_week == 2){
- staffList[i].class_index = 2
- var arr = []
- this.arrTwo.push(staffList[i].class_name)
- for(let i=0;i<this.arrTwo.length;i++){
- if(this.arrTwo[i]!=''){
- arr.push(this.arrTwo[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strTwo = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strTwo += item + objVal[index] + '\n'
- })
- twoStr = strTwo
- }
- if(staffList[i].schedule_week == 3){
- staffList[i].class_index = 3
- var arr = []
- this.arrThree.push(staffList[i].class_name)
- for(let i=0;i<this.arrThree.length;i++){
- if(this.arrThree[i]!=''){
- arr.push(this.arrThree[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strThree = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strThree += item + objVal[index] + '\n'
- })
- threeStr = strThree
- }
- if(staffList[i].schedule_week == 4){
- staffList[i].class_index = 4
- var arr = []
- this.arrFour.push(staffList[i].class_name)
- for(let i=0;i<this.arrFour.length;i++){
- if(this.arrFour[i]!=''){
- arr.push(this.arrFour[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strFour = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strFour += item + objVal[index] + '\n'
- })
- fourStr = strFour
- }
- if(staffList[i].schedule_week == 5){
- staffList[i].class_index = 5
-
- var arr = []
- this.arrFive.push(staffList[i].class_name)
- for(let i=0;i<this.arrFive.length;i++){
- if(this.arrFive[i]!=''){
- arr.push(this.arrFive[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strFive = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strFive += item + objVal[index] + '\n'
- })
- fiveStr = strFive
- }
- if(staffList[i].schedule_week == 6){
- staffList[i].class_index = 6
- var arr = []
- this.arrSix.push(staffList[i].class_name)
- for(let i=0;i<this.arrSix.length;i++){
- if(this.arrSix[i]!=''){
- arr.push(this.arrSix[i])
- }
- }
- var countedNames = arr.reduce(function (allNames, name) {
- if (name in allNames) {
- allNames[name]++;
- }
- else {
- allNames[name] = 1;
- }
- return allNames;
- }, {});
- let objKey = Object.keys(countedNames)
- let objVal = Object.values(countedNames)
- let strSix = ''
- objKey.map((item,index) => {
- let objVal = Object.values(countedNames)
- strSix += item + objVal[index] + '\n'
- })
- sixStr = strSix
- }
- }
- let tempArr = [], newArr = []
- for (let i = 0; i < staffList.length; i++) {
- if (tempArr.indexOf(staffList[i].user_name) === -1) {
- newArr.push({
- user_name: staffList[i].user_name,
- admin_user_id:staffList[i].admin_user_id,
- user_type:staffList[i].doctor_type,
- is_sort:staffList[i].is_sort,
- sort:staffList[i].sort,
- 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}]
- })
- tempArr.push(staffList[i].user_name);
- } else {
- for (let j = 0; j < newArr.length; j++) {
- if (newArr[j].user_name == staffList[i].user_name) {
- 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})
- }
- }
- }
- }
-
- let arr = [...newArr]
- let newNurse = []
- let newDoctor = []
- arr.map(item => {
- if(item.user_type == 2){
- newDoctor.push(item)
- }
- if(item.user_type == 3){
- newNurse.push(item)
- }
- })
-
- if(id == 0){
- //护士
- newNurse.sort(this.compare('admin_user_id'))
- let newNurseTableData = []
- this.nurseTableData.map(item => {
- if(item.is_sort == 1){
- newNurseTableData.push(item)
- }
- })
- newNurseTableData.sort(this.compare('admin_user_id'))
- newNurseTableData.map((item,index) => {
- if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
-
- }else{
- newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
- }
- })
- newNurse.sort(this.compare('sort'))
-
- //医生
- newDoctor.sort(this.compare('admin_user_id'))
- let newDoctorTableData = []
- this.doctorTableData.map(item => {
- if(item.is_sort == 1){
- newDoctorTableData.push(item)
- }
- })
- newDoctorTableData.sort(this.compare('admin_user_id'))
- newDoctorTableData.map((item,index) => {
- if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
-
- }else{
- newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
- }
- })
- newDoctor.sort(this.compare('sort'))
-
- // let data = []
- // data.push(...newNurse)
- // data.push(...newDoctor)
- // this.tableData = data
- let arr2 = []
- arr2.push({class_name:oneStr,schedule_week:1})
- arr2.push({class_name:twoStr,schedule_week:2})
- arr2.push({class_name:threeStr,schedule_week:3})
- arr2.push({class_name:fourStr,schedule_week:4})
- arr2.push({class_name:fiveStr,schedule_week:5})
- arr2.push({class_name:sixStr,schedule_week:6})
- arr2.push({class_name:sevenStr,schedule_week:0})
- var obj = {}
- obj.admin_user_id = "1000000"
- obj.user_name = "合计"
- obj.user_type = 10
- obj.list = arr2
- arr.push(obj)
-
- let data = []
- data.push(...newNurse)
- data.push(...newDoctor)
- data.push(obj)
- this.tableData = data
- }
- if(id == 2){
- newDoctor.sort(this.compare('admin_user_id'))
- let newDoctorTableData = []
- this.doctorTableData.map(item => {
- if(item.is_sort == 1){
- newDoctorTableData.push(item)
- }
- })
- newDoctorTableData.sort(this.compare('admin_user_id'))
- newDoctorTableData.map((item,index) => {
- if (newDoctor[index] && item.admin_user_id == newDoctor[index].admin_user_id) {
-
- }else{
- newDoctor.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
- }
- })
- newDoctor.sort(this.compare('sort'))
- // this.tableData = newDoctor
- let arr2 = []
- arr2.push({class_name:oneStr,schedule_week:1})
- arr2.push({class_name:twoStr,schedule_week:2})
- arr2.push({class_name:threeStr,schedule_week:3})
- arr2.push({class_name:fourStr,schedule_week:4})
- arr2.push({class_name:fiveStr,schedule_week:5})
- arr2.push({class_name:sixStr,schedule_week:6})
- arr2.push({class_name:sevenStr,schedule_week:0})
- var obj = {}
- obj.admin_user_id = "1000000"
- obj.user_name = "合计"
- obj.user_type = 10
- obj.list = arr2
- arr.push(obj)
-
- let data = []
- data.push(...newDoctor)
- data.push(obj)
- this.tableData = data
- }
- if(id == 3){
- newNurse.sort(this.compare('admin_user_id'))
- let newNurseTableData = []
- this.nurseTableData.map(item => {
- if(item.is_sort == 1){
- newNurseTableData.push(item)
- }
- })
- newNurseTableData.sort(this.compare('admin_user_id'))
- newNurseTableData.map((item,index) => {
- if (newNurse[index] && item.admin_user_id == newNurse[index].admin_user_id) {
-
- }else{
- newNurse.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: [],user_type:item.user_type,is_sort:item.is_sort,sort:item.sort})
- }
- })
- newNurse.sort(this.compare('sort'))
- // this.tableData = newNurse
- let arr2 = []
- arr2.push({class_name:oneStr,schedule_week:1})
- arr2.push({class_name:twoStr,schedule_week:2})
- arr2.push({class_name:threeStr,schedule_week:3})
- arr2.push({class_name:fourStr,schedule_week:4})
- arr2.push({class_name:fiveStr,schedule_week:5})
- arr2.push({class_name:sixStr,schedule_week:6})
- arr2.push({class_name:sevenStr,schedule_week:0})
- var obj = {}
- obj.admin_user_id = "1000000"
- obj.user_name = "合计"
- obj.user_type = 10
- obj.list = arr2
- arr.push(obj)
-
- let data = []
- data.push(...newNurse)
- data.push(obj)
- this.tableData = data
- console.log('cccccc',this.tableData);
- }
-
- }
- })
- },
- toSearch(){
- const params = {
- user_name: this.keywords,
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6])
- }
- toSearchScheduleList(params).then(response=>{
- if(response.data.state == 1){
- var staffList = response.data.data.staffList
- // console.log("搜索",staffList)
- let tempArr = [], newArr = []
- for (let i = 0; i < staffList.length; i++) {
- if (tempArr.indexOf(staffList[i].user_name) === -1) {
- newArr.push({
- user_name: staffList[i].user_name,
- admin_user_id:staffList[i].admin_user_id,
- 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}]
- })
- tempArr.push(staffList[i].user_name);
- } else {
- for (let j = 0; j < newArr.length; j++) {
- if (newArr[j].user_name == staffList[i].user_name) {
- 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})
- }
- }
- }
- }
-
- if(this.keywords != ''){
- this.tableData = newArr
- }else{
- let arr = [...newArr]
- arr.sort(this.compare('admin_user_id'))
- this.doctorlist.sort(this.compare('admin_user_id'))
- this.doctorlist.forEach((item, index) => {
- if (arr[index] && item.admin_user_id == arr[index].admin_user_id) {
-
- }else{
- arr.splice(index, 0, {user_name: item.user_name, admin_user_id: item.admin_user_id, list: []})
- // console.log("arr",arr)
- }
- })
- this.tableData = arr
- }
- }
- })
- },
-
- DeleteStaffSchedule(){
- const params = {
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6])
- }
- this.$confirm(
- '是否要清除当周排班? <br>清除后,信息将无法恢复',
- '删除提示',
- {
- dangerouslyUseHTMLString: true,
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }
- ).then(()=>{
- DeleteStaffSchedule(params).then(response=>{
- if(response.data.state == 1){
- var msg = response.data.data.msg
- this.$message.success("清除成功")
- this.getStaffScheduleList()
- }
- })
- })
- },
-
- copyStaffSchedule(){
- this.newVisible = true
- // const params = {
- // start_time:this.getTimestamp(this.weekDayArr[0]),
- // end_time:this.getTimestamp(this.weekDayArr[6]),
-
- // }
-
- // copyStaffSchedule(params).then(response=>{
- // if(response.data.state == 1){
- // var msg = response.data.data.msg
- // console.log("msg",msg)
- // this.$message.success("复制成功")
- // }else{
- // this.$message.error("排班已存在")
- // }
- // })
- },
- toContinuous(){
- var is_status = 0
- if(this.isChecked == false){
- is_status = 0
- }
- if(this.isChecked == true){
- is_status = 1
- }
- const params = {
- is_status:is_status
- }
- UpdateContinusSchedule(params).then(response=>{
- if(response.data.state == 1){
- var schedule = response.data.data.schedule
- this.$message.success("保存成功")
- }
- })
- },
- setDate1 (date) {
- var week = date.getDay() - 1
- date = this.addDate(date, week * -1)
- this.currentDate = new Date(date)
- let arr1 = []
- for (var i = 0; i < this.clen; i++) {
- arr1.push(this.formatDate(i == 0 ? date : this.addDate(date, 1)))
- }
- this.weekList.push(arr1)
- let num = this.weekNum
- this.currentFirstDate1 = num + 1
- },
- submitAction(formName){
- var label = ""
- for(let i=0;i<this.timeOptions.length;i++){
- if(this.form.copyWeek == this.timeOptions[i].value){
- label = this.timeOptions[i].label
- }
- }
- var start = label.split('~')
- var copy_startime = this.getTimestamp(start[0])
- var copy_endtime = this.getTimestamp(start[1])
-
- const params = {
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6]),
- copy_startime:copy_startime,
- copy_endtime:copy_endtime,
- remark:this.remark,
- }
- this.$refs[formName].validate(valid=>{
- if(valid){
- if(!this.copySchLoading){
- this.copySchLoading = true
- copyStaffSchedule(params).then(response=>{
- if(response.data.state == 1){
- var msg = response.data.data.msg
- this.copySchLoading = false
-
- this.$message.success("复制成功")
- this.newVisible = false
- }else{
- this.copySchLoading = false
- this.$message.error("排班已存在")
- }
- })
- }
-
- }
- })
- },
- compare(property){
- return function(a,b){
- var value1 = a[property];
- var value2 = b[property];
- return value2 - value1;
- }
- },
- tableCellStyle (row, rowIndex, column) {
- var week = (row.column.label).split('');
- var weeks = 0
- if (week.length == 13) {
- weeks = week[4]+week[5]+week[6]+week[7]+week[8]+week[9]+week[10]+week[11]
- }
- if (week.length == 14) {
- weeks = week[4]+week[5]+week[6]+week[7]+week[8]+week[9]+week[10]+week[11]+week[12]
- }
- var weekdate = this.getTimestamp(weeks)
- if(weekdate < this.timeNow){
- return 'background-color:#e5e5e5;'
- }
- },
- setting(){
- this.nurseVisible = true
- },
- _close: function(done) {
- done();
- },
- changeSort(val){
- console.log('val',val)
- const params = {
- sort:parseInt(val.sort),
- id:val.id,
- }
- console.log("params",params)
- SaveNurseSort(params).then(response=>{
- if(response.data.state == 1){
- var role = response.data.data.role
- this.$message.success("保存成功")
- this.getDoctorList()
- }
- })
- },
- changeRadio(val){
- console.log("val",val)
- const params = {
- id:val.id,
- is_sort:val.is_sort,
- }
- SaveIsSchedule(params).then(response=>{
- if(response.data.state == 1){
- var role = response.data.data.role
- this.$message.success("保存成功")
- this.getDoctorList()
- }
- })
- },
-
- toExport(){
- this.exportDialogVisible = true
-
- },
-
- getTimestamp(time) { //把时间日期转成时间戳
- return (new Date(time)).getTime() / 1000
- },
- exportList(){
- import('@/vendor/Export2Excel').then(excel => {
- for(let i=0;i<this.tableData.length;i++){
- this.tableData[i].monday = this.getClass(this.tableData[i].user_name,1)
- this.tableData[i].tuesday = this.getClass(this.tableData[i].user_name,2)
- this.tableData[i].wednesday = this.getClass(this.tableData[i].user_name,3)
- this.tableData[i].thursday = this.getClass(this.tableData[i].user_name,4)
- this.tableData[i].friday = this.getClass(this.tableData[i].user_name,5)
- this.tableData[i].saturday = this.getClass(this.tableData[i].user_name,6)
- this.tableData[i].weekday = this.getClass(this.tableData[i].user_name,0)
- }
- console.log("this.table",this.tableData)
- const tHeader = ['医护姓名', '周一'+"("+this.weekDayArr[0]+")" , '周二'+"("+this.weekDayArr[1]+")", '周三'+"("+this.weekDayArr[2]+")" , '周四'+"("+this.weekDayArr[3]+")" , '周五'+"("+this.weekDayArr[4]+")" , '周六'+"("+this.weekDayArr[5]+")",'周日'+"("+this.weekDayArr[6]+")"]
- const filterVal = ['user_name', 'monday', 'tuesday','wednesday','thursday','friday','saturday','weekday']
-
- const data = this.formatJson(filterVal,this.tableData)
- console.log("data",data)
-
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: '医护排班'
- })
- this.downloadLoading = false
-
- })
- },
- formatJson(filterVal, jsonData) {
- return jsonData.map(v => filterVal.map(j => v[j]))
- },
-
- toClick(id,index){
- this.$confirm(
- '是否要清除当前排班? <br>清除后,信息将无法恢复',
- '删除提示',
- {
- dangerouslyUseHTMLString: true,
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }
- ).then(()=>{
- console.log("rowwoowowow",id)
-
- DeleteStaffScheduleById(id).then(response=>{
- if(response.data.state == 1){
- var msg = response.data.data.msg
- this.$message.success("清除成功")
- this.getStaffScheduleList()
-
- }
- })
- })
- },
-
-
- hoverMouse(row,column, cell, event){
- this.name=row.user_name
- this.column_lie= column.label.split('\n')[0]
-
- },
- leavemouse(row, column, cell, event){
- this.name=''
- },
- toDialog(row){
- this.dialogVisible = true
- this.staffObj = row
- this.content = ""
- this.content = row.remark
- },
- saveDialog(){
-
- var data = {
- admin_user_id:this.staffObj.admin_user_id,
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6]),
- content:this.content,
- }
- console.log("params",data)
- saveStafScheduleRemark(data).then(response=>{
- if(response.data.state == 1){
- var msg = response.data.data.msg
- this.getStaffScheduleList()
- this.dialogVisible = false
-
- }
- })
- },
- changeStaffRmark(){
- console.log("val000000000000000000",this.remark)
- var params = {
- content:this.remark,
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6])
- }
- changeStaffRmark(params).then(response=>{
- if(response.data.state == 1){
- var msg = response.data.data.msg
- this.getStaffScheduleRemarkList()
- }
- })
- },
- getStaffScheduleRemarkList(){
- var params = {
- start_time:this.getTimestamp(this.weekDayArr[0]),
- end_time:this.getTimestamp(this.weekDayArr[6])
- }
- console.log("params=====",params)
- getStaffScheduleRemarkList(params).then(response=>{
- if(response.data.state==1){
- var scheduleRemark = response.data.data.scheduleRemark
- console.log("scheduleRemark",scheduleRemark)
-
- this.remark = scheduleRemark.remark
- console.log("haaaaaaaaaaaaaaaaaaa",this.remark)
- }
- })
- }
- },
- created(){
- //获取医护人员
- this.getDoctorList()
- //获取班种班种
- this.getScheduleList()
-
-
-
- let year = new Date().getFullYear()
- let month = new Date().getMonth() + 1
- let date = new Date().getDate()
- this.weekNum = this.getYearWeek(year,month,date)
- this.todayDate=this.formatDate(new Date())
- this.setDate(new Date())
-
-
-
- for (var i = 0; i <= 9; i++) {
- this.setDate1(this.addDate(this.currentDate, 7))
- }
- let newNum = 0
- for(let i = 0; i < this.weekList.length; i++){
- if(this.weekNum + i + 1 <= 53){
- let num = this.weekNum + i + 1
- let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + num + ')'
- this.typeOptions.push({value:i,label:str})
- let stt = this.weekList[i][0] +"~"+this.weekList[i][6]
- this.timeOptions.push({value:i,label:stt})
- }else{
-
- newNum++
- let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + newNum + ')'
- this.typeOptions.push({value:i,label:str})
- let stt = this.weekList[i][0] +"~"+this.weekList[i][6]
- this.timeOptions.push({value:i,label:stt})
- }
-
- }
- // var now = moment().locale('zh-cn').format('YYYY-MM-DD 00:00:00')
-
- var now = moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')
- console.log("日期==========---------------",now)
- this.timeNow = this.getTimestamp(now)
- console.log("haaaaaaaaaaaaaaaaaaa",this.timeNow)
- this.getStaffScheduleRemarkList()
-
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .dateBox{
- border: 1px solid #DCDFE6;
- height: 36px;
- line-height: 36px;
- text-align: center;
- padding: 0 10px;
- border-radius: 4px;
- }
- .classBox{
- width:28%;
- height: 100%;
- border: 1px solid #d0d3da;
- .classTitle{
- height: 42px;
- text-align: center;
- line-height: 42px;
- background-color: rgb(245, 247, 250);
- color: rgb(96, 98, 102);
- font-weight:bold;
-
- }
- .classMain{
- height: 400px;
- padding: 0 0 0 20px;
- display: flex;
- justify-content: space-between;
- flex-direction: column;
- >div>p{
- line-height: 30px;
- color: rgb(48, 49, 51);
- }
- .classMainBox{
- height: 350px;
- overflow-y: auto;
- }
- }
- }
- </style>
- <style lang="scss">
- .schedulingTable{
- .el-table .cell {
- white-space: pre-line;/*保留换行符*/
- }
- }
- .el-dropdown-menu{
- max-height:96%;
- overflow-y: auto;
- }
- .del_table_btns {
- position: absolute;
- right: 0px;
- top: -3px;
- // visibility: hidden;
- .el-button {
- width: 15px;
- height: 15px;
- padding: 0px;
- }
- }
-
- </style>
|