You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
7.4 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="产线编码" prop="lineCode">
<el-input
v-model="queryParams.workorderName"
placeholder="请输入产线编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产线名称" prop="lineName">
<el-input
v-model="queryParams.equipmentName"
placeholder="请输入产线名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="电表编号" prop="electricityNo">
<el-input
v-model="queryParams.electricityNo"
placeholder="请输入电表编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="订单生产日期" label-width="100px">
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['energy:orderenergy:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="OrderEnergyList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="订单号" align="center" prop="workorderCode" />
<el-table-column label="产线编码" align="center" width="100" prop="workorderName" />
<el-table-column label="产线名称" align="center" width="150"prop="equipmentName" />
<el-table-column label="生产日期" align="center" width="150"prop="productDate" />
<el-table-column label="电表编号" align="center" prop="electricityNo" />
<el-table-column label="产品编码" align="center" width="200" prop="productCode" />
<el-table-column label="产品描述" align="center" width="300" prop="productName" />
<el-table-column label="生产数量(箱)" align="center" prop="totalQuantityFeedback" />
<el-table-column label="开始值" align="center" prop="startKW" />
<el-table-column label="结束值" align="center" prop="endKW" />
<el-table-column label="倍率" align="center" prop="multiplier" />
<el-table-column label="能耗KW·h" align="center" prop="kw" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import { listOrderEnergy} from "@/api/energy/powerUse/OrderEnergy";
import { getProductByCode} from "@/api/wms/product";
import { listChildprocessall} from "@/api/mes/childprocess";
export default {
name: "OrderEnergy",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
//表格数据
OrderEnergyList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
value: '',
upload: {
loading: false,
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: {poolName: localStorage.getItem("USER_POOL_NAME_CURRENT"), Authorization: "Bearer " + getToken()},
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/mes/unitPrice/importData"
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
factoryId: null,
productCode: null,
productName: null,
workorderName: null,
equipmentName: null,
electricityNo: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
},
productQueryParams:{
productCode: null,
productName: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
productCode: [
{ required: true, message: "产品编码不能为空", trigger: "blur" },
],
lineName: [
{ required: true, message: "产线不能为空", trigger: "blur" },
],
attr1: [
{ required: true, message: "单价不能为空", trigger: "blur" },
],
},
productCodeList: [],
state: '',
timeout: null,
productCode:'',
tableData: [],
processOptions: [
{ value: 'Process 1', label: '工序1' },
{ value: 'Process 2', label: '工序2' },
],
nextID: 1,
inputType: 'text'
};
},
created() {
this.getList();
// this.fetchProcessOptions();
},
methods: {
/** 查询unitPrice列表 */
getList() {
this.loading = true;
listOrderEnergy(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.OrderEnergyList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
picId: null,
factoryId: null,
productCode: null,
productName: null,
lineCode: null,
lineName: null,
childprocessId: null,
childprocessCode: null,
childprocessName: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
this.tableData = [];
this.nextID=1;
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.picId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 导出按钮操作 */
handleExport() {
this.download('energy/report/analysis/orderenergy/export', {
...this.queryParams
}, `单耗分析_${new Date().getTime()}.xlsx`)
}
}
};
</script>