1. 优化了一些交互,中药药品编辑交互

2. dev和生产环境统一鉴别
This commit is contained in:
李琦
2026-05-30 13:52:44 +08:00
parent ad370375a7
commit 6d93314222
15 changed files with 496 additions and 326 deletions

View File

@@ -28,7 +28,7 @@
<view v-if="patientList.length" class="list">
<view
v-for="(row, idx) in patientList"
:key="rowKey(row, idx)"
:key="row._wxKey"
class="ol-card flex-row flex-ali-center"
:data-idx="idx"
@tap="onPatientCardTap"
@@ -38,7 +38,6 @@
<u-loading slot="loading"></u-loading>
</u-image>
<u-badge
:key="'ol-ub-' + rowKey(row, idx) + '-' + Number(row.unread_count || 0)"
v-if="Number(row.unread_count) > 0"
:count="Number(row.unread_count)"
:offset="[-4, -4]"
@@ -174,7 +173,7 @@ export default {
}
const next = [...this.patientList];
next.splice(idx, 1, copy);
this.patientList = this.sortPatientList(next);
this.patientList = this.mapPatientRows(this.sortPatientList(next));
},
unwrap(res) {
if (res == null) return null;
@@ -182,11 +181,17 @@ export default {
if (res.data && res.data.result !== undefined) return res.data.result;
return res;
},
rowKey(row, idx) {
const room = row.room_id != null && row.room_id !== '' ? String(row.room_id) : 'r0';
const reg = row.register_id != null ? row.register_id : row.id;
const ord = row.order_no != null && row.order_no !== '' ? String(row.order_no) : '';
return `${room}-${reg != null ? reg : 'x'}-${ord}-${idx}`;
mapPatientRows(rows) {
return (rows || []).map((row, idx) => {
const room = row.room_id != null && row.room_id !== '' ? String(row.room_id) : 'r0';
const reg = row.register_id != null ? row.register_id : row.id;
const ord = row.order_no != null && row.order_no !== '' ? String(row.order_no) : '';
const ub = Number(row.unread_count || 0);
return {
...row,
_wxKey: `${room}-${reg != null ? reg : 'x'}-${ord}-${ub}`,
};
});
},
lastMessageSortTs(row) {
const t = row.last_message_time || row.updated_at || row.register_time;
@@ -276,7 +281,7 @@ export default {
const res = await getOnlineConsultationPatientListApi({ type: this.listType });
const raw = this.unwrap(res);
const arr = Array.isArray(raw) ? raw : [];
this.patientList = this.sortPatientList(arr);
this.patientList = this.mapPatientRows(this.sortPatientList(arr));
} catch (e) {
console.error(e);
this.patientList = [];