refactor(api): 修改api结构

duizhaopin_ui
duan 2 years ago
parent 1379d19779
commit 5897db910b

@ -17,7 +17,7 @@
"axios": "0.18.1", "axios": "0.18.1",
"core-js": "3.6.5", "core-js": "3.6.5",
"echarts": "^5.3.3", "echarts": "^5.3.3",
"element-ui": "2.13.2", "element-ui": "2.15.7",
"js-cookie": "2.2.0", "js-cookie": "2.2.0",
"normalize.css": "7.0.0", "normalize.css": "7.0.0",
"nprogress": "0.2.0", "nprogress": "0.2.0",

@ -0,0 +1,27 @@
import request from '@/utils/request'
export function home_info(data) {
return request({
url: '/api/home/home_info',
method: 'post',
data
})
}
// /api/home/home_warning_list
export function home_warning_list(data) {
return request({
url: '/api/home/home_warning_list',
method: 'post',
data
})
}
// /api/home/home_drug_remaining
export function home_drug_remaining(data) {
return request({
url: '/api/home/home_drug_remaining',
method: 'post',
data
})
}

@ -2,7 +2,7 @@
export default { export default {
name: 'Scannner', name: 'Scannner',
// eslint-disable-next-line vue/require-prop-types // eslint-disable-next-line vue/require-prop-types
props: ['getCode'], props: ['getcode'],
data() { data() {
return { return {
codeValue: '', codeValue: '',

@ -25,9 +25,6 @@ import '@/permission' // permission contro
* please remove it before going online ! ! ! * please remove it before going online ! ! !
*/ */
import * as echarts from 'echarts' import * as echarts from 'echarts'
// 扫描
import VueBarcodeScanner from 'vue-barcode-scanner'
Vue.use(VueBarcodeScanner)
Vue.prototype.$echarts = echarts // 挂载到Vue实例上面 Vue.prototype.$echarts = echarts // 挂载到Vue实例上面

@ -1,4 +1,4 @@
import { logout } from '@/api/user' import { logout } from '@/api/user/user'
import { getToken, removeToken } from '@/utils/auth' import { getToken, removeToken } from '@/utils/auth'
import { resetRouter } from '@/router' import { resetRouter } from '@/router'

@ -71,7 +71,7 @@
<script> <script>
// import { validUsername } from '@/utils/validate' // import { validUsername } from '@/utils/validate'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
import { login } from '@/api/user' import { login } from '@/api/user/user'
export default { export default {
name: 'Login', name: 'Login',
data() { data() {

@ -1,5 +1,9 @@
<template> <template>
<div class="view-container"> <div
v-loading="loading"
class="view-container"
element-loading-text="拼命加载中"
>
<!-- 上半部分--> <!-- 上半部分-->
<div class="view-container-top"> <div class="view-container-top">
<div class="view-container-tl "> <div class="view-container-tl ">
@ -38,7 +42,17 @@
</div> </div>
<div class="view-container-tr view-content"> <div class="view-container-tr view-content">
<div class="header"> <div class="header">
<div class="title">库存余量</div> <div class="title">库存余量
<el-popover
placement="right"
title="怎么看试剂余量?"
width="200"
trigger="hover"
content="如“2/50”表示该试剂最后一次入库后共50瓶当前剩余2瓶。"
>
<i slot="reference" class="el-icon-warning-outline" />
</el-popover>
</div>
<div> <div>
<el-button size="small">查看全部</el-button> <el-button size="small">查看全部</el-button>
</div> </div>
@ -52,7 +66,7 @@
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
<el-select v-model="value" size="small" style="margin-right: 0" placeholder="请选择"> <el-select v-model="value" :disabled="rloading" size="small" style="margin-right: 0" placeholder="请选择">
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
@ -62,37 +76,36 @@
</el-select> </el-select>
</div> </div>
<div class="view"> <div class="view">
<div class="data-progress"> <el-table
<div class="data-progress-header"> v-loading="rloading"
<div>三氯甲烷</div><div>50/100</div> :data="remainingData"
</div> height="200"
<div> style="width: calc(100% - 1.25rem)"
<el-progress :percentage="50" :stroke-width="20" text-inside /> element-loading-text="拼命加载中"
</div> >
</div> <el-table-column
<div class="data-progress"> prop="name"
<div class="data-progress-header"> align="center"
<div>三氯甲烷</div><div>50/100</div> label="试剂名称"
</div> />
<div> <el-table-column
<el-progress :percentage="50" :stroke-width="24" text-inside /> prop="surplus_number"
</div> align="center"
</div> label="余量"
<div class="data-progress"> />
<div class="data-progress-header"> </el-table>
<div>三氯甲烷</div><div>50/100</div> <div style="text-align: center">
</div> <el-pagination
<div> layout="prev, pager, next"
<el-progress :percentage="50" :stroke-width="24" text-inside /> :total="rtotal"
</div> hide-on-single-page
:disabled="rloading"
:current-page.sync="rpage"
:page-size.sync="rpage_size"
@current-change="remainingPageChange"
/>
</div> </div>
</div> </div>
<div class="data-page">
<el-pagination
layout="prev, pager, next"
:total="1000"
/>
</div>
</div> </div>
</div> </div>
<!-- 下半部分--> <!-- 下半部分-->
@ -108,147 +121,370 @@
<div class="content" style="overflow: auto"> <div class="content" style="overflow: auto">
<el-table <el-table
:data="tableData" :data="tableData"
style="width: 100%"
height="170" height="170"
> >
<el-table-column <el-table-column
prop="date" align="center"
label="日期" prop="warning_date"
width="180" label="预警时间"
/> />
<el-table-column <el-table-column
prop="name" align="center"
label="姓名" prop="object_type"
width="180" label="预警信息类型"
>
<template slot-scope="scope">
{{ warning_data_map[scope.row.object_type-1] }}
</template>
</el-table-column>
<el-table-column
align="center"
prop="object_name"
label="对象"
/> />
<el-table-column <el-table-column
prop="address" show-overflow-tooltip
label="地址" align="center"
prop="warning_content"
label="内容"
/> />
<el-table-column
align="center"
prop="is_solve"
label="受理情况"
>
<template slot-scope="scope">
<el-tag :type="scope.row.is_solve === 0?'warning':'success' ">
{{ scope.row.is_solve === 0 ? '未受理':'已受理' }}
</el-tag>
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- align="center"-->
<!-- prop="address"-->
<!-- label="位置"-->
<!-- />-->
</el-table> </el-table>
</div> </div>
</div> </div>
</div> </div>
<div class="view-container-br"> <div class="view-container-br">
<div class="view-container-tr view-content"> <div class="view-container-tr view-content">
<div class="header"> <div class="header-warn">
<div class="title">预警信息总览</div> <div class="title">预警信息总览</div>
<div class="count">{{ warning_data_info.count_number }}</div>
<div class="desc">总计()</div>
</div> </div>
<div id="pie" /> <div id="pie" />
</div> </div>
</div> </div>
</div> </div>
<!-- // --> <!-- // -->
<el-dialog title="收货地址" :visible.sync="dialogTableVisible"> <el-dialog title="预警信息" width="70%" :visible.sync="dialogTableVisible">
<el-table :data="gridData"> <div class="header">
<el-table-column property="date" label="日期" width="150" /> <el-date-picker
<el-table-column property="name" label="姓名" width="200" /> v-model="start_time"
<el-table-column property="address" label="地址" /> size="small"
type="datetime"
placeholder="选择生产日期"
value-format="yyyy-MM-dd HH:mm:ss"
/>
<el-date-picker
v-model="end_time"
size="small"
type="datetime"
placeholder="选择过期日期"
value-format="yyyy-MM-dd HH:mm:ss"
/>
<el-select v-model="object_type" size="small" placeholder="请选择预警信息类型">
<el-option
v-for="(item,index) in warning_data_map"
:key="index"
:label="item"
:value="index + 1"
/>
</el-select>
<el-input v-model="seach_word" size="small" placeholder="请输入搜索试剂名称" />
<el-button size="small" :disabled="loadingReagent" type="primary" icon="el-icon-search" @click="searchData"></el-button>
</div>
<el-table
v-loading="loadingReagent"
:data="gridData"
height="400"
element-loading-text="拼命加载中"
:header-cell-style="headerStyle"
>
<el-table-column
align="center"
prop="warning_date"
label="预警时间"
/>
<el-table-column
align="center"
prop="object_type"
label="预警信息类型"
>
<template slot-scope="scope">
{{ warning_data_map[scope.row.object_type-1] }}
</template>
</el-table-column>
<el-table-column
align="center"
prop="object_name"
label="对象"
/>
<el-table-column
align="center"
show-overflow-tooltip
prop="warning_content"
label="内容"
/>
<el-table-column
align="center"
prop="is_solve"
label="受理情况"
>
<template slot-scope="scope">
<el-tag :type="scope.row.is_solve === 0?'warning':'success' ">
{{ scope.row.is_solve === 0 ? '未受理':'已受理' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
align="center"
prop="is_solve"
label="操作"
>
<template slot-scope="scope">
<el-button type="primary" size="small" @click="optClick(scope.row)"></el-button>
</template>
</el-table-column>
</el-table> </el-table>
<div style="text-align: center">
<el-pagination
layout="prev, pager, next"
hide-on-single-page
:disabled="loadingReagent"
:current-page.sync="page"
:total="total"
:page-size.sync="page_size"
@current-change="pageChange"
/>
</div>
<el-dialog <el-dialog
width="30%" width="50%"
title="内层 Dialog" title="预警详情"
:visible.sync="innerVisible" :visible.sync="innerVisible"
append-to-body append-to-body
/> >
<el-descriptions :column="2" border>
<el-descriptions-item label="预警对象" span="2">{{ rowData.object_name }}</el-descriptions-item>
<el-descriptions-item label="预警内容" span="2">{{ rowData.warning_content }}</el-descriptions-item>
<el-descriptions-item label="预警类型">{{ warning_data_map[rowData.object_type -1] }}</el-descriptions-item>
<el-descriptions-item label="预警来源">{{ rowData.object_name }}</el-descriptions-item>
<!-- <el-descriptions-item label="生产日期">{{ this.rowData.object_name }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="过期日期">{{ this.rowData.object_name }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="试剂余量">{{ this.rowData.object_name }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="所属终端">{{ this.rowData.object_name }}</el-descriptions-item>-->
<el-descriptions-item label="最后使用人"><el-tag>{{ rowData.warning_user_name }}</el-tag></el-descriptions-item>
<el-descriptions-item label="受理情况">
<el-tag :type="rowData.is_solve === 0?'warning':'success' ">
{{ rowData.is_solve === 0 ? '未受理':'已受理' }}
</el-tag>
</el-descriptions-item>
</el-descriptions>
<div style="text-align: center;margin-top: 20px">
<el-button>取消</el-button>
<el-button type="primary">确认受邀</el-button>
</div>
</el-dialog>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import Detail from '@/components/Detail/index' import Detail from '@/components/Detail/index'
import { home_info, home_warning_list, home_drug_remaining } from '@/api/reagent/overView'
import stringify from '@/utils/stringify'
export default { export default {
name: 'MainOverview', name: 'MainOverview',
components: { Detail }, components: { Detail },
data() { data() {
return { return {
headerStyle: { 'background': '#E6E6E6' },
loading: false,
dialogTableVisible: false, dialogTableVisible: false,
innerVisible: false, innerVisible: false,
myChart: null, myChart: null,
myChart2: null, myChart2: null,
warning_data_info: {},
warning_data_map: ['试剂临期', '试剂过期', '余量不足', '环境异常', '出库临期', '出库超期', '未称重'],
desc: [ desc: [
{ {
count: 90, count: 0,
desc: '今日入库', desc: '今日入库',
img: require('@/assets/3-主概览/今日入库.png') img: require('@/assets/3-主概览/今日入库.png')
}, },
{ {
count: 80, count: 0,
desc: '今日领用', desc: '今日领用',
img: require('@/assets/3-主概览/今日领用.png') img: require('@/assets/3-主概览/今日领用.png')
}, },
{ {
count: 70, count: 0,
desc: '今日归还', desc: '今日归还',
img: require('@/assets/3-主概览/今日归还.png') img: require('@/assets/3-主概览/今日归还.png')
}, },
{ {
count: 60, count: 0,
desc: '今日归还', desc: '今日归还',
img: require('@/assets/3-主概览/今日未归还.png') img: require('@/assets/3-主概览/今日未归还.png')
} }
], ],
tableData: [{ tableData: [],
date: '2016-05-02', options: [],
name: '王小虎', value: '',
address: '上海市普陀区金沙江路 1518 弄' radio1: '',
}, { gridData: [],
date: '2016-05-04', seach_word: '',
name: '王小虎', page: 1,
address: '上海市普陀区金沙江路 1517 弄' total: 0,
}, { page_size: 15,
date: '2016-05-01', start_time: '',
name: '王小虎', end_time: '',
address: '上海市普陀区金沙江路 1519 弄' object_type: '',
}, { loadingReagent: false,
date: '2016-05-03', rowData: {},
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄' remainingData: [],
}] rpage: 1,
rtotal: 0,
rpage_size: 15,
rclient_id: null,
rloading: false
} }
}, },
// dom created() {
mounted() { this.loading = true
this.getLoadEcharts() home_info().then(res => {
this.lineCharts() this.initDataFunc(res.data)
this.initAllCharts()
}).finally(() => (this.loading = false))
this.remainingPageChange(1)
},
beforeDestroy() {
window.removeEventListener('resize', () => {
this.myChart.resize()
this.myChart2.resize()
})
}, },
methods: { methods: {
remainingPageChange(page) {
this.rpage = page
this.getRemainingData()
},
getRemainingData() {
const data = {
client_id: this.rclient_id,
page: this.rpage,
page_size: this.rpage_size
}
this.rloading = true
home_drug_remaining(stringify(data)).then(res => {
this.remainingData = res.data.data
this.rtotal = res.data.total_count
}).finally(() => (this.rloading = false))
},
optClick(row) {
this.rowData = row
this.innerVisible = true
},
searchData() {
this.getWarnList()
},
getWarnList() {
const data = {
'seach_word': this.seach_word,
'object_type': this.object_type,
'start_time': this.start_time,
'end_time': this.end_time,
'page': this.page,
'page_size': this.page_size
}
this.loadingReagent = true
home_warning_list(stringify(data)).then(res => {
this.gridData = res.data.data_list
this.total = res.data.total_count
}).finally(() => (this.loadingReagent = false))
},
pageChange(page) {
this.page = page
this.getWarnList()
},
initDataFunc(data) {
const { new_day_record_number, warning_data_info, warning_list } = data
const nowstore = new_day_record_number.find(item => item.record_type === 1)
const nowget = new_day_record_number.find(item => item.record_type === 2)
const nowsend = new_day_record_number.find(item => item.record_type === 3)
const nowno = new_day_record_number.find(item => item.record_type === 100)
if (nowstore) {
this.desc[0].count = nowstore.type_number
}
if (nowget) {
this.desc[1].count = nowget.type_number
}
if (nowsend) {
this.desc[2].count = nowsend.type_number
}
if (nowno) {
this.desc[3].count = nowno.type_number
}
this.warning_data_info = warning_data_info
this.tableData = warning_list
},
initAllCharts() {
this.getLoadEcharts()
this.lineCharts()
window.addEventListener('resize', () => {
// echartsresizeecharts
this.myChart.resize()
this.myChart2.resize()
})
},
format(percentage) { format(percentage) {
return `${percentage / 100}%` return `${percentage / 100}%`
}, },
warnAll() { warnAll() {
this.dialogTableVisible = true this.dialogTableVisible = true
// //
this.getWarnList()
}, },
getLoadEcharts() { getLoadEcharts() {
this.myChart = this.$echarts.init( this.myChart = this.$echarts.init(
document.getElementById('pie') document.getElementById('pie')
) )
const data = this.warning_data_info.data_list.map(item => {
item.name = this.warning_data_map[item.object_type - 1]
item.value = item.type_number
return item
})
const option = { const option = {
// legend: { // legend: {
// align: 'left' // orient: 'vertical',
// left: 'left'
// }, // },
series: [ series: [
{ {
name: 'Nightingale Chart', name: 'Nightingale Chart',
type: 'pie', type: 'pie',
roseType: 'area', label: {
// radius: [50, 250], normal: {
center: ['50%', '50%'], show: true,
itemStyle: { formatter: '{b}:{d}%'
borderRadius: 8 }
}, },
data: [ data
{ value: 40, name: 'rose 1' },
{ value: 38, name: 'rose 2' },
{ value: 32, name: 'rose 3' },
{ value: 30, name: 'rose 4' },
{ value: 28, name: 'rose 5' },
{ value: 26, name: 'rose 6' },
{ value: 22, name: 'rose 7' },
{ value: 18, name: 'rose 8' }
]
} }
] ]
} }
@ -358,7 +594,9 @@ export default {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.el-input{
width: 150px;
}
.el-select { .el-select {
margin-right: 1rem; margin-right: 1rem;
} }
@ -376,16 +614,33 @@ export default {
justify-content: space-between; justify-content: space-between;
} }
} }
.header-warn{
.title {
font-size: 20px;
font-weight: bold;
color: #303133;
}
.count{
font-size: 36px;
font-weight: bold;
color: #303133;
}
.desc{
font-size: 14px;
font-weight: 400;
color: #606266;
}
}
.view-content{ .view-content{
padding: 1rem; padding: 1rem;
background-color: white; background-color: white;
} }
#pie{ #pie{
width: 30rem; width: 30rem;
height: 15rem; height: 13rem;
} }
#line{ #line{
width: 65rem; width: 65rem;
height: 14.5rem; height: 13rem;
} }
</style> </style>

@ -72,7 +72,7 @@
<script> <script>
import Scannner from '@/components/Scannner/index' import Scannner from '@/components/Scannner/index'
import { use, drug_return, use_or_return_list } from '@/api/receivingReturn' import { use, drug_return, use_or_return_list } from '@/api/reagent/receivingReturn'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {
name: 'ReceivingAndReturn', name: 'ReceivingAndReturn',

@ -110,7 +110,7 @@
</template> </template>
<script> <script>
import { report_home } from '@/api/report' import { report_home } from '@/api/reagent/report'
export default { export default {
name: 'Report', name: 'Report',

@ -54,7 +54,7 @@
</template> </template>
<script> <script>
import { stock_loss_info } from '@/api/report' import { stock_loss_info } from '@/api/reagent/report'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {

@ -57,7 +57,7 @@
</template> </template>
<script> <script>
import { drug_use_expend } from '@/api/report' import { drug_use_expend } from '@/api/reagent/report'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {

@ -48,7 +48,7 @@
</template> </template>
<script> <script>
import { drug_details_info } from '@/api/report' import { drug_details_info } from '@/api/reagent/report'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {

@ -71,7 +71,7 @@
</template> </template>
<script> <script>
import { drug_log_type_info } from '@/api/report' import { drug_log_type_info } from '@/api/reagent/report'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {

@ -39,7 +39,7 @@
</template> </template>
<script> <script>
import { stock_data_info } from '@/api/report' import { stock_data_info } from '@/api/reagent/report'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {

@ -56,7 +56,7 @@
</template> </template>
<script> <script>
import { use_frequency } from '@/api/report' import { use_frequency } from '@/api/reagent/report'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {

@ -57,7 +57,7 @@
</template> </template>
<script> <script>
import { drug_user_use_expend } from '@/api/report' import { drug_user_use_expend } from '@/api/reagent/report'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {

@ -55,7 +55,7 @@
</template> </template>
<script> <script>
import { drug_details_info } from '@/api/report' import { drug_details_info } from '@/api/reagent/report'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {

@ -221,7 +221,7 @@
<script> <script>
import ReagentForm from '@/components/ReagentForm/index' import ReagentForm from '@/components/ReagentForm/index'
import Scanner from '@/components/Scannner/index' import Scanner from '@/components/Scannner/index'
import { show_tmp, select_drug, bind_tmp_enter_warehouse, add_tmp, del_tmp } from '@/api/warehousing' import { show_tmp, select_drug, bind_tmp_enter_warehouse, add_tmp, del_tmp } from '@/api/reagent/warehousing'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
export default { export default {

Loading…
Cancel
Save