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
| <template>
| <div>
| <a-card :bordered="false">
| <a-spin :spinning="confirmLoading">
| <a-button
| :disabled="data.length>1"
| type="primary"
| icon="plus"
| @click="$refs.addOrEditForm.showModal('add')"
| v-if="hasPerm('iEdoShiftTeamShift:add')"
| >
| 新增
| </a-button>
|
| <!-- 表格 -->
| <a-table
| style="padding: 20px"
| :columns="columns"
| :data-source="data"
| :pagination="pages"
| :rowKey="(record) => record.id"
| >
| <!-- 序号 -->
| <span slot="indexScopedSlots" slot-scope="text, record, index">{{ index + 1 }}</span>
| <span slot="isNextDayScopedSlots" slot-scope="text">{{ text?'是':'否' }}</span>
| <!-- 操作 -->
| <template slot="action" slot-scope="text, record">
| <a v-if="hasPerm('iEdoShiftTeamShift:edit')" @click="$refs.addOrEditForm.showModal('edit',record)">编辑</a>
| <!-- <a-divider type="vertical" v-if="hasPerm('iEdoShiftTeamShift:edit') && hasPerm('iEdoShiftTeamShift:delete')" />
| <a v-if="hasPerm('iEdoShiftTeamShift:delete')" @click="deleteHandle(record.id)">删除</a> -->
| </template>
| </a-table>
| </a-spin>
| </a-card>
|
| <addOrEditForm ref="addOrEditForm" @reflesh="getShiftInfo" />
| </div>
| </template>
| <script>
| import { STable, XCard } from '@/components'
| import moment from 'moment'
| import addOrEditForm from './addOrEditForm.vue'
| import { getShiftInfo } from '@/api/modular/main/ShiftManage'
| export default {
| components: {
| STable,
| XCard,
| addOrEditForm
| },
| data() {
| return {
| gutter: 36,
| colMd: 6,
| colSm: 18,
| labelCol: {
| xs: { span: 24 },
| sm: { span: 8 }
| },
| wrapperCol: {
| xs: { span: 24 },
| sm: { span: 15 }
| },
| confirmLoading: false,
| data: [],
| queryParam: {},
| pages: {
| current: 1,
| pageSize: 10,
| total: 0,
| showSizeChanger: true,
| showTotal: (total, range) => `${range[0]}-${range[1]}共${total}条`,
| pageSizeOptions: ['10', '20', '30', '40'],
| onChange: this.getShiftInfo,
| onShowSizeChange: this.pageSizeChange
| },
| columns: [
| {
| title: '序',
| align: 'center',
| widthL: '50px',
| sorter: false,
| scopedSlots: { customRender: 'indexScopedSlots' }
| },
| {
| title: '班次名称',
| align: 'center',
| sorter: true,
| ellipsis: true,
| dataIndex: 'shiftName'
| },
| {
| title: '班次开始时间',
| align: 'center',
| sorter: true,
| ellipsis: true,
| dataIndex: 'shiftStartTime'
| },
| {
| title: '班次结束时间',
| align: 'center',
| sorter: true,
| ellipsis: true,
| dataIndex: 'shiftEndTime'
| },
| {
| title: '是否隔日',
| align: 'center',
| sorter: true,
| ellipsis: true,
| dataIndex: 'isNextDay',
| scopedSlots: { customRender: 'isNextDayScopedSlots' }
| },
| {
| title: '班组长',
| align: 'center',
| sorter: true,
| ellipsis: true,
| dataIndex: 'shiftRemark'
| }
| ]
| }
| },
| created() {
| if (this.hasPerm('EquipmentBaseInfo:edit')) {
| this.columns.push({
| title: '操作',
| width: '150px',
| align: 'center',
| dataIndex: 'action',
| scopedSlots: { customRender: 'action' }
| })
| }
| this.getShiftInfo()
| },
| methods: {
| moment,
| // 时间转换
| // TimeChange(t){
| // t = t == null ? '' : t;
| // return moment(t).format('YYYY-MM-DD hh:mm')},
| /**
| * 查询参数组装
| */
| switchingDate() {
| const queryParamdetergentchangetime = this.queryParam.detergentchangetimeDate
| if (queryParamdetergentchangetime != null) {
| this.queryParam.detergentchangetime = moment(queryParamdetergentchangetime).format('YYYY-MM-DD')
| if (queryParamdetergentchangetime.length < 1) {
| delete this.queryParam.detergentchangetime
| }
| } else {
| delete this.queryParam.detergentchangetime
| }
| const queryParamknifeToolChangeTime = this.queryParam.knifeToolChangeTimeDate
| if (queryParamknifeToolChangeTime != null) {
| this.queryParam.knifeToolChangeTime = moment(queryParamknifeToolChangeTime).format('YYYY-MM-DD')
| if (queryParamknifeToolChangeTime.length < 1) {
| delete this.queryParam.knifeToolChangeTime
| }
| } else {
| delete this.queryParam.knifeToolChangeTime
| }
| const obj = JSON.parse(JSON.stringify(this.queryParam))
| return obj
| },
| // 获取班次数据
| async getShiftInfo(pageNo) {
| if (pageNo) {
| this.pages.current = pageNo
| }
| this.queryParam.pageNo = this.pages.current
| this.queryParam.pageSize = this.pages.pageSize
| this.confirmLoading = true
| try {
| const { data } = await getShiftInfo(this.queryParam)
| this.data = data.rows
| this.pages.total = data.totalRows
| } catch (error) {
| console.log(error)
| }
| this.confirmLoading = false
| },
| // pageSize 变化的回调
| pageSizeChange(current, size) {
| this.pages.pageSize = size
| this.getShiftInfo(1)
| }
| }
| }
| </script>
| <style lang="less">
| .table-operator {
| margin-bottom: 18px;
| }
| button {
| margin-right: 8px;
| }
| </style>
|
|