vue2-client 1.14.31 → 1.14.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,261 @@
1
+ <template>
2
+ <a-table
3
+ :columns="columns"
4
+ :data-source="data"
5
+ :rowSelection="rowSelection"
6
+ >
7
+ <span slot="time" class="time-title">
8
+ <span>上</span>
9
+ <span>下</span>
10
+ <span>晚</span>
11
+ </span>
12
+ <template slot="Monday" slot-scope="text, record">
13
+ <div class="time-title">
14
+ <a-button v-for="(item, index) in record.Monday" :key="index" @click="handleShiftChange('Monday', index, record)">{{item === 1 || item === '1' ? '坐诊' : '休息'}}</a-button>
15
+ </div>
16
+ </template>
17
+ <template slot="Tuesday" slot-scope="text, record">
18
+ <div class="time-title">
19
+ <a-button v-for="(item, index) in record.Tuesday" :key="index" @click="handleShiftChange('Tuesday', index, record)">{{item === 1 || item === '1' ? '坐诊' : '休息'}}</a-button>
20
+ </div>
21
+ </template>
22
+ <template slot="Wednesday" slot-scope="text, record">
23
+ <div class="time-title">
24
+ <a-button v-for="(item, index) in record.Wednesday" :key="index" @click="handleShiftChange('Wednesday', index, record)">{{item === 1 || item === '1' ? '坐诊' : '休息'}}</a-button>
25
+ </div>
26
+ </template>
27
+ <template slot="Thursday" slot-scope="text, record">
28
+ <div class="time-title">
29
+ <a-button v-for="(item, index) in record.Thursday" :key="index" @click="handleShiftChange('Thursday', index, record)">{{item === 1 || item === '1' ? '坐诊' : '休息'}}</a-button>
30
+ </div>
31
+ </template>
32
+ <template slot="Friday" slot-scope="text, record">
33
+ <div class="time-title">
34
+ <a-button v-for="(item, index) in record.Friday" :key="index" @click="handleShiftChange('Friday', index, record)">{{item === 1 || item === '1' ? '坐诊' : '休息'}}</a-button>
35
+ </div>
36
+ </template>
37
+ <template slot="Saturday" slot-scope="text, record">
38
+ <div class="time-title">
39
+ <a-button v-for="(item, index) in record.Saturday" :key="index" @click="handleShiftChange('Saturday', index, record)">{{item === 1 || item === '1' ? '坐诊' : '休息'}}</a-button>
40
+ </div>
41
+ </template>
42
+ <template slot="Sunday" slot-scope="text, record">
43
+ <div class="time-title">
44
+ <a-button v-for="(item, index) in record.Sunday" :key="index" @click="handleShiftChange('Sunday', index, record)">{{item === 1 || item === '1' ? '坐诊' : '休息'}}</a-button>
45
+ </div>
46
+ </template>
47
+ <template slot="sk_limit" slot-scope="text, record">
48
+ <a-input-number id="inputNumber" v-model="record.sk_limit" :min="1" :max="100" />
49
+ </template>
50
+ </a-table>
51
+ </template>
52
+ <script>
53
+ import { runLogic } from '@vue2-client/services/api/common'
54
+
55
+ const columns = [
56
+ {
57
+ title: '科室',
58
+ dataIndex: 'dept',
59
+ key: 'dept',
60
+ scopedSlots: { customRender: 'dept' },
61
+ align: 'center'
62
+ },
63
+ {
64
+ title: '人员',
65
+ dataIndex: 'personnel',
66
+ key: 'personnel',
67
+ align: 'center'
68
+ },
69
+ {
70
+ title: '职位',
71
+ dataIndex: 'position',
72
+ key: 'position',
73
+ align: 'center'
74
+ },
75
+ {
76
+ title: '上/下/晚',
77
+ dataIndex: 'time',
78
+ key: 'time',
79
+ scopedSlots: { customRender: 'time' },
80
+ align: 'center'
81
+ },
82
+ {
83
+ title: '周一',
84
+ key: 'Monday',
85
+ dataIndex: 'Monday',
86
+ scopedSlots: { customRender: 'Monday' },
87
+ align: 'center'
88
+ },
89
+ {
90
+ title: '周二',
91
+ key: 'Tuesday',
92
+ dataIndex: 'Tuesday',
93
+ scopedSlots: { customRender: 'Tuesday' },
94
+ align: 'center'
95
+ },
96
+ {
97
+ title: '周三',
98
+ key: 'Wednesday',
99
+ dataIndex: 'Wednesday',
100
+ scopedSlots: { customRender: 'Wednesday' },
101
+ align: 'center'
102
+ },
103
+ {
104
+ title: '周四',
105
+ key: 'Thursday',
106
+ dataIndex: 'Thursday',
107
+ scopedSlots: { customRender: 'Thursday' },
108
+ align: 'center'
109
+ },
110
+ {
111
+ title: '周五',
112
+ key: 'Friday',
113
+ dataIndex: 'Friday',
114
+ scopedSlots: { customRender: 'Friday' },
115
+ align: 'center'
116
+ },
117
+ {
118
+ title: '周六',
119
+ key: 'Saturday',
120
+ dataIndex: 'Saturday',
121
+ scopedSlots: { customRender: 'Saturday' },
122
+ align: 'center'
123
+ },
124
+ {
125
+ title: '周日',
126
+ key: 'Sunday',
127
+ dataIndex: 'Sunday',
128
+ scopedSlots: { customRender: 'Sunday' },
129
+ align: 'center'
130
+ },
131
+ {
132
+ title: '排班数',
133
+ key: 'sk_limit',
134
+ dataIndex: 'sk_limit',
135
+ scopedSlots: { customRender: 'sk_limit' },
136
+ align: 'center'
137
+ }
138
+ ]
139
+
140
+ export default {
141
+ data () {
142
+ return {
143
+ data: [],
144
+ columns,
145
+ weekDate: [],
146
+ // 选中的行键值集合
147
+ selectedRows: [],
148
+ // 选中的行信息集合
149
+ selectedRowKeys: []
150
+ }
151
+ },
152
+ computed: {
153
+ rowSelection () {
154
+ return {
155
+ selectedRowKeys: this.selectedRowKeys,
156
+ onChange: (selectedRowKeys, selectedRows) => {
157
+ this.onSelectChange(selectedRowKeys, selectedRows)
158
+ }
159
+ }
160
+ }
161
+ },
162
+ mounted () {
163
+ this.init()
164
+ },
165
+ methods: {
166
+ handleShiftChange (day, index, record) {
167
+ // 找到当前记录在data中的索引
168
+ const dataIndex = this.data.findIndex(item => item.id === record.id)
169
+ if (dataIndex === -1) return
170
+ // 获取当前状态
171
+ const currentValue = record[day][index]
172
+ const newValue = currentValue === 1 || currentValue === '1' ? 0 : 1
173
+ // 更新按钮显示
174
+ this.$set(record[day], index, newValue)
175
+ // 同步更新data中的数据
176
+ this.$set(this.data[dataIndex][day], index, newValue)
177
+ console.log('当前操作的行数据:', this.data[dataIndex])
178
+ },
179
+ onSelectChange (selectedRowKeys, selectedRows) {
180
+ this.selectedRowKeys = selectedRowKeys
181
+ this.selectedRows = selectedRows
182
+ console.log('selectedRows changed: ', selectedRows)
183
+ },
184
+ // 获取选中的行数据
185
+ getSelectedRowData () {
186
+ return this.selectedRows
187
+ },
188
+ getAllTable() {
189
+ return this.data
190
+ },
191
+ init () {
192
+ runLogic('shiftSchedulingLOGIC', {}, 'af-his').then(res => {
193
+ if (res && Array.isArray(res)) {
194
+ let key = 0
195
+ this.data = res.map(item => {
196
+ // 转换排班数据格式
197
+ const scheduleData = {
198
+ key: key++,
199
+ id: item.id,
200
+ dept: item.dept,
201
+ personnel: item.personnel,
202
+ position: item.position || '',
203
+ selected_id: item.selected_id,
204
+ sk_limit: item.sk_limit || 0,
205
+ Monday: [
206
+ item.f_monday_am === '1' ? 1 : 0,
207
+ item.f_monday_pm === '1' ? 1 : 0,
208
+ item.f_monday_evening === '1' ? 1 : 0
209
+ ],
210
+ Tuesday: [
211
+ item.f_tuesday_am === '1' ? 1 : 0,
212
+ item.f_tuesday_pm === '1' ? 1 : 0,
213
+ item.f_tuesday_evening === '1' ? 1 : 0
214
+ ],
215
+ Wednesday: [
216
+ item.f_wednesday_am === '1' ? 1 : 0,
217
+ item.f_wednesday_pm === '1' ? 1 : 0,
218
+ item.f_wednesday_evening === '1' ? 1 : 0
219
+ ],
220
+ Thursday: [
221
+ item.f_thursday_am === '1' ? 1 : 0,
222
+ item.f_thursday_pm === '1' ? 1 : 0,
223
+ item.f_thursday_evening === '1' ? 1 : 0
224
+ ],
225
+ Friday: [
226
+ item.f_friday_am === '1' ? 1 : 0,
227
+ item.f_friday_pm === '1' ? 1 : 0,
228
+ item.f_friday_evening === '1' ? 1 : 0
229
+ ],
230
+ Saturday: [
231
+ item.f_saturday_am === '1' ? 1 : 0,
232
+ item.f_saturday_pm === '1' ? 1 : 0,
233
+ item.f_saturday_evening === '1' ? 1 : 0
234
+ ],
235
+ Sunday: [
236
+ item.f_sunday_am === '1' ? 1 : 0,
237
+ item.f_sunday_pm === '1' ? 1 : 0,
238
+ item.f_sunday_evening === '1' ? 1 : 0
239
+ ]
240
+ }
241
+ return scheduleData
242
+ })
243
+ }
244
+ })
245
+ }
246
+ }
247
+ }
248
+ </script>
249
+
250
+ <style scoped type="less">
251
+ .time-title {
252
+ display: flex !important;
253
+ flex-direction: column !important;
254
+ align-items: center !important;
255
+ }
256
+ ::v-deep .ant-table-thead > tr > th,
257
+ ::v-deep .ant-table-tbody > tr > td {
258
+ padding: 8px 16px !important;
259
+ overflow-wrap: break-word;
260
+ }
261
+ </style>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <XShiftSchedule>
3
+ </XShiftSchedule>
4
+ </template>
5
+
6
+ <script>
7
+
8
+ import XShiftSchedule from './XShiftSchedule.vue'
9
+
10
+ export default {
11
+ components: {
12
+ XShiftSchedule
13
+ },
14
+ data () {
15
+ return {}
16
+ }
17
+ }
18
+
19
+ </script>
20
+
21
+ <style scoped lang="less">
22
+
23
+ </style>