parent
9f67ac2f03
commit
2c06b569c9
8 changed files with 256 additions and 141 deletions
@ -0,0 +1,179 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog |
||||||
|
:title="purchaseTitle" |
||||||
|
append-to-body |
||||||
|
:visible.sync="openShow" |
||||||
|
width="50%" |
||||||
|
@close="closeDialog" |
||||||
|
:style="{ height: '600px' }" |
||||||
|
> |
||||||
|
<el-tabs v-model="transactionType" @tab-click="handleTabClick"> |
||||||
|
<el-tab-pane label="入库" name="2"></el-tab-pane> |
||||||
|
<el-tab-pane label="出库" name="1"></el-tab-pane> |
||||||
|
</el-tabs> |
||||||
|
|
||||||
|
<avue-crud |
||||||
|
:data="data" |
||||||
|
:option="dynamicOption" |
||||||
|
v-model:page="page" |
||||||
|
@on-load="onLoad" |
||||||
|
@current-change="currentChange" |
||||||
|
@size-change="sizeChange" |
||||||
|
@search-change="searchChange" |
||||||
|
@search-reset="searchReset" |
||||||
|
:page.sync="page" |
||||||
|
></avue-crud> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { recordList } from "@/api/firstOrder/list"; |
||||||
|
|
||||||
|
export default { |
||||||
|
props: { |
||||||
|
showDialog: { |
||||||
|
type: Boolean, |
||||||
|
default: false, |
||||||
|
}, |
||||||
|
|
||||||
|
rowData: { |
||||||
|
type: Object, |
||||||
|
default: () => ({}), |
||||||
|
}, |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
openShow: false, |
||||||
|
transactionType: "1", |
||||||
|
tableData: [], |
||||||
|
purchaseTitle: "记录", |
||||||
|
data: [], |
||||||
|
page: { |
||||||
|
pageSize: 10, |
||||||
|
currentPage: 1, |
||||||
|
total: 0, |
||||||
|
}, |
||||||
|
loading: false, |
||||||
|
query: {}, |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
dynamicOption() { |
||||||
|
const showPriceColumn = this.rowData.type === 'NY' && this.transactionType === '1'; |
||||||
|
|
||||||
|
const columns = [ |
||||||
|
{ |
||||||
|
label: "数量", |
||||||
|
prop: "quantity", |
||||||
|
hide: false, |
||||||
|
}, |
||||||
|
|
||||||
|
{ |
||||||
|
label: "操作人", |
||||||
|
prop: "operatorName", |
||||||
|
hide: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "时间", |
||||||
|
prop: "operationTime", |
||||||
|
type: "date", |
||||||
|
format: "yyyy-MM-dd HH:mm:ss", |
||||||
|
valueFormat: "yyyy-MM-dd HH:mm:ss", |
||||||
|
hide: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "部门", |
||||||
|
prop: "departmentName", |
||||||
|
hide: false, |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: "单价", |
||||||
|
prop: "money", |
||||||
|
hide: !showPriceColumn, |
||||||
|
}, |
||||||
|
]; |
||||||
|
|
||||||
|
return { |
||||||
|
header: false, |
||||||
|
calcHeight: 30, |
||||||
|
tip: false, |
||||||
|
searchShow: true, |
||||||
|
searchMenuSpan: 6, |
||||||
|
border: true, |
||||||
|
index: true, |
||||||
|
selection: false, |
||||||
|
viewBtn: false, |
||||||
|
addBtn: false, |
||||||
|
editBtn: false, |
||||||
|
delBtn: false, |
||||||
|
dialogClickModal: false, |
||||||
|
menu: false, |
||||||
|
printBtn: false, |
||||||
|
refreshBtn: false, |
||||||
|
gridBtn: false, |
||||||
|
gridBackgroundImage: false, |
||||||
|
gridSpan: false, |
||||||
|
filterBtn: false, |
||||||
|
columnBtn: false, |
||||||
|
menuAlign: "left", |
||||||
|
searchMenuPosition: "right", |
||||||
|
column: columns, |
||||||
|
}; |
||||||
|
} |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.openShow = this.showDialog; |
||||||
|
console.log("一级出入库记录 rowData", this.rowData); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
searchChange(params, done) { |
||||||
|
this.query = params; |
||||||
|
this.page.currentPage = 1; |
||||||
|
this.onLoad(this.page, params); |
||||||
|
done(); |
||||||
|
}, |
||||||
|
searchReset() { |
||||||
|
this.query = {}; |
||||||
|
this.onLoad(this.page); |
||||||
|
}, |
||||||
|
handleTabClick() { |
||||||
|
this.tableData = []; |
||||||
|
this.page.currentPage = 1; |
||||||
|
this.onLoad(this.page); |
||||||
|
}, |
||||||
|
closeDialog() { |
||||||
|
this.openShow = false; |
||||||
|
this.$emit("closeDialog"); |
||||||
|
}, |
||||||
|
currentChange(currentPage) { |
||||||
|
this.page.currentPage = currentPage; |
||||||
|
this.onLoad(this.page); |
||||||
|
}, |
||||||
|
sizeChange(pageSize) { |
||||||
|
this.page.pageSize = pageSize; |
||||||
|
this.onLoad(this.page); |
||||||
|
}, |
||||||
|
onLoad(page, params = {}) { |
||||||
|
this.loading = true; |
||||||
|
|
||||||
|
const query_ = { |
||||||
|
oneFromId: this.rowData.id, |
||||||
|
transactionType: this.transactionType, |
||||||
|
currentPage: page.currentPage, |
||||||
|
pageSize: page.pageSize, |
||||||
|
...params, |
||||||
|
}; |
||||||
|
console.log("query_", query_); |
||||||
|
|
||||||
|
recordList(query_) |
||||||
|
.then((res) => { |
||||||
|
this.data = res.data.result.list; |
||||||
|
this.page.total = res.data.result.total; |
||||||
|
}) |
||||||
|
.finally(() => { |
||||||
|
this.loading = false; |
||||||
|
}); |
||||||
|
}, |
||||||
|
}, |
||||||
|
}; |
||||||
|
</script> |
||||||
Loading…
Reference in new issue