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.

666 lines
25 KiB
Vue

<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryParams"
size="small"
:inline="true"
v-show="showSearch"
>
<!-- <el-form-item label="所属工作中心" prop="workCenter">
<template>
<el-select
v-model="queryParams.workCenter"
filterable
placeholder="请选择"
style="width: 195px"
>
<el-option
v-for="item in workCenterOptions"
:key="item.factoryCode"
:label="item.factoryName"
:value="item.factoryCode"
>
</el-option>
</el-select>
</template>
</el-form-item> -->
<el-form-item label="设备编码" prop="equipmentCode">
<el-input
v-model="queryParams.equipmentCode"
placeholder="请选择设备编码"
style="width: 200px"
>
<el-button
slot="append"
@click="handleSelectEquipment"
icon="el-icon-search"
></el-button>
</el-input>
<ItemSelect ref="itemSelect" @onSelected="onItemSelectedEquipment">
</ItemSelect>
</el-form-item>
<el-form-item prop="orderEnd" label="月份">
<el-date-picker
v-model="queryParams.orderEnd"
type="month"
value-format="yyyy-MM"
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-table :data="checkList" border :span-method="objectSpanMethod">
<el-table-column prop="itemTypeName" label="维护类型" width="100" fixed>
</el-table-column>
<el-table-column prop="itemName" label="检查项名称" width="150">
</el-table-column>
<el-table-column prop="itemMethod" label="检查项方法" width="150">
</el-table-column>
<el-table-column prop="itemTools" label="工具" width="150">
</el-table-column>
<el-table-column prop="standardName" label="标准名称" width="500">
</el-table-column>
<el-table-column prop="itemLoop" label="次" width="55"> </el-table-column>
<el-table-column prop="itemLoopType" label="周期" width="60">
</el-table-column>
<el-table-column prop="head" label="责任人" width="70"> </el-table-column>
<el-table-column prop="one" label="1" width="40">
<template slot-scope="scope">
{{ scope.row.one == "1" ? "√" : scope.row.one == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="two" label="2" width="40">
<template slot-scope="scope">
{{ scope.row.two == "1" ? "√" : scope.row.two == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="three" label="3" width="40">
<template slot-scope="scope">
{{ scope.row.three == "1" ? "√" : scope.row.three == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="four" label="4" width="40">
<template slot-scope="scope">
{{ scope.row.four == "1" ? "√" : scope.row.four == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="five" label="5" width="40">
<template slot-scope="scope">
{{ scope.row.five == "1" ? "√" : scope.row.five == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="six" label="6" width="40">
<template slot-scope="scope">
{{ scope.row.six == "1" ? "√" : scope.row.six == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="seven" label="7" width="40">
<template slot-scope="scope">
{{ scope.row.seven == "1" ? "√" : scope.row.seven == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="eight" label="8" width="40">
<template slot-scope="scope">
{{ scope.row.eight == "1" ? "√" : scope.row.eight == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="nine" label="9" width="40">
<template slot-scope="scope">
{{ scope.row.nine == "1" ? "√" : scope.row.nine == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="ten" label="10" width="40">
<template slot-scope="scope">
{{ scope.row.ten == "1" ? "√" : scope.row.ten == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="eleven" label="11" width="40">
<template slot-scope="scope">
{{ scope.row.eleven == "1" ? "√" : scope.row.eleven == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twelve" label="12" width="40">
<template slot-scope="scope">
{{ scope.row.twelve == "1" ? "√" : scope.row.twelve == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="thirteen" label="13" width="40">
<template slot-scope="scope">
{{ scope.row.thirteen == "1" ? "√" : scope.row.thirteen == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="fourteen" label="14" width="40">
<template slot-scope="scope">
{{ scope.row.fourteen == "1" ? "√" : scope.row.fourteen == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="fifteen" label="15" width="40">
<template slot-scope="scope">
{{ scope.row.fifteen == "1" ? "√" : scope.row.fifteen == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="sixteen" label="16" width="40">
<template slot-scope="scope">
{{ scope.row.sixteen == "1" ? "√" : scope.row.sixteen == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="seventeen" label="17" width="40">
<template slot-scope="scope">
{{ scope.row.seventeen == "1" ? "√" : scope.row.seventeen == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="eighteen" label="18" width="40">
<template slot-scope="scope">
{{ scope.row.eighteen == "1" ? "√" : scope.row.eighteen == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="nineteen" label="19" width="40">
<template slot-scope="scope">
{{ scope.row.nineteen == "1" ? "√" : scope.row.nineteen == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twenty" label="20" width="40">
<template slot-scope="scope">
{{ scope.row.twenty == "1" ? "√" : scope.row.twenty == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twentyOne" label="21" width="40">
<template slot-scope="scope">
{{ scope.row.twentyOne == "1" ? "√" : scope.row.twentyOne == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twentyTwo" label="22" width="40">
<template slot-scope="scope">
{{ scope.row.twentyTwo == "1" ? "√" : scope.row.twentyTwo == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twentyThree" label="23" width="40">
<template slot-scope="scope">
{{ scope.row.twentyThree == "1" ? "√" : scope.row.twentyThree == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twentyFour" label="24" width="40">
<template slot-scope="scope">
{{ scope.row.twentyFour == "1" ? "√" : scope.row.twentyFour == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twentyFive" label="30" width="40">
<template slot-scope="scope">
{{ scope.row.twentyFive == "1" ? "√" : scope.row.twentyFive == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twentySix" label="26" width="40">
<template slot-scope="scope">
{{ scope.row.twentySix == "1" ? "√" : scope.row.twentySix == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twentySeven" label="27" width="40">
<template slot-scope="scope">
{{ scope.row.twentySeven == "1" ? "√" : scope.row.twentySeven == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twentyEight" label="28" width="40">
<template slot-scope="scope">
{{ scope.row.twentyEight == "1" ? "√" : scope.row.twentyEight == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="twentyNine" label="29" width="40">
<template slot-scope="scope">
{{ scope.row.twentyNine == "1" ? "√" : scope.row.twentyNine == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="thirty" label="30" width="40">
<template slot-scope="scope">
{{ scope.row.thirty == "1" ? "√" : scope.row.thirty == "0" ? "X" : ""}}
</template>
</el-table-column>
<el-table-column prop="thirtyOne" label="31" width="40">
<template slot-scope="scope">
{{ scope.row.thirtyOne == "1" ? "" : scope.row.thirtyOne == "0" ? "X" : ""}}
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { Message } from "element-ui";
import ItemSelect from "./selectSingleEquipment.vue";
import {
getSummaryReport,
getWorkCenter,
selectMatchList,
} from "@/api/device/item";
export default {
name: "SummaryReport",
components: { ItemSelect },
dicts: ["device_repair_status"],
data() {
return {
//表格样式
CS: {
"text-align": "center",
},
LS: {
"text-align": "center",
width: "200px",
},
//工作中心选择
workCenterOptions: [],
//巡检、点检、保养表格数据
checkList: [],
//匹配表
matchList: [],
optType: undefined,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 维修工单表格数据
repairOrderList: [],
// 弹出层标题
title: "",
// 是否显示填写维修记录弹出层
openView: false,
// 查询参数
queryParams: {
//设备编码
equipmentCode: null,
//年月
orderEnd: null,
//工作中心
workCenter: null,
},
// 表单参数
form: {},
// 表单校验
rules: {},
};
},
created() {
this.getList();
},
methods: {
// 生成表头序号
indexMethod(index) {
return index + 1;
},
/** 查询维修工单列表 */
getList() {
this.loading = true;
getWorkCenter().then((response) => {
this.workCenterOptions = response.data;
});
getSummaryReport(this.queryParams).then((response) => {
this.checkList = response.data;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
if (
this.queryParams.equipmentCode == null ||
this.queryParams.orderEnd == null
) {
this.$message({
message: "设备编码或者年月不能为空!",
type: "warning",
});
} else {
this.loading = true;
console.log("查询参数", this.queryParams);
selectMatchList(this.queryParams).then((response) => {
this.matchList = response.data;
console.log("this.matchList", this.matchList);
//匹配打钩
var i = 0;
var j = 0;
console.log("this.matchList", this.matchList);
console.log("this.checkList", this.checkList);
for (i = 0; i < this.checkList.length; i++) {
for (j = 0; j < this.matchList.length; j++) {
if (
this.checkList[i].itemName == this.matchList[j].itemName &&
this.checkList[i].standardName == this.matchList[j].standardName
) {
var str = this.matchList[j].orderEnd.substr(8);
if (str == "01") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].one = this.matchList[j].repairReach;
}else{
this.checkList[i].one = this.matchList[j].detailReach;
}
} else if (str == "02") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].two = this.matchList[j].repairReach;
}else{
this.checkList[i].two = this.matchList[j].detailReach;
}
} else if (str == "03") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].three = this.matchList[j].repairReach;
}else{
this.checkList[i].three = this.matchList[j].detailReach;
}
} else if (str == "04") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].four = this.matchList[j].repairReach;
}else{
this.checkList[i].four = this.matchList[j].detailReach;
}
} else if (str == "05") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].five = this.matchList[j].repairReach;
}else{
this.checkList[i].five = this.matchList[j].detailReach;
}
} else if (str == "06") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].six = this.matchList[j].repairReach;
}else{
this.checkList[i].six = this.matchList[j].detailReach;
}
} else if (str == "07") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].seven = this.matchList[j].repairReach;
}else{
this.checkList[i].seven = this.matchList[j].detailReach;
}
} else if (str == "08") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].eight = this.matchList[j].repairReach;
}else{
this.checkList[i].eight = this.matchList[j].detailReach;
}
} else if (str == "09") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].nine = this.matchList[j].repairReach;
}else{
this.checkList[i].nine = this.matchList[j].detailReach;
}
} else if (str == "10") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].ten = this.matchList[j].repairReach;
}else{
this.checkList[i].ten = this.matchList[j].detailReach;
}
} else if (str == "11") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].eleven = this.matchList[j].repairReach;
}else{
this.checkList[i].eleven = this.matchList[j].detailReach;
}
} else if (str == "12") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twelve = this.matchList[j].repairReach;
}else{
this.checkList[i].twelve = this.matchList[j].detailReach;
}
} else if (str == "13") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].thirteen = this.matchList[j].repairReach;
}else{
this.checkList[i].thirteen = this.matchList[j].detailReach;
}
} else if (str == "14") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].fourteen = this.matchList[j].repairReach;
}else{
this.checkList[i].fourteen = this.matchList[j].detailReach;
}
} else if (str == "15") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].fifteen = this.matchList[j].repairReach;
}else{
this.checkList[i].fifteen = this.matchList[j].detailReach;
}
} else if (str == "16") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].sixteen = this.matchList[j].repairReach;
}else{
this.checkList[i].sixteen = this.matchList[j].detailReach;
}
} else if (str == "17") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].seventeen = this.matchList[j].repairReach;
}else{
this.checkList[i].seventeen = this.matchList[j].detailReach;
}
} else if (str == "18") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].eighteen = this.matchList[j].repairReach;
}else{
this.checkList[i].eighteen = this.matchList[j].detailReach;
}
} else if (str == "19") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].nineteen = this.matchList[j].repairReach;
}else{
this.checkList[i].nineteen = this.matchList[j].detailReach;
}
} else if (str == "20") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twenty = this.matchList[j].repairReach;
}else{
this.checkList[i].twenty = this.matchList[j].detailReach;
}
} else if (str == "21") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twentyOne = this.matchList[j].repairReach;
}else{
this.checkList[i].twentyOne = this.matchList[j].detailReach;
}
} else if (str == "22") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twentyTwo = this.matchList[j].repairReach;
}else{
this.checkList[i].twentyTwo = this.matchList[j].detailReach;
}
} else if (str == "23") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twentyThree = this.matchList[j].repairReach;
}else{
this.checkList[i].twentyThree = this.matchList[j].detailReach;
}
} else if (str == "24") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twentyFour = this.matchList[j].repairReach;
}else{
this.checkList[i].twentyFour = this.matchList[j].detailReach;
}
} else if (str == "25") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twentyFive = this.matchList[j].repairReach;
}else{
this.checkList[i].twentyFive = this.matchList[j].detailReach;
}
} else if (str == "26") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twentySix = this.matchList[j].repairReach;
}else{
this.checkList[i].twentySix = this.matchList[j].detailReach;
}
} else if (str == "27") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twentySeven = this.matchList[j].repairReach;
}else{
this.checkList[i].twentySeven = this.matchList[j].detailReach;
}
} else if (str == "28") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twentyEight = this.matchList[j].repairReach;
}else{
this.checkList[i].twentyEight = this.matchList[j].detailReach;
}
} else if (str == "29") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].twentyNine = this.matchList[j].repairReach;
}else{
this.checkList[i].twentyNine = this.matchList[j].detailReach;
}
} else if (str == "30") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].thirty = this.matchList[j].repairReach;
}else{
this.checkList[i].thirty = this.matchList[j].detailReach;
}
} else if (str == "31") {
if(this.matchList[j].repairReach == 1){
this.checkList[i].thirtyOne = this.matchList[j].repairReach;
}else{
this.checkList[i].thirtyOne = this.matchList[j].detailReach;
}
}
console.log("this.checkList[i].one", this.checkList[i].one);
} else {
}
}
}
});
}
},
// 表单重置
reset() {
this.form = {
workId: null,
orderId: null,
orderCode: null,
workHandle: null,
workPlanTime: null,
workPlanDownTime: null,
orderRelevance: null,
workPerson: null,
workTeam: null,
workOutsource: null,
workDownMachine: null,
equipmentCode: null,
workReason: null,
workFaultDesc: null,
workCostTime: null,
workCost: null,
outWorkId: null,
outWorkCode: null,
attr1: null,
attr2: null,
attr3: null,
createBy: null,
createTime: null,
updateTime: null,
updateBy: null,
delFlag: null,
factoryCode: null,
};
this.resetForm("form");
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.equipmentCode = null;
this.queryParams.year = null;
this.queryParams.mouth = null;
this.queryParams.workCenter = null;
this.queryParams.equipmentCode = null;
this.handleQuery();
},
//设备编码选择回填
onItemSelectedEquipment(obj) {
this.queryParams.equipmentCode = obj;
},
//设备选择
handleSelectEquipment() {
this.$refs.itemSelect.showFlag = true;
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
// 获取当前单元格的值
const currentValue = row[column.property];
// 获取上一行相同列的值
const preRow = this.checkList[rowIndex - 1];
const preValue = preRow ? preRow[column.property] : null;
// 如果当前值和上一行的值相同,则将当前单元格隐藏
if (currentValue === preValue) {
return { rowspan: 0, colspan: 0 };
} else {
// 否则计算当前单元格应该跨越多少行
let rowspan = 1;
for (let i = rowIndex + 1; i < this.checkList.length; i++) {
const nextRow = this.checkList[i];
const nextValue = nextRow[column.property];
if (nextValue === currentValue) {
rowspan++;
} else {
break;
}
}
return { rowspan, colspan: 1 };
}
}
if (columnIndex === 1) {
// 获取当前单元格的值
const currentValue = row[column.property];
// 获取上一行相同列的值
const preRow = this.checkList[rowIndex - 1];
const preValue = preRow ? preRow[column.property] : null;
// 如果当前值和上一行的值相同,则将当前单元格隐藏
if (currentValue === preValue) {
return { rowspan: 0, colspan: 0 };
} else {
// 否则计算当前单元格应该跨越多少行
let rowspan = 1;
for (let i = rowIndex + 1; i < this.checkList.length; i++) {
const nextRow = this.checkList[i];
const nextValue = nextRow[column.property];
if (nextValue === currentValue) {
rowspan++;
} else {
break;
}
}
return { rowspan, colspan: 1 };
}
}
},
},
};
</script>
<style>
.standardUrl_body {
height: 400px;
overflow-y: auto;
}
</style>