From 28ab9d977cb2ec91ba689c034369bfe11bde1c53 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期四, 16 五月 2024 22:33:44 +0800
Subject: [PATCH] 托盘夹具
---
src/views/console/base/CalenderTab.vue | 187 +++++++++++++++++++++++++++++++++++++++-------
1 files changed, 158 insertions(+), 29 deletions(-)
diff --git a/src/views/console/base/CalenderTab.vue b/src/views/console/base/CalenderTab.vue
index a3d8a70..ddb9e40 100644
--- a/src/views/console/base/CalenderTab.vue
+++ b/src/views/console/base/CalenderTab.vue
@@ -1,59 +1,117 @@
<!--
* @Date: 2024-04-04 22:45:43
* @LastEditors: Sneed
- * @LastEditTime: 2024-04-07 20:31:00
+ * @LastEditTime: 2024-05-05 21:20:22
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/base/CalenderTab.vue
-->
<template>
+ <el-container>
+ <el-aside width="220px">
+ <el-button type="primary" icon="el-icon-plus" @click="add">鏂板缓鏃ュ巻</el-button>
+ <div v-infinite-scroll="load">
+ <el-card shadow="never" class="card" v-for="item in caleList" :key="item.id" @click="select(item)">
+ <h3>{{ item.code }}</h3>
+ <p>鏃ュ巻鍚嶇О: {{ item.name }}</p>
+ <p>搴旂敤骞翠唤: {{ item.year }}</p>
+ </el-card>
+ </div>
+ </el-aside>
<el-container>
- <el-aside width="220px">
- <el-button type="primary" icon="el-icon-plus">鏂板缓鏃ュ巻</el-button>
- <div v-infinite-scroll="load">
- <el-card shadow="never" class="card" v-for="item in caleList" :key="item.id">
- <h3>{{item.code}}</h3>
- <p>鏃ュ巻鍚嶇О: {{item.name}}</p>
- <p>搴旂敤骞翠唤: {{item.year}}</p>
- </el-card>
- </div>
- </el-aside>
- <el-container>
- <el-header>
- <el-button type="primary">鍏宠仈宸ヤ綅</el-button>
- <el-button type="primary">缂栬緫鏃ュ巻</el-button>
- <el-button type="primary">鍒犻櫎</el-button>
- </el-header>
- <el-main>
- <Calendar :rows="12" disable-page-swipe :nav-visibility="''" :attributes='attributes'/>
- </el-main>
- </el-container>
+ <el-header>
+ <span>鏃ュ巻銆恵{ selectInfo.code }}銆憑{ selectInfo.name }}</span>
+ <el-button type="primary" style="margin-left: auto;" size="small">鍏宠仈宸ヤ綅</el-button>
+ <!-- <el-button type="primary" size="small">缂栬緫鏃ュ巻</el-button> -->
+ <el-popconfirm title="纭畾鍒犻櫎鍚楋紵" @confirm="table_del">
+ <template #reference>
+ <el-button type="primary" size="small">鍒犻櫎</el-button>
+ </template>
+ </el-popconfirm>
+ </el-header>
+ <el-main>
+ <el-row>
+ <el-col :span="6" style="padding: 10px;" v-for="item in months" :key="item.month">
+ <Calendar :initial-page="{ month: item.month + 1, year: item.year }" :rows="1"
+ disable-page-swipe :nav-visibility="''" :attributes='item.attributes' />
+ </el-col>
+ </el-row>
+ <!-- :initial-page="{ month: item.month + 1, year: item.year }" -->
+
+ </el-main>
</el-container>
+ <el-drawer v-model="drawer" size="80%" title="鐢熶骇鏃ュ巻" :direction="direction" :before-close="handleClose">
+ <Add :shiftList="shiftList" @success="success"></Add>
+ </el-drawer>
+ </el-container>
</template>
<script>
import { Calendar, DatePicker } from 'v-calendar';
import 'v-calendar/style.css';
-
+import Add from './Add.vue'
+import moment from 'moment';
export default {
components: {
Calendar,
- DatePicker
+ DatePicker,
+ Add
},
data() {
return {
+ shiftList: [],
+ selectInfo: {},
+ drawer: false,
+ months: [],
attributes: [
-
+
],
current: 0,
total: 1,
- caleList: []
+ caleList: [],
+ minDate: '',
+ maxDate: ''
}
},
created() {
this.load()
+ this.init()
},
methods: {
- load() {
- if (this.current * 15 >= this.total) {
+ dayclick(day) {
+ console.log(day)
+ },
+ init() {
+ this.$HTTP.post('/api/blade-cps/shift/list', { statusList: [1] }).then(res => {
+ if (res.code === 200) {
+ this.shiftList = res.data
+ }
+ })
+ },
+ select(row) {
+ this.selectInfo = {
+ ...row
+ }
+ this.months = []
+ this.$HTTP.get(`/api/blade-cps/calendar/${row.id}`).then(res => {
+ if (res.code === 200) {
+ console.log(res.data)
+ this.setDay(res.data)
+ }
+ })
+ },
+ table_del() {
+ this.$HTTP.delete(`/api/blade-cps/calendar/${this.selectInfo.id}`).then(res => {
+ if (res.code == 200) {
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.load(true)
+ }
+ })
+ },
+ add() {
+ this.drawer = true
+ },
+ load(flag) {
+ if (flag) this.current = 0;
+ if (this.current * 15 >= this.total) {
return
}
this.current += 1
@@ -62,14 +120,83 @@
if (res?.data?.records) {
if (this.current === 1) {
this.caleList = res?.data?.records || []
+ this.select(this.caleList[0])
} else {
this.caleList.push(
...res?.data?.records || []
)
}
-
+ }
+
+ })
+ },
+ success() {
+ this.drawer = false
+ this.load(true)
+ },
+ setDay(data) {
+ let year = data.year
+ this.$HTTP.post('/api/blade-cps/shift-off-day/list', {
+ year: year,
+ startOffDay: `${year}-01-01`,
+ endOffDay: `${year}-12-31`
+ }).then(res => {
+ if (res.code === 200) {
+ let arr = []
+ res.data.forEach(v => {
+ arr.push(v.startOffDay)
+ let day = moment(v.startOffDay)
+ while (day.add(1, 'd').unix() <= moment(v.endOffDay).unix()) {
+ arr.push(day.format('YYYY-MM-DD'))
+ }
+ })
+
+ for (let i = 0; i < 12; i++) {
+ this.months.push({
+ year: year,
+ month: i,
+ attributes: [
+ {
+ dot: 'yellow',
+ dates: arr.filter(item => {
+ // console.log(moment(item).month(), 'mmonth', item)
+ return moment(item).month() === i
+ })
+ },
+ {
+ highlight: true,
+ dates: data.calendarDayVOList.filter(item => {
+ console.log(moment(item).month(), '>>>123')
+ return moment(item.calendarDate).month() === i
+ }),
+ }
+ ]
+ })
+ }
}
})
+
+
+ // this.months.forEach((item, i) => {
+ // let start = moment(`${currentYear}-${i + 1}-01`)
+ // let end = moment(`${currentYear}-${i + 2}-01`)
+ // let dates = []
+ // while (start.unix() < end.unix()) {
+ // if (this.checkboxGroup1.includes(start.day()) && this.holiday === 0) {
+ // this.pushDate(start) && dates.push(start.format('YYYY-MM-DD'))
+ // } else if (this.checkboxGroup1.includes(start.day()) && this.holiday === 1) {
+ // if (!this.months[i].attributes[0].dates.includes(start.format('YYYY-MM-DD'))) {
+ // this.pushDate(start) && dates.push(start.format('YYYY-MM-DD'))
+ // }
+ // } else if (this.checkboxGroup1.includes(start.day()) && this.holiday === 2) {
+ // if (this.months[i].attributes[0].dates.includes(start.format('YYYY-MM-DD'))) {
+ // this.pushDate(start) && dates.push(start.format('YYYY-MM-DD'))
+ // }
+ // }
+ // start.add(1, 'd')
+ // }
+ // this.months[i].attributes[1].dates = dates
+ // })
}
}
}
@@ -80,7 +207,9 @@
cursor: pointer;
margin: 12px 12px 12px 0;
}
+
.vc-arrow {
- display: none!important;;
+ display: none !important;
+ ;
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3