WXL (wul)
5 天以前 39c8b288ec8294e026459dfb1955f0bbc49ebb52
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
<template>
  <el-dialog
    title="临近超时任务"
    :visible.sync="visible"
    width="78%"
    :close-on-click-modal="false"
    append-to-body
    class="near-timeout-dialog"
  >
    <el-alert
      v-if="taskList.length > 0"
      type="warning"
      :closable="false"
      show-icon
      :title="'共有 ' + taskList.length + ' 条任务在未来48小时内到期,请及时处理'"
    />
 
    <el-table
      v-loading="loading"
      :data="taskList"
      border
      stripe
      class="near-timeout-table"
      style="width: 100%"
    >
      <el-table-column
        label="任务名称"
        prop="taskName"
        min-width="140"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column label="姓名" prop="sendname" width="90" align="center" />
      <el-table-column
        label="诊断名称"
        prop="leavediagname"
        min-width="140"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column label="随访状态" width="100" align="center">
        <template slot-scope="scope">
          <el-tag
            v-if="scope.row.sendstate == 2"
            type="primary"
            :disable-transitions="false"
            >待随访</el-tag
          >
          <el-tag v-else type="info" :disable-transitions="false">--</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="应随访日期" width="150" align="center">
        <template slot-scope="scope">
          <span>{{ formatTime(scope.row.visitTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="科室" prop="deptname" width="120" align="center" />
      <el-table-column
        label="病区"
        prop="leavehospitaldistrictname"
        width="140"
        align="center"
      />
      <el-table-column label="联系电话" prop="phone" width="130" align="center" />
      <el-table-column label="操作" width="110" align="center" fixed="right">
        <template slot-scope="scope">
          <el-button size="medium" type="text" @click="handleDetail(scope.row)">
            <i class="el-icon-s-order"></i>查看详情
          </el-button>
        </template>
      </el-table-column>
    </el-table>
 
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="visible = false">关 闭</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
import { getNearTimeoutList } from "@/api/AiCentre/index";
 
// 登录后自动弹出临近超时任务的机构白名单
const TARGET_ORGS = ["景宁畲族自治县人民医院", "浙江省新华医院"];
 
export default {
  name: "NearTimeoutDialog",
  data() {
    return {
      visible: false,
      loading: false,
      taskList: [],
    };
  },
  computed: {
    isTargetOrg() {
      const orgname = localStorage.getItem("orgname") || "";
      return TARGET_ORGS.indexOf(orgname) !== -1;
    },
  },
  mounted() {
    // 供随访工作台卡片点击打开
    this.$root.$on("open-near-timeout", this.open);
 
    // 登录后(非登录页)自动弹出
    if (this.isTargetOrg) {
      this.open();
    }
  },
  beforeDestroy() {
    this.$root.$off("open-near-timeout", this.open);
  },
  methods: {
    async open() {
      if (!this.isTargetOrg) {
        this.$modal.msgWarning("当前机构暂未开通临近超时任务");
        return;
      }
      this.visible = true;
      await this.loadList();
    },
    async loadList() {
      this.loading = true;
      try {
        const res = await getNearTimeoutList({ pageNum: 1, pageSize: 100 });
        this.taskList = res.rows || [];
      } catch (e) {
        console.error("加载临近超时任务失败:", e);
        this.taskList = [];
      } finally {
        this.loading = false;
      }
    },
    // 跳转详情页(与出院随访列表 Seedetails 保持一致)
    handleDetail(row) {
      let type = "";
      if (row.type == 1) {
        type = 1;
      }
      this.$router.push({
        path: "/followvisit/record/detailpage/",
        query: {
          taskid: row.taskid,
          patid: row.patid,
          id: row.id,
          Voicetype: type,
          visitCount: row.visitCount || 1,
        },
      });
      this.visible = false;
    },
    formatTime(value) {
      if (value === null || value === undefined || value === "") {
        return "";
      }
      if (typeof value === "number") {
        const d = new Date(value);
        const pad = (n) => (n < 10 ? "0" + n : "" + n);
        return (
          d.getFullYear() +
          "-" +
          pad(d.getMonth() + 1) +
          "-" +
          pad(d.getDate()) +
          " " +
          pad(d.getHours()) +
          ":" +
          pad(d.getMinutes())
        );
      }
      return String(value);
    },
  },
};
</script>
 
<style scoped>
.near-timeout-table {
  margin-top: 12px;
}
</style>