服务对象列表和字典封装

This commit is contained in:
Leo_Ding 2025-10-10 09:30:33 +08:00
parent 47bd58577b
commit 73f1786be3
18 changed files with 1536 additions and 78 deletions

View File

@ -5,7 +5,7 @@ export const getRegion = (params) => request.basic.get('/region', params)
// 获取 验证码ID // 获取 验证码ID
export const getCaptcha = (params) => request.basic.get('/api/v1/captcha/id', params) export const getCaptcha = (params) => request.basic.get('/api/v1/captcha/id', params)
export const getDictByType = (type) => request.basic.get(`/api/v1/dictionaries?categoryCode=${type}`)
//上传图片 //上传图片
export const uploadFile=(params)=>request.basic.post('/api/v1/upload',params,{ export const uploadFile=(params)=>request.basic.post('/api/v1/upload',params,{
headers: { headers: {

View File

@ -0,0 +1,17 @@
/**
* 区域模块接口
*/
import request from '@/utils/request'
// 获取项目列表
export const getProjectList = (params) => request.basic.get('/api/v1/customers', params)
// 获取单挑数据
export const getItem = (id) => request.basic.get(`/api/v1/customers/${id}`)
// 添加条目
export const createItem = (params) => request.basic.post('/api/v1/customers', params)
// 更新role
export const updateItem = (id, params) => request.basic.put(`/api/v1/customers/${id}`, params)
// 删除数据
export const delItem = (id) => request.basic.delete(`/api/v1/customers/${id}`)

BIN
src/assets/imgs/total.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -145,7 +145,7 @@
<script setup> <script setup>
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { ref } from 'vue' import { ref } from 'vue'
import { useAppStore } from '@/store' import { useAppStore,useDicsStore } from '@/store'
import useMultiTab from './hooks/useMultiTab' import useMultiTab from './hooks/useMultiTab'
import useMenu from './hooks/useMenu' import useMenu from './hooks/useMenu'
import BasicContent from './components/BasicContent.vue' import BasicContent from './components/BasicContent.vue'
@ -162,6 +162,8 @@ defineOptions({
useMultiTab() useMultiTab()
const appStore = useAppStore() const appStore = useAppStore()
const dicsStore = useDicsStore()
dicsStore.loadAllDictData() //
const { sideMenuList, topMenuList } = useMenu() const { sideMenuList, topMenuList } = useMenu()
const { config } = storeToRefs(appStore) const { config } = storeToRefs(appStore)

View File

@ -34,4 +34,6 @@ export default {
'account.logout': '退出登录', 'account.logout': '退出登录',
'dict': '字典管理', 'dict': '字典管理',
'dict-detail': '字典数据', 'dict-detail': '字典数据',
'serverObj': '服务对象管理',
'serverList': '服务对象列表',
} }

View File

@ -7,6 +7,8 @@ import home from './home'
// import admin from './admin' // import admin from './admin'
import system from './system' import system from './system'
import platform from './platform' import platform from './platform'
import supervise from './supervise'
import severObj from './severObj'
// import link from './link' // import link from './link'
// import iframe from './iframe' // import iframe from './iframe'
// import other from './other' // import other from './other'
@ -21,6 +23,8 @@ export default [
// ...admin, // ...admin,
...system, ...system,
...platform, ...platform,
...supervise,
...severObj,
// ...link, // ...link,
// ...iframe, // ...iframe,
// ...other, // ...other,

View File

@ -0,0 +1,29 @@
import { DollarOutlined } from '@ant-design/icons-vue'
export default [
{
path: 'serverObj',
name: 'serverObj',
component: 'RouteViewLayout',
meta: {
icon: DollarOutlined,
title: '服务对象管理',
isMenu: true,
keepAlive: true,
permission: '*',
},
children: [
{
path: 'serverList',
name: 'serverList',
component: 'serverObj/serverList/index.vue',
meta: {
title: '服务对象列表',
isMenu: true,
keepAlive: true,
permission: '*',
},
},
],
},
]

View File

@ -14,9 +14,9 @@ export default [
}, },
children: [ children: [
{ {
path: 'custList/index.vue', path: 'custList',
name: 'custlist', name: 'custlist',
component: 'pages/custMenu/custList/index.vue', component: '/custMenu/custList/index.vue',
meta: { meta: {
title: '服务对象列表', title: '服务对象列表',
isMenu: true, isMenu: true,
@ -25,7 +25,7 @@ export default [
}, },
}, },
{ {
path: 'custallotList/index.vue', path: '/custListMenu/custallotList',
name: 'custallotList', name: 'custallotList',
component: 'pages/custMenu/custallotList/index.vue', component: 'pages/custMenu/custallotList/index.vue',
meta: { meta: {
@ -36,7 +36,7 @@ export default [
}, },
}, },
{ {
path: 'householdCustList/index.vue', path: '/custListMenu/householdCustList',
name: 'householdCustList', name: 'householdCustList',
component: 'pages/custMenu/householdCustList/index.vue', component: 'pages/custMenu/householdCustList/index.vue',
meta: { meta: {
@ -47,7 +47,7 @@ export default [
}, },
}, },
{ {
path: 'institutionList/index.vue', path: '/custListMenu/institutionList',
name: 'institutionList', name: 'institutionList',
component: 'pages/custMenu/institutionList/index.vue', component: 'pages/custMenu/institutionList/index.vue',
meta: { meta: {
@ -58,7 +58,7 @@ export default [
}, },
}, },
{ {
path: 'toimprovedList/index.vue', path: '/custListMenu/toimprovedList',
name: 'toimprovedList', name: 'toimprovedList',
component: 'pages/custMenu/toimprovedList/index.vue', component: 'pages/custMenu/toimprovedList/index.vue',
meta: { meta: {
@ -69,7 +69,7 @@ export default [
}, },
}, },
{ {
path: 'phonecareList/index.vue', path: '/custListMenu/phonecareList',
name: 'phonecareList', name: 'phonecareList',
component: 'pages/custMenu/phonecareList/index.vue', component: 'pages/custMenu/phonecareList/index.vue',
meta: { meta: {
@ -80,7 +80,7 @@ export default [
}, },
}, },
{ {
path: 'selectiveList/index.vue', path: '/custListMenu/selectiveList',
name: 'selectiveList', name: 'selectiveList',
component: 'pages/custMenu/selectiveList/index.vue', component: 'pages/custMenu/selectiveList/index.vue',
meta: { meta: {
@ -91,7 +91,7 @@ export default [
}, },
}, },
{ {
path: 'livingstateList/index.vue', path: '/custListMenu/livingstateList',
name: 'livingstateList', name: 'livingstateList',
component: 'pages/custMenu/livingstateList/index.vue', component: 'pages/custMenu/livingstateList/index.vue',
meta: { meta: {

View File

@ -4,6 +4,7 @@ import useAppStore from './modules/app'
import useMultiTabStore from './modules/multiTab' import useMultiTabStore from './modules/multiTab'
import useRouterStore from './modules/router' import useRouterStore from './modules/router'
import useUserStore from './modules/user' import useUserStore from './modules/user'
import useDicsStore from './modules/dicts'
const store = createPinia() const store = createPinia()
const setupStore = (app) => { const setupStore = (app) => {
@ -11,6 +12,6 @@ const setupStore = (app) => {
return app return app
} }
export { setupStore, useAppStore, useMultiTabStore, useRouterStore, useUserStore } export { setupStore, useAppStore, useMultiTabStore, useRouterStore, useUserStore, useDicsStore }
export default store export default store

103
src/store/modules/dicts.js Normal file
View File

@ -0,0 +1,103 @@
import { message } from 'ant-design-vue'
import { cloneDeep, findIndex, isEmpty } from 'lodash-es'
import { defineStore } from 'pinia'
import { getDictByType } from '@/apis/modules/common'
import router from '@/router'
import apis from '@/apis'
import useAppStore from './app'
const useDicsStore = defineStore('dics', {
state: () => ({
dictOptions: {},
}),
getters: {
/**
* 根据字典 key 获取选项列表
* @param state
* @returns {function(string): Array}
*/
getDict: (state) => (key) => {
return state.dictOptions[key] || []
},
/**
* 根据字典 key 和值获取对应的中文描述introduction
* @param state
* @returns {function(string, string): string}
*/
getDictLabel: (state) => (key, value) => {
const options = state.dictOptions[key] || []
const item = options.find((opt) => opt.dval === value)
return item ? item.introduction : '-'
},
/**
* 判断某个字典是否存在
*/
hasDict: (state) => (key) => {
return !!state.dictOptions[key]
},
},
mutations: {
/**
* 保存所有字典数据
* @param state
* @param payload {Object} 字典对象
*/
SET_DICT_DATA(state, payload) {
state.dictOptions = { ...payload }
},
/**
* 清空字典数据
* @param state
*/
CLEAR_DICT_DATA(state) {
state.dictOptions = {}
},
},
actions: {
/**
* 从后端加载所有字典数据
* @param commit
* @returns {Promise<void>}
*/
async loadAllDictData() {
try {
const res = await apis.dict
.getProjectList({
pageSize: 100,
current: 1,
})
.catch(() => {
throw new Error()
})
if (res?.data) {
this.dictOptions = res.data
if (res.data.length > 0) {
const dictTypes = res.data.map(item => item.code)
const requests = dictTypes.map((type) => getDictByType(type))
const results = await Promise.all(requests)
// 将结果按 type 存入 dictOptions
dictTypes.forEach((type, index) => {
this.dictOptions[type] = results[index].data || []
})
console.log('字典数据加载完成', this.dictOptions)
}
}
} catch (error) {
console.error('加载字典数据失败:', error)
}
},
/**
* 可选清空字典数据登出时调用
*/
clearDictData({ commit }) {
commit('CLEAR_DICT_DATA')
},
},
})
export default useDicsStore

3
src/utils/dics.js Normal file
View File

@ -0,0 +1,3 @@
export const dicList=[
]

View File

@ -51,7 +51,7 @@ import { useRoute, useRouter } from 'vue-router'
import { LockOutlined, UserOutlined, SafetyOutlined } from '@ant-design/icons-vue' import { LockOutlined, UserOutlined, SafetyOutlined } from '@ant-design/icons-vue'
import { config } from '@/config' import { config } from '@/config'
import { useForm } from '@/hooks' import { useForm } from '@/hooks'
import { useAppStore, useRouterStore, useUserStore } from '@/store' import { useAppStore, useRouterStore, useUserStore,useDicsStore } from '@/store'
import { timeFix } from '@/utils/util' import { timeFix } from '@/utils/util'
import apis from '@/apis' import apis from '@/apis'
@ -65,6 +65,7 @@ const { formData, formRef, formRules } = useForm()
const appStore = useAppStore() const appStore = useAppStore()
const userStore = useUserStore() const userStore = useUserStore()
const routerStore = useRouterStore() const routerStore = useRouterStore()
const dicsStore = useDicsStore()
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const loading = ref(false) const loading = ref(false)
@ -117,6 +118,7 @@ async function handleLogin() {
}) })
loading.value = false loading.value = false
if (config('http.code.success') === success) { if (config('http.code.success') === success) {
// dicsStore.loadAllDictData() //
router.push('/platform') router.push('/platform')
} }
}) })
@ -154,10 +156,7 @@ function goIndex() {
if (!indexRoute) return if (!indexRoute) return
router.push(indexRoute) router.push(indexRoute)
} }
notification.success({
message: t('welcome'),
description: `${timeFix()}${t('home')}`,
})
} }
</script> </script>

View File

@ -96,10 +96,7 @@ async function goIndex() {
console.log(indexRoute) console.log(indexRoute)
if (!indexRoute) return if (!indexRoute) return
router.push(indexRoute) router.push(indexRoute)
notification.success({
message: t('welcome'),
description: `${timeFix()}${t('home')}`,
})
} }
/** /**
* 获取首页路由 * 获取首页路由

View File

@ -0,0 +1,543 @@
<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" :rules="[{ required: true, message: '请输入姓名' }]">
<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="MAN"></a-radio>
<a-radio value="WOMAN"></a-radio>
</a-radio-group>
</a-form-item>
</a-col>
<!-- 证件号码 -->
<a-col :span="12">
<a-form-item label="证件号码" name="idNumber" :rules="[{ required: true, message: '请输入证件号码' }]">
<span style="display: inline-flex; width: 100%;">
<a-select v-model:value="formData.idType" style="width: 100px; margin-right: 8px;">
<a-select-option value="身份证">身份证</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="请选择出生日期" disabled
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" :rules="[{ required: true, message: '请输入联系方式' }]">
<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 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"
:rules="[{ required: true, message: '请选择健康状况' }]">
<a-select v-model:value="formData.healthStatus" placeholder="请选择健康状况" allow-clear>
<a-select-option v-for="item in 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="请选择服务状态" disabled>
<a-select-option value="服务中">服务中</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-select v-model:value="formData.survivalStatus" placeholder="请选择生存状态" disabled>
<a-select-option value="在世">在世</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 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 dictOptions.Care_Level" :key="item.dval"
:value="item.dval">
{{ item.introduction }}
</a-select-option>
</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="homeAddress"
:rules="[{ required: true, message: '请选择并输入家庭地址' }]">
<a-cascader v-model:value="formData.homeArea" placeholder="请选择" :options="areaOptions"
change-on-select />
<a-input v-model:value="formData.homeDetailAddress" placeholder="请输入详细地址" />
</a-form-item>
</a-col>
<!-- 地图定位地址 -->
<a-col :span="24">
<a-form-item label="地图定位地址" name="mapLocationAddress">
<a-button type="link" style="padding: 0;">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAADRklEQVRYCb1WTUhUURQ+Z2ZUMglEKEdFC9tFRquINgbtCqSFW4PoZ6GOA0WlFQT9WgY61qJNUBQELsSoXVC7cBUZUYukLHVMECPS0px3Oucx93XfnffevHGsB49z7vm+c74z992fQSjgqeunpgzCfiLYx2n1gFBtpxPMsP2MCM+iBE8nkzgWtiyGIdYNUvNKBq4wd3cYPnNexqLQM9mJL/LxAxvYdpsq5n7DXS7Smq+QDz5UVQKH37bjDx+cJ9HnaRikLUsWjADBdh9KuDDCm7IItEx04kevBM8Gam9RVSYDoyze6JVUcAxhPBqFXVMdOGfmRsxA83OKsfjQmomLAP8QqSm1Tb2cBt6/hmOcsNckFj3mmnZto5DrEzTdp/Wz8zDODWwyeGszRPi6sRIax9pwQRV0zcDsN2j7Z+KiyD/M1lDqbF0NoAUtGhbo8qEzzG8y+w4HkjXQ1HA+Qc0dKqefME8ApRrfy12JAhycSuITHaztpwMZAGkkZ6HpPBZcxnVQOX0cFyX+dwaWoT6EuBwc10xxKSQxwcQPemwN1lIcpwGemrgKBtmSGDzyw4MwPUfXchoghAqd5OeXWvBlNZieo2s5DViWfaPpPE+f988OT4CDQZieo2s5DcTKYFon+foWnPXFCM75Yhqgazm7QPD4AH3iu75B43q6EYR75QiJDwn8LoStKdqwSJCyCA55JmhB3rYT6S7crEKuLcMr9DEDnQr0syLE090a76dXwlkg2MmNl/vx9XhWwwk5n0Ai/CfioYPkcUSQi+2x35DiXhquBiY7cJSnaCSP9qphqS0aegFXAzYQg24m/tJJa+FzzSU+I7vNWjkNpNvxHV8aR01i0WOCI3Zto1BOA4Knk/gAI/afUIO+uqHUkppe2a5taBJqUtTHh8YJM17IOBKBm9MJPOmX4zkDipxNvKHGhVo+L/qCxKVe4AwoweoB6uV1cUqNQ1mE6zNdeDofN3AGVLIU4lWc96pVfLa9YcSFH6oBIfLxKdvzqvhBj3BmkngmiKNjoT6BnhBP0WWyoEePKd9e7Qn0v6wUUbOhZ0DlpFmAu76kxspKTDA1DmsLbkAK854+zyv8ohIRX2Jq/N9szQBdkLcYwT9BJvELTXHGpwAAAABJRU5ErkJggg=="
style="width: 18px; cursor: pointer;" alt="定位" />
</a-button>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<!-- 更多 -->
<a-tab-pane key="3" tab="更多">
<a-row :gutter="24">
<!-- 居住情况 -->
<a-col :span="12">
<a-form-item label="居住情况" name="livingSituation">
<a-select v-model:value="formData.livingSituation" placeholder="请选择居住情况" allow-clear>
<a-select-option v-for="item in dictOptions.Living_Situation" :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="childrenSituation">
<a-select v-model:value="formData.childrenSituation" placeholder="请选择子女情况" allow-clear>
<a-select-option v-for="item in dictOptions.CHILDREN_SITUATION" :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="statisticsCategory">
<a-select v-model:value="formData.statisticsCategory" placeholder="请选择统计分类" allow-clear>
<a-select-option v-for="item in dictOptions.Statistical_Classification" :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="intellectualSituation">
<a-select v-model:value="formData.intellectualSituation" placeholder="请选择智力情况"
allow-clear>
<a-select-option v-for="item in dictOptions.Intellectual_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="longTermCareForDisabledChildren">
<a-select v-model:value="formData.longTermCareForDisabledChildren"
placeholder="请选择是否长期照料失能子女" allow-clear>
<a-select-option v-for="item in dictOptions.Disabled_Child" :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="childrenVisitStatus">
<a-select v-model:value="formData.childrenVisitStatus" placeholder="请选择老人子女探望情况"
allow-clear>
<a-select-option v-for="item in dictOptions.Frequency_Visits" :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="householdResidenceSeparation">
<a-select v-model:value="formData.householdResidenceSeparation" placeholder="请选择是否人户分离"
allow-clear>
<a-select-option v-for="item in dictOptions.Separation" :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="ethnicity">
<a-select v-model:value="formData.ethnicity" placeholder="请选择民族" allow-clear>
<a-select-option v-for="item in dictOptions.Ethnicity" :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="completedCapacityAssessment">
<a-select v-model:value="formData.completedCapacityAssessment" placeholder="请选择是否完成能力评估"
allow-clear>
<a-select-option v-for="item in dictOptions.Capability_Assessment" :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="livesInRentedRoomOrBasement">
<a-select v-model:value="formData.livesInRentedRoomOrBasement"
placeholder="请选择是否住出租屋/地下室" allow-clear>
<a-select-option v-for="item in dictOptions.Property_Basement" :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="economicSource">
<a-select v-model:value="formData.economicSource" placeholder="请选择经济来源" allow-clear>
<a-select-option v-for="item in dictOptions.Source_Income" :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="educationLevel">
<a-select v-model:value="formData.educationLevel" placeholder="请选择文化程度" allow-clear>
<a-select-option v-for="item in dictOptions.Level_Education" :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="religion">
<a-select v-model:value="formData.religion" placeholder="请选择宗教信仰" allow-clear>
<a-select-option v-for="item in dictOptions.Religious_belief" :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="occupation">
<a-select v-model:value="formData.occupation" placeholder="请选择职业情况" allow-clear>
<a-select-option v-for="item in dictOptions.Employment_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="politicalAffiliation">
<a-select v-model:value="formData.politicalAffiliation" placeholder="请选择政治面貌"
allow-clear>
<a-select-option v-for="item in dictOptions.Political_affiliation" :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="maritalStatus">
<a-select v-model:value="formData.maritalStatus" placeholder="请选择婚姻情况" allow-clear>
<a-select-option v-for="item in dictOptions.Marital_Status" :key="item.dval"
:value="item.dval">
{{ item.introduction }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<!-- 户口所在地 -->
<a-col :span="24">
<a-form-item label="户口所在地" name="householdLocation">
<a-cascader v-model:value="formData.householdArea" placeholder="请选择"
:options="areaOptions" change-on-select />
<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="4"
:auto-size="{ minRows: 4, maxRows: 4 }" />
</a-form-item>
</a-col>
<!-- 身份证照片 -->
<a-col :span="24">
<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="24">
<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'
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: '请输入姓名' }],
idNumber: [{ required: true, message: '请输入证件号码' }],
contact1: [{ required: true, message: '请输入联系方式' }],
healthStatus: [{ required: true, message: '请选择健康状况' }],
survivalStatus: [{ required: true, message: '请选择生存状态' }],
homeAddress: [{ required: true, message: '请选择并输入家庭地址' }],
}
const props = defineProps({
dictOptions: {
type: Object,
default: () => ({}),
}
})
/**
* 新建
*/
function handleCreate() {
showModal({
type: 'create',
title: '新建项',
})
}
/**
* 编辑
*/
function handleEdit(record = {}) {
showModal({
type: 'edit',
title: '编辑项',
})
formRecord.value = record
formData.value = cloneDeep(record)
}
/**
* 确定
*/
function handleOk() {
formRef.value
.validateFields()
.then(async (values) => {
try {
showLoading()
const params = {
...values,
}
let result = null
switch (modal.value.type) {
case 'create':
result = await apis.common.create(params).catch(() => {
throw new Error()
})
break
case 'edit':
result = await apis.common.update(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,
handleEdit,
})
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,789 @@
<template>
<x-search-bar class="mb-8-2">
<template #default="{ gutter, colSpan }">
<a-form :model="searchFormData" layout="inline">
<a-row :gutter="[24, 24]">
<!-- 所在节点 -->
<a-col :span="6">
<a-row :gutter="[24, 24]">
<a-col :span="24">
<a-form-item label="所在节点" name="currentNode">
<a-tree-select v-model:value="searchFormData.currentNode" style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" :tree-data="treeData"
placeholder="请选择" tree-default-expand-all>
<template #title="{ key, value }">
<span style="color: #08c" v-if="key === '0-0-1'">Child Node1 {{ value
}}</span>
</template>
</a-tree-select>
</a-form-item>
</a-col>
<a-col :span="24" class="align-center">
<div style="display: flex; align-items: center;justify-content: center;">
<a-image :width="50" :src="totalImg" />
<span style="font-size: 28px;margin-left: 10px;">{{ totalCount }}</span>
</div>
</a-col>
</a-row>
</a-col>
<!-- 其他搜索项 -->
<a-col :span="18">
<a-row :gutter="[24, 24]">
<!-- 所在区域 -->
<a-col :span="8">
<a-form-item label="所在区域" name="region">
<a-cascader v-model:value="searchFormData.region" :options="areaOptions"
placeholder="请选择" />
</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="serviceStatus">
<a-select v-model:value="searchFormData.serviceStatus" 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="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="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 :span="8">
<a-form-item label="残疾类型" name="disabilityType">
<a-select v-model:value="searchFormData.disabilityType" allowClear>
<a-select-option v-for="item in dicsStore.dictOptions.DISABILITY_TYPES" :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="disabilityLevel">
<a-select v-model:value="searchFormData.disabilityLevel" allowClear>
<a-select-option v-for="item in dicsStore.dictOptions.Disability_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="livesInRentedRoomOrBasement">
<a-select v-model:value="searchFormData.livesInRentedRoomOrBasement" allowClear>
<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="completedCapacityAssessment">
<a-select v-model:value="searchFormData.completedCapacityAssessment" allowClear>
<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="householdResidenceSeparation">
<a-select v-model:value="searchFormData.householdResidenceSeparation" allowClear>
<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="maritalStatus">
<a-select v-model:value="searchFormData.maritalStatus" allowClear>
<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="healthStatus">
<a-select v-model:value="searchFormData.healthStatus" allowClear>
<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="8">
<a-form-item label="居住情况" name="livingSituation">
<a-select v-model:value="searchFormData.livingSituation" allowClear>
<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="statisticalClassification">
<a-select v-model:value="searchFormData.statisticalClassification" allowClear>
<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="intellectualCondition">
<a-select v-model:value="searchFormData.intellectualCondition" allowClear>
<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="longTermCareForDisabledChild">
<a-select v-model:value="searchFormData.longTermCareForDisabledChild" allowClear>
<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="frequencyOfVisits">
<a-select v-model:value="searchFormData.frequencyOfVisits" allowClear>
<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>
<!-- 户籍地址建议若为区域则用 region若为详细地址则用 detailedAddress -->
<a-col :span="8">
<a-form-item label="户籍地址" name="detailedAddress">
<a-tree-select v-model:value="searchFormData.detailedAddress" style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" :tree-data="treeData"
placeholder="请选择" tree-default-expand-all>
<template #title="{ key, value }">
<span style="color: #08c" v-if="key === '0-0-1'">Child Node1 {{ value
}}</span>
</template>
</a-tree-select>
</a-form-item>
</a-col>
<!-- 联系方式 -->
<a-col :span="8">
<a-form-item label="联系方式" name="contact1">
<a-input v-model:value="searchFormData.contact1" placeholder="请输入联系方式" />
</a-form-item>
</a-col>
<!-- 操作按钮 -->
<a-col class="align-right" :span="24">
<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-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 type="primary" @click="$refs.editDialogRef.handleCreate()">新建</a-button>
<a-button>导入</a-button>
<a-button danger>批量打标</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="{ column, record }">
<template v-if="'action' === column.key">
<x-action-button @click="checkHandler(record)">
<span>详情</span>
</x-action-button>
<x-action-button @click="checkHandler(record)">
<span>线下工单</span>
</x-action-button>
<x-action-button @click="checkHandler(record)">
<span>编辑</span>
</x-action-button>
<x-action-button @click="checkHandler(record)">
<span>线上工单</span>
</x-action-button>
<x-action-button @click="checkHandler(record)">
<span>转出</span>
</x-action-button>
</template>
</template>
</a-table>
</a-card>
</a-col>
</a-row>
<edit-dialog ref="editDialogRef" @ok="onOk" :dict-options="dictOptions"></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 { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs'
import { status } from 'nprogress'
import { getDictByType } from '@/apis/modules/common'
import totalImg from '@/assets/imgs/total.png'
import EditDialog from './components/EditDialog.vue'
import { useDicsStore } from '@/store'
defineOptions({
name: 'serverList',
})
const totalCount = ref(0) //
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: 'qrCode',
key: 'qrCode',
align: 'center',
width: 100,
},
{
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,
},
{
title: '去世原因',
dataIndex: 'causeOfDeath',
key: 'causeOfDeath',
align: 'center',
width: 140,
},
{
title: '更新时间',
dataIndex: 'updateTime',
key: 'updateTime',
align: 'center',
width: 140,
},
{
title: '失能险签约日期',
dataIndex: 'ltcInsuranceSignUpDate',
key: 'ltcInsuranceSignUpDate',
align: 'center',
width: 150,
},
{
title: '失能险解约日期',
dataIndex: 'ltcInsuranceTerminationDate',
key: 'ltcInsuranceTerminationDate',
align: 'center',
width: 150,
},
{
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,
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
align: 'center',
width: 180,
}
];
const { t } = useI18n() // t
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
const editDialogRef = 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',
},
],
},
],
},])
// type
const dictOptions = ref({})
initData()
// getDicList()
async function initData() {
try {
showLoading()
await getPageList()
hideLoading()
} catch (error) {
hideLoading()
}
}
async function getDicList() {
try {
const dictTypes = [
"SERVICE_STATUS", //
"LIVING_STATUS", //
"CATEGORY_LABELS", //
"DISABILITY_TYPES", //
"Disability_Level", //
"Capability_Assessment", //
"Property_Basement", // /
"Separation", //
"Marital_Status", //
"Health_Condition", //
"Living_Situation", //
"Statistical_Classification", //
"Intellectual_Condition", //
"Disabled_Child", //
"Frequency_Visits", //
"Service_Format", //
"Care_Level", //
"Ethnicity", //
"Source_Income", //
"Level_Education", //
"Religious_belief", //
"Employment_Status", //
"Political_affiliation" //
]
// Promise
const requests = dictTypes.map(type => getDictByType(type))
console.log(requests, 'requests')
//
const results = await Promise.all(requests)
// type dictOptions
dictTypes.forEach((type, index) => {
dictOptions.value[type] = results[index].data || []
})
console.log(dictOptions.value, 'dictOptions')
} catch (err) {
console.error('字典数据加载失败:', err)
//
dictTypes.forEach(type => {
dictOptions.value[type] = []
})
} finally {
hideLoading()
}
}
/**
* 获取表格数据
* @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

@ -1,37 +1,18 @@
<template> <template>
<a-modal <a-modal :open="modal.open" :title="modal.title" :width="480" :confirm-loading="modal.confirmLoading"
:open="modal.open" :after-close="onAfterClose" :cancel-text="cancelText" @ok="handleOk" @cancel="handleCancel">
:title="modal.title" <a-form ref="formRef" :model="formData" :rules="formRules" :label-col="{ style: { width: '90px' } }">
:width="480" <a-form-item label="名称" name="name">
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
:cancel-text="cancelText"
@ok="handleOk"
@cancel="handleCancel">
<a-form
ref="formRef"
:model="formData"
:rules="formRules"
:label-col="{ style: { width: '90px' } }">
<a-form-item
label="名称"
name="name">
<a-input v-model:value="formData.name"></a-input> <a-input v-model:value="formData.name"></a-input>
</a-form-item> </a-form-item>
<a-form-item <a-form-item label="唯一值" name="key">
label="唯一值"
name="key">
<a-input v-model:value="formData.key"></a-input> <a-input v-model:value="formData.key"></a-input>
</a-form-item> </a-form-item>
<a-form-item <a-form-item label="状态" name="status">
label="状态" <a-radio-group v-model:value="formData.status" :options="[
name="status"> { label: '启用', value: 1 },
<a-radio-group { label: '禁用', value: 0 },
v-model:value="formData.status" ]"></a-radio-group>
:options="[
{ label: '启用', value: 1 },
{ label: '禁用', value: 0 },
]"></a-radio-group>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>

View File

@ -1,11 +1,7 @@
<template> <template>
<a-row <a-row :gutter="8" :wrap="false">
:gutter="8"
:wrap="false">
<a-col flex="0 0 280px"> <a-col flex="0 0 280px">
<dict <dict v-model:value="searchFormData.role" @change="onDictChange"></dict>
v-model:value="searchFormData.role"
@change="onDictChange"></dict>
</a-col> </a-col>
<a-col flex="auto"> <a-col flex="auto">
<a-card type="flex"> <a-card type="flex">
@ -14,32 +10,23 @@
<span class="fs-14 fw-400 ml-8-2">{{ selectedDict?.key }}</span> <span class="fs-14 fw-400 ml-8-2">{{ selectedDict?.key }}</span>
</template> </template>
<x-action-bar class="mb-8-2"> <x-action-bar class="mb-8-2">
<a-button <a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
type="primary"
@click="$refs.editDialogRef.handleCreate()">
<template #icon> <template #icon>
<plus-outlined></plus-outlined> <plus-outlined></plus-outlined>
</template> </template>
新建项 新建项
</a-button> </a-button>
<template #extra> <template #extra>
<x-search-bar <x-search-bar :body-style="{ padding: 0 }" :bordered="false">
:body-style="{ padding: 0 }"
:bordered="false">
<a-form layout="inline"> <a-form layout="inline">
<a-row <a-row :gutter="12" type="flex">
:gutter="12"
type="flex">
<a-col> <a-col>
<a-form-item> <a-form-item>
<a-input></a-input> <a-input></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col> <a-col>
<a-button <a-button ghost type="primary">搜索
ghost
type="primary"
>搜索
</a-button> </a-button>
</a-col> </a-col>
</a-row> </a-row>
@ -47,11 +34,7 @@
</x-search-bar> </x-search-bar>
</template> </template>
</x-action-bar> </x-action-bar>
<a-table <a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
:columns="columns"
:data-source="listData"
:loading="loading"
:pagination="paginationState"
@change="onTableChange"> @change="onTableChange">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="'action' === column.key"> <template v-if="'action' === column.key">
@ -64,9 +47,7 @@
</a-col> </a-col>
</a-row> </a-row>
<edit-dialog <edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
ref="editDialogRef"
@ok="onOk"></edit-dialog>
</template> </template>
<script setup> <script setup>
@ -133,7 +114,7 @@ function handleDelete({ id }) {
okText: '确认', okText: '确认',
onOk: () => { onOk: () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
;(async () => { ; (async () => {
try { try {
const { code } = await apis.common.del(id).catch(() => { const { code } = await apis.common.del(id).catch(() => {
throw new Error() throw new Error()

View File

@ -10,6 +10,12 @@
<a-input :placeholder="'请输入字典名称'" v-model:value="formData.name" <a-input :placeholder="'请输入字典名称'" v-model:value="formData.name"
style="width: 100%;"></a-input> style="width: 100%;"></a-input>
</a-form-item> </a-form-item>
</a-col>
<a-col :span="24">
<a-form-item :label="'字典类型'" name="code">
<a-input :placeholder="'请输入字典类型'" v-model:value="formData.code"
style="width: 100%;"></a-input>
</a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item :label="'备注'" name="introduction"> <a-form-item :label="'备注'" name="introduction">
@ -48,6 +54,7 @@ const cancelText = ref(t('button.cancel'))
const okText = ref(t('button.confirm')) const okText = ref(t('button.confirm'))
formRules.value = { formRules.value = {
name: { required: true, message: '请输入字典名称' }, name: { required: true, message: '请输入字典名称' },
code: { required: true, message: '请输入字典类型' },
} }
/** /**