gaoshp
2024-04-07 b86771c87f19521b18f8bbf5751e98239e8f1450
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
<!--
 * @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
-->
<template>
    <el-container>
        <el-header>
            <el-button :disabled="selections.length ==  0">
                删除
            </el-button>
            <el-button @click="table_add">
                创建
            </el-button>
            <el-select style="width: 200px;margin-left: auto;" v-model="year">
                <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-header>
        <el-main>
            <scTable highlight-current-row @dataChange="dataChange" @row-click="rowClick" ref="table" :params="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>
                <el-table-column label="日期" prop="startOffDay">
                    <template #default="scope">
                        <span>{{ scope.row.startOffDay }}-{{ scope.row.endOffDay }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="休息日说明" prop="remark"></el-table-column>
                <el-table-column label="操作" fixed="right" align="right" width="160">
                    <template #default="scope">
                        <el-button-group>
                            <el-button text type="primary" size="small"
                                @click="table_edit(scope.row, scope.$index)">编辑</el-button>
                            <el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index, '0')">
                                <template #reference>
                                    <el-button text type="primary" size="small">删除</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <Dialog @success="success" ref="dialog" :option="{
            years
        }"></Dialog>
    </el-container>
</template>
 
<script>
import Dialog from  './Dialog.vue'
export default {
    components: {
        Dialog
    },
    data() {
        return {
            year: '',
            date: '',
            apiObj:  '',
            selections: [],
            years: []
        }
    },
    created() {
        let startYear = 2020
        let years = []
        for (var i = 0; i < 100; i++) {
            years.push(startYear + i)
        }
        this.years = years;
        this.apiObj = this.$API.time.getList
    },
    methods: {
        table_add () {
            this.$refs.dialog.open()
        },
        table_edit (row) {
            this.$refs.dialog.open('edit', row)
        },
        table_del () {
        },
        dataChange () {},
        rowClick () {},
        selectionChange (selections) {
            this.selections = selections
        },
        success () {
            this.$refs.table.reload()
        }
    }
}
</script>
 
<style lang="scss" scoped></style>