Explorar o código

优化中医调养第一版

张田田 hai 10 meses
pai
achega
d3d587e839

+ 4 - 4
src/libs/vxe/plugin.ts

@@ -69,10 +69,10 @@ function LazyVxeUIForForm(app: App) {
   app.use(VxeModal);
   app.use(VxeDrawer);
   app.use(VxeTooltip);
-  app.use(VxeTable);
-  app.use(VxeColumn);
-  app.use(VxeGrid);
-  app.use(VxeToolbar);
+  // app.use(VxeTable);
+  // app.use(VxeColumn);
+  // app.use(VxeGrid);
+  // app.use(VxeToolbar);
 }
 
 function LazyVxeUIForTable(app: App) {

+ 11 - 10
src/model/care.model.ts

@@ -47,15 +47,15 @@ export interface SystemItemModel {
     dosage: string; // 剂量
   }[];
   effect: string; // 功效
-  isOnline: string; // 是否线上
-  isDelivery: string; // 是否配送
+  isOffline?: string | null; // 是否线下
+  isDelivery?: string | null; // 是否配送
   photo: string; // 图片
 }
 
 export type SystemIteQuery = Partial<SystemItemModel>;
 
 export interface SystemCwModel {
-  type?: string; // system 系统调理包 institution 机构调理包
+  types?: string; // system 系统调理包 institution 机构调理包
   id?: string; // 系统调理包ID
   name?: string; // 系统调理包名称
   institutionName?: string; // 所属机构名称
@@ -141,8 +141,8 @@ export interface SystemCwModel {
           dosage: string; // 剂量
       }[];
       effect: string; // 功效
-      isOnline: string; // 是否线上
-      isDelivery: string; // 是否配送
+      isOffline?: string | null; // 是否线下
+      isDelivery?: string | null; // 是否配送
       photo: string; // 图片
       conditioningProgramSupplierName: string; // 供应商名称
       institutionId: string; // 所属机构ID
@@ -167,7 +167,7 @@ export interface SystemCwModel {
       photo?: string;
     }[]; // 穴位
     days: string; // 周期
-    frequencyType: string; // 多少天
+    frequencyType: string | string[]; // 多少天
     frequencyMeasure: string; // 频次用量
     totalPrice: string; //总价格
     initialDay: string; // 初始天数
@@ -227,7 +227,7 @@ export interface OpenConditioningSchemeModel {
   conditioningWrapId: string; // 调理包ID
   conditioningWrapName: string; // 调理包名称
   photo: string; // 调理包照片	
-  isDelivery: string; // 是否配送 Y N
+  isDelivery?: string | null; // 是否配送 Y N
   estimatedStartDate: string; // 调养日期
   estimatedEndDate: string; // 调养结束日期
   cost: number; // 费用
@@ -286,8 +286,8 @@ export interface OpenConditioningSchemeModel {
         },
       ];
       effect: string; // 功效
-      isOnline: string; // 是否线上
-      isDelivery: string; // 是否配送
+      isOffline?: string | null; // 是否线下
+      isDelivery?: string | null; // 是否配送
       photo: string; // 图片
       conditioningProgramSupplierName: string; // 供应商名称
       institutionId: string; // 所属机构ID
@@ -312,7 +312,8 @@ export interface OpenConditioningSchemeModel {
       photo?: string;
     }[]; // 穴位
     days: string; // 周期
-    frequencyType: string; // 多少天
+    frequencyType: string | string[]; // 多少天
+    frequencyTypeing: string[]; // 多少天
     frequencyMeasure: string; // 频次用量
     totalPrice: string; //总价格
     initialDay: string; // 初始天数

+ 2 - 2
src/pages/index/care/conditioningRecord.vue

@@ -176,7 +176,7 @@ function conditioningProcess(model?: ConditioningRecordListModel, index?: number
 }
 
 function serviceDetail(model?: ConditioningRecordListModel, index?: number) {
-  const type='record'
+  const types='record'
     VxeUI.modal.open({
     id: 'servicePackageDetail-modal',
     title: '系统服务',
@@ -192,7 +192,7 @@ function serviceDetail(model?: ConditioningRecordListModel, index?: number) {
         return h(ServicePackageDetail, <any>{
           data: {
             ...model,
-            type
+            types
           },
         });
       },

+ 2 - 2
src/pages/index/care/institutionService.vue

@@ -164,7 +164,7 @@ onMounted(() => {
 });
 
 function seeInstitutionDetail(model: SystemCwModel, index: number) {
-  const type = 'institution';
+  const types = 'institution';
   VxeUI.modal.open({
     title: model?.id ? `机构服务详情` : `新增机构服务`,
     height: 700,
@@ -177,7 +177,7 @@ function seeInstitutionDetail(model: SystemCwModel, index: number) {
     slots: {
       default() {
         return h(ServicePackageDetail, <any>{
-          data: { ...model, type },
+          data: { ...model, types },
           onSubmit(data: SystemCwModel) {
             refresh(page.value);
             VxeUI.modal.close(`servicePackageDetail-modal`);

+ 11 - 11
src/pages/index/care/issueService.vue

@@ -41,7 +41,7 @@ const form = reactive<FollowModel>({
   conditioningWrapName: '',
   estimatedStartDate: '',
   estimatedEndDate: '',
-  isDelivery: '',
+  isDelivery: null,
   cost: 0,
   healthAnalysisReport: {
     willillStateName: '',
@@ -216,7 +216,7 @@ async function selectPatient(item: any) {
 
 // 打开调养记录
 function openRecord(item: any) {
-  const type = 'record';
+  const types = 'record';
   VxeUI.modal.open({
     id: 'servicePackageDetail-modal',
     title: '调养记录',
@@ -227,7 +227,7 @@ function openRecord(item: any) {
     slots: {
       default() {
         return h(ServicePackageDetail, <any>{
-          data: { ...item, type },
+          data: { ...item, types },
         });
       },
     },
@@ -289,8 +289,8 @@ const emptyRow = {
     cpDynamicPricingRule: [],
     cpMedicines: [],
     effect: '',
-    isOnline: '',
-    isDelivery: '',
+    isOffline: null,
+    isDelivery: null,
     photo: '',
     institutionId: '',
     institutionName: '',
@@ -374,8 +374,8 @@ function onSelectProject({ row }: any) {
       },
       cpDynamicPricingRule: row?.cpDynamicPricingRule || [],
       cpMedicines: row?.cpMedicines || [],
-      isOnline: row?.isOnline || '',
-      isDelivery: row?.isDelivery || '',
+      isOffline: row?.isOffline || null,
+      isDelivery: row?.isDelivery || null,
       photo: row?.photo || '',
       conditioningProgramSupplierName: row?.conditioningProgramSupplierName || '',
     },
@@ -524,7 +524,7 @@ watch(totalPrice, (val) => {
 async function selectCw(item: any) {
   currentSelectedPackage.value = item;
   selectedPackage.value = item.id;
-  item.type = 'institution';
+  item.types = 'institution';
   const res: any = await getConditioningRecordDetailMethod(item);
 
   Object.assign(formData, res);
@@ -882,10 +882,10 @@ watch(showProjectPopover, (val) => {
                 </div>
               </template>
             </vxe-column>
-            <vxe-column field="conditioningProgramDetail.isOnline" title="线上项目" width="100">
+            <vxe-column field="conditioningProgramDetail.isOffline" title="线下项目" width="100">
               <template #default="{ row }">
-                <span v-if="row.conditioningProgramDetail">
-                  {{ row.conditioningProgramDetail.isOnline === 'Y' ? '是' : '否' }}
+                <span v-if="row.conditioningProgramDetail?.isOffline">
+                  {{ row.conditioningProgramDetail.isOffline === 'Y' ? '是' : '否' }}
                 </span>
                 <span v-else>-</span>
               </template>

+ 2 - 2
src/pages/index/care/systemService.vue

@@ -169,7 +169,7 @@ function deleteSystemService(model: SystemCwModel, index: number) {
 }
 
 function seeInstitution(model?: SystemCwModel, index?: number) {
-  const type = 'institution';
+  const types = 'institution';
   VxeUI.modal.open({
     id: 'servicePackageDetail-modal',
     title: '系统服务',
@@ -180,7 +180,7 @@ function seeInstitution(model?: SystemCwModel, index?: number) {
     slots: {
       default() {
         return h(ServicePackageDetail, <any>{
-          data: { ...model, type },
+          data: { ...model, types },
         });
       },
     },

+ 2 - 2
src/request/api/care.api.ts

@@ -277,13 +277,13 @@ export function addConditioningSchemeMethod(data: Partial<OpenConditioningScheme
 // 根据调理包id获取调理包详情
 export function getConditioningRecordDetailMethod(data: Partial<SystemCwModel>) {
   console.log('获取调理包详情',data);
-  if(data.type === 'institution'){
+  if(data.types === 'institution'){
     // 机构调理包详情
     return request.Post(`/fdhb-pc/conditioningManage/wrap/getCwDetailById/${data.id}`, {
       name: 'get-conditioning-record-detail',
       cacheFor: null,
     });
-  }else if(data.type === 'record'){
+  }else if(data.types === 'record'){
     return request.Post(`/fdhb-pc/patientCrManage/getPcrDetailById/${data.id}`, {
       name: 'get-conditioning-record-detail',
       cacheFor: null,

+ 28 - 38
src/service/AddItems.vue

@@ -1,6 +1,7 @@
 <script lang="ts" setup>
 import { ref, watch } from 'vue';
 import { Form, message } from 'ant-design-vue';
+import { PlusOutlined } from '@ant-design/icons-vue'; // 确保导入
 import VxeUI from 'vxe-table';
 import { useRequest } from 'alova/client';
 import { getDictionaryMethod, cpMedicinesMethod } from '@/request/api/dictionary.api';
@@ -12,7 +13,7 @@ import RemoteSelect from '@/libs/v-select-page/RemoteSelect.vue';
 import type { UploadFile } from 'ant-design-vue/es/upload/interface';
 import type { FormInstance } from 'ant-design-vue';
 type SystemModel = Partial<SystemItemModel>;
-const props = defineProps<{ data: SystemModel; title: string }>();
+const props = defineProps<{ data: SystemModel;}>();
 const formRef = ref<FormInstance>();
 const typeOptions = ref<{ label: string; value: string }[]>([]);
 
@@ -52,8 +53,8 @@ const form = reactive<SystemModel>({
     convertUnit: '',
   },
   cpMedicines: [{ name: '', dosage: '', id: '' }],
-  isOnline: '',
-  isDelivery: '',
+  isOffline: null,
+  isDelivery: null,
 });
 const onlineArr = ref<string[]>([]);
 const deliverArr = ref<string[]>([]);
@@ -63,25 +64,14 @@ const rules = {
   pricingType: [{ required: true, message: '请选择计价规则', trigger: 'change' }],
   conditioningProgramSupplierId: [{ required: true, message: '请选择供应商', trigger: 'change' }],
   institutionId: [{ required: true, message: '请选择机构名称', trigger: 'change' }],
-  isOnline: [{ required: true, message: '请选择线上项目', trigger: 'change' }],
+  isOffline: [{ required: true, message: '请选择线下项目', trigger: 'change' }],
 };
 const isShowOnline = ref<boolean>(false);
 const isShowDelivery = ref<boolean>(false);
 const supplierArr = ref<any[]>([]);
-function getIsDelivery(newVal: any) {
-  // if (newVal) {
-  //     deliverArr.value = [newVal];
-  //     if (newVal === 'Y') {
-  //       isShowDelivery.value = true;
-  //     } else {
-  //       isShowDelivery.value = false;
-  //     }
-  //   }
-}
 
 // 获取所有的供应商
 async function getSupplier(params: any) {
-  console.log(params, 'params==>');
   const res = await getAllSupplierMethod(params);
   if (res && res.length > 0) {
     supplierArr.value = res;
@@ -89,38 +79,38 @@ async function getSupplier(params: any) {
       label: item.name,
       value: item.id,
     }));
-    getIsOnline(params.conditioningProgramSupplierId, params.isOnline, params.isDelivery, params.conditioningProgramTypes);
+    getisOffline(params.conditioningProgramSupplierId, params.isOffline, params.isDelivery, params.conditioningProgramTypes);
   }
 }
-function getIsOnline(e: any, newOnline: any, newDelivery: any, newType: any) {
+function getisOffline(e: any, newOffline: any, newDelivery: any, newType: any) {
   let filterSupplierArr = supplierArr.value.filter((item: any) => item.id === e);
-  console.log(filterSupplierArr, 'filterSupplierArr==>',newType,supplierArr.value,e );
   if (filterSupplierArr.length > 0) {
     isShowOnline.value = filterSupplierArr.every((items: any) => {
-      console.log(newType, 'newType',form);
       if (newType.length > 0) {
-        console.log(filterSupplierArr, 'filterSupplierArr==>', newType[0],items.offlineCPTypes,items.onlineCPTypes);
-        return items.offlineCPTypes.includes(newType[0]) && items.onlineCPTypes.includes(newType[0]);
+        return items.offlineCPTypes?.includes(newType[0]) && items.onlineCPTypes?.includes(newType[0]);
       } else {
         return false;
       }
     });
     console.log(isShowOnline.value, 'isShowOnline==>');
     if (isShowOnline.value) {
-      if (newOnline) {
-        onlineArr.value = [newOnline];
+      if (newOffline) {
+        onlineArr.value = [newOffline];
         if (onlineArr.value.length > 1) {
           onlineArr.value = [onlineArr.value[onlineArr.value.length - 1]];
         } else if (onlineArr.value.length === 0) {
           onlineArr.value = [];
         }
-
-        if (newOnline === 'Y') {
-          isShowDelivery.value = true;
-        } else {
-          form.isDelivery = '';
+        // newOffline ==Y 线下项目 不需要配送
+        if (newOffline === 'Y') {
+          form.isDelivery = null;
           isShowDelivery.value = false;
+        } else {
+        
+          isShowDelivery.value = true;
         }
+      }else{
+        isShowDelivery.value = false;
       }
       if (newDelivery) {
         deliverArr.value = [newDelivery];
@@ -139,13 +129,13 @@ function getIsOnline(e: any, newOnline: any, newDelivery: any, newType: any) {
   }
 }
 watch(
-  [() => form.conditioningProgramType, () => form.institutionId, () => form.conditioningProgramSupplierId, () => form.isOnline, () => form.isDelivery],
-  ([newType, newInstitutionId, newSupplierId, newOnline, newDelivery]) => {
+  [() => form.conditioningProgramType, () => form.institutionId, () => form.conditioningProgramSupplierId, () => form.isOffline, () => form.isDelivery],
+  ([newType, newInstitutionId, newSupplierId, newOffline, newDelivery]) => {
     getSupplier({
       conditioningProgramTypes: newType ? [newType] : form.conditioningProgramType ? [form.conditioningProgramType] : [],
       institutionId: newInstitutionId ? newInstitutionId : form.institutionId ? form.institutionId : '',
       conditioningProgramSupplierId: newSupplierId ? newSupplierId : form.conditioningProgramSupplierId ? form.conditioningProgramSupplierId : '',
-      isOnline: newOnline,
+      isOffline: newOffline,
       isDelivery: newDelivery,
     });
   },
@@ -273,13 +263,13 @@ watch(
 );
 function bindchange(e: any) {
   form.conditioningProgramSupplierId = '';
-  form.isOnline = '';
+  form.isOffline = null;
 
 }
 function onlineChange(value: any) {
-  form.isOnline = value[value.length - 1];
+  form.isOffline = value[value.length - 1];
   deliverArr.value = [];
-  form.isDelivery = '';
+  form.isDelivery = null;
 }
 function deliveryChange(value: any) {
   form.isDelivery = value[value.length - 1];
@@ -287,8 +277,8 @@ function deliveryChange(value: any) {
 function getConditioningProgramSupplier(value: any) {
   onlineArr.value = [];
   deliverArr.value = [];
-  form.isOnline = '';
-  form.isDelivery = '';
+  form.isOffline = null;
+  form.isDelivery = null;
   isShowDelivery.value = false;
 }
 </script>
@@ -390,7 +380,7 @@ function getConditioningProgramSupplier(value: any) {
       <a-form-item label="供应商:" required name="conditioningProgramSupplierId">
         <a-select v-model:value="form.conditioningProgramSupplierId" :options="supplierOptions" placeholder="请选择" allowClear @change="getConditioningProgramSupplier" />
       </a-form-item>
-      <a-form-item label="线上项目:" name="isOnline" v-if="isShowOnline" required>
+      <a-form-item label="线下项目:" name="isOffline" v-if="isShowOnline" required>
         <a-checkbox-group v-model:value="onlineArr" @change="onlineChange">
           <a-checkbox value="Y">是</a-checkbox>
           <a-checkbox value="N">否</a-checkbox>
@@ -405,7 +395,7 @@ function getConditioningProgramSupplier(value: any) {
       <a-form-item label="图片:">
         <a-upload :showUploadList="uploadProps" v-model:file-list="fileList" list-type="picture-card" @preview="handlePreview" :maxCount="1" :customRequest="customUpload">
           <div v-if="fileList.length < 1">
-            <plus-outlined />
+            <PlusOutlined />
             <div style="margin-top: 8px">上传</div>
           </div>
         </a-upload>

+ 8 - 7
src/service/ConfirmItems.vue

@@ -1,6 +1,7 @@
 <script setup lang="ts">
 import { ref, reactive, watch, onMounted, defineEmits } from 'vue';
 import { message } from 'ant-design-vue';
+import { PlusOutlined } from '@ant-design/icons-vue';
 import { branchMethod } from '@/request/api/system.api';
 import { useRequest } from 'alova/client';
 import { cpMedicinesMethod } from '@/request/api/dictionary.api';
@@ -47,7 +48,7 @@ watch(
   ([newType, newInstitutionId]) => {
     if (newType) {
       props.data.conditioningProgramSupplierId = '';
-      props.data.isOnline = '';
+      props.data.isOffline = null;
     }
     getSupplier({
       conditioningProgramTypes: newType ? [newType] : [],
@@ -105,10 +106,10 @@ function handleOk() {
   });
 }
 // 创建一个响应式变量来控制 checkbox 的状态
-const isOnline = ref<boolean>(false);
+const isOffline = ref<boolean>(false);
 // 切换状态的函数
 function toggleOnlineStatus() {
-  props.data.isOnline = isOnline.value ? 'Y' : 'N';
+  props.data.isOffline = isOffline.value ? 'Y' : 'N';
 }
 onMounted(async () => {
   if (props.data.id) {
@@ -126,7 +127,7 @@ onMounted(async () => {
         },
       ]
     : [];
-  isOnline.value = props.data.isOnline === 'Y';
+  isOffline.value = props.data.isOffline === 'Y';
 });
 </script>
 
@@ -216,8 +217,8 @@ onMounted(async () => {
     <div class="form-row">
       <label>供应商:</label>
       <a-select v-model:value="data.conditioningProgramSupplierId" :options="supplierOptions" placeholder="请选择供应商" style="width: 200px" allow-clear class="mr-10" />
-      <a-checkbox v-model:checked="isOnline" style="margin-right: 8px" @change="toggleOnlineStatus"> 线上项目 </a-checkbox>
-      <!-- <div>{{ data.isOnline }}</div> -->
+      <a-checkbox v-model:checked="isOffline" style="margin-right: 8px" @change="toggleOnlineStatus"> 线下项目 </a-checkbox>
+    
     </div>
     <div class="form-row">
       <label>图片:</label>
@@ -233,7 +234,7 @@ onMounted(async () => {
         :customRequest="customUpload"
       >
         <div v-if="fileList.length < 1">
-          <plus-outlined />
+          <PlusOutlined />
           <div style="margin-top: 8px">上传</div>
         </div>
       </a-upload>

+ 62 - 59
src/service/EditSystemService.vue

@@ -39,6 +39,8 @@ const { loading: addOrgCwLoading, send: addOrgCw } = useRequest(addOrgCwMethod,
   emit('submit');
 });
 
+const localData = reactive({ ...props.data }); // Create a local copy of props.data
+
 const formData = reactive<FollowModel>({
   name: '', //服务包名称
   price: 0, //总计价格
@@ -86,6 +88,7 @@ const emptyRow = {
   conditioningProgramId: 0,
   days: '',
   frequencyType: '',
+  frequencyTypeing: [],
   frequencyMeasure: '',
   totalMeasure: '',
   totalPrice: '',
@@ -104,8 +107,8 @@ const emptyRow = {
     cpDynamicPricingRule: [],
     cpMedicines: [],
     effect: '',
-    isOnline: '',
-    isDelivery: '',
+    isOffline: null,
+    isDelivery: null,
     photo: '',
     institutionId: '',
     institutionName: '',
@@ -129,17 +132,10 @@ function getInstitutionProjectList() {
   });
   onSuccess(({ data }: any) => {
     allProjects.value = data;
-    console.log(allProjects.value, 'allProjects.value');
   });
 }
 function getSystemProjectList() {
-  const {
-    loading: projectLoading,
-    onSuccess,
-    replace,
-    refresh,
-    remove,
-  } = useRequest(getAllSystemCpMethod, {
+  const { loading: projectLoading, onSuccess } = useRequest(getAllSystemCpMethod, {
     immediate: true,
   });
   onSuccess(({ data }: any) => {
@@ -147,9 +143,7 @@ function getSystemProjectList() {
   });
 }
 async function getProjectList() {
-  console.log(props.data, 'getProjectList');
-  if (props.data.types === 'system') {
-    // console.log('系统');
+  if (localData.types === 'system') {
     getSystemProjectList();
   } else {
     getInstitutionProjectList();
@@ -238,7 +232,7 @@ function onSelectProject({ row }: any) {
       },
       cpDynamicPricingRule: row?.cpDynamicPricingRule,
       cpMedicines: row?.cpMedicines,
-      isOnline: row?.isOnline,
+      isOffline: row?.isOffline,
       isDelivery: row?.isDelivery,
       photo: row?.photo,
       conditioningProgramSupplierName: row?.conditioningProgramSupplierName,
@@ -254,7 +248,6 @@ function onSelectProject({ row }: any) {
 // 预览
 
 function onPreview(row) {
-  console.log(row, '66666');
   if (row.conditioningProgramDetail.id) {
     // 这里写你的预览逻辑
     VxeUI.modal.open({
@@ -336,34 +329,39 @@ function editPart(row) {
     message.warning('请先添加服务包');
   }
 }
-let frequencyType = ref<string[]>([]);
+
 // 添加计算数量的函数
 function calculateCount(row: any) {
+  const pricingType = row.conditioningProgramDetail.pricingType;
   const period = Number(row.days) || 0;
   const frequency = Number(row.frequencyMeasure) || 0;
-
-  console.log(row.frequencyMeasure, 'row.frequencyMeasure');
-  // 检查是否选择了"不限"
-  if (row.frequencyType === '不限') {
-    frequencyType.value = [row.frequencyType];
-    row.frequencyMeasure = ''; // 重置 frequencyMeasure
-    row.totalMeasure = 1;
-  } else {
-    const frequencyType = Number(row.frequencyType) || 0;
-    row.totalMeasure = Math.ceil(period / frequencyType) * frequency;
+  // 一口价
+  if (pricingType === '0') {
+    // 检查是否选择了"不限"
+    if (row.frequencyType === '不限') {
+      row.frequencyMeasure = ''; // 重置 frequencyMeasure
+      row.totalMeasure = 1;
+    } else {
+      const frequencyType = Number(row.frequencyType) || 0;
+      row.totalMeasure = Math.ceil(period / frequencyType) * frequency;
+    }
+    // 获取单价
+    const unitPrice = Number(row.conditioningProgramDetail?.cpFixedPricingRule?.unitPrice) || 0;
+    // 计算总价
+    row.totalPrice = (row.totalMeasure * unitPrice).toFixed(2);
+  } else if (pricingType === '1') {
+    // 按穴位计价
+    row.totalPrice =
+      row.conditioningProgramDetail?.cpDynamicPricingRule?.reduce((sum: number, item: any) => {
+        return sum + (Number(item.price) || 0);
+      }, 0) || 0;
   }
-
-  // 获取单价
-  const unitPrice = Number(row.conditioningProgramDetail?.cpFixedPricingRule?.unitPrice) || 0;
-  // 计算总价
-  row.totalPrice = (row.totalMeasure * unitPrice).toFixed(2);
 }
 
 // 添加监听器
 watch(
   () => formData.items,
   (newData) => {
-    console.log(newData, 'newData');
     if (!newData) return;
     newData.forEach((row) => {
       if (row?.days || row?.frequencyType || row?.frequencyMeasure) {
@@ -379,7 +377,6 @@ function cancel() {
 }
 
 function confirm() {
-  // console.log(formData, '性别值'); // 打印性别值
   const isValid = (formData.items ?? []).every((item: any) => {
     delete item.id; // 删除 id 属性
     if (item?.conditioningProgramDetail && item?.conditioningProgramDetail?.pricingType === '1') {
@@ -395,11 +392,16 @@ function confirm() {
     }
     return true; // 返回 true 表示条件满足
   });
-
+  formData?.items?.forEach((row: any) => {
+    if (row.frequencyTypeing && row.frequencyTypeing.length > 0) {
+      row.frequencyType = row.frequencyTypeing[0];
+    }
+  });
+  console.log(localData.types, 'formData.items');
   // 如果所有条件都满足,继续执行后续代码
   if (isValid) {
     // 系统服务包
-    if (props.data.types === 'system') {
+    if (localData.types === 'system') {
       delete formData.types;
       addSystemCw({
         ...formData,
@@ -407,7 +409,7 @@ function confirm() {
         notification.success({ message: '操作成功' });
         VxeUI.modal.close(`edit-system-service-modal`);
       });
-    } else if (props.data.types === 'institution') {
+    } else if (localData.types === 'institution') {
       if (fileList.value.length > 0) {
         const upImg = fileList.value[0].response?.url;
         formData.photo = upImg;
@@ -438,7 +440,6 @@ const desiredConditions = ref<{ id: string; name: string }[]>([]);
 const constitutionGroups = ref<{ id: string; name: string }[]>([]);
 async function getDesiredConditions() {
   const res = await getDictionaryMethod('conditioning_wrap_willill_state');
-  // console.log(res, 'getDesiredConditions');
   if (res?.length > 0) {
     desiredConditions.value = res.map((item: any) => ({
       id: item.value,
@@ -450,7 +451,7 @@ async function getDesiredConditions() {
 const genders = ref<{ id: string; name: string }[]>([]);
 async function getGender() {
   const res = await getDictionaryMethod('sys_user_sex');
-  if (res?.length > 0) {
+  if (res && res.length > 0) {
     genders.value = res.map((item: any) => ({
       id: item.label,
       name: item.label,
@@ -463,8 +464,7 @@ async function getGender() {
 const ages = ref<{ id: string; name: string }[]>([]);
 async function getAge() {
   const res = await getDictionaryMethod('conditioning_wrap_rule_age');
-  console.log(res, 'getAge');
-  if (res?.length > 0) {
+  if (res && res.length > 0) {
     ages.value = res.map((item: any) => ({
       id: item.label,
       name: item.label,
@@ -473,8 +473,7 @@ async function getAge() {
 }
 async function getConstitutionGroup() {
   const res = await getDictionaryMethod('constitution_group');
-  // console.log(res, 'constitutionGroup');
-  if (res?.length > 0) {
+  if (res && res.length > 0) {
     constitutionGroups.value = res.map((item: any) => ({
       id: item.value,
       name: item.label,
@@ -486,12 +485,11 @@ onMounted(async () => {
   getGender();
   getAge();
   getConstitutionGroup();
-  console.log(props.data, 'props.data');
-  if (props.data.id) {
-    props.data.type = 'institution';
+  if (localData.id) {
+    localData.types = 'institution'; // Modify the local copy instead
     // 调编辑接口获取数据
-    const res: any = await getConditioningRecordDetailMethod(props.data);
-    Object.assign(formData, res);
+    const res: any = await getConditioningRecordDetailMethod(localData);
+    Object.assign(formData, res); // Use the response to update formData
     await nextTick(); // 确保视图更新
 
     formData.conditioningWrapPatientMatchRule = res?.conditioningWrapPatientMatchRule ?? {
@@ -514,12 +512,16 @@ onMounted(async () => {
           },
         ]
       : [];
+    formData?.items?.forEach((row: any) => {
+      row.frequencyTypeing = row.frequencyType ? [row.frequencyType] : [];
+    });
   }
-  // console.log(formData.conditioningWrapPatientMatchRule, '初始化时性别值'); // 添加日志
   await getProjectList();
+  console.log(formData.items, 'formData');
 });
 
 const tableData = computed(() => {
+  console.log(formData.items, 'formData.items');
   return [...(formData.items ?? []), { ...emptyRow }];
 });
 
@@ -579,16 +581,16 @@ let multiple = ref<boolean>(true);
 <template>
   <div style="padding: 24px">
     <div class="flex">
-      <div style="margin-bottom: 16px" class="mr-4" v-if="props.data?.types === 'institution'">
+      <div style="margin-bottom: 16px" class="mr-4" v-if="localData?.types === 'institution'">
         <span>机构名称:</span>
         <a-input style="width: 200px" v-model:value="formData.institutionName" />
       </div>
       <div style="margin-bottom: 16px" class="mr-6">
         <span>服务包名称:</span>
         <a-input style="width: 200px" v-model:value="formData.name" />
-        <a-button type="primary" @click="addInstitution" class="ml-4" v-if="props.data?.types === 'institution'">引入</a-button>
+        <a-button type="primary" @click="addInstitution" class="ml-4" v-if="localData?.types === 'institution'">引入</a-button>
       </div>
-      <div class="flex" v-if="props.data?.types === 'institution'">
+      <div class="flex" v-if="localData?.types === 'institution'">
         <div class="w-35">服务形象照:</div>
         <a-upload
           :showUploadList="uploadProps"
@@ -731,7 +733,7 @@ let multiple = ref<boolean>(true);
         </vxe-column>
         <vxe-column title="预览" width="50">
           <template #default="{ row }">
-            <EyeOutlined style="font-size: 18px; color: #1890ff; cursor: pointer" @click="onPreview(row)" />
+            <EyeOutlined style="font-size: 18px; color: #1890ff; cursor: pointer" @click="onPreview(row)" v-if="row?.conditioningProgramDetail?.id" />
           </template>
         </vxe-column>
         <vxe-column field="days" title="周期" width="100">
@@ -754,13 +756,14 @@ let multiple = ref<boolean>(true);
               </div>
               <div>
                 <a-checkbox-group
+                  v-model:value="row.frequencyTypeing"
                   @change="
                     (value) => {
+                      row.frequencyTypeing = value.includes('不限') ? ['不限'] : [];
                       row.frequencyType = value.includes('不限') ? '不限' : '';
                       calculateCount(row);
                     }
                   "
-                  v-model:value="row.frequencyType"
                 >
                   <a-checkbox value="不限">不限</a-checkbox>
                 </a-checkbox-group>
@@ -810,10 +813,10 @@ let multiple = ref<boolean>(true);
             </div>
           </template>
         </vxe-column>
-        <vxe-column field="conditioningProgramDetail.isOnline" title="线上项目" width="100">
+        <vxe-column field="conditioningProgramDetail.isOffline" title="线下项目" width="100">
           <template #default="{ row }">
-            <span v-if="row.conditioningProgramDetail">
-              {{ row.conditioningProgramDetail.isOnline === 'Y' ? '是' : '否' }}
+            <span v-if="row.conditioningProgramDetail?.isOffline">
+              {{ row.conditioningProgramDetail.isOffline === 'Y' ? '是' : '否' }}
             </span>
             <span v-else>-</span>
           </template>
@@ -827,7 +830,7 @@ let multiple = ref<boolean>(true);
         </vxe-column>
         <vxe-column field="remark" title="说明" width="180">
           <template #default="{ row }">
-            <a-textarea v-model:value="row.remark" style="max-width: 180px; width: 100%; height: 50px" rows="2" show-count :maxLength="200" />
+            <a-textarea v-model:value="row.remark" style="max-width: 180px; width: 100%; height: 50px" :rows="2" show-count :maxLength="200" />
           </template>
         </vxe-column>
       </vxe-table>
@@ -841,11 +844,11 @@ let multiple = ref<boolean>(true);
       }"
       :src="previewImg"
     />
-    <div style="display: flex; justify-content: flex-end;">
+    <div style="display: flex; justify-content: flex-end">
       <span style="font-weight: bold">合计:{{ formData.price }}元</span>
     </div>
 
-    <div style="display: flex; justify-content: center;">
+    <div style="display: flex; justify-content: center">
       <a-button style="margin-right: 24px" @click="cancel">取消</a-button>
       <a-button type="primary" @click="confirm">确认</a-button>
     </div>

+ 2 - 0
src/service/HealthEvaluation.vue

@@ -9,6 +9,7 @@ const props = defineProps<{ data: FollowModel }>();
 
 const emits = defineEmits<{
   submit: [data?: SystemItemModel];
+  change: [data?: SystemItemModel];
 }>();
 
 const { loading: submitting, send: onOkSubmit } = useRequest(systemCpEditMethod, {
@@ -31,6 +32,7 @@ function onOk() {
     confirmOrgConfirmMethod(props.data).then(() => {
     VxeUI.modal.close('health-consultation-modal');
     message.success('提交成功');
+    emits('change');
   });
 
   }else{

+ 3 - 3
src/service/IntroduceProjectList.vue

@@ -6,7 +6,7 @@ import { getConditioningRecordDetailMethod } from '@/request/api/care.api';
 const tableData = ref<SystemItemModel[]>([]);
 
 type FollowModel = Partial<SystemCwModel>;
-const props = defineProps<{ data: FollowModel; id: string }>();
+const props = defineProps<{ data: FollowModel; id: number | string }>();
 
 // 引入已有项目
 async function handleAdd(row: any) {
@@ -19,8 +19,8 @@ async function handleAdd(row: any) {
 function handleCancel() {
   VxeUI.modal.close(`introduceProjectList-modal`);
 }
-const dataObj = reactive<SystemCwModel>({
-  type: 'institution',
+const dataObj = reactive({
+  types: 'institution',
   id: props.id,
 });
 onMounted(async () => {

+ 1 - 1
src/service/ServiceDetail.vue

@@ -52,7 +52,7 @@ onMounted(async () => {
           单价为${data?.cpDynamicPricingRule? data?.cpDynamicPricingRule[1]?.price || 0:0}元`:'' }}</div>
         </div>
     </div>
-      <div class="detail-item" v-if="data?.cpMedicines?.length>0 && (data?.cpMedicines.length===1 && data?.cpMedicines[0]?.name)">
+      <div class="detail-item" v-if="data?.cpMedicines?.length>0 && data?.cpMedicines[0]?.name">
         <div class="label">中药组成:</div>
       <div class="content" v-for="item in data?.cpMedicines" :key="item.id">{{ item.name }} ; </div>
     </div>

+ 4 - 0
src/service/ServiceItemsConfirm.vue

@@ -171,6 +171,10 @@ function sureItem(model?: SystemItemModel, index?: number) {
         default() {
           return h(HealthEvaluation, <any>{
             data: {...model,addType},
+            change: (data: SystemItemModel) => {
+              // 确认成功之后刷新页面
+              refresh(page.value);
+            },
           });
         },
       },

+ 1 - 3
src/service/ServiceItemsList.vue

@@ -151,7 +151,6 @@ const {
   immediate: true,
 });
 onSuccess(({ data: { data } }) => {
-  console.log(data, 'data==>');
   gridRef.value?.loadData(data);
 });
 onMounted(() => {
@@ -180,7 +179,7 @@ function editConfirmed(model?: SystemItemModel, index?: number) {
   const addType = `itemsList`;
   if (model?.name === '健康咨询' || model?.name === '健康评估') {
     VxeUI.modal.open({
-      title: model?.conditioningProgramType,
+      title: model?.conditioningProgramType ?? '项目',
       height: 400,
       width: 750,
       id: `health-consultation-modal`,
@@ -243,7 +242,6 @@ function seeDetail(model?: SystemItemModel, index?: number) {
       },
     });
   } else {
-    console.log(model, 'model');
     VxeUI.modal.open({
       title: '查看',
       height: 600,

+ 4 - 4
src/service/ServiceItemsSystem.vue

@@ -226,7 +226,7 @@ function editItems(model?: SystemItemModel, index?: number) {
   if (model?.isErasable === 'N') {
     // 健康咨询 健康评估 x显示
     VxeUI.modal.open({
-      title: model?.conditioningProgramType,
+      title: model?.conditioningProgramType ?? '项目',
       height: 400,
       width: 750,
       id: `health-consultation-modal`,
@@ -312,9 +312,9 @@ defineExpose({
           <vxe-button style="margin-right: 12px" icon="vxe-icon-repeat" circle @click="refresh(page)"></vxe-button>
         </template>
         <template #actionSlot="{ row, rowIndex }">
-          <vxe-button type="text" status="primary" @click="seeItems(row, rowIndex)">查看</vxe-button>
-          <vxe-button type="text" status="primary" @click="editItems(row, rowIndex)">编辑</vxe-button>
-          <vxe-button type="text" status="primary" @click="deleteItems(row, rowIndex)" v-if="row.isErasable === 'N' ? false : true">删除</vxe-button>
+          <vxe-button mode="text" status="primary" @click="seeItems(row, rowIndex)">查看</vxe-button>
+          <vxe-button mode="text" status="primary" @click="editItems(row, rowIndex)">编辑</vxe-button>
+          <vxe-button mode="text" status="primary" @click="deleteItems(row, rowIndex)" v-if="row.isErasable === 'N' ? false : true">删除</vxe-button>
         </template>
       </vxe-grid>
     </main>

+ 5 - 6
src/service/ServicePackageDetail.vue

@@ -1,9 +1,8 @@
 <script setup lang="ts">
-import { ref, reactive } from 'vue';
+import { ref } from 'vue';
 import type { SystemCwModel } from '@/model/care.model';
 import { getConditioningRecordDetailMethod } from '@/request/api/care.api';
-import { usePagination, useRequest } from 'alova/client';
-import { message } from 'ant-design-vue';
+import { notification } from 'ant-design-vue';
 const props = defineProps<{
   data: SystemCwModel;
 }>();
@@ -15,7 +14,7 @@ onMounted(async () => {
     const res: any = await getConditioningRecordDetailMethod(props.data);
     tableData.value = res;
   } catch (error) {
-    message.error('获取数据失败');
+    notification.error({ message: '获取数据失败' });
   }
 });
 </script>
@@ -40,8 +39,8 @@ onMounted(async () => {
                     ? '已完结'
                     : ''
       }}</span>
-      <span v-if="tableData?.diagnosis || tableData?.diagnoseDiseaseNames">疾病名称:{{ tableData?.diagnosis || tableData?.diagnoseDiseaseNames?.join(',') }}</span>
-      <span v-if="tableData?.symptom || tableData?.diagnoseSyndromeNames">证型:{{ tableData?.symptom || tableData?.diagnoseSyndromeNames?.join(',') }}</span>
+      <span v-if="tableData?.diagnosis || tableData?.diagnoseDiseaseNames?.length>0" >疾病名称:{{ tableData?.diagnosis || tableData?.diagnoseDiseaseNames?.join(',') }}</span>
+      <span v-if="tableData?.symptom || tableData?.diagnoseSyndromeNames?.length>0" >证型:{{ tableData?.symptom || tableData?.diagnoseSyndromeNames?.join(',') }}</span>
       <span>开具医生:{{ tableData?.createBy }}</span>
       <span>开具时间:{{ tableData?.createTime }}</span>
       <span v-if="tableData?.estimatedEndDate">调养周期:{{ tableData?.estimatedStartDate }} - {{ tableData?.estimatedEndDate }}</span>

+ 4 - 4
src/service/ServicePackageList.vue

@@ -1,5 +1,5 @@
 <script lang="ts" setup>
-import { ref } from 'vue';
+import { ref, reactive } from 'vue';
 import { VxeUI } from 'vxe-pc-ui';
 import IntroduceProjectList from '@/service/IntroduceProjectList.vue';
 import { getSystemCpListMethod, getConditioningRecordDetailMethod } from '@/request/api/care.api';
@@ -20,12 +20,12 @@ onSuccess(({ data: { data } }) => {
   loading.value = false;
 });
 const id = ref<string>('');
-async function handleSelect(model?: SystemCwModel, index?: number) {
+async function handleSelect(model?: SystemCwModel) {
   if (model?.id) {
     id.value = model.id;
     try {
       const params = {
-        type: 'institution',
+        types: 'institution',
         id: model.id,
       };
       const res: any = await getConditioningRecordDetailMethod(params);
@@ -56,7 +56,7 @@ async function handleSelect(model?: SystemCwModel, index?: number) {
         return h(IntroduceProjectList, {
           data: { ...props.data },
           id: id.value,
-          onSubmit(data: SystemCwModel) {
+          onSubmit() {
             VxeUI.modal.close(`introduceProjectList-modal`);
           },
         });