Преглед на файлове

药品计划申请与审核优化

hsh преди 8 месеца
родител
ревизия
d4565db16d

+ 9 - 0
src/api/yp-inventory/yp-plan-info.js

@@ -44,4 +44,13 @@ export function updateYpPlanAuditData(data) {
         method: 'post',
         data
     })
+}
+
+// 保存药品审核时更新计划购买数量
+export function saveYpPlanDetail(data) {
+    return request({
+        url: '/ypPlan/saveYpPlanDetail',
+        method: 'post',
+        data
+    })
 }

+ 8 - 5
src/views/dictionary/personnel/DeptRoomDict.vue

@@ -91,7 +91,7 @@
                 <el-table-column prop="dept" label="大科室" width="120">
                   <template v-slot="scope">
                     <div v-if="scope.row.isEdit">
-                      <el-select v-model="scope.row.dept" placeholder="请选择大科室">
+                      <el-select v-model="scope.row.dept" placeholder="请选择大科室" filterable>
                         <el-option v-for="option in unitData" :key="option.code" :label="option.name"
                                    :value="option.code"></el-option>
                       </el-select>
@@ -107,7 +107,7 @@
                 <el-table-column prop="smallDept" label="小科室" width="280">
                   <template v-slot="scope">
                     <div v-if="scope.row.isEdit">
-                      <el-select v-model="scope.row.smallDept" placeholder="请选择小科室">
+                      <el-select v-model="scope.row.smallDept" placeholder="请选择小科室" filterable>
                         <el-option v-for="option in unitData" :key="option.code" :label="option.name"
                                    :value="option.code"></el-option>
                       </el-select>
@@ -445,7 +445,7 @@ const deleteRoomDept = (row) => {
 }
 // 病房科室字典增删改存结束
 
-// 药品字典-药品分类字典增删改存开始
+// 小科室字典增删改存开始
 // 编辑
 const editSmallDept = (row) => {
   // 备份原始数据
@@ -485,7 +485,10 @@ const updateSmallDept = (row) => {
 }
 
 const callSaveSmallDept = (row, oldDeptId) => {
-  let title = '请确认是否保存<span style="color:#d12020;">' + row.smallDept + '</span>?'
+  let deptData = unitData.value.filter((item) => {
+    return item.code.includes(row.smallDept)
+  })
+  let title = '请确认是否保存<span style="color:#d12020;">' + deptData[0].name + '</span>?'
   ElMessageBox.confirm(title, {
     cancelButtonText: '取消',
     confirmButtonText: '确定',
@@ -540,7 +543,7 @@ const deleteSmallDept = (row) => {
     }
   })
 }
-// 药品字典-药品分类字典增删改存结束
+// 小科室字典增删改存结束
 
 const exportData = () => {
   alert("功能建设中。。。")

+ 156 - 21
src/views/yp-inventory/YpPlanDetails.vue

@@ -1,14 +1,34 @@
 <template>
   <div class="layout_display_flex_y">
+    <div style="margin-bottom: 6px; background-color: #fff;">
+      <el-input v-model="totalFee" class="w-50 m-2" style="width: 240px;font-size: larger" disabled>
+        <template #prepend>总费用 </template>
+      </el-input>
+      <el-input v-model="totalFeeUpdate" class="w-50 m-2" style="width: 240px;font-size: larger; margin-left: 5px" disabled>
+        <template #prepend>审核费用 </template>
+      </el-input>
+      <el-input v-model="content" class="w-50 m-2" style="width: 300px; margin-left: 5px">
+        <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="ypPlanDetailData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border stripe highlight-current-row>
+        <el-table :data="showed_data" @sort-change="sort_charge" border stripe highlight-current-row>
           <el-table-column type="index" label="序号" width="60" fixed/>
-          <el-table-column prop="remark" label="备注" width="120" fixed/>
-          <el-table-column prop="drugName" label="药品名称" width="220" show-overflow-tooltip 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="drugName" label="药品名称" width="200" show-overflow-tooltip fixed/>
           <el-table-column prop="specification" label="规格" width="150" show-overflow-tooltip/>
-          <el-table-column prop="packRetprice" label="零售价" width="100"/>
-          <el-table-column prop="buyPrice" 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">
+            <template #default="scope">
+              <el-input v-model.number="scope.row.buyAmount" size="small" @change="buyAmountCharge(scope.row)" />
+            </template>
+          </el-table-column>
+          <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="manuName" label="制药厂" width="150" show-overflow-tooltip/>
           <el-table-column prop="amount3" label="3天用量" width="100" />
@@ -17,17 +37,14 @@
           <el-table-column prop="amount30" label="30天用量" width="100" />
           <el-table-column prop="amount60" label="60天用量" width="100" />
           <el-table-column prop="days" label="可用天数" width="100" />
-          <el-table-column prop="buyAmount" label="采购计划" width="100" />
-          <el-table-column prop="unit" label="单位" width="100" />
-          <el-table-column prop="buyFee" label="购入金额" width="100" />
           <el-table-column prop="impDate" label="导入时间" width="140" />
         </el-table>
       </div>
       <div>
-        <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="[10, 15, 20, 25]"
+        <el-pagination :current-page="currentPageMx" :page-size="pageSizeMx" :page-sizes="[10, 15, 20, 25]"
                        :total="ypPlanDetailData.length" layout="total, sizes, prev, pager, next, jumper"
-                       style="margin-top: 5px" @size-change="handleSizeChange"
-                       @current-change="handleCurrentChange">
+                       style="margin-top: 5px" @size-change="handleSizeChangeMx"
+                       @current-change="handleCurrentChangeMx">
         </el-pagination>
       </div>
     </div>
@@ -35,30 +52,148 @@
 </template>
 <script setup name="YpPlanDetails">
 import { ref, onMounted, nextTick, watch } from 'vue'
+import {updateYpPlanAuditData, saveYpPlanDetail} from "@/api/yp-inventory/yp-plan-info.js";
+import {ElMessage, ElMessageBox} from "element-plus";
 
 const props = defineProps({
   ypPlanDetails: {
     type: Object,
-    default: []
+    default: {}
+  },
+  formData: {
+    type: Object,
+    default: {}
+  },
+  zfy: {
+    type: Number,
+    default: 0
   }
 })
 const ypPlanDetailData = ref([])
-const pageSize = ref(20)
-const currentPage = ref(1)
-const handleSizeChange = (val) => {
-  pageSize.value = val
+const totalFee = ref(0)
+const totalFeeUpdate = ref(0)
+const content = ref('')
+const form = ref({})
+const emit = defineEmits(['close', 'closeYpPlanDetails'])
+const showed_data = ref([])
+const pageSizeMx = ref(20)
+const currentPageMx = ref(1)
+const handleSizeChangeMx = (val) => {
+  pageSizeMx.value = val
+  showed_data.value = props.ypPlanDetails.slice((currentPageMx.value - 1) * pageSizeMx.value, currentPageMx.value * pageSizeMx.value)
 }
-const handleCurrentChange = (val) => {
-  currentPage.value = val
+const handleCurrentChangeMx = (val) => {
+  currentPageMx.value = val
+  showed_data.value = props.ypPlanDetails.slice((currentPageMx.value - 1) * pageSizeMx.value, currentPageMx.value * pageSizeMx.value)
 }
 
-onMounted(() => {
+onMounted( () => {
   nextTick(() => {
-    ypPlanDetailData.value = props.ypPlanDetails
+    ypPlanDetailData.value = props.ypPlanDetails.sort(sortFun('buyMoney', false))
+    form.value = props.formData
+    totalFee.value = props.zfy
+    totalFeeUpdate.value = props.zfy
+    showed_data.value = ypPlanDetailData.value.slice(0, pageSizeMx.value)
   })
 })
-
 watch(() => props.ypPlanDetails, () => {
   ypPlanDetailData.value = props.ypPlanDetails
+  form.value = props.formData
+  totalFee.value = props.zfy
+  totalFeeUpdate.value = props.zfy
+  showed_data.value = props.ypPlanDetails.slice((currentPageMx.value - 1) * pageSizeMx.value, currentPageMx.value * pageSizeMx.value)
 })
+// 排序改变事件
+const sort_charge = (column) => {
+  currentPageMx.value = 1
+  if(column.order === null){
+    // 默认按照购入价的降序排序
+    ypPlanDetailData.value = ypPlanDetailData.value.sort(sortFun('buyFee', false))
+  } else {
+    ypPlanDetailData.value = ypPlanDetailData.value.sort(sortFun(column.prop, column.order === 'ascending'))
+  }
+  showed_data.value = ypPlanDetailData.value.slice(0, pageSizeMx.value) // 排序完显示到第一页
+}
+
+// 排序通用方法
+const sortFun = (attr, rev) => {
+  // 第一个参数传入info里面的prop表示排的是哪一列,第二个参数是升还是降排序
+  if(rev === undefined){
+    rev = 1
+  } else {
+    rev = (rev) ? 1 : -1
+  }
+  return function(a, b){
+    a = a[attr]
+    b = b[attr]
+    if(a < b){
+      return rev * -1
+    }
+    if(a > b){
+      return rev * 1
+    }
+    return 0
+  }
+}
+
+// 根据修改的购入计划(量)计算购入金额
+const buyAmountCharge = (row) => {
+  let dj = row.buyMoney
+  let money = (row.buyAmount * row.buyPrice1).toFixed(2)
+  if(money.endsWith(".00")){
+    row.buyMoney = money.replace(".00", "")
+  } else {
+    row.buyMoney = money
+  }
+  totalFeeUpdate.value = (totalFeeUpdate.value - dj + parseFloat(row.buyMoney)).toFixed(2)
+}
+
+// 保存审核内容
+const saveYpPlanData = () => {
+  ElMessageBox.confirm("确定审核?", {
+    cancelButtonText: '取消',
+    confirmButtonText: '确定',
+    type: 'warning',
+    distinguishCancelAndClose: true,
+    dangerouslyUseHTMLString: true
+  }).then(() => {
+    saveYpPlanDetail(ypPlanDetailData.value).then((res) => {
+      if (res.cg) {
+        ElMessage({
+          type: "success",
+          message: res.cg,
+          duration: 2500,
+          showClose: true,
+        });
+        updateYpPlanAudit()
+      }
+    })
+  })
+}
+
+// 保存审核意见等内容
+const updateYpPlanAudit = () => {
+  form.value.totalFee = totalFeeUpdate.value
+  form.value.content = content.value
+  updateYpPlanAuditData(form.value)
+      .then((res) => {
+        if (res.cg) {
+          ElMessage({
+            type: "success",
+            message: res.cg,
+            duration: 2500,
+            showClose: true,
+          });
+          emit('closeYpPlanDetails', true)
+        }
+      })
+      .catch(() => {
+        ElMessage({
+          type: "error",
+          message: '药品计划意见审核失败!',
+          duration: 2500,
+          showClose: true,
+        });
+      })
+}
 </script>

+ 61 - 55
src/views/yp-inventory/YpPlanInfo.vue

@@ -74,24 +74,10 @@
           </div>
           <el-dialog v-model="showYpPlanDetails" :close-on-click-modal="false" :before-close="handleClose"
                      :close-on-press-escape="false" :title="ypPlanDetailsTitle" width="80%" destroy-on-close>
-            <YpPlanDetails :ypPlanDetails="ypPlanDetails" @closeTempPurchaseAudit="closeYpPlanDetails"/>
+            <YpPlanDetails :ypPlanDetails="ypPlanDetails" @closeYpPlanDetails="closeYpPlanDetails"/>
           </el-dialog>
-          <el-dialog v-model="dialogFormVisible" title="审核" width="500" :close-on-click-modal="false" :close-on-press-escape="false" destroy-on-close>
-            <el-form :model="form">
-              <el-input v-model="form.fileId" v-if="false" />
-              <el-input v-model="form.type" v-if="false" />
-              <el-form-item label="审核意见" :label-width="formLabelWidth">
-                <el-input v-model="form.content" autocomplete="off" />
-              </el-form-item>
-            </el-form>
-            <template #footer>
-              <div class="dialog-footer">
-                <el-button @click="dialogFormVisible = false">取消</el-button>
-                <el-button type="primary" @click="updateYpPlanAudit">
-                  确认
-                </el-button>
-              </div>
-            </template>
+          <el-dialog v-model="dialogFormVisible" title="审核" width="80%" :close-on-click-modal="false" top="6vh" :close-on-press-escape="false" destroy-on-close>
+            <YpPlanDetails :ypPlanDetails="ypPlanDetails" :formData="formData" :zfy="zfy" @closeYpPlanDetails="closeYpPlanDetails"/>
           </el-dialog>
         </el-tab-pane>
         <el-tab-pane key="ypPlan" label="导入" name="ypPlan">
@@ -327,10 +313,10 @@ const queryYpPlanDetail = (row) => {
   selectYpPlanDetailById(data)
     .then((res) => {
       ypPlanDetails.value = res;
-      showYpPlanDetails.value = true;
+      // showYpPlanDetails.value = true;
     })
     .catch(() => {
-      ypPlanDetails.value = [];
+      ypPlanDetails.value = []
     });
 }
 const closeYpPlanDetails = (flag) => {
@@ -346,8 +332,7 @@ const handleClose = (done) => {
 
 
 const dialogFormVisible = ref(false)
-const formLabelWidth = '140px'
-const form = ref({
+const formData = ref({
   fileId: '', // 审核计划id
   content: '', // 审核意见
   trialAudit: '',
@@ -355,48 +340,69 @@ const form = ref({
   finalAudit: '',
   type: 0, // 审核类型(1:初审,2:复审,3:终审)
 })
+const zfy = ref(0)
 // 审核
 const trialAuditPlan = (row) => {
+  formData.value = {}
+  if(row.reviewAudit === '1' || row.finalAudit === '1'){
+    ElMessage({
+      type: "error",
+      message: '已经复审或者终审,无法再进行初审!',
+      duration: 2500,
+      showClose: true,
+    });
+    return false
+  }
+  formData.value.fileId = row.fileId
+  formData.value.type = 1
+  formData.value.trialAudit = '1'
+  zfy.value = row.totalFee
   dialogFormVisible.value = true
-  form.value.fileId = row.fileId
-  form.value.type = 1
-  form.value.trialAudit = '1'
+  queryYpPlanDetail(row)
 }
 const reviewAuditPlan = (row) => {
+  formData.value = {}
+  if(row.finalAudit === '1'){
+    ElMessage({
+      type: "error",
+      message: '已经终审,无法再进行复审!',
+      duration: 2500,
+      showClose: true,
+    });
+    return false
+  }
+  if(row.trialAudit !== '1'){
+    ElMessage({
+      type: "error",
+      message: '还未初审,无法进行复审!',
+      duration: 2500,
+      showClose: true,
+    });
+    return false
+  }
   dialogFormVisible.value = true
-  form.value.fileId = row.fileId
-  form.value.type = 2
-  form.value.reviewAudit = '1'
+  formData.value.fileId = row.fileId
+  formData.value.type = 2
+  formData.value.reviewAudit = '1'
+  zfy.value = row.totalFee
+  queryYpPlanDetail(row)
 }
 const finalAuditPlan = (row) => {
+  formData.value = {}
   dialogFormVisible.value = true
-  form.value.fileId = row.fileId
-  form.value.type = 3
-  form.value.finalAudit = '1'
-}
-const updateYpPlanAudit = () => {
-  dialogFormVisible.value = false
-  updateYpPlanAuditData(form.value)
-    .then((res) => {
-      if (res.cg) {
-        ElMessage({
-          type: "success",
-          message: res.cg,
-          duration: 2500,
-          showClose: true,
-        });
-        queryYpPlanInfoData()
-      }
-    })
-    .catch(() => {
-      ElMessage({
-        type: "error",
-        message: '药品计划审核失败!',
-        duration: 2500,
-        showClose: true,
-      });
-      queryYpPlanInfoData()
-    })
+  formData.value.fileId = row.fileId
+  formData.value.type = 3
+  formData.value.finalAudit = '1'
+  zfy.value = row.totalFee
+  queryYpPlanDetail(row)
 }
 
-</script>
+</script>
+<style scoped>
+:deep(.my-header) {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  gap: 16px;
+}
+</style>