Ver Fonte

对于【已开】状态的,只需展示

张田田 há 7 meses atrás
pai
commit
1633c962a3

+ 46 - 17
src/pages/index/care/issueService.vue

@@ -250,7 +250,7 @@ function openRecord(item: any) {
     destroyOnClose: true,
     slots: {
       default() {
-        return h(ServicePackageDetail, <any>{
+        return h(ServicePackageDetail, {
           data: { ...item, types, status },
           onSubmit(data: any) {
             selectedPackage.value = data.conditioningWrapId;
@@ -258,7 +258,7 @@ function openRecord(item: any) {
             form.conditioningWrapName = data.conditioningWrapName;
             form.conditioningWrapId = data.conditioningWrapId;
           },
-        });
+        } as any);
       },
     },
   });
@@ -335,6 +335,10 @@ const projectSearch = ref('');
 const showProjectPopover = ref(false);
 
 const displayTableData = computed(() => {
+  // 已开状态不展示新增空白行
+  if (currentPatient?.value?.status === '0') {
+    return formData.items ?? [];
+  }
   return [...(formData.items ?? []), { ...emptyRow }];
 });
 const isShowDelivery = ref<boolean>(false);
@@ -361,6 +365,10 @@ const totalPrice = computed(() => {
   }, 0);
 });
 function onSelectProject({ row }: any) {
+  if (currentPatient?.value?.status === '0') {
+    notification.warning({ message: '已开状态不可新增项目' });
+    return;
+  }
   if ((formData.items ?? []).some((item) => item.conditioningProgramDetail?.name === row.name)) {
     notification.warning({ message: '不能重复添加该项目' });
     return;
@@ -408,6 +416,10 @@ function onSelectProject({ row }: any) {
   projectSearch.value = '';
 }
 function removeTableRow(idx: number) {
+  if (currentPatient?.value?.status === '0') {
+    notification.warning({ message: '已开状态不可删除项目' });
+    return;
+  }
   if (idx < (formData.items ?? []).length) {
     formData.items?.splice(idx, 1);
   }
@@ -480,16 +492,31 @@ function editPart(row) {
     storage: true,
     slots: {
       default() {
-        return h(AcupointEdit, <any>{
+        return h(AcupointEdit, {
           data: row,
           onSubmit(data: any) {
             VxeUI.modal.close(`edit-part-modal`);
           },
-        });
+        } as any);
       },
     },
   });
 }
+// 已开状态下显示穴位/经络/部位的只读文本
+function getAcupointText(row: any): string {
+  const meridians: string[] = Array.isArray(row?.acuMeridianNames)
+    ? row.acuMeridianNames
+    : Array.isArray(row?.cwcpAcuMeridians)
+    ? row.cwcpAcuMeridians.map((it: any) => it?.name).filter(Boolean)
+    : [];
+  const points: string[] = Array.isArray(row?.acuPointNames)
+    ? row.acuPointNames
+    : Array.isArray(row?.cwcpAcuPoints)
+    ? row.cwcpAcuPoints.map((it: any) => it?.name).filter(Boolean)
+    : [];
+  const parts = [...meridians, ...points].filter(Boolean);
+  return parts.length ? parts.join('、') : '-';
+}
 const allProjects = ref<
   Array<{
     name: string;
@@ -990,17 +1017,17 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
           <vxe-table :data="displayTableData" border style="margin-top: 8px" max-height="380px">
             <vxe-column width="60" title="">
               <template #default="{ rowIndex }">
-                <a-button type="text" danger @click="removeTableRow(rowIndex)" :disabled="rowIndex === displayTableData.length - 1">
+                <a-button type="text" danger @click="removeTableRow(rowIndex)" :disabled="currentPatient?.status === '0' || rowIndex === displayTableData.length - 1">
                   <MinusCircleOutlined />
                 </a-button>
               </template>
             </vxe-column>
             <vxe-column field="conditioningProgramDetail.name" title="项目名称" width="180">
               <template #default="{ row, rowIndex }">
-                <template v-if="rowIndex === displayTableData.length - 1">
+                <template v-if="currentPatient?.status !== '0' && rowIndex === displayTableData.length - 1">
                   <a-popover
                     v-model:open="showProjectPopover"
-                    trigger="click"
+                    :trigger="currentPatient?.status === '0' ? 'none' : 'click'"
                     placement="bottomLeft"
                     :overlayStyle="{ width: '350px', padding: 0 }"
                     @openChange="projectSearchFocus"
@@ -1034,7 +1061,7 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
             <vxe-column field="days" title="周期" width="120">
               <template #default="{ row }">
                 <div style="display: flex; align-items: center">
-                  <a-input v-model:value="row.days" @change="() => calculateCount(row)" />
+                  <a-input v-model:value="row.days" @change="() => calculateCount(row)" :disabled="currentPatient?.status === '0'" />
                   <span>天</span>
                 </div>
               </template>
@@ -1044,9 +1071,9 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
                 <div v-if="row.conditioningProgramDetail?.name === '健康咨询' || row.conditioningProgramDetail?.name === '健康评估'" class="flex items-center">
                   <div class="flex items-center mr-4">
                     <span>每</span>
-                    <a-input v-model:value="row.frequencyType" style="width: 50px" @change="() => calculateCount(row)" :disabled="row.frequencyType === '不限'" />
+                    <a-input v-model:value="row.frequencyType" style="width: 50px" @change="() => calculateCount(row)" :disabled="currentPatient?.status === '0' || row.frequencyType === '不限'" />
                     <span>天</span>
-                    <a-input v-model:value="row.frequencyMeasure" style="width: 50px" @change="() => calculateCount(row)" :disabled="row.frequencyType === '不限'" />
+                    <a-input v-model:value="row.frequencyMeasure" style="width: 50px" @change="() => calculateCount(row)" :disabled="currentPatient?.status === '0' || row.frequencyType === '不限'" />
                     <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit ? row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit : '次' }}</span>
                   </div>
                   <div>
@@ -1059,6 +1086,7 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
                           calculateCount(row);
                         }
                       "
+                      :disabled="currentPatient?.status === '0'"
                     >
                       <a-checkbox value="不限">不限</a-checkbox>
                     </a-checkbox-group>
@@ -1066,9 +1094,9 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
                 </div>
                 <div class="flex items-center" v-else>
                   <span>每</span>
-                  <a-input v-model:value="row.frequencyType" style="width: 50px" @change="() => calculateCount(row)" />
+                  <a-input v-model:value="row.frequencyType" style="width: 50px" @change="() => calculateCount(row)" :disabled="currentPatient?.status === '0'" />
                   <span>天</span>
-                  <a-input v-model:value="row.frequencyMeasure" style="width: 50px" @change="() => calculateCount(row)" />
+                  <a-input v-model:value="row.frequencyMeasure" style="width: 50px" @change="() => calculateCount(row)" :disabled="currentPatient?.status === '0'" />
                   <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit ? row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit : '次' }}</span>
                 </div>
               </template>
@@ -1102,7 +1130,7 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
               <template #default="{ row }">
                 <div style="display: flex; align-items: center">
                   <span>调养开始第</span>
-                  <a-input v-model:value="row.initialDay" style="width: 80px" />
+                  <a-input v-model:value="row.initialDay" style="width: 80px" :disabled="currentPatient?.status === '0'" />
                   <span>天</span>
                 </div>
               </template>
@@ -1118,10 +1146,11 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
 
             <vxe-column field="conditioningProgramDetail.pricingType" title="穴位/经络/部位" width="160">
               <template #default="{ row }">
-                <!-- <a-input v-model:value="row.desc" style="width: 120px" :disabled="currentPatient?.status === '0' ? true : false" /> -->
-                <span>
-                  <a @click="editPart(row)" style="color: #1890ff; cursor: pointer" v-if="row.conditioningProgramDetail.pricingType === '1'">编辑</a>
-                </span>
+                <a
+                  v-if="row.conditioningProgramDetail.pricingType === '1' && currentPatient?.status !== '0'"
+                  @click="editPart(row)"
+                  :style="{ color: '#1890ff', cursor: 'pointer' }"
+                >编辑</a>
               </template>
             </vxe-column>
             <vxe-column field="remark" title="说明" width="180">

+ 4 - 1
src/service/ServiceItemsConfirm.vue

@@ -84,7 +84,7 @@ const gridOptions = reactive<VxeGridProps<SystemItemModel>>({
     { field: 'name', title: '项目名称' },
     { field: 'conditioningProgramType', title: '方案类型' },
     { field: 'cpFixedPricingRule.unitPrice', title: '单价(元)', slots: { default: 'unitPriceCell' } },
-    { field: 'cpFixedPricingRule.pricingUnit', title: '计价单位' },
+    { field: 'cpFixedPricingRule.pricingUnit', title: '计价单位',slots: { default: 'pricingUnitCell' } },
     { field: 'cpFixedPricingRule.convertDose', title: '计价说明', slots: { default: 'convertDoseCell' } },
     { field: 'conditioningProgramSupplierName', title: '供应商' },
     {
@@ -218,6 +218,9 @@ defineExpose({
     </header>
     <main class="flex-auto overflow-hidden">
       <vxe-grid ref="gridRef" v-bind="gridOptions" v-on="gridEvents" :loading="loading">
+        <template #pricingUnitCell="{ row }">
+          {{ row.cpFixedPricingRule?.pricingUnit ? row.cpFixedPricingRule?.pricingUnit : '次' }}
+        </template>
         <template #unitPriceCell="{ row }">
           {{ row.pricingType === '1' ? '' : row.cpFixedPricingRule?.unitPrice }}
         </template>

+ 4 - 1
src/service/ServiceItemsList.vue

@@ -137,7 +137,7 @@ const gridOptions = reactive<VxeGridProps<SystemItemModel>>({
     { field: 'conditioningProgramType', title: '方案类型' },
     { field: 'isForWrapCell', title: '项目应用', slots: { default: 'isForWrapCell' } },
     { field: 'cpFixedPricingRule.unitPrice', title: '单价(元)', slots: { default: 'unitPriceCell' } },
-    { field: 'cpFixedPricingRule.pricingUnit', title: '计价单位' },
+    { field: 'cpFixedPricingRule.pricingUnit', title: '计价单位', slots: { default: 'pricingUnitCell' } },
     { field: 'cpFixedPricingRule.convertDose', title: '计价说明', slots: { default: 'convertDoseCell' } },
     { field: 'conditioningProgramSupplierName', title: '供应商' },
     { field: 'institutionName', title: '机构名称' },
@@ -346,6 +346,9 @@ defineExpose({
             })()
           }}
         </template>
+        <template #pricingUnitCell="{ row }">
+          {{ row.cpFixedPricingRule?.pricingUnit ? row.cpFixedPricingRule?.pricingUnit : '次' }}
+        </template>
         <template #unitPriceCell="{ row }">
           {{ row.pricingType === '1' ? `` : row.cpFixedPricingRule?.unitPrice }}
         </template>

+ 4 - 1
src/service/ServiceItemsSystem.vue

@@ -124,7 +124,7 @@ const gridOptions = reactive<VxeGridProps<SystemItemModel>>({
     { field: 'name', title: '项目名称' },
     { field: 'conditioningProgramType', title: '方案类型' },
     { field: 'cpFixedPricingRule.unitPrice', title: '单价(元)', slots: { default: 'unitPriceCell' }, width: 150 },
-    { field: 'cpFixedPricingRule.pricingUnit', title: '计价单位' },
+    { field: 'cpFixedPricingRule.pricingUnit', title: '计价单位', slots: { default: 'pricingUnitCell' } },
     { field: 'cpFixedPricingRule.convertDose', title: '计价说明', width: 150, slots: { default: 'convertDoseCell' } },
     { field: 'conditioningProgramSupplierName', title: '供应商' },
 
@@ -299,6 +299,9 @@ defineExpose({
     </header>
     <main class="flex-auto overflow-hidden">
       <vxe-grid ref="gridRef" v-bind="gridOptions" v-on="gridEvents" :loading="loading" @checkbox-change="onCheckboxChange" @checkbox-all="onCheckboxAll">
+        <template #pricingUnitCell="{ row }">
+          {{ row.cpFixedPricingRule?.pricingUnit ? row.cpFixedPricingRule?.pricingUnit : '次' }}
+        </template>
         <template #unitPriceCell="{ row }">
           <!-- {{ row.cpDynamicPricingRule }} -->
           {{ row.pricingType === '1' ? `` : row.cpFixedPricingRule?.unitPrice }}

+ 90 - 5
src/service/ServicePackageDetail.vue

@@ -19,7 +19,7 @@ let tableData = ref<any>({});
 async function getRecordDetail() {
   try {
     const res: any = await getConditioningRecordDetailMethod(props.data);
-    if(res){
+    if (res) {
       tableData.value = res;
     }
   } catch (error) {
@@ -99,13 +99,90 @@ const progressTextMap: Record<string, string> = {
   '3': '未开始',
   '4': '调理中',
   '5': '已完结',
-  '6': '待收货'
+  '6': '待收货',
 };
 
 const progressText = computed(() => {
   return progressTextMap[tableData.value?.progress] || '';
 });
-
+// 添加计算数量的函数
+function calculateCount(row: any) {
+  const pricingType = row.conditioningProgramDetail.pricingType;
+  const period = Number(row.days) || 0;
+  const frequency = Number(row.frequencyMeasure) || 0;
+  const maxCount = row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.max;
+  const acCount = (row.acuMeridianNames?.length ?? 0) + (row.acuPointNames?.length ?? 0);
+  // 一口价
+  // if (pricingType === '0') {
+  //   // 检查是否选择了"不限"
+  //   if (row.frequencyType === '不限') {
+  //     row.frequencyMeasure = ''; // 重置 frequencyMeasure
+  //     row.totalMeasure = 1;
+  //   } else {
+  //     const convertDose = Number(row.conditioningProgramDetail.cpFixedPricingRule.convertDose) || 0;
+  //     const frequencyType = Number(row.frequencyType) || 0;
+  //     row.totalMeasure = Math.ceil(((period / frequencyType) * frequency) / convertDose);
+  //   }
+  //   // 获取单价
+  //   const unitPrice = Number(row.conditioningProgramDetail?.cpFixedPricingRule?.unitPrice) || 0;
+  //   // 计算总价
+  //   row.totalPrice = (row.totalMeasure * unitPrice).toFixed(2);
+  // } else
+  if (pricingType === '1') {
+    // 按穴位计价
+    const frequencyType = Number(row.frequencyType) || 0;
+    row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
+    if (acCount > maxCount) {
+      if (row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.priceType === 0) {
+        // 单价
+        if (acCount > 0) {
+          let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[1].price * acCount;
+          row.unitPrice = unitPrice;
+          row.totalPrice = Math.ceil((period / frequencyType) * frequency) * unitPrice;
+        } else {
+          row.unitPrice = '-';
+          row.totalPrice = 0;
+        }
+      } else if (row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.priceType === 1) {
+        // 一口价
+        let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[1].price;
+        row.unitPrice = unitPrice;
+        row.totalPrice = row.conditioningProgramDetail.cpDynamicPricingRule[1].price * row.totalMeasure;
+      }
+    } else {
+      if (row.conditioningProgramDetail.cpDynamicPricingRule?.length > 0) {
+        if (row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType === 0) {
+          // 单价
+          if (acCount > 0) {
+            let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[0].price * acCount;
+            row.unitPrice = unitPrice;
+            row.totalPrice = Math.ceil((period / frequencyType) * frequency) * unitPrice;
+          } else {
+            row.unitPrice = '-';
+            row.totalPrice = 0;
+          }
+        } else if (row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType === 1) {
+          // 一口价
+          let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[0].price;
+          row.unitPrice = unitPrice;
+          row.totalPrice = row.conditioningProgramDetail.cpDynamicPricingRule[0].price * row.totalMeasure;
+        }
+      }
+    }
+  }
+}
+watch(
+  () => tableData?.value?.items,
+  (newData) => {
+    if (!newData) return;
+    newData.forEach((row: any) => {
+      if (row?.days || row?.frequencyType || row?.frequencyMeasure) {
+        calculateCount(row);
+      }
+    });
+  },
+  { deep: true }
+);
 </script>
 
 <template>
@@ -221,8 +298,16 @@ const progressText = computed(() => {
         </vxe-column>
         <vxe-column field="conditioningProgramDetail.conditioningProgramType" title="方案类型" align="center" />
         <vxe-column field="totalMeasure" title="数量" align="center" />
-        <vxe-column field="conditioningProgramDetail.cpFixedPricingRule.pricingUnit" title="单位" align="center" />
-        <vxe-column field="conditioningProgramDetail.cpFixedPricingRule.unitPrice" title="单价(元)" align="center" />
+        <vxe-column field="conditioningProgramDetail.cpFixedPricingRule.pricingUnit" title="单位" align="center">
+          <template #default="{ row }">
+            {{ row.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit ? row.conditioningProgramDetail?.cpFixedPricingRule?.pricingUnit : '次' }}
+          </template>
+        </vxe-column>
+        <vxe-column field="conditioningProgramDetail.cpFixedPricingRule.unitPrice" title="单价(元)" align="center">
+          <template #default="{ row }">
+            {{ row.conditioningProgramDetail?.pricingType === '0' ? row.conditioningProgramDetail?.cpFixedPricingRule?.unitPrice : row.unitPrice  }}
+          </template>
+        </vxe-column>
         <vxe-column field="totalPrice" title="总价(元)" align="center" />
         <vxe-column field="conditioningProgramDetail.medicineNames" title="组成" align="center" />
         <vxe-column field="acuPointNames" title="穴位/经络/部位" align="center" />