|
|
@@ -1,8 +1,8 @@
|
|
1
|
1
|
<template>
|
|
2
|
2
|
<div>
|
|
3
|
3
|
<el-row :gutter="20" />
|
|
4
|
|
- <el-table :data="dataLists" border>
|
|
5
|
|
- <el-table-column label="员工姓名" align="center">
|
|
|
4
|
+ <el-table :data="dataLists" :cell-class-name="tableCellClassName" border @cell-click="tableCellFn">
|
|
|
5
|
+ <el-table-column label="员工姓名" align="center" width="170px">
|
|
6
|
6
|
<template slot-scope="scope">
|
|
7
|
7
|
<div>
|
|
8
|
8
|
<span>{{ scope.row.username }}</span>
|
|
|
@@ -10,22 +10,60 @@
|
|
10
|
10
|
</div>
|
|
11
|
11
|
</template>
|
|
12
|
12
|
</el-table-column>
|
|
|
13
|
+
|
|
13
|
14
|
<el-table-column
|
|
14
|
15
|
v-for="(item, index) in dataHeader"
|
|
15
|
16
|
:key="index"
|
|
16
|
17
|
:label="item"
|
|
17
|
18
|
align="center"
|
|
18
|
19
|
>
|
|
19
|
|
- <template slot-scope="scope">
|
|
20
|
|
- <template v-for="itemChlid in scope.row.datenum">
|
|
21
|
|
- <template v-if="item === itemChlid.datetime.split(' ')[0].split('-')[2]">{{ itemChlid.num }}</template>
|
|
|
20
|
+ <el-table-column label="其它标本" align="center" width="100px">
|
|
|
21
|
+ <template slot-scope="scope">
|
|
|
22
|
+ <template v-for="itemChlid in scope.row.datenum">
|
|
|
23
|
+ <div v-if="item === itemChlid.datetime.split(' ')[0].split('-')[2]" :key="tableKey">
|
|
|
24
|
+ <a v-if="cellShowData[`${scope.row.index}_${scope.column.index}`] !== true" >{{ itemChlid.othernum }}</a>
|
|
|
25
|
+ <el-input
|
|
|
26
|
+ v-else
|
|
|
27
|
+ :min="0"
|
|
|
28
|
+ v-model="itemChlid.othernum"
|
|
|
29
|
+ type="number"
|
|
|
30
|
+ @blur="setDatas(scope.row , item , itemChlid.othernum , `${scope.row.index}_${scope.column.index}` , itemChlid , '其它标本')"
|
|
|
31
|
+ />
|
|
|
32
|
+ </div>
|
|
|
33
|
+ </template>
|
|
22
|
34
|
</template>
|
|
23
|
|
- </template>
|
|
|
35
|
+ </el-table-column>
|
|
|
36
|
+
|
|
|
37
|
+ <el-table-column label="体检标本" align="center" width="100px">
|
|
|
38
|
+ <template slot-scope="scope">
|
|
|
39
|
+ <template v-for="itemChlid in scope.row.datenum">
|
|
|
40
|
+ <div v-if="item === itemChlid.datetime.split(' ')[0].split('-')[2]" :key="tableKey">
|
|
|
41
|
+ <a v-if="cellShowData[`${scope.row.index}_${scope.column.index}`] !== true" >{{ itemChlid.num }}</a>
|
|
|
42
|
+ <el-input
|
|
|
43
|
+ v-else
|
|
|
44
|
+ :min="0"
|
|
|
45
|
+ v-model="itemChlid.num"
|
|
|
46
|
+ type="number"
|
|
|
47
|
+ @blur="setDatas(scope.row , item , itemChlid.num , `${scope.row.index}_${scope.column.index}` , itemChlid , '体检标本')"
|
|
|
48
|
+ />
|
|
|
49
|
+ </div>
|
|
|
50
|
+ </template>
|
|
|
51
|
+ </template>
|
|
|
52
|
+ </el-table-column>
|
|
24
|
53
|
</el-table-column>
|
|
|
54
|
+
|
|
25
|
55
|
<el-table-column label="合计" align="center">
|
|
26
|
|
- <template slot-scope="scope">
|
|
27
|
|
- <div>{{ scope.row.total }}</div>
|
|
28
|
|
- </template>
|
|
|
56
|
+ <el-table-column label="其它标本" align="center" width="100px">
|
|
|
57
|
+ <template slot-scope="scope">
|
|
|
58
|
+ <div>{{ scope.row.othertotal }}</div>
|
|
|
59
|
+ </template>
|
|
|
60
|
+ </el-table-column>
|
|
|
61
|
+ <el-table-column label="体检标本" align="center" width="100px">
|
|
|
62
|
+ <template slot-scope="scope">
|
|
|
63
|
+ <div>{{ scope.row.total }}</div>
|
|
|
64
|
+ </template>
|
|
|
65
|
+ </el-table-column>
|
|
|
66
|
+
|
|
29
|
67
|
</el-table-column>
|
|
30
|
68
|
</el-table>
|
|
31
|
69
|
|
|
|
@@ -41,7 +79,9 @@ export default {
|
|
41
|
79
|
LoadingFlag: false,
|
|
42
|
80
|
params: {},
|
|
43
|
81
|
dataLists: [],
|
|
44
|
|
- dataHeader: []
|
|
|
82
|
+ dataHeader: [],
|
|
|
83
|
+ tableKey: 0,
|
|
|
84
|
+ cellShowData: {}
|
|
45
|
85
|
}
|
|
46
|
86
|
},
|
|
47
|
87
|
computed: {},
|
|
|
@@ -61,9 +101,103 @@ export default {
|
|
61
|
101
|
})
|
|
62
|
102
|
resolve()
|
|
63
|
103
|
})
|
|
|
104
|
+ },
|
|
|
105
|
+ tableCellFn(row, column) {
|
|
|
106
|
+ if (this.tableCellFn._show === 1 || row.username === '日合计') {
|
|
|
107
|
+ return
|
|
|
108
|
+ }
|
|
|
109
|
+
|
|
|
110
|
+ let dayNub = new Date(row.datenum[Math.ceil(column.index / 2) - 1].datetime).getDate()
|
|
|
111
|
+ dayNub = dayNub < 10 ? `0${dayNub}` : dayNub
|
|
|
112
|
+
|
|
|
113
|
+ // 权限判断
|
|
|
114
|
+ const userCode = localStorage.getItem('roleCode')
|
|
|
115
|
+ if (userCode !== 'GLY') {
|
|
|
116
|
+ const oldDate = this.params.sdate.split('-')
|
|
|
117
|
+ const oldDateStr = `${oldDate[0]}-${oldDate[1]}-${dayNub}`
|
|
|
118
|
+ const newDate = new Date()
|
|
|
119
|
+ const newDateStr = `${newDate.getFullYear()}-${newDate.getMonth() + 1 < 10 ? `0${newDate.getMonth() + 1}` : newDate.getMonth() + 1}-${newDate.getDate() < 10 ? `0${newDate.getDate()}` : newDate.getDate()}`
|
|
|
120
|
+
|
|
|
121
|
+ const findData = row.datenum.find(val => val.datetime.indexOf(oldDateStr) !== -1)
|
|
|
122
|
+
|
|
|
123
|
+ // console.table(findData)
|
|
|
124
|
+ // console.log(oldDateStr)
|
|
|
125
|
+ // console.log(newDateStr)
|
|
|
126
|
+
|
|
|
127
|
+ if (column.label === '其它标本') {
|
|
|
128
|
+ if (findData.othernum !== 0) {
|
|
|
129
|
+ return
|
|
|
130
|
+ }
|
|
|
131
|
+ } else {
|
|
|
132
|
+ if (findData.num !== 0) {
|
|
|
133
|
+ return
|
|
|
134
|
+ }
|
|
|
135
|
+ }
|
|
|
136
|
+
|
|
|
137
|
+ if (oldDateStr !== newDateStr) {
|
|
|
138
|
+ return
|
|
|
139
|
+ }
|
|
|
140
|
+ }
|
|
|
141
|
+
|
|
|
142
|
+ const linData = this.cellShowData[`${row.index}_${column.index}`]
|
|
|
143
|
+
|
|
|
144
|
+ // 互斥
|
|
|
145
|
+ for (const key in this.cellShowData) {
|
|
|
146
|
+ this.cellShowData[key] = false
|
|
|
147
|
+ }
|
|
|
148
|
+ this.cellShowData[`${row.index}_${column.index}`] = true
|
|
|
149
|
+
|
|
|
150
|
+ // 防止重复刷新
|
|
|
151
|
+ if (!linData) {
|
|
|
152
|
+ this.tableKey++
|
|
|
153
|
+ }
|
|
|
154
|
+ },
|
|
|
155
|
+ tableCellClassName({ row, column, rowIndex, columnIndex }) { // 注意这里是解构
|
|
|
156
|
+ // 利用单元格的 className 的回调方法,给行列索引赋值
|
|
|
157
|
+ row.index = rowIndex
|
|
|
158
|
+ column.index = columnIndex
|
|
|
159
|
+ },
|
|
|
160
|
+ setDatas(rowData, columnData, data, inp, row, type) {
|
|
|
161
|
+ if (data <= 0) {
|
|
|
162
|
+ if (type === '其它标本') {
|
|
|
163
|
+ row.othernum = 0
|
|
|
164
|
+ } else {
|
|
|
165
|
+ row.num = 0
|
|
|
166
|
+ }
|
|
|
167
|
+
|
|
|
168
|
+ data = 0
|
|
|
169
|
+ }
|
|
|
170
|
+
|
|
|
171
|
+ this.cellShowData[inp] = false
|
|
|
172
|
+ this.tableKey++
|
|
|
173
|
+
|
|
|
174
|
+ this.tableCellFn._show = 1
|
|
|
175
|
+ setTimeout(() => {
|
|
|
176
|
+ this.tableCellFn._show = 2
|
|
|
177
|
+ }, 170)
|
|
|
178
|
+
|
|
|
179
|
+ const resData = {
|
|
|
180
|
+ usercode: rowData.usercode,
|
|
|
181
|
+ username: rowData.username,
|
|
|
182
|
+ sdate: columnData
|
|
|
183
|
+ }
|
|
|
184
|
+
|
|
|
185
|
+ if (type === '其它标本') {
|
|
|
186
|
+ resData['OtherNumber'] = data
|
|
|
187
|
+ } else {
|
|
|
188
|
+ resData['number'] = data
|
|
|
189
|
+ }
|
|
|
190
|
+
|
|
|
191
|
+ this.$emit('setDatas', resData)
|
|
64
|
192
|
}
|
|
65
|
193
|
}
|
|
66
|
194
|
}
|
|
67
|
195
|
</script>
|
|
68
|
196
|
|
|
69
|
|
-<style scoped></style>
|
|
|
197
|
+<style scoped lang="scss">
|
|
|
198
|
+ /deep/ .el-table__row{
|
|
|
199
|
+ .el-table__cell:nth-child(n+2):nth-child(4n) , .el-table__cell:nth-child(n+2):nth-child(4n) + *{
|
|
|
200
|
+ background-color: #f3f3f3;
|
|
|
201
|
+ }
|
|
|
202
|
+ }
|
|
|
203
|
+</style>
|