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

appointment.vue 95KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165
  1. <template>
  2. <div class="main-contain">
  3. <el-dialog
  4. title="提示"
  5. :visible.sync="exportVisible"
  6. width="40%"
  7. >
  8. <div>
  9. 您提交的排班信息已上传成功,系统正在执行导入,请稍候点击当前页面右上角“下载日志”查看导入结果
  10. </div>
  11. <span slot="footer" class="dialog-footer">
  12. <el-button @click="exportVisible = false">取 消</el-button>
  13. <el-button type="primary" @click="exportVisible = false">确 定</el-button>
  14. </span>
  15. </el-dialog>
  16. <el-dialog
  17. title="提示"
  18. :visible.sync="exportLogVisible"
  19. width="40%"
  20. >
  21. <div v-for="(item,index) in logs" :key="index">
  22. <span> {{ item.export_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  23. <br/>
  24. <br/>
  25. <span>{{ getContent(item) }}</span>
  26. <span>点击</span>
  27. <span style="color:blue" @click="generateTxt(item)">查看详情</span>
  28. <br/>
  29. <br/>
  30. </div>
  31. <span slot="footer" class="dialog-footer">
  32. <el-button @click="exportLogVisible = false">取 消</el-button>
  33. <el-button type="primary" @click="exportLogVisible = false">确 定</el-button>
  34. </span>
  35. </el-dialog>
  36. <el-dialog
  37. title="提示"
  38. :visible.sync="dialogVisible"
  39. width="40%"
  40. >
  41. <span>您提交的文档不是系统标准导入模板,请检查您的文档或重新下载文档</span>
  42. <span slot="footer" class="dialog-footer">
  43. <el-button @click="dialogVisible = false">取 消</el-button>
  44. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  45. </span>
  46. </el-dialog>
  47. <el-dialog
  48. title="提示"
  49. :visible.sync="isExistRepeatVisible"
  50. width="40%"
  51. >
  52. <span>检查到文档中同一天同个人存在多个排班,请检查并修改您的文档,重新导入</span>
  53. <span slot="footer" class="dialog-footer">
  54. <el-button @click="isExistRepeatVisible = false">取 消</el-button>
  55. <el-button type="primary" @click="isExistRepeatVisible = false">确 定</el-button>
  56. </span>
  57. </el-dialog>
  58. <div class="position">
  59. <bread-crumb :crumbs="crumbs"></bread-crumb>
  60. <div style="display:flex;align-items:center">
  61. <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleAction" v-if="activeName !='historyWeek'">打印排班</el-button>
  62. <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleActionOne" v-if="activeName == 'historyWeek'">打印排班</el-button>
  63. <!-- <schedule-upload-excel style="margin-right:10px;" :on-success='handleSuccess' v-if="is_edit"></schedule-upload-excel> -->
  64. <!-- <el-button @click="printTable" type="primary" size="small">打印排班</el-button> -->
  65. <el-button v-if="isShow()" type="primary" size="small" @click="export_file()" :loading="downloadLoading">
  66. 导出排班
  67. </el-button>
  68. <!-- <el-button
  69. @click="generateLog()"
  70. class="filter-item"
  71. type="primary"
  72. v-if="is_edit"
  73. size="small"
  74. >下载日志
  75. </el-button> -->
  76. <el-button type="primary" size="small" icon="el-icon-setting" @click="setScheduleTemplateAction">排班模板
  77. </el-button>
  78. <!-- <el-button type="primary" size="small" @click="copySchedule" v-if="is_edit">复制排班</el-button>
  79. <el-button type="primary" size="small" v-if="is_edit" @click="smartsch">智能排班</el-button> -->
  80. <el-button type="primary" size="small" v-if="!is_edit" @click="editsch">编辑排班</el-button>
  81. <!-- <el-button type="danger" size="small" v-if="is_edit" @click="outisedit">退出编辑</el-button> -->
  82. </div>
  83. </div>
  84. <div class="app-container">
  85. <div style="right:30px;position:absolute;z-index:99">
  86. <span>导出周次:</span>
  87. <el-date-picker
  88. v-model="weekTime"
  89. type="week"
  90. format="yyyy 第 WW 周"
  91. placeholder="选择周"
  92. :picker-options="{'firstDayOfWeek': 1}"
  93. @change="changeWeek"
  94. >
  95. </el-date-picker>
  96. </div>
  97. <el-tabs v-model="activeName" :tab-position="tabPosition" ref="elTabs" @tab-click="handleClick">
  98. <el-tab-pane name="historyWeek">
  99. <span slot="label"><i class="el-icon-date"></i> 历史周期 ({{ theWeek.historyWeek }}) </span>
  100. </el-tab-pane>
  101. <el-tab-pane name="lastWeek">
  102. <span slot="label"><i class="el-icon-date"></i> 上周 ({{ theWeek.lastWeek }})</span>
  103. </el-tab-pane>
  104. <el-tab-pane name="thisWeek">
  105. <span slot="label"><i class="el-icon-date"></i> 本周 ({{ theWeek.thisWeek }})</span>
  106. </el-tab-pane>
  107. <el-tab-pane name="nextWeek">
  108. <span slot="label"><i class="el-icon-date"></i> 下一周 ({{ theWeek.nextWeek }})</span>
  109. </el-tab-pane>
  110. <el-tab-pane name="nextTwoWeek">
  111. <span slot="label"><i class="el-icon-date"></i> 下下周 ({{ theWeek.nextTwoWeek }})</span>
  112. </el-tab-pane>
  113. </el-tabs>
  114. <div v-if="!is_edit">
  115. <table-data ref="tableData" :week-time="activeName" :partitions-prop="partitions"
  116. :schedule-zone-row-prop="scheduleZoneRow"
  117. :schedule-zone-prop="scheduleZone" title="" @event1="changePartition"
  118. @event2="changeSchedule" @event3="changeWeekDay" v-show="showtableOne">
  119. </table-data>
  120. </div>
  121. <edit-table-data ref="edittableData" :week-time="activeName" :partitions-prop="partitions"
  122. :schedule-zone-row-prop="scheduleZoneRow" :schedule-zone-prop="scheduleZone"
  123. title="" @event1="changePartition"
  124. @event2="changeSchedule" v-if="is_edit" @event3="changeWeekDay">
  125. <div class="position">
  126. <!-- <bread-crumb :crumbs="crumbs"></bread-crumb> -->
  127. <div>
  128. <el-tabs v-model="activeName" :tab-position="tabPosition" ref="elTabs">
  129. <el-tab-pane name="lastWeek">
  130. <span slot="label"><i class="el-icon-date"></i> 上周 ({{ theWeek.lastWeek }})</span>
  131. </el-tab-pane>
  132. <el-tab-pane name="thisWeek">
  133. <span slot="label"><i class="el-icon-date"></i> 本周 ({{ theWeek.thisWeek }})</span>
  134. </el-tab-pane>
  135. <el-tab-pane name="nextWeek">
  136. <span slot="label"><i class="el-icon-date"></i> 下一周 ({{ theWeek.nextWeek }})</span>
  137. </el-tab-pane>
  138. <el-tab-pane name="nextTwoWeek">
  139. <span slot="label"><i class="el-icon-date"></i> 下下周 ({{ theWeek.nextTwoWeek }})</span>
  140. </el-tab-pane>
  141. </el-tabs>
  142. </div>
  143. <div style="display:flex;align-items:center">
  144. <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleAction">打印排班</el-button>
  145. <schedule-upload-excel style="margin-right:10px;" :on-success='handleSuccess' v-if="is_edit"></schedule-upload-excel>
  146. <el-button v-if="isShow()" type="primary" size="small" @click="export_file()" :loading="downloadLoading">
  147. 导出排班
  148. </el-button>
  149. <el-button
  150. @click="generateLog()"
  151. class="filter-item"
  152. type="primary"
  153. v-if="is_edit"
  154. size="small"
  155. >下载日志
  156. </el-button>
  157. <el-button type="primary" size="small" icon="el-icon-setting" @click="setScheduleTemplateAction">排班模板
  158. </el-button>
  159. <el-button type="primary" size="small" @click="copySchedule" v-if="is_edit">复制排班</el-button>
  160. <el-button type="primary" size="small" v-if="is_edit" @click="smartsch">智能排班</el-button>
  161. <el-button type="primary" size="small" v-if="!is_edit" @click="editsch">编辑排班</el-button>
  162. <el-button type="danger" size="small" v-if="is_edit" @click="outisedit">退出编辑</el-button>
  163. </div>
  164. </div>
  165. </edit-table-data>
  166. <HistoryWeekTable v-show="showtable" ref="tableDataZero" :week-time="activeName" partitions-prop="partitions"
  167. :schedule-zone-row-prop="scheduleZoneRow"
  168. :schedule-zone-prop="scheduleZone" title="" >
  169. </HistoryWeekTable>
  170. <el-dialog title="复制排班" width="600px" :visible.sync="newVisible">
  171. <el-form :model="form" ref="form" label-width="90px" :rules="rules">
  172. <el-form-item label="周次:">
  173. <el-radio v-model="form.lastweek" label="1">上周排班信息</el-radio>
  174. <el-radio v-model="form.lastweek" label="2">本周排班信息</el-radio>
  175. </el-form-item>
  176. <el-form-item label="复制到 : " required prop="copyWeek">
  177. <el-select v-model="form.copyWeek" placeholder="请选择">
  178. <el-option
  179. v-for="item in typeOptions"
  180. :key="item.value"
  181. :label="item.label"
  182. :value="item.value">
  183. </el-option>
  184. </el-select>
  185. </el-form-item>
  186. </el-form>
  187. <div slot="footer" class="dialog-footer">
  188. <el-button @click="newVisible=false">取 消</el-button>
  189. <el-button v-loading="copySchLoading" type="primary" @click="submitAction('form')">保 存</el-button>
  190. </div>
  191. </el-dialog>
  192. </div>
  193. </div>
  194. </template>
  195. <script>
  196. import moment from 'moment'
  197. import {parseTime} from '@/utils'
  198. import tableData from './components/tableData'
  199. import {
  200. copyPatientSchedule,
  201. exportSchedule,
  202. getScheduleTemplate,
  203. getThreeWeekList,
  204. getWeekPanels,
  205. initDate,
  206. getAllZones
  207. } from '@/api/schedule'
  208. import {
  209. patientLists
  210. } from '@/api/schedule_template/sch_template'
  211. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  212. import UploadExcel from '@/xt_pages/components/UploadExcel'
  213. import ScheduleUploadExcel from './components/scheduleUploadExcel/index'
  214. import {generateLog} from '@/api/config'
  215. import {uParseTime} from '@/utils/tools'
  216. import EditTableData from "./components/editTableData";
  217. import HistoryWeekTable from './components/historyWeekTable'
  218. export default {
  219. name: 'appointment',
  220. data() {
  221. return {
  222. options:[
  223. {id:0,name:"全部"},
  224. {id:1,name:"上午"},
  225. {id:2,name:"下午"},
  226. {id:3,name:"晚上"},
  227. ],
  228. patientList:[],
  229. scheduleType: [
  230. { id: 1, name: "上午" },
  231. { id: 2, name: "下午" },
  232. { id: 3, name: "晚上" }
  233. ],weekType:[
  234. { id: 1, name: "周一" },
  235. { id: 2, name: "周二" },
  236. { id: 3, name: "周三" },
  237. { id: 4, name: "周四" },
  238. { id: 5, name: "周五" },
  239. { id: 6, name: "周六" },
  240. { id: 7, name: "周日" },
  241. ],
  242. query_date:"",
  243. query_sch_type:"",
  244. query_week_type:"",
  245. query_zone:"",
  246. crumbs: [
  247. {path: false, name: '排班管理'},
  248. {path: '/workforce/appointment', name: '排班管理'}
  249. ],
  250. activeName: 'thisWeek',
  251. tabPosition: 'top',
  252. partitions: {},
  253. scheduleZone: [],
  254. days: [],
  255. logs: [],
  256. showtable:false,
  257. showtableOne:true,
  258. is_edit: false,
  259. schedulingTableVisible:false,//全屏
  260. scheduleZoneRow: [],
  261. downloadLoading: false,
  262. msgTipVisible: false,
  263. dialogVisible: false,
  264. isExistRepeatVisible: false,
  265. exportVisible: false,
  266. exportLogVisible: false,
  267. // 周期
  268. theWeek: {
  269. historyWeek:0,
  270. lastWeek: 0,
  271. thisWeek: 0,
  272. nextWeek: 0,
  273. nextTwoWeek: 0
  274. },
  275. tableList: [],
  276. weekTime: "",
  277. schedule_type: 0,
  278. partition_id: 0,
  279. zones: [],
  280. start_time: "",
  281. end_time: "",
  282. export_type: 0,
  283. form: {
  284. lastweek: "1",
  285. copyWeek: "",
  286. },
  287. newVisible: false,
  288. copySchLoading:false,
  289. typeOptions: [],
  290. timeOptions: [],
  291. copyWeek: '',
  292. weekList: [],
  293. currentFirstDate1: '',
  294. rules: {
  295. copyWeek: [{required: true, message: "请选择复制时间段", trigger: "blur"}],
  296. },
  297. weekNum: '',
  298. weekDayArr: [],
  299. todayDate: '',
  300. clen: 7,
  301. nowYear: new Date().getFullYear(),
  302. schedule_week: 0,
  303. newDay: [],
  304. templateObj: {},
  305. week_date:""
  306. }
  307. },
  308. components: {
  309. EditTableData,
  310. ScheduleUploadExcel,
  311. tableData,
  312. BreadCrumb,
  313. UploadExcel,
  314. HistoryWeekTable
  315. },
  316. methods: {
  317. handleClick(e,tab){
  318. if(e.name == 'historyWeek'){
  319. this.showtable=true
  320. this.showtableOne=false
  321. this.$nextTick(() => {
  322. this.$refs.tableDataZero.start()
  323. })
  324. // console.log('12343545',this.$refs.tableDataZero);
  325. }else{
  326. this.showtable=false
  327. this.showtableOne=true
  328. }
  329. },
  330. dragstart(event, item) {
  331. // console.log('start的索引',item.moveIndex)
  332. // 开始移动的时候将移动的索引值+图片的url存储下来
  333. },
  334. dragend(event,item) {
  335. // console.log('dragend',item)
  336. },
  337. getAllZones(){
  338. getAllZones().then(response=>{
  339. if(response.data.state == 1){
  340. var zones = response.data.data.zones
  341. this.zones = zones
  342. }
  343. })
  344. },
  345. compare(p) { //这是比较函数
  346. return function (m, n) {
  347. var a = m[p];
  348. var b = n[p];
  349. return a - b; //升序
  350. }
  351. },
  352. // printTable(){
  353. // this.$router.push({path: '/scheduleTablePrint?partition_id='+this.partition_id+"&weekTime="+this.activeName})
  354. // },
  355. generateTxt: function (log) {
  356. var content = ''
  357. var errlog = log.err_logs
  358. content = this.getContent(log)
  359. for (let i = 0; i < errlog.length; i++) {
  360. if (content.length == 0) {
  361. content = errlog[i].err_msg
  362. } else {
  363. content = content + '\n' + errlog[i].err_msg
  364. }
  365. }
  366. var url = new Blob(['\ufeff' + content], {type: 'text/txt,charset=UTF-8'})
  367. if (typeof url === 'object' && url instanceof Blob) {
  368. url = URL.createObjectURL(url) // 创建blob地址
  369. }
  370. const aLink = document.createElement('a')
  371. aLink.href = url
  372. aLink.download = this.timestampToTime(log.export_time) + '临时排班导入日志.txt'
  373. aLink.click()
  374. },
  375. timestampToTime(timestamp) {
  376. var date = new Date(timestamp * 1000)//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  377. var Y = date.getFullYear() + '年'
  378. var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月'
  379. var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日 '
  380. var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + '时'
  381. var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + '分'
  382. var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds()) + '秒'
  383. return Y + M + D + h + m + s
  384. },
  385. getContent(log) {
  386. return '您导入的文档共' + log.total_num + '条患者数据' + ',' + '已成功导入' + log.success_num + '条,导入失败' + log.fail_num + '条,'
  387. },
  388. generateLog() {
  389. let params = {
  390. 'log_type': 2
  391. }
  392. generateLog(params).then(
  393. response => {
  394. if (response.data.state === 1) {
  395. this.logs = response.data.data.logs
  396. this.exportLogVisible = true
  397. } else {
  398. this.$message.error(response.data.msg)
  399. }
  400. }
  401. )
  402. },
  403. getWeekPanels() {
  404. // this.scheduleZoneRow = []
  405. // this.scheduleZone = []
  406. getWeekPanels(1, this.partition_id).then(response => {
  407. if (response.data.state == 0) {
  408. return false
  409. }
  410. var partitions = response.data.data.partitions
  411. console.log("分区",response.data.data)
  412. this.theWeek.thisWeek = response.data.data.theWeek
  413. this.theWeek.lastWeek = response.data.data.theLastWeek
  414. this.theWeek.nextWeek = response.data.data.theNextWeek
  415. this.theWeek.nextTwoWeek = response.data.data.theNextSecWeek
  416. this.theWeek.historyWeek = response.data.data.theWeek - 2
  417. // 在控制变量改变的时候进行 强制渲染更新
  418. let childrenRefs = this.$refs.elTabs.$children
  419. this.$nextTick(() => {
  420. childrenRefs.forEach(child => child.$forceUpdate())
  421. })
  422. var that = this
  423. if (partitions.length > 0) {
  424. let arrSort = []
  425. partitions.forEach((item) => {
  426. let num = Math.max.apply(Math, item.jihaos.map(function (o) {
  427. return o.sort
  428. }))
  429. item.sort = num
  430. arrSort.push(item)
  431. })
  432. arrSort.sort(this.compare('sort'))
  433. partitions = arrSort
  434. partitions.forEach(function (partition) {
  435. if (partition.jihaos.length == 0) {
  436. return false
  437. }
  438. that.scheduleZoneRow.push(partition.jihaos.length)
  439. that.partitions[partition.id] = partition
  440. partition.jihaos.forEach(function (jihao) {
  441. var thisPa = {
  442. area: partition.name,
  443. zone_id: partition.id,
  444. zone_type: partition.type,
  445. cut: jihao.number,
  446. jihao_id: jihao.id,
  447. Mon_M: {
  448. schedule_id: 0,
  449. mode_id: 0,
  450. mode_name: '',
  451. dialysis_machine_name:"",
  452. patient_id: 0,
  453. patient: '',
  454. zone_id:partition.id,
  455. jihao_id: jihao.id,
  456. },
  457. Mon_A: {
  458. schedule_id: 0,
  459. mode_id: 0,
  460. mode_name: '',
  461. dialysis_machine_name:"",
  462. patient_id: 0,
  463. patient: '',
  464. zone_id:partition.id,
  465. jihao_id: jihao.id,
  466. },
  467. Mon_N: {
  468. schedule_id: 0,
  469. mode_id: 0,
  470. mode_name: '',
  471. patient_id: 0,
  472. dialysis_machine_name:"",
  473. patient: '',
  474. zone_id:partition.id,
  475. jihao_id: jihao.id,
  476. },
  477. Tue_M: {
  478. schedule_id: 0,
  479. mode_id: 0,
  480. mode_name: '',
  481. dialysis_machine_name:"",
  482. patient_id: 0,
  483. patient: '',
  484. zone_id:partition.id,
  485. jihao_id: jihao.id,
  486. },
  487. Tue_A: {
  488. schedule_id: 0,
  489. mode_id: 0,
  490. mode_name: '',
  491. dialysis_machine_name:"",
  492. patient_id: 0,
  493. patient: '',
  494. zone_id:partition.id,
  495. jihao_id: jihao.id,
  496. },
  497. Tue_N: {
  498. schedule_id: 0,
  499. mode_id: 0,
  500. mode_name: '',
  501. patient_id: 0,
  502. dialysis_machine_name:"",
  503. patient: '',
  504. zone_id:partition.id,
  505. jihao_id: jihao.id,
  506. },
  507. Wed_M: {
  508. schedule_id: 0,
  509. mode_id: 0,
  510. mode_name: '',
  511. patient_id: 0,
  512. dialysis_machine_name:"",
  513. patient: '',
  514. zone_id:partition.id,
  515. jihao_id: jihao.id,
  516. },
  517. Wed_A: {
  518. schedule_id: 0,
  519. mode_id: 0,
  520. mode_name: '',
  521. patient_id: 0,
  522. dialysis_machine_name:"",
  523. patient: '',
  524. zone_id:partition.id,
  525. jihao_id: jihao.id,
  526. },
  527. Wed_N: {
  528. schedule_id: 0,
  529. mode_id: 0,
  530. mode_name: '',
  531. patient_id: 0,
  532. dialysis_machine_name:"",
  533. patient: '',
  534. zone_id:partition.id,
  535. jihao_id: jihao.id,
  536. },
  537. Thurs_M: {
  538. schedule_id: 0,
  539. mode_id: 0,
  540. mode_name: '',
  541. patient_id: 0,
  542. dialysis_machine_name:"",
  543. patient: '',
  544. zone_id:partition.id,
  545. jihao_id: jihao.id,
  546. },
  547. Thurs_A: {
  548. schedule_id: 0,
  549. mode_id: 0,
  550. mode_name: '',
  551. patient_id: 0,
  552. dialysis_machine_name:"",
  553. patient: '',
  554. zone_id:partition.id,
  555. jihao_id: jihao.id,
  556. },
  557. Thurs_N: {
  558. schedule_id: 0,
  559. mode_id: 0,
  560. mode_name: '',
  561. patient_id: 0,
  562. dialysis_machine_name:"",
  563. patient: '',
  564. zone_id:partition.id,
  565. jihao_id: jihao.id,
  566. },
  567. Fri_M: {
  568. schedule_id: 0,
  569. mode_id: 0,
  570. mode_name: '',
  571. dialysis_machine_name:"",
  572. patient_id: 0,
  573. patient: '',
  574. zone_id:partition.id,
  575. jihao_id: jihao.id,
  576. },
  577. Fri_A: {
  578. schedule_id: 0,
  579. mode_id: 0,
  580. mode_name: '',
  581. dialysis_machine_name:"",
  582. patient_id: 0,
  583. patient: '',
  584. zone_id:partition.id,
  585. jihao_id: jihao.id,
  586. },
  587. Fri_N: {
  588. schedule_id: 0,
  589. mode_id: 0,
  590. mode_name: '',
  591. patient_id: 0,
  592. dialysis_machine_name:"",
  593. patient: '',
  594. zone_id:partition.id,
  595. jihao_id: jihao.id,
  596. },
  597. Sat_M: {
  598. schedule_id: 0,
  599. mode_id: 0,
  600. mode_name: '',
  601. patient_id: 0,
  602. dialysis_machine_name:"",
  603. patient: '',
  604. zone_id:partition.id,
  605. jihao_id: jihao.id,
  606. },
  607. Sat_A: {
  608. schedule_id: 0,
  609. mode_id: 0,
  610. mode_name: '',
  611. dialysis_machine_name:"",
  612. patient_id: 0,
  613. patient: '',
  614. zone_id:partition.id,
  615. jihao_id: jihao.id,
  616. },
  617. Sat_N: {
  618. schedule_id: 0,
  619. mode_id: 0,
  620. mode_name: '',
  621. patient_id: 0,
  622. dialysis_machine_name:"",
  623. patient: '',
  624. zone_id:partition.id,
  625. jihao_id: jihao.id,
  626. },
  627. Sun_A: {
  628. schedule_id: 0,
  629. mode_id: 0,
  630. mode_name: '',
  631. patient_id: 0,
  632. dialysis_machine_name:"",
  633. patient: '',
  634. zone_id:partition.id,
  635. jihao_id: jihao.id,
  636. },
  637. Sun_N: {
  638. schedule_id: 0,
  639. mode_id: 0,
  640. mode_name: '',
  641. dialysis_machine_name:"",
  642. patient_id: 0,
  643. patient: '',
  644. zone_id:partition.id,
  645. jihao_id: jihao.id,
  646. },
  647. Sun_M: {
  648. schedule_id: 0,
  649. mode_id: 0,
  650. mode_name: '',
  651. dialysis_machine_name:"",
  652. patient_id: 0,
  653. patient: '',
  654. zone_id:partition.id,
  655. jihao_id: jihao.id,
  656. },
  657. total: 0
  658. }
  659. that.scheduleZone.push(thisPa)
  660. })
  661. })
  662. }
  663. // console.log("111111111")
  664. console.log(that.scheduleZone)
  665. })
  666. },
  667. changeSch(val){
  668. // console.log(this.partitions)
  669. // console.log(this.scheduleZoneRow)
  670. // console.log(this.scheduleZone)
  671. },
  672. changeWeekType(val){
  673. },
  674. changeZone(val){
  675. },
  676. setScheduleTemplateAction: function () {
  677. this.schedulingTableVisible=true
  678. this.$router.push({path: '/workforce/template'})
  679. },
  680. export_file: function () {
  681. // this.getWeekPanelsTwo()
  682. this.export_file_step_two()
  683. },
  684. export_file_step_two: function(){
  685. this.downloadLoading = true
  686. import('@/vendor/Export2Excel').then(excel => {
  687. const filterVal = [
  688. '区号',
  689. '机号'
  690. ]
  691. if (this.export_type == 0) {
  692. const multiHeader = [['区号', '机号', '周一' + "(" + this.days[0] + ")", '', '', '周二' + "(" + this.days[1] + ")", '', '', '周三' + "(" + this.days[2] + ")", '', '', '周四' + "(" + this.days[3] + ")", '', '', '周五' + "(" + this.days[4] + ")", '', '', '周六' + "(" + this.days[5] + ")", '', '', '周日' + "(" + this.days[6] + ")", '', '', '周一' + "(" + this.days[7] + ")", '', '', '周二' + "(" + this.days[8] + ")", '', '', '周三' + "(" + this.days[9] + ")", '', '', '周四' + "(" + this.days[10] + ")", '', '', '周五' + "(" + this.days[11] + ")", '', '', '周六' + "(" + this.days[12] + ")", '', '', '周日' + "(" + this.days[13] + ")", '', '', '周一' + "(" + this.days[14] + ")", '', '', '周二' + "(" + this.days[15] + ")", '', '', '周三' + "(" + this.days[16] + ")", '', '', '周四' + "(" + this.days[17] + ")", '', '', '周五' + "(" + this.days[18] + ")", '', '', '周六' + "(" + this.days[19] + ")", '', '', '周日' + "(" + this.days[20] + ")", '', '']]
  693. const header = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上']
  694. const merges = ['A1:A2', 'B1:B2', 'C1:E1', 'F1:H1', 'I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1', 'U1:W1', 'X1:Z1', 'AA1:AC1', 'AD1:AF1', 'AG1:AI1', 'AJ1:AL1', 'AM1:AO1', 'AP1:AR1', 'AS1:AU1', 'AV1:AX1', 'AY1:BA1', 'BB1:BD1', 'BE1:BG1', 'BH1:BJ1', 'BK1:BM1']
  695. var list = []
  696. let i = 0
  697. for (let key in this.partitions) {
  698. var tempValue
  699. var jihaos = this.partitions[key].jihaos
  700. if (i == 0) {
  701. let m = 'A3' + ':' + 'A' + (2 + jihaos.length)
  702. tempValue = (2 + jihaos.length)
  703. merges.push(m)
  704. } else {
  705. let m = 'A' + (tempValue + 1) + ':' + 'A' + ((tempValue + 1) + jihaos.length - 1)
  706. tempValue = ((tempValue + 1) + jihaos.length - 1)
  707. merges.push(m)
  708. }
  709. for (let b = 0; b < jihaos.length; b++) {
  710. let obj = {}
  711. obj['区号'] = this.partitions[key].name
  712. obj['机号'] = jihaos[b].number.toString()
  713. list.push(obj)
  714. }
  715. i++
  716. }
  717. var data = []
  718. this.tableList.map(item => {
  719. data.push(Object.values(item))
  720. })
  721. const filename = '排班模版'
  722. excel.export_json_to_excel({
  723. multiHeader,
  724. header,
  725. merges,
  726. data,
  727. filename
  728. })
  729. this.downloadLoading = false
  730. }
  731. if (this.export_type == 1) {
  732. const multiHeader = [['区号', '机号', '周一' + "(" + this.newDay[0] + ")", '', '', '周二' + "(" + this.newDay[1] + ")", '', '', '周三' + "(" + this.newDay[2] + ")", '', '', '周四' + "(" + this.newDay[3] + ")", '', '', '周五' + "(" + this.newDay[4] + ")", '', '', '周六' + "(" + this.newDay[5] + ")", '', '', '周日' + "(" + this.newDay[6] + ")", '', '']]
  733. const header = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上']
  734. const merges = ['A1:A2', 'B1:B2', 'C1:E1', 'F1:H1', 'I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1', 'U1:W1', 'X1:Z1', 'AA1:AC1', 'AD1:AF1', 'AG1:AI1', 'AJ1:AL1', 'AM1:AO1', 'AP1:AR1', 'AS1:AU1', 'AV1:AX1', 'AY1:BA1', 'BB1:BD1', 'BE1:BG1', 'BH1:BJ1', 'BK1:BM1']
  735. var list = []
  736. let i = 0
  737. for (let key in this.partitions) {
  738. var tempValue
  739. var jihaos = this.partitions[key].jihaos
  740. if (i == 0) {
  741. let m = 'A3' + ':' + 'A' + (2 + jihaos.length)
  742. tempValue = (2 + jihaos.length)
  743. merges.push(m)
  744. } else {
  745. let m = 'A' + (tempValue + 1) + ':' + 'A' + ((tempValue + 1) + jihaos.length - 1)
  746. tempValue = ((tempValue + 1) + jihaos.length - 1)
  747. merges.push(m)
  748. }
  749. for (let b = 0; b < jihaos.length; b++) {
  750. let obj = {}
  751. obj['区号'] = this.partitions[key].name
  752. obj['机号'] = jihaos[b].number.toString()
  753. list.push(obj)
  754. }
  755. i++
  756. }
  757. var data = []
  758. this.tableList.map(item => {
  759. data.push(Object.values(item))
  760. })
  761. const filename = '排班模版'
  762. if (this.$store.getters.xt_user.org.id == 10234) {
  763. excel.export_json_to_excel1({
  764. multiHeader,
  765. header,
  766. merges,
  767. data,
  768. filename,
  769. ref: this.$refs['tableData'].$refs['table'].$el
  770. })
  771. } else {
  772. excel.export_json_to_excel({
  773. multiHeader,
  774. header,
  775. merges,
  776. data,
  777. filename
  778. })
  779. }
  780. this.downloadLoading = false
  781. }
  782. })
  783. },
  784. export_fileTwo: function () {
  785. import('@/vendor/Export2Excel').then(excel => {
  786. const filterVal = [
  787. '区号',
  788. '机号'
  789. ]
  790. const multiHeader = [['区号', '机号', '周一' + "(" + this.days[0] + ")", '', '', '周二' + "(" + this.days[1] + ")", '', '', '周三' + "(" + this.days[2] + ")", '', '', '周四' + "(" + this.days[3] + ")", '', '', '周五' + "(" + this.days[4] + ")", '', '', '周六' + "(" + this.days[5] + ")", '', '', '周日' + "(" + this.days[6] + ")", '', '', '周一' + "(" + this.days[7] + ")", '', '', '周二' + "(" + this.days[8] + ")", '', '', '周三' + "(" + this.days[9] + ")", '', '', '周四' + "(" + this.days[10] + ")", '', '', '周五' + "(" + this.days[11] + ")", '', '', '周六' + "(" + this.days[12] + ")", '', '', '周日' + "(" + this.days[13] + ")", '', '', '周一' + "(" + this.days[14] + ")", '', '', '周二' + "(" + this.days[15] + ")", '', '', '周三' + "(" + this.days[16] + ")", '', '', '周四' + "(" + this.days[17] + ")", '', '', '周五' + "(" + this.days[18] + ")", '', '', '周六' + "(" + this.days[19] + ")", '', '', '周日' + "(" + this.days[20] + ")", '', '']]
  791. const header = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上']
  792. const merges = ['A1:A2', 'B1:B2', 'C1:E1', 'F1:H1', 'I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1', 'U1:W1', 'X1:Z1', 'AA1:AC1', 'AD1:AF1', 'AG1:AI1', 'AJ1:AL1', 'AM1:AO1', 'AP1:AR1', 'AS1:AU1', 'AV1:AX1', 'AY1:BA1', 'BB1:BD1', 'BE1:BG1', 'BH1:BJ1', 'BK1:BM1']
  793. var data = []
  794. // console.log("33333",this.tableList)
  795. this.tableList.map(item => {
  796. data.push(Object.values(item))
  797. })
  798. const filename = '排班模版'
  799. excel.export_json_to_excel({
  800. multiHeader,
  801. header,
  802. merges,
  803. data,
  804. filename
  805. })
  806. })
  807. },
  808. // formatJson(filterVal, jsonData) {
  809. // return jsonData.map(v => filterVal.map(j => v[j]))
  810. // },
  811. formatJson(filterVal, jsonData) {
  812. return jsonData.map(v =>
  813. filterVal.map(j => {
  814. if (j === 'timestamp') {
  815. return parseTime(v[j])
  816. } else {
  817. return v[j]
  818. }
  819. })
  820. )
  821. },
  822. printScheduleAction: function () {
  823. var date = new Date().getTime()
  824. if (this.activeName == 'lastWeek') {
  825. date = date - 7 * 24 * 60 * 60 * 1000
  826. } else if (this.activeName == 'nextWeek') {
  827. date = date + 7 * 24 * 60 * 60 * 1000
  828. } else if (this.activeName == 'nextTwoWeek') {
  829. date = date + 14 * 24 * 60 * 60 * 1000
  830. }
  831. console.log("whhwhwhwhwhwh",date)
  832. console.log("this.templateObj.template_id == 1",this.templateObj.template_id)
  833. console.log("week2333333333333333",this.week_date)
  834. if (this.templateObj.template_id == 1) {
  835. this.$router.push({path: '/workforce/schedule/print', query: {date: date}})
  836. }
  837. if (this.templateObj.template_id == 2) {
  838. this.$router.push({path: '/scheduleTablePrint?partition_id=' + this.partition_id + "&weekTime=" + this.activeName+"&week_date="+this.week_date})
  839. }
  840. if (this.templateObj.template_id == 3) {
  841. this.$router.push({path: '/scheduleTablePrintOne?partition_id=' + this.partition_id + "&weekTime=" + this.activeName+"&week_date="+this.week_date})
  842. }
  843. if(this.templateObj.template_id == 4){
  844. this.$router.push({path: '/scheduleTablePrintTwo?partition_id=' + this.partition_id + "&weekTime=" + this.activeName+"&week_date="+this.week_date})
  845. }
  846. },
  847. printScheduleActionOne:function(){
  848. var start_time = this.$refs.tableDataZero.start_time
  849. var end_time = this.$refs.tableDataZero.end_time
  850. var partition_id = this.$refs.tableDataZero.partition_id
  851. var nextTwoWeek = "nextTwoWeek"
  852. var week_date = []
  853. this.$router.push({path:'/scheduleTablePrintThree?partition_id='+partition_id+"&weekTime="+nextTwoWeek+"&week_date="+week_date+"&start_time="+start_time+"&end_time="+end_time})
  854. },
  855. isShow() {
  856. let isShow = false
  857. if (Object.keys(this.partitions).length != 0) {
  858. isShow = true
  859. let i = 0
  860. for (let key in this.partitions) {
  861. if (i == 0) {
  862. if (this.partitions[key].jihaos.length > 0) {
  863. isShow = true
  864. }
  865. }
  866. i++
  867. }
  868. }
  869. return isShow
  870. },
  871. handleSuccess({results, header}) {
  872. let headers = []
  873. for (let key in results[0]) {
  874. headers.push(key)
  875. }
  876. if (header.length == 65) {
  877. var isHas_1 = headers.includes('区号')
  878. var isHas_2 = headers.includes('机号')
  879. var isHas_3 = headers.includes('周一' + "(" + this.days[0] + ")")
  880. var isHas_4 = headers.includes('')
  881. var isHas_5 = headers.includes('_1')
  882. var isHas_6 = headers.includes('周二' + "(" + this.days[1] + ")")
  883. var isHas_7 = headers.includes('_2')
  884. var isHas_8 = headers.includes('_3')
  885. var isHas_9 = headers.includes('周三' + "(" + this.days[2] + ")")
  886. var isHas_10 = headers.includes('_4')
  887. console.log("10" + isHas_10)
  888. var isHas_11 = headers.includes('_5')
  889. console.log("11" + isHas_11)
  890. var isHas_12 = headers.includes('周四' + "(" + this.days[3] + ")")
  891. console.log("12" + isHas_12)
  892. var isHas_13 = headers.includes('_6')
  893. console.log("13" + isHas_13)
  894. var isHas_14 = headers.includes('_7')
  895. console.log("14" + isHas_14)
  896. var isHas_15 = headers.includes('周五' + "(" + this.days[4] + ")")
  897. console.log("15" + isHas_15)
  898. var isHas_16 = headers.includes('_8')
  899. console.log("16" + isHas_16)
  900. var isHas_17 = headers.includes('_9')
  901. console.log("17" + isHas_17)
  902. var isHas_18 = headers.includes('周六' + "(" + this.days[5] + ")")
  903. console.log("18" + isHas_18)
  904. var isHas_19 = headers.includes('_10')
  905. console.log("19" + isHas_19)
  906. var isHas_20 = headers.includes('_11')
  907. console.log("20" + isHas_20)
  908. var isHas_21 = headers.includes('周日' + "(" + this.days[6] + ")")
  909. console.log("21" + isHas_21)
  910. var isHas_22 = headers.includes('_12')
  911. console.log("22" + isHas_22)
  912. var isHas_23 = headers.includes('_13')
  913. console.log("23" + isHas_23)
  914. var isHas_24 = headers.includes('周一' + "(" + this.days[7] + ")")
  915. console.log("24" + isHas_24)
  916. var isHas_25 = headers.includes('_14')
  917. console.log("25" + isHas_25)
  918. var isHas_26 = headers.includes('_15')
  919. console.log("26" + isHas_26)
  920. var isHas_27 = headers.includes('周二' + "(" + this.days[8] + ")")
  921. console.log("27" + isHas_27)
  922. var isHas_28 = headers.includes('_16')
  923. console.log("28" + isHas_28)
  924. var isHas_29 = headers.includes('_17')
  925. console.log("29" + isHas_29)
  926. var isHas_30 = headers.includes('周三' + "(" + this.days[9] + ")")
  927. console.log("30" + isHas_30)
  928. var isHas_31 = headers.includes('_18')
  929. console.log("31" + isHas_31)
  930. var isHas_32 = headers.includes('_19')
  931. console.log("32" + isHas_32)
  932. var isHas_33 = headers.includes('周四' + "(" + this.days[10] + ")")
  933. console.log("33" + isHas_33)
  934. var isHas_34 = headers.includes('_20')
  935. console.log("34" + isHas_34)
  936. var isHas_35 = headers.includes('_21')
  937. console.log("35" + isHas_35)
  938. var isHas_36 = headers.includes('周五' + "(" + this.days[11] + ")")
  939. console.log("36" + isHas_36)
  940. var isHas_37 = headers.includes('_22')
  941. console.log("37" + isHas_37)
  942. var isHas_38 = headers.includes('_23')
  943. console.log("38" + isHas_38)
  944. var isHas_39 = headers.includes('周六' + "(" + this.days[12] + ")")
  945. console.log("39" + isHas_39)
  946. var isHas_40 = headers.includes('_24')
  947. console.log("40" + isHas_40)
  948. var isHas_41 = headers.includes('_25')
  949. console.log("41" + isHas_41)
  950. var isHas_42 = headers.includes('周日' + "(" + this.days[13] + ")")
  951. console.log("42" + isHas_42)
  952. var isHas_43 = headers.includes('_26')
  953. console.log("43" + isHas_43)
  954. var isHas_44 = headers.includes('_27')
  955. console.log("44" + isHas_44)
  956. var isHas_45 = headers.includes('周一' + "(" + this.days[14] + ")")
  957. console.log("45" + isHas_45)
  958. var isHas_46 = headers.includes('_28')
  959. console.log("46" + isHas_46)
  960. var isHas_47 = headers.includes('_29')
  961. console.log("47" + isHas_47)
  962. var isHas_48 = headers.includes('周二' + "(" + this.days[15] + ")")
  963. console.log("48" + isHas_48)
  964. var isHas_49 = headers.includes('_30')
  965. console.log("49" + isHas_49)
  966. var isHas_50 = headers.includes('_31')
  967. console.log("50" + isHas_50)
  968. var isHas_51 = headers.includes('周三' + "(" + this.days[16] + ")")
  969. console.log("51" + isHas_51)
  970. var isHas_52 = headers.includes('_32')
  971. console.log("52" + isHas_52)
  972. var isHas_53 = headers.includes('_33')
  973. console.log("53" + isHas_53)
  974. var isHas_54 = headers.includes('周四' + "(" + this.days[17] + ")")
  975. console.log("54" + isHas_54)
  976. var isHas_55 = headers.includes('_34')
  977. console.log("55" + isHas_55)
  978. var isHas_56 = headers.includes('_35')
  979. console.log("56" + isHas_56)
  980. var isHas_57 = headers.includes('周五' + "(" + this.days[18] + ")")
  981. console.log("57" + isHas_57)
  982. var isHas_58 = headers.includes('_36')
  983. console.log("58" + isHas_58)
  984. var isHas_59 = headers.includes('_37')
  985. console.log("59" + isHas_59)
  986. var isHas_60 = headers.includes('周六' + "(" + this.days[19] + ")")
  987. console.log("60" + isHas_60)
  988. var isHas_61 = headers.includes('_38')
  989. console.log("61" + isHas_61)
  990. var isHas_62 = headers.includes('_39')
  991. console.log("62" + isHas_62)
  992. var isHas_63 = headers.includes('周日' + "(" + this.days[20] + ")")
  993. console.log("63" + isHas_63)
  994. var isHas_64 = headers.includes('_40')
  995. console.log("64" + isHas_64)
  996. var isHas_65 = headers.includes('_41')
  997. console.log("65" + isHas_65)
  998. if (!(isHas_1 && isHas_2 && isHas_3 && isHas_4 && isHas_5 &&
  999. isHas_6 && isHas_7 && isHas_8 && isHas_9 && isHas_10 &&
  1000. isHas_11 && isHas_12 && isHas_13 && isHas_14 && isHas_15 &&
  1001. isHas_16 && isHas_17 && isHas_18 && isHas_19 && isHas_20 &&
  1002. isHas_21 && isHas_22 && isHas_23 && isHas_24 && isHas_25 &&
  1003. isHas_26 && isHas_27 && isHas_28 && isHas_29 && isHas_30 &&
  1004. isHas_31 && isHas_32 && isHas_33 && isHas_34 && isHas_35 &&
  1005. isHas_36 && isHas_37 && isHas_38 && isHas_39 && isHas_40 &&
  1006. isHas_41 && isHas_42 && isHas_43 && isHas_44 && isHas_45 &&
  1007. isHas_46 && isHas_47 && isHas_48 && isHas_49 && isHas_50 &&
  1008. isHas_51 && isHas_52 && isHas_53 && isHas_54 && isHas_55 &&
  1009. isHas_56 && isHas_57 && isHas_58 && isHas_59 && isHas_60 &&
  1010. isHas_61 && isHas_62 && isHas_63 && isHas_64 && isHas_65)) {
  1011. this.dialogVisible = true
  1012. return
  1013. }
  1014. } else if (header.length == 23) {
  1015. var isHas_1 = headers.includes('区号')
  1016. console.log("1" + isHas_1)
  1017. var isHas_2 = headers.includes('机号')
  1018. console.log("2" + isHas_2)
  1019. var isHas_3 = headers.includes('周一' + "(" + this.days[0] + ")")
  1020. console.log("3" + isHas_3)
  1021. var isHas_4 = headers.includes('')
  1022. console.log("4" + isHas_4)
  1023. var isHas_5 = headers.includes('_1')
  1024. console.log("5" + isHas_5)
  1025. var isHas_6 = headers.includes('周二' + "(" + this.days[1] + ")")
  1026. console.log("6" + isHas_6)
  1027. var isHas_7 = headers.includes('_2')
  1028. console.log("7" + isHas_7)
  1029. var isHas_8 = headers.includes('_3')
  1030. console.log("8" + isHas_8)
  1031. var isHas_9 = headers.includes('周三' + "(" + this.days[2] + ")")
  1032. console.log("9" + isHas_9)
  1033. var isHas_10 = headers.includes('_4')
  1034. console.log("10" + isHas_10)
  1035. var isHas_11 = headers.includes('_5')
  1036. console.log("11" + isHas_11)
  1037. var isHas_12 = headers.includes('周四' + "(" + this.days[3] + ")")
  1038. console.log("12" + isHas_12)
  1039. var isHas_13 = headers.includes('_6')
  1040. console.log("13" + isHas_13)
  1041. var isHas_14 = headers.includes('_7')
  1042. console.log("14" + isHas_14)
  1043. var isHas_15 = headers.includes('周五' + "(" + this.days[4] + ")")
  1044. console.log("15" + isHas_15)
  1045. var isHas_16 = headers.includes('_8')
  1046. console.log("16" + isHas_16)
  1047. var isHas_17 = headers.includes('_9')
  1048. console.log("17" + isHas_17)
  1049. var isHas_18 = headers.includes('周六' + "(" + this.days[5] + ")")
  1050. console.log("18" + isHas_18)
  1051. var isHas_19 = headers.includes('_10')
  1052. console.log("19" + isHas_19)
  1053. var isHas_20 = headers.includes('_11')
  1054. console.log("20" + isHas_20)
  1055. var isHas_21 = headers.includes('周日' + "(" + this.days[6] + ")")
  1056. console.log("21" + isHas_21)
  1057. var isHas_22 = headers.includes('_12')
  1058. console.log("22" + isHas_22)
  1059. var isHas_23 = headers.includes('_13')
  1060. console.log("23" + isHas_23)
  1061. if (!(isHas_1 && isHas_2 && isHas_3 && isHas_4 && isHas_5 &&
  1062. isHas_6 && isHas_7 && isHas_8 && isHas_9 && isHas_10 &&
  1063. isHas_11 && isHas_12 && isHas_13 && isHas_14 && isHas_15 &&
  1064. isHas_16 && isHas_17 && isHas_18 && isHas_19 && isHas_20 &&
  1065. isHas_21)) {
  1066. this.dialogVisible = true
  1067. return
  1068. }
  1069. } else {
  1070. this.dialogVisible = true
  1071. return
  1072. }
  1073. let is_system_zone = true
  1074. let is_device_number = true
  1075. let zones = []
  1076. let deviceNumber = []
  1077. for (let i = 0; i < results.length; i++) {
  1078. if (results[i + 1] && results[i + 1]['区号'] != undefined) {
  1079. zones.push(results[i + 1]['区号'])
  1080. }
  1081. if (results[i + 1] && results[i + 1]['机号'] != undefined) {
  1082. deviceNumber.push(results[i + 1]['机号'])
  1083. }
  1084. }
  1085. const obj = {}
  1086. zones = zones.reduce((cur, next) => {
  1087. obj[next] ? '' : obj[next] = true && cur.push(next)
  1088. return cur
  1089. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1090. const obj2 = {}
  1091. deviceNumber = deviceNumber.reduce((cur, next) => {
  1092. obj2[next] ? '' : obj2[next] = true && cur.push(next)
  1093. return cur
  1094. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1095. var total_zones = []
  1096. var total_device_number = []
  1097. for (let key in this.partitions) {
  1098. total_zones.push(this.partitions[key].name)
  1099. }
  1100. for (let key in this.partitions) {
  1101. var jihaos = this.partitions[key].jihaos
  1102. for (let i = 0; i < jihaos.length; i++) {
  1103. total_device_number.push(jihaos[i].number)
  1104. }
  1105. }
  1106. for (let i = 0; i < zones.length; i++) {
  1107. if (!total_zones.includes(zones[i])) {
  1108. is_system_zone = false
  1109. }
  1110. }
  1111. for (let i = 0; i < deviceNumber.length; i++) {
  1112. if (!total_device_number.includes(deviceNumber[i])) {
  1113. is_device_number = false
  1114. }
  1115. }
  1116. let tempObj = null
  1117. if (results.length > 0) {
  1118. tempObj = results[0]
  1119. }
  1120. let datas = []
  1121. let failed_datas = []
  1122. console.log("结果22222222222", results)
  1123. for (let i = 0; i < results.length; i++) {
  1124. for (let key in results[i + 1]) {
  1125. let tempObjTwo = {partition_name: '', device_number_name: ''}
  1126. if (key != '区号' && key != '机号' && results[i + 1][key] != "") {
  1127. let obj = {}
  1128. obj['name'] = results[i + 1][key].replace(/\s/g, '')
  1129. if (tempObj[key] == '上午') {
  1130. obj['schedule_type'] = 1
  1131. } else if (tempObj[key] == '下午') {
  1132. obj['schedule_type'] = 2
  1133. } else if (tempObj[key] == '晚上') {
  1134. obj['schedule_type'] = 3
  1135. } else {
  1136. obj['schedule_type'] = 0
  1137. }
  1138. obj['schedule_week'] = this.getWeekByResultsStr(key)
  1139. obj['schedule_date'] = this.getDateByResultsStr(key)
  1140. obj['row'] = this.getRow(key)
  1141. tempObjTwo = obj
  1142. }
  1143. tempObjTwo['partition_name'] = results[i + 1]['区号']
  1144. tempObjTwo['device_number_name'] = results[i + 1]['机号']
  1145. tempObjTwo['index'] = i + 3
  1146. if (tempObjTwo['schedule_week'] != undefined && tempObjTwo['name'] != undefined && tempObjTwo['schedule_type'] != undefined && tempObjTwo['schedule_date'] != undefined) {
  1147. var current_date = new Date()
  1148. var m_year = current_date.getFullYear()
  1149. var m_month = current_date.getMonth() + 1
  1150. m_month = m_month < 10 ? '0' + m_month.toString() : m_month.toString()
  1151. var m_date = current_date.getDate() < 10 ? '0' + current_date.getDate().toString() : current_date.getDate().toString()
  1152. var current_date_two = new Date(m_year + '-' + m_month + '-' + m_date)
  1153. if (new Date(tempObjTwo['schedule_date']).getTime() > new Date(current_date_two).getTime()) {
  1154. datas.push(tempObjTwo)
  1155. } else {
  1156. failed_datas.push(tempObjTwo)
  1157. }
  1158. }
  1159. }
  1160. }
  1161. console.log("datas", datas)
  1162. let date_arr = []
  1163. //校验文档是否规范
  1164. for (let i = 0; i < datas.length; i++) {
  1165. if (datas[i].schedule_date !== '0') {
  1166. date_arr.push(datas[i].schedule_date)
  1167. }
  1168. if (datas[i].device_number_name == undefined) {
  1169. console.log("err1" + datas[i].device_number_name)
  1170. is_device_number = false
  1171. }
  1172. if (datas[i].partition_name == undefined) {
  1173. console.log("err2" + datas[i].partition_name)
  1174. is_system_zone = false
  1175. }
  1176. if (datas[i].schedule_date === '0') {
  1177. console.log("err23" + datas[i].schedule_date)
  1178. is_system_zone = false
  1179. }
  1180. if (datas[i].schedule_week === '0') {
  1181. console.log("err234" + datas[i].schedule_week)
  1182. is_system_zone = false
  1183. }
  1184. if (datas[i].schedule_type === 0) {
  1185. console.log("err2345" + datas[i].schedule_type)
  1186. is_system_zone = false
  1187. }
  1188. }
  1189. console.log("date_arr", date_arr)
  1190. //校验文档中同一天同个人是否存在多个排班
  1191. let is_exist_repeat = false
  1192. const obj3 = {}
  1193. date_arr = date_arr.reduce((cur, next) => {
  1194. obj3[next] ? '' : obj3[next] = true && cur.push(next)
  1195. return cur
  1196. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1197. let tempObjArr = []
  1198. for (let i = 0; i < date_arr.length; i++) {
  1199. let obj = {}
  1200. let key = date_arr[i]
  1201. let value = []
  1202. for (let b = 0; b < datas.length; b++) {
  1203. if (key == datas[b].schedule_date) {
  1204. value.push(datas[b].name)
  1205. }
  1206. }
  1207. obj[key] = value
  1208. tempObjArr.push(obj)
  1209. }
  1210. for (let i = 0; i < tempObjArr.length; i++) {
  1211. for (let key in tempObjArr[i]) {
  1212. let arr = tempObjArr[i][key]
  1213. const obj = {}
  1214. arr = arr.reduce((cur, next) => {
  1215. obj[next] ? '' : obj[next] = true && cur.push(next)
  1216. return cur
  1217. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1218. if (tempObjArr[i][key].length > arr.length) { //比对原数组和去重后的原数组总数,不同的话则存在重复元素
  1219. is_exist_repeat = true
  1220. }
  1221. }
  1222. }
  1223. if (headers.length > 65 || !is_system_zone || !is_device_number) {
  1224. this.dialogVisible = true
  1225. return
  1226. } else {
  1227. if (is_exist_repeat) {
  1228. this.isExistRepeatVisible = true
  1229. return
  1230. } else {
  1231. this.exportVisible = true
  1232. this.$alert('您提交的排班信息已上传成功,系统正在执行导入,请稍候点击当前页面右上角“下载日志”查看导入结果', '上传成功', {
  1233. confirmButtonText: '确定',
  1234. callback: action => {
  1235. }
  1236. });
  1237. console.log("data232332233223", datas)
  1238. console.log("failed_datas33332332", failed_datas)
  1239. var newSchedule = datas.sort((a, b) => {
  1240. return a.schedule_date - b.schedule_date
  1241. })
  1242. var start_time = ""
  1243. var type = 0
  1244. if (failed_datas.length > 0) {
  1245. var oldSchedule = failed_datas.sort((a, b) => {
  1246. return a.schedule_date - b.schedule_date
  1247. })
  1248. start_time = oldSchedule[0].schedule_date
  1249. type = 0
  1250. }
  1251. if (failed_datas.length == 0) {
  1252. start_time = newSchedule[0].schedule_date
  1253. type = 1
  1254. }
  1255. console.log("newSchedule2323223", newSchedule)
  1256. console.log("oldSchedule344433434", oldSchedule)
  1257. var length = newSchedule.length - 1
  1258. let params = {
  1259. schedule: datas,
  1260. failed_schedule: failed_datas,
  1261. start_time: start_time,
  1262. end_time: newSchedule[length].schedule_date,
  1263. delete_type: type,
  1264. }
  1265. console.log("param2323233223", params)
  1266. //今天的时间
  1267. var day2 = new Date()
  1268. day2.setTime(day2.getTime())
  1269. var month = day2.getMonth() + 1 < 10 ? '0' + (day2.getMonth() + 1).toString() : (day2.getMonth() + 1).toString()
  1270. var day = day2.getDate() < 10 ? '0' + (day2.getDate()).toString() : (day2.getMonth() + 1).toString()
  1271. var date = day2.getFullYear() + '-' + month + '-' + day
  1272. exportSchedule(params, date).then(response => {
  1273. if (response.data.state == 0) {
  1274. return false
  1275. }
  1276. this.getWeekPanels()
  1277. })
  1278. }
  1279. }
  1280. },
  1281. sortData(a, b) {
  1282. return a.schedule_date - b.schedule_date
  1283. },
  1284. getInitDate() {
  1285. initDate().then(response => {
  1286. if (response.data.state == 0) {
  1287. return false
  1288. }
  1289. this.days = response.data.data.days
  1290. console.log("日期22222222", this.days)
  1291. })
  1292. },
  1293. getWeekByResultsStr(key) {
  1294. switch (key) {
  1295. case '周一' + "(" + this.days[0] + ")":
  1296. return '1'
  1297. break
  1298. case '周一' + "(" + this.days[7] + ")":
  1299. return '1'
  1300. break
  1301. case '周一' + "(" + this.days[14] + ")":
  1302. return '1'
  1303. break
  1304. case '':
  1305. return '1'
  1306. break
  1307. case '_1':
  1308. return '1'
  1309. break
  1310. case '_14':
  1311. return '1'
  1312. break
  1313. case '_15':
  1314. return '1'
  1315. break
  1316. case '_28':
  1317. return '1'
  1318. break
  1319. case '_29':
  1320. return '1'
  1321. break
  1322. case '周二' + "(" + this.days[1] + ")" :
  1323. return '2'
  1324. break
  1325. case '周二' + "(" + this.days[8] + ")":
  1326. return '2'
  1327. break
  1328. case '周二' + "(" + this.days[15] + ")" :
  1329. return '2'
  1330. break
  1331. case '_2':
  1332. return '2'
  1333. break
  1334. case '_3':
  1335. return '2'
  1336. break
  1337. case '_16' :
  1338. return '2'
  1339. break
  1340. case '_17' :
  1341. return '2'
  1342. break
  1343. case '_30':
  1344. return '2'
  1345. break
  1346. case '_31':
  1347. return '2'
  1348. break
  1349. case '周三' + "(" + this.days[2] + ")":
  1350. return '3'
  1351. break
  1352. case '周三' + "(" + this.days[9] + ")":
  1353. return '3'
  1354. break
  1355. case '周三' + "(" + this.days[16] + ")":
  1356. return '3'
  1357. break
  1358. case '_4' :
  1359. return '3'
  1360. break
  1361. case '_5' :
  1362. return '3'
  1363. break
  1364. case '_18' :
  1365. return '3'
  1366. break
  1367. case '_19' :
  1368. return '3'
  1369. break
  1370. case '_32' :
  1371. return '3'
  1372. break
  1373. case '_33' :
  1374. return '3'
  1375. break
  1376. case '周四' + "(" + this.days[3] + ")":
  1377. return '4'
  1378. break
  1379. case '周四' + "(" + this.days[10] + ")" :
  1380. return '4'
  1381. break
  1382. case'周四' + "(" + this.days[17] + ")" :
  1383. return '4'
  1384. break
  1385. case '_6' :
  1386. return '4'
  1387. break
  1388. case '_7':
  1389. return '4'
  1390. break
  1391. case '_20':
  1392. return '4'
  1393. break
  1394. case '_21':
  1395. return '4'
  1396. break
  1397. case '_34':
  1398. return '4'
  1399. break
  1400. case '_35':
  1401. return '4'
  1402. break
  1403. case '周五' + "(" + this.days[4] + ")" :
  1404. return '5'
  1405. break
  1406. case '周五' + "(" + this.days[11] + ")":
  1407. return '5'
  1408. break
  1409. case '周五' + "(" + this.days[18] + ")" :
  1410. return '5'
  1411. break
  1412. case '_8':
  1413. return '5'
  1414. break
  1415. case '_9' :
  1416. return '5'
  1417. break
  1418. case '_22' :
  1419. return '5'
  1420. break
  1421. case '_23':
  1422. return '5'
  1423. break
  1424. case '_36':
  1425. return '5'
  1426. break
  1427. case '_37':
  1428. return '5'
  1429. break
  1430. case '周六' + "(" + this.days[5] + ")":
  1431. return '6'
  1432. break
  1433. case '周六' + "(" + this.days[12] + ")":
  1434. return '6'
  1435. break
  1436. case '周六' + "(" + this.days[19] + ")":
  1437. return '6'
  1438. break
  1439. case '_10' :
  1440. return '6'
  1441. break
  1442. case '_11':
  1443. return '6'
  1444. break
  1445. case '_24' :
  1446. return '6'
  1447. break
  1448. case '_25' :
  1449. return '6'
  1450. break
  1451. case '_38' :
  1452. return '6'
  1453. break
  1454. case '_39':
  1455. return '6'
  1456. break
  1457. case '周日' + "(" + this.days[6] + ")":
  1458. return '7'
  1459. break
  1460. case '周日' + "(" + this.days[13] + ")":
  1461. return '7'
  1462. break
  1463. case '周日' + "(" + this.days[20] + ")":
  1464. return '7'
  1465. break
  1466. case '_12' :
  1467. return '7'
  1468. break
  1469. case '_13' :
  1470. return '7'
  1471. break
  1472. case '_26':
  1473. return '7'
  1474. break
  1475. case '_27':
  1476. return '7'
  1477. break
  1478. case '_40' :
  1479. return '7'
  1480. break
  1481. case '_41':
  1482. return '7'
  1483. break
  1484. default:
  1485. return '0'
  1486. break
  1487. }
  1488. },
  1489. getRow(key) {
  1490. switch (key) {
  1491. case '周一' + "(" + this.days[0] + ")" : //本周一
  1492. return 'C'
  1493. break
  1494. case '': //本周一
  1495. return 'D'
  1496. break
  1497. case '_1': //本周一
  1498. return 'E'
  1499. break
  1500. case '周一' + "(" + this.days[7] + ")": //下周一
  1501. return 'X'
  1502. break
  1503. case '_14': //下周一
  1504. return 'Y'
  1505. break
  1506. case '_15': //下周一
  1507. return 'Z'
  1508. break
  1509. case '周一' + "(" + this.days[14] + ")" : //下下周一
  1510. return 'AS'
  1511. break
  1512. case '_28': //下下周一
  1513. return 'AT'
  1514. break
  1515. case '_29': //下下周一
  1516. return 'AU'
  1517. break
  1518. case '周二' + "(" + this.days[1] + ")" : //本周二
  1519. return 'F'
  1520. break
  1521. case '_2': //本周二
  1522. return 'G'
  1523. break
  1524. case '_3': //本周二
  1525. return 'H'
  1526. break
  1527. case '周二' + "(" + this.days[8] + ")"://下周二
  1528. return 'AA'
  1529. break
  1530. case '_16' ://下周二
  1531. return 'AB'
  1532. break
  1533. case '_17'://下周二
  1534. return 'AC'
  1535. break
  1536. case '周二' + "(" + this.days[15] + ")"://下下周二
  1537. return 'AV'
  1538. break
  1539. case '_30' ://下下周二
  1540. return 'AW'
  1541. break
  1542. case '_31'://下下周二
  1543. return 'AX'
  1544. break
  1545. case '周三' + "(" + this.days[2] + ")": //本周三
  1546. return 'I'
  1547. break
  1548. case '_4': //本周三
  1549. return 'J'
  1550. break
  1551. case '_5': //本周三
  1552. return 'K'
  1553. break
  1554. case '周三' + "(" + this.days[9] + ")": //下周三
  1555. return 'AD'
  1556. break
  1557. case '_18' : //下周三
  1558. return 'AE'
  1559. break
  1560. case '_19': //下周三
  1561. return 'AF'
  1562. break
  1563. case '周三' + "(" + this.days[16] + ")" : //下下周三
  1564. return 'AY'
  1565. break
  1566. case '_32' : //下下周三
  1567. return 'AZ'
  1568. break
  1569. case '_33': //下下周三
  1570. return 'BA'
  1571. break
  1572. case '周四' + "(" + this.days[3] + ")":
  1573. return 'L'
  1574. break
  1575. case '_6' :
  1576. return 'M'
  1577. break
  1578. case '_7':
  1579. return 'N'
  1580. break
  1581. case '周四' + "(" + this.days[10] + ")":
  1582. return 'AG'
  1583. break
  1584. case '_20' :
  1585. return 'AH'
  1586. break
  1587. case '_21':
  1588. return 'AI'
  1589. break
  1590. case '周四' + "(" + this.days[17] + ")":
  1591. return 'BB'
  1592. break
  1593. case '_34':
  1594. return 'BC'
  1595. break
  1596. case '_35':
  1597. return 'BD'
  1598. break
  1599. case '周五' + "(" + this.days[4] + ")":
  1600. return 'O'
  1601. break
  1602. case '_8':
  1603. return 'P'
  1604. break
  1605. case '_9':
  1606. return 'Q'
  1607. break
  1608. case '周五' + "(" + this.days[11] + ")":
  1609. return 'AJ'
  1610. break
  1611. case '_22' :
  1612. return 'AK'
  1613. break
  1614. case '_23':
  1615. return 'AL'
  1616. break
  1617. case '周五' + "(" + this.days[18] + ")":
  1618. return 'BE'
  1619. break
  1620. case '_36':
  1621. return 'BF'
  1622. break
  1623. case '_37':
  1624. return 'BG'
  1625. break
  1626. case '周六' + "(" + this.days[5] + ")" :
  1627. return 'R'
  1628. break
  1629. case '_10' :
  1630. return 'S'
  1631. break
  1632. case '_11':
  1633. return 'T'
  1634. break
  1635. case '周六' + "(" + this.days[12] + ")":
  1636. return 'AM'
  1637. break
  1638. case '_24' :
  1639. return 'AN'
  1640. break
  1641. case '_25':
  1642. return 'AO'
  1643. break
  1644. case '周六' + "(" + this.days[19] + ")":
  1645. return 'BH'
  1646. break
  1647. case '_38' :
  1648. return 'BI'
  1649. break
  1650. case '_39':
  1651. return 'BJ'
  1652. break
  1653. case '周日' + "(" + this.days[6] + ")" :
  1654. return 'U'
  1655. break
  1656. case '_12' :
  1657. return 'V'
  1658. break
  1659. case '_13':
  1660. return 'W'
  1661. break
  1662. case '周日' + "(" + this.days[13] + ")":
  1663. return 'AP'
  1664. break
  1665. case '_26' :
  1666. return 'AQ'
  1667. break
  1668. case '_27':
  1669. return 'AR'
  1670. break
  1671. case '周日' + "(" + this.days[20] + ")":
  1672. return 'BK'
  1673. break
  1674. case '_40':
  1675. return 'BL'
  1676. break
  1677. case '_41':
  1678. return 'BM'
  1679. break
  1680. }
  1681. },
  1682. getDateByResultsStr(key) {
  1683. switch (key) {
  1684. case '周一' + "(" + this.days[0] + ")" : //本周一
  1685. return this.days[0]
  1686. break
  1687. case '': //本周一
  1688. return this.days[0]
  1689. break
  1690. case '_1': //本周一
  1691. return this.days[0]
  1692. break
  1693. case '周一' + "(" + this.days[7] + ")": //下周一
  1694. return this.days[7]
  1695. break
  1696. case '_14': //下周一
  1697. return this.days[7]
  1698. break
  1699. case '_15': //下周一
  1700. return this.days[7]
  1701. break
  1702. case '周一' + "(" + this.days[14] + ")": //下下周一
  1703. return this.days[14]
  1704. break
  1705. case '_28': //下下周一
  1706. return this.days[14]
  1707. break
  1708. case '_29': //下下周一
  1709. return this.days[14]
  1710. break
  1711. case '周二' + "(" + this.days[1] + ")": //本周二
  1712. return this.days[1]
  1713. break
  1714. case '_2': //本周二
  1715. return this.days[1]
  1716. break
  1717. case '_3': //本周二
  1718. return this.days[1]
  1719. break
  1720. case '周二' + "(" + this.days[8] + ")"://下周二
  1721. return this.days[8]
  1722. break
  1723. case '_16' ://下周二
  1724. return this.days[8]
  1725. break
  1726. case '_17'://下周二
  1727. return this.days[8]
  1728. break
  1729. case '周二' + "(" + this.days[15] + ")"://下下周二
  1730. return this.days[15]
  1731. break
  1732. case '_30' ://下下周二
  1733. return this.days[15]
  1734. break
  1735. case '_31'://下下周二
  1736. return this.days[15]
  1737. break
  1738. case '周三' + "(" + this.days[2] + ")" : //本周三
  1739. return this.days[2]
  1740. break
  1741. case '_4': //本周三
  1742. return this.days[2]
  1743. break
  1744. case '_5': //本周三
  1745. return this.days[2]
  1746. break
  1747. case '周三' + "(" + this.days[9] + ")": //下周三
  1748. return this.days[9]
  1749. break
  1750. case '_18' : //下周三
  1751. return this.days[9]
  1752. break
  1753. case '_19': //下周三
  1754. return this.days[9]
  1755. break
  1756. case '周三' + "(" + this.days[16] + ")": //下下周三
  1757. return this.days[16]
  1758. break
  1759. case '_32' : //下下周三
  1760. return this.days[16]
  1761. break
  1762. case '_33': //下下周三
  1763. return this.days[16]
  1764. break
  1765. case '周四' + "(" + this.days[3] + ")":
  1766. return this.days[3]
  1767. break
  1768. case '_6' :
  1769. return this.days[3]
  1770. break
  1771. case '_7':
  1772. return this.days[3]
  1773. break
  1774. case '周四' + "(" + this.days[10] + ")":
  1775. return this.days[10]
  1776. break
  1777. case '_20' :
  1778. return this.days[10]
  1779. break
  1780. case '_21':
  1781. return this.days[10]
  1782. break
  1783. case '周四' + "(" + this.days[17] + ")":
  1784. return this.days[17]
  1785. break
  1786. case '_34':
  1787. return this.days[17]
  1788. break
  1789. case '_35':
  1790. return this.days[17]
  1791. break
  1792. case '周五' + "(" + this.days[4] + ")":
  1793. return this.days[4]
  1794. break
  1795. case '_8':
  1796. return this.days[4]
  1797. break
  1798. case '_9':
  1799. return this.days[4]
  1800. break
  1801. case '周五' + "(" + this.days[11] + ")" :
  1802. return this.days[11]
  1803. break
  1804. case '_22' :
  1805. return this.days[11]
  1806. break
  1807. case '_23':
  1808. return this.days[11]
  1809. break
  1810. case '周五' + "(" + this.days[18] + ")":
  1811. return this.days[18]
  1812. break
  1813. case '_36':
  1814. return this.days[18]
  1815. break
  1816. case '_37':
  1817. return this.days[18]
  1818. break
  1819. case '周六' + "(" + this.days[5] + ")":
  1820. return this.days[5]
  1821. break
  1822. case '_10' :
  1823. return this.days[5]
  1824. break
  1825. case '_11':
  1826. return this.days[5]
  1827. break
  1828. case '周六' + "(" + this.days[12] + ")":
  1829. return this.days[12]
  1830. break
  1831. case '_24' :
  1832. return this.days[12]
  1833. break
  1834. case '_25':
  1835. return this.days[12]
  1836. break
  1837. case '周六' + "(" + this.days[19] + ")":
  1838. return this.days[19]
  1839. break
  1840. case '_38' :
  1841. return this.days[19]
  1842. break
  1843. case '_39':
  1844. return this.days[19]
  1845. break
  1846. case '周日' + "(" + this.days[6] + ")" :
  1847. return this.days[6]
  1848. break
  1849. case '_12' :
  1850. return this.days[6]
  1851. break
  1852. case '_13':
  1853. return this.days[6]
  1854. break
  1855. case '周日' + "(" + this.days[13] + ")":
  1856. return this.days[13]
  1857. break
  1858. case '_26' :
  1859. return this.days[13]
  1860. break
  1861. case '_27':
  1862. return this.days[13]
  1863. break
  1864. case '周日' + "(" + this.days[20] + ")":
  1865. return this.days[20]
  1866. break
  1867. case '_40':
  1868. return this.days[20]
  1869. break
  1870. case '_41':
  1871. return this.days[20]
  1872. break
  1873. default:
  1874. return '0'
  1875. break
  1876. }
  1877. },
  1878. getNextWeek(i) {
  1879. let weekOfDay = parseInt(moment().format('E'));//计算今天是这周第几天
  1880. let next_monday = moment().add((7 - weekOfDay) + 7 * (i - 1) + 1, 'days').format('YYYY-MM-DD');//周一日期
  1881. let next_sunday = moment().add((7 - weekOfDay) + 7 * i, 'days').format('YYYY-MM-DD');//周日日期
  1882. return next_sunday
  1883. },
  1884. getNextWeekOne(i) {
  1885. let weekOfDay = parseInt(moment().format('E'));//计算今天是这周第几天
  1886. let next_monday = moment().add((7 - weekOfDay) + 7 * (i - 1) + 1, 'days').format('YYYY-MM-DD');//周一日期
  1887. return next_monday
  1888. },
  1889. //
  1890. getThreeWeekList() {
  1891. var params = {
  1892. start_time: this.start_time,
  1893. end_time: this.end_time,
  1894. partition_id: this.partition_id,
  1895. schedule_type: this.schedule_type
  1896. }
  1897. console.log("params32323232323223", params)
  1898. getThreeWeekList(params).then(response => {
  1899. if (response.data.state == 1) {
  1900. var partitions = response.data.data.partitions
  1901. const merges = ['A1:A2', 'B1:B2', 'C1:E1', 'F1:H1', 'I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1', 'U1:W1', 'X1:Z1', 'AA1:AC1', 'AD1:AF1', 'AG1:AI1', 'AJ1:AL1', 'AM1:AO1', 'AP1:AR1', 'AS1:AU1', 'AV1:AX1', 'AY1:BA1', 'BB1:BD1', 'BE1:BG1', 'BH1:BJ1', 'BK1:BM1']
  1902. var list = []
  1903. let i = 0
  1904. for (let key in partitions) {
  1905. var tempValue
  1906. var jihaos = partitions[key].jihaos
  1907. if (i == 0) {
  1908. let m = 'A3' + ':' + 'A' + (2 + jihaos.length)
  1909. tempValue = (2 + jihaos.length)
  1910. merges.push(m)
  1911. } else {
  1912. let m = 'A' + (tempValue + 1) + ':' + 'A' + ((tempValue + 1) + jihaos.length - 1)
  1913. tempValue = ((tempValue + 1) + jihaos.length - 1)
  1914. merges.push(m)
  1915. }
  1916. console.log("jihaos", jihaos)
  1917. for (let b = 0; b < jihaos.length; b++) {
  1918. var obj = {}
  1919. obj['区号'] = partitions[key].name
  1920. obj['机号'] = jihaos[b].number.toString()
  1921. if (this.export_type == 0) {
  1922. obj['shangwu'] = ''
  1923. obj['xiawu'] = ''
  1924. obj['wanshang'] = ''
  1925. obj['shangwu1'] = ''
  1926. obj['xiawu1'] = ''
  1927. obj['wanshang1'] = ''
  1928. obj['shangwu2'] = ''
  1929. obj['xiawu2'] = ''
  1930. obj['wanshang2'] = ''
  1931. obj['shangwu3'] = ''
  1932. obj['xiawu3'] = ''
  1933. obj['wanshang3'] = ''
  1934. obj['shangwu4'] = ''
  1935. obj['xiawu4'] = ''
  1936. obj['wanshang4'] = ''
  1937. obj['shangwu5'] = ''
  1938. obj['xiawu5'] = ''
  1939. obj['wanshang5'] = ''
  1940. obj['shangwu6'] = ''
  1941. obj['xiawu6'] = ''
  1942. obj['wanshang6'] = ''
  1943. obj['shangwu7'] = ''
  1944. obj['xiawu7'] = ''
  1945. obj['wanshang7'] = ''
  1946. obj['shangwu8'] = ''
  1947. obj['xiawu8'] = ''
  1948. obj['wanshang8'] = ''
  1949. obj['shangwu9'] = ''
  1950. obj['xiawu9'] = ''
  1951. obj['wanshang9'] = ''
  1952. obj['shangwu10'] = ''
  1953. obj['xiawu10'] = ''
  1954. obj['wanshang10'] = ''
  1955. obj['shangwu11'] = ''
  1956. obj['xiawu11'] = ''
  1957. obj['wanshang11'] = ''
  1958. obj['shangwu12'] = ''
  1959. obj['xiawu12'] = ''
  1960. obj['wanshang12'] = ''
  1961. obj['shangwu13'] = ''
  1962. obj['xiawu13'] = ''
  1963. obj['wanshang13'] = ''
  1964. obj['shangwu14'] = ''
  1965. obj['xiawu14'] = ''
  1966. obj['wanshang14'] = ''
  1967. obj['shangwu15'] = ''
  1968. obj['xiawu15'] = ''
  1969. obj['wanshang15'] = ''
  1970. obj['shangwu16'] = ''
  1971. obj['xiawu16'] = ''
  1972. obj['wanshang16'] = ''
  1973. obj['shangwu17'] = ''
  1974. obj['xiawu17'] = ''
  1975. obj['wanshang17'] = ''
  1976. obj['shangwu18'] = ''
  1977. obj['xiawu18'] = ''
  1978. obj['wanshang18'] = ''
  1979. obj['shangwu19'] = ''
  1980. obj['xiawu19'] = ''
  1981. obj['wanshang19'] = ''
  1982. obj['shangwu20'] = ''
  1983. obj['xiawu20'] = ''
  1984. obj['wanshang20'] = ''
  1985. }
  1986. if (this.export_type == 1) {
  1987. obj['shangwu'] = ''
  1988. obj['xiawu'] = ''
  1989. obj['wanshang'] = ''
  1990. obj['shangwu1'] = ''
  1991. obj['xiawu1'] = ''
  1992. obj['wanshang1'] = ''
  1993. obj['shangwu2'] = ''
  1994. obj['xiawu2'] = ''
  1995. obj['wanshang2'] = ''
  1996. obj['shangwu3'] = ''
  1997. obj['xiawu3'] = ''
  1998. obj['wanshang3'] = ''
  1999. obj['shangwu4'] = ''
  2000. obj['xiawu4'] = ''
  2001. obj['wanshang4'] = ''
  2002. obj['shangwu5'] = ''
  2003. obj['xiawu5'] = ''
  2004. obj['wanshang5'] = ''
  2005. obj['shangwu6'] = ''
  2006. obj['xiawu6'] = ''
  2007. obj['wanshang6'] = ''
  2008. }
  2009. list.push(obj)
  2010. }
  2011. i++
  2012. }
  2013. const start_time = moment().weekday(1).format('YYYY-MM-DD'); //本周一
  2014. var start = this.getTimestamp(start_time) - 28800
  2015. console.log("start", start)
  2016. const end_time = moment().weekday(7).format('YYYY-MM-DD');
  2017. var end = this.getTimestamp(end_time) - 28800
  2018. console.log("end", end)
  2019. var scheduleList = response.data.data.list
  2020. var week = []
  2021. var nextWeek = []
  2022. var lastWeek = []
  2023. var next_start = this.getNextWeekOne(1)
  2024. var nextstart = this.getTimestamp(next_start) - 28800
  2025. var next_end = this.getNextWeek(1)
  2026. var nextend = this.getTimestamp(next_end) - 28800
  2027. var last_start = this.getNextWeekOne(2)
  2028. var last_end = this.getNextWeek(2)
  2029. var laststart = this.getTimestamp(last_start) - 28800
  2030. var lastend = this.getTimestamp(last_end) - 28800
  2031. if (this.export_type == 0) {
  2032. for (let i = 0; i < scheduleList.length; i++) {
  2033. if (scheduleList[i].schedule_date >= start && scheduleList[i].schedule_date <= end) {
  2034. week.push(scheduleList[i])
  2035. }
  2036. if (scheduleList[i].schedule_date >= nextstart && scheduleList[i].schedule_date <= nextend) {
  2037. nextWeek.push(scheduleList[i])
  2038. }
  2039. if (scheduleList[i].schedule_date >= laststart && scheduleList[i].schedule_date <= lastend) {
  2040. lastWeek.push(scheduleList[i])
  2041. }
  2042. }
  2043. }
  2044. if (this.export_type == 1) {
  2045. week = scheduleList
  2046. }
  2047. console.log("list")
  2048. console.log(list)
  2049. console.log("week")
  2050. console.log(week)
  2051. if (week.length > 0) {
  2052. for (let i = 0; i < list.length; i++) {
  2053. for (let j = 0; j < week.length; j++) {
  2054. if (list[i].机号 == week[j].number && list[i].区号 == week[j].zon_name) {
  2055. // 周一上午
  2056. if (week[j].schedule_week == 1 && week[j].schedule_type == 1) {
  2057. console.log(week[j].name)
  2058. list[i].shangwu = week[j].name
  2059. }
  2060. // 周一下午
  2061. if (week[j].schedule_week == 1 && week[j].schedule_type == 2) {
  2062. list[i].xiawu = week[j].name
  2063. }
  2064. // 周一晚上
  2065. if (week[j].schedule_week == 1 && week[j].schedule_type == 3) {
  2066. list[i].wanshang = week[j].name
  2067. }
  2068. //周二上午
  2069. if (week[j].schedule_week == 2 && week[j].schedule_type == 1) {
  2070. list[i].shangwu1 = week[j].name
  2071. }
  2072. //周二下午
  2073. if (week[j].schedule_week == 2 && week[j].schedule_type == 2) {
  2074. list[i].xiawu1 = week[j].name
  2075. }
  2076. //周二晚上
  2077. if (week[j].schedule_week == 2 && week[j].schedule_type == 3) {
  2078. list[i].wanshang1 = week[j].name
  2079. }
  2080. //周三上午
  2081. if (week[j].schedule_week == 3 && week[j].schedule_type == 1) {
  2082. list[i].shangwu2 = week[j].name
  2083. }
  2084. //周三下午
  2085. if (week[j].schedule_week == 3 && week[j].schedule_type == 2) {
  2086. list[i].xiawu2 = week[j].name
  2087. }
  2088. //周三晚上
  2089. if (week[j].schedule_week == 3 && week[j].schedule_type == 3) {
  2090. list[i].wanshang2 = week[j].name
  2091. }
  2092. //周四上午
  2093. if (week[j].schedule_week == 4 && week[j].schedule_type == 1) {
  2094. list[i].shangwu3 = week[j].name
  2095. }
  2096. //周四下午
  2097. if (week[j].schedule_week == 4 && week[j].schedule_type == 2) {
  2098. list[i].xiawu3 = week[j].name
  2099. }
  2100. //周四晚上
  2101. if (week[j].schedule_week == 4 && week[j].schedule_type == 3) {
  2102. list[i].wanshang3 = week[j].name
  2103. }
  2104. //周五上午
  2105. if (week[j].schedule_week == 5 && week[j].schedule_type == 1) {
  2106. list[i].shangwu4 = week[j].name
  2107. }
  2108. //周五下午
  2109. if (week[j].schedule_week == 5 && week[j].schedule_type == 2) {
  2110. list[i].xiawu4 = week[j].name
  2111. }
  2112. //周五晚上
  2113. if (week[j].schedule_week == 5 && week[j].schedule_type == 3) {
  2114. list[i].wanshang4 = week[j].name
  2115. }
  2116. //周六上午
  2117. if (week[j].schedule_week == 6 && week[j].schedule_type == 1) {
  2118. list[i].shangwu5 = week[j].name
  2119. }
  2120. //周六下午
  2121. if (week[j].schedule_week == 6 && week[j].schedule_type == 2) {
  2122. list[i].xiawu5 = week[j].name
  2123. }
  2124. //周六晚上
  2125. if (week[j].schedule_week == 6 && week[j].schedule_type == 3) {
  2126. list[i].wanshang5 = week[j].name
  2127. }
  2128. //周日上午
  2129. if (week[j].schedule_week == 7 && week[j].schedule_type == 1) {
  2130. list[i].shangwu6 = week[j].name
  2131. }
  2132. //周日下午
  2133. if (week[j].schedule_week == 7 && week[j].schedule_type == 2) {
  2134. list[i].xiawu6 = week[j].name
  2135. }
  2136. //周日晚上
  2137. if (week[j].schedule_week == 7 && week[j].schedule_type == 3) {
  2138. list[i].wanshang6 = week[j].name
  2139. }
  2140. }
  2141. }
  2142. }
  2143. }
  2144. if (nextWeek.length > 0) {
  2145. for (let i = 0; i < list.length; i++) {
  2146. for (let j = 0; j < nextWeek.length; j++) {
  2147. if (list[i].机号 == nextWeek[j].number && list[i].区号 == nextWeek[j].zon_name) {
  2148. //周一
  2149. if (nextWeek[j].schedule_week == 1 && nextWeek[j].schedule_type == 1) {
  2150. list[i].shangwu7 = nextWeek[j].name
  2151. }
  2152. //周一下午
  2153. if (nextWeek[j].schedule_week == 1 && nextWeek[j].schedule_type == 2) {
  2154. list[i].xiawu7 = nextWeek[j].name
  2155. }
  2156. //周一晚上
  2157. if (nextWeek[j].schedule_week == 1 && nextWeek[j].schedule_type == 3) {
  2158. list[i].wanshang7 = nextWeek[j].name
  2159. }
  2160. //周二上午
  2161. if (nextWeek[j].schedule_week == 2 && nextWeek[j].schedule_type == 1) {
  2162. list[i].shangwu8 = nextWeek[j].name
  2163. }
  2164. //周二下午
  2165. if (nextWeek[j].schedule_week == 2 && nextWeek[j].schedule_type == 2) {
  2166. list[i].xiawu8 = nextWeek[j].name
  2167. }
  2168. //周二晚上
  2169. if (nextWeek[j].schedule_week == 2 && nextWeek[j].schedule_type == 3) {
  2170. list[i].wanshang8 = nextWeek[j].name
  2171. }
  2172. //周三上午
  2173. if (nextWeek[j].schedule_week == 3 && nextWeek[j].schedule_type == 1) {
  2174. list[i].shangwu9 = nextWeek[j].name
  2175. }
  2176. //周三下午
  2177. if (nextWeek[j].schedule_week == 3 && nextWeek[j].schedule_type == 2) {
  2178. list[i].xiawu9 = nextWeek[j].name
  2179. }
  2180. //周三晚上
  2181. if (nextWeek[j].schedule_week == 3 && nextWeek[j].schedule_type == 3) {
  2182. list[i].wanshang9 = nextWeek[j].name
  2183. }
  2184. //周四上午
  2185. if (nextWeek[j].schedule_week == 4 && nextWeek[j].schedule_type == 1) {
  2186. list[i].shangwu10 = nextWeek[j].name
  2187. }
  2188. //周四下午
  2189. if (nextWeek[j].schedule_week == 4 && nextWeek[j].schedule_type == 2) {
  2190. list[i].xiawu10 = nextWeek[j].name
  2191. }
  2192. //周四晚上
  2193. if (nextWeek[j].schedule_week == 4 && nextWeek[j].schedule_type == 3) {
  2194. list[i].wanshang10 = nextWeek[j].name
  2195. }
  2196. //周五上午
  2197. if (nextWeek[j].schedule_week == 5 && nextWeek[j].schedule_type == 1) {
  2198. list[i].shangwu11 = nextWeek[j].name
  2199. }
  2200. //周五下午
  2201. if (nextWeek[j].schedule_week == 5 && nextWeek[j].schedule_type == 2) {
  2202. list[i].xiawu11 = nextWeek[j].name
  2203. }
  2204. //周五晚上
  2205. if (nextWeek[j].schedule_week == 5 && nextWeek[j].schedule_type == 3) {
  2206. list[i].wanshang11 = nextWeek[j].name
  2207. }
  2208. //周六上午
  2209. if (nextWeek[j].schedule_week == 6 && nextWeek[j].schedule_type == 1) {
  2210. list[i].shangwu12 = nextWeek[j].name
  2211. }
  2212. //周六下午
  2213. if (nextWeek[j].schedule_week == 6 && nextWeek[j].schedule_type == 2) {
  2214. list[i].xiawu12 = nextWeek[j].name
  2215. }
  2216. //周六晚上
  2217. if (nextWeek[j].schedule_week == 6 && nextWeek[j].schedule_type == 3) {
  2218. list[i].wanshang12 = nextWeek[j].name
  2219. }
  2220. //周日上午
  2221. if (nextWeek[j].schedule_week == 7 && nextWeek[j].schedule_type == 1) {
  2222. list[i].shangwu13 = nextWeek[j].name
  2223. }
  2224. //周日下午
  2225. if (nextWeek[j].schedule_week == 7 && nextWeek[j].schedule_type == 2) {
  2226. list[i].xiawu13 = nextWeek[j].name
  2227. }
  2228. //周日晚上
  2229. if (nextWeek[j].schedule_week == 7 && nextWeek[j].schedule_type == 3) {
  2230. list[i].wanshang13 = nextWeek[j].name
  2231. }
  2232. }
  2233. }
  2234. }
  2235. }
  2236. //
  2237. if (lastWeek.length > 0) {
  2238. for (let i = 0; i < list.length; i++) {
  2239. for (let j = 0; j < lastWeek.length; j++) {
  2240. if (list[i].机号 == lastWeek[j].number && list[i].区号 == lastWeek[j].zon_name) {
  2241. //周一
  2242. if (lastWeek[j].schedule_week == 1 && lastWeek[j].schedule_type == 1) {
  2243. list[i].shangwu14 = lastWeek[j].name
  2244. }
  2245. //周一下午
  2246. if (lastWeek[j].schedule_week == 1 && lastWeek[j].schedule_type == 2) {
  2247. list[i].xiawu14 = lastWeek[j].name
  2248. }
  2249. //周一晚上
  2250. if (lastWeek[j].schedule_week == 1 && lastWeek[j].schedule_type == 3) {
  2251. list[i].wanshang14 = lastWeek[j].name
  2252. }
  2253. //周二
  2254. if (lastWeek[j].schedule_week == 2 && lastWeek[j].schedule_type == 1) {
  2255. list[i].shangwu15 = lastWeek[j].name
  2256. }
  2257. //周二下午
  2258. if (lastWeek[j].schedule_week == 2 && lastWeek[j].schedule_type == 2) {
  2259. list[i].xiawu15 = lastWeek[j].name
  2260. }
  2261. //周二晚上
  2262. if (lastWeek[j].schedule_week == 2 && lastWeek[j].schedule_type == 3) {
  2263. list[i].wanshang15 = lastWeek[j].name
  2264. }
  2265. //周三
  2266. if (lastWeek[j].schedule_week == 3 && lastWeek[j].schedule_type == 1) {
  2267. list[i].shangwu16 = lastWeek[j].name
  2268. }
  2269. //周三下午
  2270. if (lastWeek[j].schedule_week == 3 && lastWeek[j].schedule_type == 2) {
  2271. list[i].xiawu16 = lastWeek[j].name
  2272. }
  2273. //周三晚上
  2274. if (lastWeek[j].schedule_week == 3 && lastWeek[j].schedule_type == 3) {
  2275. list[i].wanshang16 = lastWeek[j].name
  2276. }
  2277. //周四
  2278. if (lastWeek[j].schedule_week == 4 && lastWeek[j].schedule_type == 1) {
  2279. list[i].shangwu17 = lastWeek[j].name
  2280. }
  2281. //周四下午
  2282. if (lastWeek[j].schedule_week == 4 && lastWeek[j].schedule_type == 2) {
  2283. list[i].xiawu17 = lastWeek[j].name
  2284. }
  2285. //周四晚上
  2286. if (lastWeek[j].schedule_week == 4 && lastWeek[j].schedule_type == 3) {
  2287. list[i].wanshang17 = lastWeek[j].name
  2288. }
  2289. //周五
  2290. if (lastWeek[j].schedule_week == 5 && lastWeek[j].schedule_type == 1) {
  2291. list[i].shangwu18 = lastWeek[j].name
  2292. }
  2293. //周五下午
  2294. if (lastWeek[j].schedule_week == 5 && lastWeek[j].schedule_type == 2) {
  2295. list[i].xiawu18 = lastWeek[j].name
  2296. }
  2297. //周五晚上
  2298. if (lastWeek[j].schedule_week == 5 && lastWeek[j].schedule_type == 3) {
  2299. list[i].wanshang18 = lastWeek[j].name
  2300. }
  2301. //周六
  2302. if (lastWeek[j].schedule_week == 6 && lastWeek[j].schedule_type == 1) {
  2303. list[i].shangwu19 = lastWeek[j].name
  2304. }
  2305. //周六下午
  2306. if (lastWeek[j].schedule_week == 6 && lastWeek[j].schedule_type == 2) {
  2307. list[i].xiawu19 = lastWeek[j].name
  2308. }
  2309. //周六晚上
  2310. if (lastWeek[j].schedule_week == 6 && lastWeek[j].schedule_type == 3) {
  2311. list[i].wanshang19 = lastWeek[j].name
  2312. }
  2313. //周日
  2314. if (lastWeek[j].schedule_week == 7 && lastWeek[j].schedule_type == 1) {
  2315. list[i].shangwu20 = lastWeek[j].name
  2316. }
  2317. //周日下午
  2318. if (lastWeek[j].schedule_week == 7 && lastWeek[j].schedule_type == 2) {
  2319. list[i].xiawu20 = lastWeek[j].name
  2320. }
  2321. //周日晚上
  2322. if (lastWeek[j].schedule_week == 7 && lastWeek[j].schedule_type == 3) {
  2323. list[i].wanshang20 = lastWeek[j].name
  2324. }
  2325. }
  2326. }
  2327. }
  2328. }
  2329. this.tableList = list
  2330. this.start_time = ""
  2331. this.end_time = ""
  2332. }
  2333. })
  2334. },
  2335. changePartition(val) {
  2336. this.partition_id = val
  2337. // this.getThreeWeekList()
  2338. // this.getWeekPanels()
  2339. },
  2340. changeSchedule(val) {
  2341. this.schedule_type = vald
  2342. this.getThreeWeekList()
  2343. this.getWeekPanels()
  2344. },
  2345. changeWeekDay(val){
  2346. console.log("Val2332322323wo",val)
  2347. var str = val.join(",")
  2348. console.log("stor233233223",str)
  2349. this.week_date = str
  2350. },
  2351. changeWeek(val) {
  2352. this.start_time = ""
  2353. this.end_time = ""
  2354. this.newDay = []
  2355. var start = this.getTimestamp(val) - 57600
  2356. this.start_time = this.getTime(start)
  2357. this.newDay.push(this.start_time)
  2358. var next = start + 86400
  2359. var nest_day = this.getTime(next)
  2360. this.newDay.push(nest_day)
  2361. var last_days = start + 172800
  2362. var last_day = this.getTime(last_days)
  2363. this.newDay.push(last_day)
  2364. var tuesdays = start + 259200
  2365. var tuesday = this.getTime(tuesdays)
  2366. this.newDay.push(tuesday)
  2367. var fivdays = start + 345600
  2368. var fiveday = this.getTime(fivdays)
  2369. this.newDay.push(fiveday)
  2370. var sixday = start + 432000
  2371. var sixdays = this.getTime(sixday)
  2372. this.newDay.push(sixdays)
  2373. var end = this.getTimestamp(val) + 460800
  2374. this.end_time = this.getTime(end)
  2375. this.newDay.push(this.end_time)
  2376. this.export_type = 1
  2377. this.getThreeWeekList()
  2378. },
  2379. getTime(val) {
  2380. return uParseTime(val, '{y}-{m}-{d}')
  2381. },
  2382. smartsch(){
  2383. this.$nextTick(function() {
  2384. this.$refs.edittableData.showSmartDialog()
  2385. })
  2386. },
  2387. editsch() {
  2388. this.is_edit = true
  2389. this.schedulingTableVisible=true
  2390. this.$nextTick(function() {//, this.days,this.zones
  2391. this.$refs.edittableData.setEditData(this.patientList, this.$store.getters.treatment_mode, this.days,this.zones)
  2392. })
  2393. },
  2394. outisedit(){
  2395. this.is_edit=false
  2396. this.schedulingTableVisible=false
  2397. },
  2398. copySchedule() {
  2399. this.newVisible = true
  2400. },
  2401. getYearWeek(year, month, date) {
  2402. /*
  2403. dateNow是当前日期
  2404. dateFirst是当年第一天
  2405. dataNumber是当前日期是今年第多少天
  2406. 用dataNumber + 当前年的第一天的周差距的和在除以7就是本年第几周
  2407. */
  2408. let dateNow = new Date(year, parseInt(month) - 1, date);
  2409. let dateFirst = new Date(year, 0, 1);
  2410. let dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 86400000);
  2411. return Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7) - 1;
  2412. },
  2413. getTimestamp(time) { //把时间日期转成时间戳
  2414. return (new Date(time)).getTime() / 1000
  2415. },
  2416. formatDate(date) {
  2417. var year = date.getFullYear() + '.'
  2418. var month = (date.getMonth() + 1) + '.';
  2419. var day = date.getDate();
  2420. return year + month + day
  2421. },
  2422. formatDateTwo(date) {
  2423. var year = date.getFullYear() + '.'
  2424. var month = (date.getMonth() + 1) + '.';
  2425. var day = date.getDate();
  2426. return year + month + day
  2427. },
  2428. addDate(date, n) {
  2429. date.setDate(date.getDate() + n);
  2430. return date;
  2431. },
  2432. //
  2433. setDate(date) {
  2434. var week = date.getDay() - 1;
  2435. date = this.addDate(date, week * -1);
  2436. this.currentFirstDate = new Date(date);
  2437. this.currentDate = new Date(date)
  2438. for (var i = 0; i < this.clen; i++) {
  2439. this.weekDayArr.push(this.formatDate(i == 0 ? date : this.addDate(date, 1)))
  2440. }
  2441. },
  2442. setDate1(date) {
  2443. var week = date.getDay() - 1
  2444. date = this.addDate(date, week * -1)
  2445. this.currentDate = new Date(date)
  2446. let arr1 = []
  2447. for (var i = 0; i < this.clen; i++) {
  2448. arr1.push(this.formatDate(i == 0 ? date : this.addDate(date, 1)))
  2449. }
  2450. this.weekList.push(arr1)
  2451. let num = this.weekNum
  2452. this.currentFirstDate1 = num + 1
  2453. },
  2454. getTimestamp(time) { //把时间日期转成时间戳
  2455. return (new Date(time)).getTime() / 1000
  2456. },
  2457. submitAction(formName) {
  2458. var start_time = ""
  2459. var end_time = ""
  2460. //上周
  2461. if (this.form.lastweek == "1") {
  2462. let weekOfday = parseInt(moment().format('d'))
  2463. start_time = this.getTimestamp(moment().subtract(weekOfday + 6, 'days').format('YYYY-MM-DD')) - 28800
  2464. end_time = this.getTimestamp(moment().subtract(weekOfday, 'days').format('YYYY-MM-DD')) - 28800
  2465. }
  2466. //本周
  2467. if (this.form.lastweek == "2") {
  2468. start_time = this.getTimestamp(this.weekDayArr[0])
  2469. end_time = this.getTimestamp(this.weekDayArr[6])
  2470. }
  2471. var label = ""
  2472. for (let i = 0; i < this.timeOptions.length; i++) {
  2473. if (this.form.copyWeek == this.timeOptions[i].value) {
  2474. label = this.timeOptions[i].label
  2475. }
  2476. }
  2477. var start = label.split('~')
  2478. var copy_startime = this.getTimestamp(start[0])
  2479. var copy_endtime = this.getTimestamp(start[1])
  2480. const params = {
  2481. start_time: start_time,
  2482. end_time: end_time,
  2483. copy_startime: copy_startime,
  2484. copy_endtime: copy_endtime,
  2485. }
  2486. this.$refs[formName].validate(valid => {
  2487. if (valid) {
  2488. if(!this.copySchLoading){
  2489. this.copySchLoading = true
  2490. copyPatientSchedule(params).then(response => {
  2491. if (response.data.state == 1) {
  2492. var msg = response.data.data.msg
  2493. this.$message.success("复制成功")
  2494. this.copySchLoading = false
  2495. this.newVisible = false
  2496. } else {
  2497. this.copySchLoading = false
  2498. this.$message.error("复制失败")
  2499. }
  2500. })
  2501. }
  2502. }
  2503. })
  2504. },
  2505. getlist() {
  2506. getScheduleTemplate().then(response => {
  2507. if (response.data.state == 1) {
  2508. var template = response.data.data.template
  2509. console.log('12243254',response.data.data);
  2510. this.templateObj = template
  2511. }
  2512. })
  2513. },
  2514. getPatientList(){
  2515. patientLists().then(response => {
  2516. if (response.data.state == 1) {
  2517. var patientList = response.data.data.list
  2518. this.patientList = patientList
  2519. console.log("list")
  2520. console.log( this.patientList)
  2521. }
  2522. })
  2523. }
  2524. },
  2525. created() {
  2526. this.getlist()
  2527. this.getPatientList()
  2528. var start_time = moment().weekday(1).format('YYYY-MM-DD');
  2529. this.start_time = start_time
  2530. var end_time = this.getNextWeek(2)
  2531. this.end_time = end_time
  2532. this.getWeekPanels()
  2533. this.getInitDate()
  2534. //获取三周排班数据
  2535. this.getThreeWeekList()
  2536. let year = new Date().getFullYear()
  2537. let month = new Date().getMonth() + 1
  2538. let date = new Date().getDate()
  2539. this.weekNum = this.getYearWeek(year, month, date)
  2540. this.todayDate = this.formatDate(new Date())
  2541. this.setDate(new Date())
  2542. for (var i = 0; i <= 9; i++) {
  2543. this.setDate1(this.addDate(this.currentDate, 7))
  2544. }
  2545. let newNum = 0
  2546. for (let i = 0; i < this.weekList.length; i++) {
  2547. if (this.weekNum + i + 2 <= 53) {
  2548. let num = this.weekNum + i + 2
  2549. let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + num + ')'
  2550. this.typeOptions.push({value: i, label: str})
  2551. let stt = this.weekList[i][0] + "~" + this.weekList[i][6]
  2552. this.timeOptions.push({value: i, label: stt})
  2553. } else {
  2554. newNum++
  2555. let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + newNum + ')'
  2556. this.typeOptions.push({value: i, label: str})
  2557. let stt = this.weekList[i][0] + "~" + this.weekList[i][6]
  2558. this.timeOptions.push({value: i, label: stt})
  2559. }
  2560. }
  2561. }
  2562. }
  2563. </script>
  2564. <style rel="stylesheet/css" lang="scss">
  2565. .schedule-table-cell-disable {
  2566. background-color: #F5F5F5 !important;
  2567. }
  2568. </style>