中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

872 lines
33 KiB

<template>
<div>
<avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud"
@row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" @on-load="onLoad" :before-open="beforeOpen">
<template #menu-left>
<el-button type="primary" @click="handleLine">生成报告
</el-button>
<el-button type="danger" @click="handleDelete">删 除
</el-button>
</template>
<template #menu="scope">
<el-button type="text" @click="handleView(scope.row)">详情</el-button>
<el-button type="text" @click="rowDel(scope.row)">删除</el-button>
</template>
</avue-crud>
<el-dialog title="检验报告" append-to-body v-model="lineBox" fullscreen width="95%">
<el-form :inline="true" v-model="lineForm" label-width="80px">
<el-row :gutter="24">
<el-col :span="5">
<el-form-item label="作业中心:" prop="workCenterId">
<el-select v-model="lineForm.workCenterId" placeholder="请选择" @change="changeWorkCenter" style="width: 220px;">
<el-option v-for="item in workList" :key="item.id" :label="item.wcName" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="槽号:" prop="workTankId">
<el-select v-model="lineForm.workTankId" placeholder="请选择" style="width: 220px;">
<el-option v-for="item in tankList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="5">
<el-form-item label="槽液信息:" prop="tank">
<el-select v-model="lineForm.tank" placeholder="请选择" style="width: 220px;">
<el-option v-for="item in tankData" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col> -->
<el-col :span="5">
<el-form-item label="分析项目:" prop="testElement">
<!-- <el-select v-model="lineForm.tank" placeholder="请选择" style="width: 220px;">
<el-option v-for="item in tankData" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select> -->
<el-input v-model="lineForm.testElement" style="width: 220px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="时间范围:" prop="timeRange">
<el-date-picker v-model="lineForm.timeRange" type="daterange" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" range-separator="至" start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item style="float: right;">
<el-button type="primary" @click="createLine">搜索</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="height: 600px;">
<avue-crud :option="addoption" :table-loading="loading" :data="reportData" v-model="form" v-model:page="page"
ref="crud" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" @on-load="onLoad" :before-open="beforeOpen">
</avue-crud>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog">取 消</el-button>
<el-button type="primary" @click="submit">保 存</el-button>
</span>
</template>
</el-dialog>
<el-dialog title="详情" append-to-body v-model="detailBox" width="70%">
<div style="padding: 10px 0 30px;border-bottom:1px solid #eee;">
<div style="margin: 20px 0;">报告信息</div>
<!-- <div style="display: flex;flex-wrap: wrap;">
<div style="width: 33%;margin-bottom: 15px;">作业中心:{{ detailForm.wcName }}</div>
<div style="width: 33%;margin-bottom: 15px;">槽号:{{ detailForm.slotNo }}</div>
<div style="width: 33%;margin-bottom: 15px;">检测成分:{{ detailForm.testName }}</div>
<div style="width: 33%;">曲线时间范围:{{ detailForm.lineTime }}</div>
<div style="width: 33%;">操作人:{{ detailForm.createTime }}</div>
<div style="width: 33%;">曲线生产时间:{{ detailForm.createUser }}</div>
</div> -->
</div>
<!-- <div style="margin: 20px 0;">
检测曲线
</div> -->
<!-- <div style="width: 100%;height: 520px;" ref="lineChart"></div> -->
</el-dialog>
</div>
</template>
<script>
import { detail } from '@/api/flow/flow'
import {getReportList,generateReport} from '@/api/tankSolutionSystem/resultsCon'
import {getWorkCenter,getTank,getPerson,getManager,getTeam,addInfo,getDetail,editInfo} from '@/api/tankSolutionSystem/info'
export default {
data() {
return {
data: [],
form: {},
query: {},
lineForm: {},
nameForm: {},
detailBox: false,
detailForm: {},
tankList:[],
workList:[],
reportData:[],
lineBox: false,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
loading: false,
option: {
tip: false,
size: 'medium',
height: 'auto',
align: 'center',
calcHeight: 32,
// simplePage: true,
columnSort: true,
searchShow: true,
searchMenuSpan: 12,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: true,
selection: true,
viewBtn: false,
delBtn: false,
addBtn: false,
editBtn: false,
editBtnText: '修改',
viewBtnText: '详情',
labelWidth: 120,
// menuWidth: 200,
dialogWidth: 1200,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
excelBtn: true,
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
index: false,
showOverflowTooltip: true,
searchLabelPosition: 'left',
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
column: [
{
label: '报告名称',
prop: 'name',
sortable: true,
filter: true,
span: 8,
search: true,
},
{
label: '生成时间',
prop: 'createTime',
sortable: true,
filter: true,
span: 8,
search: true,
},
{
label: '维护人',
prop: 'lineTime',
sortable: true,
filter: true,
span: 8,
search: false,
width: 240,
},
{
label: '维护时间',
prop: 'updateTime',
sortable: true,
filter: true,
span: 8,
search: false,
},
]
},
testData: [],
maxData: [],
minData: [],
xData: [],
lineTitle: '',
isShowBox: false,
selectionList: [],
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
loading: false,
addoption: {
addRowBtn: true,
tip: false,
size: 'medium',
// height: 'auto',
align: 'center',
calcHeight: 32,
// simplePage: true,
columnSort: true,
searchShow: true,
searchMenuSpan: 6,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: true,
selection: false,
viewBtn: false,
delBtn: false,
addBtn: false,
editBtn: false,
editBtnText: '修改',
viewBtnText: '详情',
labelWidth: 120,
// menuWidth: 200,
dialogWidth: 1200,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
excelBtn: true,
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
index: false,
showOverflowTooltip: true,
menu: false,
header: false,
searchLabelPosition: 'left',
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
column: [
{
label: '取样时间',
prop: 'lineName',
type:'date',
sortable: true,
filter: true,
span: 8,
search: false,
width: 120,
cell: true,
},
{
label: '温度(℃)',
prop: 'temperatureActual',
sortable: true,
filter: true,
span: 8,
search: false,
width: 120,
cell: true,
},
{
label: '槽号',
prop: 'workTankId',
search: false,
type: 'select',
sortable: true,
filter: true,
addDisplay: false,
editDisplay: false,
viewDisplay: false,
span: 24,
width: 180,
cell: true,
dicUrl:'/api/blade-desk/BA/WorkTank/listForSelect',
props:{
label:'name',
value:'id'
}
},
{
label: '体积(L)',
prop: 'volume',
sortable: true,
filter: true,
span: 8,
search: false,
width: 120,
cell: true,
},
{
label: '分析项目',
prop: 'testElement',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '规范下限(g/L)',
prop: 'normValueMin',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '目标下限(g/L)',
prop: 'targetValueMin',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '添加点(g/L)',
prop: 'fillingLocation',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '目标值(g/L)',
prop: 'targetValue',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '目标上限(g/L)',
prop: 'targetValueMax',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '规范上限(g/L)',
prop: 'normValueMax',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '化验频率',
prop: 'createUser',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '化验值(g/L)',
prop: 'firstTestValue',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '药品计算公式',
prop: 'createUser',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '药品添加量',
prop: 'actualAddValue',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '药品批次号',
prop: 'drugBatCode',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '药品监督员签名',
prop: 'createUser',
sortable: true,
filter: true,
span: 8,
search: false,
width: 160,
cell: true,
},
{
label: '药品添加人签名',
prop: 'createUser',
sortable: true,
filter: true,
span: 8,
search: false,
width: 160,
cell: true,
},
{
label: '调整后化验值(g/L)',
prop: 'repeatTestValue',
sortable: true,
filter: true,
span: 8,
search: false,
width: 170,
cell: true,
type:'select',
dictData:[
{
label:'合格',
value:1,
},
{
label:"不合格",
value:2
}
]
},
{
label: '是否合格',
prop: 'qualified',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '有效期',
prop: 'createUser',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '超出规范极限调整后的结果',
prop: 'createUser',
sortable: true,
filter: true,
span: 8,
search: false,
width: 240,
cell: true,
},
{
label: '槽液清理记录',
prop: 'createUser',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
{
label: '控制规范',
prop: 'createUser',
sortable: true,
filter: true,
span: 8,
search: false,
width: 140,
cell: true,
},
]
}
}
},
mounted() {
this.getWorkCenterList()
this.getTankList()
},
methods: {
handleLine() {
this.reportData = []
this.lineBox = true
},
createLine() {
// 传 作业中心 workCenterId 作业槽workTankId 槽液liquidTankId 分析项目testElement 时间范围 createTimeStart createTimeEnd
console.log('lineForm--------',this.lineForm)
let params = {
workCenterId:this.lineForm.workCenterId,
workTankId:this.lineForm.workTankId,
testElement:this.lineForm.testElement,
createTimeStart:this.lineForm.timeRange.length != 0 ? this.lineForm.timeRange[0] : '',
createTimeEnd:this.lineForm.timeRange.length != 0 ? this.lineForm.timeRange[1] : '',
}
generateReport(params).then(res =>{
this.reportData = res.data.data.records.map(item =>{
return {
$cellEdit:true,
...item
}
})
console.log('this.reportData===============',this.reportData)
})
// this.data = [
// { $cellEdit: true, id: '1', lineName: '氰化钠', wcName: '化学镀镍作业中心', slotNo: '#21', testName: '氰化钠', lineTime: '2016-10-15 ~ 2016-10-21', createTime: '2016-09-21 08:50:08', createUser: '张三' },
// { $cellEdit: true, id: '2', lineName: '氰化钠', wcName: '化学镀镍作业中心', slotNo: '#21', testName: '氰化钠', lineTime: '2016-10-15 ~ 2016-10-21', createTime: '2016-09-21 08:50:08', createUser: '张三' },
// { $cellEdit: true, id: '3', lineName: '氰化钠', wcName: '化学镀镍作业中心', slotNo: '#21', testName: '氰化钠', lineTime: '2016-10-10 ~ 2016-10-21', createTime: '2016-09-21 08:50:08', createUser: '张三' },
// { $cellEdit: true, id: '4', lineName: '氰化钠', wcName: '化学镀镍作业中心', slotNo: '#21', testName: '氰化钠', lineTime: '2016-10-18 ~ 2016-10-21', createTime: '2016-09-21 08:50:08', createUser: '张三' },
// ]
},
// 作业中心下拉
getWorkCenterList(){
getWorkCenter().then(res =>{
this.workList = res.data.data
})
},
// 切换作业中心
changeWorkCenter(){
this.lineForm.workTankId = ''
this.getTankList(this.lineForm.workCenterId)
},
// 查询作业槽下拉列表
getTankList(val){
getTank({workstationId:val ? val : ''}).then(res =>{
this.tankList = res.data.data
})
},
//计算方法
getDateCount(sDate, eDate) {
// 定义起始日期和结束日期
let startDate = new Date(sDate); // 例如:2023年1月1日
let endDate = new Date(eDate); // 例如:2023年1月10日
// 确保起始日期小于等于结束日期
if (startDate > endDate) {
[startDate, endDate] = [endDate, startDate];
}
// 存储所有日期的数组
let allDates = [];
let currentDate = new Date(startDate);
let totalDays = 0;
// 循环遍历每一天
while (currentDate <= endDate) {
allDates.push(new Date(currentDate)); // 添加当前日期到数组
totalDays++; // 增加天数计数
currentDate.setDate(currentDate.getDate() + 1); // 移动到下一天
}
return {
dates: allDates.map(date => date.toISOString().slice(0, 10)), totalDays
}
},
beforeOpen(done, type) {
if (['add', 'edit'].includes(type)) {
this.initData();
}
if (['edit', 'view'].includes(type)) {
getMenu(this.form.id).then(res => {
this.form = Object.assign(res.data.data, {
hasChildren: this.form.hasChildren,
});
if (this.form.parentId === '0') {
this.form.parentId = '';
}
});
}
done();
},
handleView(row) {
console.log('row-------------------', row)
this.detailForm = row
let data = row.lineTime.split(' ~ ')
console.log('data------------------', data)
this.lineTitle = '槽号:' + row.slotNo + ' 检测成分:氰化铜'
//调用方法
let days = this.getDateCount(data[0], data[1]);
console.log(days);
this.xData = days.dates
this.testData = []
this.maxData = []
this.minData = []
for (let i = 0; i < days.totalDays; i++) {
// 生成一个介于0到99之间的随机整数(包括0和99)
let randomInteger = Math.floor(Math.random() * 30);
// 将随机整数添加到数组中
this.testData.push(randomInteger);
this.minData.push(5);
this.maxData.push(30);
}
this.$nextTick(() => {
this.createBarChart()
this.detailBox = true
})
},
createBarChart() {
const mapBoxEchart = this.$echarts.init(this.$refs.lineChart);
const option = {
title: {
text: this.lineTitle,
left: "center",
},
legend: {
show: true,
orient: "vertical",
right: 'right'
},
grid: {
containLabel: true,
left: 20,
right: 20,
bottom: '1%',
top: '15%'
},
tooltip: {
// 提示框组件
trigger: 'axis', // 触发类型 柱状图
axisPointer: { type: 'shadow' } // 触发效果 移动上去 背景效果
},
xAxis: {
axisLabel: {
color: '#000',
fontSize: 14,
interval: 0
},
axisTick: {
show: false
},
splitLine: {
show: false
},
axisLine: {
show: true
},
data: this.xData,
type: 'category'
},
yAxis: {
axisLabel: {
color: '#000',
fontSize: 14
},
max: this.maxData[0] + 10,
axisTick: {
show: false
},
splitLine: {
show: true
},
axisLine: {
show: true
},
name: ''
},
series: [
{
name: '上限', // 名称
data: this.maxData,
type: 'line',
itemStyle: {
color: '#6480e1'
},
label: {
show: false,
position: 'top',
color: '#000'
}
},
{
name: '下限', // 名称
data: this.minData,
type: 'line',
smooth: true,
itemStyle: {
color: '#c0db50'
},
label: {
show: false,
color: '#fff'
}
},
{
name: '检测值', // 名称
data: this.testData,
type: 'line',
itemStyle: {
color: '#6a6d87'
},
label: {
show: false,
color: '#fff'
}
}
]
};
// 使用制定的配置项和数据显示图表
mapBoxEchart.setOption(option, true);
// // 窗口大小改变时,重新渲染图表
window.addEventListener('resize', function () {
mapBoxEchart.resize();
}, 200);
},
// 多选
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
rowUpdate(row, index, done, loading) {
},
rowSave(row, done, loading) {
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
rowDel(row, index, done) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
})
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据');
return;
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
})
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
onLoad() {
this.loading = true
getReportList({
current:this.page.currentPage,
size:this.page.pageSize
}).then(res =>{
this.data = res.data.data.records
this.page.total = res.data.data.total
this.loading = false
})
// this.data = [
// { $cellEdit: true, id: '1', lineName: '氰化钠', wcName: '化学镀镍作业中心', slotNo: '#21', testName: '氰化钠', lineTime: '2016-10-15 ~ 2016-10-21', createTime: '2016-09-21 08:50:08', createUser: '张三' },
// { $cellEdit: true, id: '2', lineName: '氰化钠', wcName: '化学镀镍作业中心', slotNo: '#21', testName: '氰化钠', lineTime: '2016-10-15 ~ 2016-10-21', createTime: '2016-09-21 08:50:08', createUser: '张三' },
// { $cellEdit: true, id: '3', lineName: '氰化钠', wcName: '化学镀镍作业中心', slotNo: '#21', testName: '氰化钠', lineTime: '2016-10-10 ~ 2016-10-21', createTime: '2016-09-21 08:50:08', createUser: '张三' },
// { $cellEdit: true, id: '4', lineName: '氰化钠', wcName: '化学镀镍作业中心', slotNo: '#21', testName: '氰化钠', lineTime: '2016-10-18 ~ 2016-10-21', createTime: '2016-09-21 08:50:08', createUser: '张三' },
// ]
// this.page.total = this.data.length
// this.loading = false
// setTimeout(() => {
// this.selectionClear()
// }, 500)
}
}
}
</script>
<style></style>