| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <template>
- <ContentWrap>
- <!-- 保护性约束观察记录表 -->
- <el-form
- class="-mb-15px"
- :model="queryParams"
- ref="queryFormRef"
- :inline="true"
- label-width="110px"
- >
- <el-form-item label="长者姓名">
- <el-input
- v-model="queryParams.elderName"
- placeholder="长者姓名"
- class="!w-240px"
- clearable
- />
- </el-form-item>
- <el-form-item label="评估人">
- <el-input
- v-model="queryParams.assessor"
- placeholder="长者姓名"
- class="!w-240px"
- clearable
- />
- </el-form-item>
- <el-form-item label="记录日期">
- <el-date-picker
- size="default"
- ref="selectRef"
- class="!w-240px"
- v-model="queryParams.assessDate"
- type="daterange"
- :clearable="true"
- :editable="false"
- placeholder="选择记录日期"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- date-format="YYYY-MM-DD"
- />
- </el-form-item>
- <el-form-item>
- <el-button @click="handleQuery" style="margin-left: 2vw"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
- <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
- </el-form-item>
- </el-form>
- </ContentWrap>
- <!-- 列表 -->
- <ContentWrap>
- <div class="mb-10px">
- <ButtonAdd @click="openForm(undefined)" />
- <!-- <el-button @click="inputH" type="success"><Icon icon="fa:cloud-upload" :size="16" class="mr-1"/>导入</el-button>-->
- <!-- <ButtonImport @click="handleImportCard" />-->
- </div>
- <el-table v-loading="loading" :data="list" :header-cell-style="tableHeaderColor">
- <el-table-column header-align="center" align="center" label="序号" width="60">
- <template #default="scope">
- {{
- scope.$index + (queryParams.pageNo * queryParams.pageSize - queryParams.pageSize) + 1
- }}
- </template>
- </el-table-column>
- <el-table-column prop="elderName" header-align="center" align="center" label="长者姓名" min-width="150" show-overflow-tooltip/>
- <el-table-column prop="assessor" header-align="center" align="center" label="评估人" min-width="200" show-overflow-tooltip/>
- <el-table-column prop="assessDate" header-align="center" align="center" label="记录日期" min-width="200" show-overflow-tooltip/>
- <el-table-column prop="creator" header-align="center" align="center" label="记录人" min-width="200" show-overflow-tooltip/>
- <el-table-column label="操作" align="center" width="200" >
- <template #default="scope">
- <el-button
- link
- type="primary"
- @click="openFormEdit(scope.row, scope.row.id)"
- >
- 编辑
- </el-button>
- <el-button
- link
- type="warning"
- @click="openFormDetail(scope.row,scope.row.id)"
- >
- 详情
- </el-button>
- <el-button
- link
- type="danger"
- @click="openClose(scope.row)"
- >
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 分页 -->
- <Pagination
- :total="total"
- v-model:page="queryParams.pageNo"
- v-model:limit="queryParams.pageSize"
- @pagination="getList"
- />
- </ContentWrap>
- <AddForm ref="formRef" @success="getList" />
- <!-- 通用批量导出弹窗 -->
- <BatchExportDialog
- :show="showBatchExport"
- :title="exportConfig.title"
- :loading="exportLoading"
- :batch-min="exportConfig.batchMin"
- :batch-max="exportConfig.batchMax"
- :count-min="exportConfig.countMin"
- :count-max="exportConfig.countMax"
- :default-batch="exportConfig.defaultBatch"
- :default-count="exportConfig.defaultCount"
- :description="exportConfig.description"
- @update:show="showBatchExport = $event"
- @confirm="handleBatchExport"
- @cancel="showBatchExport = false"
- />
- <Import
- ref="importRef"
- @success="getList"
- :config="{
- title: '导入',
- downloadUrl: 'elderly-service-order/get-import-template',
- excelTempName: '居家工单-【导入】模板',
- importUrl: '/elderly-service-order/import',
- failExportUrl: '',
- }"
- />
- </template>
- <script setup lang="ts">
- import AddForm from "./AddForm.vue";
- import ButtonAdd from "@/components/ButtonAdd/src/ButtonAdd.vue";
- import { useUserStore } from '@/store/modules/user'
- import {formatTimestamp, getCurrentMonthRange} from "@/utils/dateUtil";
- import Import from "@/components/ImportFile/index.vue";
- import {
- sdsDelete, sdsPage
- } from "@/api/social-work";
- const message = useMessage() // 消息弹窗
- const { t } = useI18n() // 国际化
- const userStore = useUserStore()
- const loading = ref(true) // 列表的加载中
- const detailRef = ref()
- const importRef = ref()
- const total = ref(0) // 列表的总页数
- const list = ref([]) // 列表的数据
- // 状态管理
- const showBatchExport = ref(false)
- const exportConfig = ref({
- title: '',
- batchMin: 1,
- batchMax: 999,
- countMin: 1,
- countMax: 200,
- defaultBatch: 1,
- defaultCount: 200,
- description: [] as string[]
- })
- const exportLoading = ref(false)
- let queryParams = reactive({
- pageNo: 1,
- pageSize: 10,
- elderName: '',
- assessor: '',
- assessDate: getCurrentMonthRange(),
- tenantIds: userStore.orgTenantId
- })
- const queryFormRef = ref() // 搜索的表单
- // 打开导出弹窗
- const handleImportCard = async () => {
- // showBatchExport.value = true
- }
- // 处理批量导出
- const handleBatchExport = async (batch: number, count: number) => {
- exportLoading.value = true
- console.log(batch,count)
- // try {
- // let queryParams = {
- // pageNo: batch,
- // pageSize: count,
- // tenantId: userStore.orgTenantId[0]
- // }
- // const list = await careRecordsPage(queryParams)
- // if (list.length <= 0) {
- // message.error('暂无数据可以导出!')
- // return
- // }
- // const headers = [
- // { key: 'organizationName', title: '机构名称' },
- // { key: 'visitName', title: '姓名' },
- // { key: 'visitPhone', title: '手机号' },
- // { key: 'visitDate', title: '预约时间' },
- // { key: 'accompanyCount', title: '陪同人数' },
- // { key: 'reason', title: '理由' }
- // ]
- // exportWithExpandedObjectArrays(list, headers, `医疗护理记录${formatToDateTime()}.xlsx`, '医疗护理记录')
- // } catch (_) {}
- }
- /** 查询列表 */
- const getList = async () => {
- loading.value = true
- try {
- //let queryP = {...queryParams,discoveryTime:queryParams.discoveryTime?[queryParams.discoveryTime[0]+" 00:00:00",queryParams.discoveryTime[1]+" 23:59:59"]:null}
- const data = await sdsPage(queryParams)
- list.value = data.list
- total.value = data.total
- } finally {
- loading.value = false
- }
- }
- /** 搜索按钮操作 */
- const handleQuery = async () => {
- if (!queryFormRef.value) return
- const valid = await queryFormRef.value.validate()
- if (!valid) return
- queryParams.pageNo = 1
- await getList()
- }
- /** 重置按钮操作 */
- const resetQuery = () => {
- queryParams.elderName = ''
- queryParams.assessor = ''
- queryParams.tenantIds = userStore.orgTenantId
- queryParams.assessDate= getCurrentMonthRange()
- queryFormRef.value.resetFields()
- handleQuery()
- }
- /** 添加/修改操作 */
- const formRef = ref()
- const openForm = (id?: number) => {
- if(queryParams.tenantIds.length == 0 || queryParams.tenantIds.length > 1){
- message.error('新增只能选择一个机构')
- return
- }
- formRef.value.open(queryParams.tenantIds[0], id,false)
- }
- const editRef = ref()
- const openFormEdit = (row: any = {}, id?: number) => {
- formRef.value.open(row.tenantId, id,false)
- }
- const openFormDetail = (row: any = {},id?: number) => {
- formRef.value.open(row.tenantId,id,true)
- }
- const openClose = async (item) => {
- try {
- console.log("任务ID",item)
- const res = await message.confirm('确定要删除吗?', '提示')
- if (res == 'confirm') {
- // 发起
- try {
- const res = await sdsDelete(item.id)
- if (res){
- message.success(t('common.updateSuccess'))
- }
- }catch(err) {}
- }
- // 刷新列表
- await getList()
- } catch {}
- }
- /** 取消按钮操作 */
- const cancelDelete = async (id: number) => {
- try {
- // 取消的二次确认
- await message.cancelConfirm()
- // 发起取消
- // await elderlyBakDel(id)
- message.success(t('common.delSuccess'))
- // 刷新列表
- await getList()
- } catch {}
- }
- const route = useRoute()
- /** 初始化 **/
- onMounted(() => {
- if(route.query && route.query.elderName){
- queryParams.elderName = route.query.elderName as string
- }
- getList()
- })
- // 表头格式
- const tableHeaderColor = ({ rowIndex }: any) => {
- if (rowIndex === 0) {
- return {
- backgroundColor: '#f8f8f9',
- color: '#666666',
- fontWeight: 'bold'
- }
- }
- }
- </script>
- <style scoped lang="scss"></style>
|