Merge pull request 'projects/qhd-line-zhp' (#465) from projects/qhd-line-zhp into projects/qhd-line-test
Reviewed-on: #465
This commit is contained in:
4
.env.dev
4
.env.dev
@@ -12,8 +12,8 @@ ENV = 'development'
|
||||
VUE_APP_TITLE = 智能监控分析系统
|
||||
|
||||
# 芋道管理系统/开发环境
|
||||
VUE_APP_BASE_API = 'http://172.16.32.79:48082'
|
||||
# VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
|
||||
# VUE_APP_BASE_API = 'http://172.16.32.79:48082'
|
||||
VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
|
||||
|
||||
|
||||
# 路由懒加载
|
||||
|
||||
@@ -111,3 +111,10 @@ export function getProcessAutoReportNew(data) {
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
export function getProcessAutoReportLastGroup(data) {
|
||||
return request({
|
||||
url: '/monitoring/production-monitor/getProcessAutoReportLastGroup',
|
||||
method: 'post',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<!-- <el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label=" 基板类型" prop="typeDictValue">
|
||||
<el-select :disabled="isdetail" v-model="dataForm.typeDictValue" clearable style="width: 100%"
|
||||
@@ -89,7 +89,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row> -->
|
||||
</el-form>
|
||||
|
||||
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
||||
|
||||
@@ -348,7 +348,7 @@ export default {
|
||||
dataListLoading: false,
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`monitoring:group-off:update`)
|
||||
this.$auth.hasPermi(`monitoring:group-off:detail`)
|
||||
? {
|
||||
type: 'eq',
|
||||
btnName: '详情',
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
<el-tabs v-model="activeLabel" :stretch="true" @tab-click="handleTabClick">
|
||||
<el-tab-pane :label="'全部数据'" name="table">
|
||||
<base-table-s ref="lineCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
|
||||
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="300" />
|
||||
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="220" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
|
||||
<el-tab-pane :label="'\u3000生产折线图\u3000'" name="graph">
|
||||
<div style="height: 230px;" v-if="activeLabel == 'graph'" class="graph">
|
||||
<barChart v-if="tableData && tableData.length > 0" ref="barChart" height="230px"
|
||||
:bar-data="tableData" />
|
||||
@@ -59,7 +59,7 @@
|
||||
<base-table-s ref="lineTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
|
||||
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="300" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
|
||||
<el-tab-pane :label="'\u3000生产折线图\u3000'" name="graph">
|
||||
<div style="height: 230px;" v-if="activeLabelDay == 'graph'" class="graph">
|
||||
<barChart v-if="tableData2 && tableData2.length > 0" ref="barChart" height="230px"
|
||||
:bar-data="tableData2" />
|
||||
@@ -72,50 +72,30 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-inner" v-if="listQuery.timeType === 3">
|
||||
<!-- 当班数据(占1/2剩余高度) -->
|
||||
<div class="content-card energyOverlimitLog">
|
||||
<span class="blue-block"></span>
|
||||
<span class="tip">上一班数据</span>
|
||||
<el-row style="margin-top: 10px;">
|
||||
<el-col class="custom-tabs">
|
||||
<el-tabs v-model="activeLabel" :stretch="true" @tab-click="handleTabClick">
|
||||
<el-tab-pane :label="'全部数据'" name="table">
|
||||
<base-table-s ref="lineCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
|
||||
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="300" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
|
||||
<div style="height: 230px;" v-if="activeLabel == 'graph'" class="graph">
|
||||
<barChart v-if="tableData && tableData.length > 0" ref="barChart" height="230px"
|
||||
:bar-data="tableData" />
|
||||
<div v-else class="no-data-bg"></div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<span class="tip" v-if="listQuery.startTime && listQuery.endTime">
|
||||
<span>{{ reportTypeMap[listQuery.reportType] }}</span>
|
||||
<span>
|
||||
{{ parseTime(listQuery.startTime) }} 至{{
|
||||
parseTime(listQuery.endTime) }}
|
||||
</span>
|
||||
</span>
|
||||
<span class="tip" v-else>生产数据 </span>
|
||||
<div class="graph">
|
||||
<base-table-s ref="lineCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
|
||||
:limit="100" :table-props="tableProps" :max-height="300" :table-data="tableDataCustom" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 当天数据(占1/2剩余高度) -->
|
||||
<div class="content-card energyOverlimitLog">
|
||||
<span class="blue-block"></span>
|
||||
<span class="tip">当天数据</span>
|
||||
<el-row style="margin-top: 10px;">
|
||||
<el-col class="custom-tabs">
|
||||
<el-tabs v-model="activeLabelDay" :stretch="true" @tab-click="handleTabClick">
|
||||
<el-tab-pane :label="'全部数据'" name="table">
|
||||
<base-table-s ref="lineTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
|
||||
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="300" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
|
||||
<div style="height: 230px;" v-if="activeLabelDay == 'graph'" class="graph">
|
||||
<barChart v-if="tableData2 && tableData2.length > 0" ref="barChart" height="230px"
|
||||
:bar-data="tableData2" />
|
||||
<div v-else class="no-data-bg"></div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<span class="tip">生产折线图</span>
|
||||
<div style="width: 100%;height: 100%;" class="graph">
|
||||
<barChart v-if="tableDataCustom && tableDataCustom.length > 0" ref="barChart"
|
||||
:bar-data="tableDataCustom" />
|
||||
<div v-else class="no-data-bg"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 3.2 时间维度为“自定义”时的内容(两个平分高度的div) -->
|
||||
@@ -126,10 +106,10 @@
|
||||
<span>{{ reportTypeMap[listQuery.reportType] }}</span>
|
||||
<span>
|
||||
{{ parseTime(listQuery.startTime) }} 至{{
|
||||
parseTime(listQuery.endTime) }}
|
||||
parseTime(listQuery.endTime) }}
|
||||
</span>
|
||||
</span>
|
||||
<span class="tip" v-else>生产表格数据 </span>
|
||||
<span class="tip" v-else>生产数据 </span>
|
||||
<div class="graph">
|
||||
<base-table-s ref="lineCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
|
||||
:limit="100" :table-props="tableProps" :max-height="300" :table-data="tableDataCustom" />
|
||||
@@ -183,10 +163,10 @@
|
||||
<span>{{ reportTypeMap[listQuery.reportType] }}</span>
|
||||
<span>
|
||||
{{ parseTime(listQuery.startTime) }} 至{{
|
||||
parseTime(listQuery.endTime) }}
|
||||
parseTime(listQuery.endTime) }}
|
||||
</span>
|
||||
</span>
|
||||
<span class="tip" v-else>生产表格数据 </span>
|
||||
<span class="tip" v-else>生产数据 </span>
|
||||
<base-table-s ref="productCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
|
||||
:limit="100" :table-props="productTableProps" :table-data="productTableData" :max-height="300" />
|
||||
</div>
|
||||
@@ -199,7 +179,7 @@
|
||||
<script>
|
||||
import { parseTime } from '@/filter/code-filter';
|
||||
import {
|
||||
getLineAuto, getPdList, getPdlAutoReportNewSearchNow, getProductAuto,
|
||||
getLineAuto, getPLlistByFactory, getPdlAutoReportNewSearchNow, getProcessAutoReportLastGroup,
|
||||
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew, getPdlAutoReportNewSearchLastGroup
|
||||
} from '@/api/core/monitoring/auto';
|
||||
import { getFactoryPage } from '@/api/core/base/factory';
|
||||
@@ -401,7 +381,7 @@ export default {
|
||||
activeLabel: 'table', // 当班数据tab
|
||||
activeLabelDay: 'table', // 当天数据tab
|
||||
fileName: '',
|
||||
headFormValue: {},
|
||||
headFormValue:{},
|
||||
dataListLoading: false,
|
||||
tableProps,
|
||||
factoryColumns: [],
|
||||
@@ -423,7 +403,8 @@ export default {
|
||||
],
|
||||
product: [ // 按产品监控(不含上一班)
|
||||
{ id: 1, name: '当天' },
|
||||
{ id: 2, name: '自定义' }
|
||||
{ id: 2, name: '自定义' },
|
||||
{ id: 3, name: '上一班' }
|
||||
]
|
||||
},
|
||||
formConfig: [
|
||||
@@ -563,6 +544,13 @@ export default {
|
||||
productTablePropsDay() {
|
||||
// 当天数据的完整表头(基础列 + 当天动态表头)
|
||||
const baseColumns = [
|
||||
{
|
||||
prop: 'sizes',
|
||||
label: '规格',
|
||||
width: 105,
|
||||
showOverflowtooltip: true,
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
prop: 'process',
|
||||
label: '产品工艺',
|
||||
@@ -571,7 +559,7 @@ export default {
|
||||
{
|
||||
prop: 'processType',
|
||||
label: '产品类型',
|
||||
filter: (val) => (val != 1 ? '面板' : '背板'),
|
||||
filter: (val) => (val === 1 ? '面板' : '背板'),
|
||||
sortable: true,
|
||||
fixed: true
|
||||
},
|
||||
@@ -681,7 +669,7 @@ export default {
|
||||
);
|
||||
const timeLabel = {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1, timeLabel);
|
||||
@@ -702,12 +690,16 @@ export default {
|
||||
type: 'label',
|
||||
label: `刷新时间: ${this.formatCurrentTime()}`,
|
||||
};
|
||||
this.listQuery.timeType = 3;
|
||||
if (this.$refs.searchBarForm) {
|
||||
this.$refs.searchBarForm.formInline.timeType = 3;
|
||||
}
|
||||
if (timeItemIndex > -1) {
|
||||
this.formConfig.splice(timeItemIndex, 1, timeLabel);
|
||||
} else {
|
||||
this.formConfig.push(timeLabel);
|
||||
}
|
||||
this.getProductList();
|
||||
this.getProductLastList();
|
||||
|
||||
}
|
||||
},
|
||||
@@ -920,7 +912,9 @@ export default {
|
||||
},
|
||||
// 获取产线和工厂列表
|
||||
getPdLineList() {
|
||||
getPdList().then(res => {
|
||||
getPLlistByFactory({
|
||||
factoryIds:this.listQuery.factoryIds
|
||||
}).then(res => {
|
||||
this.formConfig[3].selectOptions = res.data || [];
|
||||
});
|
||||
|
||||
@@ -1068,7 +1062,11 @@ export default {
|
||||
this.getDataList();
|
||||
}
|
||||
} else {
|
||||
this.getProductList();
|
||||
if (this.listQuery.timeType === 3) {
|
||||
this.getProductLastList();
|
||||
} else {
|
||||
this.getProductList();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'export':
|
||||
@@ -1150,7 +1148,7 @@ export default {
|
||||
this.listQuery.lineId = undefined;
|
||||
this.listQuery.processType = this.headFormValue.processType ? this.headFormValue.processType : [];
|
||||
this.listQuery.reportType = this.headFormValue.reportType || undefined;
|
||||
this.listQuery.timeType = this.headFormValue.timeType || undefined;
|
||||
this.listQuery.timeType = this.headFormValue.timeType ? this.headFormValue.timeType : this.listQuery.timeType;
|
||||
this.listQuery.searchType = this.headFormValue.searchType || undefined
|
||||
if (this.listQuery.timeType === 2) {
|
||||
const resGroup = await getProcessAutoReportNew(this.listQuery);
|
||||
@@ -1158,6 +1156,9 @@ export default {
|
||||
|
||||
// 格式化数据:lineDetList提取到外层,键名加lineId前缀
|
||||
const formatData = (rawList) => {
|
||||
if (!Array.isArray(rawList) || rawList.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return rawList.map(item => {
|
||||
// 解构出 lineDetList 和其他字段(rest)
|
||||
const { lineDetList = [], ...rest } = item;
|
||||
@@ -1206,6 +1207,9 @@ export default {
|
||||
|
||||
// 格式化数据:lineDetList提取到外层,键名加lineId前缀
|
||||
const formatData = (rawList) => {
|
||||
if (!Array.isArray(rawList) || rawList.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return rawList.map(item => {
|
||||
// 解构出 lineDetList 和其他字段(rest)
|
||||
const { lineDetList = [], ...rest } = item;
|
||||
@@ -1266,7 +1270,72 @@ export default {
|
||||
}
|
||||
|
||||
},
|
||||
async getProductLastList() {
|
||||
console.log('last');
|
||||
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.factoryId = this.headFormValue.factoryId || []
|
||||
this.listQuery.process = this.headFormValue.process ? this.headFormValue.process : [];
|
||||
this.listQuery.lineId = undefined;
|
||||
this.listQuery.processType = this.headFormValue.processType ? this.headFormValue.processType : [];
|
||||
this.listQuery.reportType = this.headFormValue.reportType || undefined;
|
||||
this.listQuery.timeType = this.headFormValue.timeType ? this.headFormValue.timeType : this.listQuery.timeType;
|
||||
this.listQuery.searchType = this.headFormValue.searchType || undefined
|
||||
if (this.listQuery.timeType === 3) {
|
||||
const resGroup = await getProcessAutoReportLastGroup(this.listQuery);
|
||||
console.log('resGroup', resGroup);
|
||||
|
||||
// 格式化数据:lineDetList提取到外层,键名加lineId前缀
|
||||
const formatData = (rawList) => {
|
||||
if (!Array.isArray(rawList) || rawList.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return rawList.map(item => {
|
||||
// 解构出 lineDetList 和其他字段(rest)
|
||||
const { lineDetList = [], ...rest } = item;
|
||||
|
||||
// 遍历 lineDetList 中的每一项,逐个格式化并合并
|
||||
const formattedLineData = lineDetList.reduce((acc, lineData) => {
|
||||
// 取当前 lineData 的 lineId 作为前缀(确保存在,否则用空字符串)
|
||||
const lineIdPrefix = lineData.lineId ? String(lineData.lineId) : '';
|
||||
|
||||
// 为当前 lineData 的每个字段添加 lineId 前缀,合并到累加器中
|
||||
Object.entries(lineData).forEach(([key, value]) => {
|
||||
const newKey = lineIdPrefix ? `${lineIdPrefix}${key}` : key;
|
||||
acc[newKey] = value;
|
||||
});
|
||||
|
||||
return acc;
|
||||
}, {}); // 初始值为空对象
|
||||
|
||||
// 合并外层字段和所有格式化后的 lineDetList 字段
|
||||
return { ...rest, ...formattedLineData };
|
||||
});
|
||||
};
|
||||
|
||||
// 处理当班和当天数据(分别存储)
|
||||
this.productTableData = formatData(resGroup.data.list); // 当班数据
|
||||
console.log(this.productTableData, 'productTableData');
|
||||
|
||||
// --------------------------
|
||||
// 生成当班数据的动态表头
|
||||
// --------------------------
|
||||
const groupLineDatas = [];
|
||||
resGroup.data.list.forEach(item => {
|
||||
if (item.lineDetList && item.lineDetList.length) {
|
||||
groupLineDatas.push(...item.lineDetList);
|
||||
}
|
||||
});
|
||||
// 去重当班数据的产线(按lineId)
|
||||
const uniqueGroupLines = Array.from(
|
||||
new Map(groupLineDatas.map(line => [line.lineId, line])).values()
|
||||
);
|
||||
// 生成当班数据的表头(一级:产线名,二级:指标)
|
||||
this.factoryColumns = this.generateLineColumns(uniqueGroupLines);
|
||||
}
|
||||
|
||||
},
|
||||
// 生成动态表头:一级为产线名,二级为产线数据指标
|
||||
generateLineColumns(lines) {
|
||||
// lines为去重后的产线列表(单个元素为一条产线数据)
|
||||
@@ -1362,8 +1431,8 @@ export default {
|
||||
},
|
||||
// 为当天时调用的接口
|
||||
getLastDayDataList() {
|
||||
getPdlAutoReportNewSearchLastGroup().then((response) => {
|
||||
this.tableData = response.data.classData.map((item, index) => {
|
||||
getPdlAutoReportNewSearchLastGroup(this.listQuery).then((response) => {
|
||||
this.tableDataCustom = response.data.classData.map((item, index) => {
|
||||
item.originalLossNum = item.original?.lossNum;
|
||||
item.originalLossArea = item.original?.lossArea;
|
||||
item.edgeLossNum = item.edge?.lossNum;
|
||||
@@ -1384,7 +1453,7 @@ export default {
|
||||
});
|
||||
},
|
||||
getDayDataList() {
|
||||
getPdlAutoReportNewSearchNow().then((response) => {
|
||||
getPdlAutoReportNewSearchNow(this.listQuery).then((response) => {
|
||||
this.tableData = response.data.classData.map((item, index) => {
|
||||
item.originalLossNum = item.original?.lossNum;
|
||||
item.originalLossArea = item.original?.lossArea;
|
||||
@@ -1448,6 +1517,43 @@ export default {
|
||||
// 搜索栏下拉选择变化
|
||||
handleSearchBarChanged({ param, value }) {
|
||||
if (param === 'timeType') {
|
||||
this.tableData2 = []
|
||||
this.tableDataCustom = []
|
||||
this.tableData = []
|
||||
const resetCommon = () => {
|
||||
// 重置搜索表单的筛选条件
|
||||
if (this.$refs.searchBarForm) {
|
||||
const form = this.$refs.searchBarForm.formInline;
|
||||
form.timeVal = undefined;
|
||||
form.timeType = 1;
|
||||
form.reportType = undefined;
|
||||
form.searchType = undefined;
|
||||
form.lineId = undefined;
|
||||
form.factoryId = undefined;
|
||||
form.process = undefined;
|
||||
form.processType = undefined;
|
||||
}
|
||||
// 重置查询参数
|
||||
this.listQuery = {
|
||||
...this.listQuery, // 保留分页等基础参数
|
||||
factoryId: undefined,
|
||||
process: undefined,
|
||||
lineId: undefined,
|
||||
processType: undefined,
|
||||
reportType: undefined,
|
||||
timeType: 1,
|
||||
searchType: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined
|
||||
};
|
||||
// 重置表单配置中公共隐藏的项
|
||||
this.formConfig[1].type = ''; // 隐藏查询类型
|
||||
this.formConfig[6].type = ''; // 隐藏报表类型
|
||||
this.formConfig[7].type = ''; // 隐藏时间范围
|
||||
};
|
||||
|
||||
// 3. 执行公共重置
|
||||
resetCommon();
|
||||
this.listQuery.timeType = value;
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
@@ -1564,7 +1670,9 @@ export default {
|
||||
// 切换工厂时刷新产线列表
|
||||
this.listQuery.lineId = [];
|
||||
this.$refs.searchBarForm.formInline.lineId = undefined;
|
||||
getPdList(value).then(res => {
|
||||
getPLlistByFactory({
|
||||
factoryIds:value
|
||||
}).then(res => {
|
||||
this.formConfig[3].selectOptions = res.data || [];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ const tableProps = [
|
||||
},
|
||||
{
|
||||
prop: 'thick',
|
||||
label: '玻璃长度/mm'
|
||||
label: '玻璃厚度/mm'
|
||||
},
|
||||
];
|
||||
|
||||
@@ -275,7 +275,7 @@ export default {
|
||||
fileName += this.listQuery.thick + '_';
|
||||
}
|
||||
// 添加时间戳避免文件名重复
|
||||
fileName += + '.xlsx';
|
||||
fileName + '.xlsx';
|
||||
|
||||
FileSaver.saveAs(blob, fileName);
|
||||
this.$message.success('导出成功');
|
||||
|
||||
@@ -358,8 +358,8 @@ export default {
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = { ...this.listQuery };
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
// params.pageNo = undefined;
|
||||
// params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出下片日志?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportDownLogData(params);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<base-table-s ref="lineCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
|
||||
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="300" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
|
||||
<el-tab-pane :label="'\u3000生产折线图\u3000'" name="graph">
|
||||
<div style="height: 230px;" v-if="activeLabel == 'graph'" class="graph">
|
||||
<barChart v-if="tableData && tableData.length > 0" ref="barChart" height="230px"
|
||||
:bar-data="tableData" />
|
||||
@@ -59,7 +59,7 @@
|
||||
<base-table-s ref="lineTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
|
||||
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="300" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
|
||||
<el-tab-pane :label="'\u3000生产折线图\u3000'" name="graph">
|
||||
<div style="height: 230px;" v-if="activeLabelDay == 'graph'" class="graph">
|
||||
<barChart v-if="tableData2 && tableData2.length > 0" ref="barChart" height="230px"
|
||||
:bar-data="tableData2" />
|
||||
@@ -72,50 +72,30 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-inner" v-if="listQuery.timeType === 3">
|
||||
<!-- 当班数据(占1/2剩余高度) -->
|
||||
<div class="content-card energyOverlimitLog">
|
||||
<span class="blue-block"></span>
|
||||
<span class="tip">上一班数据</span>
|
||||
<el-row style="margin-top: 10px;">
|
||||
<el-col class="custom-tabs">
|
||||
<el-tabs v-model="activeLabel" :stretch="true" @tab-click="handleTabClick">
|
||||
<el-tab-pane :label="'全部数据'" name="table">
|
||||
<base-table-s ref="lineCurrentShiftTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'"
|
||||
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData" :max-height="300" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
|
||||
<div style="height: 230px;" v-if="activeLabel == 'graph'" class="graph">
|
||||
<barChart v-if="tableData && tableData.length > 0" ref="barChart" height="230px"
|
||||
:bar-data="tableData" />
|
||||
<div v-else class="no-data-bg"></div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<span class="tip" v-if="listQuery.startTime && listQuery.endTime">
|
||||
<span>{{ reportTypeMap[listQuery.reportType] }}</span>
|
||||
<span>
|
||||
{{ parseTime(listQuery.startTime) }} 至{{
|
||||
parseTime(listQuery.endTime) }}
|
||||
</span>
|
||||
</span>
|
||||
<span class="tip" v-else>生产数据 </span>
|
||||
<div class="graph">
|
||||
<base-table-s ref="lineCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
|
||||
:limit="100" :table-props="tableProps" :max-height="300" :table-data="tableDataCustom" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 当天数据(占1/2剩余高度) -->
|
||||
<div class="content-card energyOverlimitLog">
|
||||
<span class="blue-block"></span>
|
||||
<span class="tip">当天数据</span>
|
||||
<el-row style="margin-top: 10px;">
|
||||
<el-col class="custom-tabs">
|
||||
<el-tabs v-model="activeLabelDay" :stretch="true" @tab-click="handleTabClick">
|
||||
<el-tab-pane :label="'全部数据'" name="table">
|
||||
<base-table-s ref="lineTodayTable" style="margin-bottom: 16px;" v-if="activeLabelDay == 'table'"
|
||||
:page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" :max-height="300" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="'\u3000当天生产折线图\u3000'" name="graph">
|
||||
<div style="height: 230px;" v-if="activeLabelDay == 'graph'" class="graph">
|
||||
<barChart v-if="tableData2 && tableData2.length > 0" ref="barChart" height="230px"
|
||||
:bar-data="tableData2" />
|
||||
<div v-else class="no-data-bg"></div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<span class="tip">生产折线图</span>
|
||||
<div style="width: 100%;height: 100%;" class="graph">
|
||||
<barChart v-if="tableDataCustom && tableDataCustom.length > 0" ref="barChart"
|
||||
:bar-data="tableDataCustom" />
|
||||
<div v-else class="no-data-bg"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 3.2 时间维度为“自定义”时的内容(两个平分高度的div) -->
|
||||
@@ -129,7 +109,7 @@
|
||||
parseTime(listQuery.endTime) }}
|
||||
</span>
|
||||
</span>
|
||||
<span class="tip" v-else>生产表格数据 </span>
|
||||
<span class="tip" v-else>生产数据 </span>
|
||||
<div class="graph">
|
||||
<base-table-s ref="lineCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
|
||||
:limit="100" :table-props="tableProps" :max-height="300" :table-data="tableDataCustom" />
|
||||
@@ -186,7 +166,7 @@
|
||||
parseTime(listQuery.endTime) }}
|
||||
</span>
|
||||
</span>
|
||||
<span class="tip" v-else>生产表格数据 </span>
|
||||
<span class="tip" v-else>生产数据 </span>
|
||||
<base-table-s ref="productCustomTable" style="margin-bottom: 16px;" v-if="activeLabel == 'table'" :page="1"
|
||||
:limit="100" :table-props="productTableProps" :table-data="productTableData" :max-height="300" />
|
||||
</div>
|
||||
@@ -199,7 +179,7 @@
|
||||
<script>
|
||||
import { parseTime } from '@/filter/code-filter';
|
||||
import {
|
||||
getLineAuto, getPdList, getPdlAutoReportNewSearchNow, getProductAuto,
|
||||
getLineAuto, getPdList, getPdlAutoReportNewSearchNow, getProcessAutoReportLastGroup,
|
||||
getProcessAutoReportGroup, getProcessAutoReportDay, getProcessAutoReportNew, getPdlAutoReportNewSearchLastGroup
|
||||
} from '@/api/core/monitoring/auto';
|
||||
import { getFactoryPage } from '@/api/core/base/factory';
|
||||
@@ -423,7 +403,9 @@ export default {
|
||||
],
|
||||
product: [ // 按产品监控(不含上一班)
|
||||
{ id: 1, name: '当天' },
|
||||
{ id: 2, name: '自定义' }
|
||||
{ id: 2, name: '自定义' },
|
||||
{ id: 3, name: '上一班' }
|
||||
|
||||
]
|
||||
},
|
||||
formConfig: [
|
||||
@@ -527,6 +509,13 @@ export default {
|
||||
productTableProps() {
|
||||
// 当班数据的完整表头(基础列 + 当班动态表头)
|
||||
const baseColumns = [
|
||||
{
|
||||
prop: 'sizes',
|
||||
label: '规格',
|
||||
width: 105,
|
||||
showOverflowtooltip: true,
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
prop: 'process',
|
||||
label: '产品工艺',
|
||||
@@ -535,7 +524,7 @@ export default {
|
||||
{
|
||||
prop: 'processType',
|
||||
label: '产品类型',
|
||||
filter: (val) => (val != 1 ? '面板' : '背板'),
|
||||
filter: (val) => (val === 1 ? '面板' : '背板'),
|
||||
sortable: true,
|
||||
fixed: true
|
||||
},
|
||||
@@ -550,6 +539,13 @@ export default {
|
||||
productTablePropsDay() {
|
||||
// 当天数据的完整表头(基础列 + 当天动态表头)
|
||||
const baseColumns = [
|
||||
{
|
||||
prop: 'sizes',
|
||||
label: '规格',
|
||||
width: 105,
|
||||
showOverflowtooltip: true,
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
prop: 'process',
|
||||
label: '产品工艺',
|
||||
@@ -601,7 +597,7 @@ export default {
|
||||
});
|
||||
|
||||
// 3. 初始化直接调用 按产品监控 的接口
|
||||
this.getProductList();
|
||||
// this.getProductList();
|
||||
this.getPdLineList();
|
||||
const queryParams = {
|
||||
pageNo: 1,
|
||||
@@ -701,7 +697,6 @@ export default {
|
||||
this.getLastDayDataList();
|
||||
|
||||
} else {
|
||||
this.getProductList();
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
);
|
||||
@@ -714,14 +709,84 @@ export default {
|
||||
} else {
|
||||
this.formConfig.push(timeLabel);
|
||||
}
|
||||
this.listQuery.timeType = 3;
|
||||
if (this.$refs.searchBarForm) {
|
||||
this.$refs.searchBarForm.formInline.timeType = 3;
|
||||
}
|
||||
// 按产品监控:显示产品工艺和类型,隐藏产线,时间维度移除上一班
|
||||
this.formConfig[0].selectOptions = this.timeTypeOptions.product; // 不含上一班
|
||||
this.formConfig[3].type = ''; // 隐藏产线
|
||||
this.formConfig[4].type = 'select'; // 显示产品工艺
|
||||
this.formConfig[5].type = 'select'; // 显示产品类型
|
||||
this.getProductLastList();
|
||||
}
|
||||
},
|
||||
async getProductLastList() {
|
||||
console.log('last');
|
||||
|
||||
this.listQuery.pageNo = 1;
|
||||
this.listQuery.pageSize = 10;
|
||||
this.listQuery.factoryId = this.headFormValue.factoryId || []
|
||||
this.listQuery.process = this.headFormValue.process ? this.headFormValue.process : [];
|
||||
this.listQuery.lineId = undefined;
|
||||
this.listQuery.processType = this.headFormValue.processType ? this.headFormValue.processType : [];
|
||||
this.listQuery.reportType = this.headFormValue.reportType || undefined;
|
||||
this.listQuery.timeType = this.headFormValue.timeType ? this.headFormValue.timeType : this.listQuery.timeType;
|
||||
this.listQuery.searchType = this.headFormValue.searchType || undefined
|
||||
if (this.listQuery.timeType === 3) {
|
||||
const resGroup = await getProcessAutoReportLastGroup(this.listQuery);
|
||||
console.log('resGroup', resGroup);
|
||||
|
||||
// 格式化数据:lineDetList提取到外层,键名加lineId前缀
|
||||
const formatData = (rawList) => {
|
||||
if (!Array.isArray(rawList) || rawList.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return rawList.map(item => {
|
||||
// 解构出 lineDetList 和其他字段(rest)
|
||||
const { lineDetList = [], ...rest } = item;
|
||||
|
||||
// 遍历 lineDetList 中的每一项,逐个格式化并合并
|
||||
const formattedLineData = lineDetList.reduce((acc, lineData) => {
|
||||
// 取当前 lineData 的 lineId 作为前缀(确保存在,否则用空字符串)
|
||||
const lineIdPrefix = lineData.lineId ? String(lineData.lineId) : '';
|
||||
|
||||
// 为当前 lineData 的每个字段添加 lineId 前缀,合并到累加器中
|
||||
Object.entries(lineData).forEach(([key, value]) => {
|
||||
const newKey = lineIdPrefix ? `${lineIdPrefix}${key}` : key;
|
||||
acc[newKey] = value;
|
||||
});
|
||||
|
||||
return acc;
|
||||
}, {}); // 初始值为空对象
|
||||
|
||||
// 合并外层字段和所有格式化后的 lineDetList 字段
|
||||
return { ...rest, ...formattedLineData };
|
||||
});
|
||||
};
|
||||
|
||||
// 处理当班和当天数据(分别存储)
|
||||
this.productTableData = formatData(resGroup.data.list); // 当班数据
|
||||
console.log(this.productTableData, 'productTableData');
|
||||
|
||||
// --------------------------
|
||||
// 生成当班数据的动态表头
|
||||
// --------------------------
|
||||
const groupLineDatas = [];
|
||||
resGroup.data.list.forEach(item => {
|
||||
if (item.lineDetList && item.lineDetList.length) {
|
||||
groupLineDatas.push(...item.lineDetList);
|
||||
}
|
||||
});
|
||||
// 去重当班数据的产线(按lineId)
|
||||
const uniqueGroupLines = Array.from(
|
||||
new Map(groupLineDatas.map(line => [line.lineId, line])).values()
|
||||
);
|
||||
// 生成当班数据的表头(一级:产线名,二级:指标)
|
||||
this.factoryColumns = this.generateLineColumns(uniqueGroupLines);
|
||||
}
|
||||
|
||||
},
|
||||
// 导出表格
|
||||
handleExport() {
|
||||
// 按产线监控
|
||||
@@ -1039,7 +1104,11 @@ export default {
|
||||
this.getDataList();
|
||||
}
|
||||
} else {
|
||||
this.getProductList();
|
||||
if (this.listQuery.timeType === 3) {
|
||||
this.getProductLastList();
|
||||
} else {
|
||||
this.getProductList();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'export':
|
||||
@@ -1072,7 +1141,7 @@ export default {
|
||||
if (this.activeName === 'productLine') {
|
||||
this.getDayDataList();
|
||||
} else {
|
||||
this.getProductList();
|
||||
this.getProductLastList();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1120,7 +1189,7 @@ export default {
|
||||
this.listQuery.lineId = undefined;
|
||||
this.listQuery.processType = this.headFormValue.processType ? this.headFormValue.processType : [];
|
||||
this.listQuery.reportType = this.headFormValue.reportType || undefined;
|
||||
this.listQuery.timeType = this.headFormValue.timeType || undefined;
|
||||
this.listQuery.timeType = this.headFormValue.timeType ? this.headFormValue.timeType : this.listQuery.timeType;
|
||||
this.listQuery.searchType = this.headFormValue.searchType || undefined
|
||||
if (this.listQuery.timeType === 2) {
|
||||
const resGroup = await getProcessAutoReportNew(this.listQuery);
|
||||
@@ -1128,17 +1197,31 @@ export default {
|
||||
|
||||
// 格式化数据:lineDetList提取到外层,键名加lineId前缀
|
||||
const formatData = (rawList) => {
|
||||
// 1. 处理rawList为空/非数组的情况,直接返回空数组
|
||||
if (!Array.isArray(rawList) || rawList.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return rawList.map(item => {
|
||||
// 解构出 lineDetList 和其他字段(rest)
|
||||
const { lineDetList = [], ...rest } = item;
|
||||
// 防止item为null/undefined的情况,默认赋值为空对象
|
||||
const currentItem = item || {};
|
||||
// 解构出 lineDetList 和其他字段(rest),确保lineDetList是数组
|
||||
const { lineDetList = [], ...rest } = currentItem;
|
||||
|
||||
// 2. 处理lineDetList为空/非数组的情况,直接返回rest
|
||||
if (!Array.isArray(lineDetList) || lineDetList.length === 0) {
|
||||
return { ...rest }; // 浅拷贝,避免原对象引用问题
|
||||
}
|
||||
|
||||
// 遍历 lineDetList 中的每一项,逐个格式化并合并
|
||||
const formattedLineData = lineDetList.reduce((acc, lineData) => {
|
||||
// 防止lineData为null/undefined的情况,默认赋值为空对象
|
||||
const currentLineData = lineData || {};
|
||||
// 取当前 lineData 的 lineId 作为前缀(确保存在,否则用空字符串)
|
||||
const lineIdPrefix = lineData.lineId ? String(lineData.lineId) : '';
|
||||
const lineIdPrefix = currentLineData.lineId ? String(currentLineData.lineId) : '';
|
||||
|
||||
// 为当前 lineData 的每个字段添加 lineId 前缀,合并到累加器中
|
||||
Object.entries(lineData).forEach(([key, value]) => {
|
||||
Object.entries(currentLineData).forEach(([key, value]) => {
|
||||
const newKey = lineIdPrefix ? `${lineIdPrefix}${key}` : key;
|
||||
acc[newKey] = value;
|
||||
});
|
||||
@@ -1176,6 +1259,9 @@ export default {
|
||||
|
||||
// 格式化数据:lineDetList提取到外层,键名加lineId前缀
|
||||
const formatData = (rawList) => {
|
||||
if (!Array.isArray(rawList) || rawList.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return rawList.map(item => {
|
||||
// 解构出 lineDetList 和其他字段(rest)
|
||||
const { lineDetList = [], ...rest } = item;
|
||||
@@ -1332,8 +1418,10 @@ export default {
|
||||
},
|
||||
// 为当天时调用的接口
|
||||
getLastDayDataList() {
|
||||
getPdlAutoReportNewSearchLastGroup().then((response) => {
|
||||
this.tableData = response.data.classData.map((item, index) => {
|
||||
console.log('this.listQuery', this.listQuery);
|
||||
|
||||
getPdlAutoReportNewSearchLastGroup(this.listQuery).then((response) => {
|
||||
this.tableDataCustom = response.data.classData.map((item, index) => {
|
||||
item.originalLossNum = item.original?.lossNum;
|
||||
item.originalLossArea = item.original?.lossArea;
|
||||
item.edgeLossNum = item.edge?.lossNum;
|
||||
@@ -1354,7 +1442,7 @@ export default {
|
||||
});
|
||||
},
|
||||
getDayDataList() {
|
||||
getPdlAutoReportNewSearchNow().then((response) => {
|
||||
getPdlAutoReportNewSearchNow(this.listQuery).then((response) => {
|
||||
this.tableData = response.data.classData.map((item, index) => {
|
||||
item.originalLossNum = item.original?.lossNum;
|
||||
item.originalLossArea = item.original?.lossArea;
|
||||
@@ -1410,6 +1498,45 @@ export default {
|
||||
handleSearchBarChanged({ param, value }) {
|
||||
console.log(value, param);
|
||||
if (param === 'timeType') {
|
||||
this.tableData = []
|
||||
this.tableDataCustom = []
|
||||
this.tableData2 = []
|
||||
this.productTableData = []
|
||||
this.productTableDataDay = []
|
||||
const resetCommon = () => {
|
||||
// 重置搜索表单的筛选条件
|
||||
if (this.$refs.searchBarForm) {
|
||||
const form = this.$refs.searchBarForm.formInline;
|
||||
form.timeVal = undefined;
|
||||
form.timeType = 1;
|
||||
form.reportType = undefined;
|
||||
form.searchType = undefined;
|
||||
form.lineId = undefined;
|
||||
form.factoryId = undefined;
|
||||
form.process = undefined;
|
||||
form.processType = undefined;
|
||||
}
|
||||
// 重置查询参数
|
||||
this.listQuery = {
|
||||
...this.listQuery, // 保留分页等基础参数
|
||||
factoryId: undefined,
|
||||
process: undefined,
|
||||
lineId: undefined,
|
||||
processType: undefined,
|
||||
reportType: undefined,
|
||||
timeType: 1,
|
||||
searchType: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined
|
||||
};
|
||||
// 重置表单配置中公共隐藏的项
|
||||
this.formConfig[1].type = ''; // 隐藏查询类型
|
||||
this.formConfig[6].type = ''; // 隐藏报表类型
|
||||
this.formConfig[7].type = ''; // 隐藏时间范围
|
||||
};
|
||||
|
||||
// 3. 执行公共重置
|
||||
resetCommon();
|
||||
this.listQuery.timeType = value;
|
||||
const timeItemIndex = this.formConfig.findIndex(item =>
|
||||
item.label?.includes('刷新时间')
|
||||
|
||||
@@ -216,7 +216,7 @@ import {
|
||||
import { getTree } from '@/api/base/equipment';
|
||||
import { getEquipmentTypePage } from '@/api/base/equipmentType';
|
||||
import { getEquipmentOverall } from '@/api/base/equipment';
|
||||
|
||||
import { getTenantId } from '@/utils/auth'
|
||||
// import * as XLSX from 'xlsx';
|
||||
// import FileSaver from 'file-saver';
|
||||
import ButtonNav from '@/components/ButtonNav';
|
||||
@@ -569,7 +569,7 @@ export default {
|
||||
const token = getAccessToken();
|
||||
const headers = new Headers({
|
||||
Authorization: `Bearer ${token}`,
|
||||
'tenant-id': store.getters.userId,
|
||||
'tenant-id': getTenantId(),
|
||||
'Content-Type': 'text/event-stream',
|
||||
});
|
||||
|
||||
|
||||
@@ -34,28 +34,7 @@ export default {
|
||||
mixins: [basicPageMixin],
|
||||
data() {
|
||||
return {
|
||||
// tableBtn: [
|
||||
// this.$auth.hasPermi('base:quality-inspection-type:update')
|
||||
// ? {
|
||||
// type: 'edit',
|
||||
// btnName: '修改',
|
||||
// }
|
||||
// : undefined,
|
||||
// this.$auth.hasPermi('base:quality-inspection-type:delete')
|
||||
// ? {
|
||||
// type: 'delete',
|
||||
// btnName: '删除',
|
||||
// }
|
||||
// : undefined,
|
||||
// ].filter((v) => v),
|
||||
tableProps: [
|
||||
// {
|
||||
// prop: 'createTime',
|
||||
// label: '添加时间',
|
||||
// fixed: true,
|
||||
// width: 180,
|
||||
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
// },
|
||||
{ prop: 'factoryName', label: '工厂' },
|
||||
{ prop: 'lineName', label: '产线' },
|
||||
{ prop: 'remark', label: '玻璃编号' },
|
||||
@@ -74,42 +53,7 @@ export default {
|
||||
},
|
||||
{ prop: 'reason', label: '判等原因' },
|
||||
{ prop: 'specifications', label: '规格' },
|
||||
|
||||
|
||||
// {
|
||||
// label: '操作',
|
||||
// alignt: 'center',
|
||||
// subcomponent: {
|
||||
// render: function (h) {
|
||||
// return h('div', null, [
|
||||
// h(
|
||||
// 'el-button',
|
||||
// {
|
||||
// props: {
|
||||
// icon: 'el-icon-edit',
|
||||
// size: 'mini',
|
||||
// type: 'text',
|
||||
// },
|
||||
// },
|
||||
// ' 修改'
|
||||
// ),
|
||||
// h(
|
||||
// 'el-button',
|
||||
// {
|
||||
// props: {
|
||||
// icon: 'el-icon-edit',
|
||||
// size: 'mini',
|
||||
// type: 'text',
|
||||
// },
|
||||
// },
|
||||
// ' 修改'
|
||||
// ),
|
||||
// ]);
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
],
|
||||
//
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
@@ -135,13 +79,13 @@ export default {
|
||||
label: '时间范围',
|
||||
dateType: 'datetimerange',
|
||||
format: 'yyyy-MM-dd HH:mm:ss',
|
||||
// valueFormat: 'timestamp',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
valueFormat: 'timestamp',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
param: 'timeVal',
|
||||
width: 350
|
||||
width: 350,
|
||||
defaultSelect: [],
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@@ -149,23 +93,9 @@ export default {
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
// {
|
||||
// type: 'button',
|
||||
// btnName: '重置',
|
||||
// name: 'reset',
|
||||
// },
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:quality-inspection-type:create')
|
||||
// ? 'button'
|
||||
// : '',
|
||||
// btnName: '新增',
|
||||
// name: 'add',
|
||||
// plain: true,
|
||||
// color: 'success',
|
||||
// },
|
||||
{
|
||||
type: this.$auth.hasPermi('base:quality-inspection-type:export')
|
||||
? 'button'
|
||||
@@ -215,11 +145,55 @@ export default {
|
||||
// deep: true
|
||||
// },
|
||||
// },
|
||||
created() {
|
||||
mounted() {
|
||||
const { startTimestamp, endTimestamp } = this.getThreeDaysAgoThisTimeToNowTimeStamps();
|
||||
// 找到时间范围的配置项并赋值(对应你代码中的timeVal参数)
|
||||
this.searchBarFormConfig[3].defaultSelect = [startTimestamp, endTimestamp]; // 赋值给日期选择器
|
||||
this.queryParams.startTime = startTimestamp;
|
||||
this.queryParams.endTime = endTimestamp;
|
||||
this.getList();
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
getThreeDaysAgoThisTimeToNowTimeStamps() {
|
||||
const now = new Date();
|
||||
// 1. 计算三天前的当前时刻(使用setDate直接修改日期,保留时分秒等信息)
|
||||
const threeDaysAgoThisTime = new Date(now); // 复制当前日期对象,避免修改原对象
|
||||
threeDaysAgoThisTime.setDate(threeDaysAgoThisTime.getDate() - 3); // 日期减3天,时分秒保持和当前一致
|
||||
|
||||
// 2. 获取时间戳(毫秒级和秒级)
|
||||
// 开始时间戳:三天前的当前时刻
|
||||
const startTimestamp = threeDaysAgoThisTime.getTime(); // 毫秒级
|
||||
const startTimestampSec = Math.floor(startTimestamp / 1000); // 秒级
|
||||
// 结束时间戳:当前时刻
|
||||
const endTimestamp = now.getTime(); // 毫秒级
|
||||
const endTimestampSec = Math.floor(endTimestamp / 1000); // 秒级
|
||||
|
||||
// 封装日期格式化函数,转换为yyyy-MM-dd HH:mm:ss格式
|
||||
const formatDateTime = (date) => {
|
||||
const y = date.getFullYear();
|
||||
// 月份是从0开始的,所以要+1;补零确保是两位
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const d = String(date.getDate()).padStart(2, '0');
|
||||
const h = String(date.getHours()).padStart(2, '0');
|
||||
const min = String(date.getMinutes()).padStart(2, '0');
|
||||
const s = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${y}-${m}-${d} ${h}:${min}:${s}`;
|
||||
};
|
||||
|
||||
// 格式化后的字符串:三天前的当前时刻 和 当前时刻
|
||||
const startDateTimeStr = formatDateTime(threeDaysAgoThisTime);
|
||||
const endDateTimeStr = formatDateTime(now);
|
||||
|
||||
return {
|
||||
startTimestamp, // 三天前当前时刻的毫秒级时间戳
|
||||
endTimestamp, // 当前时刻的毫秒级时间戳
|
||||
startTimestampSec, // 三天前当前时刻的秒级时间戳
|
||||
endTimestampSec, // 当前时刻的秒级时间戳
|
||||
startDateTimeStr, // yyyy-MM-dd HH:mm:ss格式的开始时间字符串
|
||||
endDateTimeStr // yyyy-MM-dd HH:mm:ss格式的结束时间字符串
|
||||
};
|
||||
},
|
||||
getDict() {
|
||||
getPdList().then(res => {
|
||||
this.searchBarFormConfig[1].selectOptions = res.data || [];
|
||||
@@ -250,11 +224,6 @@ export default {
|
||||
this.queryParams.startTime = btn.timeVal ? btn.timeVal[0] : undefined
|
||||
this.queryParams.endTime = btn.timeVal ? btn.timeVal[1] : undefined
|
||||
this.queryParams.checkNum = btn.checkNum ? btn.checkNum : undefined
|
||||
|
||||
|
||||
// keys.forEach((key) => {
|
||||
// this.queryParams[key] = btn[key] || null;
|
||||
// });
|
||||
this.getList();
|
||||
break;
|
||||
case 'add':
|
||||
@@ -263,10 +232,6 @@ export default {
|
||||
case 'export':
|
||||
this.handleExport();
|
||||
break;
|
||||
// case 'reset':
|
||||
// this.$refs['search-bar'].resetForm();
|
||||
// this.resetQuery();
|
||||
// break;
|
||||
}
|
||||
},
|
||||
/** 查询列表 */
|
||||
|
||||
@@ -150,7 +150,8 @@ export default {
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
param: 'timeVal',
|
||||
width: 350
|
||||
width: 350,
|
||||
defaultSelect: [],
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@@ -226,11 +227,56 @@ export default {
|
||||
// deep: true
|
||||
// },
|
||||
// },
|
||||
created() {
|
||||
mounted() {
|
||||
|
||||
const { startTimestamp, endTimestamp } = this.getThreeDaysAgoThisTimeToNowTimeStamps();
|
||||
// 找到时间范围的配置项并赋值(对应你代码中的timeVal参数)
|
||||
this.searchBarFormConfig[2].defaultSelect = [startTimestamp, endTimestamp]; // 赋值给日期选择器
|
||||
this.queryParams.startTime = startTimestamp;
|
||||
this.queryParams.endTime = endTimestamp;
|
||||
this.getList();
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
getThreeDaysAgoThisTimeToNowTimeStamps() {
|
||||
const now = new Date();
|
||||
// 1. 计算三天前的当前时刻(使用setDate直接修改日期,保留时分秒等信息)
|
||||
const threeDaysAgoThisTime = new Date(now); // 复制当前日期对象,避免修改原对象
|
||||
threeDaysAgoThisTime.setDate(threeDaysAgoThisTime.getDate() - 3); // 日期减3天,时分秒保持和当前一致
|
||||
|
||||
// 2. 获取时间戳(毫秒级和秒级)
|
||||
// 开始时间戳:三天前的当前时刻
|
||||
const startTimestamp = threeDaysAgoThisTime.getTime(); // 毫秒级
|
||||
const startTimestampSec = Math.floor(startTimestamp / 1000); // 秒级
|
||||
// 结束时间戳:当前时刻
|
||||
const endTimestamp = now.getTime(); // 毫秒级
|
||||
const endTimestampSec = Math.floor(endTimestamp / 1000); // 秒级
|
||||
|
||||
// 封装日期格式化函数,转换为yyyy-MM-dd HH:mm:ss格式
|
||||
const formatDateTime = (date) => {
|
||||
const y = date.getFullYear();
|
||||
// 月份是从0开始的,所以要+1;补零确保是两位
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const d = String(date.getDate()).padStart(2, '0');
|
||||
const h = String(date.getHours()).padStart(2, '0');
|
||||
const min = String(date.getMinutes()).padStart(2, '0');
|
||||
const s = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${y}-${m}-${d} ${h}:${min}:${s}`;
|
||||
};
|
||||
|
||||
// 格式化后的字符串:三天前的当前时刻 和 当前时刻
|
||||
const startDateTimeStr = formatDateTime(threeDaysAgoThisTime);
|
||||
const endDateTimeStr = formatDateTime(now);
|
||||
|
||||
return {
|
||||
startTimestamp, // 三天前当前时刻的毫秒级时间戳
|
||||
endTimestamp, // 当前时刻的毫秒级时间戳
|
||||
startTimestampSec, // 三天前当前时刻的秒级时间戳
|
||||
endTimestampSec, // 当前时刻的秒级时间戳
|
||||
startDateTimeStr, // yyyy-MM-dd HH:mm:ss格式的开始时间字符串
|
||||
endDateTimeStr // yyyy-MM-dd HH:mm:ss格式的结束时间字符串
|
||||
};
|
||||
},
|
||||
getDict() {
|
||||
getPdList().then(res => {
|
||||
this.searchBarFormConfig[1].selectOptions = res.data || [];
|
||||
|
||||
@@ -98,8 +98,8 @@ export default {
|
||||
|
||||
init(data) {
|
||||
this.visible = true;
|
||||
this.factoryName = data.factoryName || '';
|
||||
this.lineName = data.lineName || '';
|
||||
this.factoryName = data.factoryName || '未知工厂';
|
||||
this.lineName = data.lineName || '未知产线';
|
||||
|
||||
if (data.startTime && data.endTime) {
|
||||
const start = moment(data.startTime).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
@@ -152,7 +152,8 @@ export default {
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
param: 'timeVal',
|
||||
width: 350
|
||||
width: 350,
|
||||
defaultSelect: [],
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@@ -225,11 +226,56 @@ export default {
|
||||
// deep: true
|
||||
// },
|
||||
// },
|
||||
created() {
|
||||
mounted() {
|
||||
|
||||
const { startTimestamp, endTimestamp } = this.getThreeDaysAgoThisTimeToNowTimeStamps();
|
||||
// 找到时间范围的配置项并赋值(对应你代码中的timeVal参数)
|
||||
this.searchBarFormConfig[2].defaultSelect = [startTimestamp, endTimestamp]; // 赋值给日期选择器
|
||||
this.queryParams.startTime = startTimestamp;
|
||||
this.queryParams.endTime = endTimestamp;
|
||||
this.getList();
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
getThreeDaysAgoThisTimeToNowTimeStamps() {
|
||||
const now = new Date();
|
||||
// 1. 计算三天前的当前时刻(使用setDate直接修改日期,保留时分秒等信息)
|
||||
const threeDaysAgoThisTime = new Date(now); // 复制当前日期对象,避免修改原对象
|
||||
threeDaysAgoThisTime.setDate(threeDaysAgoThisTime.getDate() - 3); // 日期减3天,时分秒保持和当前一致
|
||||
|
||||
// 2. 获取时间戳(毫秒级和秒级)
|
||||
// 开始时间戳:三天前的当前时刻
|
||||
const startTimestamp = threeDaysAgoThisTime.getTime(); // 毫秒级
|
||||
const startTimestampSec = Math.floor(startTimestamp / 1000); // 秒级
|
||||
// 结束时间戳:当前时刻
|
||||
const endTimestamp = now.getTime(); // 毫秒级
|
||||
const endTimestampSec = Math.floor(endTimestamp / 1000); // 秒级
|
||||
|
||||
// 封装日期格式化函数,转换为yyyy-MM-dd HH:mm:ss格式
|
||||
const formatDateTime = (date) => {
|
||||
const y = date.getFullYear();
|
||||
// 月份是从0开始的,所以要+1;补零确保是两位
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const d = String(date.getDate()).padStart(2, '0');
|
||||
const h = String(date.getHours()).padStart(2, '0');
|
||||
const min = String(date.getMinutes()).padStart(2, '0');
|
||||
const s = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${y}-${m}-${d} ${h}:${min}:${s}`;
|
||||
};
|
||||
|
||||
// 格式化后的字符串:三天前的当前时刻 和 当前时刻
|
||||
const startDateTimeStr = formatDateTime(threeDaysAgoThisTime);
|
||||
const endDateTimeStr = formatDateTime(now);
|
||||
|
||||
return {
|
||||
startTimestamp, // 三天前当前时刻的毫秒级时间戳
|
||||
endTimestamp, // 当前时刻的毫秒级时间戳
|
||||
startTimestampSec, // 三天前当前时刻的秒级时间戳
|
||||
endTimestampSec, // 当前时刻的秒级时间戳
|
||||
startDateTimeStr, // yyyy-MM-dd HH:mm:ss格式的开始时间字符串
|
||||
endDateTimeStr // yyyy-MM-dd HH:mm:ss格式的结束时间字符串
|
||||
};
|
||||
},
|
||||
getDict() {
|
||||
getPdList().then(res => {
|
||||
this.searchBarFormConfig[1].selectOptions = res.data || [];
|
||||
|
||||
Reference in New Issue
Block a user