scheduling.vue 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064
  1. <template>
  2. <div class="content-box">
  3. <div class="left">
  4. <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
  5. <span class="cameratxt" @click="getList(1)" :class="themeIndex == 1 ? 'is_active' : ''">时段设置</span>
  6. <span class="cameratxt" @click="getList(2)" :class="themeIndex == 2 ? 'is_active' : ''">排班设置</span>
  7. </div>
  8. <div v-if="themeIndex == 1" v-loading="loading1">
  9. <div class="middle">
  10. <!-- 按钮列表 -->
  11. <div class="gongneng" style="margin-top: 20px">
  12. <el-button type="primary" color="rgba(111, 182, 184, 1)" @click="addlist"><img src="@/assets/add.png"
  13. style="width: 14px; height: 14px; margin-right: 4px" alt="" /><span>添加时段</span></el-button>
  14. </div>
  15. </div>
  16. <div class="footer">
  17. <el-table :row-class-name="tableRowClassName" :data="tableData.list" style="width: 100%" :header-cell-style="{
  18. background: 'rgba(240, 243, 247, 1)',
  19. height: '50px',
  20. border: 0,
  21. }">
  22. <!-- <el-table-column align="center" type="selection" width="80" /> -->
  23. <el-table-column width="150" align="center " type="index" label="序号" />
  24. <el-table-column align="center" prop="name" label="名称" />
  25. <el-table-column align="center" prop="color" label="颜色">
  26. <template #default="scope">
  27. <el-button :color="scope.row.color" :link="false">&nbsp;&nbsp;&nbsp;</el-button>
  28. </template>
  29. </el-table-column>
  30. <el-table-column align="center" label="起止时间">
  31. <template #default="{ row }">
  32. <span>{{ row.startTime + "~" + row.endTime }}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column align="center" prop="isDutys" label="是否值班" />
  36. <el-table-column align="center" label="操作" width="220">
  37. <template #default="scope">
  38. <div class="edit">
  39. <div class="look" @click="editTime(scope.row)">编辑</div>
  40. <el-popconfirm width="220" confirm-button-text="确认" cancel-button-text="取消" :icon="InfoFilled"
  41. icon-color="#f89626" title="是否删除?" @confirm="delTime(scope.row)" @cancel="cencelTime">
  42. <template #reference>
  43. <div class="look">删除</div>
  44. </template>
  45. </el-popconfirm>
  46. </div>
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. <!-- 添加时段弹窗 -->
  51. <el-dialog class="addStaff" v-model="addDialogVisible" :close-on-click-modal="false"
  52. :close-on-press-escape="false" :title="dialongTitle" align-center width="609" :before-close="cancelAdd">
  53. <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm"
  54. :size="formSize" label-position="left" status-icon>
  55. <el-form-item label="班次名称 :" prop="name">
  56. <el-input clearable v-model="ruleForm.name" placeholder="请输入班次名称" />
  57. </el-form-item>
  58. <el-form-item label="颜色 :" prop="color">
  59. <div class="colorSelect">
  60. <ul>
  61. <li :class="i.flag == 1 ? 'li_active' : ''" v-for="i in ruleFormColor.list">
  62. <div class="item" :class="`item${i.id}`" @click="selectColor(i)">
  63. <img v-if="i.id == colorInd" src="@/assets/colorSelect.png" alt="" />
  64. </div>
  65. </li>
  66. </ul>
  67. </div>
  68. </el-form-item>
  69. <el-form-item label="时间 :" prop="snTime">
  70. <div>
  71. <el-time-picker v-model="ruleForm.snTime" type="daterange" range-separator="-" start-placeholder="起始时间"
  72. end-placeholder="结束时间" format="HH:mm" value-format="HH:mm" :prefix-icon="Calendar" is-range
  73. placeholder="请选择日期" />
  74. </div>
  75. </el-form-item>
  76. <el-form-item label="非工作时间 :" prop="noworkTime">
  77. <div class="noworkTime" v-for="(item, index) in ruleForm.noworkTime">
  78. <el-time-picker v-model="item.time" type="daterange" range-separator="-" start-placeholder="起始时间"
  79. end-placeholder="结束时间" format="HH:mm" value-format="HH:mm" :prefix-icon="Calendar" is-range
  80. placeholder="请选择日期" />
  81. <img @click="delNotWork(index)" v-if="ruleForm.noworkTime.length != 1" src="@/assets/noworkTime.png"
  82. alt="" />
  83. <img @click="addNotWork" v-if="index == ruleForm.noworkTime.length - 1" src="@/assets/workTime.png"
  84. alt="" />
  85. </div>
  86. </el-form-item>
  87. <el-form-item label="是否值班 :" prop="isDuty" style="
  88. padding-bottom: 40px;
  89. border-bottom: 1px solid rgba(230, 230, 230, 1);
  90. ">
  91. <el-switch v-model="ruleForm.isDuty" class="ml-2" style="--el-switch-on-color: rgba(111, 182, 184, 1)" />
  92. </el-form-item>
  93. <el-form-item class="options">
  94. <el-button color="rgba(111, 182, 184, 1)" class="queding" type="primary" @click="submitAdd(ruleFormRef)">
  95. 确定
  96. </el-button>
  97. <el-button class="congzhi" @click="cancelAdd(ruleFormRef)">取消</el-button>
  98. </el-form-item>
  99. </el-form>
  100. </el-dialog>
  101. </div>
  102. <!-- 分页组件 -->
  103. <div class="pageSize">
  104. <span></span>
  105. <el-pagination background :current-page="currentPage" :page-size="pageSize"
  106. layout="total, prev, pager, next, jumper, slot" :total="total" @update:current-page="handleCurrentChange" />
  107. </div>
  108. </div>
  109. <div v-else-if="themeIndex == 2" v-loading="loading2">
  110. <div class="middle">
  111. <div class="filter">
  112. <div class="condition">
  113. <span>创建时间 : </span>
  114. <el-date-picker v-model="searchInput.createTime" type="daterange" range-separator="-" start-placeholder="起始时间"
  115. end-placeholder="结束时间" format="YYYY-MM-DD" value-format="YYYY-MM-DD" :prefix-icon="Calendar"
  116. placeholder="请选择日期" />
  117. </div>
  118. <el-button style="margin-left: 20px" color="rgba(111, 182, 184, 1)" type="primary" class="search"
  119. @click="searchBtn"><el-icon>
  120. <Search />
  121. </el-icon> <span>查询</span></el-button>
  122. </div>
  123. <!-- 按钮列表 -->
  124. <div class="gongneng">
  125. <!-- <el-button
  126. type="primary"
  127. color="rgba(111, 182, 184, 1)"
  128. @click="addStaff"
  129. ><img
  130. src="@/assets/add.png"
  131. style="width: 14px; height: 14px; margin-right: 4px"
  132. alt=""
  133. /><span>添加人员</span></el-button
  134. > -->
  135. <el-button type="primary" color="rgba(111, 182, 184, 1)" @click="importTemp"><span>导入模板下载</span></el-button>
  136. <el-button color="rgba(111, 182, 184, 1)" class="import" type="primary" @click="importFile"><img
  137. src="@/assets/toLead.png" style="width: 24px; height: 22px" alt="" />
  138. <span>导入</span></el-button>
  139. <el-button color="rgba(111, 182, 184, 1)" class="import" type="primary" @click="importExcel"><img
  140. src="@/assets/import.png" style="width: 14px; height: 14px; margin-right: 4px" alt="" />
  141. <span>导出</span></el-button>
  142. </div>
  143. </div>
  144. <div class="footer">
  145. <el-table :row-class-name="tableRowClassName" class="footers" :data="tableData.list" style="width: 100%"
  146. :header-cell-style="{
  147. background: 'rgba(240, 243, 247, 1)',
  148. height: '50px',
  149. border: 0,
  150. }">
  151. <!-- <el-table-column align="center" type="selection" width="80" /> -->
  152. <el-table-column prop="schoolName" align="center" width="120" fixed="left" label="校区" />
  153. <el-table-column fixed="left" prop="userName" align="center" label="人员">
  154. </el-table-column>
  155. <el-table-column align="center" label="日期">
  156. <el-table-column width="300" prop="date" align="center" v-for="(i, index) in dates.list"
  157. :label="i.weekStr + '(' + i.dateStr + ')'">
  158. <template #default="{ row }">
  159. <!-- <span>{{ row.classSettings[index] }}</span> -->
  160. <!-- <span>{{ index }}</span> -->
  161. <div class="word">
  162. <div class="classItem" v-if="row.classSettings[index].id">
  163. <div class="del" v-for="item in row.classSettings[index].shifts">
  164. <el-button :link="false" :color="item.color" :dark="true">{{ item.name }}</el-button>
  165. <div class="classX" @click="delClass(row.classSettings[index], item)">
  166. <img src="@/assets/classX.png" alt="" />
  167. </div>
  168. </div>
  169. <div class="bottom" @click="editClass(row.classSettings[index])">
  170. <img src="@/assets/bottom.png" alt="" />
  171. </div>
  172. </div>
  173. <div class="word" v-else>
  174. <span @click="addClass(row.classSettings[index])">添加班次</span>
  175. </div>
  176. </div>
  177. </template>
  178. </el-table-column>
  179. <!-- <el-table-column prop="date" align="center" label="周二(07.08)">
  180. <div class="word">
  181. <span @click="addClass">添加班次</span>
  182. </div>
  183. </el-table-column> -->
  184. </el-table-column>
  185. </el-table>
  186. <!-- 添加人员弹窗 -->
  187. <!-- <el-dialog
  188. class="addStaff2"
  189. v-model="addStaffVisible"
  190. :close-on-click-modal="false"
  191. :close-on-press-escape="false"
  192. title="添加人员"
  193. align-center
  194. width="1009"
  195. :before-close="addStaffClose"
  196. >
  197. <div class="middle">
  198. <div class="filter">
  199. <div class="condition">
  200. <span>校区 : </span>
  201. <el-select
  202. v-model="addStaffSearch.schoolId"
  203. class="m-2"
  204. placeholder="请选择身份"
  205. >
  206. <el-option label="车队长" value="车队长" />
  207. <el-option label="司机" value="司机" />
  208. </el-select>
  209. </div>
  210. <div class="condition">
  211. <span>电话 : </span>
  212. <el-input
  213. clearable
  214. v-model="addStaffSearch.phone"
  215. class="w-50 m-2"
  216. placeholder="请输入电话号码"
  217. style="width: 150px"
  218. />
  219. </div>
  220. <div class="condition">
  221. <span>关联报修类型 : </span>
  222. <el-select
  223. v-model="addStaffSearch.type"
  224. class="m-2"
  225. placeholder="请选择身份"
  226. >
  227. <el-option label="车队长" value="车队长" />
  228. <el-option label="司机" value="司机" />
  229. </el-select>
  230. </div>
  231. </div>
  232. </div>
  233. <div class="footer">
  234. <el-table
  235. :row-class-name="tableRowClassName"
  236. :data="addStaffList.list"
  237. @selection-change="handleSelectionChange3"
  238. style="width: 100%"
  239. :header-cell-style="{
  240. background: 'rgba(240, 243, 247, 1)',
  241. height: '50px',
  242. border: 0,
  243. }"
  244. >
  245. <el-table-column align="center" type="selection" width="80" />
  246. <el-table-column
  247. width="150"
  248. align="center "
  249. prop="schoolName"
  250. label="校区"
  251. />
  252. <el-table-column align="center" prop="userName" label="姓名" />
  253. <el-table-column align="center" prop="userPhone" label="电话" />
  254. <el-table-column align="center" prop="car_number" label="状态" />
  255. <el-table-column align="center" prop="teamName" label="维修班" />
  256. <el-table-column
  257. align="center"
  258. prop="car_number"
  259. label="关联报修类型"
  260. width="180"
  261. show-overflow-tooltip
  262. >
  263. <template #default="{ row }">
  264. {{ row.articleName }}
  265. </template>
  266. </el-table-column>
  267. <el-table-column type="selection" width="80" />
  268. </el-table>
  269. <div class="pageSize">
  270. <span></span>
  271. <el-pagination
  272. background
  273. :current-page="currentPage3"
  274. :page-size="pageSize3"
  275. layout="total, prev, pager, next, jumper, slot"
  276. :total="total3"
  277. @update:current-page="handleCurrentChange3"
  278. />
  279. </div>
  280. </div>
  281. <div class="options">
  282. <el-button
  283. color="rgba(111, 182, 184, 1)"
  284. class="queding"
  285. type="primary"
  286. @click="submitAdd(ruleFormRef)"
  287. >
  288. 确定
  289. </el-button>
  290. <el-button class="congzhi" @click="addStaffClose(ruleFormRef)"
  291. >取消</el-button
  292. >
  293. </div>
  294. </el-dialog> -->
  295. <!-- 添加班次弹窗 -->
  296. <el-dialog class="addClass" v-model="addClassVisible" :close-on-click-modal="false" :close-on-press-escape="false"
  297. :title="addClassTitle" align-center width="409" :before-close="addClassClose">
  298. <el-form ref="ruleFormClassRef" :model="ruleFormClass" :rules="classRules" class="demo-ruleForm"
  299. :size="formSize" label-position="left" status-icon>
  300. <el-form-item label="" prop="shiftIds">
  301. <el-tree :data="addClassList" :props="{ label: 'name', children: 'children', value: 'id' }" node-key="id"
  302. show-checkbox ref="articleIdsRef" @check-change="handleArticleIds" />
  303. <!-- <el-checkbox-group
  304. v-model="checkedCities"
  305. @change="handleCheckedCitiesChange"
  306. >
  307. <el-checkbox
  308. v-for="item in addClassList"
  309. :key="item.id"
  310. :label="item.name"
  311. >{{ item.name }}</el-checkbox
  312. >
  313. </el-checkbox-group> -->
  314. </el-form-item>
  315. <el-form-item class="options">
  316. <el-button color="rgba(111, 182, 184, 1)" class="queding" type="primary"
  317. @click="addClassSubmit(ruleFormClassRef)">
  318. 确定
  319. </el-button>
  320. <el-button class="congzhi" @click="addClassClose(ruleFormClassRef)">取消</el-button>
  321. </el-form-item>
  322. </el-form>
  323. </el-dialog>
  324. <!-- 导入弹窗 -->
  325. <el-dialog class="importXlsx" v-model="importXlsx" :close-on-click-modal="false" :close-on-press-escape="false"
  326. title="导入文件" align-center width="409" :before-close="closeXlsx">
  327. <el-upload class="avatar-uploader" action="" ref="upload" :on-preview="handlePreview" :on-remove="handleRemove"
  328. :on-change="handleChange" :http-request="handleUpload" :before-upload="beforeAvatarUpload"
  329. :auto-upload="false" :limit="1" :on-exceed="handleExceed">
  330. <template #trigger>
  331. <el-button type="primary" color="rgba(111, 182, 184, 1)" @click="updateImg">
  332. <img src="@/assets/toLead.png" style="width: 24px; height: 22px" alt="" />
  333. <span style="color: #fff">导入文件</span></el-button>
  334. </template>
  335. <!-- <template #tip>
  336. <div class="el-upload__tip">
  337. (注:图片大小不超过10M,建议按3:2比例)
  338. </div>
  339. </template> -->
  340. </el-upload>
  341. <div class="options">
  342. <el-button color="rgba(111, 182, 184, 1)" class="queding" type="primary" @click="importSuc()">
  343. 确定
  344. </el-button>
  345. <el-button class="congzhi" @click="closeXlsx()">取消</el-button>
  346. </div>
  347. </el-dialog>
  348. </div>
  349. <!-- 分页组件 -->
  350. <div class="pageSize">
  351. <span></span>
  352. <el-pagination background :current-page="currentPage2" :page-size="pageSize2"
  353. layout="total, prev, pager, next, jumper, slot" :total="total2" @update:current-page="handleCurrentChange2" />
  354. </div>
  355. </div>
  356. </div>
  357. </template>
  358. <script setup>
  359. import { ref, watch, reactive, nextTick, onBeforeMount, onUnmounted } from "vue";
  360. import { useRouter } from "vue-router";
  361. import { ElMessage, ElMessageBox } from "element-plus";
  362. import { Calendar } from "@element-plus/icons-vue";
  363. import vidiconsApi from "@/api/vidicons.js";
  364. import { dayjs } from "element-plus";
  365. import lodash, { fill } from "lodash";
  366. import axios from "axios";
  367. import { useStore } from "vuex";
  368. const store = useStore();
  369. const api = ref("");
  370. const router = useRouter();
  371. // 表格数据
  372. const tableData = reactive({ list: [] }); // 表格数据
  373. const dates = reactive({ list: [] }); // 日期数据
  374. const schoolId = ref(""); // 判断是否为超级管理员账号
  375. const themeIndex = ref(2); // 切换 耗材管理 和 耗材记录
  376. const loading1 = ref(false);
  377. const loading2 = ref(false);
  378. // 添加时段 弹窗数据 (------------------------------------)
  379. const dialongTitle = ref("添加时段"); // 弹窗标题
  380. const searchInput = reactive({
  381. createTime: "",
  382. }); // 搜索按钮数据
  383. const currentPage = ref(1); // 当前页
  384. const pageSize = ref(10);
  385. const total = ref(); // 当前总数
  386. const selectData = reactive({ list: [] }); // 多选框选择的数据
  387. const addDialogVisible = ref(false); // 控制添加员工弹窗
  388. const colorInd = ref(); // 添加时段中默认选中1中颜色
  389. const ruleFormColor = reactive({
  390. list: [
  391. { color: "#F07459", id: 1, flag: 0 },
  392. { color: "#DE6868", id: 2, flag: 0 },
  393. { color: "#5AE090", id: 3, flag: 0 },
  394. { color: "#679EE6", id: 4, flag: 0 },
  395. { color: "#F0AA65", id: 5, flag: 0 },
  396. { color: "#F0D375", id: 6, flag: 0 },
  397. { color: "#67D6CF", id: 7, flag: 0 },
  398. { color: "#CC82D9", id: 8, flag: 0 },
  399. ],
  400. }); // 颜色数据
  401. const ruleFormRef = ref();
  402. const ruleForm = reactive({
  403. name: "",
  404. snTime: "",
  405. color: "",
  406. isDuty: "",
  407. noworkTime: [{ time: ["00:00", "12:00"] }],
  408. id: "",
  409. });
  410. // 表单验证
  411. const rules = reactive({
  412. // serial: [{ required: true, message: "序列号不能为空", trigger: "blur" }],
  413. name: [{ required: true, message: "班次名称不能为空", trigger: "blur" }],
  414. color: [
  415. {
  416. required: true,
  417. message: "请选择一个颜色",
  418. trigger: "blur",
  419. },
  420. ],
  421. snTime: [{ required: true, message: "请选择时间", trigger: "blur" }],
  422. noworkTime: [
  423. { required: true, message: "非工作时间不能为空", trigger: "blur" },
  424. ],
  425. // isDuty: [{ required: true, message: "值班", trigger: "blur" }],
  426. });
  427. // 添加班次 弹窗数据 (---------------------------)
  428. const addClassVisible = ref(false); // 控制添加班次弹窗
  429. const addClassTitle = ref("添加班次");
  430. const addClassList = ref([]); // 添加时段数据选择列表 如:["日常班次", "周末班次"]
  431. const checkedCities = ref([]); // 选中的时段列表
  432. const articleIdsRef = ref(); // 选中时段ref
  433. const addStaffVisible = ref(false); // 控制添加人员弹窗
  434. const formSize = ref("default");
  435. // 排班设置页面(---------------------------------------------)
  436. const upload = ref(); // 导入按钮ref
  437. const fileXlsx = ref(); // 导入的文件file
  438. const importXlsx = ref(false); // 导入弹窗
  439. const ruleFormClassRef = ref();
  440. // 添加班次数据
  441. const ruleFormClass = reactive({
  442. shiftIds: [],
  443. id: "",
  444. startDate: "",
  445. userId: "",
  446. });
  447. // 表单验证
  448. const classRules = reactive({
  449. shiftIds: [{ required: true, message: "至少选择一个班次", trigger: "blur" }],
  450. });
  451. // // 添加人员中搜索数据
  452. // const addStaffSearch = reactive({
  453. // schoolId: "",
  454. // phone: "",
  455. // type: "",
  456. // });
  457. const addStaffList = reactive({ list: [] }); // 添加人员中的 表格数据
  458. const currentPage2 = ref(1); // 当前页
  459. const pageSize2 = ref(6);
  460. const total2 = ref(30); // 当前总数
  461. // const currentPage3 = ref(1); // 当前页
  462. // const pageSize3 = ref(8);
  463. // const total3 = ref(30); // 当前总数
  464. watch(
  465. () => searchInput.createTime,
  466. (newVal, oldVal) => {
  467. console.log("监听时间:", newVal);
  468. if (newVal == null) {
  469. searchBtn();
  470. }
  471. }
  472. );
  473. // 查看耗材列表
  474. const getList = async (flag) => {
  475. if (flag == 1) {
  476. loading1.value = true;
  477. themeIndex.value = 1;
  478. let data = {
  479. currentPage: currentPage.value,
  480. pageCount: pageSize.value,
  481. // name: "时段设置",
  482. };
  483. let res = await axios({
  484. method: "get",
  485. url: api.value + "/repairShiftSettings/queryPageRepairShiftSettings",
  486. headers: {
  487. token: sessionStorage.getItem("token"),
  488. user_head: sessionStorage.getItem("userhead"),
  489. },
  490. params: data,
  491. });
  492. console.log(res, "时段设置");
  493. if (res.data.code == 200) {
  494. res.data.data.list.forEach((item) => {
  495. if (item.isDuty == 1) {
  496. item.isDutys = "是";
  497. } else {
  498. item.isDutys = "否";
  499. }
  500. });
  501. tableData.list = res.data.data.list;
  502. total.value = res.data.data.totalCount;
  503. loading1.value = false;
  504. } else {
  505. loading1.value = false;
  506. ElMessage({
  507. type: "error",
  508. showClose: true,
  509. message: res.data.message,
  510. center: true,
  511. });
  512. if (res.data.code == 570) {
  513. sessionStorage.removeItem("token")
  514. router.push({
  515. path: `/login`,
  516. });
  517. }
  518. }
  519. } else if (flag == 2) {
  520. loading2.value = true;
  521. themeIndex.value = 2;
  522. let data = {
  523. currentPage: currentPage2.value,
  524. pageCount: pageSize2.value,
  525. // startTime: searchInput.createTime[0],
  526. // endTime: searchInput.createTime[1],
  527. };
  528. if (searchInput.createTime) {
  529. data.startTime = searchInput.createTime[0]
  530. data.endTime = searchInput.createTime[1]
  531. }
  532. let res = await axios({
  533. method: "get",
  534. url: api.value + "/repairClassesSettings/queryPageRepairClassesSettings",
  535. headers: {
  536. token: sessionStorage.getItem("token"),
  537. user_head: sessionStorage.getItem("userhead"),
  538. },
  539. params: data,
  540. });
  541. console.log(res, "排班设置");
  542. if (res.data.code == 200) {
  543. tableData.list = res.data.data.pageDatas.list;
  544. dates.list = res.data.data.dates;
  545. total2.value = res.data.data.pageDatas.totalCount;
  546. loading2.value = false;
  547. } else {
  548. loading2.value = false;
  549. ElMessage({
  550. type: "error",
  551. showClose: true,
  552. message: res.data.message,
  553. center: true,
  554. });
  555. }
  556. }
  557. };
  558. //(添加时段--------------------------------------)
  559. const addlist = () => {
  560. addDialogVisible.value = true;
  561. dialongTitle.value = "添加时段";
  562. colorInd.value = 0;
  563. ruleForm.name = "";
  564. ruleForm.snTime = "";
  565. ruleForm.isDuty = false;
  566. ruleForm.color = "";
  567. ruleForm.noworkTime = [{ time: ["00:00", "12:00"] }];
  568. ruleForm.id = "";
  569. ruleFormColor.list.forEach((item) => {
  570. item.flag = 0;
  571. tableData.list.forEach((i) => {
  572. if (i.color == item.color) {
  573. console.log(item.color, "已选择的");
  574. item.flag = 1;
  575. }
  576. });
  577. });
  578. };
  579. //添加时段-编辑时段
  580. const editTime = (row) => {
  581. addDialogVisible.value = true;
  582. dialongTitle.value = "编辑时段";
  583. ruleFormColor.list.forEach((item) => {
  584. item.flag = 0;
  585. tableData.list.forEach((i) => {
  586. if (i.color == item.color && i.color != row.color) {
  587. console.log(item.color, "已选择的");
  588. item.flag = 1;
  589. }
  590. });
  591. });
  592. console.log(row);
  593. ruleForm.id = row.id;
  594. ruleFormColor.list.forEach((item) => {
  595. if (item.color == row.color) {
  596. colorInd.value = item.id;
  597. }
  598. });
  599. ruleForm.color = ruleFormColor.list[colorInd.value - 1].color;
  600. if (row.isDuty == 1) {
  601. ruleForm.isDuty = true;
  602. } else {
  603. ruleForm.isDuty = false;
  604. }
  605. ruleForm.snTime = [row.startTime, row.endTime];
  606. ruleForm.name = row.name;
  607. ruleForm.noworkTime = [];
  608. row.notWorkTime.split(",").forEach((item) => {
  609. ruleForm.noworkTime.push({ time: item.split("-") });
  610. });
  611. };
  612. // 选择颜色
  613. const selectColor = (i) => {
  614. // console.log(i);
  615. if (i.flag) {
  616. ElMessage({
  617. type: "warning",
  618. showClose: true,
  619. message: "当前颜色已被占用",
  620. center: true,
  621. });
  622. } else {
  623. colorInd.value = i.id;
  624. ruleForm.color = i.color;
  625. }
  626. };
  627. // 添加时段-添加非工作时间
  628. const addNotWork = () => {
  629. ruleForm.noworkTime.push({ time: [] });
  630. console.log(ruleForm.noworkTime);
  631. };
  632. // 添加时段-减掉非工作时间
  633. const delNotWork = (i) => {
  634. console.log(ruleForm.noworkTime);
  635. ruleForm.noworkTime = ruleForm.noworkTime.filter((item, index) => {
  636. return i != index;
  637. });
  638. };
  639. // 添加时段-确认添加时段
  640. const submitAdd = async (formEl) => {
  641. if (!formEl) return;
  642. await formEl.validate(async (valid, fields) => {
  643. if (valid) {
  644. if (dialongTitle.value == "添加时段") {
  645. let isDuty;
  646. if (ruleForm.isDuty) {
  647. isDuty = 1;
  648. } else {
  649. isDuty = 0;
  650. }
  651. let noWork = [];
  652. ruleForm.noworkTime.forEach((item) => {
  653. if (item.time) {
  654. let time = item.time[0] + "-" + item.time[1];
  655. noWork.push(time);
  656. }
  657. });
  658. console.log(noWork, "非工作时间数组");
  659. let data = {
  660. name: ruleForm.name,
  661. startTime: ruleForm.snTime[0],
  662. endTime: ruleForm.snTime[1],
  663. color: ruleForm.color,
  664. isDuty: isDuty,
  665. notWorkTime: noWork,
  666. };
  667. // let res = await admin.adminAdd(data);
  668. let res = await axios({
  669. method: "post",
  670. url: api.value + "/repairShiftSettings/insertRepairShiftSettings",
  671. headers: {
  672. token: sessionStorage.getItem("token"),
  673. user_head: sessionStorage.getItem("userhead"),
  674. },
  675. data: data,
  676. });
  677. console.log(res, "添加时段");
  678. if (res.data.code == 200) {
  679. getList(themeIndex.value);
  680. ElMessage({
  681. type: "success",
  682. showClose: true,
  683. message: res.data.message,
  684. center: true,
  685. });
  686. addDialogVisible.value = false;
  687. colorInd.value = 0;
  688. ruleFormRef.value.resetFields();
  689. } else {
  690. ElMessage({
  691. type: "error",
  692. showClose: true,
  693. message: res.data.message,
  694. center: true,
  695. });
  696. }
  697. } else {
  698. let isDuty;
  699. if (ruleForm.isDuty) {
  700. isDuty = 1;
  701. } else {
  702. isDuty = 0;
  703. }
  704. let noWork = [];
  705. ruleForm.noworkTime.forEach((item) => {
  706. if (item.time) {
  707. let time = item.time[0] + "-" + item.time[1];
  708. noWork.push(time);
  709. }
  710. });
  711. let data = {
  712. name: ruleForm.name,
  713. startTime: ruleForm.snTime[0],
  714. endTime: ruleForm.snTime[1],
  715. color: ruleForm.color,
  716. isDuty: isDuty,
  717. notWorkTime: noWork,
  718. id: ruleForm.id,
  719. };
  720. let res = await axios({
  721. method: "post",
  722. url: api.value + "/repairShiftSettings/updateRepairShiftSettingsById",
  723. headers: {
  724. token: sessionStorage.getItem("token"),
  725. user_head: sessionStorage.getItem("userhead"),
  726. },
  727. data: data,
  728. });
  729. console.log(res, "编辑时段");
  730. if (res.data.code == 200) {
  731. getList(themeIndex.value);
  732. ElMessage({
  733. type: "success",
  734. showClose: true,
  735. message: res.data.message,
  736. center: true,
  737. });
  738. addDialogVisible.value = false;
  739. colorInd.value = 0;
  740. ruleFormRef.value.resetFields();
  741. } else {
  742. ElMessage({
  743. type: "error",
  744. showClose: true,
  745. message: res.data.message,
  746. center: true,
  747. });
  748. }
  749. }
  750. let data = {
  751. currentPage: currentPage.value,
  752. pageCount: pageSize.value,
  753. // name: "时段设置",
  754. };
  755. let res = await axios({
  756. method: "get",
  757. url: api.value + "/repairShiftSettings/queryPageRepairShiftSettings",
  758. headers: {
  759. token: sessionStorage.getItem("token"),
  760. user_head: sessionStorage.getItem("userhead"),
  761. },
  762. params: data,
  763. });
  764. console.log(res, "添加时段选择数据");
  765. addClassList.value = res.data.data.list;
  766. } else {
  767. console.log("error submit!", fields);
  768. }
  769. });
  770. };
  771. // 添加时段-取消添加时段
  772. const cancelAdd = () => {
  773. addDialogVisible.value = false;
  774. colorInd.value = 0;
  775. ruleFormRef.value.resetFields();
  776. };
  777. //添加时段-删除时段按钮
  778. const delTime = async (row) => {
  779. let data = { id: row.id };
  780. let res = await axios({
  781. method: "get",
  782. url: api.value + "/repairShiftSettings/deleteRepairShiftSettingsById",
  783. headers: {
  784. token: sessionStorage.getItem("token"),
  785. user_head: sessionStorage.getItem("userhead"),
  786. },
  787. params: data,
  788. });
  789. console.log(res, "删除时段");
  790. if (res.data.code == 200) {
  791. if (tableData.list.length == 1 && currentPage.value != 1) {
  792. currentPage.value = currentPage.value - 1;
  793. }
  794. getList(themeIndex.value);
  795. ElMessage({
  796. type: "success",
  797. showClose: true,
  798. message: res.data.message,
  799. center: true,
  800. });
  801. } else {
  802. ElMessage({
  803. type: "error",
  804. showClose: true,
  805. message: res.data.message,
  806. center: true,
  807. });
  808. }
  809. };
  810. // 添加时段-取消删除
  811. const cencelTime = () => {
  812. ElMessage({
  813. type: "info",
  814. showClose: true,
  815. message: "取消删除",
  816. center: true,
  817. });
  818. };
  819. // 排班管理 (----------------------------------------------)
  820. // 排班查询
  821. const searchBtn = () => {
  822. getList(themeIndex.value);
  823. };
  824. // 添加班次弹窗
  825. const addClass = (row) => {
  826. addClassTitle.value = "添加班次";
  827. addClassVisible.value = true;
  828. ruleFormClass.startDate = row.startDate;
  829. ruleFormClass.userId = row.userId;
  830. ruleFormClass.shiftIds = [];
  831. articleIdsRef.value.setCheckedKeys([]);
  832. console.log(row);
  833. };
  834. const editClass = (row) => {
  835. addClassTitle.value = "编辑班次";
  836. addClassVisible.value = true;
  837. ruleFormClass.startDate = row.startDate;
  838. ruleFormClass.userId = row.userId;
  839. ruleFormClass.id = row.id;
  840. nextTick(() => {
  841. articleIdsRef.value.setCheckedKeys(row.shiftIds);
  842. });
  843. console.log(row);
  844. };
  845. // 关闭班次弹窗
  846. const addClassClose = () => {
  847. addClassVisible.value = false;
  848. ruleFormClassRef.value.resetFields();
  849. };
  850. // 确定添加班次
  851. const addClassSubmit = async (formEl) => {
  852. if (!formEl) return;
  853. await formEl.validate(async (valid, fields) => {
  854. if (valid) {
  855. if (addClassTitle.value == "添加班次") {
  856. let data = {
  857. userId: ruleFormClass.userId,
  858. startDate: ruleFormClass.startDate,
  859. shiftIds: ruleFormClass.shiftIds,
  860. };
  861. // let res = await admin.adminAdd(data);
  862. let res = await axios({
  863. method: "post",
  864. url: api.value + "/repairClassesSettings/insertRepairClassesSettings",
  865. headers: {
  866. token: sessionStorage.getItem("token"),
  867. user_head: sessionStorage.getItem("userhead"),
  868. },
  869. data: data,
  870. });
  871. console.log(res, "添加班次");
  872. if (res.data.code == 200) {
  873. addClassVisible.value = false;
  874. getList(themeIndex.value);
  875. ElMessage({
  876. type: "success",
  877. showClose: true,
  878. message: res.data.message,
  879. center: true,
  880. });
  881. } else {
  882. ElMessage({
  883. type: "error",
  884. showClose: true,
  885. message: res.data.message,
  886. center: true,
  887. });
  888. }
  889. } else {
  890. let data = {
  891. userId: ruleFormClass.userId,
  892. startDate: ruleFormClass.startDate,
  893. shiftIds: ruleFormClass.shiftIds,
  894. id: ruleFormClass.id,
  895. };
  896. let res = await axios({
  897. method: "post",
  898. url:
  899. api.value +
  900. "/repairClassesSettings/updateRepairClassesSettingsById",
  901. headers: {
  902. token: sessionStorage.getItem("token"),
  903. user_head: sessionStorage.getItem("userhead"),
  904. },
  905. data: data,
  906. });
  907. console.log(res, "编辑班次");
  908. if (res.data.code == 200) {
  909. addClassVisible.value = false;
  910. getList(themeIndex.value);
  911. ElMessage({
  912. type: "success",
  913. showClose: true,
  914. message: res.data.message,
  915. center: true,
  916. });
  917. } else {
  918. ElMessage({
  919. type: "error",
  920. showClose: true,
  921. message: res.data.message,
  922. center: true,
  923. });
  924. }
  925. }
  926. } else {
  927. console.log("error submit!", fields);
  928. }
  929. });
  930. };
  931. // 删除班次
  932. const delClass = async (row, item) => {
  933. console.log(row, item);
  934. if (row.shiftIds.length > 1) {
  935. ruleFormClass.startDate = row.startDate;
  936. ruleFormClass.userId = row.userId;
  937. addClassList.value.forEach((i) => {
  938. if (i.name == item.name) {
  939. ruleFormClass.shiftIds = row.shiftIds.filter((ii) => {
  940. return ii != i.id;
  941. });
  942. }
  943. });
  944. ruleFormClass.id = row.id;
  945. let data = {
  946. userId: ruleFormClass.userId,
  947. startDate: ruleFormClass.startDate,
  948. shiftIds: ruleFormClass.shiftIds,
  949. id: ruleFormClass.id,
  950. };
  951. let res = await axios({
  952. method: "post",
  953. url: api.value + "/repairClassesSettings/updateRepairClassesSettingsById",
  954. headers: {
  955. token: sessionStorage.getItem("token"),
  956. user_head: sessionStorage.getItem("userhead"),
  957. },
  958. data: data,
  959. });
  960. console.log(res, "删除班次");
  961. if (res.data.code == 200) {
  962. addClassVisible.value = false;
  963. getList(themeIndex.value);
  964. ElMessage({
  965. type: "success",
  966. showClose: true,
  967. message: "删除成功",
  968. center: true,
  969. });
  970. } else {
  971. ElMessage({
  972. type: "error",
  973. showClose: true,
  974. message: res.data.message,
  975. center: true,
  976. });
  977. }
  978. } else {
  979. ruleFormClass.id = row.id;
  980. let data = {
  981. id: ruleFormClass.id,
  982. };
  983. let res = await axios({
  984. method: "get",
  985. url: api.value + "/repairClassesSettings/deleteRepairClassesSettingsById",
  986. headers: {
  987. token: sessionStorage.getItem("token"),
  988. user_head: sessionStorage.getItem("userhead"),
  989. },
  990. params: data,
  991. });
  992. console.log(res, "删除班次");
  993. if (res.data.code == 200) {
  994. addClassVisible.value = false;
  995. getList(themeIndex.value);
  996. ElMessage({
  997. type: "success",
  998. showClose: true,
  999. message: "删除成功",
  1000. center: true,
  1001. });
  1002. } else {
  1003. ElMessage({
  1004. type: "error",
  1005. showClose: true,
  1006. message: res.data.message,
  1007. center: true,
  1008. });
  1009. }
  1010. }
  1011. };
  1012. // // 添加人员
  1013. // const addStaff = async () => {
  1014. // addStaffVisible.value = true;
  1015. // // 报修类型接口
  1016. // let data = {
  1017. // schoolId: 1,
  1018. // };
  1019. // let res = await axios({
  1020. // method: "get",
  1021. // url: api.value + "/repairArticleType/queryRepairArticleType",
  1022. // headers: {
  1023. // token: sessionStorage.getItem("token"),
  1024. // user_head: sessionStorage.getItem("userhead"),
  1025. // },
  1026. // params: data,
  1027. // });
  1028. // console.log(res, "报修类型接口");
  1029. // let datas = {
  1030. // currentPage: 1,
  1031. // pageCount: 8,
  1032. // };
  1033. // let ress = await axios({
  1034. // method: "get",
  1035. // url: api.value + "/repairUser/queryPageRepairUser",
  1036. // headers: {
  1037. // token: sessionStorage.getItem("token"),
  1038. // user_head: sessionStorage.getItem("userhead"),
  1039. // },
  1040. // params: datas,
  1041. // });
  1042. // console.log(ress, "员工列表");
  1043. // if (ress.data.code == 200) {
  1044. // ress.data.data.list.forEach((item) => {
  1045. // // 楼栋关联字段
  1046. // if (item.articleNames) {
  1047. // item.articleName = item.articleNames.join(",");
  1048. // } else {
  1049. // item.articleName = "暂无关联";
  1050. // }
  1051. // });
  1052. // addStaffList.list = ress.data.data.list;
  1053. // total3.value = ress.data.data.totalCount;
  1054. // } else {
  1055. // ElMessage({
  1056. // type: "error",
  1057. // showClose: true,
  1058. // message: res.data.message,
  1059. // center: true,
  1060. // });
  1061. // }
  1062. // };
  1063. // 关闭添加人员弹窗
  1064. const addStaffClose = () => {
  1065. addStaffVisible.value = false;
  1066. };
  1067. // // 表格selection中的多选功能
  1068. const handleArticleIds = (data, checked, indeterminate) => {
  1069. console.log(data, checked, indeterminate);
  1070. // let keys = articleIdsRef.value.getCheckedNodes();
  1071. let keys = articleIdsRef.value.getCheckedKeys();
  1072. console.log(keys);
  1073. ruleFormClass.shiftIds = keys;
  1074. };
  1075. // const handleCheckedCitiesChange = (value) => {
  1076. // console.log(value);
  1077. // };
  1078. // 多选框功能
  1079. const handleSelectionChange3 = (val) => {
  1080. console.log(val);
  1081. selectData.list = val;
  1082. };
  1083. // 导入弹窗
  1084. const importFile = () => {
  1085. importXlsx.value = true;
  1086. };
  1087. const closeXlsx = () => {
  1088. importXlsx.value = false;
  1089. upload.value.clearFiles();
  1090. fileXlsx.value = "";
  1091. };
  1092. // 导出模板
  1093. const importTemp = async () => {
  1094. let res = await axios({
  1095. method: "get",
  1096. url: api.value + "/repairClassesSettings/downloadRepairClassesSettingExcel",
  1097. headers: {
  1098. token: sessionStorage.getItem("token"),
  1099. user_head: sessionStorage.getItem("userhead"),
  1100. },
  1101. responseType: "blob",
  1102. });
  1103. console.log(res, "导出模板");
  1104. if (res.status == 200) {
  1105. let name = `排班导入模板`;
  1106. var content = res.data;
  1107. var data = new Blob([content]);
  1108. var downloadUrl = window.URL.createObjectURL(data);
  1109. var anchor = document.createElement("a");
  1110. anchor.href = downloadUrl;
  1111. anchor.download = name + ".xlsx";
  1112. anchor.click();
  1113. window.URL.revokeObjectURL(data);
  1114. ElMessage({
  1115. type: "success",
  1116. showClose: true,
  1117. message: "导出成功",
  1118. center: true,
  1119. });
  1120. } else {
  1121. ElMessage({
  1122. type: "error",
  1123. showClose: true,
  1124. message: "导出失败",
  1125. center: true,
  1126. });
  1127. }
  1128. };
  1129. // 添导入文件功能
  1130. const handleChange = (file, fileLists) => {
  1131. console.log(file, "file11111");
  1132. // let formData = new FormData(); //声明一个FormDate对象
  1133. // formData.append("formFile", file.raw);
  1134. // fileXlsx.value = formData;
  1135. fileXlsx.value = file.raw;
  1136. };
  1137. // 可以获取文件参数(封面图上传图片)
  1138. const handleUpload = (file) => {
  1139. console.log(file, "file22222");
  1140. };
  1141. // 移出文件
  1142. const handleRemove = (uploadFile, uploadFiles) => {
  1143. console.log(uploadFile, uploadFiles);
  1144. fileXlsx.value = "";
  1145. };
  1146. // 限制上传图片的大小类型
  1147. const beforeAvatarUpload = (rawFile) => {
  1148. console.log(rawFile.type);
  1149. if (
  1150. rawFile.type !==
  1151. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  1152. ) {
  1153. ElMessage.error("文件必须为xlsx格式!");
  1154. return false;
  1155. }
  1156. // else if (rawFile.size / 1024 / 1024 > 10) {
  1157. // ElMessage.error("图片的大小不能超过10MB!");
  1158. // return false;
  1159. // }
  1160. return true;
  1161. };
  1162. // 上传文件时多次上传会替换前一个文件
  1163. const handleExceed = (files) => {
  1164. console.log(files, "替换文件");
  1165. upload.value.clearFiles();
  1166. const file = files[0];
  1167. upload.value.handleStart(file);
  1168. // let formData = new FormData(); //声明一个FormDate对象
  1169. // formData.append("formFile", files.raw);
  1170. // fileXlsx.value = formData;
  1171. fileXlsx.value = files.raw;
  1172. };
  1173. // 确定导入文件
  1174. const importSuc = async () => {
  1175. console.log("确定导入");
  1176. let data = new FormData(); //声明一个FormDate对象
  1177. data.set("file", fileXlsx.value);
  1178. let res = await axios({
  1179. method: "post",
  1180. url: api.value + "/repairClassesSettings/importRepairClassesSettingExcel",
  1181. headers: {
  1182. token: sessionStorage.getItem("token"),
  1183. user_head: sessionStorage.getItem("userhead"),
  1184. "Content-Type": "multipart/form-data;charset=UTF-8",
  1185. },
  1186. data: data,
  1187. });
  1188. console.log(res);
  1189. if (res.data.code == 200) {
  1190. getList();
  1191. ElMessage({
  1192. type: "success",
  1193. showClose: true,
  1194. message: res.data.message,
  1195. center: true,
  1196. });
  1197. } else {
  1198. ElMessage({
  1199. type: "error",
  1200. showClose: true,
  1201. message: res.data.message,
  1202. center: true,
  1203. });
  1204. }
  1205. };
  1206. //导出功能
  1207. const importExcel = async () => {
  1208. let datas = {
  1209. account: localStorage.getItem("user"),
  1210. startTime: searchInput.createTime[0],
  1211. endTime: searchInput.createTime[1],
  1212. };
  1213. let res = await axios({
  1214. method: "get",
  1215. url: api.value + "/repairClassesSettings/downloadRepairClassesExcel",
  1216. headers: {
  1217. token: sessionStorage.getItem("token"),
  1218. user_head: sessionStorage.getItem("userhead"),
  1219. },
  1220. params: datas,
  1221. responseType: "blob",
  1222. });
  1223. console.log(res, "导出排班");
  1224. if (res.status == 200) {
  1225. let name = `排班管理`;
  1226. var content = res.data;
  1227. var data = new Blob([content]);
  1228. var downloadUrl = window.URL.createObjectURL(data);
  1229. var anchor = document.createElement("a");
  1230. anchor.href = downloadUrl;
  1231. anchor.download = name + ".xlsx";
  1232. anchor.click();
  1233. window.URL.revokeObjectURL(data);
  1234. ElMessage({
  1235. type: "success",
  1236. showClose: true,
  1237. message: "导出成功",
  1238. center: true,
  1239. });
  1240. } else {
  1241. ElMessage({
  1242. type: "error",
  1243. showClose: true,
  1244. message: "导出失败",
  1245. center: true,
  1246. });
  1247. }
  1248. };
  1249. // 表格斑马纹颜色修改
  1250. const tableRowClassName = ({ row, rowIndex }) => {
  1251. if (rowIndex % 2 === 0) {
  1252. return "even";
  1253. } else if (rowIndex % 2 !== 0) {
  1254. return "odd";
  1255. }
  1256. return "";
  1257. };
  1258. // 时段设置分页
  1259. const handleCurrentChange = (value) => {
  1260. // console.log(value);
  1261. currentPage.value = value;
  1262. getList(themeIndex.value);
  1263. };
  1264. // 时段管理分页
  1265. const handleCurrentChange2 = (value) => {
  1266. // console.log(value);
  1267. currentPage2.value = value;
  1268. getList(themeIndex.value);
  1269. };
  1270. // const handleCurrentChange3 = (value) => {
  1271. // // console.log(value);
  1272. // currentPage3.value = value;
  1273. // getList(themeIndex.value);
  1274. // };
  1275. onBeforeMount(async () => {
  1276. api.value = store.state.user.api;
  1277. schoolId.value = sessionStorage.getItem("schoolId");
  1278. getList(themeIndex.value);
  1279. let data = {
  1280. currentPage: currentPage.value,
  1281. pageCount: pageSize.value,
  1282. // name: "时段设置",
  1283. };
  1284. let res = await axios({
  1285. method: "get",
  1286. url: api.value + "/repairShiftSettings/queryPageRepairShiftSettings",
  1287. headers: {
  1288. token: sessionStorage.getItem("token"),
  1289. user_head: sessionStorage.getItem("userhead"),
  1290. },
  1291. params: data,
  1292. });
  1293. console.log(res, "添加时段选择数据");
  1294. addClassList.value = res.data.data.list;
  1295. });
  1296. onUnmounted(() => { });
  1297. </script>
  1298. <style scoped lang="scss">
  1299. .content-box {
  1300. width: 97.5%;
  1301. height: 89%;
  1302. margin: 20px auto;
  1303. background-color: #fff;
  1304. color: #fff;
  1305. display: flex;
  1306. flex-direction: column;
  1307. box-shadow: 0px 3px 10px rgba(213, 228, 252, 1);
  1308. .left {
  1309. // width: calc(100wh - 40px);
  1310. display: flex;
  1311. align-items: center;
  1312. height: 60px;
  1313. margin: 0 30px;
  1314. border-bottom: 1px solid #ccc;
  1315. color: rgb(0, 0, 0);
  1316. font-size: 18px;
  1317. font-weight: 600;
  1318. user-select: none;
  1319. span {
  1320. height: 60px;
  1321. line-height: 60px;
  1322. margin-right: 20px;
  1323. cursor: pointer;
  1324. }
  1325. .is_active {
  1326. color: rgba(111, 182, 184, 1);
  1327. }
  1328. }
  1329. .middle {
  1330. width: 96%;
  1331. margin: 0 auto;
  1332. color: #000;
  1333. // border-bottom: 1px solid rgb(231, 231, 231);
  1334. .filter {
  1335. display: flex;
  1336. flex-wrap: wrap;
  1337. align-items: center;
  1338. margin: 10px 0 0 0;
  1339. .search {
  1340. color: #fff;
  1341. }
  1342. .condition {
  1343. display: flex;
  1344. align-items: center;
  1345. margin: 10px 30px 10px 0;
  1346. :deep(.el-input .el-input__inner) {
  1347. font-size: 16px;
  1348. }
  1349. span {
  1350. margin: 0 10px 0 0;
  1351. }
  1352. }
  1353. }
  1354. .gongneng {
  1355. margin: 10px 0 15px 0;
  1356. display: flex;
  1357. .avatar-uploader {
  1358. margin: 0 10px;
  1359. :deep(.el-upload-list) {
  1360. display: none;
  1361. }
  1362. }
  1363. span {
  1364. color: #fff;
  1365. }
  1366. }
  1367. :deep(.cont) {
  1368. width: 60%;
  1369. margin: 20px auto;
  1370. }
  1371. :deep(.download) {
  1372. display: flex;
  1373. align-items: center;
  1374. margin: 10px;
  1375. }
  1376. :deep(.download span) {
  1377. font-size: 16px;
  1378. margin-left: 20px;
  1379. }
  1380. :deep(.cont .el-button) {
  1381. margin-left: 60px;
  1382. margin-bottom: 30px;
  1383. }
  1384. :deep(.cont .accomplish) {
  1385. width: 100%;
  1386. display: flex;
  1387. justify-content: center;
  1388. }
  1389. :deep(.cont .accomplish .el-button) {
  1390. width: 50%;
  1391. margin: 0;
  1392. }
  1393. }
  1394. .footer {
  1395. width: 96%;
  1396. height: 550px;
  1397. margin: 10px auto 30px;
  1398. .el-table--fit {
  1399. height: 100%;
  1400. :deep(.el-table__header-wrapper) {
  1401. background-color: #000;
  1402. font-size: 16px;
  1403. tr {
  1404. color: #000;
  1405. }
  1406. }
  1407. :deep(.el-table__row) {
  1408. height: 50px;
  1409. font-size: 16px;
  1410. color: #000;
  1411. }
  1412. :deep(.el-table__row):nth-child(2n) {
  1413. .el-table-fixed-column--left {
  1414. background-color: rgba(240, 243, 247, 1);
  1415. }
  1416. }
  1417. :deep(.el-table__row td) {
  1418. padding: 0;
  1419. border: 0;
  1420. }
  1421. .el-button--primary {
  1422. margin-left: 5px;
  1423. }
  1424. :deep(.el-table__body .even) {
  1425. background-color: #fff;
  1426. }
  1427. :deep(.el-table__body .odd) {
  1428. background-color: rgba(240, 243, 247, 1);
  1429. }
  1430. :deep(.edit) {
  1431. display: flex;
  1432. align-items: center;
  1433. justify-content: center;
  1434. color: rgba(111, 182, 184, 1);
  1435. }
  1436. :deep(.look) {
  1437. padding: 0 10px;
  1438. cursor: pointer;
  1439. }
  1440. :deep(.look):hover {
  1441. color: red;
  1442. }
  1443. .el-table__row {
  1444. //添加班次 周一到周日样式
  1445. .word {
  1446. color: rgba(111, 182, 184, 1);
  1447. cursor: pointer;
  1448. .classItem {
  1449. display: flex;
  1450. justify-content: center;
  1451. align-items: center;
  1452. .del {
  1453. display: flex;
  1454. justify-content: center;
  1455. align-items: center;
  1456. margin-left: 5px;
  1457. }
  1458. .el-button {
  1459. color: #fff;
  1460. }
  1461. .classX {
  1462. width: 25px;
  1463. height: 25px;
  1464. img {
  1465. width: 25px;
  1466. height: 25px;
  1467. margin-left: 2px;
  1468. }
  1469. }
  1470. .bottom {
  1471. img {
  1472. width: 15px;
  1473. height: 8px;
  1474. margin-left: 10px;
  1475. }
  1476. }
  1477. }
  1478. }
  1479. .word span:hover {
  1480. color: red;
  1481. }
  1482. }
  1483. }
  1484. // 添加时段弹窗样式
  1485. :deep(.addStaff) {
  1486. // height: 420px;
  1487. border-radius: 11px;
  1488. user-select: none;
  1489. .el-dialog__header {
  1490. border-radius: 11px 11px 0 0;
  1491. background: rgba(237, 241, 245, 1);
  1492. font-weight: 600;
  1493. margin: 0;
  1494. .el-dialog__headerbtn {
  1495. outline: none;
  1496. }
  1497. }
  1498. .el-dialog__body {
  1499. padding: 30px 20px 10px 20px;
  1500. .el-input {
  1501. width: 200px;
  1502. }
  1503. .el-form-item__content {
  1504. // 非工作时间样式
  1505. .noworkTime {
  1506. display: flex;
  1507. align-items: center;
  1508. margin-bottom: 3px;
  1509. img {
  1510. width: 20px;
  1511. height: 20px;
  1512. margin-left: 10px;
  1513. display: inline-block;
  1514. cursor: pointer;
  1515. }
  1516. }
  1517. .colorSelect {
  1518. width: 200px;
  1519. ul {
  1520. list-style: none;
  1521. display: flex;
  1522. flex-wrap: wrap;
  1523. padding: 0;
  1524. margin: 0;
  1525. li {
  1526. border: 1px solid transparent;
  1527. margin: 4px 10px 0px 0;
  1528. border-radius: 5px;
  1529. .item {
  1530. width: 35px;
  1531. height: 22px;
  1532. border-radius: 5px;
  1533. background: #000;
  1534. cursor: pointer;
  1535. margin: 1px;
  1536. img {
  1537. width: 12px;
  1538. height: 12px;
  1539. position: relative;
  1540. right: -22px;
  1541. }
  1542. }
  1543. .item1 {
  1544. background-color: rgba(240, 116, 89, 1);
  1545. }
  1546. .item2 {
  1547. background-color: rgb(187, 99, 99, 1);
  1548. }
  1549. .item3 {
  1550. background-color: rgba(90, 224, 144, 1);
  1551. }
  1552. .item4 {
  1553. background-color: rgba(103, 158, 230, 1);
  1554. }
  1555. .item5 {
  1556. background-color: rgba(240, 170, 101, 1);
  1557. }
  1558. .item6 {
  1559. background-color: rgba(240, 211, 117, 1);
  1560. }
  1561. .item7 {
  1562. background-color: rgba(103, 214, 207, 1);
  1563. }
  1564. .item8 {
  1565. background-color: rgba(204, 130, 217, 1);
  1566. }
  1567. }
  1568. // li:hover {
  1569. // border: 1px solid rgba(30, 125, 251, 1);
  1570. // }
  1571. .li_active {
  1572. border: 1px solid rgba(30, 125, 251, 1);
  1573. }
  1574. }
  1575. }
  1576. .el-checkbox-group {
  1577. display: flex;
  1578. flex-direction: column;
  1579. }
  1580. }
  1581. .checkbox {
  1582. .el-form-item__content {
  1583. display: flex;
  1584. flex-direction: column;
  1585. align-items: flex-start;
  1586. .noworkTime {
  1587. border: 1px solid red;
  1588. img {
  1589. width: 16px;
  1590. height: 16px;
  1591. display: inline-block;
  1592. }
  1593. }
  1594. .el-checkbox-group {
  1595. display: flex;
  1596. flex-direction: column;
  1597. }
  1598. }
  1599. }
  1600. .options {
  1601. .el-form-item__content {
  1602. .queding {
  1603. margin-left: 20px;
  1604. color: #fff;
  1605. }
  1606. display: flex;
  1607. flex-direction: row-reverse;
  1608. }
  1609. }
  1610. }
  1611. }
  1612. // 添加员工弹窗样式
  1613. :deep(.addStaff2) {
  1614. // height: 420px;
  1615. border-radius: 11px;
  1616. .el-dialog__header {
  1617. border-radius: 11px 11px 0 0;
  1618. background: rgba(237, 241, 245, 1);
  1619. font-weight: 600;
  1620. margin: 0;
  1621. .el-dialog__headerbtn {
  1622. outline: none;
  1623. }
  1624. }
  1625. .el-dialog__body {
  1626. padding: 0 20px 10px 20px;
  1627. .middle {
  1628. width: 100%;
  1629. }
  1630. .footer {
  1631. width: 100%;
  1632. margin: 10px auto;
  1633. .el-table--fit {
  1634. height: 450px;
  1635. .el-table__header {
  1636. th:last-child {
  1637. .cell {
  1638. display: flex;
  1639. justify-content: center;
  1640. }
  1641. }
  1642. }
  1643. .el-table__row {
  1644. .cell {
  1645. display: flex;
  1646. justify-content: center;
  1647. }
  1648. }
  1649. }
  1650. .pageSize {
  1651. margin: 0;
  1652. padding: 20px 0;
  1653. border-bottom: 1px solid #ccc;
  1654. }
  1655. }
  1656. .options {
  1657. margin: 15px 0 10px 0;
  1658. .queding {
  1659. margin-left: 20px;
  1660. color: #fff;
  1661. }
  1662. display: flex;
  1663. flex-direction: row-reverse;
  1664. }
  1665. }
  1666. }
  1667. // 添加员工弹窗样式
  1668. :deep(.addClass) {
  1669. // height: 420px;
  1670. border-radius: 11px;
  1671. .el-dialog__header {
  1672. border-radius: 11px 11px 0 0;
  1673. background: rgba(237, 241, 245, 1);
  1674. font-weight: 600;
  1675. margin: 0;
  1676. .el-dialog__headerbtn {
  1677. outline: none;
  1678. }
  1679. }
  1680. .el-dialog__body {
  1681. padding: 20px 20px 10px 20px;
  1682. .el-input {
  1683. width: 200px;
  1684. }
  1685. .el-form {
  1686. .el-form-item__content {
  1687. margin-left: 22px !important;
  1688. }
  1689. }
  1690. .el-form-item__content {
  1691. // 非工作时间样式
  1692. .noworkTime {
  1693. display: flex;
  1694. align-items: center;
  1695. img {
  1696. width: 20px;
  1697. height: 20px;
  1698. margin-left: 10px;
  1699. display: inline-block;
  1700. cursor: pointer;
  1701. }
  1702. }
  1703. .colorSelect {
  1704. width: 200px;
  1705. ul {
  1706. list-style: none;
  1707. display: flex;
  1708. flex-wrap: wrap;
  1709. padding: 0;
  1710. margin: 0;
  1711. li {
  1712. border: 1px solid transparent;
  1713. margin: 4px 10px 0px 0;
  1714. border-radius: 5px;
  1715. .item {
  1716. width: 35px;
  1717. height: 22px;
  1718. border-radius: 5px;
  1719. background: #000;
  1720. cursor: pointer;
  1721. margin: 1px;
  1722. img {
  1723. width: 12px;
  1724. height: 12px;
  1725. position: relative;
  1726. right: -22px;
  1727. }
  1728. }
  1729. .item1 {
  1730. background-color: rgba(240, 116, 89, 1);
  1731. }
  1732. .item2 {
  1733. background-color: rgb(187, 99, 99, 1);
  1734. }
  1735. .item3 {
  1736. background-color: rgba(90, 224, 144, 1);
  1737. }
  1738. .item4 {
  1739. background-color: rgba(103, 158, 230, 1);
  1740. }
  1741. .item5 {
  1742. background-color: rgba(240, 170, 101, 1);
  1743. }
  1744. .item6 {
  1745. background-color: rgba(240, 211, 117, 1);
  1746. }
  1747. .item7 {
  1748. background-color: rgba(103, 214, 207, 1);
  1749. }
  1750. .item8 {
  1751. background-color: rgba(204, 130, 217, 1);
  1752. }
  1753. }
  1754. li:hover {
  1755. border: 1px solid rgba(30, 125, 251, 1);
  1756. }
  1757. }
  1758. }
  1759. .el-checkbox-group {
  1760. display: flex;
  1761. flex-direction: column;
  1762. }
  1763. }
  1764. .checkbox {
  1765. .el-form-item__content {
  1766. display: flex;
  1767. flex-direction: column;
  1768. align-items: flex-start;
  1769. .noworkTime {
  1770. border: 1px solid red;
  1771. img {
  1772. width: 16px;
  1773. height: 16px;
  1774. display: inline-block;
  1775. }
  1776. }
  1777. .el-checkbox-group {
  1778. display: flex;
  1779. flex-direction: column;
  1780. }
  1781. }
  1782. }
  1783. .options {
  1784. .el-form-item__content {
  1785. .queding {
  1786. margin-left: 20px;
  1787. color: #fff;
  1788. }
  1789. display: flex;
  1790. flex-direction: row-reverse;
  1791. }
  1792. }
  1793. }
  1794. }
  1795. // 导入弹窗样式
  1796. :deep(.importXlsx) {
  1797. // height: 420px;
  1798. border-radius: 11px;
  1799. .el-dialog__header {
  1800. border-radius: 11px 11px 0 0;
  1801. background: rgba(237, 241, 245, 1);
  1802. font-weight: 600;
  1803. margin: 0;
  1804. .el-dialog__headerbtn {
  1805. outline: none;
  1806. }
  1807. }
  1808. .el-dialog__body {
  1809. padding: 20px 20px 10px 20px;
  1810. .options {
  1811. margin: 15px 0;
  1812. .queding {
  1813. margin-left: 20px;
  1814. color: #fff;
  1815. }
  1816. display: flex;
  1817. flex-direction: row-reverse;
  1818. }
  1819. }
  1820. }
  1821. }
  1822. .footers {
  1823. :deep(.el-table__row) {
  1824. height: 50px;
  1825. font-size: 16px;
  1826. color: #000;
  1827. td:nth-of-type(n + 3) {
  1828. .cell {
  1829. display: flex;
  1830. justify-content: right;
  1831. .word {
  1832. width: 280px;
  1833. .classItem {
  1834. justify-content: left;
  1835. flex-wrap: wrap;
  1836. .del {
  1837. margin: 4px 3px;
  1838. }
  1839. }
  1840. }
  1841. }
  1842. }
  1843. }
  1844. }
  1845. .pageSize {
  1846. display: flex;
  1847. align-items: center;
  1848. justify-content: space-between;
  1849. margin: 0 30px;
  1850. span {
  1851. color: #000;
  1852. }
  1853. .el-pagination {
  1854. // width: 1600px;
  1855. :deep(.el-pagination__total) {
  1856. color: #000;
  1857. }
  1858. :deep(.el-pagination__goto) {
  1859. color: #000;
  1860. }
  1861. :deep(.el-pagination__classifier) {
  1862. color: #000;
  1863. }
  1864. :deep(.el-input__wrapper) {
  1865. border: 1px solid rgba(0, 0, 0, 1);
  1866. border-radius: 5px;
  1867. box-shadow: none;
  1868. }
  1869. :deep(.el-pager li) {
  1870. margin: 0 5px;
  1871. border: 1px solid rgba(0, 0, 0, 1);
  1872. border-radius: 5px;
  1873. background-color: transparent;
  1874. }
  1875. :deep(.el-pager li.is-active) {
  1876. background-color: rgba(111, 182, 184, 1);
  1877. }
  1878. :deep(.btn-prev) {
  1879. margin-right: 5px;
  1880. border: 1px solid rgba(0, 0, 0, 1);
  1881. border-radius: 5px;
  1882. background-color: transparent;
  1883. }
  1884. :deep(.btn-next) {
  1885. margin-left: 5px;
  1886. border: 1px solid rgba(0, 0, 0, 1);
  1887. border-radius: 5px;
  1888. background-color: transparent;
  1889. }
  1890. }
  1891. }
  1892. }
  1893. .el-input {
  1894. width: 192px;
  1895. }
  1896. </style>