设备综合报表

master
A0010407 12 months ago
parent 02de4bb008
commit 48cba41dce

@ -58,3 +58,27 @@ export function delItem(itemId) {
method: 'delete'
});
}
/////////////////////////////////////////下面都是汇总报表用
// 查询检查项汇总表
export function getSummaryReport() {
return request({
url: '/device/item/summaryReport',
method: 'get'
});
}
// 查询工作中心
export function getWorkCenter() {
return request({
url: '/device/item/getWorkCenter',
method: 'get'
});
}
// 查询工单匹配检查项
export function selectMatchList(query) {
return request({
url: '/device/item/matchList',
params: query
});
}

@ -1126,7 +1126,6 @@
></ItemSelectSpareParts>
</el-tab-pane>
</el-tabs>
</el-tabs>
</el-form>
<div slot="footer" class="dialog-footer">

@ -0,0 +1,665 @@
<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="55">
</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>

@ -0,0 +1,296 @@
<template>
<el-dialog
title="设备选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal="false"
width="1100px"
center
:before-close="cancelEquipmentForm"
>
<el-row :gutter="20">
<!--分类数据-->
<el-col :span="5" :xs="24">
<el-card>
<span>请选择设备类型</span>
<div class="head-container" style="text-align: center">
<el-tree
:data="treeData1"
:props="{ id: 'equipmentTypeCode', label: 'equipmentTypeName' }"
node-key="id"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
default-expand-all
@node-click="handleNodeClick"
/>
</div>
</el-card>
</el-col>
<!--设备数据-->
<el-col :span="19" :xs="24">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="设备编码" prop="itemCode">
<el-input
v-model="queryParams.itemCode"
placeholder="请输入设备编码"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="itemName">
<el-input
v-model="queryParams.itemName"
placeholder="请输入设备名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</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
v-loading="loading"
:data="itemList"
@selection-change="handleEquipmentSelectionChange"
ref="myTable"
>
<el-table-column width="50" align="center" type="selection">
<!-- <template v-slot="scope">
<el-radio v-model="selectedItemId" :label="scope.row.itemId" @change="handleRowChange(scope.row)">{{""}}</el-radio>
</template> -->
</el-table-column>
<!-- 序号 -->
<el-table-column
type="index"
width="90"
align="center"
:index="indexMethod"
label="序号"
></el-table-column>
<el-table-column
label="设备编码"
align="center"
key="itemCode"
prop="equipmentCode"
v-if="columns[0].visible"
>
</el-table-column>
<el-table-column
label="设备类型编码"
align="center"
key="itemTypeCode"
prop="equipmentTypeCode"
v-if="columns[2].visible"
>
</el-table-column>
<el-table-column
label="设备名称"
align="left"
key="itemName"
prop="equipmentName"
v-if="columns[1].visible"
:show-overflow-tooltip="true"
/>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitEquipmentForm"> </el-button>
<el-button @click="cancelEquipmentForm"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {
getEquipmentList,
getEquipmentTypeList,
} from "@/api/device/faultReport";
import { Message } from "element-ui";
export default {
name: "MdItemSingle",
// components: { Treeselect },
data() {
return {
treeData1: [],
showFlag: false,
//
selectedItemId: undefined,
selectedRows: undefined,
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
itemList: null,
//
itemTypeOptions: undefined,
//
equipmentTypeCode: undefined,
//
queryParams: {
pageNum: 1,
pageSize: 10,
itemName: null,
equipmentTypeCode: null,
itemTypeId: 0,
itemCodeGet: "",
itemCode: null,
equipmentCode: null,
equipmentName: null,
},
//
columns: [
{ key: 0, label: `设备编码`, visible: true },
{ key: 1, label: `设备名称`, visible: true },
{ key: 2, label: `设备类型`, visible: true },
],
};
},
created() {
this.getList();
this.getEquipmentType();
},
methods: {
//
reset() {
this.form = {
itemId: null,
itemCode: this.processId,
itemType: null,
};
this.resetForm("form");
},
handleEquipmentSelectionChange(val) {
this.itemList = val;
},
//
indexMethod(index) {
return index + 1;
},
/** 查询设备编码列表*/
getList() {
this.loading = true;
this.queryParams.equipmentCode = this.queryParams.itemCode;
this.queryParams.equipmentName = this.queryParams.itemName;
getEquipmentList(this.queryParams).then((response) => {
this.itemList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询分类下拉树结构 */
getEquipmentType() {
getEquipmentTypeList().then((response) => {
console.log(response.rows);
this.treeData1 = response.rows;
console.log(this.treeData1);
});
},
//
filterNode(value, data) {
console.log(value, data);
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
console.log("id", data.id);
this.queryParams.equipmentTypeCode = data.equipmentTypeCode;
console.log(this.equipmentTypeCode);
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.equipmentTypeCode = null;
this.resetForm("queryForm");
this.handleQuery();
},
//
handleEquipmentSelectionChange(selection) {
this.ids = selection.map((item) => item.equipmentCode);
this.single = selection.length !== 1;
this.multiple = !selection.length;
console.log("多选框", this.ids);
},
submitEquipmentForm() {
const data = this.ids;
if (data.length > 1) {
Message.warning("只能选择一个报修机器,请勿选择多个!");
} else {
const equipmentCode = data.toString();
if (this.queryParams.itemCodeGet == "") {
this.queryParams.itemCodeGet = equipmentCode;
} else {
this.queryParams.itemCodeGet =
this.queryParams.itemCodeGet + "," + equipmentCode;
}
this.selectedRows = this.queryParams.itemCodeGet;
this.$emit("onSelected", this.selectedRows);
this.queryParams.equipmentTypeCode = null;
this.getList();
console.log("111111", this.queryParams.equipmentTypeCode);
this.showFlag = false;
this.queryParams.itemCodeGet = "";
}
},
cancelEquipmentForm() {
this.queryParams.equipmentTypeCode = null;
this.getList();
console.log("111111", this.queryParams.equipmentTypeCode);
this.showFlag = false;
},
},
};
</script>
Loading…
Cancel
Save