feige
2024-12-01 3db1df80349d2bb3e279026a8647790576578f0a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<template>
  <div class="app-container" style="opacity: 1;" >
      <el-date-picker
            v-model="calenderDate"
            type="date"
               clearable="false"
  @change="clearChange"
 
            placeholder="选择日期">
          </el-date-picker>
    <el-calendar  
 v-model="calenderDate">
 
  <div slot="dateCell" slot-scope="{data}">
        <div :class="data.isSelected ? 'is-selected' : ''">
           <div class="day">
              {{ data.day.split('-').slice(1).join('-') }} 
              {{ data.isSelected ? '✔️' : '' }}
           </div>
        </div>
     </div>
 
    </el-calendar>
 
 
 
 
    <el-dialog :visible.sync="open" width="900px">
        <div class="table-container">
          <div style="padding-top:15px;padding-left:30px;padding-bottom:-20px"><span class="text">修改记录</span></div>
          <el-divider/>
          <el-table v-loading="loading" :data="infoList"  @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" style="background: #FFEFF2;  border-radius: 14px 14px 14px 14px;">
            <el-table-column  label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" style="width: 20%" align="center"/>
        
            <el-table-column label="被修改模块" prop="module" sortable style="width: 25%" align="center">
            </el-table-column>
            <el-table-column label="修改时间" prop="updateTime" sortable style="width: 25%"  align="center"/>
            <el-table-column label="修改人" prop="updater" sortable style="width: 25%" align="center"/>
          </el-table>
        
          <pagination
            v-show="total>0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
            style="background: #FEF7FC;"
          />
        </div>
    </el-dialog>
    </div>
</template>
 
<script>
    import {getShouye} from "@/api/shouye";
    
    export default {
      name: "calendar",
      
      data() {
        return {
            open: false,
            total: 0,
            // 表格数据
            infoList: [],
            calenderDate:new Date(),
            productDate: '',
            // 查询参数
            queryParams: {
              pageNum: 1,
              pageSize: 10,
              
            },
            }
        }, 
        
        watch:{
            calenderDate(newVal, oldVal) {
               // 格式化 因为绑定的数组不是我们想用的,这里以2022-22-22这种格式作为演示
              this.calenderDate = this.formatDate(newVal)
               // 这里就是我们处理数据,调用接口的位置
              this.allcalendar()
            }
        },
    created() {
      this.getList()
    },
    
      methods: {
           clearChange(value) {
              if (!value) {
                this.$nextTick(() => {
                  this.calenderDate = new Date()
                })
              }
           
            },
          handleVisibleChange(visible) {
              alert(visible)
      if (!visible) {
        // 当日期选择器关闭时设置时间为当天的00:00:00
        this.date = this.setTimeToStartOfDay(new Date());
      }
    },
    setTimeToStartOfDay(date) {
      return new Date(date.getFullYear(), date.getMonth(), date.getDate());
    },
          //隔行变色
          tableRowClassName({ row, rowIndex }) {
            if (rowIndex % 2 == 0) {
              return "statistics-warning-row1";
            } else {
              return "statistics-warning-row";
            }
          },
          // 多选框选中数据
          handleSelectionChange(selection) {
            this.ids = selection.map(item => item.id)
            console.log(this.ids)
            this.single = selection.length!=1
            this.multiple = !selection.length
          },
          
    /** 查询角色列表 */
    getList() {
      this.loading = true;
      // console.log(this.queryParams)
      //  listProperty(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
      // console.log("111")
      if(this.productDate!="")
        this.queryParams.module = this.productDate
      // alert(this.queryParams.module)
      // console.log(this.queryParams)
      getShouye(this.queryParams).then(response => {
          //  alert(123)
          //   console.log("222")
          this.infoList = response.data.data;
          // console.log(this.infoList)
          this.total = response.data.total;
          
          this.loading = false;
        }
      );
    },
                async allcalendar() {
                      this.productDate = this.calenderDate
                      const loading = this.$loading({
                        lock: true, //加上这个 页面点击日历的时候会莫名其妙抖动一下 因为我界面上有滚动条,所以我注释了
                        text: 'Loading',
                        spinner: 'el-icon-loading',
                        background: 'rgba(0, 0, 0, 0.7)'
                      })
                      try {
                          
                          this.open = true; 
                          this.getList()
                        // 这里调用接口肯定是需要点击的日期的,书写自己的处理逻辑即可
                      //  await this.haveDateInfo()
                      } catch (error) {
                        console.log(error)
                      }
                      loading.close()
                    },
                    // 格式化日期函数
                        formatDate(date) {
                          const value = new Date(date)
                          const year = value.getFullYear()
                          const month = (value.getMonth() + 1).toString().padStart(2, '0')
                          const day = value.getDate().toString().padStart(2, '0')
                          return `${year}-${month}-${day}`
                        }
 
 
          }
    }
            
</script>
<style scoped="">
.app-container{
  background-color: #FEF7FC;
}
.el-table__row.statistics-warning-row {
  background: #E0EEFE;
 
}
.el-table__row.statistics-warning-row1 {
  background: #FFEFF2;
 
}
.text{
  font-size: 16px;
  line-height: 24px;
  text-align: center;
}
.bkg_image img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: -5px;
}
.bkg_image {
  position: relative; /* 设置相对定位 */
}
.overlay {
  position: absolute; /* 设置绝对定位 */
  top: 10px;
  left: 10px;
  width: 100%;
  height: 90%;
  background-color: rgba(255, 255, 255, 0.5); /* 半透明颜色,可根据需求调整透明度 */
  z-index: 1; /* 将表格置于图片上方 */
}
 
</style>