|
|
|
@ -24,7 +24,7 @@ |
|
|
|
<el-row :gutter="16"> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="工厂"> |
|
|
|
<el-select v-model="searchData.site" placeholder="请选择" filterable style="width: 100%"> |
|
|
|
<el-select v-model="searchData.site" placeholder="请选择" filterable style="width: 100%" @change="onSiteChange"> |
|
|
|
<el-option |
|
|
|
v-for="item in siteList" |
|
|
|
:key="item" |
|
|
|
@ -39,28 +39,46 @@ |
|
|
|
<el-input v-model="searchData.orderNo" placeholder="请输入" clearable></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="派工单号"> |
|
|
|
<el-input v-model="searchData.seqNo" placeholder="请输入" clearable></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="加工中心名称"> |
|
|
|
<el-input v-model="searchData.workCenter" placeholder="请输入" clearable></el-input> |
|
|
|
<el-select v-model="searchData.workCenterNo" placeholder="全部" clearable filterable style="width: 100%" @change="onWorkCenterChange"> |
|
|
|
<el-option |
|
|
|
v-for="item in workCenterList" |
|
|
|
:key="item.workCenterNo" |
|
|
|
:label="workCenterLabel(item)" |
|
|
|
:value="item.workCenterNo"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="生产机台"> |
|
|
|
<el-input v-model="searchData.resource" placeholder="请输入" clearable></el-input> |
|
|
|
<el-form-item> |
|
|
|
<span slot="label"><el-link type="primary" @click="openResource">生产机台</el-link></span> |
|
|
|
<el-input :value="resourceText" placeholder="全部" readonly> |
|
|
|
<i v-if="searchData.resource" slot="suffix" class="el-input__icon el-icon-circle-close filter-clear" @click.stop="clearResource"></i> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="操作员"> |
|
|
|
<el-input v-model="searchData.operator" placeholder="请输入" clearable></el-input> |
|
|
|
<el-form-item> |
|
|
|
<span slot="label"><el-link type="primary" @click="openOperator">操作员</el-link></span> |
|
|
|
<el-input :value="operatorText" placeholder="全部" readonly> |
|
|
|
<i v-if="searchData.operator" slot="suffix" class="el-input__icon el-icon-circle-close filter-clear" @click.stop="clearOperator"></i> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row :gutter="16"> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="标签条码"> |
|
|
|
<el-input v-model="searchData.rollNo" placeholder="请输入" clearable></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row :gutter="16"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="卷创建日期"> |
|
|
|
<div class="date-range"> |
|
|
|
@ -129,17 +147,35 @@ |
|
|
|
:total="totalCount" |
|
|
|
layout="total, sizes, prev, pager, next, jumper"> |
|
|
|
</el-pagination> |
|
|
|
<report-choose-dialog |
|
|
|
ref="resourceDialog" |
|
|
|
title="选择生产机台" |
|
|
|
:columns="resourceColumns" |
|
|
|
:rows="resourceList" |
|
|
|
:loading="resourceLoading" |
|
|
|
@choose="chooseResource"> |
|
|
|
</report-choose-dialog> |
|
|
|
<report-choose-dialog |
|
|
|
ref="operatorDialog" |
|
|
|
title="选择操作员" |
|
|
|
:columns="operatorColumns" |
|
|
|
:rows="operatorList" |
|
|
|
:loading="operatorLoading" |
|
|
|
@choose="chooseOperator"> |
|
|
|
</report-choose-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import {getOrderRollDefectReport, getReportSiteList} from "@/api/shopOrder/productionReport.js" |
|
|
|
import {getOrderRollDefectReport, getReportOperatorList, getReportResourceList, getReportSiteList, getReportWorkCenterList} from "@/api/shopOrder/productionReport.js" |
|
|
|
import ReportChooseDialog from "./reportChooseDialog.vue" |
|
|
|
import XLSX from "xlsx" |
|
|
|
|
|
|
|
const FIXED_COLUMNS = ["卷创建日期", "工单号", "加工中心编码", "加工中心名称", "生产机台", "操作员", "标签条码", "不良总数"] |
|
|
|
const FIXED_COLUMNS = ["卷创建日期", "工单号", "派工单号", "加工中心编码", "加工中心名称", "生产机台", "操作员", "标签条码", "单卷数量", "不良总数"] |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "orderRollDefectReport", |
|
|
|
components: {ReportChooseDialog}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
searchExpanded: true, |
|
|
|
@ -147,6 +183,20 @@ export default { |
|
|
|
dataListLoading: false, |
|
|
|
exportLoading: false, |
|
|
|
siteList: [], |
|
|
|
workCenterList: [], |
|
|
|
resourceList: [], |
|
|
|
operatorList: [], |
|
|
|
resourceLoading: false, |
|
|
|
operatorLoading: false, |
|
|
|
resourceColumns: [ |
|
|
|
{prop: "workCenterNo", label: "加工中心"}, |
|
|
|
{prop: "resourceID", label: "机台编码"}, |
|
|
|
{prop: "resourceDesc", label: "机台名称"} |
|
|
|
], |
|
|
|
operatorColumns: [ |
|
|
|
{prop: "operatorID", label: "人员编号"}, |
|
|
|
{prop: "operatorName", label: "姓名"} |
|
|
|
], |
|
|
|
searchData: this.emptySearch(), |
|
|
|
dataList: [], |
|
|
|
columnList: this.buildColumns(FIXED_COLUMNS), |
|
|
|
@ -163,6 +213,18 @@ export default { |
|
|
|
pageList() { |
|
|
|
const start = (this.pageIndex - 1) * this.pageSize |
|
|
|
return this.dataList.slice(start, start + this.pageSize) |
|
|
|
}, |
|
|
|
resourceText() { |
|
|
|
if (!this.searchData.resource) { |
|
|
|
return "" |
|
|
|
} |
|
|
|
return this.searchData.resourceDesc ? this.searchData.resource + " " + this.searchData.resourceDesc : this.searchData.resource |
|
|
|
}, |
|
|
|
operatorText() { |
|
|
|
if (!this.searchData.operator) { |
|
|
|
return "" |
|
|
|
} |
|
|
|
return this.searchData.operatorName ? this.searchData.operator + " " + this.searchData.operatorName : this.searchData.operator |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
@ -179,9 +241,13 @@ export default { |
|
|
|
return { |
|
|
|
site: this.siteList && this.siteList.length > 0 ? this.siteList[0] : "", |
|
|
|
orderNo: "", |
|
|
|
workCenter: "", |
|
|
|
seqNo: "", |
|
|
|
workCenterNo: "", |
|
|
|
workCenterDesc: "", |
|
|
|
resource: "", |
|
|
|
resourceDesc: "", |
|
|
|
operator: "", |
|
|
|
operatorName: "", |
|
|
|
rollNo: "", |
|
|
|
startDate: "", |
|
|
|
endDate: "" |
|
|
|
@ -214,12 +280,13 @@ export default { |
|
|
|
columnProp: name, |
|
|
|
columnLabel: name, |
|
|
|
columnWidth: this.columnWidth(name, index), |
|
|
|
align: index >= FIXED_COLUMNS.length || name === "不良总数" ? "right" : (name === "卷创建日期" ? "center" : "left") |
|
|
|
align: index >= FIXED_COLUMNS.length || name === "不良总数" || name === "单卷数量" ? "right" : (name === "卷创建日期" ? "center" : "left") |
|
|
|
})) |
|
|
|
}, |
|
|
|
columnWidth(name, index) { |
|
|
|
if (name === "卷创建日期") return 170 |
|
|
|
if (name === "工单号" || name === "标签条码" || name === "操作员") return 180 |
|
|
|
if (name === "工单号" || name === "派工单号" || name === "标签条码" || name === "操作员") return 180 |
|
|
|
if (name === "单卷数量") return 110 |
|
|
|
if (index >= FIXED_COLUMNS.length) return 120 |
|
|
|
return 130 |
|
|
|
}, |
|
|
|
@ -229,16 +296,88 @@ export default { |
|
|
|
if (this.siteList.length > 0 && (!this.searchData.site || this.siteList.indexOf(this.searchData.site) < 0)) { |
|
|
|
this.searchData.site = this.siteList[0] |
|
|
|
} |
|
|
|
this.loadWorkCenters() |
|
|
|
}) |
|
|
|
}, |
|
|
|
onSiteChange() { |
|
|
|
this.searchData.workCenterNo = "" |
|
|
|
this.searchData.workCenterDesc = "" |
|
|
|
this.clearResource() |
|
|
|
this.clearOperator() |
|
|
|
this.loadWorkCenters() |
|
|
|
}, |
|
|
|
loadWorkCenters() { |
|
|
|
if (!this.searchData.site) { |
|
|
|
this.workCenterList = [] |
|
|
|
return |
|
|
|
} |
|
|
|
getReportWorkCenterList({site: this.searchData.site}).then(({data}) => { |
|
|
|
this.workCenterList = (data && data.workCenterList) || [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
workCenterLabel(item) { |
|
|
|
return item.workCenterDesc ? item.workCenterNo + " " + item.workCenterDesc : item.workCenterNo |
|
|
|
}, |
|
|
|
onWorkCenterChange(value) { |
|
|
|
const found = this.workCenterList.find(item => item.workCenterNo === value) |
|
|
|
this.searchData.workCenterDesc = found ? (found.workCenterDesc || "") : "" |
|
|
|
this.clearResource() |
|
|
|
}, |
|
|
|
clearResource() { |
|
|
|
this.searchData.resource = "" |
|
|
|
this.searchData.resourceDesc = "" |
|
|
|
}, |
|
|
|
clearOperator() { |
|
|
|
this.searchData.operator = "" |
|
|
|
this.searchData.operatorName = "" |
|
|
|
}, |
|
|
|
openResource() { |
|
|
|
if (!this.searchData.site) { |
|
|
|
this.$message.warning("请选择工厂") |
|
|
|
return |
|
|
|
} |
|
|
|
this.resourceList = [] |
|
|
|
this.resourceLoading = true |
|
|
|
this.$refs.resourceDialog.open() |
|
|
|
getReportResourceList({ |
|
|
|
site: this.searchData.site, |
|
|
|
workCenterNo: this.searchData.workCenterNo |
|
|
|
}).then(({data}) => { |
|
|
|
this.resourceList = (data && data.resourceList) || [] |
|
|
|
}).finally(() => { |
|
|
|
this.resourceLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
chooseResource(row) { |
|
|
|
this.searchData.resource = row.resourceID || "" |
|
|
|
this.searchData.resourceDesc = row.resourceDesc || "" |
|
|
|
}, |
|
|
|
openOperator() { |
|
|
|
if (!this.searchData.site) { |
|
|
|
this.$message.warning("请选择工厂") |
|
|
|
return |
|
|
|
} |
|
|
|
this.operatorList = [] |
|
|
|
this.operatorLoading = true |
|
|
|
this.$refs.operatorDialog.open() |
|
|
|
getReportOperatorList({site: this.searchData.site}).then(({data}) => { |
|
|
|
this.operatorList = (data && data.operatorList) || [] |
|
|
|
}).finally(() => { |
|
|
|
this.operatorLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
chooseOperator(row) { |
|
|
|
this.searchData.operator = row.operatorID || "" |
|
|
|
this.searchData.operatorName = row.operatorName || "" |
|
|
|
}, |
|
|
|
getData() { |
|
|
|
this.searchLoading = true |
|
|
|
this.dataListLoading = true |
|
|
|
getOrderRollDefectReport({ |
|
|
|
site: this.searchData.site, |
|
|
|
orderNo: this.searchData.orderNo, |
|
|
|
seqNo: "", |
|
|
|
workCenter: this.searchData.workCenter, |
|
|
|
seqNo: this.searchData.seqNo, |
|
|
|
workCenter: this.searchData.workCenterDesc, |
|
|
|
resource: this.searchData.resource, |
|
|
|
startDate: this.searchData.startDate, |
|
|
|
endDate: this.searchData.endDate |
|
|
|
@ -395,6 +534,15 @@ export default { |
|
|
|
border-radius: 6px; |
|
|
|
} |
|
|
|
|
|
|
|
.filter-clear { |
|
|
|
cursor: pointer; |
|
|
|
color: #c0c4cc; |
|
|
|
} |
|
|
|
|
|
|
|
.filter-clear:hover { |
|
|
|
color: #909399; |
|
|
|
} |
|
|
|
|
|
|
|
.search-form /deep/ .el-date-editor.el-input { |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
|