Commit 1777cf5f by lichengming

修改了统计分析

parents 2b2771e5 42781453
......@@ -67,11 +67,6 @@ export default {
year: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('noBtn')
}
},
mounted() {
this.$refs.pageTable._hideLoading()
},
......
<template>
<div>
<form id="form-customer-table">
<input name="queryDateBegin" type="hidden"/>
<input name="queryDateEnd" type="hidden"/>
</form>
<PTVXETable id="customer-contract-table" ref="pageTable"
:tableHeight="tableHeight" @on-result-change="_tableResultChange" :getPage="getPage" hide-checkbox click-value>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detail(scope.row)">{{scope.row[item.key]}}</a>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
<!--详情-->
<Detail ref="detailModal"/>
</div>
</template>
<script>
import { meterContract } from '../../../api'
import Detail from './Detail'
export default {
components: { Detail },
data() {
return {
pageColumns: [
{
title: '客户名称',
key: 'client',
width: 120,
fixed: 'left'
},
{ title: '委托数量', key: 'total' },
{ title: '委托额度', key: 'price' },
{ title: '已收额度', key: 'collectPrice' },
{ title: '未收额度', key: 'noCollectPrice' }
],
formObj: {
client: undefined
},
getPage: {},
customer: '',
queryDateBegin: '',
queryDateEnd: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('noBtn')
}
},
methods: {
// 查看所有委托
_detail(data) {
this.$refs.detailModal._open({
cname: data.customer,
queryDateBegin: this.queryDateBegin,
queryDateEnd: this.queryDateEnd
})
},
_openTable(data) {
this.customer = data.customer
$('input[name=queryDateBegin]').val(data.queryDateBegin)
$('input[name=queryDateEnd]').val(data.queryDateEnd)
this.queryDateBegin = data.queryDateBegin
this.queryDateEnd = data.queryDateEnd
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await meterContract.page(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
// _page() {
// const data = {}
// if (this.customer) {
// data.customer = this.customer
// }
// this.$refs.pageTable._page(
// 'form-customer-table',
// 'StatisticContract/pageCustomerContract',
// data
// )
// },
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.StatisticContract.page
break
case 'singleSelect':
// 单击
this.$emit('on-result-change', data)
break
case 'dbSelect':
// 双击
this.customer = ''
break
case 'changeSize':
// this._page()
break
}
},
/** *********************************导出客户委托分析表-begin*********************************************/
_exportSampleForm() {
let result = []
this.$store
.dispatch(
'StatisticContract/pageCustomerContract',
this._searchParams()
)
.then(() => {
result = this.$store.state.StatisticContract.page.records
if (result.length === 0) {
this.$Message.warning('暂无数据,不可导出!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定导出全部数据(最多导出5000条)?',
onOk: () => {
this.$exportExcel(
'customer-contract-table',
'客户委托分析表',
this.pageColumns,
result
)
}
})
}
})
},
// 参数
_searchParams() {
const data = this.$serialize('form-customer-table')
if (this.customer) {
data.customer = this.customer
}
return this.$extend(data, { page: 1, rows: 5000 })
}
/** *********************************导出客户委托分析表-end*********************************************/
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="1000" class="modal-footer-none">
<Modal v-model="showModal" width="1200" class="modal-footer-none">
<p slot="header">详情</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" hide-checkbox>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
<Form id="search-personal-detail" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item style="width:32%" label="录入时间:">
<Date-picker :editable="false" @on-change="_dateChange" v-model="dateList"
type="daterange" placeholder="录入时间" format="yyyy-MM-dd"
style="width:100%"></Date-picker>
<input v-model="formObj.testDateBegin" type="hidden" name="testDateBegin">
<input v-model="formObj.testDateEnd" type="hidden" name="testDateEnd">
<input v-model="groupIds" type="hidden" name="groupIds">
<input v-model="testerIds" type="hidden" name="testerIds">
</Form-item>
<Form-item style="width:32%" label="检测科室:">
<SelMultiGroup ref="groupModal" @on-result-change="_groupResult"></SelMultiGroup>
</Form-item>
<Form-item style="width:32%" label="检测人:">
<!--显示某几个科室下的人员 isGroupIds为标识-->
<SelMultiUserGroup ref="userModal" @on-result-change="_userResult" is-group-ids></SelMultiUserGroup>
</Form-item>
<Form-item style="width:32%" label="检测项目:">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入检测项目" clearable/>
</Form-item>
<Form-item style="width:32%" label="检测依据:">
<Input v-model="formObj.testBasis" @on-enter="_formSearch" name="testBasis" placeholder="请输入检测依据"
clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide"></btn-list>
</Col>
<Col span="24">
<PTVXETable id="groupStatisticTable" ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<span v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key], "yyyy-mm-dd"):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key]?scope.row[item.key].display:''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
......@@ -27,24 +67,48 @@
</div>
</template>
<script>
/* 个人检测量统计------项目查看项目详情 */
import SelMultiUserGroup from '../../../components/user-info/SelMultiUserGroup'
import SelMultiGroup from '../../../components/user-info/SelMultiGroup'
export default {
components: { SelMultiUserGroup, SelMultiGroup },
data() {
return {
btn: [{ type: '', id: '', name: '导出' }],
showModal: false,
selectData: [],
getPage: {},
pageColumns: [
{ title: '委托名称', key: 'name' },
{ title: '委托编号', key: 'code', width: 180 },
{ title: '委托金额(元)', key: 'contractAmount', width: 160 },
{ title: '已收金额(元) ', key: 'bereturnedAmount', width: 160 },
{ title: '未收金额(元)', key: 'noreturnedAmount', width: 160 }
{ title: '样品编号', key: 'num', width: 180, fixed: 'left' },
{ title: '样品名称', key: 'sampleName', width: 180 },
{ title: '检测项目', key: 'name', width: 120 },
{ title: '检测值', key: 'testValue', width: 140 },
{ title: '单位', key: 'unit', width: 100 },
{ title: '结果判定', key: 'qualified', width: 100, status: true },
{ title: '单项结论', key: 'singleConclusion', width: 100 },
{ title: '复测值', key: 'retestValue', width: 100 },
{ title: '检出类别', key: 'detectionType', width: 100 },
{ title: '检出限', key: 'detection', width: 100 },
{ title: '检测依据', key: 'testBasis', width: 200 },
{ title: '检测依据名称', key: 'testBasisName', width: 200 },
{ title: '检测方法', key: 'testMethod', width: 200 },
{ title: '判定依据', key: 'judgeBasis', width: 200 },
{ title: '判定依据名称', key: 'judgeBasisName', width: 200 },
{ title: '限量', key: 'limitDefault', width: 100 },
{ title: '检测科室', key: 'groupName', width: 100 },
{ title: '检测人', key: 'tester', width: 100 },
{ title: '录入时间', key: 'testDate', width: 120, date: true }
],
dateList: [],
formObj: {
cname: '',
queryDateBegin: '',
queryDateEnd: ''
}
name: '',
testDateBegin: '',
testDateEnd: '',
testBasis: ''
},
groupIds: [],
testerIds: []
}
},
computed: {
......@@ -53,8 +117,51 @@ export default {
}
},
methods: {
_open(data) {
this.formObj = data
// 选择科室返回
_groupResult(data) {
this.groupIds = data
// 查询科室下的人员
if (data.length === 0) {
this.testerIds = []
}
this.$refs.userModal._openUserByGroup(data)
},
// 选择人员返回
_userResult(data) {
this.testerIds = data
},
_dateChange(data) {
this.formObj.testDateBegin = data[0]
this.formObj.testDateEnd = data[1]
},
_open(formObj) {
// 显示科室信息
this.groupIds = formObj.groupIds
this.$refs.groupModal._open(this.groupIds)
// 显示人员信息
this.testerIds = formObj.testerIds
this.$refs.userModal._openUserByGroup(this.groupIds, this.testerIds)
this.selectData = []
this.formObj = this.$resetFields(this.formObj)
/** ***********时间处理*********/
const beginDate = formObj.beginDate ? formObj.beginDate + '-01' : ''
const endDate = formObj.endDate ? formObj.endDate.split('-') : ''
this.formObj.testDateBegin = beginDate || ''
this.formObj.testDateEnd = formObj.endDate
? formObj.endDate + '-' + this.$getLastDay(endDate[0], endDate[1])
: ''
if (formObj.beginDate) {
this.dateList = [
new Date(this.formObj.testDateBegin),
new Date(this.formObj.testDateEnd)
]
} else {
this.dateList = []
}
/** ***********时间处理*********/
this.showModal = true
this.$nextTick(function() {
// this._page()
......@@ -62,8 +169,8 @@ export default {
},
_page() {
this.$refs.pageTable._page(
'search-contract-detail',
'FoodContract/pageContractByCustomer',
'search-personal-detail',
'FoodItem/yearTestDetail',
this.$serializeFormSearch(this.formObj)
)
},
......@@ -73,15 +180,77 @@ export default {
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
this.getPage = this.$store.state.FoodItem.page
break
case 'selectData':
this.selectData = data
break
// default :
// this._page();
case 'changeSize':
// this._page()
break
}
},
_btnClick(msg) {
switch (msg) {
case '导出':
if (this.getPage.records.length === 0) {
this.$Message.warning('暂无数据,不可导出!')
} else {
this._export()
}
break
}
},
/** *********************************************导出*****************************************/
_export() {
if (this.selectData.length === 0) {
// 导出全部数据
this._exportOk(this.getPage.total)
} else {
// 只导出选中的数据
this._exportOk(this.selectData.length)
}
},
_exportOk(length) {
this.$Message.destroy()
this.$Modal.confirm({
title: '提示',
content: '确定导出这' + length + '条数据?',
onOk: () => {
if (this.selectData.length > 0) {
this.$exportExcel(
'groupStatisticTable',
'项目统计信息',
this.pageColumns,
this.selectData
)
} else {
this.$Message.loading({
content: '正在处理,请稍后...',
duration: 0
})
this.$store
.dispatch('EnvItem/yearTestDetail', this._searchParams())
.then(() => {
const result = this.$store.state.EnvItem.page.records
this.$exportExcel(
'groupStatisticTable',
'项目统计信息',
this.pageColumns,
result
)
})
}
}
})
},
// 参数
_searchParams() {
const data = this.$serialize('search-personal-detail')
Object.assign(data, this.formObj)
return this.$extend(data, { page: 1, rows: this.$exportRows() })
}
/** *********************************************导出*****************************************/
}
}
</script>
......@@ -8,112 +8,283 @@
<div class="fl">
<Form id="search-form" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="客户名称:">
<Input v-model="tempData.customer" @on-click="_selectCustomer" @on-change="_cusChange"
placeholder="请选择客户名称" class="width-200" clearable icon="plus" readonly/>
</Form-item>
<Form-item label="制单日期:">
<Form-item label="委托日期:">
<el-date-picker
v-model="queryDate"
@change="_dateChange"
type="monthrange"
range-separator="-"
start-placeholder="开始月份"
end-placeholder="结束月份"
size="small"
value-format="yyyy-MM">
value-format="yyyy-MM"
@change="_dateChange">
</el-date-picker>
</Form-item>
<Form-item class="search-btn">
<Button @click="_search" type="primary">搜索</Button>
<Button type="primary" class="width-80" @click="_getData">搜索</Button>
</Form-item>
</Form>
</div>
<div class="fr">
<Button @click="_export" class="width-80">导出</Button>
<Button class="width-80" @click="_exportSampleForm">导出</Button>
</div>
<div class="clear"></div>
</Col>
<!--内容-->
<Col span="24">
<Row :gutter="16">
<Col span="24">
<!--table-->
<CustomerTable ref="tableModal" @on-result-change="_customerChange"></CustomerTable>
<Col span="14">
<ElTableNoPage id="table-year" ref="pageTable" :table-height="tableHeight"
:get-page="getPage" hide-checkbox @on-result-change="_tableResultChange" >
<el-table-column fixed type="index" label="序号" width="100">
</el-table-column>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
:prop="item.key"
:label="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined">
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a></div>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</el-table-column>
</ElTableNoPage>
</Col>
<Col span="10">
<!--pie-->
<!-- <CustomerPie ref="pieModal"></CustomerPie>-->
<UserTestPie ref="testPieModal"></UserTestPie>
</Col>
</Row>
</Col>
</Row>
</div>
</div>
<!--选择客户-->
<Customer ref="cunstomerModal" @on-result-change="_customerResult"></Customer>
<!--检测项目详情-->
<Detail ref="detailModal"></Detail>
</div>
</template>
<script>
import Customer from '../../../components/user-info/customer'
import CustomerTable from './CustomerTable'
import { meterSample } from '../../../api'
import UserTestPie from './UserTestPie'
import Detail from './Detail'
export default {
components: {
CustomerTable,
Customer
UserTestPie,
Detail
},
data() {
const now = new Date()
const date = this.$dateformat(now, 'yyyy-mm')
const date = this.$dateformat(new Date(), 'yyyy-mm')
return {
beginDate: new Date(),
endDate: new Date(),
groupId: '',
groupName: '',
tester: '',
testerId: '',
pageColumns: [
{ title: '委托单位', key: 'client', detail: true },
{ title: '委托数量', key: 'quantity' },
{ title: '委托额度', key: 'fee' }
],
groupData: [],
getPage: {
records: []
},
formObj: {
edateBegin: undefined,
edateEnd: undefined
},
tempData: {
queryDateBegin: date,
queryDateEnd: date,
customer: ''
groupId: '',
groupName: '',
beginDate: date,
endDate: date
},
queryDate: [date, date]
testerData: [],
queryDate: [date, date],
serviceType: '',
serviceTypeList: []
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('search')
}
},
mounted() {
this._search()
this.$refs.pageTable._hideLoading()
// this._contHide()
// this._getUserGroup()
this.formObj.edateBegin = this.tempData.beginDate
this.formObj.edateEnd = this.tempData.endDate
this._getData()
// this._getServiceTypeList()
},
methods: {
// 服务类型
_getData: async function() {
const result = await meterSample.pageCustomerEntrustStatistics(
this.formObj
)
if (result) {
this.getPage.records = result
this.$refs.testPieModal._openPie(this.getPage.records)
}
},
// 检测项目详情
_detailModal(data) {
const obj = {
testerIds: [data.testerId],
groupIds: this.groupIds,
beginDate: this.tempData.beginDate,
endDate: this.tempData.endDate
}
console.log(obj)
// this.$refs.detailModal._open(obj)
},
_dateChange(data) {
if (data) {
this.tempData.queryDateBegin = data[0]
this.tempData.queryDateEnd = data[1]
this.formObj.edateBegin = data[0]
this.formObj.edateEnd = data[1]
} else {
this.tempData.queryDateBegin = ''
this.tempData.queryDateEnd = ''
this.tempData.edateBegin = ''
this.tempData.edateEnd = ''
}
},
_open() {
this.$refs.tableModal._openTable(this.tempData)
// this.$refs.pieModal._openAllPie(this.tempData)
_contHide() {
this.tempData.beginDate = this.$dateformat(new Date(), 'yyyy-mm')
this.tempData.endDate = this.$dateformat(new Date(), 'yyyy-mm')
// this._page()
// this._getById()
},
_page() {
const data = {}
if (this.groupId) {
data.groupId = this.groupId
}
if (this.tester && this.testerId) {
data.testerId = this.testerId
} else {
this.testerId = ''
}
if (this.tempData.beginDate) {
data.beginDate = this.tempData.beginDate
}
if (this.tempData.endDate) {
data.endDate = this.tempData.endDate
}
if (this.serviceType) {
data.serviceType = this.serviceType
}
this.$refs.pageTable._page(
'search-form',
'FoodItem/pagePersonalTask',
data
)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_search() {
this._open()
this.tempData.groupId = this.groupId
this.tempData.groupName = this.groupId ? this.groupName : ''
this.tempData.serviceType = this.serviceType ? this.serviceType : ''
this.$refs.testPieModal._openPie(this.tempData)
this._formSearch()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'changeSize':
// this._page()
break
}
},
_export() {
this.$refs.tableModal._exportSampleForm()
/** *********************************导出-begin*********************************************/
_exportSampleForm() {
let result = []
this.$store
.dispatch('FoodItem/pagePersonalTask', this._searchParams())
.then(() => {
result = this.$store.state.FoodItem.page.records
this.$Modal.confirm({
title: '提示',
content: '确定导出全部数据?',
onOk: () => {
this.$exportExcel(
'personalTestNum',
'个人检测量统计表',
this.pageColumns,
result
)
}
})
})
},
// 参数
_searchParams() {
const data = {}
if (this.groupId) {
data.groupId = this.groupId
}
if (this.tester && this.testerId) {
data.testerId = this.testerId
} else {
this.testerId = ''
}
if (this.tempData.beginDate) {
data.beginDate = this.tempData.beginDate
}
if (this.tempData.endDate) {
data.endDate = this.tempData.endDate
}
return this.$extend(data, { page: 1, rows: 5000 })
},
_selectCustomer() {
this.$refs.cunstomerModal._open()
/** *********************************导出样品台账-end*********************************************/
_getUserGroup() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
_customerResult(data) {
this.tempData.customer = data.cname
this._search()
// 主检人&检测科室
_groupChange(data) {
if (data) {
this.groupName = data.label
this.groupId = data.value
this.testerId = ''
this.tester = ''
this._getUserList(data.value)
}
},
_customerChange(data) {
// this.$refs.pieModal._openPie(data, this.tempData)
_getUserList(groupId, realname) {
const data = { page: 1, rows: 50 }
if (groupId) {
Object.assign(data, { groupId: groupId })
}
if (realname) {
Object.assign(data, { realname: realname })
}
this.$store.dispatch('LmsUserGroup/getUserByGroupId', data).then(() => {
this.testerData = this.$store.state.LmsUserGroup.userPage.records
})
},
// 选择人员为空的情况
_cusChange(data) {
if (data.target.value === '') {
this.tempData.customer = ''
this._search()
_testerChange(msg, data) {
switch (msg) {
case 'select':
this.tester = data.realname
this.testerId = data.userId
break
case 'blur':
this.tester = ''
break
case 'query':
this.tester = data.realname
this._getUserList('', data.realname)
break
}
}
}
......
<template>
<div class="border-chart-color">
<div class="chartTitle">
<label>{{groupName}} 客户委托量比率</label>
</div>
<div :style="heightObj" class="chartCont">
<div v-if="showStatistic" style="width:90%">
<IEcharts :option="option" :style="optionObj"></IEcharts>
</div>
<div v-else :style="noDataObj" class="no-statistic-bg"></div>
</div>
<form id="persontal-task-pie">
<input name="groupId" type="hidden"/>
<input name="beginDate" type="hidden"/>
<input name="endDate" type="hidden"/>
<input name="groupName" type="hidden"/>
<input name="serviceType" type="hidden"/>
</form>
</div>
</template>
<script>
// import IEcharts from 'vue-echarts-v3/src/full'
export default {
// components: { IEcharts },
data() {
return {
// 科室名称
groupName: '',
showStatistic: true,
heightObj: {
height: '300px'
},
option: {
title: {
x: 'center',
textStyle: {
fontSize: 14,
fontWeight: 'normal'
}
},
tooltip: {
trigger: 'item',
formatter: function(a) {
return (
a.name +
'</br>样品量: ' +
a.data.value +
'<br>占比: ' +
a.percent +
'%'
)
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 0,
top: 20,
bottom: 20,
data: []
},
color: this.$echartColor,
series: [
{
name: '访问来源',
type: 'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '30',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: []
}
]
},
optionObj: {
height: ''
},
noDataObj: {
marginTop: ''
}
}
},
mounted() {
this._contHide()
},
methods: {
_contHide() {
this.optionObj.height = document.documentElement.clientHeight - 300 + 'px'
this.heightObj.height = document.documentElement.clientHeight - 272 + 'px'
this.noDataObj.marginTop =
(document.documentElement.clientHeight - 450) / 2 + 'px'
this.optionObj.width =
(document.documentElement.clientWidth - 200) / 2.6 + 'px'
},
_openPie(data) {
const testerList = []
const seriesList = []
let total = 0
for (let i = 0; i < data.length; i++) {
testerList.push(data[i].client)
total = total + data[i].quantity
seriesList.push({
value: data[i].quantity,
name: data[i].client,
total: data[i].quantity
})
}
this.option.title.text = '委托单总量(个):' + total
this.option.legend.data = testerList
this.option.series[0].data = seriesList
console.log(this.option.series[0].data)
},
_searchParams() {
const data = this.$serialize('persontal-task-pie')
return this.$extend(data)
}
}
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment