PersonalCenter.vue.orig 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  1. <template>
  2. <div class="news">
  3. <div class="center-banner">
  4. <div class="content">
  5. <div class="user">
  6. <img v-if="userInfo.avatar" :src="userInfo.avatar" />
  7. <img v-else src="../assets/img/default-avatar.png">
  8. <p>
  9. <span>Hi~{{ userInfo.nickName }}</span>
  10. <span>{{ userInfo.roleNames }}</span>
  11. <span>{{ userInfo.pgName || '未加入课题组' }}</span>
  12. </p>
  13. </div>
  14. <div class="btns">
  15. <p>安全积分:<span>100</span></p>
  16. <el-button size="medium"
  17. round>个人设置</el-button>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="common-container">
  22. <el-container>
  23. <div class="left-tabs">
  24. <h4>个人中心</h4>
  25. <ul>
  26. <li
  27. v-for="(item, index) in options"
  28. :key="index"
  29. :class="{ active: index === active }"
  30. @click="tabSelect(item, index)"
  31. >
  32. {{ item.label }}
  33. </li>
  34. </ul>
  35. </div>
  36. <div v-show="active === 0" class="w100">
  37. <el-row class="flex mt12" :gutter="12">
  38. <el-col :span="12">
  39. <el-card>
  40. <div slot="header" class="header">
  41. <h4>科研仪器</h4>
  42. </div>
  43. <ul class="cage-list">
  44. <li v-for="v in instrList" :key="v.id">
  45. <header>
  46. <p>{{ v.instName }}</p>
  47. <el-tag
  48. v-if="v.instStatus == '10'"
  49. type="primary"
  50. size="mini"
  51. >
  52. 正常
  53. </el-tag>
  54. <el-tag
  55. v-else-if="v.instStatus == '20'"
  56. type="warning"
  57. size="mini"
  58. >
  59. 故障
  60. </el-tag>
  61. <el-tag
  62. v-else-if="v.instStatus == '30'"
  63. type="danger"
  64. size="mini"
  65. >
  66. 报废
  67. </el-tag>
  68. </header>
  69. <p>型号:{{ v.instNameEn }}</p>
  70. <p>仪器负责人:{{ v.instHeadName }}</p>
  71. </li>
  72. </ul>
  73. </el-card>
  74. </el-col>
  75. <el-col :span="12">
  76. <el-card header="通知公告">
  77. <div slot="header" class="header">
  78. <h4>通知公告</h4>
  79. </div>
  80. <div class="link-list">
  81. <ul>
  82. <li v-for="item in noticeList" :key="item.id">
  83. <div>
  84. {{ item.noticeTitle }}
  85. </div>
  86. <span>{{ item.noticeTime.split(" ")[0] }}</span>
  87. </li>
  88. </ul>
  89. </div>
  90. </el-card>
  91. </el-col>
  92. </el-row>
  93. <el-row class="flex mt12" :gutter="12">
  94. <el-col :span="12">
  95. <el-card>
  96. <div slot="header" class="header">
  97. <h4>科研平台</h4>
  98. </div>
  99. <ul class="platform-list">
  100. <li>
  101. <div class="text">
  102. <header>
  103. <p>分子生物平台</p>
  104. <span>单价:¥100/小时</span>
  105. </header>
  106. <p>位置:7栋6层-分子生物平台中心-12号终端</p>
  107. <p>有效时间:1月1日 12:00 -- 1月15日 12:00</p>
  108. </div>
  109. <div class="btn">
  110. <header>
  111. <p>剩余时长</p>
  112. <p class="remain-time">2天18小时</p>
  113. </header>
  114. 小计:¥300
  115. </div>
  116. </li>
  117. <li>
  118. <div class="text">
  119. <header>
  120. <p>分子生物平台</p>
  121. <span>单价:¥100/小时</span>
  122. </header>
  123. <p>位置:7栋6层-分子生物平台中心-12号终端</p>
  124. <p>有效时间:1月1日 12:00 -- 1月15日 12:00</p>
  125. </div>
  126. <div class="btn">
  127. <header>
  128. <p>剩余时长</p>
  129. <p class="remain-time">2天18小时</p>
  130. </header>
  131. 小计:¥300
  132. </div>
  133. </li>
  134. </ul>
  135. </el-card>
  136. <el-card class="mt12">
  137. <div slot="header" class="header">
  138. <h4>笼位管理(共3个)</h4>
  139. </div>
  140. <ul class="cage-list">
  141. <li>
  142. <header>
  143. <p>实验用小鼠-3只</p>
  144. <el-tag type="primary" size="mini">正常</el-tag>
  145. </header>
  146. <p>位置:7栋6层-602室 4区12号架 8号笼</p>
  147. <p>到期时间:2月1日(剩余10天)</p>
  148. </li>
  149. <li>
  150. <header>
  151. <p>实验用小鼠-3只-笼位申请</p>
  152. <el-tag type="warning" size="mini">待分配</el-tag>
  153. </header>
  154. <p>位置:待分配</p>
  155. <p>申请时间:2月1日</p>
  156. </li>
  157. <li>
  158. <header>
  159. <p>实验用小鼠-3只</p>
  160. <el-tag type="primary" size="mini">正常</el-tag>
  161. </header>
  162. <p>位置:7栋6层-602室 4区12号架 8号笼</p>
  163. <p>到期时间:2月1日(剩余10天)</p>
  164. </li>
  165. </ul>
  166. </el-card>
  167. </el-col>
  168. <el-col :span="12">
  169. <el-card class="calendar">
  170. <div slot="header" class="header">
  171. <h4>日程安排</h4>
  172. </div>
  173. <FullCalendar
  174. class="fullCalendar"
  175. ref="fullCalendar"
  176. :options="calendarOptions"
  177. />
  178. <ul>
  179. <li>仪器:需要进行第二期临床实验使用仪器</li>
  180. <li>平台:需要使用平台查找相应的案例</li>
  181. <li>笼位:进行第二次动物实验</li>
  182. <li>技术:约李老师进行第三次技术咨询</li>
  183. </ul>
  184. </el-card>
  185. <el-card class="mt12 cost">
  186. <div slot="header" class="header">
  187. <h4>费用统计</h4>
  188. </div>
  189. <div class="chart-container">
  190. <div class="text">
  191. <header>课题组:人血球免疫蛋白应用研究课题组</header>
  192. <ul>
  193. <li>费用账单:6条待确认</li>
  194. <li>本月支出:¥567.89</li>
  195. <li>累计支出:¥1234.56</li>
  196. </ul>
  197. </div>
  198. <div id="chart"></div>
  199. </div>
  200. </el-card>
  201. </el-col>
  202. </el-row>
  203. <el-row class="flex mt12 technical" :gutter="12">
  204. <el-col :span="24">
  205. <el-card>
  206. <div slot="header" class="header">
  207. <h4>技术服务</h4>
  208. </div>
  209. <p>技术服务 - No.123456 - 李老师</p>
  210. <ul>
  211. <li>11-20:委托发起</li>
  212. <li>11-21:项目确定</li>
  213. <li>11-23:项目开始</li>
  214. <li>11-23:阶段性结果</li>
  215. <li>当前:结尾验收</li>
  216. <li>费用结算</li>
  217. <li>结果上传</li>
  218. </ul>
  219. <p>技术服务 - No.123456 - 李老师</p>
  220. <ul>
  221. <li>11-20:委托发起</li>
  222. <li>11-21:项目确定</li>
  223. <li>11-23:项目开始</li>
  224. <li>11-23:阶段性结果</li>
  225. <li>当前:结尾验收</li>
  226. <li>费用结算</li>
  227. <li>结果上传</li>
  228. </ul>
  229. </el-card>
  230. </el-col>
  231. </el-row>
  232. </div>
  233. <div v-show="active === 1" class="w100">
  234. <el-card>
  235. <div class="toolbar-wrap">
  236. <div class="switch-date">
  237. <div
  238. class="btn day"
  239. :class="curSelectedDate == 'd' ? 'actived' : ''"
  240. @click="selectDate('d')"
  241. >
  242. </div>
  243. <div
  244. class="btn week"
  245. :class="curSelectedDate == 'w' ? 'actived' : ''"
  246. @click="selectDate('w')"
  247. >
  248. </div>
  249. <div
  250. class="btn month"
  251. :class="curSelectedDate == 'm' ? 'actived' : ''"
  252. @click="selectDate('m')"
  253. >
  254. </div>
  255. </div>
  256. <div class="date-wrap">
  257. <div class="prev" @click="handlePrev">
  258. <el-button icon="el-icon-arrow-left" size="small" circle />
  259. </div>
  260. <div class="date">
  261. <el-popover
  262. :width="200"
  263. placement="top-start"
  264. trigger="click"
  265. >
  266. <div slot="reference">
  267. <span class="time">{{ curTime }}</span>
  268. </div>
  269. <el-date-picker
  270. @change="getAppointList"
  271. style="width: 100%"
  272. v-model="curTime"
  273. type="date"
  274. placeholder="选择日期"
  275. value-format="yyyy-MM-dd"
  276. :clearable="false"
  277. />
  278. </el-popover>
  279. <span class="week">{{ WEEKS[moment(curTime).day()] }}</span>
  280. </div>
  281. <div class="next" @click="handleNext">
  282. <el-button icon="el-icon-arrow-right" size="small" circle />
  283. </div>
  284. </div>
  285. </div>
  286. <div class="table-wrap">
  287. <el-table
  288. :data="appointData"
  289. border
  290. height="500"
  291. style="width: 922px"
  292. >
  293. <el-table-column
  294. type="index"
  295. width="50"
  296. align="center"
  297. ></el-table-column>
  298. <el-table-column
  299. prop="instName"
  300. label="仪器名称"
  301. min-width="160"
  302. />
  303. <el-table-column
  304. prop="projectName"
  305. label="课题组/服务"
  306. min-width="160"
  307. >
  308. <template #default="{ row }">
  309. <span v-if="row.projectName">{{ row.projectName }}</span>
  310. <span v-else>{{ row.serviceName }}</span>
  311. </template>
  312. </el-table-column>
  313. <el-table-column prop="startTime" label="开始时间" width="160">
  314. <template #default="{ row }">
  315. {{ parseTime(row.startTime, "{y}-{m}-{d} {h}:{i}") }}
  316. </template>
  317. </el-table-column>
  318. <el-table-column prop="endTime" label="结束时间" width="160">
  319. <template #default="{ row }">
  320. {{ parseTime(row.endTime, "{y}-{m}-{d} {h}:{i}") }}
  321. </template>
  322. </el-table-column>
  323. <el-table-column prop="userName" label="预约人" width="140" />
  324. <el-table-column
  325. prop="userContact"
  326. label="联系方式"
  327. width="160"
  328. />
  329. <el-table-column
  330. prop="appointStatus"
  331. label="预约状态"
  332. width="160"
  333. >
  334. <template #default="{ row }">
  335. {{ setStatus(row.appointStatus) }}
  336. </template>
  337. </el-table-column>
  338. <el-table-column
  339. prop="appointStatus"
  340. label="违约情况"
  341. width="160"
  342. >
  343. <template #default="{ row }">
  344. {{ getBreachTypes(row) }}
  345. </template>
  346. </el-table-column>
  347. <el-table-column
  348. prop="breachScore"
  349. label="扣分明细"
  350. width="160"
  351. >
  352. <template #default="{ row }">
  353. <span>{{ row.breachScore }}分</span>
  354. </template>
  355. </el-table-column>
  356. <el-table-column label="操作" fixed="right" width="100">
  357. <template #default="{ row }">
  358. <el-button
  359. type="text"
  360. v-if="row.appointStatus == '10'"
  361. @click="handleEditAppoint(row)"
  362. text
  363. >
  364. 编辑
  365. </el-button>
  366. <el-button
  367. type="text"
  368. style="color: #f56c6c"
  369. v-if="
  370. row.appointStatus == '10' || row.appointStatus == '20'
  371. "
  372. @click="cancelAppoint(row)"
  373. text
  374. >
  375. 取消
  376. </el-button>
  377. </template>
  378. </el-table-column>
  379. </el-table>
  380. </div>
  381. <div class="pagination">
  382. <el-pagination
  383. background
  384. @size-change="handleSizeChange"
  385. @current-change="handleCurrentChange"
  386. :current-page="searchForm.pageNum"
  387. :page-sizes="[10, 50, 100]"
  388. :page-size="searchForm.pageSize"
  389. layout="total, sizes, prev, pager, next, jumper"
  390. :total="total"
  391. ></el-pagination>
  392. </div>
  393. </el-card>
  394. </div>
  395. </el-container>
  396. </div>
  397. <<<<<<< Updated upstream
  398. <PersonalInfoDialog ref="personalInfoDialogRef" />
  399. =======
  400. <AppointCreate
  401. ref="appointCreateRef"
  402. @refresh="
  403. searchForm.pageNum = 1;
  404. getAppointList();
  405. "
  406. ></AppointCreate>
  407. >>>>>>> Stashed changes
  408. </div>
  409. </template>
  410. <script>
  411. <<<<<<< Updated upstream
  412. import Banner from "../components/Banner";
  413. import LeftTabs from "@/components/LeftTabs";
  414. import RightContent from "@/components/RightContent";
  415. import * as echarts from "echarts";
  416. import FullCalendar from "@fullcalendar/vue";
  417. import dayGridPlugin from "@fullcalendar/daygrid";
  418. import interactionPlugin from "@fullcalendar/interaction";
  419. import { getNoticeList } from "@/api/login";
  420. import {
  421. getInstrList,
  422. getInstrListByUser,
  423. userCancelAppoint,
  424. cancelAppoint,
  425. } from "@/api/instr";
  426. import moment from "moment";
  427. import to from "await-to-js";
  428. import { mapGetters } from "vuex";
  429. import PersonalInfoDialog from "@/components/PersonalInfo";
  430. export default {
  431. name: "PersonalCenter",
  432. components: {
  433. Banner,
  434. LeftTabs,
  435. RightContent,
  436. FullCalendar,
  437. PersonalInfoDialog,
  438. },
  439. computed: {
  440. ...mapGetters(["userInfo"]),
  441. },
  442. data() {
  443. return {
  444. active: -1,
  445. loading: true,
  446. selectTab: {},
  447. options: [
  448. {
  449. label: "工作台",
  450. },
  451. {
  452. label: "预约信息",
  453. },
  454. ],
  455. routeList: [
  456. {
  457. name: "首页",
  458. path: "/",
  459. },
  460. {
  461. name: "个人中心",
  462. },
  463. ],
  464. breadList: [],
  465. calendarOptions: {
  466. height: 300,
  467. plugins: [dayGridPlugin, interactionPlugin], // 需要用哪个插件引入后放到这个数组里
  468. initialDate: new Date(), // 日历第一次加载时显示的初始日期。可以解析为Date的任何职包括ISO8601日期字符串,例如"2014-02-01"。
  469. initialView: "dayGridMonth", // 日历加载时的初始视图,默认值为'dayGridMonth',可以为任何可用视图的值,如例如'dayGridWeek','timeGridDay','listWeek'
  470. locale: "zh-cn", // 设置日历的语言,中文为 “zh-cn”
  471. firstDay: "1", // 设置每周的第一天,默认值取决于当前语言环境,该值为代表星期几的数字,且值必须为整数,星期日=0
  472. weekNumberCalculation: "ISO", // 指定"ISO"结果为ISO8601周数。指定"ISO"将firstDay的默认值更改为1(Monday)
  473. buttonText: {
  474. // 文本将显示在headerToolbar / footerToolbar的按钮上。不支持HTML注入。所有特殊字符将被转义。
  475. today: "今天",
  476. month: "月",
  477. week: "周",
  478. day: "天",
  479. },
  480. headerToolbar: {
  481. // 在日历顶部定义按钮和标题。将headerToolbar选项设置为false不会显示任何标题工具栏。可以为对象提供属性start/center/end或left/center/right。这些属性包含带有逗号/空格分隔值的字符串。用逗号分隔的值将相邻显示。用空格分隔的值之间会显示一个很小的间隙。
  482. right: "today prev,next",
  483. center: "title",
  484. left: "dayGridMonth,dayGridWeek,dayGridDay",
  485. },
  486. eventTimeFormat: {
  487. // 在每个事件上显示的时间的格式
  488. hour: "numeric",
  489. minute: "2-digit",
  490. hour12: false,
  491. },
  492. events: [],
  493. dateClick: this.handleDateClick, // 当用户单击日期或时间时,触发该回调,触发此回调,您必须加载interaction插件
  494. },
  495. instrList: [],
  496. noticeList: [],
  497. curSelectedDate: "",
  498. curTime: "",
  499. appointData: [],
  500. WEEKS: [
  501. "星期日",
  502. "星期一",
  503. "星期二",
  504. "星期三",
  505. "星期四",
  506. "星期五",
  507. "星期六",
  508. ],
  509. };
  510. },
  511. mounted() {
  512. this.tabSelect(this.options[0], 0);
  513. this.curTime = this.getToday();
  514. this.initChart();
  515. this.getNotice();
  516. this.getInstr();
  517. },
  518. methods: {
  519. moment,
  520. // 獲取當前日期
  521. getToday() {
  522. return moment(moment().startOf("day").valueOf()).format("YYYY-MM-DD");
  523. =======
  524. import Banner from "../components/Banner";
  525. import LeftTabs from "@/components/LeftTabs";
  526. import RightContent from "@/components/RightContent";
  527. import * as echarts from "echarts";
  528. import FullCalendar from "@fullcalendar/vue";
  529. import dayGridPlugin from "@fullcalendar/daygrid";
  530. import interactionPlugin from "@fullcalendar/interaction";
  531. import { getNoticeList } from "@/api/login";
  532. import {
  533. getInstrList,
  534. getInstrListByUser,
  535. userCancelAppoint,
  536. } from "@/api/instr";
  537. import { mapGetters } from "vuex";
  538. import moment from "moment";
  539. import to from "await-to-js";
  540. import { getToken } from "@/utils/auth";
  541. import AppointCreate from "./equipment/components/appoint-create.vue";
  542. export default {
  543. name: "PersonalCenter",
  544. components: {
  545. Banner,
  546. LeftTabs,
  547. RightContent,
  548. FullCalendar,
  549. AppointCreate,
  550. >>>>>>> Stashed changes
  551. },
  552. <<<<<<< Updated upstream
  553. // 获取下一周的周一0点
  554. var startOfNextWeek = moment(this.curTime)
  555. .startOf("isoWeek")
  556. .add(1, "weeks")
  557. .format("YYYY-MM-DD HH:mm:ss");
  558. return [startOfWeek, startOfNextWeek];
  559. },
  560. getMonthDate() {
  561. const date = moment(this.curTime);
  562. // 获取当前月份的最后一天
  563. return [
  564. date.startOf("month").format("YYYY-MM-DD HH:mm:ss"),
  565. date.endOf("month").add(1, "days").format("YYYY-MM-DD") + " 00:00:00",
  566. ];
  567. },
  568. // 上一周、天、月
  569. handlePrev() {
  570. if (this.curSelectedDate == "d") {
  571. this.getYesterday();
  572. } else if (this.curSelectedDate == "w") {
  573. this.getPrevWeekDays();
  574. } else if (this.curSelectedDate == "m") {
  575. this.getPrevMonthDays();
  576. }
  577. this.getAppointList();
  578. },
  579. // 下一周、天、月
  580. handleNext() {
  581. if (this.curSelectedDate == "d") {
  582. this.getTomorrow();
  583. } else if (this.curSelectedDate == "w") {
  584. this.getNextWeekDays();
  585. } else if (this.curSelectedDate == "m") {
  586. this.getNextMonthDays();
  587. }
  588. this.getAppointList();
  589. },
  590. selectDate(date) {
  591. this.curSelectedDate = date;
  592. this.getAppointList();
  593. },
  594. async getAppointList() {
  595. let startTimeStart = "";
  596. let startTimeEnd = "";
  597. if (this.curSelectedDate == "d") {
  598. startTimeStart = moment(this.curTime).format("YYYY-MM-DD HH:mm:ss");
  599. startTimeEnd = moment(this.curTime)
  600. .add(1, "days")
  601. .format("YYYY-MM-DD HH:mm:ss");
  602. } else if (this.curSelectedDate == "w") {
  603. startTimeStart = this.getWeekDate()[0];
  604. startTimeEnd = this.getWeekDate()[1];
  605. } else if (this.curSelectedDate == "m") {
  606. startTimeStart = moment(this.curTime)
  607. .startOf("month")
  608. .format("YYYY-MM-DD HH:mm:ss");
  609. startTimeEnd = this.getMonthDate()[1];
  610. }
  611. const [err, res] = await to(
  612. getInstrListByUser({ startTimeStart, startTimeEnd })
  613. );
  614. if (err) return;
  615. this.appointData = res.data.list;
  616. },
  617. setStatus(key) {
  618. let str = "";
  619. switch (key) {
  620. case "10":
  621. str = "待审核";
  622. break;
  623. case "11":
  624. str = "已退回";
  625. break;
  626. case "20":
  627. str = "已通过";
  628. break;
  629. case "30":
  630. str = "已驳回";
  631. break;
  632. case "40":
  633. str = "已取消";
  634. break;
  635. case "50":
  636. str = "已上机";
  637. break;
  638. case "60":
  639. str = "已完成";
  640. break;
  641. case "70":
  642. str = "审核超时";
  643. break;
  644. case "80":
  645. str = "超时取消";
  646. break;
  647. case "90":
  648. str = "超时未上机";
  649. break;
  650. }
  651. return str;
  652. },
  653. getBreachTypes(row) {
  654. let breachTypes = [];
  655. if (row.isLate) breachTypes.push("迟到");
  656. if (row.isOvertime) breachTypes.push("超时");
  657. if (row.isLeaveEarly) breachTypes.push("早退");
  658. if (row.isAbsence) breachTypes.push("爽约");
  659. return breachTypes.join("、") || "-";
  660. },
  661. cancelAppoint(row) {
  662. // 删除附件
  663. this.$confirm("确认取消预约?", "提示", {
  664. confirmButtonText: "确认",
  665. cancelButtonText: "取消",
  666. type: "warning",
  667. })
  668. .then(async () => {
  669. const post =
  670. row.userId == props.curUserId
  671. ? userCancelAppoint({ id: Number(row.id) })
  672. : cancelAppoint({ id: Number(row.id) });
  673. const [err] = await to(post);
  674. if (err) return;
  675. this.$message.success("取消成功");
  676. this.getAppointList();
  677. })
  678. .catch(() => {});
  679. },
  680. editAppoint() {},
  681. // 选择tab
  682. tabSelect(row, index) {
  683. this.active = index;
  684. this.selectTab = { ...row };
  685. this.breadList = [...this.routeList, { name: this.selectTab.label }];
  686. },
  687. async getNotice() {
  688. const [err, res] = await to(getNoticeList());
  689. if (err) return;
  690. this.noticeList = res.data.list || [];
  691. },
  692. async getInstr() {
  693. const [err, res] = await to(getInstrList({ pageSize: 4, pageNum: 1 }));
  694. if (err) return;
  695. this.instrList = res.data.list || [];
  696. },
  697. initChart() {
  698. let chart = echarts.init(document.getElementById("chart"));
  699. const options = {
  700. series: [
  701. =======
  702. data() {
  703. return {
  704. active: -1,
  705. loading: true,
  706. selectTab: {},
  707. searchForm: {
  708. pageNum: 1,
  709. pageSize: 10,
  710. },
  711. total: 0,
  712. options: [
  713. >>>>>>> Stashed changes
  714. {
  715. label: "工作台",
  716. },
  717. {
  718. label: "预约信息",
  719. },
  720. ],
  721. routeList: [
  722. {
  723. name: "首页",
  724. path: "/",
  725. },
  726. {
  727. name: "个人中心",
  728. },
  729. ],
  730. breadList: [],
  731. calendarOptions: {
  732. height: 300,
  733. plugins: [dayGridPlugin, interactionPlugin], // 需要用哪个插件引入后放到这个数组里
  734. initialDate: new Date(), // 日历第一次加载时显示的初始日期。可以解析为Date的任何职包括ISO8601日期字符串,例如"2014-02-01"。
  735. initialView: "dayGridMonth", // 日历加载时的初始视图,默认值为'dayGridMonth',可以为任何可用视图的值,如例如'dayGridWeek','timeGridDay','listWeek'
  736. locale: "zh-cn", // 设置日历的语言,中文为 “zh-cn”
  737. firstDay: "1", // 设置每周的第一天,默认值取决于当前语言环境,该值为代表星期几的数字,且值必须为整数,星期日=0
  738. weekNumberCalculation: "ISO", // 指定"ISO"结果为ISO8601周数。指定"ISO"将firstDay的默认值更改为1(Monday)
  739. buttonText: {
  740. // 文本将显示在headerToolbar / footerToolbar的按钮上。不支持HTML注入。所有特殊字符将被转义。
  741. today: "今天",
  742. month: "月",
  743. week: "周",
  744. day: "天",
  745. },
  746. headerToolbar: {
  747. // 在日历顶部定义按钮和标题。将headerToolbar选项设置为false不会显示任何标题工具栏。可以为对象提供属性start/center/end或left/center/right。这些属性包含带有逗号/空格分隔值的字符串。用逗号分隔的值将相邻显示。用空格分隔的值之间会显示一个很小的间隙。
  748. right: "today prev,next",
  749. center: "title",
  750. left: "dayGridMonth,dayGridWeek,dayGridDay",
  751. },
  752. eventTimeFormat: {
  753. // 在每个事件上显示的时间的格式
  754. hour: "numeric",
  755. minute: "2-digit",
  756. hour12: false,
  757. },
  758. events: [],
  759. dateClick: this.handleDateClick, // 当用户单击日期或时间时,触发该回调,触发此回调,您必须加载interaction插件
  760. },
  761. instrList: [],
  762. noticeList: [],
  763. curSelectedDate: "w",
  764. curTime: "",
  765. appointData: [],
  766. WEEKS: [
  767. "星期日",
  768. "星期一",
  769. "星期二",
  770. "星期三",
  771. "星期四",
  772. "星期五",
  773. "星期六",
  774. ],
  775. };
  776. },
  777. computed: {
  778. ...mapGetters(["userInfo"]),
  779. },
  780. mounted() {
  781. this.tabSelect(this.options[0], 0);
  782. this.curTime = this.getToday();
  783. this.initChart();
  784. this.getNotice();
  785. this.getInstr();
  786. },
  787. methods: {
  788. moment,
  789. // 獲取當前日期
  790. getToday() {
  791. return moment(moment().startOf("day").valueOf()).format("YYYY-MM-DD");
  792. },
  793. getYesterday() {
  794. this.curTime = moment(
  795. moment(this.curTime).add(-1, "days").startOf("day").valueOf()
  796. ).format("YYYY-MM-DD");
  797. },
  798. getTomorrow() {
  799. this.curTime = moment(
  800. moment(this.curTime).add(+1, "days").startOf("day").valueOf()
  801. ).format("YYYY-MM-DD");
  802. },
  803. getPrevWeekDays() {
  804. this.curTime = moment(this.curTime)
  805. .subtract(1, "week")
  806. .format("YYYY-MM-DD");
  807. },
  808. getNextWeekDays() {
  809. this.curTime = moment(this.curTime).add(1, "week").format("YYYY-MM-DD");
  810. },
  811. getPrevMonthDays() {
  812. this.curTime = moment(this.curTime)
  813. .subtract(1, "months")
  814. .format("YYYY-MM-DD");
  815. },
  816. getNextMonthDays() {
  817. this.curTime = moment(this.curTime)
  818. .add(1, "months")
  819. .format("YYYY-MM-DD");
  820. },
  821. getWeekDate() {
  822. // 获取当前周的周一0点
  823. var startOfWeek = moment(this.curTime)
  824. .startOf("isoWeek")
  825. .format("YYYY-MM-DD HH:mm:ss");
  826. // 获取下一周的周一0点
  827. var startOfNextWeek = moment(this.curTime)
  828. .startOf("isoWeek")
  829. .add(1, "weeks")
  830. .format("YYYY-MM-DD HH:mm:ss");
  831. return [startOfWeek, startOfNextWeek];
  832. },
  833. getMonthDate() {
  834. const date = moment(this.curTime);
  835. // 获取当前月份的最后一天
  836. return [
  837. date.startOf("month").format("YYYY-MM-DD HH:mm:ss"),
  838. date.endOf("month").add(1, "days").format("YYYY-MM-DD") + " 00:00:00",
  839. ];
  840. },
  841. // 上一周、天、月
  842. handlePrev() {
  843. if (this.curSelectedDate == "d") {
  844. this.getYesterday();
  845. } else if (this.curSelectedDate == "w") {
  846. this.getPrevWeekDays();
  847. } else if (this.curSelectedDate == "m") {
  848. this.getPrevMonthDays();
  849. }
  850. this.getAppointList();
  851. },
  852. // 下一周、天、月
  853. handleNext() {
  854. if (this.curSelectedDate == "d") {
  855. this.getTomorrow();
  856. } else if (this.curSelectedDate == "w") {
  857. this.getNextWeekDays();
  858. } else if (this.curSelectedDate == "m") {
  859. this.getNextMonthDays();
  860. }
  861. this.getAppointList();
  862. },
  863. selectDate(date) {
  864. this.curSelectedDate = date;
  865. this.getAppointList();
  866. },
  867. async getAppointList() {
  868. let startTimeStart = "";
  869. let startTimeEnd = "";
  870. if (this.curSelectedDate == "d") {
  871. startTimeStart = moment(this.curTime).format("YYYY-MM-DD HH:mm:ss");
  872. startTimeEnd = moment(this.curTime)
  873. .add(1, "days")
  874. .format("YYYY-MM-DD HH:mm:ss");
  875. } else if (this.curSelectedDate == "w") {
  876. startTimeStart = this.getWeekDate()[0];
  877. startTimeEnd = this.getWeekDate()[1];
  878. } else if (this.curSelectedDate == "m") {
  879. startTimeStart = moment(this.curTime)
  880. .startOf("month")
  881. .format("YYYY-MM-DD HH:mm:ss");
  882. startTimeEnd = this.getMonthDate()[1];
  883. }
  884. console.log(startTimeStart);
  885. const [err, res] = await to(
  886. getInstrListByUser({
  887. startTimeStart,
  888. startTimeEnd,
  889. ...this.searchForm,
  890. })
  891. );
  892. if (err) return;
  893. this.appointData = res.data.list;
  894. this.total = res.data.total;
  895. },
  896. setStatus(key) {
  897. let str = "";
  898. switch (key) {
  899. case "10":
  900. str = "待审核";
  901. break;
  902. case "11":
  903. str = "已退回";
  904. break;
  905. case "20":
  906. str = "已通过";
  907. break;
  908. case "30":
  909. str = "已驳回";
  910. break;
  911. case "40":
  912. str = "已取消";
  913. break;
  914. case "50":
  915. str = "已上机";
  916. break;
  917. case "60":
  918. str = "已完成";
  919. break;
  920. case "70":
  921. str = "审核超时";
  922. break;
  923. case "80":
  924. str = "超时取消";
  925. break;
  926. case "90":
  927. str = "超时未上机";
  928. break;
  929. }
  930. return str;
  931. },
  932. getBreachTypes(row) {
  933. let breachTypes = [];
  934. if (row.isLate) breachTypes.push("迟到");
  935. if (row.isOvertime) breachTypes.push("超时");
  936. if (row.isLeaveEarly) breachTypes.push("早退");
  937. if (row.isAbsence) breachTypes.push("爽约");
  938. return breachTypes.join("、") || "-";
  939. },
  940. // 取消预约
  941. cancelAppoint(row) {
  942. // 删除附件
  943. this.$confirm("确认取消预约?", "提示", {
  944. confirmButtonText: "确认",
  945. cancelButtonText: "取消",
  946. type: "warning",
  947. })
  948. .then(async () => {
  949. const post = userCancelAppoint({ id: Number(row.id) });
  950. const [err] = await to(post);
  951. if (err) return;
  952. this.$message.success("取消成功");
  953. this.getAppointList();
  954. })
  955. .catch(() => {});
  956. },
  957. // 编辑预约
  958. handleEditAppoint(row) {
  959. const token = getToken();
  960. if (!token) {
  961. return this.$router.push("/login");
  962. }
  963. this.$refs.appointCreateRef.openDialog(row);
  964. },
  965. // 选择tab
  966. tabSelect(row, index) {
  967. this.active = index;
  968. this.selectTab = { ...row };
  969. this.breadList = [...this.routeList, { name: this.selectTab.label }];
  970. if (index == 1) {
  971. this.getAppointList();
  972. }
  973. },
  974. async getNotice() {
  975. const [err, res] = await to(getNoticeList());
  976. if (err) return;
  977. this.noticeList = res.data.list || [];
  978. },
  979. async getInstr() {
  980. const [err, res] = await to(getInstrList({ pageSize: 4, pageNum: 1 }));
  981. if (err) return;
  982. this.instrList = res.data.list || [];
  983. },
  984. initChart() {
  985. let chart = echarts.init(document.getElementById("chart"));
  986. const options = {
  987. series: [
  988. {
  989. type: "gauge",
  990. startAngle: 180,
  991. endAngle: 0,
  992. center: ["50%", "75%"],
  993. radius: "90%",
  994. min: 0,
  995. max: 1,
  996. splitNumber: 8,
  997. axisLine: {
  998. lineStyle: {
  999. width: 6,
  1000. color: [
  1001. [0.25, "#FF6E76"],
  1002. [0.5, "#FDDD60"],
  1003. [0.75, "#58D9F9"],
  1004. [1, "#7CFFB2"],
  1005. ],
  1006. },
  1007. },
  1008. pointer: {
  1009. icon: "path://M12.8,0.7l12,40.1H0.7L12.8,0.7z",
  1010. length: "12%",
  1011. width: 20,
  1012. offsetCenter: [0, "-60%"],
  1013. itemStyle: {
  1014. color: "auto",
  1015. },
  1016. },
  1017. axisTick: {
  1018. length: 12,
  1019. lineStyle: {
  1020. color: "auto",
  1021. width: 2,
  1022. },
  1023. },
  1024. splitLine: {
  1025. length: 20,
  1026. lineStyle: {
  1027. color: "auto",
  1028. width: 5,
  1029. },
  1030. },
  1031. axisLabel: {
  1032. color: "#464646",
  1033. fontSize: 14,
  1034. distance: -40,
  1035. rotate: "tangential",
  1036. formatter: function (value) {
  1037. if (value === 0.875) {
  1038. return "充足";
  1039. } else if (value === 0.625) {
  1040. return "可控";
  1041. } else if (value === 0.375) {
  1042. return "紧张";
  1043. } else if (value === 0.125) {
  1044. return "危险";
  1045. }
  1046. return "";
  1047. },
  1048. },
  1049. title: {
  1050. offsetCenter: [0, "-10%"],
  1051. fontSize: 14,
  1052. },
  1053. detail: {
  1054. fontSize: 20,
  1055. offsetCenter: [0, "-35%"],
  1056. valueAnimation: true,
  1057. formatter: function (value) {
  1058. return Math.round(value * 100) + "";
  1059. },
  1060. color: "inherit",
  1061. },
  1062. data: [
  1063. {
  1064. value: 0.7,
  1065. name: "危险预算余额",
  1066. },
  1067. ],
  1068. },
  1069. ],
  1070. };
  1071. chart.setOption(options);
  1072. },
  1073. handleDateClick(dateClickInfo) {
  1074. console.log(dateClickInfo);
  1075. },
  1076. handleSizeChange(val) {
  1077. this.searchForm.pageSize = val;
  1078. this.getAppointList();
  1079. },
  1080. handleCurrentChange(val) {
  1081. this.searchForm.pageNum = val;
  1082. this.getAppointList();
  1083. },
  1084. },
  1085. };
  1086. </script>
  1087. <style lang="scss" scoped>
  1088. <<<<<<< Updated upstream
  1089. .center-banner {
  1090. background: url(../assets/img/login-bg.png) top no-repeat;
  1091. height: 240px;
  1092. display: flex;
  1093. justify-content: center;
  1094. align-items: center;
  1095. .content {
  1096. height: 180px;
  1097. width: 1200px;
  1098. border-radius: 16px;
  1099. background-color: rgba($color: #fff, $alpha: 0.5);
  1100. display: flex;
  1101. align-items: center;
  1102. justify-content: space-between;
  1103. padding: 0 40px;
  1104. .user {
  1105. display: flex;
  1106. align-items: center;
  1107. img {
  1108. height: 100px;
  1109. width: 100px;
  1110. border-radius: 50%;
  1111. }
  1112. p {
  1113. height: 100px;
  1114. display: flex;
  1115. flex-direction: column;
  1116. justify-content: space-around;
  1117. margin-left: 12px;
  1118. span:nth-child(1) {
  1119. font-weight: bold;
  1120. font-size: 18px;
  1121. }
  1122. span:nth-child(3) {
  1123. font-weight: bold;
  1124. }
  1125. }
  1126. }
  1127. .btns {
  1128. display: flex;
  1129. align-items: center;
  1130. > p {
  1131. display: flex;
  1132. align-items: center;
  1133. margin-right: 20px;
  1134. line-height: 30px;
  1135. font-weight: bold;
  1136. span {
  1137. font-size: 30px;
  1138. font-weight: bold;
  1139. color: #1d66dc;
  1140. font-style: italic;
  1141. }
  1142. }
  1143. }
  1144. }
  1145. }
  1146. .flex {
  1147. width: 100%;
  1148. flex-wrap: wrap;
  1149. .el-card {
  1150. flex: 0 0 calc(50% - 14px);
  1151. height: 400px;
  1152. ::v-deep .el-card__body {
  1153. padding: 10px;
  1154. height: calc(100% - 79px);
  1155. }
  1156. &.calendar {
  1157. height: 500px;
  1158. ul {
  1159. display: flex;
  1160. flex-direction: column;
  1161. justify-content: space-around;
  1162. height: 130px;
  1163. li {
  1164. font-size: 14px;
  1165. =======
  1166. .flex {
  1167. width: 100%;
  1168. flex-wrap: wrap;
  1169. .el-card {
  1170. flex: 0 0 calc(50% - 14px);
  1171. height: 400px;
  1172. ::v-deep .el-card__body {
  1173. padding: 10px;
  1174. height: calc(100% - 79px);
  1175. }
  1176. &.calendar {
  1177. height: 500px;
  1178. ul {
  1179. >>>>>>> Stashed changes
  1180. display: flex;
  1181. flex-direction: column;
  1182. justify-content: space-around;
  1183. height: 130px;
  1184. li {
  1185. font-size: 14px;
  1186. display: flex;
  1187. align-items: center;
  1188. &:before {
  1189. content: "";
  1190. display: inline-block;
  1191. width: 6px;
  1192. height: 6px;
  1193. border-radius: 3px;
  1194. background-color: #a30014;
  1195. margin-right: 4px;
  1196. }
  1197. }
  1198. }
  1199. }
  1200. &.cost {
  1201. height: 300px;
  1202. }
  1203. }
  1204. &.technical .el-card {
  1205. height: auto;
  1206. ::v-deep .el-card__body {
  1207. height: auto;
  1208. }
  1209. }
  1210. }
  1211. .cage-list {
  1212. display: flex;
  1213. flex-wrap: wrap;
  1214. list-style: none;
  1215. li {
  1216. height: 160px;
  1217. width: 221px;
  1218. font-size: 14px;
  1219. border: 1px solid #ebeef5;
  1220. border-radius: 6px;
  1221. display: flex;
  1222. flex-direction: column;
  1223. justify-content: space-around;
  1224. padding: 10px;
  1225. &:nth-child(2n) {
  1226. margin-left: 4px;
  1227. }
  1228. &:nth-child(n + 3) {
  1229. margin-top: 4px;
  1230. }
  1231. header {
  1232. display: flex;
  1233. justify-content: space-between;
  1234. p {
  1235. color: #1d66dc;
  1236. }
  1237. }
  1238. }
  1239. }
  1240. .platform-list {
  1241. height: 100%;
  1242. display: flex;
  1243. flex-direction: column;
  1244. li {
  1245. flex: 1;
  1246. display: flex;
  1247. align-items: center;
  1248. margin: 12px;
  1249. border-radius: 8px;
  1250. overflow: hidden;
  1251. border: 1px solid #ebeef5;
  1252. .text {
  1253. flex: 1;
  1254. height: 100%;
  1255. padding: 12px;
  1256. }
  1257. .btn {
  1258. width: 120px;
  1259. height: 100%;
  1260. color: #fff;
  1261. font-size: 20px;
  1262. background-color: #73b9b9;
  1263. display: flex;
  1264. flex-direction: column;
  1265. align-items: center;
  1266. justify-content: space-around;
  1267. header {
  1268. font-size: 14px;
  1269. }
  1270. .remain-time {
  1271. color: #f56c6c;
  1272. }
  1273. }
  1274. }
  1275. }
  1276. .chart-container {
  1277. display: flex;
  1278. .text {
  1279. flex: 1;
  1280. font-size: 14px;
  1281. display: flex;
  1282. flex-direction: column;
  1283. header {
  1284. color: #1d66dc;
  1285. }
  1286. ul {
  1287. margin-top: 12px;
  1288. flex: 1;
  1289. display: flex;
  1290. flex-direction: column;
  1291. justify-content: space-around;
  1292. }
  1293. li {
  1294. background-color: #e4b5bb;
  1295. border-radius: 4px;
  1296. padding: 4px 8px;
  1297. }
  1298. }
  1299. #chart {
  1300. width: 233px;
  1301. height: 220px;
  1302. }
  1303. }
  1304. .technical {
  1305. p {
  1306. font-size: 16px;
  1307. height: 24px;
  1308. line-height: 24px;
  1309. }
  1310. ul {
  1311. display: flex;
  1312. height: 50px;
  1313. line-height: 50px;
  1314. border-radius: 4px;
  1315. overflow: hidden;
  1316. margin: 20px 0;
  1317. li {
  1318. flex: 1;
  1319. text-align: center;
  1320. background-color: #d9fba5;
  1321. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  1322. &:nth-child(2) {
  1323. background-color: #98ca49;
  1324. }
  1325. &:nth-child(3) {
  1326. background-color: #a4dffa;
  1327. }
  1328. &:nth-child(4) {
  1329. background-color: #48bff4;
  1330. }
  1331. &:nth-child(5) {
  1332. background-color: #b6b6f1;
  1333. }
  1334. &:nth-child(6) {
  1335. background-color: #ebcda7;
  1336. }
  1337. &:nth-child(7) {
  1338. background-color: #f2a4ad;
  1339. }
  1340. }
  1341. }
  1342. }
  1343. .toolbar-wrap {
  1344. height: 30px;
  1345. display: flex;
  1346. justify-content: space-between;
  1347. align-items: center;
  1348. // margin-bottom: 20px;
  1349. .switch-date {
  1350. width: 108px;
  1351. height: 28px;
  1352. border-radius: 2px;
  1353. border: 1px solid #b5c1d8;
  1354. display: flex;
  1355. padding: 4px 6px 0;
  1356. .btn {
  1357. cursor: pointer;
  1358. flex: 1;
  1359. font-size: 13px;
  1360. color: #585858;
  1361. display: flex;
  1362. align-items: center;
  1363. justify-content: center;
  1364. &.actived {
  1365. background: #eef3fe;
  1366. font-weight: bold;
  1367. color: #2c78ff;
  1368. }
  1369. }
  1370. }
  1371. .date-wrap {
  1372. display: flex;
  1373. align-items: center;
  1374. :deep(.el-button--small.is-circle) {
  1375. width: 26px;
  1376. height: 26px;
  1377. display: flex;
  1378. align-items: center;
  1379. justify-content: center;
  1380. }
  1381. .date {
  1382. margin: 0 10px;
  1383. font-size: 14px;
  1384. color: #585858;
  1385. display: flex;
  1386. align-items: center;
  1387. }
  1388. .week {
  1389. color: #2c78ff;
  1390. padding-left: 6px;
  1391. }
  1392. }
  1393. }
  1394. .table-wrap {
  1395. flex: 1;
  1396. margin: 20px 0 0;
  1397. // overflow: hidden;
  1398. }
  1399. .pagination {
  1400. width: 100%;
  1401. height: 50px;
  1402. display: flex;
  1403. align-items: center;
  1404. justify-content: flex-end;
  1405. }
  1406. </style>