Files
scrq-hd/.svn/pristine/94/945e905c56d2203c9c7f35bee8c766ff5f8be92f.svn-base
2025-07-03 10:34:04 +08:00

494 lines
13 KiB
Plaintext

<template>
<div>
<div class="main">
<div>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-select
ref="select"
@click.native="notSelect"
style="width: 800px"
v-model="seqence"
:multiple="true"
placeholder=""
>
<el-option
v-for="item in seqenceOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
<el-popover
style="float: right"
placement="bottom-end"
title="自定义显示列"
width="250"
@show="initPopover"
trigger="hover"
>
<headConfig
ref="test"
@fathers="fathers"
:propThis="propThis"
></headConfig>
<el-button
size="mini"
type="primary"
class="el-icon-caret-bottom"
slot="reference"
>自定义列</el-button
>
</el-popover>
</el-row>
</div>
<el-table
@sort-change="sortChange"
@header-dragend="headerDragend"
v-loading="loading"
highlight-current-row
@current-change="handleCurrentChange"
:data="tableData"
border
lazy
@expand-change="rowExpand"
:expand-row-keys="expands"
:row-key="getRowKeys"
class="tableStyle"
style="width: 100%"
:height="tableHeight"
v-if="indexShow"
>
<el-table-column type="index" align="center" label="序号" width="50">
</el-table-column>
<el-table-column type="expand">
<template slot-scope="scope">
<el-table
border
ref="singleTableFlow"
v-loading="subLoading"
:data="childrenList"
style="width: 100%"
class="two-list"
max-height="130"
>
<el-table-column
type="index"
align="center"
label="序号"
width="50"
>
</el-table-column>
<el-table-column prop="location" align="center" label="位号"> </el-table-column>
<el-table-column prop="phenomenon" align="center" label="不良现象" width="200">
</el-table-column>
<el-table-column prop="reason" align="center" label="不良原因" width="200">
</el-table-column>
<el-table-column prop="defect" align="center" label="缺陷原因" width="200">
</el-table-column>
<el-table-column
prop="isOK"
label="是否合格"
width="100"
align="center"
:formatter="formatterColumn"
>
</el-table-column>
<el-table-column
prop="xlocation"
label="X轴"
align="center"
:show-overflow-tooltip="true"
width="100"
>
</el-table-column>
<el-table-column prop="ylocation" align="center" label="Y轴" width="100">
</el-table-column>
<el-table-column prop="description" align="center" label="详细描述" width="180">
</el-table-column>
<el-table-column prop="deptNameA" align="center" label="责任部门一" width="120">
</el-table-column
><el-table-column prop="deptNameB" align="center" label="责任部门二" width="120">
</el-table-column>
<el-table-column prop="repairBy" align="center" label="维修人员" width="120">
</el-table-column>
<el-table-column prop="repairDt" align="center" label="维修时间" width="180">
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column
v-for="(item, index) in realList"
:sortable="item.notSort == true ? false : `custom`"
:prop="item.tableProp"
:key="index"
:align="item.align"
header-align="center"
:min-width="item.width"
:label="item.tableTitle"
:show-overflow-tooltip="item.show_overflow_tooltip"
>
</el-table-column>
</el-table>
<el-pagination
style="margin-top: 10px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange2"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100, 200, 500, 1000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
export default {
name: "PatchRepairList",
props: {
propsThis: {
type: Object,
},
},
data() {
return {
getRowKeys: (row) => {
//获取当前行id
// console.log(row)
return row.id; //这里看这一行中需要根据哪个属性值是id
},
childrenList: [],
expands: [], //只展开一行放入当前行id
subLoading: false,
pageQty: 0,
pageQtySummer: 0,
indexShow: false,
showMore: false,
currentRow: null,
List: [],
warehouseOptions: [],
locationOptions: [],
realList: [],
isAdd: null,
total: null,
pageSize: 50,
buttonEnable: true,
tableHeight: 0,
currentPage: 1,
propThis: this,
tableData: [],
queryParams: {},
loading: false,
seqenceOptions: [],
seqence: [],
};
},
mounted() {
let tempList = this.$headerConfig.getList("PatchRepairList");
tempList.forEach((data, index) => {
if (data.notSort) return;
let temp = {
value: null,
label: null,
};
temp.value = data.tableProp.replace("Show", "") + " ascending";
temp.label = data.tableTitle + " 升序";
this.seqenceOptions.push(temp);
let tempD = {
value: null,
label: null,
};
tempD.value = data.tableProp.replace("Show", "") + " descending";
tempD.label = data.tableTitle + " 降序";
this.seqenceOptions.push(tempD);
});
this.getList();
const params = {
tableName: "PatchRepairList",
};
this.$headerConfig.getRealList(params).then((data) => {
console.log("开始输出真正表格");
if (data.data && data.data.data && data.data.data !== null) {
let temp = JSON.parse(data.data.data);
this.realList = temp.headerList;
this.List = temp.List;
} else {
this.List = this.$headerConfig.getList("PatchRepairList");
this.realList = this.List;
let temp = {
headerList: this.realList,
List: this.List,
};
const params = {
tableName: "PatchRepairList",
configure: JSON.stringify(temp),
};
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
}
this.indexShow = true;
});
setTimeout(() => {
this.tableHeight=this.propsThis.tableHeight
}, 100);
},
methods: {
rowExpand(row, rowList) {
// this.$refs.singleTable.setCurrentRow(row);
this.childrenList = [];
this.subLoading = true;
let that = this;
// console.log("进入", rowList.length);
if (rowList.length) {
that.expands = [];
if (row) {
that.expands.push(row.id);
}
this.getChildrenList(row.id);
} else {
that.expands = [];
}
},
getChildrenList(id) {
this.$report
.PatchRepairDetailList({
pasterRepairId: id,
})
.then((data) => {
console.log(data, "子数据");
if(data.data.code==200){
this.childrenList = data.data.data;
}else{
this.$message.error(data.msg)
}
this.subLoading = false;
});
},
formatterColumn(row) {
return row.isOk == 1 ? "是" : row.isOk == 0 ? "否" : "未知";
},
initPopover() {
const params = {
tableName: "PatchRepairList",
};
this.$headerConfig.getRealList(params).then((data) => {
console.log("开始输出真正表格");
let temp = JSON.parse(data.data.data);
console.log(temp);
this.realList = temp.headerList;
console.log(this.realList);
this.$refs.test.init();
});
},
fathers(data) {
this.List = data.configure.List;
data.configure.List.forEach((value) => {
this.realList.forEach((real) => {
if (value.tableProp == real.tableProp) {
value.width = real.width;
}
});
});
data.configure.headerList.forEach((value) => {
this.realList.forEach((real) => {
if (value.tableProp == real.tableProp) {
value.width = real.width;
}
});
});
if (data.configure.headerList.length <= 0) {
return;
}
const params = {
tableName: "PatchRepairList",
configure: JSON.stringify(data.configure),
};
this.realList = data.configure.headerList;
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
},
initSeqenceOptions() {
this.realList.forEach((data, index) => {
if (data.notSort) return;
let temp = {
value: null,
label: null,
};
temp.value = data.tableProp.replace("Show", "") + " ascending";
temp.label = data.tableTitle + " 升序";
this.seqenceOptions.push(temp);
let tempD = {
value: null,
label: null,
};
tempD.value = data.tableProp.replace("Show", "") + " descending";
tempD.label = data.tableTitle + " 降序";
this.seqenceOptions.push(tempD);
});
},
notSelect() {
this.$refs.select.blur();
},
sortChange({ column, prop, order }) {
console.log(prop);
let sTemp = {
value: null,
label: null,
};
let value = prop.replace("Show", "") + " " + order;
let judgeValue = value.split(" ");
// this.seqence.push(value)
if (this.seqence.length === 0) {
this.seqence.push(value);
console.log(this.seqence);
} else {
for (let i = 0; i < this.seqence.length; i++) {
let judgeSeqence = this.seqence[i].split(" ");
if (judgeValue[0] === judgeSeqence[0]) {
if (judgeValue[1] === "null") {
return;
}
this.seqence.splice(i, 1, value);
console.log(this.seqence);
return;
}
if (i + 1 === this.seqence.length) {
this.seqence.push(value);
console.log(this.seqence);
}
}
}
},
headerDragend(newWidth, oldWidth, column, event) {
// realList
this.realList.forEach((value) => {
if (column.property == value.tableProp) {
value.width = newWidth;
}
});
this.$refs.test.init();
setTimeout(() => {
this.$refs.test.show();
}, 1000);
},
getList() {
this.loading = true;
const orders = [];
this.seqence.map((val) => {
orders.push(
val.replace("ascending", "asc").replace("descending", "desc")
);
});
const params = {
pageSize: this.pageSize,
pageNo: this.currentPage,
serialNumber: this.propsThis.queryParams.serialNumber,
orderProdNumber: this.propsThis.queryParams.orderProdNumber,
orderWorkNumber: this.propsThis.queryParams.orderWorkNumber,
workCenterId: this.propsThis.queryParams.workCenterId,
orders,
};
this.$report.PatchRepairList(params).then((data) => {
if (data.data.code == 200) {
this.tableData = data.data.data.data;
this.tableData.forEach((e) => {
if (e.isOk == 0) {
e.isOkShow = "否";
} else if (e.isOk == 1) {
e.isOkShow = "是";
} else {
e.isOkShow = "未知";
}
});
this.total = data.data.data.recordsTotal;
} else {
this.$message.error(data.msg);
}
this.loading = false;
});
},
handleCurrentChange2(val) {
// this.currentRow = val;
console.log(val);
this.currentPage = val;
this.getList();
},
handleSizeChange(val) {
this.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.buttonEnable = false;
this.currentRow = val;
},
Query() {
this.currentPage = 1;
this.getList();
},
resetQuery() {
this.queryParams = {};
this.seqence = [];
},
},
watch: {
seqence: function () {
this.getList();
},
},
};
</script>
<style scoped lang="scss">
.mb8 >>> .el-select .el-input__inner {
border: 0px;
}
.mb8 >>> .el-select .el-input__inner {
border: 0px;
padding-right: 35px;
}
>>> .el-input__suffix-inner {
display: none;
}
>>> .el-form-item {
margin-bottom: 10px;
}
.el-divider {
margin-top: 0px;
margin-bottom: 5px;
}
>>> .el-table .el-table__header-wrapper th {
padding: 5px 0;
}
</style>