hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
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
<template>
  <div class="page_status">
    <v-header
      title="设备预警"
      :bar="bar"
      search
      @on-search="onSearch"
    ></v-header>
 
    <div class="tab">
      <v-tool-table :trs="trs" :tds="tds">
        <!-- 处理结果: -->
        <template v-slot:result="item">
          <div class="table_flex">
            <!-- {{item.scope.id}} -->
            <div :style="{ color: item.scope.resultColor }">
              {{ item.scope.disposeResult }}
            </div>
          </div>
        </template>
 
        <template v-slot:btn="item">
          <div class="table_flex" v-if="item.scope.disposeType === '1'">
            <!-- {{item.scope.id}} -->
            <span class="col_primary" @click="clickHandle('1', item.scope.id)"
              >处理</span
            >
            <span class="col_primary" @click="clickHandle('4', item.scope.id)"
              >忽略</span
            >
          </div>
        </template>
        <template v-slot:more="item">
          <div class="table_flex">
            <!-- {{item.scope.id}} -->
            <span class="col_primary" @click="onCheck(item.scope.id)"
              >查看</span
            >
          </div>
        </template>
      </v-tool-table>
    </div>
    <!-- 分页 -->
    <v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
    <!-- 处理弹窗 -->
    <el-dialog
      title="处理"
      :visible.sync="dialogVisible"
      width="400px"
      :before-close="handleClose"
      append-to-body
    >
      <div>
        <el-form
          :model="sosForm"
          ref="sosForm"
          label-position="top"
          :inline="true"
          label-width="400px"
          class="yourForm"
        >
          <el-form-item
            label="处理人:"
            prop="disposeUserId"
            style="width:100%;"
          >
            <el-select
              class="custom-select"
              v-model="assignor"
              placeholder="请选择"
              style="width:100%;"
            >
              <el-option
                v-for="item in handlerList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            label="预警内容:"
            prop="earlyWarningText"
            style="width:100%;"
          >
            <el-input
              style="width:100%;"
              v-model.trim="sosForm.earlyWarningText"
              type="textarea"
              :rows="4"
              class="input-width"
              placeholder="请输入预警内容"
              size="small"
            ></el-input>
          </el-form-item>
        </el-form>
        <div class="fl-cen">
          <el-button size="small" @click="handleClose">取 消</el-button>
          <el-button type="primary" @click="submitHandle">确 定</el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import { mapState } from "vuex";
export default {
  props: {},
  components: {},
  data() {
    return {
      bar: [
        { title: "设备ID", name: "equipmentNumber" },
        { title: "用户姓名", name: "userName" },
        { title: "绑定手机号", name: "phone" },
        {
          title: "预警类型",
          name: "type",
          type: "select",
          list: [
            { label: "血压异常", value: "1" },
            { label: "心率异常", value: "2" },
            { label: "体温异常", value: "3" },
            { label: "SOS预警", value: "4" }
          ],
          width: "150px !important"
        }
      ],
      trs: [
        { text: "序号", val: "index", width: "50px" },
        { text: "预警时间", val: "creationTime" },
        { text: "设备编号", val: "equipmentNumber" },
        { text: "用户姓名", val: "userName" },
        { text: "绑定手机号", val: "binPhone" },
        { text: "预警类型", val: "earlyWarningType" },
        { text: "处理结果", val: "btn", slot: "result" },
        { text: "处理人", val: "disposeUserName" },
        { text: "操作", val: "btn", slot: "btn" },
        { text: "更多", val: "btn", slot: "more" }
      ],
      tds: [],
      paged: { page: 0, total: 0, r: 0, limit: 10 },
      os: {},
      search: {},
      assignor: "",
      dialogVisible: false,
      handlerList: [],
      sosForm: {
        id: "",
        earlyWarningText: ""
      }
    };
  },
  computed: {
    ...mapState({ vuex_page: "pageReset" })
  },
  watch: {
    vuex_page: {
      handler(n) {
        if (n.page === this.$route.path) {
          this.paged.page = 1;
          this.init();
        }
      },
      deep: true
    }
  },
  methods: {
    clickHandle(type, id) {
      switch (type) {
        case "1": {
          this.sosForm.id = id;
          this.dialogVisible = true;
          break;
        }
        case "4": {
          this.handle(type, id);
          break;
        }
 
        default:
          break;
      }
    },
    // 忽略
    handle(type, id) {
      let v = {
        id: id,
        disposeType: type
      };
      this.$api.post("JinhuibraceletApi/dispose", v, e => {
        demo.toast("已处理");
        this.dialogVisible = false;
        this.init();
      });
    },
    submitHandle() {
      if (!this.assignor) {
        return demo.toast("请选择分配处理人");
      }
 
      let v = {
        id: this.sosForm.id,
        disposeUserId: this.assignor,
        earlyWarningText: this.sosForm.earlyWarningText,
        disposeType: "3"
      };
      this.$api.post("JinhuibraceletApi/dispose", v, e => {
        demo.toast("已分配");
        this.dialogVisible = false;
        this.init();
      });
    },
    handleClose() {
      this.sosForm.id = "";
      this.dialogVisible = false;
    },
    //分配人
    distribution() {
      let user = demo.$session.get("user") || {};
      let d = {
        communityId: user.communityId
      };
      this.$api.get("JinhuibraceletApi/conductorList", d, e => {
        this.handlerList = e.map(d => {
          return {
            label: d.name,
            value: d.userId
          };
        });
      });
    },
 
    // 置顶
    onSearch(v) {
      // if (v.time && v.time.length && v.time[1]) {
      //   v.publishAtBegin = v.time[0];
      //   v.publishAtEnd = v.time[1];
      // } else {
      //   v.publishAtBegin = "";
      //   v.publishAtEnd = "";
      // }
      this.search = demo.copy(v);
      // delete this.search.time;
      this.paged.page = 1;
      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 user = demo.$session.get("user") || {};
 
      let v = demo.copy(
        Object.assign(this.os, this.search, {
          pageNum: this.paged.page,
          pageSize: this.paged.limit,
          communityId: user.communityId || ""
        })
      );
      this.$api.get("JinhuibraceletApi/getEarlyWarningList", v, e => {
        this.paged.total = e.total;
        this.paged.r++;
        this.tds = e.records || [];
        console.log("this.tds---" + JSON.stringify(this.tds));
        e.records.map((item, index) => {
          item.index = (this.paged.page - 1) * this.paged.limit + index + 1;
          if (item.earlyWarningType) {
            item.earlyWarningType = [
              "血压异常",
              "心率异常",
              "体温异常",
              "SOS预警"
            ][parseInt(item.earlyWarningType) - 1];
          }
          // (1 未处理2 已处理3处理中 4 忽略
          if (item.disposeType) {
            item.disposeResult = ["未处理", "已处理", "处理中", "忽略"][
              parseInt(item.disposeType) - 1
            ];
            item.resultColor = ["#FB4646", "#05CC96", "#4985FF", "#B4B4B4"][
              parseInt(item.disposeType) - 1
            ];
          }
        });
      });
    },
    onCheck(id) {
      this.$router.push({
        path: "/jh_OldManWristband_DeviceWorning_detail",
        query: { id: id }
      });
    }
  },
  mounted() {
    //查询动态分类列表
    // this.queryDynamic();
    this.search = {
      equipmentNumber: "",
      type: "",
      userName: "",
      phone: ""
    };
    this.distribution();
  }
};
</script>
 
<style lang="less" scoped>
.page_status {
  overflow-y: auto;
  .add,
  .tab {
    margin-bottom: 10px;
  }
  .yourForm {
    .el-input {
      width: 350px;
    }
  }
}
</style>