Procházet zdrojové kódy

对接居家服务项目接口

unknown před 1 měsícem
rodič
revize
a5657d8c7e

+ 1 - 1
src/api/elderly/elder/contract/index.ts

@@ -10,7 +10,7 @@ export const getElderlyContract = (query) => {
 // 获取列表
 export const getElderlyContract2 = (query) => {
   return request.get({
-    url: 'elderly/contract/findPage',
+    url: '/elderly/contract/expiring-within-one-month',
     params: query
   })
 }

+ 3 - 3
src/views/Home/Index.vue

@@ -605,13 +605,13 @@ const getContractList = async () => {
   try {
     const data = await getElderlyContract2(queryParamsContract)
     //console.log("弹窗",userStore.tenant.id)
-    if (data.list && data.list.length > 0) {
+    if (data && data.length > 0) {
       // 使用全局通知弹窗
       if ((window as any).$showContractNotification) {
         (window as any).$showContractNotification({
           title: '合同过期提醒',
-          message: `检测到 ${data.list.length} 位长者的合同已过期,请及时处理!`,
-          contracts: data.list.map((item: any) => ({
+          message: `检测到 ${data.length} 位长者的合同已过期,请及时处理!`,
+          contracts: data.map((item: any) => ({
             elderName: item.elderName || item.name,
             expireDate: formatTimestampYMD(item.expireTime)
           }))

+ 3 - 3
src/views/elderly/elder/contract/index.vue

@@ -152,12 +152,12 @@ const getContractList = async () => {
   loading.value = true
   try {
     const data = await getElderlyContract2(queryParamsContract)
-    if(data.list && data.list.length>0){
+    if(data && data.length>0){
       if ((window as any).$showContractNotification) {
         (window as any).$showContractNotification({
           title: '合同过期提醒',
-          message: `检测到 ${data.list.length} 位长者的合同已过期,请及时处理!`,
-          contracts: data.list.map((item: any) => ({
+          message: `检测到 ${data.length} 位长者的合同已过期,请及时处理!`,
+          contracts: data.map((item: any) => ({
             elderName: item.elderName || item.name,
             expireDate: formatTimestampYMD(item.expireTime)
           }))

+ 2 - 55
src/views/living-home/elderlyManage/elderly-person-file-in/index.vue

@@ -118,7 +118,7 @@
 <script setup lang="ts">
 import { ref, onMounted } from 'vue'
 import { useRouter } from 'vue-router'
-import {getElderlyList, updateElderlyInfo, deleteElderly, deleteElderlyBatch} from '@/api/ykCenter'
+import {deleteElderlyBatch} from '@/api/ykCenter'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import Import from "@/components/ImportFile/index.vue";
 import Form from "./Form.vue";
@@ -271,57 +271,7 @@ const handleDateChange = (value: any) => {
   }
 }
 
-// 默认假数据 - 在住长者
-const defaultElderlyList = [
-  {
-    id: '1',
-    elderName: '张大爷',
-    gender: 1,
-    age: 78,
-    personalPhone: '13800138001',
-    homeTel: '0769-12345678',
-    selfCareStatus: '1',
-    liveSituation: '1',
-    voucherBalance: 500,
-    cashBalance: 1200,
-    isEnjoyService: '1',
-    serviceTimes: 12,
-    currentAddress: '东莞市南城区宏图路1号',
-    registerTime: '2024-01-15 10:30:00'
-  },
-  {
-    id: '2',
-    elderName: '李奶奶',
-    gender: 2,
-    age: 82,
-    personalPhone: '13900139002',
-    homeTel: '0769-87654321',
-    selfCareStatus: '2',
-    liveSituation: '2',
-    voucherBalance: 800,
-    cashBalance: 2500,
-    isEnjoyService: '1',
-    serviceTimes: 24,
-    currentAddress: '东莞市东城区东纵路2号',
-    registerTime: '2023-08-20 14:20:00'
-  },
-  {
-    id: '3',
-    elderName: '王爷爷',
-    gender: 1,
-    age: 75,
-    personalPhone: '13700137003',
-    homeTel: '0769-11223344',
-    selfCareStatus: '1',
-    liveSituation: '1',
-    voucherBalance: 0,
-    cashBalance: 500,
-    isEnjoyService: '0',
-    serviceTimes: 0,
-    currentAddress: '东莞市万江区万道路3号',
-    registerTime: '2024-03-10 09:15:00'
-  }
-]
+
 
 // 获取长者列表
 const getList = async () => {
@@ -338,9 +288,6 @@ const getList = async () => {
     total.value = res.total || elderlyList.value.length
   } catch (error) {
     console.error('获取长者列表失败:', error)
-    // 接口失败时使用默认假数据
-    elderlyList.value = defaultElderlyList
-    total.value = defaultElderlyList.length
     ElMessage.warning('使用默认数据展示')
   } finally {
     loading.value = false

+ 61 - 28
src/views/living-home/serviceItemManage/serviceCombo/addComboForm.vue

@@ -57,7 +57,7 @@
           </el-button>
           <div v-if="selectedItems.length" class="mt-10px p-10px bg-gray-50 rounded">
             <div v-for="(item, index) in selectedItems" :key="item.id" class="flex items-center justify-between mb-5px last:mb-0">
-              <span>{{ item.serviceName }}({{ item.servicePrice }}元)</span>
+              <span style="color: #1d1414">{{ item.itemName }}({{ item.amount||0 }}元)</span>
               <el-button v-if="formType !== 'detail'" type="danger" link size="small" @click="removeSelectedItem(index)">删除</el-button>
             </div>
           </div>
@@ -217,16 +217,32 @@
         >
           <el-table-column type="selection" width="55" align="center" />
           <el-table-column label="序号" type="index" width="80" align="center" />
-          <el-table-column prop="serviceName" label="服务名称" align="center" min-width="150" />
-          <el-table-column prop="serviceTypeName" label="服务类别" align="center" min-width="120" />
-          <el-table-column prop="deductElderFee" label="是否收费" align="center" width="100" />
-          <el-table-column prop="servicePrice" label="金额(元)" align="center" width="100" />
-          <el-table-column prop="billingMethod" label="收费方式" align="center" width="100" />
+          <el-table-column prop="itemName" label="服务名称" align="center" min-width="150" />
+          <el-table-column prop="serviceTypeName" label="服务类别" align="center" min-width="120" >
+            <template #default="scope">
+              {{ getServiceTypeName(scope.row.categoryId) }}
+            </template>
+          </el-table-column>
+          <el-table-column prop="isDeductElderFee" label="是否扣取长者费用" align="center" width="150">
+            <template #default="scope">
+              <el-tag>{{ scope.row.isDeductElderFee==1?"是":"否" }}</el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column prop="amount" label="金额(元)" align="center" width="100" >
+            <template #default="scope">
+              {{ parseFloat(scope.row.amount||"0").toFixed(2) }}
+            </template>
+          </el-table-column>
+          <el-table-column prop="billingMethod" label="计费方式" align="center" width="100">
+            <template #default="scope">
+              {{ scope.row.costType==1?"按时":"按次" }}
+            </template>
+          </el-table-column>
         </el-table>
       </div>
       
-      <div class="bg-gray-50 p-15px rounded">
-        <div class="font-bold mb-10px">已勾选项目:</div>
+      <div class="bg-gray-50 p-15px rounded" style="margin-bottom: 10px">
+        <div class="font-bold mb-10px">已选项目:</div>
         <div v-if="tempSelectedItems.length" class="flex flex-wrap gap-10px">
           <el-tag
             v-for="item in tempSelectedItems"
@@ -234,7 +250,7 @@
             closable
             @close="removeTempItem(item.id)"
           >
-            {{ item.serviceName }}({{ item.servicePrice }}元)
+            {{ item.itemName }}({{ item.amount||0 }}元)
           </el-tag>
         </div>
         <div v-else class="text-gray-400">暂无已选项目</div>
@@ -258,6 +274,7 @@ import { FormRules } from 'element-plus'
 import UploadImg from '@/components/UploadFile/src/UploadImg.vue'
 import UploadImgs from '@/components/UploadFile/src/UploadImgs.vue'
 import * as ServiceComboApi from '@/api/living-home/elderly'
+import * as ServiceItemApi from '@/api/living-home/elderly'
 import {useUserStore} from "@/store/modules/user";
 const userStore = useUserStore()
 defineOptions({ name: 'ServiceComboForm' })
@@ -316,15 +333,9 @@ const formRef = ref()
 const getServiceTypeList = async () => {
   try {
     const data = await ServiceComboApi.getServiceTypeList()
-    serviceTypeList.value = data || []
+    serviceTypeList.value = data.list || []
   } catch (error) {
-    serviceTypeList.value = [
-      { id: 1, name: '生活照料' },
-      { id: 2, name: '医疗护理' },
-      { id: 3, name: '康复保健' },
-      { id: 4, name: '精神慰藉' },
-      { id: 5, name: '文化娱乐' }
-    ]
+
   }
 }
 
@@ -335,18 +346,22 @@ const getAvailableItems = async () => {
     if (itemQueryParams.serviceTypeId) {
       params.serviceTypeId = itemQueryParams.serviceTypeId
     }
-    const data = await ServiceComboApi.getServiceItemList(params)
-    availableItems.value = data || []
+    const data = await ServiceComboApi.getServiceItemPage(params)
+    availableItems.value = data.list || []
   } catch (error) {
-    availableItems.value = [
-      { id: 1, serviceName: '居家清洁服务', serviceTypeName: '生活照料', servicePrice: 80, deductElderFee: '是', billingMethod: '按次' },
-      { id: 2, serviceName: '助餐送餐服务', serviceTypeName: '生活照料', servicePrice: 25, deductElderFee: '是', billingMethod: '按次' },
-      { id: 3, serviceName: '陪同就医服务', serviceTypeName: '医疗护理', servicePrice: 120, deductElderFee: '是', billingMethod: '按时' },
-      { id: 4, serviceName: '健康体检服务', serviceTypeName: '医疗护理', servicePrice: 200, deductElderFee: '是', billingMethod: '按次' }
-    ]
+
   }
 }
 
+
+/** 根据categoryId获取服务类别名称 */
+const getServiceTypeName = (categoryId: number | undefined) => {
+  if (!categoryId) return '-'
+  const type = serviceTypeList.value.find(item => item.id === categoryId)
+  return type?.name || '-'
+}
+
+
 /** 打开选择项目弹窗 */
 const openSelectItemDialog = () => {
   tempSelectedItems.value = [...selectedItems.value]
@@ -389,7 +404,7 @@ const confirmSelectItems = () => {
   formData.value.comboPrice = totalPrice
   
   // 自动生成概述
-  const descriptions = selectedItems.value.map(item => `${item.serviceName}:${item.serviceDescription || ''}`)
+  const descriptions = selectedItems.value.map(item => `${item.itemName}:${item.serviceDescription || ''}`)
   formData.value.comboDescription = descriptions.join('\n')
   
   selectItemDialogVisible.value = false
@@ -456,9 +471,27 @@ const open = async (type: string, id?: number) => {
         tenantId: data.tenantId || userStore.tenant.id
       }
       if (data.itemIds) {
-        // 需要根据itemIds加载项目详情
+        // 根据itemIds拆分,循环查询项目详情
         const itemIds = data.itemIds.split(',').map(Number)
-        selectedItems.value = itemIds.map(id => ({ id }))
+        const itemDetails = await Promise.all(
+          itemIds.map(async (itemId) => {
+            try {
+              return await ServiceItemApi.getServiceItem(itemId)
+            } catch (error) {
+              console.error(`获取项目${itemId}详情失败`, error)
+              return null
+            }
+          })
+        )
+        // 过滤掉获取失败的项目,并映射字段
+        selectedItems.value = itemDetails
+          .filter(item => item !== null)
+          .map(item => ({
+            id: item.id,
+            itemName: item.itemName,
+            amount: item.amount,
+
+          }))
       }
       if (data.detail) {
         comboDetailImages.value = data.detail.split(',')

+ 33 - 39
src/views/living-home/serviceItemManage/serviceCombo/index.vue

@@ -1,7 +1,8 @@
 <script lang="ts" setup>
 import addComboForm from './addComboForm.vue'
 import * as ServiceComboApi from '@/api/living-home/elderly'
-
+import {useUserStore} from "@/store/modules/user";
+const userStore = useUserStore()
 defineOptions({ name: 'ServiceCombo' })
 
 const message = useMessage()
@@ -15,29 +16,20 @@ const queryParams = reactive({
   pageNo: 1,
   pageSize: 10,
   serviceTypeId: undefined as number | undefined,
-  comboName: '',
+  packageName: '',
+  tenantIds: userStore.orgTenantId
 })
 const queryFormRef = ref()
 
-/** 测试数据 - 服务类别 */
-const mockServiceTypes = [
-  { id: 1, name: '生活照料' },
-  { id: 2, name: '医疗护理' },
-  { id: 3, name: '康复保健' },
-  { id: 4, name: '精神慰藉' },
-  { id: 5, name: '文化娱乐' }
-]
-
 
 
 /** 获取服务类别列表 */
 const getServiceTypeList = async () => {
   try {
     const data = await ServiceComboApi.getServiceTypeList()
-    serviceTypeList.value = data || []
+    serviceTypeList.value = data.list || []
   } catch (error) {
     console.log('获取服务类别失败,使用测试数据')
-    serviceTypeList.value = mockServiceTypes
   }
 }
 
@@ -55,6 +47,14 @@ const getList = async () => {
   }
 }
 
+
+/** 根据categoryId获取服务类别名称 */
+const getServiceTypeName = (categoryId: number | undefined) => {
+  if (!categoryId) return '-'
+  const type = serviceTypeList.value.find(item => item.id === categoryId)
+  return type?.name || '-'
+}
+
 /** 搜索按钮操作 */
 const handleQuery = () => {
   queryParams.pageNo = 1
@@ -84,14 +84,14 @@ const handleDetail = (row: ServiceComboApi.ServiceComboVO) => {
 }
 
 /** 批量删除 */
-const handleBatchDelete = async () => {
-  if (!selectedIds.value.length) {
-    message.warning('请选择要删除的数据')
-    return
-  }
+const handleBatchDelete = async (id) => {
+  // if (!selectedIds.value.length) {
+  //   message.warning('请选择要删除的数据')
+  //   return
+  // }
   try {
     await message.delConfirm()
-    await ServiceComboApi.deleteServiceCombo(selectedIds.value)
+    await ServiceComboApi.deleteServiceCombo(id)
     message.success(t('common.delSuccess'))
     getList()
   } catch {}
@@ -107,21 +107,9 @@ const handleShelf = async (row: ServiceComboApi.ServiceComboVO, action: 'up' | '
   } catch {}
 }
 
-/** 上移 */
-const handleMoveUp = async (index: number) => {
-  if (index === 0) return
-  const temp = list.value[index]
-  list.value[index] = list.value[index - 1]
-  list.value[index - 1] = temp
-}
 
-/** 下移 */
-const handleMoveDown = async (index: number) => {
-  if (index === list.value.length - 1) return
-  const temp = list.value[index]
-  list.value[index] = list.value[index + 1]
-  list.value[index + 1] = temp
-}
+
+
 
 /** 初始化 */
 onMounted(() => {
@@ -157,7 +145,7 @@ onMounted(() => {
       </el-form-item>
       <el-form-item label="套餐名称:" prop="comboName">
         <el-input
-          v-model="queryParams.comboName"
+          v-model="queryParams.packageName"
           placeholder="请输入"
           clearable
           @keyup.enter="handleQuery"
@@ -183,9 +171,9 @@ onMounted(() => {
         <el-button type="primary" @click="openForm('create')">
           <Icon icon="ep:plus" class="mr-5px" /> 新增
         </el-button>
-        <el-button type="danger" plain @click="handleBatchDelete" :disabled="!selectedIds.length">
-          <Icon icon="ep:delete" class="mr-5px" /> 删除
-        </el-button>
+<!--        <el-button type="danger" plain @click="handleBatchDelete" :disabled="!selectedIds.length">-->
+<!--          <Icon icon="ep:delete" class="mr-5px" /> 删除-->
+<!--        </el-button>-->
       </div>
     </div>
     <el-table
@@ -197,7 +185,11 @@ onMounted(() => {
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="序号" type="index" width="80" align="center" />
       <el-table-column prop="comboName" label="套餐名称" align="center" min-width="120" />
-      <el-table-column prop="serviceTypeName" label="服务类别" align="center" min-width="100" />
+      <el-table-column prop="serviceTypeName" label="服务类别" align="center" min-width="100" >
+        <template #default="scope">
+          {{ getServiceTypeName(scope.row.categoryId) }}
+        </template>
+      </el-table-column>
       <el-table-column label="服务图标" align="center" width="100">
         <template #default="scope">
           <el-image
@@ -243,7 +235,9 @@ onMounted(() => {
           <el-button link type="warning" @click="handleShelf(scope.row, 'down')" v-if="scope.row.isShelf === '是'">
             <Icon icon="ep:bottom" class="mr-5px" /> 下架
           </el-button>
-
+          <el-button link type="danger" @click="handleBatchDelete(scope.row.id)">
+            <Icon icon="ep:bottom" class="mr-5px" /> 删除
+          </el-button>
         </template>
       </el-table-column>
     </el-table>

+ 10 - 2
src/views/living-home/serviceItemManage/serviceItem/addItemForm.vue

@@ -288,8 +288,16 @@ const formRef = ref()
 
 /** 获取服务类别列表 */
 const getServiceTypeList = async () => {
-  const data = await ServiceItemApi.getServiceTypeList()
-  serviceTypeList.value = data || []
+  const queryParams = {
+    pageNo: 1,
+    pageSize: 100,
+    name:''
+  }
+  try {
+    const data = await ServiceItemApi.getServiceTypeList(queryParams)
+    serviceTypeList.value = data.list || []
+  }catch (_){}
+
 }
 
 /** 提成方式变化 */

+ 39 - 175
src/views/living-home/serviceItemManage/serviceItem/index.vue

@@ -23,9 +23,9 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="服务名称:" prop="serviceName">
+      <el-form-item label="服务名称:" prop="itemName">
         <el-input
-          v-model="queryParams.serviceName"
+          v-model="queryParams.itemName"
           placeholder="请输入"
           clearable
           @keyup.enter="handleQuery"
@@ -76,14 +76,18 @@
     >
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="序号" type="index" width="80" align="center" />
-      <el-table-column prop="serviceName" label="服务名称" align="center" min-width="120" />
-      <el-table-column prop="serviceTypeName" label="服务类别" align="center" min-width="100" />
+      <el-table-column prop="itemName" label="服务名称" align="center" min-width="120" />
+      <el-table-column prop="categoryId" label="服务类别" align="center" min-width="100">
+        <template #default="scope">
+          {{ getServiceTypeName(scope.row.categoryId) }}
+        </template>
+      </el-table-column>
       <el-table-column label="服务图标" align="center" width="100">
         <template #default="scope">
           <el-image
-            v-if="scope.row.serviceImage"
-            :src="scope.row.serviceImage"
-            :preview-src-list="[scope.row.serviceImage]"
+            v-if="scope.row.icon"
+            :src="scope.row.icon"
+            :preview-src-list="[scope.row.icon]"
             style="width: 50px; height: 50px"
             fit="cover"
             preview-teleported
@@ -91,21 +95,25 @@
           <span v-else>/</span>
         </template>
       </el-table-column>
-      <el-table-column prop="servicePrice" label="金额(元)" align="center" width="100" />
+      <el-table-column prop="amount" label="金额(元)" align="center" width="100" >
+        <template #default="scope">
+          {{ parseFloat(scope.row.amount||"0").toFixed(2) }}
+        </template>
+      </el-table-column>
       <el-table-column prop="billingMethod" label="计费方式" align="center" width="100">
         <template #default="scope">
-          {{ scope.row.billingMethod }}
+          {{ scope.row.costType==1?"按时":"按次" }}
         </template>
       </el-table-column>
-      <el-table-column prop="servicePoints" label="服务积分" align="center" width="90" />
-      <el-table-column prop="deductElderFee" label="是否扣取长者费用" align="center" width="150">
+      <el-table-column prop="point" label="服务积分" align="center" width="90" />
+      <el-table-column prop="isDeductElderFee" label="是否扣取长者费用" align="center" width="150">
         <template #default="scope">
-          {{ scope.row.deductElderFee }}
+          <el-tag>{{ scope.row.isDeductElderFee==1?"是":"否" }}</el-tag>
         </template>
       </el-table-column>
       <el-table-column prop="volunteerDeductFee" label="志愿者服务是否扣费" align="center" width="160">
         <template #default="scope">
-          {{ scope.row.volunteerDeductFee }}
+          <el-tag>{{ scope.row.isDeductVolunteerFee==1?"是":"否" }}</el-tag>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" width="280" fixed="right">
@@ -135,7 +143,8 @@
 <script lang="ts" setup>
 import addItemForm from './addItemForm.vue'
 import * as ServiceItemApi from '@/api/living-home/elderly'
-
+import {useUserStore} from "@/store/modules/user";
+const userStore = useUserStore()
 defineOptions({ name: 'ServiceItem' })
 
 const message = useMessage()
@@ -149,167 +158,25 @@ const queryParams = reactive({
   pageNo: 1,
   pageSize: 10,
   serviceTypeId: undefined as number | undefined,
-  serviceName: '',
+  itemName: '',
+  tenantIds: userStore.orgTenantId
 })
 const queryFormRef = ref()
 
-/** 测试数据 - 服务类别 */
-const mockServiceTypes = [
-  { id: 1, name: '生活照料' },
-  { id: 2, name: '医疗护理' },
-  { id: 3, name: '康复保健' },
-  { id: 4, name: '精神慰藉' },
-  { id: 5, name: '文化娱乐' }
-]
 
-/** 测试数据 - 服务项目列表 */
-const mockServiceItems = [
-  {
-    id: 1,
-    serviceName: '居家清洁服务',
-    serviceTypeName: '生活照料',
-    serviceTypeId: 1,
-    serviceImage: '',
-    servicePrice: 80.00,
-    billingMethod: '按次',
-    servicePoints: 8,
-    deductElderFee: '是',
-    volunteerDeductFee: '否',
-    isShelf: '是',
-    staffCommissionType: '按单',
-    staffCommissionValue: 15,
-    needVisit: '是',
-    checkMedicationTaboo: '否'
-  },
-  {
-    id: 2,
-    serviceName: '助餐送餐服务',
-    serviceTypeName: '生活照料',
-    serviceTypeId: 1,
-    serviceImage: '',
-    servicePrice: 25.00,
-    billingMethod: '按次',
-    servicePoints: 5,
-    deductElderFee: '是',
-    volunteerDeductFee: '否',
-    isShelf: '是',
-    staffCommissionType: '按比例',
-    staffCommissionValue: 10,
-    needVisit: '否',
-    checkMedicationTaboo: '否'
-  },
-  {
-    id: 3,
-    serviceName: '陪同就医服务',
-    serviceTypeName: '医疗护理',
-    serviceTypeId: 2,
-    serviceImage: '',
-    servicePrice: 120.00,
-    billingMethod: '按时',
-    servicePoints: 15,
-    deductElderFee: '是',
-    volunteerDeductFee: '否',
-    isShelf: '是',
-    staffCommissionType: '按单',
-    staffCommissionValue: 30,
-    needVisit: '是',
-    checkMedicationTaboo: '是'
-  },
-  {
-    id: 4,
-    serviceName: '健康体检服务',
-    serviceTypeName: '医疗护理',
-    serviceTypeId: 2,
-    serviceImage: '',
-    servicePrice: 200.00,
-    billingMethod: '按次',
-    servicePoints: 20,
-    deductElderFee: '是',
-    volunteerDeductFee: '否',
-    isShelf: '否',
-    staffCommissionType: '按比例',
-    staffCommissionValue: 8,
-    needVisit: '是',
-    checkMedicationTaboo: '是'
-  },
-  {
-    id: 5,
-    serviceName: '康复训练指导',
-    serviceTypeName: '康复保健',
-    serviceTypeId: 3,
-    serviceImage: '',
-    servicePrice: 150.00,
-    billingMethod: '按时',
-    servicePoints: 18,
-    deductElderFee: '是',
-    volunteerDeductFee: '否',
-    isShelf: '是',
-    staffCommissionType: '按单',
-    staffCommissionValue: 40,
-    needVisit: '是',
-    checkMedicationTaboo: '是'
-  },
-  {
-    id: 6,
-    serviceName: '心理疏导服务',
-    serviceTypeName: '精神慰藉',
-    serviceTypeId: 4,
-    serviceImage: '',
-    servicePrice: 100.00,
-    billingMethod: '按时',
-    servicePoints: 12,
-    deductElderFee: '是',
-    volunteerDeductFee: '否',
-    isShelf: '是',
-    staffCommissionType: '按比例',
-    staffCommissionValue: 15,
-    needVisit: '是',
-    checkMedicationTaboo: '否'
-  },
-  {
-    id: 7,
-    serviceName: '书法绘画培训',
-    serviceTypeName: '文化娱乐',
-    serviceTypeId: 5,
-    serviceImage: '',
-    servicePrice: 60.00,
-    billingMethod: '按次',
-    servicePoints: 6,
-    deductElderFee: '是',
-    volunteerDeductFee: '是',
-    isShelf: '否',
-    staffCommissionType: '按单',
-    staffCommissionValue: 10,
-    needVisit: '否',
-    checkMedicationTaboo: '否'
-  },
-  {
-    id: 8,
-    serviceName: '个人卫生护理',
-    serviceTypeName: '生活照料',
-    serviceTypeId: 1,
-    serviceImage: '',
-    servicePrice: 50.00,
-    billingMethod: '按次',
-    servicePoints: 5,
-    deductElderFee: '是',
-    volunteerDeductFee: '否',
-    isShelf: '是',
-    staffCommissionType: '按单',
-    staffCommissionValue: 12,
-    needVisit: '否',
-    checkMedicationTaboo: '否'
-  }
-]
 
 /** 获取服务类别列表 */
 const getServiceTypeList = async () => {
   try {
-    const data = await ServiceItemApi.getServiceTypeList()
-    serviceTypeList.value = data || []
+    const queryParams = {
+      pageNo: 1,
+      pageSize: 100,
+      name:''
+    }
+    const data = await ServiceItemApi.getServiceTypeList(queryParams)
+    serviceTypeList.value = data.list || []
   } catch (error) {
     console.log('获取服务类别失败,使用测试数据')
-    serviceTypeList.value = mockServiceTypes
   }
 }
 
@@ -321,21 +188,18 @@ const getList = async () => {
     list.value = data.list || data || []
   } catch (error) {
     console.log('获取服务项目列表失败,使用测试数据')
-    let filteredData = [...mockServiceItems]
-    if (queryParams.serviceTypeId) {
-      filteredData = filteredData.filter(item => item.serviceTypeId === queryParams.serviceTypeId)
-    }
-    if (queryParams.serviceName) {
-      filteredData = filteredData.filter(item => 
-        item.serviceName.includes(queryParams.serviceName)
-      )
-    }
-    list.value = filteredData
   } finally {
     loading.value = false
   }
 }
 
+/** 根据categoryId获取服务类别名称 */
+const getServiceTypeName = (categoryId: number | undefined) => {
+  if (!categoryId) return '-'
+  const type = serviceTypeList.value.find(item => item.id === categoryId)
+  return type?.name || '-'
+}
+
 /** 搜索按钮操作 */
 const handleQuery = () => {
   queryParams.pageNo = 1

+ 17 - 13
src/views/living-home/serviceItemManage/serviceType/index.vue

@@ -36,9 +36,9 @@
         <el-button type="primary" @click="openForm('create')">
           <Icon icon="ep:plus" class="mr-5px" /> 新增
         </el-button>
-        <el-button type="danger" plain @click="handleBatchDelete" :disabled="!selectedIds.length">
-          <Icon icon="ep:delete" class="mr-5px" /> 删除
-        </el-button>
+<!--        <el-button type="danger" plain @click="handleBatchDelete" :disabled="!selectedIds.length">-->
+<!--          <Icon icon="ep:delete" class="mr-5px" /> 删除-->
+<!--        </el-button>-->
       </div>
     </div>
     <el-table
@@ -56,7 +56,9 @@
           <el-button link type="primary" @click="openForm('update', scope.row.id)">
             <Icon icon="ep:edit" class="mr-5px" /> 编辑
           </el-button>
-
+          <el-button link type="danger" @click="handleBatchDelete(scope.row.id)">
+            <Icon icon="ep:edit" class="mr-5px" /> 删除
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -69,7 +71,8 @@
 <script lang="ts" setup>
 import ServiceTypeForm from './ServiceTypeForm.vue'
 import * as ServiceTypeApi from '@/api/living-home/elderly'
-
+import {useUserStore} from "@/store/modules/user";
+const userStore = useUserStore()
 defineOptions({ name: 'ServiceType' })
 
 const message = useMessage()
@@ -82,6 +85,7 @@ const queryParams = reactive({
   pageNo: 1,
   pageSize: 100,
   name: '',
+  tenantIds: userStore.orgTenantId
 })
 const queryFormRef = ref()
 
@@ -98,8 +102,8 @@ const getList = async () => {
   loading.value = true
   try {
     const data = await ServiceTypeApi.getServiceTypeList(queryParams)
-    list.value = data
-  } finally {
+    list.value = data.list??[]
+  }catch (_){} finally {
     loading.value = false
   }
 }
@@ -127,14 +131,14 @@ const openForm = (type: string, id?: number) => {
 }
 
 /** 批量删除 */
-const handleBatchDelete = async () => {
-  if (!selectedIds.value.length) {
-    message.warning('请选择要删除的数据')
-    return
-  }
+const handleBatchDelete = async (id) => {
+  // if (!selectedIds.value.length) {
+  //   message.warning('请选择要删除的数据')
+  //   return
+  // }
   try {
     await message.delConfirm()
-    await ServiceTypeApi.deleteServiceType(selectedIds.value)
+    await ServiceTypeApi.deleteServiceType(id)
     message.success(t('common.delSuccess'))
     getList()
   } catch {}

+ 6 - 4
src/views/living-home/serviceTeam/districtManagement/ServiceAreaForm.vue

@@ -75,6 +75,11 @@ const open = async (type: string, id?: number) => {
   formType.value = type
   resetForm()
   // 修改时,设置数据
+    // 加载区域数据
+  if (areaTree.value.length === 0) {
+    areaTree.value = await AreaApi.getAreaTree()
+  }
+  
   if (id) {
     formLoading.value = true
     try {
@@ -100,10 +105,7 @@ const open = async (type: string, id?: number) => {
     }
   }
 
-  // 加载区域数据
-  if (areaTree.value.length === 0) {
-    areaTree.value = await AreaApi.getAreaTree()
-  }
+
 
 }
 defineExpose({ open }) // 提供 open 方法,用于打开弹窗

+ 2 - 2
src/views/living-home/serviceTeam/serviceDepartment/index.vue

@@ -121,7 +121,7 @@ const getList = async () => {
   loading.value = true
   try {
     const data = await DeptApi.getServiceDeptList(queryParams)
-    list.value = handleTree(data)
+    list.value = data.list
   } finally {
     loading.value = false
   }
@@ -173,6 +173,6 @@ const handleDelete = async (id: number) => {
 onMounted(async () => {
   await getList()
   // 获取用户列表
-  //userList.value = await UserApi.getSimpleUserList()
+  userList.value = await UserApi.getSimpleUserList()
 })
 </script>

+ 12 - 7
src/views/living-home/serviceTeam/servicePersonnelManage/RelateElderDialog.vue

@@ -3,7 +3,7 @@
     <!-- 搜索栏 -->
     <el-form :model="queryParams" ref="queryFormRef" :inline="true" class="mb-4">
       <el-form-item label="长者姓名:">
-        <el-input v-model="queryParams.name" placeholder="请输入" clearable style="width: 20vw"/>
+        <el-input v-model="queryParams.elderName" placeholder="请输入" clearable style="width: 20vw"/>
       </el-form-item>
       <el-form-item label="关联状态:">
         <el-select v-model="queryParams.relationStatus" placeholder="请选择" clearable style="width: 20vw">
@@ -43,11 +43,15 @@
     >
       <el-table-column type="selection" width="55" />
       <el-table-column type="index" label="序号" width="80" />
-      <el-table-column prop="name" label="长者姓名" />
-      <el-table-column prop="gender" label="性别" width="80" />
+      <el-table-column prop="elderName" label="长者姓名" />
+      <el-table-column prop="sex" label="性别" width="80" >
+        <template #default="scope">
+          {{scope.row.sex=="1"?"男":"女"}}
+        </template>
+      </el-table-column>
       <el-table-column prop="age" label="年龄" width="80" />
       <el-table-column prop="phone" label="联系方式" />
-      <el-table-column prop="address" label="居住地址" />
+      <el-table-column prop="currentLiveAddress" label="居住地址" show-overflow-tooltip/>
       <el-table-column label="操作" align="center" width="120">
         <template #default="scope">
           <el-button link type="primary" @click="handleRelate(scope.row)">
@@ -76,6 +80,7 @@
 import * as ElderApi from '@/api/living-home/elderly'
 import * as AreaApi from '@/api/system/area'
 import { defaultProps, handleTree } from '@/utils/tree'
+import {getHomeElderlyList} from "@/api/living-home/elderly";
 
 defineOptions({ name: 'RelateElderDialog' })
 
@@ -102,10 +107,10 @@ const servicePersonId = ref<number>() // 当前服务人员ID
 const queryParams = reactive({
   pageNo: 1,
   pageSize: 20,
-  name: '',
+  elderName: '',
   relationStatus: '',
   areaCode: [],
-  address: ''
+  currentLiveAddress: ''
 })
 
 const queryFormRef = ref()
@@ -138,7 +143,7 @@ const getList = async () => {
       ...queryParams,
       servicePersonId: servicePersonId.value
     }
-    const data = await ElderApi.getElderList(params)
+    const data = await ElderApi.getHomeElderlyList(params)
     list.value = data.list || []
     total.value = data.total || 0
   } finally {

+ 12 - 6
src/views/living-home/serviceTeam/servicePersonnelManage/ServicePersonForm.vue

@@ -153,11 +153,12 @@
 <script lang="ts" setup>
 import * as ServicePersonApi from '@/api/living-home/elderly'
 import * as AreaApi from '@/api/system/area'
-import * as DeptApi from '@/api/system/dept'
+import * as DeptApi from '@/api/system/user'
 import { defaultProps, handleTree } from '@/utils/tree'
 import { UploadImg } from '@/components/UploadFile'
 import { FormRules } from 'element-plus'
-
+import {useUserStore} from "@/store/modules/user";
+const userStore = useUserStore()
 defineOptions({ name: 'ServicePersonForm' })
 
 const { t } = useI18n() // 国际化
@@ -190,9 +191,9 @@ const formRules = reactive<FormRules>({
   name: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
   idCard: [{ required: true, message: '身份证号不能为空', trigger: 'blur' }],
   gender: [{ required: true, message: '性别不能为空', trigger: 'change' }],
-  age: [{ required: true, message: '年龄不能为空', trigger: 'blur' }],
+  //age: [{ required: true, message: '年龄不能为空', trigger: 'blur' }],
   phone: [{ required: true, message: '手机号码不能为空', trigger: 'blur' }],
-  personType: [{ required: true, message: '人员类型不能为空', trigger: 'change' }],
+  // personType: [{ required: true, message: '人员类型不能为空', trigger: 'change' }],
   serviceAreaId: [{ required: true, message: '服务区域不能为空', trigger: 'change' }]
 })
 
@@ -319,8 +320,13 @@ const loadServiceAreaList = async () => {
 /** 加载部门列表 */
 const loadDeptList = async () => {
   try {
-    const data = await DeptApi.getSimpleDeptList()
-    deptList.value = handleTree(data)
+    const queryParams = {
+      pageNo: 1,
+      pageSize: 100,
+      tenantIds: userStore.orgTenantId
+    }
+    const data = await DeptApi.getServiceDeptList(queryParams)
+    deptList.value = data.list
   } catch (error) {
     console.error('加载部门列表失败:', error)
   }

+ 15 - 12
src/views/living-home/serviceTeam/servicePersonnelManage/index.vue

@@ -67,9 +67,9 @@
         <el-button type="primary" @click="openForm('create')">
           <Icon icon="ep:plus" class="mr-5px" /> 新增
         </el-button>
-        <el-button type="danger" @click="handleBatchDelete" :disabled="!selectedIds.length">
-          <Icon icon="ep:delete" class="mr-5px" /> 删除
-        </el-button>
+<!--        <el-button type="danger" @click="handleBatchDelete" :disabled="!selectedIds.length">-->
+<!--          <Icon icon="ep:delete" class="mr-5px" /> 删除-->
+<!--        </el-button>-->
         <el-button type="primary" plain @click="handleExport">
           <Icon icon="ep:download" class="mr-5px" /> 导出
         </el-button>
@@ -96,7 +96,7 @@
       <el-table-column prop="elderCount" label="关联长者" width="100" />
       <el-table-column prop="serviceArea" label="服务区域" show-overflow-tooltip/>
       <el-table-column prop="organization" label="所属组织" show-overflow-tooltip/>
-      <el-table-column label="操作" align="center" width="350">
+      <el-table-column label="操作" align="center" width="450">
         <template #default="scope">
           <el-button link type="primary" @click="handleDetail(scope.row)">
             <Icon icon="ep:view" class="mr-5px" /> 详情
@@ -107,9 +107,12 @@
           <el-button link type="primary" @click="handleRelateElder(scope.row)">
             <Icon icon="ep:connection" class="mr-5px" /> 关联长者设置
           </el-button>
-          <el-button link type="danger" @click="handleResign(scope.row)">
+          <el-button link type="warning" @click="handleResign(scope.row)">
             <Icon icon="ep:close" class="mr-5px" /> 离职
           </el-button>
+          <el-button link type="danger" @click="handleBatchDelete(scope.row.id)">
+            <Icon icon="ep:close" class="mr-5px" /> 删除
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -178,7 +181,7 @@ const getList = async () => {
     // 先尝试从接口获取数据
     const data = await ServicePersonApi.getServicePersonList(queryParams)
     // 如果接口返回数据为空,则使用默认数据
-    let result = data && data.length > 0 ? data : []
+    let result = data && data.list.length > 0 ? data : []
     list.value = result.list
   } catch (error) {
     // 接口调用失败时,使用默认数据并筛选
@@ -216,14 +219,14 @@ const openForm = (type: string, id?: number) => {
 }
 
 /** 批量删除按钮操作 */
-const handleBatchDelete = async () => {
-  if (selectedIds.value.length === 0) {
-    message.warning('请选择要删除的数据')
-    return
-  }
+const handleBatchDelete = async (id) => {
+  // if (selectedIds.value.length === 0) {
+  //   message.warning('请选择要删除的数据')
+  //   return
+  // }
   try {
     await message.delConfirm()
-    await ServicePersonApi.deleteServicePerson(selectedIds.value)
+    await ServicePersonApi.deleteServicePerson(id)
     message.success(t('common.delSuccess'))
     await getList()
   } catch {}