|
@@ -0,0 +1,233 @@
|
|
|
+<template>
|
|
|
+ <page-layer>
|
|
|
+ <template #header>
|
|
|
+ <el-input v-model="keyCode" class="w-50 m-2" style="width: 360px" placeholder="请输入药品" clearable>
|
|
|
+ <template #prepend>关键字</template>
|
|
|
+ </el-input>
|
|
|
+ <el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期" :shortcuts="shortcuts" style="width: 360px;margin-left: 3px"></el-date-picker>
|
|
|
+ <el-select v-model="groupNo" placeholder="请选择药房" clearable style="width: 240px;margin-left: 3px">
|
|
|
+ <el-option v-for="item in groupNoList" :key="item.code" :label="item.name" :value="item.code">
|
|
|
+ <span style="float: left">{{ item.label }}</span>
|
|
|
+ <span style="float: right; color: var(--el-text-color-secondary); font-size: 13px;">
|
|
|
+ {{ item.value }}
|
|
|
+ </span>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button type="primary" icon="Search" @click="queryYpUsedQuantity" style="margin-left: 5px">查询</el-button>
|
|
|
+ <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">使用量导出</el-button>
|
|
|
+ </template>
|
|
|
+ <template #main>
|
|
|
+ <el-tabs :tab-position="tabPosition" style="height: 200px" class="demo-tabs">
|
|
|
+ <el-tab-pane label="药品使用量">
|
|
|
+ <el-table :data="ypUserdData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border
|
|
|
+ style="width: 100%" :height="tableHeight" highlight-current-row :row-style="rowStyle"
|
|
|
+ :table-layout="tableLayout">
|
|
|
+ <el-table-column type="index" label="排名" width="100" />
|
|
|
+ <el-table-column prop="code" label="编码" width="120" />
|
|
|
+ <el-table-column prop="serial" label="序号" width="100" />
|
|
|
+ <el-table-column prop="name" label="品名" width="300" />
|
|
|
+ <el-table-column prop="specification" label="规格" width="200" />
|
|
|
+ <el-table-column prop="packRetprice" label="零售价" width="180" />
|
|
|
+ <el-table-column prop="amount" label="数量" width="120" />
|
|
|
+ <el-table-column label="操作" fixed="right" width="200" align="center" header-align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button type="primary" size="small" @click="handleUserd(scope.row)">使用明细</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="handleStat(scope.row)">进销存计算</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="[15, 30, 45, 60]"
|
|
|
+ :total="ypUserdData.length" layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
|
|
|
+ @size-change="handleSizeChange" @current-change="handleCurrentChange">
|
|
|
+ </el-pagination>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="药品进销存">
|
|
|
+ <el-table :data="ypOutInData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border
|
|
|
+ style="width: 100%" :height="tableHeight" highlight-current-row :row-style="rowStyle">
|
|
|
+ <el-table-column type="index" label="序号" width="50" fixed />
|
|
|
+ </el-table>
|
|
|
+ <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="[15, 30, 45, 60]"
|
|
|
+ :total="ypOutInData.length" layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
|
|
|
+ @size-change="handleSizeChange" @current-change="handleCurrentChange">
|
|
|
+ </el-pagination>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </template>
|
|
|
+ </page-layer>
|
|
|
+ <el-dialog v-model="showUsedMx" :close-on-click-modal="false" :close-on-press-escape="false" :title="ypTitle"
|
|
|
+ class="yp-edit-dialog" width="80%" height="80%" destroy-on-close>
|
|
|
+ <YpUsedDetail :ypUsedMx="ypUsedDetail" />
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+<script setup name="YpOutInStat">
|
|
|
+import { ref, onMounted, nextTick } from 'vue'
|
|
|
+import PageLayer from '@/layout/PageLayer.vue'
|
|
|
+import store from '@/store'
|
|
|
+import { shortcuts, seltYearAndNowLast } from '@/data/shortcuts'
|
|
|
+import { formatDate, getDateRangeFormatDate } from '@/utils/date'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import { selectYpUsedQuantity, selectYpUsedMx, selectYpOutInStat } from "@/api/yp-inventory/yp-out-in-stat.js"
|
|
|
+import { selectYpGroupNameByYfFlag } from '@/api/yp-dict/yp-dict-info.js'
|
|
|
+import { Export } from '@/utils/ExportExcel'
|
|
|
+import { clone } from '@/utils/clone'
|
|
|
+import YpUsedDetail from '@/views/yp-inventory/YpUsedDetail.vue'
|
|
|
+
|
|
|
+const tabPosition = ref('top')
|
|
|
+const tableLayout = ref('fixed')
|
|
|
+const windowSize = store.state.app.windowSize;
|
|
|
+const tableHeight = windowSize.h / 1.15;
|
|
|
+const pageSize = ref(30)
|
|
|
+const currentPage = ref(1)
|
|
|
+const showUsedMx = ref(false)
|
|
|
+const ypTitle = ref('')
|
|
|
+const ypUsedDetail = ref([])
|
|
|
+
|
|
|
+const handleSizeChange = (val) => {
|
|
|
+ pageSize.value = val
|
|
|
+}
|
|
|
+const handleCurrentChange = (val) => {
|
|
|
+ currentPage.value = val
|
|
|
+}
|
|
|
+const start = formatDate(seltYearAndNowLast[0].value[0])
|
|
|
+const end = formatDate(seltYearAndNowLast[0].value[1])
|
|
|
+const keyCode = ref('')
|
|
|
+const groupNo = ref('')
|
|
|
+const dateRange = ref([])
|
|
|
+const groupNoList = ref([])
|
|
|
+const ypOutInData = ref([])
|
|
|
+const ypUserdData = ref([])
|
|
|
+const queryTerm = reactive({
|
|
|
+ startTime: '',
|
|
|
+ endTime: '',
|
|
|
+ keyCode: '',
|
|
|
+ groupNo: '',
|
|
|
+ code: '',
|
|
|
+})
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ nextTick(async () => {
|
|
|
+ queryYpGroupNameByYfFlag('')
|
|
|
+ queryTerm.startTime = start
|
|
|
+ queryTerm.endTime = end + ' 23:59:59'
|
|
|
+ dateRange.value = [start, end]
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
+// 查询所有药房明细
|
|
|
+const queryYpGroupNameByYfFlag = (val) => {
|
|
|
+ selectYpGroupNameByYfFlag(val, '1')
|
|
|
+ .then((res) => {
|
|
|
+ groupNoList.value = res
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ groupNoList.value = []
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 查询药品使用数量
|
|
|
+const queryYpUsedQuantity = () => {
|
|
|
+ if (dateRange.value) {
|
|
|
+ let dateS = getDateRangeFormatDate(dateRange.value)
|
|
|
+ queryTerm.startTime = dateS.startTime
|
|
|
+ queryTerm.endTime = dateS.endTime
|
|
|
+ } else {
|
|
|
+ queryTerm.startTime = start
|
|
|
+ queryTerm.endTime = end
|
|
|
+ ElMessage({
|
|
|
+ type: 'info',
|
|
|
+ message: '默认查询本月的数据',
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ queryTerm.keyCode = keyCode.value
|
|
|
+ queryTerm.groupNo = groupNo.value
|
|
|
+ selectYpUsedQuantity(queryTerm)
|
|
|
+ .then((res) => {
|
|
|
+ ypUserdData.value = res.resultData
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 查询药品明细
|
|
|
+const handleUserd = (row) => {
|
|
|
+ queryTerm.code = row.code
|
|
|
+ selectYpUsedMx(queryTerm).then((res) => {
|
|
|
+ ypTitle.value = '品名: ' + row.name
|
|
|
+ ypUsedDetail.value = res.resultData
|
|
|
+ showUsedMx.value = true
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const handleStat = (row) => {
|
|
|
+ queryTerm.code = row.code
|
|
|
+ alert('功能建设中。。。')
|
|
|
+}
|
|
|
+
|
|
|
+// 查询药品进销存记录
|
|
|
+const queryYpOutInStat = () => {
|
|
|
+ if (dateRange.value) {
|
|
|
+ let dateS = getDateRangeFormatDate(dateRange.value)
|
|
|
+ queryTerm.startTime = dateS.startTime
|
|
|
+ queryTerm.endTime = dateS.endTime
|
|
|
+ } else {
|
|
|
+ queryTerm.startTime = start
|
|
|
+ queryTerm.endTime = end
|
|
|
+ ElMessage({
|
|
|
+ type: 'info',
|
|
|
+ message: '默认查询本月的数据',
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ queryTerm.keyCode = keyCode.value
|
|
|
+ queryTerm.groupNo = groupNo.value
|
|
|
+ selectYpOutInStat(queryTerm)
|
|
|
+ .then((res) => {
|
|
|
+ ypOutInData.value = res
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+const rowStyle = (row, rowIndex) => {
|
|
|
+ if (row.row.days <= 0) {
|
|
|
+ return {
|
|
|
+ backgroundColor: "#e60012 !important",
|
|
|
+ color: "#28A458 !important",
|
|
|
+ cursor: "pointer",
|
|
|
+ };
|
|
|
+ } else if (row.row.days > 0 && row.row.days <= 7) {
|
|
|
+ return {
|
|
|
+ backgroundColor: "#ecd452 !important",
|
|
|
+ color: "#28A458 !important",
|
|
|
+ cursor: "pointer",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return { cursor: "pointer" };
|
|
|
+}
|
|
|
+
|
|
|
+// 导出慢病基础信息
|
|
|
+const exportData = () => {
|
|
|
+ if (ypUserdData.value.length === 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: "没有可以导出的数据!",
|
|
|
+ type: "warning",
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ const title = {
|
|
|
+ code: "编码",
|
|
|
+ serial: "序号",
|
|
|
+ name: "品名",
|
|
|
+ specification: "规格",
|
|
|
+ packRetprice: "零售价",
|
|
|
+ amount: "数量",
|
|
|
+ };
|
|
|
+
|
|
|
+ const d = clone(ypUserdData.value)
|
|
|
+ Export(d, title, "药品使用量")
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|