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

409 lines
12 KiB
Plaintext

<template>
<div class="app-container">
<div class="main">
<div class="query" ref="query">
<el-form
:model="queryParams"
ref="queryParams"
:inline="true"
label-width="100px"
>
<el-form-item>
<el-input
v-model="queryParams.pickNumber"
placeholder="拣配单号"
clearable
size="small"
style="width: 230px"
/>
</el-form-item>
<el-form-item>
<el-input
v-model="queryParams.sourceWarehouseName"
placeholder="来源库区名称"
clearable
size="small"
style="width: 230px"
/>
</el-form-item>
<el-form-item>
<el-input
v-model="queryParams.targetWarehouseName"
placeholder="目标库区名称"
clearable
size="small"
style="width: 230px"
/>
</el-form-item>
<el-form-item>
<el-select
size="small"
collapse-tags
style="width: 230px"
v-model="queryParams.dictStatus"
placeholder="单据状态"
>
<el-option
v-for="item in this.$dictType.getAutoPickArray()"
:key="item.key"
:label="item.text"
:value="item.key"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="Query"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
<el-button
type="primary"
:icon="
showMore == true ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
"
size="mini"
@click="showMoreChange"
></el-button>
</el-form-item>
<div v-show="showMore">
<el-form-item>
<el-input
v-model="queryParams.targetWarehouseCode"
placeholder="目标库区代码"
clearable
size="small"
style="width: 230px"
/>
</el-form-item>
<el-form-item>
<el-input
v-model="queryParams.sourceWarehouseCode"
placeholder="来源库区代码"
clearable
size="small"
style="width: 230px"
/>
</el-form-item>
</div>
</el-form>
</div>
<el-divider></el-divider>
<div>
<el-row :gutter="10" class="mb8">
<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>
<el-table
@header-dragend="headerDragend"
v-loading="loading"
highlight-current-row
:data="tableData"
border
ref="singleTable"
lazy
:row-key="getRowKeys"
@expand-change="rowExpand"
:height="tableHeight"
class="tableStyle"
style="width: 100%"
>
<el-table-column align="center" type="index" label="序号" width="50">
</el-table-column>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="expand">
<template slot-scope="scope">
<el-table
v-loading="subLoading"
:data="scope.row.childrenList"
style="width: 95%"
class="two-list"
>
<el-table-column
type="index"
align="center"
label="序号"
width="50"
>
</el-table-column>
<el-table-column
align="center"
prop="materialCode"
label="物料编码"
width="230"
>
</el-table-column>
<el-table-column
prop="materialName"
label="物料名称"
width="200"
align="center"
/>
<el-table-column
prop="materialSpec"
label="规格型号"
:show-overflow-tooltip="true"
width="200"
align="center"
/>
<el-table-column
prop="materialUnit"
label="物料单位"
width="130"
align="center"
/>
<el-table-column prop="planQty" label="需求数量" width="130" align="center"/>
<el-table-column prop="doneQty" label="实发数量" width="130" align="center"/>
<el-table-column prop="createdBy" label="创建人" width="80" align="center"/>
<el-table-column prop="createdDt" label="创建时间" width="200" align="center"/>
<el-table-column prop="updatedBy" label="修改人" width="80" align="center"/>
<el-table-column prop="updatedDt" label="修改时间" width="200" align="center"/>
</el-table>
</template>
</el-table-column>
<el-table-column
v-for="(item, index) in realList"
: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>
</div>
</template>
<script>
export default {
name: "PickingList",
components: {},
data() {
return {
getRowKeys: (row) => {
//获取当前行id
// console.log(row)
return row.id; //这里看这一行中需要根据哪个属性值是id
},
queryParams: {},
pageSize: 50,
currentPage: 1,
showMore: false,
tableHeight: 0,
propThis: this,
realList: [],
total: null,
loading: false,
tableData: [],
List: [],
subLoading: false,
childrenList: [],
indexShow: false,
};
},
mounted() {
this.$nextTick(() => {
this.tableHeight =
window.innerHeight - this.$refs.query.offsetHeight - 250;
});
this.getList();
const params = {
tableName: "PickingList",
};
this.$headerConfig.getRealList(params).then((data) => {
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;
console.log(this.List, "进入");
} else {
this.List = this.$headerConfig.getList("PickingList");
this.realList = this.List;
console.log("shei", this.realList);
let temp = {
headerList: this.realList,
List: this.List,
};
const params = {
tableName: "PickingList",
configure: JSON.stringify(temp),
};
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
}
this.indexShow = true;
});
},
methods: {
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);
},
Query() {
this.currentPage = 1;
this.getList();
},
resetQuery() {
this.queryParams = {};
this.getList();
},
showMoreChange() {
if (!this.showMore) {
this.tableHeight = this.tableHeight - 70;
} else {
this.tableHeight = this.tableHeight + 70;
}
this.$nextTick(() => {
this.showMore = !this.showMore;
});
},
initPopover() {
const params = {
tableName: "PickingList",
};
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;
}
console.log(this.List, "gjk");
const params = {
tableName: "PickingList",
configure: JSON.stringify(data.configure),
};
this.realList = data.configure.headerList;
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
},
getList() {
//拿到所有数据
// this.rowExpand();
this.loading = true;
const params = {
pageSize: this.pageSize,
pageNo: this.currentPage,
dictStatus: this.queryParams.dictStatus,
pickNumber: this.queryParams.pickNumber,
sourceWarehouseCode: this.queryParams.sourceWarehouseCode,
sourceWarehouseName: this.queryParams.sourceWarehouseName,
targetWarehouseCode: this.queryParams.targetWarehouseCode,
targetWarehouseName: this.queryParams.targetWarehouseName,
};
this.$PickingList.getList(params).then((resp) => {
console.log("拿到数据", resp.data.data.data);
this.tableData = resp.data.data.data;
this.tableData.forEach((value) => {
value.dictStatusShow = this.$dictType.getAutoPick(value.dictStatus);
});
this.total = resp.data.data.recordsTotal;
this.loading = false;
});
},
handleSizeChange(val) {
this.pageSize = val;
this.getList();
},
handleCurrentChange2(val) {
this.currentPage = val;
this.getList();
},
rowExpand(row, rowList) {
// this.$refs.singleTable.setCurrentRow(row);
this.childrenList = [];
this.subLoading = true;
this.$PickingList.getDetail({ pickId: row.id }).then((resp) => {
if (resp.data.code == 200) {
row.childrenList = resp.data.data.dtls;
this.subLoading = false;
}
});
},
},
};
</script>
<style lang="scss" scoped>
.el-divider--horizontal {
display: block;
height: 1px;
width: 100%;
margin: 0px 0;
}
</style>