Commit e293af40 by lichengming

修改了证书及时率

parent 1946beca
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top:10px">
<Form :d="formId" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<Row style="margin-top: 10px;">
<!--查询条件-->
<Col span="24">
<div class="fl">
<Form id="search-form" :label-width="100" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="检定依据:" style="margin-left: -20px">
<Input @on-enter="_formSearch" v-model="formObj.code" name="judgeBasis" placeholder="请输入判定依据" clearable/>
<Form-item label="应出报告日期:">
<!--<DatePicker type="month" style="width:90px" v-model="startDate" @on-change="_beginDateChange"-->
<!--:editable="false"></DatePicker>-->
<!--<label class="line-color">——</label>-->
<!--<DatePicker type="month" style="width:90px" v-model="endDate" :editable="false"-->
<!--@on-change="_endDateChange"></DatePicker>-->
<el-date-picker
v-model="queryDate"
@change="_dateChange"
type="monthrange"
range-separator="-"
start-placeholder="开始月份"
end-placeholder="结束月份"
size="small"
value-format="yyyy-MM">
</el-date-picker>
</Form-item>
<Form-item class="search-item" label="检定依据名称:">
<Input @on-enter="_formSearch" v-model="formObj.name" name="judgeBasisName" placeholder="请输入判定依据名称" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
<Form-item class="marginLeft-70" style="margin-left: -60px;">
<Button @click="_search" type="primary" class="width-80">搜索</Button>
</Form-item>
</Form>
</div>
<div class="fr">
<Button @click="_export" class="width-80">导出</Button>
</div>
<div class="clear"></div>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
<!--内容-->
<Col span="24" style="margin-bottom: 10px">
<Row :gutter="16">
<Col span="10">
<!--pie-->
<ReportTimelyPie ref="contractPieModal" @on-result-change="_pieResult"></ReportTimelyPie>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:form-id="formId"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange">
<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>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
<Col span="14">
<!--table-->
<ReportTimelyTable ref="contractTableModal"></ReportTimelyTable>
</Col>
</Row>
</Col>
</Row>
</div>
</div>
</div>
</template>
<script>
import { meterAptitude } from '../../../api'
import ReportTimelyTable from './ReportTimelyTable'
import ReportTimelyPie from './ReportTimelyPie'
export default {
name: 'MeterAptitudeStandard',
components: {},
components: {
ReportTimelyTable,
ReportTimelyPie
},
data() {
const date = this.$dateformat(new Date(), 'yyyy-mm')
return {
formId: 'meterAptitudeFormId',
pageColumns: [
{ title: '检定依据', key: 'code', width: 160 },
{ title: '检定依据名称', key: 'name' },
{ title: '登记时间', key: 'ctime', date: true, width: 140 },
{ title: '备注', key: 'remark' }
],
btn: [
{ type: 'success', id: '', name: '添加' },
{ type: 'error', id: '', name: '删除' }
],
iconMsg: [
{ type: 'md-create', id: '', name: '编辑' },
{ type: 'md-trash', id: '', name: '删除' }
],
formObj: {
name: undefined,
code: undefined
tempData: {
beginDate: date,
endDate: date
},
searchOpen: true,
selectIds: [],
getPage: {},
typeData: []
}
pieData: {
beginDate: date,
endDate: date
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
queryDate: [date, date]
}
},
mounted() {
this._page()
// this._open()
// this._search();
},
methods: {
_btnClick(msg) {
switch (msg) {
case '添加':
this._editModal(false)
break
case '删除':
this._deleteSelected()
break
case '导入':
this._import()
break
case '导出':
this._export()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '删除':
this._deleteById(data.id)
break
case '操作日志':
this._record(data.id)
break
}
},
_page: async function() {
console.log(9522123)
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterAptitude.page(this.formObj)
if (result) {
console.log(55555)
console.log(result)
this.getPage = result
console.log(123456789)
console.log(this.getPage)
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodJudgeBasis.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
_delete: async function(ids) {
const result = await meterAptitude.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
_dateChange(data) {
if (data) {
this.tempData.beginDate = data[0]
this.tempData.endDate = data[1]
this.pieData.beginDate = data[0]
this.pieData.endDate = data[1]
} else {
this._deleteByIds(ids, '确定删除这 ' + ids.length + ' 条记录?')
}
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
this._getById(id)
// 编辑
// this.$store.dispatch('FoodJudgeBasis/getById', id).then(() => {
// this.$refs.editModal._open(this.$store.state.FoodJudgeBasis.model)
// })
} else {
// 添加
this.$refs.editModal._open()
}
},
_getById: async function(id) {
const result = await meterAptitude.getById(id)
if (result) {
this.$refs.editModal._open(result)
}
this.tempData.beginDate = ''
this.tempData.endDate = ''
this.pieData.beginDate = ''
this.pieData.endDate = ''
}
this.$refs.contractTableModal._changeDate(this.tempData)
},
_pieResult(res) {
this.$refs.contractTableModal._pieOpen(res)
},
_open() {
this.$store
.dispatch('LmsBaseDict/getItem', '报告及时率预警期')
.then(() => {
const timeWrning = this.$store.state.LmsBaseDict.item[0].name
this.$refs.contractTableModal._openTable({
beginDate: this.tempData.beginDate,
endDate: this.tempData.endDate,
warningDate: timeWrning
})
this.$refs.contractPieModal._openPie({
beginDate: this.tempData.beginDate,
endDate: this.tempData.endDate,
warningDate: timeWrning
})
})
},
// 导入
_import() {
const data = {
importUrl:
'/food/v1/food_aptitude_judge_basis/food_aptitude_judge_import',
downloadUrl: '/food/v1/excel/template/FoodAptitudeJudgeBasis',
title: '导入检验方法管理'
}
this.$refs.sampleModal._open(data)
_search() {
this.$refs.contractTableModal._searchTable({
beginDate: this.tempData.beginDate,
endDate: this.tempData.endDate
})
this.$refs.contractPieModal._searchPie({
beginDate: this.pieData.beginDate,
endDate: this.pieData.endDate
})
},
// 导出
_export() {
console.log('.this.selectIds', this.selectIds)
if (this.selectIds.length === 0) {
this.$Message.warning('请选择需要导出的数据')
} else {
const content = '确定导出 ' + this.selectIds.length + ' 条记录?'
this.$Modal.confirm({
title: '提示',
content: content,
onOk: () => {
// eslint-disable-next-line no-undef
http.open(
'/food/v1/food_aptitude_judge_basis/food_aptitude_judge_export?ids=' +
this.selectIds
)
}
})
}
this.$refs.contractTableModal._exportSampleForm()
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="border-chart-color">
<div class="chartTitle">
<label>报告及时率统计</label>
</div>
<Form id="report-timely-pie">
<input name="beginDate" type="hidden">
<input name="endDate" type="hidden">
<input name="warningDate" type="hidden">
</Form>
<div :style="heightObj" class="chartCont">
<div style="width:90%">
<IEcharts :option="option" :style="optionObj" @click="_pieClick"></IEcharts>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
name: 'A',
heightObj: {
height: '300px'
},
option: {
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: ['30%', '65%'],
center: ['40%', '50%'],
data: [
{ value: 335, name: '直接访问' },
{ value: 310, name: '邮件营销' },
{ value: 234, name: '联盟广告' },
{ value: 135, name: '视频广告' },
{ value: 1548, name: '搜索引擎' }
],
avoidLabelOverlap: false,
label: {
normal: {
show: false,
position: 'center'
},
emphasis: {
show: true,
textStyle: {
fontSize: '30',
fontWeight: 'bold'
}
}
},
labelLine: {
normal: {
show: false
}
}
}
]
},
optionObj: {
height: ''
},
pageParams: {},
pie: [],
timeWrning: []
}
},
mounted() {
this._contHide()
},
methods: {
_contHide() {
this.optionObj.height = document.documentElement.clientHeight - 300 + 'px'
this.heightObj.height = document.documentElement.clientHeight - 272 + 'px'
this.optionObj.width =
(document.documentElement.clientWidth - 200) / 2.6 + 'px'
},
_openPie(data) {
$('input[name="warningDate"]').val(data.warningDate)
$('input[name="beginDate"]').val(data.beginDate)
$('input[name="endDate"]').val(data.endDate)
// this._page()
},
_searchPie(data) {
$('input[name="beginDate"]').val(data.beginDate)
$('input[name="endDate"]').val(data.endDate)
// this._page()
},
_page() {
this.$store
.dispatch('FoodSample/listPromptnessPie', this._searchParams())
.then(() => {
this.pie = this.$store.state.FoodSample.list
this.option.series[0].data = []
this.option.legend.data = []
for (let i = 0; i < this.pie.length; i++) {
this.option.series[0].data.push({
name: this.pie[i].type,
value: this.pie[i].total
})
this.option.legend.data.push(this.pie[i].type)
}
})
},
_searchParams() {
const data = this.$serialize('report-timely-pie')
return this.$extend(data, this.pageParams)
},
_pieClick(res) {
this.$emit('on-result-change', res.data.name)
}
}
}
</script>
<template>
<div>
<Form id="pie-search-form">
<input name="beginDate" type="hidden">
<input name="endDate" type="hidden">
<input name="warningDate" type="hidden">
<input name="type" type="hidden">
</Form>
<PTVXETable id="reportTimelyTable" ref="pageTable" :pageColumns="pageColumns"
:tableHeight="tableHeight" @on-result-change="_tableResultChange" :getPage="getPage" select-data>
<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 v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</template>
<script>
import { meterContract } from '../../../api'
export default {
data() {
return {
loading: true,
formObj: {
client: undefined
},
pageColumns: [
{ title: '样品编号', key: 'sampleNum', width: 180 },
{ title: '委托单位', key: 'client' },
{ title: '委托编号', key: 'contractCode', width: 180 },
{ title: '应出报告日期', key: 'dueDate', width: 120, date: true },
{ title: '签发日期', key: 'issueDate', width: 120, date: true },
{ title: '报告超期原因', key: 'reason' }
],
getPage: {},
selectData: []
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('', 230)
}
},
mounted() {
this._page()
},
methods: {
// 日期变化时,将时间赋值,导出根据查询条件
_changeDate(data) {
$('input[name=beginDate]').val(data.beginDate)
$('input[name=endDate]').val(data.endDate)
$('input[name=type]').val('')
},
_openTable(data) {
$('input[name=beginDate]').val(data.beginDate)
$('input[name=endDate]').val(data.endDate)
$('input[name=warningDate]').val(data.warningDate)
$('input[name=type]').val('')
this._page()
},
_searchTable(data) {
$('input[name=beginDate]').val(data.beginDate)
$('input[name=endDate]').val(data.endDate)
$('input[name=type]').val('')
this._page()
},
_pieOpen(res) {
$('input[name=type]').val(res)
// this._page()
},
// _page() {
// this.$refs.pageTable._page('pie-search-form', 'FoodSample/reportTimely')
// },
_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
console.log('请求结果为', result)
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSample.page
break
case 'selectData':
this.selectData = data
break
case 'changeSize':
this._page()
break
}
},
/** *********************************导出-begin*********************************************/
_exportSampleForm() {
let result = []
if (this.selectData.length === 0) {
// 导出全部数据
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$store
.dispatch('FoodSample/reportTimely', this._searchParams())
.then(() => {
result = this.$store.state.FoodSample.page.records
this.$exportExcel(
'reportTimelyTable',
'报告及时率统计表',
this.pageColumns,
result
)
})
}
})
} else {
// 只导出选中的数据
result = this.selectData
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$exportExcel(
'reportTimelyTable',
'报告及时率统计表',
this.pageColumns,
result
)
}
})
}
},
// 参数
_searchParams() {
const data = this.$serialize('pie-search-form')
return this.$extend(data, { page: 1, rows: 5000 })
}
/** *********************************导出样品台账-end*********************************************/
}
}
</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