Bladeren bron

Merge branch 'master' of http://47.107.245.0:3000/xiongxing/kyj-yanglao-web-new

unknown 1 dag geleden
bovenliggende
commit
01555c1653

+ 8 - 0
src/api/elderly/nursing/index.ts

@@ -389,4 +389,12 @@ export const getElderlyItemsRoundDetail = (params: Recordable) => {
     url: 'elderly-items-round/get',
     params
   })
+}
+
+/** 导出长者巡房项目日志 Excel(params.yearMonth:YYYY-MM,与列表一致可传 tenantIds / elderName / role) */
+export const exportElderlyItemsRoundExcel = (params: Recordable) => {
+  return request.download({
+    url: 'elderly-items-round/exportExcel',
+    params
+  })
 }

+ 15 - 0
src/views/elderly/apply/check-in-request/ProcessForm.vue

@@ -1227,6 +1227,7 @@ let dataForm = reactive<ChechInRequestFormType>({
   address: '',
   salesUserId: '',
   nurseLevelId: '',
+  nurseLevelName: '',
   contractNumber: '',
   censusRegister: '',
   idCard: '',
@@ -1486,6 +1487,20 @@ const getNurseLevelList = async () => {
   }
 }
 
+/** 护理等级仅绑定了 id,提交需带上名称;列表未加载前保留接口下发的 nurseLevelName */
+const syncNurseLevelName = () => {
+  const id = dataForm.nurseLevelId
+  if (id === '' || id === null || id === undefined) {
+    dataForm.nurseLevelName = ''
+    return
+  }
+  const item = nurseLevelList.value.find((n) => String(n.id) === String(id))
+  if (item) {
+    dataForm.nurseLevelName = item.nurseLevelName
+  }
+}
+
+watch([() => dataForm.nurseLevelId, nurseLevelList], syncNurseLevelName, { deep: true })
 
 const setTenantId = (tId, type=1) => {
   dataForm.tenantId = tId

+ 2 - 0
src/views/elderly/apply/types.ts

@@ -13,6 +13,8 @@ export interface ChechInRequestFormType {
   contractNumber: string
   censusRegister: string
   careType: number
+  nurseLevelId: string | number
+  nurseLevelName: string
   idCard: string
   idCard2: string
   bloodType: string

+ 75 - 1
src/views/elderly/nursing/room-Inspection-project-log/index.vue

@@ -36,6 +36,11 @@
     </el-form>
   </ContentWrap>
   <ContentWrap>
+    <div class="mb-10px">
+      <el-button type="primary" plain @click="openExportDialog">
+        <Icon icon="ep:download" class="mr-5px" /> 导出
+      </el-button>
+    </div>
     <Table2
       v-loading="loading"
       :list="list"
@@ -55,16 +60,47 @@
     />
 
     <Detail ref="detailRef" />
+
+    <el-dialog
+      v-model="exportDialogVisible"
+      title="导出巡房项目日志"
+      width="420px"
+      append-to-body
+      destroy-on-close
+    >
+      <el-form label-width="88px">
+        <el-form-item label="导出年月" required>
+          <TgDatePicker
+            v-model="exportYearMonth"
+            type="month"
+            placeholder="请选择年月"
+            class="!w-full"
+          />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="exportDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="exportLoading" @click="confirmExport">确定</el-button>
+      </template>
+    </el-dialog>
   </ContentWrap>
 </template>
 <script setup lang="ts">
-import { getElderlyItemsRoundPage } from '@/api/elderly/nursing'
+import { ElLoading } from 'element-plus'
+import download from '@/utils/download'
+import { formatToDate2 } from '@/utils/dateUtil'
+import { exportElderlyItemsRoundExcel, getElderlyItemsRoundPage } from '@/api/elderly/nursing'
 import Detail from './Detail.vue'
 import { ElderlyItemsRoundLogColumns } from '../column'
 import { useUserStore } from '@/store/modules/user'
 import { ROLE_SUBMIT_LABEL, getRoleSubmitLabel } from './roleSubmitLabel'
 
 const userStore = useUserStore()
+const message = useMessage()
+
+const exportDialogVisible = ref(false)
+const exportYearMonth = ref(formatToDate2())
+const exportLoading = ref(false)
 
 const roleSubmitOptions = Object.entries(ROLE_SUBMIT_LABEL).map(([enumKey, label]) => ({
   enumKey,
@@ -133,6 +169,44 @@ const openDetail = (row: Recordable) => {
   detailRef.value?.open(row, buildDetailListFilters())
 }
 
+const openExportDialog = () => {
+  exportYearMonth.value = formatToDate2()
+  exportDialogVisible.value = true
+}
+
+const buildExportParams = (): Recordable => {
+  const p: Recordable = {
+    tenantIds: queryParams.tenantIds,
+    yearMonth: exportYearMonth.value
+  }
+  const { role, elderName } = queryParams as Recordable
+  if (role !== '' && role != null) p.role = role
+  if (elderName !== '' && elderName != null) p.elderName = elderName
+  return p
+}
+
+const confirmExport = async () => {
+  if (!exportYearMonth.value) {
+    message.warning('请选择导出年月')
+    return
+  }
+  exportLoading.value = true
+  const fullscreenLoading = ElLoading.service({
+    lock: true,
+    text: '正在导出,请稍候...',
+    background: 'rgba(0, 0, 0, 0.7)'
+  })
+  try {
+    const data = await exportElderlyItemsRoundExcel(buildExportParams())
+    download.excel(data as Blob, `巡房项目日志-${exportYearMonth.value}.xls`)
+    exportDialogVisible.value = false
+    message.success('导出成功')
+  } finally {
+    fullscreenLoading.close()
+    exportLoading.value = false
+  }
+}
+
 onMounted(() => {
   getList()
 })