modified: .env.development
new file: src/api/home.js
new file: src/assets/404_images/bg.png
modified: src/main.js
modified: src/views/home/index.vue
modified: src/views/standardLibrary/index.vue
| | |
| | | ENV = 'development' |
| | | |
| | | # base api |
| | | VUE_APP_BASE_API = 'http://localhost:1234/' |
| | | VUE_APP_BASE_API = 'http://192.168.110.87:1234/' |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | //è·åå·²æ£éªtop3 |
| | | export function getVerifiedTop3(params) { |
| | | return request({ |
| | | url: '/home/checktop3', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | //è·åæªæ£éªtop4 |
| | | export function getUncheckedTop4(params) { |
| | | return request({ |
| | | url: '/home/unchecktop4', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | //è·å忿䏿ååæ ¼ç |
| | | export function getMatAndFinshQualified(params) { |
| | | return request({ |
| | | url: '/home/qualified', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | //è·åæ£éªä¸æªæ£éªçååä¸é¡¹ç®çæ°é |
| | | export function getCheckAndProjectNum(params) { |
| | | return request({ |
| | | url: '/home/checkProjectNum', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | |
| | | import store from './store' |
| | | import router from './router' |
| | | |
| | | //å¼å
¥echarts |
| | | import echarts from 'echarts' |
| | | Vue.prototype.$echarts = echarts |
| | | |
| | | |
| | | import '@/icons' // icon |
| | | import '@/permission' // permission control |
| | | |
| | |
| | | <template> |
| | | <div class="home-main"> |
| | | <div class="home-header-welcome"> |
| | | <div class="welcome-left"> |
| | | <div class="left-avatar" /> |
| | | <div class="left-tips"> |
| | | <div>Hi jackï¼æ¬¢è¿ä½¿ç¨ZT-LIMS</div> |
| | | <div>ä»å¤©æ¯2023å¹´07æ07æ¥ ææäº</div> |
| | | </div> |
| | | <div class="content-main"> |
| | | <div class="echart1"> |
| | | <el-row :gutter="10"> |
| | | <el-col :span="16"> |
| | | <el-card class="box-card" :body-style="{ padding: '0px 10px',height:'120px' }"> |
| | | <p style="font-size: 10px;margin-left: 10px;">æ£éªæ»æ°ç»è®¡</p> |
| | | <el-row :gutter="10"> |
| | | <el-col :span="6" > |
| | | <img :src="imgSrc" /> |
| | | <div class="card-text"> |
| | | <h6>æ£éªåå·²æ£éªæ»æ°</h6> |
| | | <p>{{insNum}}</p> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <img :src="imgSrc"/> |
| | | <div class="card-text"> |
| | | <h6>æ£éªåæªæ£éªæ»æ°</h6> |
| | | <p>{{insUnNum}}</p> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <img :src="imgSrc"/> |
| | | <div class="card-text"> |
| | | <h6>æ£éªé¡¹ç®å·²æ£éªæ»æ°</h6> |
| | | <p>{{insproNum}}</p> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <img :src="imgSrc"/> |
| | | <div class="card-text"> |
| | | <h6>æ£éªé¡¹ç®æªæ£éªæ»æ°</h6> |
| | | <p>{{insproUnNum}}</p> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-card class="box-card" :body-style="{ padding: '0px',height:'120px' }"> |
| | | <p style="font-size: 10px;margin-left: 10px;color: #2fcf10;">å·²æ£éª</p> |
| | | <el-table |
| | | :data="verifiedData" |
| | | :default-sort = "{prop: 'date', order: 'descending'}" |
| | | :cell-style="{margin:'0',padding:'2px 0px'}" |
| | | :header-cell-style="{margin:'0',padding:'0',backgroundColor:'#f0f7ff',color:'#0050a7'}"> |
| | | <el-table-column prop="no" label="æå" sortable width="110"></el-table-column> |
| | | <el-table-column prop="result" label="æ£éªç»è®º" width="110"></el-table-column> |
| | | <el-table-column prop="num" label="æ£éªæ°é" sortable width="110"></el-table-column> |
| | | <el-table-column prop="chact" label="æ£éªå æ¯" sortable width="110"></el-table-column> |
| | | </el-table> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="welcome-right"> |
| | | <div class="right-centent"> |
| | | <div>å³å°è¶
æå¾
å</div> |
| | | <div>ææ </div> |
| | | </div> |
| | | <div /> |
| | | <div class="right-centent"> |
| | | <div>å·²è¶
æå¾
å</div> |
| | | <div>21</div> |
| | | </div> |
| | | <div class="echart2"> |
| | | <el-row :gutter="10"> |
| | | <el-col :span="6"> |
| | | <el-card :body-style="{ padding: '0px',height:'180px' }"> |
| | | <p>åææåæ ¼ç</p> |
| | | <div id="materialPieChart" style="width:100%;height:180px"></div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-card :body-style="{ padding: '0px',height:'180px' }"> |
| | | <p>æååæ ¼ç</p> |
| | | <div id="finishedPieChart" style="width:100%;height:180px"></div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-card :body-style="{ padding: '0px',height:'180px' }"> |
| | | <p style="z-index: 10;position: absolute;font-size: 10px;margin-left: 10px;color: #ff0000;">æªæ£éª</p> |
| | | <el-table |
| | | :data="uncheckedData" |
| | | :cell-style="{margin:'0px',padding:'3px 0px'}" |
| | | :header-cell-style="{margin:'0px',padding:'3px 0px',backgroundColor:'#f0f7ff',color:'#0050a7'}"> |
| | | <el-table-column prop="no" label="åºå·" width="100"></el-table-column> |
| | | <el-table-column prop="name" label="å¾
æ£é¡¹ç®" width="120"></el-table-column> |
| | | <el-table-column prop="instrumentname" label="设å¤" width="120"></el-table-column> |
| | | <el-table-column prop="startTime" label="æ£éªæ¶é´" width="120"> |
| | | </el-table-column><el-table-column prop="checkname" label="æ£éªäºº" width="120"> |
| | | </el-table-column><el-table-column prop="endTime" label="é¢è®¡ç»ææ¶é´" width="120"></el-table-column> |
| | | </el-table> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="echart3"> |
| | | <el-card :body-style="{ padding: '0px',height:'300px' }"> |
| | | <el-radio-group class="button-group" :input="getDataByType(radioType)" v-model="radioType" size="mini"> |
| | | <el-radio-button label="æ¬å¨"></el-radio-button> |
| | | <el-radio-button label="æ¬æ"></el-radio-button> |
| | | <el-radio-button label="æ¬å¹´"></el-radio-button> |
| | | </el-radio-group> |
| | | <div id="barLineChart" style="width:100%;height:300px;"></div> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | <div class="content-main" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | import { getVerifiedTop3,getUncheckedTop4,getMatAndFinshQualified,getCheckAndProjectNum |
| | | } from '@/api/home' |
| | | export default { |
| | | name: "home", |
| | | data() { |
| | | return { |
| | | insNum: 0, |
| | | insUnNum: 0, |
| | | insproNum: 0, |
| | | insproUnNum: 1110, |
| | | radioType: "æ¬å¹´", |
| | | imgSrc: require("@/assets/404_images/bg.png"), |
| | | verifiedData: new Array(), |
| | | uncheckedData: new Array(), |
| | | } |
| | | }, |
| | | mounted(){ |
| | | this.getcheckProjectNum(); |
| | | this.getVerifiedData(); |
| | | this.getUncheckedData(); |
| | | this.getPieChart(); |
| | | }, |
| | | methods: { |
| | | async getcheckProjectNum(){ |
| | | const {data} = await getCheckAndProjectNum(); |
| | | this.insNum = data.insNum; |
| | | this.insUnNum = data.insUnNum; |
| | | this.insproNum = data.insproNum; |
| | | this.insproUnNum = data.insproUnNum; |
| | | }, |
| | | async getVerifiedData(){ |
| | | const { data } = await getVerifiedTop3(); |
| | | for(let i=0;i<data.length;i++){ |
| | | let val = ""; |
| | | if(data[i].result == 0){ |
| | | val = "ä¸åæ ¼"; |
| | | }else if(data[i].result == 1){ |
| | | val = "åæ ¼"; |
| | | }else{ |
| | | val = "æªæ£éª"; |
| | | } |
| | | this.verifiedData.push ({ |
| | | no: i+1, |
| | | result: val, |
| | | num: data[i].num, |
| | | chact: data[i].chact + '%' |
| | | }) |
| | | } |
| | | }, |
| | | async getUncheckedData(){ |
| | | const {data} = await getUncheckedTop4(); |
| | | for(let i=0;i<data.length;i++){ |
| | | this.uncheckedData.push ({ |
| | | no: i+1, |
| | | name: data[i].name, |
| | | instrumentname: data[i].instrumentname, |
| | | startTime: data[i].startTime, |
| | | checkname: data[i].checkname, |
| | | endTime: data[i].endTime |
| | | }) |
| | | } |
| | | }, |
| | | initPieChart(elementId,data){ |
| | | var chartDom = document.getElementById(elementId); |
| | | var myChart = echarts.init(chartDom); |
| | | window.addEventListener('resize', function() { |
| | | myChart.resize(); |
| | | }); |
| | | var option; |
| | | option = { |
| | | tooltip: { |
| | | trigger: 'item' |
| | | }, |
| | | legend: { |
| | | orient: 'vertical', |
| | | right: 'right', |
| | | top: 'center', |
| | | left: 20 |
| | | }, |
| | | series: [ |
| | | { |
| | | type: 'pie', |
| | | radius: ['40%', '70%'], |
| | | tooltip: { |
| | | valueFormatter: function(value){ |
| | | return value + '%'; |
| | | } |
| | | }, |
| | | avoidLabelOverlap: false, |
| | | label: { |
| | | show: false, |
| | | position: 'center', |
| | | }, |
| | | labelLine: { |
| | | show: false |
| | | }, |
| | | data: data |
| | | } |
| | | ] |
| | | }; |
| | | |
| | | option && myChart.setOption(option); |
| | | }, |
| | | async getPieChart(){ |
| | | const {data} = await getMatAndFinshQualified(); |
| | | let material = [ |
| | | { value: data.material, name: 'åæ ¼',itemStyle:{color: '#91cc75'} }, |
| | | { value: data.unmaterial, name: 'ä¸åæ ¼',itemStyle:{color: '#fac858'} }, |
| | | { value: data.notmaterial, name: 'å¾
æ£éª' }, |
| | | ] |
| | | let finished = [ |
| | | { value: data.finished, name: 'åæ ¼',itemStyle:{color: '#91cc75'} }, |
| | | { value: data.unfinished, name: 'ä¸åæ ¼',itemStyle:{color: '#fac858'} }, |
| | | { value: data.notfinished, name: 'å¾
æ£éª' }, |
| | | ] |
| | | //渲æé¥¼ç¶å¾ |
| | | this.initPieChart("materialPieChart",material); |
| | | this.initPieChart("finishedPieChart",finished); |
| | | }, |
| | | async getDataByType(label){ |
| | | const xAxis = ['䏿', 'äºæ', '䏿', 'åæ', 'äºæ', 'å
æ', '䏿','å
«æ','乿','åæ','å䏿','åäºæ'] |
| | | const bar1Data = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]; |
| | | const bar2Data = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]; |
| | | const line1Data = [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]; |
| | | const line2Data = [3.0, 4.2, 6.3, 5.5, 8.3, 13.2, 20.3, 13.4, 23.0, 21.5, 2.0, 33.2]; |
| | | switch(label){ |
| | | case "æ¬å¹´": |
| | | this.initBarAndLineChart(xAxis,bar1Data,bar2Data,line1Data,line2Data); |
| | | break; |
| | | case "æ¬æ": |
| | | let arr = new Array(); |
| | | for(let i=1;i<=31;i++){ |
| | | arr.push(i); |
| | | } |
| | | this.initBarAndLineChart(arr,bar1Data,bar2Data,line1Data,line2Data); |
| | | break; |
| | | case "æ¬å¨": |
| | | let arr2 = new Array("å¨ä¸","å¨äº","å¨ä¸","å¨å","å¨äº","å¨å
","卿¥"); |
| | | this.initBarAndLineChart(arr2,bar1Data,bar2Data,line1Data,line2Data); |
| | | break |
| | | } |
| | | }, |
| | | initBarAndLineChart(xAxis,bar1Data,bar2Data,line1Data,line2Data){ |
| | | var chartDom = document.getElementById('barLineChart'); |
| | | var myChart = echarts.init(chartDom); |
| | | window.addEventListener('resize', function() { |
| | | myChart.resize(); |
| | | }); |
| | | var option; |
| | | option = { |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | axisPointer: { |
| | | type: 'cross', |
| | | crossStyle: { |
| | | color: '#999' |
| | | } |
| | | } |
| | | }, |
| | | legend: { |
| | | data: ['åæææ£éª', 'æåæ£éª', 'åææåæ ¼ç','æååæ ¼ç'] |
| | | }, |
| | | xAxis: [ |
| | | { |
| | | type: 'category', |
| | | data: xAxis, |
| | | axisPointer: { |
| | | type: 'shadow' |
| | | } |
| | | } |
| | | ], |
| | | yAxis: [ |
| | | { |
| | | type: 'value', |
| | | name: 'æ£éªæ°é', |
| | | min: 0, |
| | | max: 1000, |
| | | interval: 100, |
| | | axisLabel: { |
| | | formatter: '{value}' |
| | | } |
| | | }, |
| | | { |
| | | type: 'value', |
| | | name: 'åæ ¼ç', |
| | | min: 0, |
| | | max: 100, |
| | | interval: 10, |
| | | axisLabel: { |
| | | formatter: '{value} %' |
| | | } |
| | | } |
| | | ], |
| | | series: [ |
| | | { |
| | | name: 'åæææ£éª', |
| | | type: 'bar', |
| | | tooltip: { |
| | | valueFormatter: function (value) { |
| | | return value; |
| | | } |
| | | }, |
| | | data: bar1Data |
| | | }, |
| | | { |
| | | name: 'æåæ£éª', |
| | | type: 'bar', |
| | | tooltip: { |
| | | valueFormatter: function (value) { |
| | | return value ; |
| | | } |
| | | }, |
| | | data: bar2Data |
| | | }, |
| | | { |
| | | name: 'åææåæ ¼ç', |
| | | smooth: true, |
| | | type: 'line', |
| | | yAxisIndex: 1, |
| | | tooltip: { |
| | | valueFormatter: function (value) { |
| | | return value + ' %'; |
| | | } |
| | | }, |
| | | data: line1Data |
| | | }, |
| | | { |
| | | name: 'æååæ ¼ç', |
| | | smooth: true, |
| | | type: 'line', |
| | | yAxisIndex: 1, |
| | | tooltip: { |
| | | valueFormatter: function (value) { |
| | | return value + ' %'; |
| | | } |
| | | }, |
| | | data: line2Data |
| | | } |
| | | ] |
| | | }; |
| | | option && myChart.setOption(option); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .home-main{ |
| | | .home-header-welcome{ |
| | | width: 100%; |
| | | background: #fff; |
| | | height: 84px; |
| | | display: flex; |
| | | border-bottom: 1px solid #f0f2f5; |
| | | padding: 8px 24px 12px 24px; |
| | | justify-content: space-between; |
| | | .welcome-left{ |
| | | display: flex; |
| | | align-items: center; |
| | | height: 100%; |
| | | .left-avatar{ |
| | | width: 56px; |
| | | height: 56px; |
| | | margin-right: 24px; |
| | | background: #0077DB; |
| | | border-radius: 50%; |
| | | .content-main{ |
| | | .echart1{ |
| | | .el-table{ |
| | | font-weight: bold; |
| | | width: 100%; |
| | | height:100; |
| | | padding:0px; |
| | | margin-left:10px; |
| | | } |
| | | .box-card img{ |
| | | width:100%; |
| | | height:100px; |
| | | border-radius: 10px; |
| | | } |
| | | .box-card .card-text{ |
| | | position: absolute; |
| | | top:0px; |
| | | h6{ |
| | | margin:10px 15px; |
| | | } |
| | | p{ |
| | | width:100%; |
| | | text-align: right; |
| | | font-size: 25px; |
| | | } |
| | | } |
| | | } |
| | | .echart2 { |
| | | .el-table{ |
| | | font-weight: bold; |
| | | width: 100%; |
| | | height:100; |
| | | padding:0px; |
| | | margin-left:10px; |
| | | padding-top:40px; |
| | | } |
| | | .left-tips{ |
| | | height: 80%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | >div:nth-child(1){ |
| | | font-size: 20px; |
| | | color: #303133; |
| | | } |
| | | >div:nth-child(2){ |
| | | font-size: 14px; |
| | | color: #606266; |
| | | } |
| | | .el-col{ |
| | | margin: 10px 0; |
| | | } |
| | | p{ |
| | | position: absolute; |
| | | font-size: 10px; |
| | | margin-left: 10px; |
| | | color:black; |
| | | } |
| | | } |
| | | .welcome-right{ |
| | | width: 250px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | .right-centent{ |
| | | height: 80%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | align-items: flex-end; |
| | | >div:nth-child(1){ |
| | | color: #909399; |
| | | font-size: 14px; |
| | | } |
| | | >div:nth-child(2){ |
| | | font-size: 24px; |
| | | color: #c0c4cc; |
| | | } |
| | | } |
| | | >div:nth-child(2){ |
| | | width: 2px; |
| | | height: 70%; |
| | | background: #f0f2f5; |
| | | } |
| | | .echart3 .button-group{ |
| | | margin-top: 10px; |
| | | margin-left: 88%; |
| | | z-index: 10; |
| | | } |
| | | } |
| | | } |
| | |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | |
| | | .el-table { |
| | | // .el-table { |
| | | // flex: 1; |
| | | // max-height: 680px; |
| | | // overflow-y: scroll; |
| | | } |
| | | // } |
| | | >div:nth-child(3){ |
| | | // height: 20px; |
| | | display: flex; |