|
@@ -9,60 +9,154 @@
|
|
|
<statistics :imgUrl="require('@/assets/img/1700228167058.jpg')" titles="库存总量" subhea="931"></statistics>
|
|
|
</bgPure>
|
|
|
</div>
|
|
|
- <cards>
|
|
|
+ <div class="home-echarts">
|
|
|
+ <cards class="home-echarts-card2">
|
|
|
+ <template #card-tit>
|
|
|
+ 库存统计-图表
|
|
|
+ </template>
|
|
|
+ <template #card-content>
|
|
|
+ <echartBarRow id="bar1" :lineData="data.lineData"></echartBarRow>
|
|
|
+ </template>
|
|
|
+ </cards>
|
|
|
+ <cards class="home-echarts-card1">
|
|
|
<template #card-tit>
|
|
|
<div style="display: flex;align-items: center;">
|
|
|
- <p>单位(栋)</p>
|
|
|
- <div style="display: flex;align-items: center;margin:0 30px ;">
|
|
|
+ <!-- <p>单位(栋)</p> -->
|
|
|
+ <div style="display: flex;align-items: center;margin:0 30px 0 0;">
|
|
|
<div style="width: 15px;height: 15px;border-radius: 50%;background: #2251f7;"></div>
|
|
|
- <p style="margin-left: 10px;">楼宇数量</p>
|
|
|
+ <p style="margin-left: 10px;">出库</p>
|
|
|
</div>
|
|
|
<div style="display: flex;align-items: center;">
|
|
|
<div style="width: 15px;height: 15px;border-radius: 50%;background: #fd8c38;"></div>
|
|
|
- <p style="margin-left: 10px;">写字楼数量</p>
|
|
|
+ <p style="margin-left: 10px;">入库</p>
|
|
|
+ </div>
|
|
|
+ <div style="display: flex;align-items: center;margin:0 30px ;">
|
|
|
+ <div style="width: 15px;height: 15px;border-radius: 50%;background: rgb(56, 225, 202);"></div>
|
|
|
+ <p style="margin-left: 10px;">销售出库</p>
|
|
|
+ </div>
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <div style="width: 15px;height: 15px;border-radius: 50%;background: rgb(253, 109, 151);"></div>
|
|
|
+ <p style="margin-left: 10px;">采购入库</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <template #card-subhead>行政区划选择</template>
|
|
|
+ <!-- <template #card-subhead>行政区划选择</template> -->
|
|
|
<template #card-content>
|
|
|
<echartbar id="bar0"></echartbar>
|
|
|
</template>
|
|
|
</cards>
|
|
|
+ </div>
|
|
|
+ <cards style="margin-top: 20px;">
|
|
|
+ <template #card-tit>
|
|
|
+ 库存统计-表格
|
|
|
+ </template>
|
|
|
+ <template #card-subhead>
|
|
|
+ <el-select v-model.number="data.initParam.productId" filterable remote reserve-keyword placeholder="疫苗名称"
|
|
|
+ :remote-method="remoteMethod1" :loading="loading" clearable style="width: 200px;"
|
|
|
+ @clear="data.initParam.productId = null" @click="click1" @change="changeFun">
|
|
|
+ <el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ <template #card-content>
|
|
|
+ <tables ref="TableRef" :requestApi="homeList" :columns="columns" :initParam="data.initParam"></tables>
|
|
|
+ </template>
|
|
|
+ </cards>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { reactive, provide, onMounted } from "vue";
|
|
|
+import { homeList,productList } from "@/api";
|
|
|
+import { provide, onMounted, reactive,ref } from "vue";
|
|
|
import echartbar from '@/components/echart/echart-bar.vue'
|
|
|
-import echartbarlR from '@/components/echart/echart-bar-LR.vue'
|
|
|
-import echartline from '@/components/echart/echart-line.vue'
|
|
|
+import echartBarRow from '@/components/echart/echart-bar-row.vue'
|
|
|
import bgPure from '@/components/bgPure.vue'
|
|
|
import cards from '@/components/card.vue'
|
|
|
import statistics from '@/components/statistics.vue'
|
|
|
import { userInfo } from "@/api";
|
|
|
import { useStore } from "vuex";
|
|
|
+import tables from "@/components/table.vue";
|
|
|
import * as echarts from 'echarts'
|
|
|
provide('echart', echarts)
|
|
|
-const data = reactive({
|
|
|
- tableData: [],
|
|
|
- tabData: [
|
|
|
- { label: "疫苗名称", name: "first" },
|
|
|
- { label: "生产企业", name: "second" },
|
|
|
- { label: "规格", name: "third" },
|
|
|
- { label: "剂型", name: "fourth" },
|
|
|
- { label: "单位", name: "fourth1" },
|
|
|
- ]
|
|
|
-})
|
|
|
const store = useStore()
|
|
|
+const TableRef = ref()
|
|
|
//获取用户信息
|
|
|
-const getuserInfoApi = async ()=>{
|
|
|
- const result:any = await userInfo({})
|
|
|
- if(result.code==200)store.commit('setIsUserInfo', result.data) //存储用户个人信息
|
|
|
-}
|
|
|
-onMounted(()=>{
|
|
|
- getuserInfoApi()
|
|
|
+const getuserInfoApi = async () => {
|
|
|
+ const result: any = await userInfo({})
|
|
|
+ if (result.code == 200) store.commit('setIsUserInfo', result.data) //存储用户个人信息
|
|
|
+}
|
|
|
+// 渲染表格
|
|
|
+const columns: any = [
|
|
|
+ { type: 'index', label: '编号', width: 80, },
|
|
|
+ { prop: 'product_name', label: '疫苗名称'},
|
|
|
+ { prop: 'spec_name', label: '规格(剂/支或粒)'},
|
|
|
+ { prop: 'balance', label: '数量', },
|
|
|
+ { prop: 'unit_name', label: '单位'},
|
|
|
+]
|
|
|
+interface ListItem {
|
|
|
+ value: string
|
|
|
+ label: string
|
|
|
+}
|
|
|
+const list1 = ref<ListItem[]>([])//疫苗名称
|
|
|
+const options1 = ref<ListItem[]>([])
|
|
|
+const loading = ref(false)
|
|
|
+const remoteMethod1 = async (query: string) => {
|
|
|
+ if (query) {
|
|
|
+ loading.value = true
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false
|
|
|
+ options1.value = list1.value.filter((item: any) => {
|
|
|
+ return item.label.toLowerCase().includes(query.toLowerCase())
|
|
|
+ })
|
|
|
+ }, 200)
|
|
|
+ } else {
|
|
|
+ options1.value = []
|
|
|
+ }
|
|
|
+}
|
|
|
+const click1 = async () => { options1.value = list1.value }
|
|
|
+//请求参数
|
|
|
+const data: any = reactive({
|
|
|
+ initParam: {
|
|
|
+ specId: 0,
|
|
|
+ productId: null
|
|
|
+ },
|
|
|
+ lineData:[]
|
|
|
})
|
|
|
+//函数
|
|
|
+const changeFun = async ()=>{
|
|
|
+ if(data.initParam.productId=="") data.initParam.productId = null
|
|
|
+ TableRef.value?.getTableList()
|
|
|
+ homeListApi()
|
|
|
+}
|
|
|
+// 渲染表格
|
|
|
+onMounted(async () => {
|
|
|
+ const result1: any = await productList({ age: 1, pageSize: 999 })//疫苗名称
|
|
|
+ list1.value = findMap(result1.data.list, 'obj')
|
|
|
|
|
|
+})
|
|
|
+onMounted(() => {
|
|
|
+ getuserInfoApi()
|
|
|
+})
|
|
|
+//函数
|
|
|
+const homeListApi = async ()=>{
|
|
|
+ const result:any = await homeList({
|
|
|
+ "page": 1,
|
|
|
+ "pageSize": 9999,
|
|
|
+ "specId": 0,
|
|
|
+ "productId": data.initParam.productId
|
|
|
+ })
|
|
|
+ if(result.code==200 && result.msg=="查询成功"){
|
|
|
+ data.lineData = result.data?.list || []
|
|
|
+ }
|
|
|
+ console.log('result',result)
|
|
|
+}
|
|
|
+homeListApi()
|
|
|
+//函数
|
|
|
+const findMap = (arr: any, obj: any) => {
|
|
|
+ return arr.map((item: any) => {
|
|
|
+ return { value: obj == 'obj' ? item.id : item, label: obj == 'obj' ? item.name : item }
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
.home {
|
|
@@ -73,5 +167,11 @@ onMounted(()=>{
|
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
|
grid-gap: 20px;
|
|
|
}
|
|
|
+
|
|
|
+ &-echarts {
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
|
|
|
+ grid-gap: 20px;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|