|
@@ -36,6 +36,11 @@
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</ContentWrap>
|
|
</ContentWrap>
|
|
|
<ContentWrap>
|
|
<ContentWrap>
|
|
|
|
|
+ <div class="mb-10px">
|
|
|
|
|
+ <el-button type="primary" plain @click="openExportDialog">
|
|
|
|
|
+ <Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </div>
|
|
|
<Table2
|
|
<Table2
|
|
|
v-loading="loading"
|
|
v-loading="loading"
|
|
|
:list="list"
|
|
:list="list"
|
|
@@ -55,16 +60,47 @@
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<Detail ref="detailRef" />
|
|
<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>
|
|
</ContentWrap>
|
|
|
</template>
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
<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 Detail from './Detail.vue'
|
|
|
import { ElderlyItemsRoundLogColumns } from '../column'
|
|
import { ElderlyItemsRoundLogColumns } from '../column'
|
|
|
import { useUserStore } from '@/store/modules/user'
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
import { ROLE_SUBMIT_LABEL, getRoleSubmitLabel } from './roleSubmitLabel'
|
|
import { ROLE_SUBMIT_LABEL, getRoleSubmitLabel } from './roleSubmitLabel'
|
|
|
|
|
|
|
|
const userStore = useUserStore()
|
|
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]) => ({
|
|
const roleSubmitOptions = Object.entries(ROLE_SUBMIT_LABEL).map(([enumKey, label]) => ({
|
|
|
enumKey,
|
|
enumKey,
|
|
@@ -133,6 +169,44 @@ const openDetail = (row: Recordable) => {
|
|
|
detailRef.value?.open(row, buildDetailListFilters())
|
|
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(() => {
|
|
onMounted(() => {
|
|
|
getList()
|
|
getList()
|
|
|
})
|
|
})
|