diff --git a/src/api/Pregnancy_Test/Pregnancy_Test.js b/src/api/Pregnancy_Test/Pregnancy_Test.js index 345608e..8547e00 100644 --- a/src/api/Pregnancy_Test/Pregnancy_Test.js +++ b/src/api/Pregnancy_Test/Pregnancy_Test.js @@ -42,3 +42,14 @@ export function delPregnancy_Test(id) { method: 'delete' }) } + +// 根据耳号查询羊只信息 +export function getSheepByManageTags(manageTags) { + return request({ + url: '/Pregnancy_Test/Pregnancy_Test/getSheepByManageTags', + method: 'get', + params: { + manageTags: manageTags + } + }) +} \ No newline at end of file diff --git a/src/views/Pregnancy_Test/Pregnancy_Test/index.vue b/src/views/Pregnancy_Test/Pregnancy_Test/index.vue index 989d52f..9b423b9 100644 --- a/src/views/Pregnancy_Test/Pregnancy_Test/index.vue +++ b/src/views/Pregnancy_Test/Pregnancy_Test/index.vue @@ -1,45 +1,43 @@ - +/* 🔥 监听 enddate 变化,自动计算治疗天数 */ +watch(() => form.value.enddate, (newVal) => { + if (newVal && form.value.begindate) { + const start = new Date(form.value.begindate) + const end = new Date(newVal) + const diffTime = Math.abs(end - start) + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + form.value.treatDay = diffDays + } else { + form.value.treatDay = 0 + } +}) + +/* 🔥 可选:监听 begindate 变化,重新计算天数 */ +watch(() => form.value.begindate, () => { + if (form.value.enddate) { + const start = new Date(form.value.begindate) + const end = new Date(form.value.enddate) + const diffTime = Math.abs(end - start) + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + form.value.treatDay = diffDays + } +}) + +onMounted(() => { + getList() + getDiseases() + listSheepfold_management().then(res => { + sheepfoldOptions.value = res.rows.map(item => ({ value: item.id, label: item.sheepfoldName })) + }) +}) + \ No newline at end of file diff --git a/src/views/biosafety/disinfect/index.vue b/src/views/biosafety/disinfect/index.vue index ace824e..66547ac 100644 --- a/src/views/biosafety/disinfect/index.vue +++ b/src/views/biosafety/disinfect/index.vue @@ -1,324 +1,516 @@ +/* ------------------ 下拉数据 ------------------ */ +const barns = ref([]) +const presOptions = ref([]) +const units = ref([]) +const usages = ref([]) +const medicines = ref([]) + +/* 校验规则 */ +const rules = { + sheepfoldIds: [{ required: true, message: '请选择羊舍', trigger: 'change' }], + datetime: [{ required: true, message: '请选择日期', trigger: 'change' }] +} + +/* 处方选择事件 - 新增 */ +function handleSelectPrescription(id) { + if (!id) return + getPrescription(id).then(res => { + usageDetails.value = res.data?.swPresDetailList?.map(i => ({ + mediId: i.mediId, + dosage: i.dosage, + unit: i.unitId, + usageId: i.usageId + })) || [] + }) +} + +/* 处方选择事件 - 修改 */ +function handleSelectPrescriptionEdit(id) { + if (!id) return + getPrescription(id).then(res => { + editDetails.value = res.data?.swPresDetailList?.map(i => ({ + mediId: i.mediId, + dosage: i.dosage, + unit: i.unitId, + usageId: i.usageId + })) || [] + }) +} + +/* 明细添加行 - 新增 */ +function handleAddDetail() { + usageDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null }) +} + +/* 明细添加行 - 修改 */ +function handleAddDetailEdit() { + editDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null }) +} + +/* ------------------ 初始加载 ------------------ */ +onMounted(() => { + getList() + /* 加载本地羊舍 */ + request({ url: '/sheepfold_management/sheepfold_management/list', method: 'get' }).then(res => { + barns.value = res.rows + }) + listPrescription({ status: 1, persType: 1 }).then(res => { + presOptions.value = res.rows.map(item => ({ id: item.id, label: item.name })) + }) + listUnit().then(res => { + units.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listUsage().then(res => { + usages.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listMedicine().then(res => { + medicines.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) +}) + \ No newline at end of file diff --git a/src/views/biosafety/health/index.vue b/src/views/biosafety/health/index.vue index e9fc95a..8cdf7b3 100644 --- a/src/views/biosafety/health/index.vue +++ b/src/views/biosafety/health/index.vue @@ -1,21 +1,16 @@ +/* ------------------ 药品/处方/下拉 ------------------ */ +const usageDetails = ref([]) +const presOptions = ref([]) +const units = ref([]) +const usages = ref([]) +const medicines = ref([]) + +function handleSelectPrescription(id) { + if (!id) return + getPrescription(id).then(res => { + usageDetails.value = res.data?.swPresDetailList?.map(i => ({ + mediId: i.mediId, + dosage: i.dosage, + unit: i.unitId, + usageId: i.usageId + })) || [] + }) +} + +function handleAddDetail() { + usageDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null }) +} + +/* ------------------ 初始化 ------------------ */ +onMounted(() => { + getList() + getBarns() + listPrescription({ status: 1, persType: 2 }).then(res => { + presOptions.value = res.rows.map(item => ({ id: item.id, label: item.name })) + }) + listUnit().then(res => { + units.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listUsage().then(res => { + usages.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listMedicine().then(res => { + medicines.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) +}) + \ No newline at end of file diff --git a/src/views/biosafety/immunity/index.vue b/src/views/biosafety/immunity/index.vue index 63112dc..dffa551 100644 --- a/src/views/biosafety/immunity/index.vue +++ b/src/views/biosafety/immunity/index.vue @@ -1,31 +1,16 @@ +/* ------------------ 药品/处方/下拉 ------------------ */ +const usageDetails = ref([]) +const presOptions = ref([]) +const units = ref([]) +const usages = ref([]) +const medicines = ref([]) + +function handleSelectPrescription(id) { + if (!id) return + getPrescription(id).then(res => { + usageDetails.value = res.data?.swPresDetailList?.map(i => ({ + mediId: i.mediId, + dosage: i.dosage, + unit: i.unitId, + usageId: i.usageId + })) || [] + }) +} + +function handleAddDetail() { + usageDetails.value.push({ mediId: null, dosage: 0, unit: null, usageId: null, manufacturer: null, batchNumber: null }) +} + +/* ------------------ 初始化 ------------------ */ +onMounted(() => { + getList() + getBarns() + listPrescription({ status: 1, persType: 0 }).then(res => { + presOptions.value = res.rows.map(item => ({ id: item.id, label: item.name })) + }) + listUnit().then(res => { + units.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listUsage().then(res => { + usages.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) + listMedicine().then(res => { + medicines.value = res.rows.map(item => ({ value: item.id, label: item.name })) + }) +}) + \ No newline at end of file