|
|
@@ -24,23 +24,25 @@ const props = defineProps({
|
|
24
|
24
|
const emit = defineEmits(['getLogs'])
|
|
25
|
25
|
|
|
26
|
26
|
const logs = ref([]);
|
|
27
|
|
-
|
|
28
|
|
-onMounted(async () => {
|
|
29
|
|
-
|
|
30
|
|
- const result = await getPatientLogs({
|
|
31
|
|
- patientId: props.patientId,
|
|
32
|
|
- });
|
|
33
|
|
-
|
|
34
|
|
- if (result.data && result.data.length > 0) {
|
|
35
|
|
- logs.value = result.data
|
|
36
|
|
-
|
|
37
|
|
- // 父组件可能未加载完成,所以延迟1s推送数据
|
|
38
|
|
- setTimeout(() => {
|
|
39
|
|
- emit('getLogs', logs.value)
|
|
40
|
|
- }, 1000)
|
|
41
|
|
- }
|
|
|
27
|
+watch(props, (nweProps) => {
|
|
|
28
|
+ initMethod(nweProps);
|
|
|
29
|
+});
|
|
|
30
|
+onMounted(() => {
|
|
|
31
|
+ initMethod()
|
|
42
|
32
|
})
|
|
43
|
|
-
|
|
|
33
|
+function initMethod() {
|
|
|
34
|
+ getPatientLogs({
|
|
|
35
|
+ patientId: props.patientId,
|
|
|
36
|
+ }).then((res) => {
|
|
|
37
|
+ if (res.state === 'success') {
|
|
|
38
|
+ logs.value = res.data;
|
|
|
39
|
+ // 父组件可能未加载完成,所以延迟1s推送数据
|
|
|
40
|
+ setTimeout(() => {
|
|
|
41
|
+ emit('getLogs', logs.value)
|
|
|
42
|
+ }, 1000)
|
|
|
43
|
+ }
|
|
|
44
|
+ })
|
|
|
45
|
+}
|
|
44
|
46
|
</script>
|
|
45
|
47
|
|
|
46
|
48
|
<style lang="scss" scoped>
|