Bladeren bron

新增列“药品编码”、“药品类别”、“是否中标”、“当月累计已审批计划”、“当月累计已入库数量”等

hsh 2 maanden geleden
bovenliggende
commit
c5766fc7e1
1 gewijzigde bestanden met toevoegingen van 58 en 2 verwijderingen
  1. 58 2
      src/views/yp-inventory/YpPlanDetails.vue

+ 58 - 2
src/views/yp-inventory/YpPlanDetails.vue

@@ -10,16 +10,23 @@
       <el-input v-model="content" class="w-50 m-2" style="width: 300px; margin-left: 5px">
         <template #prepend>审核意见 </template>
       </el-input>
+      <el-input v-model="supplyName" class="w-50 m-2" style="width: 300px; margin-left: 5px" clearable @change="queryYpPlanDetailsByGys">
+        <template #prepend>供应商 </template>
+      </el-input>
       <el-button type="primary" icon="Check" @click="saveYpPlanData" style="margin-left: 5px">审核</el-button>
     </div>
     <div class="layout_container">
       <div class="layout_main layout_el-table">
-        <el-table :data="showed_data" @sort-change="sort_charge" border stripe highlight-current-row>
+        <el-table :data="showed_data" @sort-change="sort_charge" border stripe highlight-current-row
+                  show-summary :summary-method="getSummaries">
           <el-table-column type="index" label="序号" width="60" fixed/>
           <el-table-column prop="remark" label="备注" width="100" fixed/>
           <el-table-column prop="supplyName" label="药品供应商" width="200" show-overflow-tooltip fixed/>
+          <el-table-column prop="chargeCode" label="药品编码" width="80" show-overflow-tooltip fixed/>
           <el-table-column prop="drugName" label="药品名称" width="200" show-overflow-tooltip fixed/>
           <el-table-column prop="specification" label="规格" width="150" show-overflow-tooltip/>
+          <el-table-column prop="drugKind" label="药品类别" width="100"/>
+          <el-table-column prop="isWinning" label="是否中标" width="100"/>
           <el-table-column prop="packRetprice1" label="零售价" width="100"/>
           <el-table-column prop="buyPrice1" label="购入价" width="100"/>
           <el-table-column prop="buyAmount" label="采购计划" width="100">
@@ -30,6 +37,8 @@
           <el-table-column prop="buyMoney" label="购入金额" width="100" sortable/>
           <el-table-column prop="unit" label="单位" width="60" />
           <el-table-column prop="amount" label="库存量" width="100" />
+          <el-table-column prop="planTotal" label="当月累计已审批计划量" width="100" />
+          <el-table-column prop="realTotal" label="当月累计实际入库量" width="100" />
           <el-table-column prop="manuName" label="制药厂" width="150" show-overflow-tooltip/>
           <el-table-column prop="amount3" label="3天用量" width="100" />
           <el-table-column prop="amount7" label="7天用量" width="100" />
@@ -52,7 +61,7 @@
 </template>
 <script setup name="YpPlanDetails">
 import { ref, onMounted, nextTick, watch } from 'vue'
-import {updateYpPlanAuditData, saveYpPlanDetail} from "@/api/yp-inventory/yp-plan-info.js";
+import {updateYpPlanAuditData, saveYpPlanDetail, selectYpPlanDetail} from "@/api/yp-inventory/yp-plan-info.js";
 import {ElMessage, ElMessageBox} from "element-plus";
 
 const props = defineProps({
@@ -73,6 +82,7 @@ const ypPlanDetailData = ref([])
 const totalFee = ref(0)
 const totalFeeUpdate = ref(0)
 const content = ref('')
+const supplyName = ref('')
 const form = ref({})
 const emit = defineEmits(['close', 'closeYpPlanDetails'])
 const showed_data = ref([])
@@ -196,4 +206,50 @@ const updateYpPlanAudit = () => {
         });
       })
 }
+
+const queryYpPlanDetailsByGys = () => {
+  const dataParam = ref({
+    fileId: props.ypPlanDetails[0].fileId,
+    supplyName: supplyName.value
+  })
+  selectYpPlanDetail(dataParam.value).then((res) => {
+    ypPlanDetailData.value = res
+    showed_data.value = ypPlanDetailData.value.slice((currentPageMx.value - 1) * pageSizeMx.value, currentPageMx.value * pageSizeMx.value)
+  })
+}
+
+const getSummaries = (param) => {
+  const { columns, data } = param
+  const sums = []
+
+  columns.forEach((column, index) => {
+    if (index === 0) {
+      sums[index] = h('div', { style: { textDecoration: 'underline' } }, [
+        '小计',
+      ])
+      return
+    }
+    if(column.property !== 'buyMoney'){
+      return;
+    }
+    const values = data.map((item) => Number(item[column.property]))
+    if (!values.every((value) => Number.isNaN(value))) {
+      sums[index] = values.reduce((prev, curr) => {
+        const value = Number(curr)
+        if (!Number.isNaN(value)) {
+          return prev + curr
+        } else {
+          return prev
+        }
+      }, 0)
+      sums[1] = sums[index].toFixed(2)
+      sums[index] = ''
+    } else {
+      sums[1] = 0
+      sums[index] = ''
+    }
+  })
+
+  return sums
+}
 </script>