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
199
200
201
202
203
204
205
206
207
208
209
| <template>
| <div class="inoculation">
| <v-header
| title="接种信息管理"
| :bar="bar"
| search
| @on-search="onSearch"
| @on-reset="onReset"
| ></v-header>
| <div class="add">
| <button class="m_btn small bgc_primary" @click="onIn">导入</button>
| <button class="m_btn small bgc_green" @click="onOut">导出</button>
| <button class="m_btn small bgc_info" @click="onDown">下载导入模板</button>
| </div>
| <div class="tab">
| <v-tool-table :trs="trs" :tds="tds" first firstWidth="50px">
| <template v-slot:first-th>
| <div>
| <el-checkbox v-model="maxall"></el-checkbox>
| </div>
| </template>
| <template v-slot:first-td="{ scope }">
| <div>
| <el-checkbox v-model="scope.is_check"></el-checkbox>
| </div>
| </template>
| <template v-slot:btn="item">
| <div class="table_flex">
| <!-- {{item.scope.state}} -->
| <span class="col_primary" @click="onShow(item.scope)">查看</span>
| </div>
| </template>
| <template v-slot:sex="item">
| <b>{{ ["保密", "男", "女", "保密"][item.scope.sex] }}</b>
| </template>
| </v-tool-table>
| </div>
| <v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
| </div>
| </template>
|
| <script>
| import { mapState } from "vuex";
| export default {
| props: {},
| components: {},
| data() {
| return {
| bar: [
| { title: "姓名", name: "name" },
| { title: "身份证号", name: "idCard" },
| { title: "手机号", name: "phone" },
| { title: "登记时间", name: "d", type: "times" },
| {
| title: "接种剂次",
| name: "dosage",
| },
| ],
| trs: [
| { text: "序号", val: "id", width: "60px" },
| { text: "姓名", val: "name" },
| { text: "性别", val: "btn", slot: "sex", width: "60px" },
| { text: "年龄", val: "age", width: "60px" },
| { text: "手机号", val: "phone" },
| { text: "身份证号", val: "idCard" },
| { text: "接种时间", val: "inoculationAt" },
| { text: "接种剂次", val: "dosage" },
| { text: "医疗机构", val: "medicalInstitution" },
| { text: "疫苗批号", val: "vaccinesCode" },
| { text: "疫苗名称", val: "vaccines" },
| { text: "备注", val: "remark" },
| { text: "操作", val: "btn" },
| ],
| tds: [],
| paged: { page: 0, total: 0, r: 0, limit: 10 },
| os: {},
| search: {},
| maxall: false,
| maxallTime: false,
| sendIds: [],
| };
| },
| computed: {
| ...mapState({ vuex_page: "pageReset" }),
| },
| watch: {
| vuex_page: {
| handler(n) {
| if (n.page === this.$route.path) {
| this.init();
| }
| },
| deep: true,
| },
| maxall(n) {
| if (this.maxallTime) return 0;
| this.tds = this.tds.map((r) => {
| r.is_check = n;
| return r;
| });
| },
| tds: {
| handler(n) {
| let x = n.filter((r) => {
| return r.is_check;
| });
| this.maxallTime = true;
| this.maxall = x.length === n.length && x.length > 0;
| setTimeout(() => {
| this.maxallTime = false;
| }, 500);
| this.sendIds = x.map((r) => {
| return r.id;
| });
| },
| deep: true,
| },
| },
| methods: {
| onIn() {
| demo.toast("接口未出");
| },
| onDown() {
| demo.toast("接口未出");
| },
| onOut() {
| let v = demo.copy(
| Object.assign(this.os, this.search, {
| pageNum: this.paged.page,
| pageSize: this.paged.limit,
| ids: this.sendIds,
| })
| );
| this.$api.post("vaccines/inoculation/export", v, (e) => {
| window.location.href = e;
| });
| },
| onShow(e) {
| this.$store.dispatch("setFixed", {
| event: "add",
| data: {
| title: "接种信息管理详情",
| type: "aff-ino",
| data: e,
| },
| time: Date.now(),
| });
| },
| onReset(e) {
| this.onSearch(e);
| },
| onSearch(e) {
| let x = demo.copy(e);
| if (x.d && x.d.length === 2) {
| x.startTime = x.d[0];
| x.endTime = x.d[1];
| } else {
| x.endTime = "";
| x.startTime = "";
| }
| delete x.d;
| this.paged.page = 1;
| this.search = x;
| this.init();
| },
| onPage(v) {
| if (v.page === this.paged.page && v.page && !v.reset) {
| return 0;
| }
| this.paged.page = v.page;
| this.paged.limit = v.limit;
| this.init();
| },
| // 获取数据
| init() {
| let v = demo.copy(
| Object.assign(this.os, this.search, {
| pageNum: this.paged.page,
| pageSize: this.paged.limit,
| })
| );
| this.$api.post("vaccines/inoculation/list", v, (e) => {
| this.paged.total = e.total;
| this.paged.r++;
| this.tds = (e.records || []).map((r) => {
| r.is_check = false;
| return r;
| });
| });
| },
| },
| mounted() {},
| };
| </script>
| <style lang='less' scoped>
| .inoculation {
| overflow-y: auto;
| .add,
| .tab {
| margin-bottom: 8px;
| }
| .m_btn {
| min-width: 80px;
| & + .m_btn {
| margin-left: 20px;
| }
| }
| }
| </style>
|
|