Много чего
This commit is contained in:
@@ -7,7 +7,7 @@ import {useNotification} from "../../../Composables/useNotification.js";
|
||||
|
||||
const open = defineModel('open')
|
||||
const props = defineProps({
|
||||
patientId: {
|
||||
patientInfo: {
|
||||
type: Number,
|
||||
}
|
||||
})
|
||||
@@ -18,10 +18,10 @@ const loading = ref(true)
|
||||
const patient = ref({})
|
||||
const showArchiveHistoryModal = ref(false)
|
||||
const selectedArchiveHistoryId = ref(null)
|
||||
const selectedArchiveHistoryType = ref(null)
|
||||
const selectedArchiveHistoryType = ref(props.patientInfo.type)
|
||||
const isCreateNewArchiveHistoryModal = ref(false)
|
||||
const archiveInfo = ref({
|
||||
id: props.patientId,
|
||||
id: props.patientInfo.id,
|
||||
num: null,
|
||||
post_in: null,
|
||||
status: null
|
||||
@@ -30,7 +30,7 @@ const emits = defineEmits(['historyUpdated', 'closeWithoutSave'])
|
||||
|
||||
const onResetData = () => {
|
||||
archiveInfo.value = {
|
||||
id: props.patientId,
|
||||
id: props.patientInfo.id,
|
||||
num: null,
|
||||
post_in: null,
|
||||
status: null
|
||||
@@ -47,16 +47,16 @@ const patientData = ref({
|
||||
})
|
||||
|
||||
const loadPatientData = async () => {
|
||||
if (!props.patientId) return
|
||||
if (!props.patientInfo.id) return
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
await axios.get(`/api/si/patients/${props.patientId}?view_type=${filtersRef.value.view_type}`).then(res => {
|
||||
await axios.get(`/api/si/patients/${props.patientInfo.id}?view_type=${props.patientInfo.type}`).then(res => {
|
||||
patient.value = res.data
|
||||
patientData.value = res.data.info
|
||||
archiveInfo.value = res.data.archiveInfo ?? {
|
||||
historyable_type: res.data.historyable_type,
|
||||
id: props.patientId,
|
||||
// historyable_type: res.data.historyable_type,
|
||||
id: props.patientInfo.id,
|
||||
num: null,
|
||||
post_in: null,
|
||||
status: null,
|
||||
@@ -73,12 +73,12 @@ const loadPatientData = async () => {
|
||||
const onShowArchiveHistoryModal = (id) => {
|
||||
if (id === null) {
|
||||
isCreateNewArchiveHistoryModal.value = true
|
||||
selectedArchiveHistoryId.value = props.patientId
|
||||
selectedArchiveHistoryId.value = props.patientInfo.id
|
||||
} else {
|
||||
isCreateNewArchiveHistoryModal.value = false
|
||||
selectedArchiveHistoryId.value = id
|
||||
}
|
||||
selectedArchiveHistoryType.value = archiveInfo.value.historyable_type
|
||||
selectedArchiveHistoryType.value = props.patientInfo.type
|
||||
showArchiveHistoryModal.value = true
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ const onUpdateHistory = async ({data}) => {
|
||||
}
|
||||
emits('historyUpdated', {
|
||||
data: updatedData,
|
||||
patientId: props.patientId
|
||||
patientId: props.patientInfo.id
|
||||
})
|
||||
}
|
||||
|
||||
@@ -130,14 +130,14 @@ const hasCreateNew = computed(() => archiveInfo.value === null)
|
||||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
await axios.post(`/api/archive/histories/info/${props.patientId}`, archiveInfo.value).then(res => {
|
||||
await axios.post(`/api/archive/histories/info/${props.patientInfo.id}`, archiveInfo.value).then(res => {
|
||||
// onCloseWithoutSave()
|
||||
const updatedData = {
|
||||
status: archiveInfo.value.status,
|
||||
}
|
||||
emits('historyUpdated', {
|
||||
data: updatedData,
|
||||
patientId: props.patientId
|
||||
patientId: props.patientInfo.id
|
||||
})
|
||||
open.value = false
|
||||
})
|
||||
@@ -151,7 +151,7 @@ const onSubmit = async () => {
|
||||
}
|
||||
|
||||
// Наблюдаем за изменением patientId
|
||||
watch(() => props.patientId, async (newId) => {
|
||||
watch(() => props.patientInfo, async (newId) => {
|
||||
if (newId) {
|
||||
await loadPatientData()
|
||||
}
|
||||
@@ -177,6 +177,11 @@ watch(() => props.patientId, async (newId) => {
|
||||
<NFormItem label="Дата поступления карты в архив">
|
||||
<NDatePicker v-model:value="archiveInfo.post_in" format="dd.MM.yyyy" />
|
||||
</NFormItem>
|
||||
<NFormItem label="№ карты в МИС / СофтИнфо">
|
||||
<NTag :bordered="false" round class="w-full justify-center">
|
||||
{{ archiveInfo.mis_num }} / {{ archiveInfo.foxpro_num }}
|
||||
</NTag>
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
</NFlex>
|
||||
<NButton @click="onShowArchiveHistoryModal(null)" :disabled="!patientData.can_be_issued">
|
||||
@@ -202,7 +207,7 @@ watch(() => props.patientId, async (newId) => {
|
||||
<NSpin :show="true" />
|
||||
</div>
|
||||
</NModal>
|
||||
<ArchiveHistoryMoveModal @history-updated="onUpdateHistory" @close-without-save="selectedArchiveHistoryId = null" :is-create-new="isCreateNewArchiveHistoryModal" v-model:open="showArchiveHistoryModal" :active-history-type="selectedArchiveHistoryType" :archive-history-id="selectedArchiveHistoryId" />
|
||||
<ArchiveHistoryMoveModal @history-updated="onUpdateHistory" @close-without-save="selectedArchiveHistoryId = null" :is-create-new="isCreateNewArchiveHistoryModal" v-model:open="showArchiveHistoryModal" :type="selectedArchiveHistoryType" :archive-history-id="selectedArchiveHistoryId" />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user