gaoshp
2024-04-08 3aa4bac11ba6312db65459ce24810d13a63e3314
src/views/master/time/day-off/index.vue
@@ -1,26 +1,26 @@
<!--
 * @Date: 2024-04-07 20:43:26
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-07 22:50:04
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/master/time/day-off/index.vue
 * @LastEditors: gaoshp
 * @LastEditTime: 2024-04-08 15:02:14
 * @FilePath: /cps-web/src/views/master/time/day-off/index.vue
-->
<template>
    <el-container>
        <el-header>
            <el-button :disabled="selections.length ==  0">
            <el-button :disabled="selections.length ==  0" @click="dels">
                删除
            </el-button>
            <el-button @click="table_add">
                创建
            </el-button>
            <el-select style="width: 200px;margin-left: auto;" v-model="year">
            <el-select style="width: 200px;margin-left: auto;" v-model="year" @change="query">
                <el-option v-for="(item, index) in years" :key="index" :label="item" :value="item"></el-option>
            </el-select>
            <el-date-picker style="width: 200px;flex: 0  0 auto;margin-left: 8px;" v-model="date" type="daterange"
                range-separator="至" start-placeholder="开始" end-placeholder="结束" />
            <el-date-picker @change="query" style="width: 300px;flex: 0  0 auto;margin-left: 8px;" v-model="date" type="daterange"
                range-separator="至" start-placeholder="开始" end-placeholder="结束" value-format="YYYY-MM-DD"/>
        </el-header>
        <el-main>
            <scTable highlight-current-row @dataChange="dataChange" @row-click="rowClick" ref="table" :params="params"
            <scTable highlight-current-row  ref="table" :params="{}"
                :apiObj="apiObj" @selection-change="selectionChange" stripe>
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column label="所属年份" prop="year"></el-table-column>
@@ -74,6 +74,8 @@
        }
        this.years = years;
        this.apiObj = this.$API.time.getList
        this.year = new Date().getFullYear()
        this.date = [`${this.year}-01-01`,`${this.year}-12-31`]
    },
    methods: {
        table_add () {
@@ -82,15 +84,28 @@
        table_edit (row) {
            this.$refs.dialog.open('edit', row)
        },
        table_del () {
        query () {
            this.$refs.table.reload({
                year: this.year,
                startOffDay: this.date[0] || '',
                endOffDay: this.date[1] || ''
            })
        },
        dataChange () {},
        rowClick () {},
        table_del (row) {
            this.$API.time.remove.delete([row.id]).then(res => {
                this.query()
            })
        },
        dels () {
            this.$API.time.remove.delete([...this.selections.map(item => item.id)]).then(res => {
                this.query()
            })
        },
        selectionChange (selections) {
            this.selections = selections
        },
        success () {
            this.$refs.table.reload()
            this.query()
        }
    }
}