2025-10-12 10:22:54 +08:00

417 lines
13 KiB
Vue

<template>
<x-search-bar class="mb-8-2">
<template #default="{ gutter, colSpan }">
<a-form :model="searchFormData" layout="inline" labelAlign="left">
<a-row :gutter="[24, 24]">
<!-- 姓名 -->
<a-col :span="8">
<a-form-item label="姓名" name="name">
<a-input v-model:value="searchFormData.name" placeholder="请输入姓名" />
</a-form-item>
</a-col>
<!-- 身份证号 -->
<a-col :span="8">
<a-form-item label="身份证号" name="idNumber">
<a-input v-model:value="searchFormData.idNumber" placeholder="请输入身份证号" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="建档日期" name="jianDangTimeRange">
<a-range-picker v-model:value="searchFormData.jianDangTimeRange" />
</a-form-item>
</a-col>
<!-- 生存状态 -->
<a-col :span="8">
<a-form-item label="生存状态" name="survivalStatus">
<a-select v-model:value="searchFormData.survivalStatus" allowClear>
<a-select-option v-for="item in dicsStore.dictOptions.LIVING_STATUS" :key="item.dval"
:value="item.dval">{{
item.introduction }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 档案号 -->
<a-col :span="8">
<a-form-item label="档案号" name="fileNumber">
<a-input v-model:value="searchFormData.fileNumber" placeholder="请输入档案号" />
</a-form-item>
</a-col>
<!-- 所在区域 -->
<a-col :span="8">
<a-form-item label="所在区域" name="region">
<AreaCascader v-model:value="searchFormData.currentNode" @change="onAreaChange" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="所在节点" name="currentNode">
<a-tree-select v-model:value="value" show-search style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" placeholder="Please select"
allow-clear tree-default-expand-all :tree-data="treeData" tree-node-filter-prop="label">
<template #title="{ value: val, label }">
<b v-if="val === 'parent 1-1'" style="color: #08c">sss</b>
<template v-else>{{ label }}</template>
</template>
</a-tree-select>
</a-form-item>
</a-col>
<!-- 护理等级 -->
<a-col :span="8">
<a-form-item label="护理等级" name="nursingLevel">
<a-select v-model:value="searchFormData.nursingLevel" placeholder="请选择护理等级" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Care_Level" :key="item.dval"
:value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 护理等级 -->
<a-col :span="8">
<a-form-item label="服务对象分类" name="serviceRecipientCategory">
<a-select v-model:value="searchFormData.serviceRecipientCategory" placeholder="请选择服务对象分类" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Service_Recipient_Category" :key="item.dval"
:value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 操作按钮 -->
<a-col class="align-left" :span="8">
<a-space>
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
<a-button ghost type="primary" @click="handleSearch">
{{ $t('button.search') }}
</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
</template>
</x-search-bar>
<a-row :gutter="8" :wrap="false">
<a-col flex="auto">
<a-card title="机构服务对象列表">
<template #extra>
<a-space>
<a-button>导入</a-button>
<a-button>导入记录</a-button>
<a-button>导出</a-button>
<a-button>导出记录</a-button>
</a-space>
</template>
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
:pagination="paginationState" :scroll="{ x: 'max-content' }" @change="onTableChange">
<template #bodyCell="{ index, column, record }">
<template v-if="column.key === 'serialNumber'">
<span>{{ index + 1 }}</span>
</template>
<template v-if="'action' === column.key">
<x-action-button @click="$refs.editDialogRef.handleCreate(record)">
<span>分配</span>
</x-action-button>
</template>
</template>
</a-table>
</a-card>
</a-col>
</a-row>
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
</template>
<script setup>
import { message, Modal } from 'ant-design-vue'
import { ref } from 'vue'
import apis from '@/apis'
import { config } from '@/config'
import { usePagination } from '@/hooks'
import { useI18n } from 'vue-i18n'
import EditDialog from './components/EditDialog.vue'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
import dayjs from 'dayjs'
defineOptions({
name: 'allocation',
})
const dicsStore = useDicsStore()
const columns = [
{
title: '序号',
dataIndex: 'serialNumber',
key: 'serialNumber',
align: 'center',
width: 80,
},
{
title: '姓名',
dataIndex: 'name',
key: 'name',
align: 'center',
width: 100,
},
{
title: '性别',
dataIndex: 'gender',
key: 'gender',
align: 'center',
width: 80,
},
{
title: '年龄',
dataIndex: 'age',
key: 'age',
align: 'center',
width: 80,
},
{
title: '身份证号',
dataIndex: 'idNumber',
key: 'idNumber',
align: 'center',
width: 180,
},
{
title: '服务对象分类',
dataIndex: 'serviceRecipientCategory',
key: 'serviceRecipientCategory',
align: 'center',
width: 120,
},
{
title: '护理等级',
dataIndex: 'careLev',
key: 'careLev',
align: 'center',
width: 120,
},
{
title: '所在区域',
dataIndex: 'region',
key: 'region',
align: 'center',
width: 120,
},
{
title: '入住日期',
dataIndex: 'ruzhuTime',
key: 'ruzhuTime',
align: 'center',
width: 200,
},
{
title: '退住日期',
dataIndex: 'tuizhuTime',
key: 'tuizhuTime',
align: 'center',
width: 200,
},
{
title: '所在节点',
dataIndex: 'currentNode',
key: 'currentNode',
align: 'center',
width: 120,
},
{
title: '档案号',
dataIndex: 'fileNumber',
key: 'fileNumber',
align: 'center',
width: 140,
},
{
title: '所在机构',
dataIndex: 'currentJiGou',
key: 'currentJiGou',
align: 'center',
width: 120,
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
align: 'center',
width: 120,
fixed: 'right',
}
];
const { t } = useI18n() // 解构出t方法
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
const editDialogRef = ref()
const detailRef = ref()
const treeData = ref([
{
title: 'Node1',
value: '0-0',
key: '0-0',
children: [
{
value: '0-0-1',
key: '0-0-1',
slots: {
title: 'title',
},
},
{
title: 'Child Node2',
value: '0-0-2',
key: '0-0-2',
},
],
},
{
title: 'Node2',
value: '0-1',
key: '0-1',
},
]);
const options = ref([
{
value: 'zhejiang',
label: 'Zhejiang',
children: [
{
value: 'hangzhou',
label: 'Hangzhou',
children: [
{
value: 'xihu',
label: 'West Lake',
},
],
},
],
},
{
value: 'jiangsu',
label: 'Jiangsu',
children: [
{
value: 'nanjing',
label: 'Nanjing',
children: [
{
value: 'zhonghuamen',
label: 'Zhong Hua Men',
},
],
},
],
},])
getPageList()
async function getPageList() {
try {
const { pageSize, current } = paginationState
const { success, data, total } = await apis.serverObj
.getProjectList({
pageSize,
current: current,
...searchFormData.value,
})
.catch(() => {
throw new Error()
})
if (config('http.code.success') === success) {
listData.value = data
paginationState.total = total
}
} catch (error) {
}
}
/**核销 */
const checkHandler = (record) => {
Modal.confirm({
title: '即将核销是否继续',
content: t('button.confirm'),
okText: t('button.confirm'),
onOk: async () => {
const params = {
...record,
status: 'success'
}
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
// throw new Error()
})
if (config('http.code.success') === success) {
// resolve()
message.success('核销成功')
await getPageList()
}
},
})
}
/**
* 删除
*/
function handleDelete({ id }) {
Modal.confirm({
title: t('pages.system.user.delTip'),
content: t('button.confirm'),
okText: t('button.confirm'),
onOk: () => {
return new Promise((resolve, reject) => {
; (async () => {
try {
const { success } = await apis.productOrder.delItem(id).catch(() => {
throw new Error()
})
if (config('http.code.success') === success) {
resolve()
message.success(t('component.message.success.delete'))
await getPageList()
}
} catch (error) {
reject()
}
})()
})
},
})
}
/**
* 分页
*/
function onTableChange({ current, pageSize }) {
paginationState.current = current
paginationState.pageSize = pageSize
getPageList()
}
/**
* 搜索
*/
function handleSearch() {
resetPagination()
getPageList()
}
/**
* 重置
*/
function handleResetSearch() {
searchFormData.value = {}
resetPagination()
getPageList()
}
/**
* 编辑完成
*/
async function onOk() {
await getPageList()
}
</script>
<style lang="less" scoped></style>