服务对象管理

This commit is contained in:
Leo_Ding 2025-10-12 10:22:54 +08:00
parent 664cde29f7
commit f3c82882f0
20 changed files with 4718 additions and 82 deletions

View File

@ -32,10 +32,10 @@ export default {
account: '个人页',
'account.trigger': '触发报错',
'account.logout': '退出登录',
'dict': '字典管理',
dict: '字典管理',
'dict-detail': '字典数据',
'serverObj': '服务对象管理',
'serverList': '服务对象列表',
serverObj: '服务对象管理',
serverList: '服务对象列表',
workorderMenu: '工单管理',
mineWorderOrder: '我下的工单',
invalidWzorkOrder: '无效工单',
@ -45,4 +45,11 @@ export default {
serviceSites: '服务站点',
serviceOrganization: '服务组织',
nodeAdministration: '节点管理',
allocation: '待分配对象列表',
domicile: '户籍对象列表',
institution: '机构服务对象列表',
toBeInstitution: '待完善对象列表',
carePhone: '电话关爱对象',
serverSearch: '服务对象查询',
existence: '生存状态管理',
}

View File

@ -24,6 +24,84 @@ export default [
permission: '*',
},
},
{
path: 'allocation',
name: 'allocation',
component: 'serverObj/allocation/index.vue',
meta: {
title: '服务对象分配',
isMenu: true,
keepAlive: true,
permission: '*',
},
},
{
path: 'domicile',
name: 'domicile',
component: 'serverObj/domicile/index.vue',
meta: {
title: '户籍对象列表',
isMenu: true,
keepAlive: true,
permission: '*',
},
},
{
path: 'institution',
name: 'institution',
component: 'serverObj/institution/index.vue',
meta: {
title: '机构服务对象列表',
isMenu: true,
keepAlive: true,
permission: '*',
},
},
{
path: 'toBeInstitution',
name: 'toBeInstitution',
component: 'serverObj/toBeInstitution/index.vue',
meta: {
title: '待完善对象列表',
isMenu: true,
keepAlive: true,
permission: '*',
},
},
{
path: 'carePhone',
name: 'carePhone',
component: 'serverObj/carePhone/index.vue',
meta: {
title: '电话关爱对象',
isMenu: true,
keepAlive: true,
permission: '*',
},
},
{
path: 'serverSearch',
name: 'serverSearch',
component: 'serverObj/serverSearch/index.vue',
meta: {
title: '服务对象查询',
isMenu: true,
keepAlive: true,
permission: '*',
},
},
{
path: 'existence',
name: 'existence',
component: 'serverObj/existence/index.vue',
meta: {
title: '生存状态管理',
isMenu: true,
keepAlive: true,
permission: '*',
},
}
],
},
]

82
src/utils/validate.js Normal file
View File

@ -0,0 +1,82 @@
/**
* 表单验证工具 - Vue 3 兼容
* 包含手机号邮箱身份证号 验证规则
*/
// 验证手机号(中国大陆)
export const validatePhone = (_rule, value) => {
console.log('validatePhone', value);
const phoneRegex = /^1[3-9]\d{9}$/;
if (!value) {
return Promise.reject('手机号不能为空');
}
if (!phoneRegex.test(value)) {
return Promise.reject('请输入正确的手机号');
}
return Promise.resolve();
};
// 验证邮箱
export const validateEmail = (_rule, value) => {
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (!value) {
return Promise.reject('邮箱不能为空');
}
if (!emailRegex.test(value)) {
return Promise.reject('请输入正确的邮箱地址');
}
return Promise.resolve();
};
// 验证身份证号码(支持 15 位和 18 位,含校验)
export const validateIdCard = (_rule, value) => {
const idCardRegex = /(^\d{15}$)|(^\d{18}$)|(^\d{18}X$)/i;
if (!value) {
return Promise.reject('身份证号不能为空');
}
if (!idCardRegex.test(value)) {
return Promise.reject('身份证号格式不正确');
}
// 更严格的 18 位身份证校验(含最后一位校验码)
if (value.length === 18) {
const Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1]; // 加权因子
const Vi = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']; // 校验码
let sum = 0;
for (let i = 0; i < 17; i++) {
sum += parseInt(value[i], 10) * Wi[i];
}
const checkCode = Vi[sum % 11];
if (checkCode !== value[17].toUpperCase()) {
return Promise.reject('身份证号校验失败,请输入正确的身份证号');
}
}
// 可选:验证生日部分(仅做基础判断)
let year, month, day;
if (value.length === 15) {
year = '19' + value.substring(6, 8);
month = value.substring(8, 10);
day = value.substring(10, 12);
} else {
year = value.substring(6, 10);
month = value.substring(10, 12);
day = value.substring(12, 14);
}
const isValidDate = !isNaN(new Date(year, month - 1, day));
if (!isValidDate) {
return Promise.reject('身份证号中的出生日期不合法');
}
const currentYear = new Date().getFullYear();
const birthYear = parseInt(year, 10);
if (birthYear < 1900 || birthYear > currentYear) {
return Promise.reject('出生年份不合法');
}
return Promise.resolve();
};

View File

@ -0,0 +1,136 @@
<template>
<a-modal :open="modal.open" :title="modal.title" :width="600" :confirm-loading="modal.confirmLoading"
:after-close="onAfterClose" :cancel-text="cancelText" @ok="handleOk" @cancel="handleCancel">
<a-form ref="formRef" :model="formData" :rules="formRules">
<a-row :gutter="24">
<!-- 姓名 -->
<a-col :span="24">
<a-form-item label="分配到" name="name" :rules="[{ required: true, message: '请选择节点' }]">
<a-tree-select v-model:value="formData.name" style="width: 100%" :tree-data="treeData" tree-checkable
allow-clear :show-checked-strategy="SHOW_PARENT" placeholder="请选择站点"
tree-node-filter-prop="label" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-modal>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { ref, defineProps } from 'vue'
import { config } from '@/config'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
const emit = defineEmits(['ok'])
const activeKey = ref('1')
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
const cancelText = ref('取消')
const treeData = [
{
label: 'Node1',
value: '0-0',
children: [
{
label: 'Child Node1',
value: '0-0-0',
},
],
},
{
label: 'Node2',
value: '0-1',
children: [
{
label: 'Child Node3',
value: '0-1-0',
disabled: true,
},
{
label: 'Child Node4',
value: '0-1-1',
},
{
label: 'Child Node5',
value: '0-1-2',
},
],
},
];
/**
* 新建
*/
function handleCreate() {
showModal({
type: 'create',
title: '分配节点',
})
}
/**
* 确定
*/
function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
try {
showLoading()
const params = {
...formData.value,
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.serverObj.createItem(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.serverObj.updateItem(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.code) {
hideModal()
emit('ok')
}
} catch (error) {
hideLoading()
}
})
.catch(() => {
hideLoading()
})
}
/**
* 取消
*/
function handleCancel() {
hideModal()
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
hideLoading()
}
defineExpose({
handleCreate,
})
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,392 @@
<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="region">
<AreaCascader v-model:value="searchFormData.currentNode" @change="onAreaChange" />
</a-form-item>
</a-col>
<!-- 姓名 -->
<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="fileNumber">
<a-input v-model:value="searchFormData.fileNumber" placeholder="请输入档案号" />
</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-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: 'governmentPurchasedService',
key: 'governmentPurchasedService',
align: 'center',
width: 150,
},
{
title: '服务对象分类',
dataIndex: 'serviceRecipientCategory',
key: 'serviceRecipientCategory',
align: 'center',
width: 120,
},
{
title: '健康状况',
dataIndex: 'healthStatus',
key: 'healthStatus',
align: 'center',
width: 120,
},
// --- ---
{
title: '联系方式1',
dataIndex: 'contact1',
key: 'contact1',
align: 'center',
width: 130,
},
{
title: '联系方式2',
dataIndex: 'contact2',
key: 'contact2',
align: 'center',
width: 130,
},
{
title: '联系方式3',
dataIndex: 'contact3',
key: 'contact3',
align: 'center',
width: 130,
},
{
title: '所在区域',
dataIndex: 'region',
key: 'region',
align: 'center',
width: 120,
},
{
title: '详细地址',
dataIndex: 'detailedAddress',
key: 'detailedAddress',
align: 'center',
width: 200,
},
{
title: '所在节点',
dataIndex: 'currentNode',
key: 'currentNode',
align: 'center',
width: 120,
},
{
title: '档案号',
dataIndex: 'fileNumber',
key: 'fileNumber',
align: 'center',
width: 140,
},
// --- ---
{
title: '建档日期',
dataIndex: 'dateOfFileCreation',
key: 'dateOfFileCreation',
align: 'center',
width: 140,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
{
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>

View File

@ -0,0 +1,136 @@
<template>
<a-modal :open="modal.open" :title="modal.title" :width="600" :confirm-loading="modal.confirmLoading"
:after-close="onAfterClose" :cancel-text="cancelText" @ok="handleOk" @cancel="handleCancel">
<a-form ref="formRef" :model="formData" :rules="formRules">
<a-row :gutter="24">
<!-- 姓名 -->
<a-col :span="24">
<a-form-item label="分配到" name="name" :rules="[{ required: true, message: '请选择节点' }]">
<a-tree-select v-model:value="formData.name" style="width: 100%" :tree-data="treeData" tree-checkable
allow-clear :show-checked-strategy="SHOW_PARENT" placeholder="请选择站点"
tree-node-filter-prop="label" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-modal>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { ref, defineProps } from 'vue'
import { config } from '@/config'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
const emit = defineEmits(['ok'])
const activeKey = ref('1')
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
const cancelText = ref('取消')
const treeData = [
{
label: 'Node1',
value: '0-0',
children: [
{
label: 'Child Node1',
value: '0-0-0',
},
],
},
{
label: 'Node2',
value: '0-1',
children: [
{
label: 'Child Node3',
value: '0-1-0',
disabled: true,
},
{
label: 'Child Node4',
value: '0-1-1',
},
{
label: 'Child Node5',
value: '0-1-2',
},
],
},
];
/**
* 新建
*/
function handleCreate() {
showModal({
type: 'create',
title: '分配节点',
})
}
/**
* 确定
*/
function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
try {
showLoading()
const params = {
...formData.value,
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.serverObj.createItem(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.serverObj.updateItem(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.code) {
hideModal()
emit('ok')
}
} catch (error) {
hideLoading()
}
})
.catch(() => {
hideLoading()
})
}
/**
* 取消
*/
function handleCancel() {
hideModal()
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
hideLoading()
}
defineExpose({
handleCreate,
})
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,392 @@
<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="12">
<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="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="fileNumber">
<a-input v-model:value="searchFormData.fileNumber" placeholder="请输入档案号" />
</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-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: 'governmentPurchasedService',
key: 'governmentPurchasedService',
align: 'center',
width: 150,
},
{
title: '服务对象分类',
dataIndex: 'serviceRecipientCategory',
key: 'serviceRecipientCategory',
align: 'center',
width: 120,
},
{
title: '健康状况',
dataIndex: 'healthStatus',
key: 'healthStatus',
align: 'center',
width: 120,
},
// --- ---
{
title: '联系方式1',
dataIndex: 'contact1',
key: 'contact1',
align: 'center',
width: 130,
},
{
title: '联系方式2',
dataIndex: 'contact2',
key: 'contact2',
align: 'center',
width: 130,
},
{
title: '联系方式3',
dataIndex: 'contact3',
key: 'contact3',
align: 'center',
width: 130,
},
{
title: '所在区域',
dataIndex: 'region',
key: 'region',
align: 'center',
width: 120,
},
{
title: '详细地址',
dataIndex: 'detailedAddress',
key: 'detailedAddress',
align: 'center',
width: 200,
},
{
title: '所在节点',
dataIndex: 'currentNode',
key: 'currentNode',
align: 'center',
width: 120,
},
{
title: '档案号',
dataIndex: 'fileNumber',
key: 'fileNumber',
align: 'center',
width: 140,
},
// --- ---
{
title: '建档日期',
dataIndex: 'dateOfFileCreation',
key: 'dateOfFileCreation',
align: 'center',
width: 140,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
{
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>

View File

@ -0,0 +1,623 @@
<template>
<a-modal :open="modal.open" :title="modal.title" :width="800" :confirm-loading="modal.confirmLoading"
:after-close="onAfterClose" :cancel-text="cancelText" @ok="handleOk" @cancel="handleCancel">
<a-form ref="formRef" :model="formData" :rules="formRules">
<a-tabs v-model:activeKey="activeKey">
<!-- 基本信息 -->
<a-tab-pane key="1" tab="基本信息">
<a-row :gutter="24">
<!-- 姓名 -->
<a-col :span="12">
<a-form-item label="姓名" name="name">
<a-input v-model:value="formData.name" placeholder="请输入姓名" />
</a-form-item>
</a-col>
<!-- 性别 -->
<a-col :span="12">
<a-form-item label="性别" name="gender">
<a-radio-group v-model:value="formData.gender">
<a-radio value="1"></a-radio>
<a-radio value="2"></a-radio>
</a-radio-group>
</a-form-item>
</a-col>
<!-- 证件号码 -->
<a-col :span="12">
<a-form-item label="证件号码" name="idNumber">
<span style="display: inline-flex; width: 100%;">
<a-select v-model:value="formData.identityType"
style="width: 100px; margin-right: 8px;">
<a-select-option v-for="item in dicsStore.dictOptions.CARD_TYPE"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
<a-input v-model:value="formData.idNumber" placeholder="请输入证件号码" style="flex: 1;" />
</span>
</a-form-item>
</a-col>
<!-- 出生日期 -->
<a-col :span="12">
<a-form-item label="出生日期" name="birthDate">
<a-date-picker v-model:value="formData.birthDate" placeholder="请选择出生日期"
style="width: 100%;" />
</a-form-item>
</a-col>
<!-- 关爱巡访电话 -->
<a-col :span="12">
<a-form-item label="关爱巡访电话" name="careVisitPhone">
<a-input v-model:value="formData.careVisitPhone" placeholder="请输入关爱巡访电话" />
</a-form-item>
</a-col>
<!-- 联系方式 -->
<a-col :span="12">
<a-form-item label="联系方式" name="contact1">
<a-input v-model:value="formData.contact1" placeholder="请输入联系方式" />
</a-form-item>
</a-col>
<!-- 社保卡号 -->
<a-col :span="12">
<a-form-item label="社保卡号" name="socialSecurityCardNumber">
<a-input v-model:value="formData.socialSecurityCardNumber" placeholder="请输入社保卡号" />
</a-form-item>
</a-col>
<!-- 其他电话1 -->
<a-col :span="12">
<a-form-item label="其他电话1" name="otherPhone1">
<a-input v-model:value="formData.otherPhone1" placeholder="请输入其他电话1" />
</a-form-item>
</a-col>
<!-- 联系状态 -->
<a-col :span="12">
<a-form-item label="联系状态" name="contactStatus">
<a-select v-model:value="formData.contactStatus" placeholder="请选择联系状态" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.CONTACT_STATUS"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 其他电话2 -->
<a-col :span="12">
<a-form-item label="其他电话2" name="otherPhone2">
<a-input v-model:value="formData.otherPhone2" placeholder="请输入其他电话2" />
</a-form-item>
</a-col>
<!-- 政府购买服务开始时间 -->
<a-col :span="12">
<a-form-item label="政府购买服务开始时间" name="governmentPurchasedServiceStartDate">
<a-date-picker v-model:value="formData.governmentPurchasedServiceStartDate"
placeholder="请选择政府购买服务开始时间" style="width: 100%;" />
</a-form-item>
</a-col>
<!-- 健康状况 -->
<a-col :span="12">
<a-form-item label="健康状况" name="healthStatus">
<a-select v-model:value="formData.healthStatus" placeholder="请选择健康状况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Health_Condition"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 服务状态 -->
<a-col :span="12">
<a-form-item label="服务状态" name="serviceStatus">
<a-select v-model:value="formData.serviceStatus" placeholder="请选择服务状态">
<a-select-option v-for="item in dicsStore.dictOptions.SERVICE_STATUS"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 生存状态 -->
<a-col :span="12">
<a-form-item label="生存状态" name="survivalStatus">
<a-select v-model:value="formData.survivalStatus" placeholder="请选择生存状态">
<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="12">
<a-form-item label="服务形式" name="serviceForm">
<a-select v-model:value="formData.serviceForm" placeholder="请选择服务形式" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Service_Format"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 护理等级 -->
<a-col :span="12">
<a-form-item label="护理等级" name="nursingLevel">
<a-select v-model:value="formData.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="12">
<a-form-item label="家庭地址" name="homeAreaCodes">
<AreaCascader v-model:value="formData.homeAreaCodes" @change="onAreaChange" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="详细地址" name="homeDetailAddress">
<a-input v-model:value="formData.homeDetailAddress" placeholder="请输入详细地址" />
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<!-- 家庭信息 -->
<a-tab-pane key="2" tab="地图定位">
<a-row :gutter="24">
<!-- 经度 -->
<a-col :span="12">
<a-form-item label="经度" name="log">
<a-input v-model:value="formData.log" placeholder="请输入经度" />
</a-form-item>
</a-col>
<!-- 纬度 -->
<a-col :span="12">
<a-form-item label="纬度" name="lat">
<a-input v-model:value="formData.lat" placeholder="请输入纬度" />
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<!-- 更多 -->
<a-tab-pane key="3" tab="更多">
<a-row :gutter="24">
<!-- 居住情况 -->
<a-col :span="8">
<a-form-item label="居住情况" name="livingSituation">
<a-select v-model:value="formData.livingSituation" placeholder="请选择居住情况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Living_Situation"
: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="childrenSituation">
<a-select v-model:value="formData.childrenSituation" placeholder="请选择子女情况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.CHILDREN_STATE"
: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="statisticsCategory">
<a-select v-model:value="formData.statisticsCategory" placeholder="请选择统计分类" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Statistical_Classification"
: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="intellectualSituation">
<a-select v-model:value="formData.intellectualSituation" placeholder="请选择智力情况"
allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Intellectual_Condition"
: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="longTermCareForDisabledChildren">
<a-select v-model:value="formData.longTermCareForDisabledChildren"
placeholder="请选择是否长期照料失能子女" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Disabled_Child"
: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="childrenVisitStatus">
<a-select v-model:value="formData.childrenVisitStatus" placeholder="请选择老人子女探望情况"
allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Frequency_Visits"
: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="householdResidenceSeparation">
<a-select v-model:value="formData.householdResidenceSeparation" placeholder="请选择是否人户分离"
allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Separation" :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="ethnicity">
<a-select v-model:value="formData.ethnicity" placeholder="请选择民族" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Ethnicity" :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="completedCapacityAssessment">
<a-select v-model:value="formData.completedCapacityAssessment" placeholder="请选择是否完成能力评估"
allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Capability_Assessment"
: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="livesInRentedRoomOrBasement">
<a-select v-model:value="formData.livesInRentedRoomOrBasement"
placeholder="请选择是否住出租屋/地下室" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Property_Basement"
: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="economicSource">
<a-select v-model:value="formData.economicSource" placeholder="请选择经济来源" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Source_Income"
: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="educationLevel">
<a-select v-model:value="formData.educationLevel" placeholder="请选择文化程度" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Level_Education"
: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="religion">
<a-select v-model:value="formData.religion" placeholder="请选择宗教信仰" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Religious_belief"
: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="occupation">
<a-select v-model:value="formData.occupation" placeholder="请选择职业情况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Employment_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="politicalAffiliation">
<a-select v-model:value="formData.politicalAffiliation" placeholder="请选择政治面貌"
allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Political_affiliation"
: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="maritalStatus">
<a-select v-model:value="formData.maritalStatus" placeholder="请选择婚姻情况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Marital_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="householdLocation">
<AreaCascader v-model:value="formData.householdArea" @change="onAreaHoldChange" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="详细地址" name="householdDetailAddress">
<a-input v-model:value="formData.householdDetailAddress" placeholder="请输入详细地址" />
</a-form-item>
</a-col>
<!-- 其他 -->
<a-col :span="24">
<a-form-item label="其他" name="otherNotes">
<a-textarea v-model:value="formData.otherNotes" placeholder="请输入" :rows="1"
:auto-size="{ minRows: 1, maxRows: 2 }" />
</a-form-item>
</a-col>
<!-- 身份证照片 -->
<a-col :span="12">
<a-form-item label="身份证照片" name="idCardPhotos">
<a-upload v-model:file-list="formData.idCardPhotos" list-type="picture-card"
:multiple="true" :before-upload="() => false">
<div>
<plus-outlined />
<div class="ant-upload-text">选择图片</div>
</div>
</a-upload>
</a-form-item>
</a-col>
<!-- 上传资料 -->
<a-col :span="12">
<a-form-item label="上传资料" name="uploadedDocuments">
<a-upload v-model:file-list="formData.uploadedDocuments" list-type="picture-card"
:multiple="true" :before-upload="() => false">
<div>
<plus-outlined />
<div class="ant-upload-text">选择图片</div>
</div>
</a-upload>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
</a-tabs>
</a-form>
</a-modal>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { ref, defineProps } from 'vue'
import { config } from '@/config'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
import { validatePhone, validateEmail, validateIdCard } from '@/utils/validate'
const emit = defineEmits(['ok'])
const activeKey = ref('1')
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
const cancelText = ref('取消')
formRules.value = {
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
identityType: [{ required: true, message: '请选择证件类型', trigger: 'change' }],
idNumber: [{ required: true, message: '请输入证件号码', trigger: 'blur' }],
contact1: [{ validator: validatePhone, trigger: ['blur', 'input'] }, { required: true, message: '请输入联系方式', trigger: 'blur' }],
healthStatus: [{ required: true, message: '请选择健康状况', trigger: 'change' }],
survivalStatus: [{ required: true, message: '请选择生存状态', trigger: 'change' }],
homeAreaCodes: [{ required: true, message: '请选择并输入家庭地址', trigger: 'change' }],
serviceStatus: [{ required: true, message: '请选择服务状态', trigger: 'change' }],
homeDetailAddress: [{ required: true, message: '请输入详细地址', trigger: 'change' }],
}
formData.value.gender = '1'
const dicsStore = useDicsStore()
/**
* 新建
*/
function handleCreate() {
showModal({
type: 'create',
title: '新建项',
})
}
/**
* 编辑
*/
function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑项',
})
formRecord.value = record
formData.value = cloneDeep(record)
}
// utils/idCard.js
function isValidIdCard(value) {
if (!value || typeof value !== 'string') return false;
const idCardRegex = /(^\d{15}$)|(^\d{18}$)|(^\d{18}X$)/i;
if (!idCardRegex.test(value)) return false;
// 18
if (value.length === 18) {
const Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];
const Vi = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
let sum = 0;
for (let i = 0; i < 17; i++) {
sum += parseInt(value[i], 10) * Wi[i];
}
const checkCode = Vi[sum % 11];
if (checkCode !== value[17].toUpperCase()) {
return false;
}
}
//
let year, month, day;
if (value.length === 15) {
year = '19' + value.substring(6, 8);
month = value.substring(8, 10);
day = value.substring(10, 12);
} else {
year = value.substring(6, 10);
month = value.substring(10, 12);
day = value.substring(12, 14);
}
const date = new Date(year, month - 1, day);
if (
date.getFullYear() !== parseInt(year, 10) ||
date.getMonth() + 1 !== parseInt(month, 10) ||
date.getDate() !== parseInt(day, 10)
) {
return false;
}
const currentYear = new Date().getFullYear();
const birthYear = parseInt(year, 10);
if (birthYear < 1900 || birthYear > currentYear) {
return false;
}
return true;
}
/**
* 确定
*/
function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
try {
showLoading()
const params = {
...formData.value,
}
//
console.log('params.identityType', isValidIdCard(params.idNumber));
if (params.identityType === '1' && !isValidIdCard(params.idNumber)) {
throw new Error('请输入正确的身份证号码');
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.serverObj.createItem(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.serverObj.updateItem(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.code) {
hideModal()
emit('ok')
}
} catch (error) {
hideLoading()
}
})
.catch(() => {
hideLoading()
})
}
function onAreaChange(value, labels) {
console.log(formData.value.homeAreaCodes);
formData.value.homeAreaLabels = [...labels]
}
function onAreaHoldChange(value, labels) {
console.log(formData.value.houseAreaCodes);
formData.value.houseAreaLabels = [...labels]
}
/**
* 取消
*/
function handleCancel() {
hideModal()
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
hideLoading()
}
defineExpose({
handleCreate,
handleEdit,
})
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,570 @@
<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="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="region">
<AreaCascader v-model:value="searchFormData.currentNode" @change="onAreaChange" />
</a-form-item>
</a-col>
<!-- 户籍所在区域 -->
<a-col :span="8">
<a-form-item label="户籍所在区域" name="householdArea">
<AreaCascader v-model:value="searchFormData.householdArea" @change="onAreaHouseChange" />
</a-form-item>
</a-col>
<!-- 分类标签 -->
<a-col :span="8">
<a-form-item label="分类标签" name="serviceRecipientCategory">
<a-select v-model:value="searchFormData.serviceRecipientCategory" allowClear>
<a-select-option v-for="item in dicsStore.dictOptions.SERVICE_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="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="idNumber">
<a-input v-model:value="searchFormData.idNumber" placeholder="请输入身份证号" />
</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="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 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>
<template #title>
<a-space>
<span style="font-size: 18px;">户籍对象列表</span>
<span style="margin-left: 10px;color: #666;">({{ totalCount }})</span>
</a-space>
</template>
<template #extra>
<a-space>
<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.detailRef.handleCreate(record)">
<span>详情</span>
</x-action-button>
<x-action-button @click="$refs.detailRef.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>
<detail ref="detailRef"></detail>
</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 totalImg from '@/assets/imgs/total.png'
import EditDialog from './components/EditDialog.vue'
import detail from '../serverList/components/detail.vue'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
import dayjs from 'dayjs'
defineOptions({
name: 'serverList',
})
const totalCount = ref(0) //
const dicsStore = useDicsStore()
const labelOptions= ref([])
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: 'governmentPurchasedService',
key: 'governmentPurchasedService',
align: 'center',
width: 150,
},
{
title: '服务对象分类',
dataIndex: 'serviceRecipientCategory',
key: 'serviceRecipientCategory',
align: 'center',
width: 120,
},
{
title: '健康状况',
dataIndex: 'healthStatus',
key: 'healthStatus',
align: 'center',
width: 120,
},
{
title: '联系状态',
dataIndex: 'contactStatus',
key: 'contactStatus',
align: 'center',
width: 120,
},
{
title: '是否完成能力评估',
dataIndex: 'completedCapacityAssessment',
key: 'completedCapacityAssessment',
align: 'center',
width: 150,
},
{
title: '是否住出租屋/地下室',
dataIndex: 'livesInRentedRoomOrBasement',
key: 'livesInRentedRoomOrBasement',
align: 'center',
width: 180,
},
{
title: '是否人户分离',
dataIndex: 'householdResidenceSeparation',
key: 'householdResidenceSeparation',
align: 'center',
width: 120,
},
{
title: '婚姻情况',
dataIndex: 'maritalStatus',
key: 'maritalStatus',
align: 'center',
width: 120,
},
{
title: '居住情况',
dataIndex: 'livingSituation',
key: 'livingSituation',
align: 'center',
width: 120,
},
{
title: '生存状态',
dataIndex: 'survivalStatus',
key: 'survivalStatus',
align: 'center',
width: 120,
},
// --- ---
{
title: '去世时间',
dataIndex: 'dateOfDeath',
key: 'dateOfDeath',
align: 'center',
width: 140,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
// --- ---
{
title: '去世原因',
dataIndex: 'causeOfDeath',
key: 'causeOfDeath',
align: 'center',
width: 140,
},
// --- ---
{
title: '更新时间',
dataIndex: 'updateTime',
key: 'updateTime',
align: 'center',
width: 140,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
// --- ---
{
title: '失能险签约日期',
dataIndex: 'ltcInsuranceSignUpDate',
key: 'ltcInsuranceSignUpDate',
align: 'center',
width: 150,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
// --- ---
{
title: '失能险解约日期',
dataIndex: 'ltcInsuranceTerminationDate',
key: 'ltcInsuranceTerminationDate',
align: 'center',
width: 150,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
// --- ---
{
title: '联系方式1',
dataIndex: 'contact1',
key: 'contact1',
align: 'center',
width: 130,
},
{
title: '联系方式2',
dataIndex: 'contact2',
key: 'contact2',
align: 'center',
width: 130,
},
{
title: '联系方式3',
dataIndex: 'contact3',
key: 'contact3',
align: 'center',
width: 130,
},
{
title: '所在区域',
dataIndex: 'region',
key: 'region',
align: 'center',
width: 120,
},
{
title: '详细地址',
dataIndex: 'detailedAddress',
key: 'detailedAddress',
align: 'center',
width: 200,
},
{
title: '残疾类型',
dataIndex: 'disabilityType',
key: 'disabilityType',
align: 'center',
width: 120,
},
{
title: '残疾等级',
dataIndex: 'disabilityLevel',
key: 'disabilityLevel',
align: 'center',
width: 120,
},
{
title: '残疾证号',
dataIndex: 'disabilityCertificateNumber',
key: 'disabilityCertificateNumber',
align: 'center',
width: 160,
},
{
title: '所在节点',
dataIndex: 'currentNode',
key: 'currentNode',
align: 'center',
width: 120,
},
{
title: '档案号',
dataIndex: 'fileNumber',
key: 'fileNumber',
align: 'center',
width: 140,
},
// --- ---
{
title: '建档日期',
dataIndex: 'dateOfFileCreation',
key: 'dateOfFileCreation',
align: 'center',
width: 140,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
align: 'center',
width: 150,
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()
/**
* 获取表格数据
* @returns {Promise<void>}
*/
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>

View File

@ -0,0 +1,136 @@
<template>
<a-modal :open="modal.open" :title="modal.title" :width="600" :confirm-loading="modal.confirmLoading"
:after-close="onAfterClose" :cancel-text="cancelText" @ok="handleOk" @cancel="handleCancel">
<a-form ref="formRef" :model="formData" :rules="formRules">
<a-row :gutter="24">
<!-- 姓名 -->
<a-col :span="24">
<a-form-item label="分配到" name="name" :rules="[{ required: true, message: '请选择节点' }]">
<a-tree-select v-model:value="formData.name" style="width: 100%" :tree-data="treeData" tree-checkable
allow-clear :show-checked-strategy="SHOW_PARENT" placeholder="请选择站点"
tree-node-filter-prop="label" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-modal>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { ref, defineProps } from 'vue'
import { config } from '@/config'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
const emit = defineEmits(['ok'])
const activeKey = ref('1')
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
const cancelText = ref('取消')
const treeData = [
{
label: 'Node1',
value: '0-0',
children: [
{
label: 'Child Node1',
value: '0-0-0',
},
],
},
{
label: 'Node2',
value: '0-1',
children: [
{
label: 'Child Node3',
value: '0-1-0',
disabled: true,
},
{
label: 'Child Node4',
value: '0-1-1',
},
{
label: 'Child Node5',
value: '0-1-2',
},
],
},
];
/**
* 新建
*/
function handleCreate() {
showModal({
type: 'create',
title: '分配节点',
})
}
/**
* 确定
*/
function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
try {
showLoading()
const params = {
...formData.value,
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.serverObj.createItem(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.serverObj.updateItem(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.code) {
hideModal()
emit('ok')
}
} catch (error) {
hideLoading()
}
})
.catch(() => {
hideLoading()
})
}
/**
* 取消
*/
function handleCancel() {
hideModal()
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
hideLoading()
}
defineExpose({
handleCreate,
})
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,392 @@
<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="12">
<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="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="fileNumber">
<a-input v-model:value="searchFormData.fileNumber" placeholder="请输入档案号" />
</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-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: 'governmentPurchasedService',
key: 'governmentPurchasedService',
align: 'center',
width: 150,
},
{
title: '服务对象分类',
dataIndex: 'serviceRecipientCategory',
key: 'serviceRecipientCategory',
align: 'center',
width: 120,
},
{
title: '健康状况',
dataIndex: 'healthStatus',
key: 'healthStatus',
align: 'center',
width: 120,
},
// --- ---
{
title: '联系方式1',
dataIndex: 'contact1',
key: 'contact1',
align: 'center',
width: 130,
},
{
title: '联系方式2',
dataIndex: 'contact2',
key: 'contact2',
align: 'center',
width: 130,
},
{
title: '联系方式3',
dataIndex: 'contact3',
key: 'contact3',
align: 'center',
width: 130,
},
{
title: '所在区域',
dataIndex: 'region',
key: 'region',
align: 'center',
width: 120,
},
{
title: '详细地址',
dataIndex: 'detailedAddress',
key: 'detailedAddress',
align: 'center',
width: 200,
},
{
title: '所在节点',
dataIndex: 'currentNode',
key: 'currentNode',
align: 'center',
width: 120,
},
{
title: '档案号',
dataIndex: 'fileNumber',
key: 'fileNumber',
align: 'center',
width: 140,
},
// --- ---
{
title: '建档日期',
dataIndex: 'dateOfFileCreation',
key: 'dateOfFileCreation',
align: 'center',
width: 140,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
{
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>

View File

@ -0,0 +1,136 @@
<template>
<a-modal :open="modal.open" :title="modal.title" :width="600" :confirm-loading="modal.confirmLoading"
:after-close="onAfterClose" :cancel-text="cancelText" @ok="handleOk" @cancel="handleCancel">
<a-form ref="formRef" :model="formData" :rules="formRules">
<a-row :gutter="24">
<!-- 姓名 -->
<a-col :span="24">
<a-form-item label="分配到" name="name" :rules="[{ required: true, message: '请选择节点' }]">
<a-tree-select v-model:value="formData.name" style="width: 100%" :tree-data="treeData" tree-checkable
allow-clear :show-checked-strategy="SHOW_PARENT" placeholder="请选择站点"
tree-node-filter-prop="label" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-modal>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { ref, defineProps } from 'vue'
import { config } from '@/config'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
const emit = defineEmits(['ok'])
const activeKey = ref('1')
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
const cancelText = ref('取消')
const treeData = [
{
label: 'Node1',
value: '0-0',
children: [
{
label: 'Child Node1',
value: '0-0-0',
},
],
},
{
label: 'Node2',
value: '0-1',
children: [
{
label: 'Child Node3',
value: '0-1-0',
disabled: true,
},
{
label: 'Child Node4',
value: '0-1-1',
},
{
label: 'Child Node5',
value: '0-1-2',
},
],
},
];
/**
* 新建
*/
function handleCreate() {
showModal({
type: 'create',
title: '分配节点',
})
}
/**
* 确定
*/
function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
try {
showLoading()
const params = {
...formData.value,
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.serverObj.createItem(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.serverObj.updateItem(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.code) {
hideModal()
emit('ok')
}
} catch (error) {
hideLoading()
}
})
.catch(() => {
hideLoading()
})
}
/**
* 取消
*/
function handleCancel() {
hideModal()
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
hideLoading()
}
defineExpose({
handleCreate,
})
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,416 @@
<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>

View File

@ -8,7 +8,7 @@
<a-row :gutter="24">
<!-- 姓名 -->
<a-col :span="12">
<a-form-item label="姓名" name="name" :rules="[{ required: true, message: '请输入姓名' }]">
<a-form-item label="姓名" name="name">
<a-input v-model:value="formData.name" placeholder="请输入姓名" />
</a-form-item>
</a-col>
@ -25,11 +25,12 @@
<!-- 证件号码 -->
<a-col :span="12">
<a-form-item label="证件号码" name="idNumber" :rules="[{ required: true, message: '请输入证件号码' }]">
<a-form-item label="证件号码" name="idNumber">
<span style="display: inline-flex; width: 100%;">
<a-select v-model:value="formData.identityType" style="width: 100px; margin-right: 8px;">
<a-select-option v-for="item in dicsStore.dictOptions.CARD_TYPE" :key="item.dval"
:value="item.dval">
<a-select v-model:value="formData.identityType"
style="width: 100px; margin-right: 8px;">
<a-select-option v-for="item in dicsStore.dictOptions.CARD_TYPE"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -55,7 +56,7 @@
<!-- 联系方式 -->
<a-col :span="12">
<a-form-item label="联系方式" name="contact1" :rules="[{ required: true, message: '请输入联系方式' }]">
<a-form-item label="联系方式" name="contact1">
<a-input v-model:value="formData.contact1" placeholder="请输入联系方式" />
</a-form-item>
</a-col>
@ -78,8 +79,8 @@
<a-col :span="12">
<a-form-item label="联系状态" name="contactStatus">
<a-select v-model:value="formData.contactStatus" placeholder="请选择联系状态" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.CONTACT_STATUS" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.CONTACT_STATUS"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -103,11 +104,10 @@
<!-- 健康状况 -->
<a-col :span="12">
<a-form-item label="健康状况" name="healthStatus"
:rules="[{ required: true, message: '请选择健康状况' }]">
<a-form-item label="健康状况" name="healthStatus">
<a-select v-model:value="formData.healthStatus" placeholder="请选择健康状况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Health_Condition" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Health_Condition"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -118,17 +118,21 @@
<a-col :span="12">
<a-form-item label="服务状态" name="serviceStatus">
<a-select v-model:value="formData.serviceStatus" placeholder="请选择服务状态">
<a-select-option value="服务中">服务中</a-select-option>
<a-select-option v-for="item in dicsStore.dictOptions.SERVICE_STATUS"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 生存状态 -->
<a-col :span="12">
<a-form-item label="生存状态" name="survivalStatus"
:rules="[{ required: true, message: '请选择生存状态' }]">
<a-form-item label="生存状态" name="survivalStatus">
<a-select v-model:value="formData.survivalStatus" placeholder="请选择生存状态">
<a-select-option value="在世">在世</a-select-option>
<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>
@ -137,8 +141,8 @@
<a-col :span="12">
<a-form-item label="服务形式" name="serviceForm">
<a-select v-model:value="formData.serviceForm" placeholder="请选择服务形式" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Service_Format" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Service_Format"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -156,23 +160,39 @@
</a-select>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<!-- 家庭信息 -->
<a-tab-pane key="2" tab="家庭信息">
<a-row :gutter="24">
<!-- 家庭地址 -->
<a-col :span="24">
<a-form-item label="家庭地址" name="homeAreaCodes"
:rules="[{ required: true, message: '请选择并输入家庭地址' }]">
<a-col :span="12">
<a-form-item label="家庭地址" name="homeAreaCodes">
<AreaCascader v-model:value="formData.homeAreaCodes" @change="onAreaChange" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="详细地址" name="homeDetailAddress">
<a-input v-model:value="formData.homeDetailAddress" placeholder="请输入详细地址" />
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<!-- 家庭信息 -->
<a-tab-pane key="2" tab="地图定位">
<a-row :gutter="24">
<!-- 经度 -->
<a-col :span="12">
<a-form-item label="经度" name="log">
<a-input v-model:value="formData.log" placeholder="请输入经度" />
</a-form-item>
</a-col>
<!-- 纬度 -->
<a-col :span="12">
<a-form-item label="纬度" name="lat">
<a-input v-model:value="formData.lat" placeholder="请输入纬度" />
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<!-- 更多 -->
@ -182,8 +202,8 @@
<a-col :span="8">
<a-form-item label="居住情况" name="livingSituation">
<a-select v-model:value="formData.livingSituation" placeholder="请选择居住情况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Living_Situation" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Living_Situation"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -194,8 +214,8 @@
<a-col :span="8">
<a-form-item label="子女情况" name="childrenSituation">
<a-select v-model:value="formData.childrenSituation" placeholder="请选择子女情况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.CHILDREN_STATE" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.CHILDREN_STATE"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -206,8 +226,8 @@
<a-col :span="8">
<a-form-item label="统计分类" name="statisticsCategory">
<a-select v-model:value="formData.statisticsCategory" placeholder="请选择统计分类" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Statistical_Classification" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Statistical_Classification"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -219,8 +239,8 @@
<a-form-item label="智力情况" name="intellectualSituation">
<a-select v-model:value="formData.intellectualSituation" placeholder="请选择智力情况"
allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Intellectual_Condition" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Intellectual_Condition"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -232,8 +252,8 @@
<a-form-item label="是否长期照料失能子女" name="longTermCareForDisabledChildren">
<a-select v-model:value="formData.longTermCareForDisabledChildren"
placeholder="请选择是否长期照料失能子女" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Disabled_Child" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Disabled_Child"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -245,8 +265,8 @@
<a-form-item label="老人子女探望情况" name="childrenVisitStatus">
<a-select v-model:value="formData.childrenVisitStatus" placeholder="请选择老人子女探望情况"
allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Frequency_Visits" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Frequency_Visits"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -283,8 +303,8 @@
<a-form-item label="是否完成能力评估" name="completedCapacityAssessment">
<a-select v-model:value="formData.completedCapacityAssessment" placeholder="请选择是否完成能力评估"
allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Capability_Assessment" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Capability_Assessment"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -296,8 +316,8 @@
<a-form-item label="是否住出租屋/地下室" name="livesInRentedRoomOrBasement">
<a-select v-model:value="formData.livesInRentedRoomOrBasement"
placeholder="请选择是否住出租屋/地下室" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Property_Basement" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Property_Basement"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -308,8 +328,8 @@
<a-col :span="8">
<a-form-item label="经济来源" name="economicSource">
<a-select v-model:value="formData.economicSource" placeholder="请选择经济来源" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Source_Income" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Source_Income"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -320,8 +340,8 @@
<a-col :span="8">
<a-form-item label="文化程度" name="educationLevel">
<a-select v-model:value="formData.educationLevel" placeholder="请选择文化程度" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Level_Education" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Level_Education"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -332,8 +352,8 @@
<a-col :span="8">
<a-form-item label="宗教信仰" name="religion">
<a-select v-model:value="formData.religion" placeholder="请选择宗教信仰" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Religious_belief" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Religious_belief"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -344,8 +364,8 @@
<a-col :span="8">
<a-form-item label="职业情况" name="occupation">
<a-select v-model:value="formData.occupation" placeholder="请选择职业情况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Employment_Status" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Employment_Status"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -357,8 +377,8 @@
<a-form-item label="政治面貌" name="politicalAffiliation">
<a-select v-model:value="formData.politicalAffiliation" placeholder="请选择政治面貌"
allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Political_affiliation" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Political_affiliation"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -369,8 +389,8 @@
<a-col :span="8">
<a-form-item label="婚姻情况" name="maritalStatus">
<a-select v-model:value="formData.maritalStatus" placeholder="请选择婚姻情况" allow-clear>
<a-select-option v-for="item in dicsStore.dictOptions.Marital_Status" :key="item.dval"
:value="item.dval">
<a-select-option v-for="item in dicsStore.dictOptions.Marital_Status"
:key="item.dval" :value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
@ -379,8 +399,7 @@
<!-- 户口所在地 -->
<a-col :span="8">
<a-form-item label="户口所在地" name="householdLocation"
:rules="[{ required: true, message: '请选择' }]">
<a-form-item label="户口所在地" name="householdArea">
<AreaCascader v-model:value="formData.householdArea" @change="onAreaHoldChange" />
</a-form-item>
</a-col>
@ -438,19 +457,22 @@ import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
import { validatePhone, validateEmail, validateIdCard } from '@/utils/validate'
const emit = defineEmits(['ok'])
const activeKey = ref('1')
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
const cancelText = ref('取消')
formRules.value = {
name: [{ required: true, message: '请输入姓名' }],
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
identityType: [{ required: true, message: '请选择证件类型', trigger: 'change' }],
idNumber: [{ required: true, message: '请输入证件号码' }],
contact1: [{ required: true, message: '请输入联系方式' }],
healthStatus: [{ required: true, message: '请选择健康状况' }],
survivalStatus: [{ required: true, message: '请选择生存状态' }],
homeAreaCodes: [{ required: true, message: '请选择并输入家庭地址' }],
idNumber: [{ required: true, message: '请输入证件号码', trigger: 'blur' }],
contact1: [{ validator: validatePhone, trigger: ['blur', 'input'] }, { required: true, message: '请输入联系方式', trigger: 'blur' }],
healthStatus: [{ required: true, message: '请选择健康状况', trigger: 'change' }],
survivalStatus: [{ required: true, message: '请选择生存状态', trigger: 'change' }],
homeAreaCodes: [{ required: true, message: '请选择并输入家庭地址', trigger: 'change' }],
serviceStatus: [{ required: true, message: '请选择服务状态', trigger: 'change' }],
homeDetailAddress: [{ required: true, message: '请输入详细地址', trigger: 'change' }],
}
formData.value.gender = '1'
const dicsStore = useDicsStore()
@ -475,7 +497,57 @@ function handleEdit(record = {}) {
formRecord.value = record
formData.value = cloneDeep(record)
}
// utils/idCard.js
function isValidIdCard(value) {
if (!value || typeof value !== 'string') return false;
const idCardRegex = /(^\d{15}$)|(^\d{18}$)|(^\d{18}X$)/i;
if (!idCardRegex.test(value)) return false;
// 18
if (value.length === 18) {
const Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];
const Vi = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
let sum = 0;
for (let i = 0; i < 17; i++) {
sum += parseInt(value[i], 10) * Wi[i];
}
const checkCode = Vi[sum % 11];
if (checkCode !== value[17].toUpperCase()) {
return false;
}
}
//
let year, month, day;
if (value.length === 15) {
year = '19' + value.substring(6, 8);
month = value.substring(8, 10);
day = value.substring(10, 12);
} else {
year = value.substring(6, 10);
month = value.substring(10, 12);
day = value.substring(12, 14);
}
const date = new Date(year, month - 1, day);
if (
date.getFullYear() !== parseInt(year, 10) ||
date.getMonth() + 1 !== parseInt(month, 10) ||
date.getDate() !== parseInt(day, 10)
) {
return false;
}
const currentYear = new Date().getFullYear();
const birthYear = parseInt(year, 10);
if (birthYear < 1900 || birthYear > currentYear) {
return false;
}
return true;
}
/**
* 确定
*/
@ -488,6 +560,11 @@ function handleOk() {
const params = {
...formData.value,
}
//
console.log('params.identityType', isValidIdCard(params.idNumber));
if (params.identityType === '1' && !isValidIdCard(params.idNumber)) {
throw new Error('请输入正确的身份证号码');
}
let result = null
switch (modal.value.type) {
case 'create':

View File

@ -0,0 +1,136 @@
<template>
<a-modal :open="modal.open" :title="modal.title" :width="600" :confirm-loading="modal.confirmLoading"
:after-close="onAfterClose" :cancel-text="cancelText" @ok="handleOk" @cancel="handleCancel">
<a-form ref="formRef" :model="formData" :rules="formRules">
<a-row :gutter="24">
<!-- 姓名 -->
<a-col :span="24">
<a-form-item label="分配到" name="name" :rules="[{ required: true, message: '请选择节点' }]">
<a-tree-select v-model:value="formData.name" style="width: 100%" :tree-data="treeData" tree-checkable
allow-clear :show-checked-strategy="SHOW_PARENT" placeholder="请选择站点"
tree-node-filter-prop="label" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-modal>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { ref, defineProps } from 'vue'
import { config } from '@/config'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
const emit = defineEmits(['ok'])
const activeKey = ref('1')
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
const cancelText = ref('取消')
const treeData = [
{
label: 'Node1',
value: '0-0',
children: [
{
label: 'Child Node1',
value: '0-0-0',
},
],
},
{
label: 'Node2',
value: '0-1',
children: [
{
label: 'Child Node3',
value: '0-1-0',
disabled: true,
},
{
label: 'Child Node4',
value: '0-1-1',
},
{
label: 'Child Node5',
value: '0-1-2',
},
],
},
];
/**
* 新建
*/
function handleCreate() {
showModal({
type: 'create',
title: '分配节点',
})
}
/**
* 确定
*/
function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
try {
showLoading()
const params = {
...formData.value,
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.serverObj.createItem(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.serverObj.updateItem(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.code) {
hideModal()
emit('ok')
}
} catch (error) {
hideLoading()
}
})
.catch(() => {
hideLoading()
})
}
/**
* 取消
*/
function handleCancel() {
hideModal()
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
hideLoading()
}
defineExpose({
handleCreate,
})
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,392 @@
<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="12">
<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="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="fileNumber">
<a-input v-model:value="searchFormData.fileNumber" placeholder="请输入档案号" />
</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-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: 'governmentPurchasedService',
key: 'governmentPurchasedService',
align: 'center',
width: 150,
},
{
title: '服务对象分类',
dataIndex: 'serviceRecipientCategory',
key: 'serviceRecipientCategory',
align: 'center',
width: 120,
},
{
title: '健康状况',
dataIndex: 'healthStatus',
key: 'healthStatus',
align: 'center',
width: 120,
},
// --- ---
{
title: '联系方式1',
dataIndex: 'contact1',
key: 'contact1',
align: 'center',
width: 130,
},
{
title: '联系方式2',
dataIndex: 'contact2',
key: 'contact2',
align: 'center',
width: 130,
},
{
title: '联系方式3',
dataIndex: 'contact3',
key: 'contact3',
align: 'center',
width: 130,
},
{
title: '所在区域',
dataIndex: 'region',
key: 'region',
align: 'center',
width: 120,
},
{
title: '详细地址',
dataIndex: 'detailedAddress',
key: 'detailedAddress',
align: 'center',
width: 200,
},
{
title: '所在节点',
dataIndex: 'currentNode',
key: 'currentNode',
align: 'center',
width: 120,
},
{
title: '档案号',
dataIndex: 'fileNumber',
key: 'fileNumber',
align: 'center',
width: 140,
},
// --- ---
{
title: '建档日期',
dataIndex: 'dateOfFileCreation',
key: 'dateOfFileCreation',
align: 'center',
width: 140,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
{
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>

View File

@ -0,0 +1,136 @@
<template>
<a-modal :open="modal.open" :title="modal.title" :width="600" :confirm-loading="modal.confirmLoading"
:after-close="onAfterClose" :cancel-text="cancelText" @ok="handleOk" @cancel="handleCancel">
<a-form ref="formRef" :model="formData" :rules="formRules">
<a-row :gutter="24">
<!-- 姓名 -->
<a-col :span="24">
<a-form-item label="分配到" name="name" :rules="[{ required: true, message: '请选择节点' }]">
<a-tree-select v-model:value="formData.name" style="width: 100%" :tree-data="treeData" tree-checkable
allow-clear :show-checked-strategy="SHOW_PARENT" placeholder="请选择站点"
tree-node-filter-prop="label" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-modal>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { ref, defineProps } from 'vue'
import { config } from '@/config'
import apis from '@/apis'
import { useForm, useModal } from '@/hooks'
import { useDicsStore } from '@/store'
import AreaCascader from '@/components/AreaCascader/index.vue'
const emit = defineEmits(['ok'])
const activeKey = ref('1')
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
const cancelText = ref('取消')
const treeData = [
{
label: 'Node1',
value: '0-0',
children: [
{
label: 'Child Node1',
value: '0-0-0',
},
],
},
{
label: 'Node2',
value: '0-1',
children: [
{
label: 'Child Node3',
value: '0-1-0',
disabled: true,
},
{
label: 'Child Node4',
value: '0-1-1',
},
{
label: 'Child Node5',
value: '0-1-2',
},
],
},
];
/**
* 新建
*/
function handleCreate() {
showModal({
type: 'create',
title: '分配节点',
})
}
/**
* 确定
*/
function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
try {
showLoading()
const params = {
...formData.value,
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.serverObj.createItem(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.serverObj.updateItem(params).catch(() => {
throw new Error()
})
break
}
hideLoading()
if (config('http.code.success') === result?.code) {
hideModal()
emit('ok')
}
} catch (error) {
hideLoading()
}
})
.catch(() => {
hideLoading()
})
}
/**
* 取消
*/
function handleCancel() {
hideModal()
}
/**
* 关闭后
*/
function onAfterClose() {
resetForm()
hideLoading()
}
defineExpose({
handleCreate,
})
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,392 @@
<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="12">
<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="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="fileNumber">
<a-input v-model:value="searchFormData.fileNumber" placeholder="请输入档案号" />
</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-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: 'governmentPurchasedService',
key: 'governmentPurchasedService',
align: 'center',
width: 150,
},
{
title: '服务对象分类',
dataIndex: 'serviceRecipientCategory',
key: 'serviceRecipientCategory',
align: 'center',
width: 120,
},
{
title: '健康状况',
dataIndex: 'healthStatus',
key: 'healthStatus',
align: 'center',
width: 120,
},
// --- ---
{
title: '联系方式1',
dataIndex: 'contact1',
key: 'contact1',
align: 'center',
width: 130,
},
{
title: '联系方式2',
dataIndex: 'contact2',
key: 'contact2',
align: 'center',
width: 130,
},
{
title: '联系方式3',
dataIndex: 'contact3',
key: 'contact3',
align: 'center',
width: 130,
},
{
title: '所在区域',
dataIndex: 'region',
key: 'region',
align: 'center',
width: 120,
},
{
title: '详细地址',
dataIndex: 'detailedAddress',
key: 'detailedAddress',
align: 'center',
width: 200,
},
{
title: '所在节点',
dataIndex: 'currentNode',
key: 'currentNode',
align: 'center',
width: 120,
},
{
title: '档案号',
dataIndex: 'fileNumber',
key: 'fileNumber',
align: 'center',
width: 140,
},
// --- ---
{
title: '建档日期',
dataIndex: 'dateOfFileCreation',
key: 'dateOfFileCreation',
align: 'center',
width: 140,
customRender: ({ text, record }) => {
return text ? dayjs(text).format('YYYY-MM-DD') : '-';
},
},
{
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>

View File

@ -1,5 +1,5 @@
<template>
<a-modal :open="modal.open" :title="modal.title" :width="800" :confirm-loading="modal.confirmLoading"
<a-modal :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading"
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
<a-spin :spinning="spining">
<a-form ref="formRef" :model="formData" :rules="formRules">
@ -16,6 +16,12 @@
<a-input :placeholder="'请输入字典值'" v-model:value="formData.dval"
style="width: 100%;"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'排序'" name="sort">
<a-input-number :placeholder="'请输入排序'" v-model:value="formData.sort"
style="width: 100%;"></a-input-number>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'备注'" name="remark">

View File

@ -124,6 +124,7 @@ const listDetailData = ref([]);
const detailColumns = [
{ title: '字典标签', dataIndex: 'introduction',width:200 },
{ title: '字典值', dataIndex: 'dval',width:80 },
{ title: '排序', dataIndex: 'sort',width:80 },
{ title: '备注', dataIndex: 'remark', key: 'remark' },
{ title: '状态', dataIndex: 'status', key: 'status',width:100 },
{ title: t('button.action'), key: 'action', fixed: 'right', width: 130 },