Files
scrq-hd/.svn/pristine/b5/b5812f2297b43528344c2c462679e5fbe41d8136.svn-base
2025-07-03 10:34:04 +08:00

385 lines
9.8 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
v-if="indexShow"
:height="propsThis.tableHeight"
class="tableStyle"
style="width: 100%"
>
<el-table-column type="index" align="center" label="序号" width="50">
</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: "listSnOperationHis",
props: {
propsThis: {
type: Object,
},
},
mounted() {
let tempList = this.$headerConfig.getList("listSnOperationHis");
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: "listSnOperationHis",
};
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("listSnOperationHis");
this.realList = this.List;
let temp = {
headerList: this.realList,
List: this.List,
};
const params = {
tableName: "listSnOperationHis",
configure: JSON.stringify(temp),
};
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
}
this.indexShow = true;
});
},
data() {
return {
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,
tableData: [],
propThis: this,
queryParams: {},
loading: false,
seqenceOptions: [],
seqence: [],
};
},
methods: {
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);
});
console.log(this.seqenceOptions);
},
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.listSnOperationHis(params).then((data) => {
if (data.data.code == 200) {
this.tableData = data.data.data.data;
this.tableData.forEach((value) => {
value.dictQcstatusShow = this.$dictType.getSNQStatus(
value.dictQcstatus
);
value.dictSnstatusShow = this.$dictType.getSNStatus(
value.dictSnstatus
);
});
this.total = data.data.data.recordsTotal;
} else {
this.$message.error(data.msg);
}
this.loading = false;
});
},
initPopover() {
const params = {
tableName: "listSnOperationHis",
};
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: "listSnOperationHis",
configure: JSON.stringify(data.configure),
};
this.realList = data.configure.headerList;
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
},
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>