WXL
2025-01-15 1cb1fbf80c955986385377b5f84e8915d1e655d6
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<template>
  <div>
    <el-dialog
      title="适用疾病选择"
      :visible.sync="dialogVisiblepatient"
      width="70%"
      :before-close="handleClosehz"
    >
      <div class="examine-jic">
        <div style="margin: 0 10px 20px 10px">
          <el-card class="box-card">
            <el-tag
              v-for="item in overallCase"
              :key="item.icdid"
              type="warning"
              closable
              @close="handleClose(item)"
            >
              {{ item.icdname }}
            </el-tag>
            <div style="margin-top: 20px; text-align: right">
              共选择<span
                style="font-size: 18px; color: #409eff; margin: 0 10px"
                >{{ overallCase.length }}</span
              >条数据
            </div>
          </el-card>
        </div>
        <div class="jic-value">
          <el-row :gutter="20">
            <!--用户数据-->
            <el-form
              :model="patientqueryParams"
              ref="queryForm"
              size="small"
              :inline="true"
              label-width="98px"
            >
              <el-form-item label="疾病名称" prop="name">
                <el-input
                  v-model="patientqueryParams.icdname"
                  placeholder="请输入疾病名称"
                  @keyup.enter.native="handleAddpatient"
                />
              </el-form-item>
 
              <el-form-item>
                <el-button
                  type="primary"
                  icon="el-icon-search"
                  size="medium"
                  @click="handleAddpatient"
                  >搜索</el-button
                >
                <el-button
                  icon="el-icon-refresh"
                  size="medium"
                  @click="resetQuery"
                  >重置</el-button
                >
              </el-form-item>
            </el-form>
            <!-- 选择器官列表 -->
            <el-table
              ref="multipleTable"
              :data="donorchargeList"
              tooltip-effect="dark"
              style="width: 100%"
              @selection-change="handleSelectionChange"
            >
              <el-table-column class="checkall" type="selection" width="55">
              </el-table-column>
              <el-table-column
                prop="icdid"
                label="疾病编号"
                width="100"
                show-overflow-tooltip
              >
              </el-table-column>
              <el-table-column label="疾病名称" show-overflow-tooltip>
                <template slot-scope="scope">{{ scope.row.icdname }}</template>
              </el-table-column>
 
              <el-table-column prop="icdcode" label="疾病编码" width="150">
              </el-table-column>
            </el-table>
          </el-row>
          <pagination
            v-show="patienttotal > 0"
            :total="patienttotal"
            :page.sync="patientqueryParams.pageNum"
            :limit.sync="patientqueryParams.pageSize"
            @pagination="handleAddpatient"
          />
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="$emit('addoption')">取 消</el-button>
        <el-button type="primary" @click="AddDispatchpatients"
          >确定添加</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>
 
<script>
import { getillnesslist, deltargetillness } from "@/api/AiCentre/index";
export default {
  name: "Diseasetotality",
  data() {
    return {
      patienttotal: 0, //
      // 当前页选中数据
      multipleSelection: [],
      // 总选中数据
      // overallCase: [],
      patientqueryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      donorchargeList: [],
      donorchargeanlList: [], //案例列表
    };
  },
 
  props: {
    dialogVisiblepatient: {
      type: Boolean,
      default: () => {
        return false;
      },
    },
    overallCase: {
      type: Array,
      required: true,
      default: () => [],
    },
    // 5问卷模板、3随访模板、6宣教
    type: {
      type: Number,
      default: () => {
        return 5;
      },
    },
  },
 
  created() {},
 
  mounted() {
    // this.handleAddpatient();
  },
 
  watch: {},
 
  methods: {
    handleClosehz() {
      this.$emit("addoption");
    },
    // 选择数据标签删除事件
    handleClose(item) {
      console.log(item);
      if (this.multipleSelection.indexOf(item) == -1 && !item.outid) {
        console.log(1);
        this.overallCase.splice(this.overallCase.indexOf(item), 1);
      } else if (item.outid) {
        this.$modal
          .confirm('是否确认删除名称为"' + item.icd10name + '"的数据项?')
          .then(() => {
            this.multipleSelection.splice(
              this.multipleSelection.indexOf(item),
              1
            );
            deltargetillness(item.id).then((res) => {
              if (res.code == 200) {
                this.$modal.msgSuccess("删除成功");
                this.overallCase.splice(this.overallCase.indexOf(item), 1);
              }
            });
            // 取消挂载状态
            this.$refs.multipleTable.toggleRowSelection(item, false);
          })
          .catch(() => {});
      } else {
        this.overallCase.splice(this.overallCase.indexOf(item), 1);
        this.multipleSelection.splice(this.multipleSelection.indexOf(item), 1);
        // 取消挂载状态
        this.$refs.multipleTable.toggleRowSelection(item, false);
      }
    },
    resetQuery() {
      this.patientqueryParams.icdname = null;
      this.handleAddpatient();
    },
    // 触发查询事件
    handleAddpatient(row) {
      this.$emit("kkoption");
 
      getillnesslist(this.patientqueryParams).then((res) => {
        this.donorchargeList = res.rows;
        this.patienttotal = res.total;
        console.log(this.$refs.multipleTable, "22");
        this.Restorecheck();
      });
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      if (this.decision) return;
      // 判断是否有删除
      if (this.multipleSelection.length <= selection.length) {
        this.multipleSelection = selection;
      } else {
        console.log(selection, "selection");
        console.log(this.multipleSelection, "this.multipleSelection");
        this.multipleSelection.forEach((item) => {
          if (selection.includes(item)) {
          } else {
            if (this.multipleSelection.length == 1) {
              this.multipleSelection = [];
            } else {
              this.multipleSelection.splice(
                this.multipleSelection.indexOf(item),
                1
              );
            }
            if (this.overallCase.length == 1) {
              this.overallCase = [];
            } else {
              this.overallCase.splice(this.overallCase.indexOf(item), 1);
            }
          }
        });
      }
      // 赋值给整体选中数组
      console.log(this.overallCase);
      this.multipleSelection.forEach((item) => {
        console.log(
          this.overallCase.every((obj) => obj.icdname != item.icdname)
        );
 
        if (this.overallCase.every((obj) => obj.icdname != item.icdname)) {
          this.overallCase.push(item);
        }
      });
      console.log(this.multipleSelection, "触发选择后multipleSelection");
    },
    // 切换页后恢复选中
    Restorecheck() {
      console.log(this.overallCase, "this.overallCase");
      const allid = this.overallCase.map((item) => item.icdname);
      const overlap = this.donorchargeList.filter((value) => {
        return allid.includes(value.icdname);
      });
      // 保持ids和当前页面的同步性
      this.multipleSelection = overlap;
      console.log(this.multipleSelection, "进入分页multipleSelection");
 
      this.toggleSelection(overlap);
    },
    // 挂载选择状态
    toggleSelection(rows) {
      if (rows) {
        this.decision = true;
        this.$nextTick(() => {
          rows.forEach((row) => {
            this.$refs.multipleTable.toggleRowSelection(row, true);
          });
          this.decision = false;
        });
        console.log(123);
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    AddDispatchpatients() {
      this.$emit("addoption");
    },
  },
};
</script>
 
<style lang="scss" scoped>
.examine-jic {
  .headline {
    font-size: 24px;
    border-left: 5px solid #41a1be;
    padding-left: 5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    .Add-details {
      font-size: 18px;
      color: #02a7f0;
      cursor: pointer;
    }
  }
  .jic-value {
    font-size: 20px;
    border-top: 1px solid #a7abac;
    padding: 10px;
    margin-bottom: 10px;
    .details-jic {
      padding: 10px 15px;
      border: 1px solid #dcdfe6;
      -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
        0 0 6px 0 rgba(0, 0, 0, 0.04);
      .details-title {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        div:nth-child(2) {
          color: #02a7f0;
          cursor: pointer;
        }
      }
      .details-renw {
        background: #e4ebfc;
        padding: 15px 5px;
        border-radius: 5px;
        margin-bottom: 20px;
      }
    }
  }
}
::v-deep.el-table .el-table__header th:first-child .el-checkbox {
  display: none;
}
.el-tag + .el-tag {
  margin-left: 10px;
  margin-bottom: 10px;
}
</style>