Commit 430a7547adea9f6e293592e55a14cc364651d928

Authored by 周超
1 parent 8ab6a817

和志哥来个同步

src/views/user/InterviewSchedule.vue
... ... @@ -41,6 +41,16 @@
41 41 </div>
42 42  
43 43 </div>
  44 + <div >
  45 + <el-calendar v-model="query.date">
  46 + <!-- 这里使用的是 2.5 slot 语法,对于新项目请使用 2.6 slot 语法-->
  47 + <template slot="dateCell" slot-scope="{date, data}">
  48 + <p :class="data.isSelected ? 'is-selected' : ''" v-html="getContent(data,date)">
  49 +
  50 + </p>
  51 + </template>
  52 + </el-calendar>
  53 + </div>
44 54 <el-table :data="userList" id="QuestionTable" border
45 55 style="width: 100%;border-radius: 5px;box-shadow: 0 0 10px #efefef;margin-top: 10px;" :stripe='true'>
46 56 <el-table-column type="index" prop="date" width="50" align="center"></el-table-column>
... ... @@ -56,8 +66,8 @@
56 66 <el-table-column prop="date" label="姓名">
57 67 <template slot-scope="scope">
58 68 <span>{{ scope.row.fullName }}</span>
59   - <el-tag v-for="item in scope.row.taglist" size="mini" style="margin-right:5px"
60   - :disable-transitions="false" >{{item}}</el-tag>
  69 + <el-tag v-for="item in scope.row.taglist" size="mini" style="margin-right:5px" :disable-transitions="false">
  70 + {{item}}</el-tag>
61 71  
62 72 </template>
63 73 </el-table-column>
... ... @@ -149,6 +159,7 @@
149 159 }
150 160 };
151 161 return {
  162 +
152 163 title: '添加管理员',
153 164 buttonText: '立即创建',
154 165 userList: [],
... ... @@ -173,18 +184,92 @@
173 184 Password: '',
174 185 checkPass: '',
175 186 },
  187 + accountlist:[],
176 188 Count: 0,
177 189 query: {
178 190 PageIndex: 1,
179 191 PageSize: 1000,
180   -
  192 + date: '',
  193 + month:0,
  194 + day:1
181 195 },
182 196 }
183 197 },
184 198 created() {
185   - this.GetUser()
  199 + this.GetUser();
  200 +
  201 + this.$nextTick(() => {
  202 + // 点击前一个月
  203 + let prevBtn = document.querySelector(
  204 + ".el-calendar__button-group .el-button-group>button:nth-child(1)"
  205 + );
  206 + prevBtn.addEventListener("click", e => {
  207 + console.log(this.query.date);
  208 + this.handlemonth(1);
  209 + });
  210 +
  211 + //点击下一个月
  212 + let nextBtn = document.querySelector(
  213 + ".el-calendar__button-group .el-button-group>button:nth-child(3)"
  214 + );
  215 + nextBtn.addEventListener("click", () => {
  216 + console.log(this.query.date);
  217 + this.handlemonth(-1);
  218 + });
  219 +
  220 + //点击今天
  221 + let todayBtn = document.querySelector(
  222 + ".el-calendar__button-group .el-button-group>button:nth-child(2)"
  223 + );
  224 + todayBtn.addEventListener("click", () => {
  225 + this.handlemonth(0);
  226 + });
  227 + });
186 228 },
187 229 methods: {
  230 + getContent(data,date){
  231 + // {{ data.day.split('-').slice(1).join('-') }} {{ data.isSelected ? '✔️' : ''}}
  232 + var html = [];
  233 + html.push( data.day.split('-').slice(1).join('-'));
  234 + try {
  235 + var d = this.accountlist.filter(o=>o.startTime == data.day);
  236 + if(d){
  237 + d.forEach((item)=>{
  238 + html.push(`<el-tag type="success" style=" background-color: #ecf5ff;
  239 + display: inline-block;
  240 + height: 32px;
  241 + padding: 0 10px;
  242 + line-height: 30px;
  243 + font-size: 12px;
  244 + color: #409eff;
  245 + border: 1px solid #d9ecff;
  246 + border-radius: 4px;
  247 + box-sizing: border-box;
  248 + white-space: nowrap;">${item.qujian+':'+item.count}</el-tag>`);
  249 + });
  250 + }
  251 + } catch (error) {
  252 +
  253 + }
  254 + return html.join(' &nbsp;');
  255 + },
  256 + handlemonth(val) {
  257 + switch (val) {
  258 + case -1:
  259 + this.query.day=0;
  260 + this.query.month--;
  261 + break;
  262 + case 0:
  263 + this.query.month = 0;
  264 + this.query.day =1;
  265 + break;
  266 + case 1:
  267 + this.query.month++;
  268 + this.query.day =0;
  269 + break;
  270 + }
  271 + this.GetUser();
  272 + },
188 273 search() {
189 274 this.GetUser();
190 275 },
... ... @@ -229,7 +314,8 @@
229 314  
230 315 GetUser() {
231 316 GetCompanyInvitation(this.query).then(res => {
232   - this.userList = res.data.data
  317 + this.userList = res.data.data.list || [];
  318 + this.accountlist = res.data.data.account || []
233 319 this.Count = res.data.records
234 320 })
235 321 },
... ...