基于element日歷組件實現(xiàn)簽卡記錄
本文實例為大家分享了基于element日歷組件實現(xiàn)簽卡記錄的具體代碼,供大家參考,具體內(nèi)容如下
使用element日歷組件為基礎,實現(xiàn)可以查看每天簽卡記錄
<template> ? <div class="n-container"> ? ? <div style="padding: 40px"> ? ? ? <el-col :span="24"> ? ? ? ? <div class="title"> ? ? ? ? ? <div class="tpadding">我的考勤</div> ? ? ? ? ? <el-divider></el-divider> ? ? ? ? </div> ? ? ? </el-col> ? ? ? <el-col :span="24"> ? ? ? ? <div class="block"> ? ? ? ? ? <el-calendar v-model="recordTime" :first-day-of-week="7"> ? ? ? ? ? ? <!-- 這里使用的是 2.5 slot 語法,對于新項目請使用 2.6 slot 語法--> ? ? ? ? ? ? <template slot="dateCell" slot-scope="{ date, data }"> ? ? ? ? ? ? ? <!--自定義內(nèi)容--> ? ? ? ? ? ? ? <div slot="reference" class="histyle" @click="getDateAtte(data)"> ? ? ? ? ? ? ? ? <div class="calendar-day"> ? ? ? ? ? ? ? ? ? <el-popover ? ? ? ? ? ? ? ? ? ? placement="left" ? ? ? ? ? ? ? ? ? ? visible-arrow="false" ? ? ? ? ? ? ? ? ? ? width="500" ? ? ? ? ? ? ? ? ? ? trigger="click" ? ? ? ? ? ? ? ? ? > ? ? ? ? ? ? ? ? ? ? <el-table :data="recordList"> ? ? ? ? ? ? ? ? ? ? ? <el-table-column ? ? ? ? ? ? ? ? ? ? ? ? width="140" ? ? ? ? ? ? ? ? ? ? ? ? property="signState" ? ? ? ? ? ? ? ? ? ? ? ? label="狀態(tài)類型" ? ? ? ? ? ? ? ? ? ? ? ></el-table-column> ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? ? <el-table-column ? ? ? ? ? ? ? ? ? ? ? ? width="140" ? ? ? ? ? ? ? ? ? ? ? ? property="signTime" ? ? ? ? ? ? ? ? ? ? ? ? label="實際簽卡時間" ? ? ? ? ? ? ? ? ? ? ? ></el-table-column> ? ? ? ? ? ? ? ? ? ? ? <!-- <el-table-column ? ? ? ? ? ? ? ? ? ? ? ? width="120" ? ? ? ? ? ? ? ? ? ? ? ? property="checkintime" ? ? ? ? ? ? ? ? ? ? ? ? label="應簽卡時間" ? ? ? ? ? ? ? ? ? ? ? ></el-table-column> --> ? ? ? ? ? ? ? ? ? ? ? ? <el-table-column ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? ? ? property="attmachinename" ? ? ? ? ? ? ? ? ? ? ? ? label="考勤機名稱" ? ? ? ? ? ? ? ? ? ? ? ></el-table-column> ? ? ? ? ? ? ? ? ? ? </el-table> ? ? ? ? ? ? ? ? ? ? <div slot="reference"> ? ? ? ? ? ? ? ? ? ? ? {{ data.day.split("-").slice(2).join("-") }} ? ? ? ? ? ? ? ? ? ? ? <!-- <i class="el-icon-warning-outline is_waring"></i> --> ? ? ? ? ? ? ? ? ? ? </div> ? ? ? ? ? ? ? ? ? </el-popover> ? ? ? ? ? ? ? ? </div> ? ? ? ? ? ? ? </div> ? ? ? ? ? ? </template> ? ? ? ? ? </el-calendar> ? ? ? ? </div> ? ? ? </el-col> ? ? </div> ? </div> </template> ? <script> import { listRecord } from "@/api/self/attendance"; export default { ? data() { ? ? return { ? ? ? recordTime: this.selectofearmonth, ? ? ? nosignList: [], ? ? ? queryParams: { ? ? ? ? userId: this.userIdVal, ? ? ? ? signTime: this.dt, ? ? ? }, ? ? ? recordList: [], ? ? }; ? }, ? props: ["selectofearmonth", "dt", "userIdVal"], ? created() {}, ? watch: { ? ? selectofearmonth: { ? ? ? handler(newVal, oldVal) { ? ? ? ? this.recordTime = this.parseTime(newVal, "{y}-{m}"); ? ? ? ? this.getDateAtte(); ? ? ? }, ? ? }, ? }, ? methods: { ? ? getDateAtte(data) { ? ? ? this.queryParams.signTime = data.day; ? ? ? if ( ? ? ? ? this.queryParams.signTime == null || ? ? ? ? this.queryParams.signTime == "" ? ? ? ) { ? ? ? ? return "時間不能為空"; ? ? ? } ? ? ? if (this.queryParams.userId == null || this.queryParams.userId == "") { ? ? ? ? return "用戶ID不能為空"; ? ? ? } ? ? ? listRecord(this.queryParams).then((data) => { ? ? ? ? if (data.code != 200) { ? ? ? ? ? return; ? ? ? ? } ? ? ? ? this.recordList = data.rows; ? ? ? }); ? ? }, ? ? //處理請求回的數(shù)據(jù),與日歷數(shù)據(jù)相掛鉤 ? ? dealMyDate(v) { ? ? ? let len = this.saveMothData.length; ? ? ? let res = {}; ? ? ? for (let i = 0; i < len; i++) { ? ? ? ? if (this.saveMothData[i].memoDate == v) { ? ? ? ? ? res.hasMemo = true; ? ? ? ? ? res.memoLevel = this.saveMothData[i].memoLevel; ? ? ? ? ? res.memoTime = this.saveMothData[i].memoTime; ? ? ? ? ? break; ? ? ? ? } ? ? ? } ? ? ? return res; ? ? }, ? ? //點擊日歷上每一天更新備忘錄列表 ? ? updateMemo(data) { ? ? ? this.chooseDay = data.day; ? ? ? this.memorandumCurrentPage = 1; ? ? ? const param = { ? ? ? ? pageNum: this.memorandumCurrentPage, ? ? ? ? pageSize: this.memorandumPageSize, ? ? ? ? param: { ? ? ? ? ? day: data.day, ? ? ? ? ? emplId: this.emplId, ? ? ? ? }, ? ? ? }; ? ? ? this.queryMemoList(param); ? ? }, ? ? //查詢備忘錄列表 ? ? queryMemoList(data, flag) { ? ? ? var param; ? ? ? if (data) { ? ? ? ? // ? ? ? ? param = data; ? ? ? ? param.emplId = this.emplId; ? ? ? } else { ? ? ? ? //不傳data的情況,有可能是初次加載或者不傳month也不傳day ? ? ? ? param = { ? ? ? ? ? param: { ? ? ? ? ? ? emplId: this.emplId, ? ? ? ? ? }, ? ? ? ? ? pageNum: this.memorandumCurrentPage, ? ? ? ? ? pageSize: this.memorandumPageSize, ? ? ? ? }; ? ? ? } ? ? }, ? }, }; </script> ? <style scope> .n-container { ? padding: 0px; ? box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%); ? height: 500px; ? margin-bottom: 10px; } .title { ? font-size: 16px; ? font-weight: bold; ? text-align: left; } .tpadding { ? padding-top: 12px; } .is-selected { ? color: #2936f3; ? font-size: 17px; ? margin-top: 5px; } .histyle { ? height: 35px; } .el-calendar-table .el-calendar-day { ? height: 30px; } .is_waring { ? color: rgb(236, 134, 17); } .is_right { ? color: rgb(145, 176, 235); } </style>
結(jié)果如圖:
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Element中select多數(shù)據(jù)加載優(yōu)化的實現(xiàn)
本文主要介紹了Element中select多數(shù)據(jù)加載優(yōu)化的實現(xiàn),文中通過示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-09-09vue-cli-service?build?自定義參數(shù)方式
這篇文章主要介紹了vue-cli-service?build?自定義參數(shù)方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-10-10在Vue里如何把網(wǎng)頁的數(shù)據(jù)導出到Excel的方法
這篇文章主要介紹了在Vue里如何把網(wǎng)頁的數(shù)據(jù)導出到Excel,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-09-09Vue實現(xiàn)Hover功能(mouseover與mouseenter的區(qū)別及說明)
這篇文章主要介紹了Vue實現(xiàn)Hover功能(mouseover與mouseenter的區(qū)別及說明),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-10-10vue.js模仿京東省市區(qū)三級聯(lián)動的選擇組件實例代碼
選擇省市區(qū)是我們大家在填寫地址的時候經(jīng)常會遇到的一個功能,下面這篇文章主要給大家介紹了關(guān)于利用vue.js模仿實現(xiàn)京東省市區(qū)三級聯(lián)動選擇組件的相關(guān)資料,文中通過示例代碼介紹的非常詳細,需要的朋友可以參考借鑒,下面來一起看看吧。2017-11-11