vue2-client 1.14.34 → 1.14.35

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.
@@ -3,11 +3,9 @@
3
3
  :columns="columns"
4
4
  :data-source="data"
5
5
  :rowSelection="rowSelection"
6
- >
6
+ :scroll="{ y: '75vh' }">
7
7
  <span slot="time" class="time-title">
8
- <span>上</span>
9
- <span>下</span>
10
- <span>晚</span>
8
+ <span v-for="(item, index) in configData.timePeriod" :key=index>{{item}}</span>
11
9
  </span>
12
10
  <template slot="Monday" slot-scope="text, record">
13
11
  <div class="time-title">
@@ -45,108 +43,100 @@
45
43
  </div>
46
44
  </template>
47
45
  <template slot="sk_limit" slot-scope="text, record">
48
- <a-input-number id="inputNumber" v-model="record.sk_limit" :min="1" :max="100" />
46
+ <a-input-number id="inputNumber" v-model="record.sk_limit" :min="configData.sk_limitMin" :max="configData.sk_limitMax" />
49
47
  </template>
50
48
  </a-table>
51
49
  </template>
52
50
  <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
- ]
51
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
139
52
 
140
53
  export default {
141
54
  data () {
142
55
  return {
143
56
  data: [],
144
- columns,
145
- weekDate: [],
57
+ // 列配置
58
+ columns: [],
59
+ // 列名
60
+ columnNames: [],
146
61
  // 选中的行键值集合
147
62
  selectedRows: [],
148
63
  // 选中的行信息集合
149
- selectedRowKeys: []
64
+ selectedRowKeys: [],
65
+ // 原始数据备份
66
+ originalData: [],
67
+ // 配置参数
68
+ configData: {},
69
+ // 排班时间表
70
+ shiftTable: [
71
+ {
72
+ title: '周一',
73
+ key: 'Monday',
74
+ dataIndex: 'Monday',
75
+ scopedSlots: { customRender: 'Monday' },
76
+ align: 'center'
77
+ },
78
+ {
79
+ title: '周二',
80
+ key: 'Tuesday',
81
+ dataIndex: 'Tuesday',
82
+ scopedSlots: { customRender: 'Tuesday' },
83
+ align: 'center'
84
+ },
85
+ {
86
+ title: '周三',
87
+ key: 'Wednesday',
88
+ dataIndex: 'Wednesday',
89
+ scopedSlots: { customRender: 'Wednesday' },
90
+ align: 'center'
91
+ },
92
+ {
93
+ title: '周四',
94
+ key: 'Thursday',
95
+ dataIndex: 'Thursday',
96
+ scopedSlots: { customRender: 'Thursday' },
97
+ align: 'center'
98
+ },
99
+ {
100
+ title: '周五',
101
+ key: 'Friday',
102
+ dataIndex: 'Friday',
103
+ scopedSlots: { customRender: 'Friday' },
104
+ align: 'center'
105
+ },
106
+ {
107
+ title: '周六',
108
+ key: 'Saturday',
109
+ dataIndex: 'Saturday',
110
+ scopedSlots: { customRender: 'Saturday' },
111
+ align: 'center'
112
+ },
113
+ {
114
+ title: '周日',
115
+ key: 'Sunday',
116
+ dataIndex: 'Sunday',
117
+ scopedSlots: { customRender: 'Sunday' },
118
+ align: 'center'
119
+ },
120
+ {
121
+ title: '排班数',
122
+ key: 'sk_limit',
123
+ dataIndex: 'sk_limit',
124
+ scopedSlots: { customRender: 'sk_limit' },
125
+ align: 'center'
126
+ }
127
+ ]
128
+ }
129
+ },
130
+ props: {
131
+ // 配置名
132
+ queryParamsName: {
133
+ type: String,
134
+ default: ''
135
+ },
136
+ // 服务名
137
+ serviceName: {
138
+ type: String,
139
+ default: 'af-his'
150
140
  }
151
141
  },
152
142
  computed: {
@@ -159,9 +149,7 @@ export default {
159
149
  }
160
150
  }
161
151
  },
162
- mounted () {
163
- this.init()
164
- },
152
+ mounted () {},
165
153
  methods: {
166
154
  handleShiftChange (day, index, record) {
167
155
  // 找到当前记录在data中的索引
@@ -174,75 +162,78 @@ export default {
174
162
  this.$set(record[day], index, newValue)
175
163
  // 同步更新data中的数据
176
164
  this.$set(this.data[dataIndex][day], index, newValue)
177
- console.log('当前操作的行数据:', this.data[dataIndex])
178
165
  },
179
166
  onSelectChange (selectedRowKeys, selectedRows) {
180
167
  this.selectedRowKeys = selectedRowKeys
181
168
  this.selectedRows = selectedRows
182
- console.log('selectedRows changed: ', selectedRows)
183
169
  },
184
170
  // 获取选中的行数据
185
171
  getSelectedRowData () {
186
172
  return this.selectedRows
187
173
  },
188
- getAllTable() {
174
+ // 获取全部数据
175
+ getAllTable () {
189
176
  return this.data
190
177
  },
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
- }
178
+ // 初始化数据
179
+ async init (queryParamsName) {
180
+ getConfigByName(queryParamsName, this.serviceName, result => {
181
+ this.configData = result
182
+ runLogic(result.dataSource, {}, this.serviceName).then(res => {
183
+ this.columns = []
184
+ this.columns = JSON.parse(JSON.stringify(this.configData.columns))
185
+ for (let i = 0; i < this.shiftTable.length; i++) {
186
+ this.columns.push(this.shiftTable[i])
187
+ }
188
+ if (res && Array.isArray(res)) {
189
+ const weekDays = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
190
+ const shifts = ['am', 'pm', 'evening']
191
+ let key = 0
192
+ this.data = res.map(item => {
193
+ const scheduleData = {
194
+ key: key++
195
+ }
196
+ this.configData.columnsName.forEach(columnName => { scheduleData[columnName] = item[columnName] })
197
+ weekDays.forEach(day => {
198
+ scheduleData[day.charAt(0).toUpperCase() + day.slice(1)] = shifts.map(shift => item[`f_${day}_${shift}`] === '1' ? 1 : 0)
199
+ })
200
+ return scheduleData
201
+ })
202
+ // 保存原始数据
203
+ this.originalData = JSON.parse(JSON.stringify(this.data))
204
+ }
205
+ })
206
+ })
207
+ },
208
+ // 查询数据函数
209
+ filterTableData (filters) {
210
+ if (!filters || Object.keys(filters).length === 0) {
211
+ // 如果没有过滤条件,恢复原始数据
212
+ this.data = JSON.parse(JSON.stringify(this.originalData))
213
+ return
214
+ }
215
+ // 从原始数据开始过滤
216
+ this.data = this.originalData.filter(item => {
217
+ // 检查每一项是否满足所有过滤条件
218
+ return Object.entries(filters).every(([key, value]) => {
219
+ // 如果过滤值是字符串,进行模糊匹配
220
+ if (typeof value === 'string') {
221
+ return item[key] && item[key].toString().toLowerCase().includes(value.toLowerCase())
222
+ }
223
+ // 如果过滤值是数字,进行精确匹配
224
+ return item[key] === value
225
+ })
244
226
  })
245
227
  }
228
+ },
229
+ watch: {
230
+ queryParamsName: {
231
+ handler (newValue) {
232
+ this.init(newValue)
233
+ },
234
+ deep: true,
235
+ immediate: true
236
+ }
246
237
  }
247
238
  }
248
239
  </script>
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <XShiftSchedule>
2
+ <XShiftSchedule
3
+ :query-params-name="queryParamsName"
4
+ :service-name="serviceName"
5
+ >
3
6
  </XShiftSchedule>
4
7
  </template>
5
8
 
@@ -12,7 +15,10 @@ export default {
12
15
  XShiftSchedule
13
16
  },
14
17
  data () {
15
- return {}
18
+ return {
19
+ queryParamsName: 'schedulingRuleConfigurationConfig',
20
+ serviceName: 'af-his'
21
+ }
16
22
  }
17
23
  }
18
24