全选出入库功能

This commit is contained in:
2024-05-13 20:07:25 +08:00
parent 66b878f193
commit 8ad7dc0b3d

View File

@@ -95,12 +95,17 @@
<view class="zd-col-2 zd-sec-td nowrap"><text>{{el.update_time}}</text></view> <view class="zd-col-2 zd-sec-td nowrap"><text>{{el.update_time}}</text></view>
<view class="zd-col-1 zd-sec-td"><uni-icons type="more-filled" size="14" color="#fff" @tap="getDetails(2,el)"></uni-icons></view> <view class="zd-col-1 zd-sec-td"><uni-icons type="more-filled" size="14" color="#fff" @tap="getDetails(2,el)"></uni-icons></view>
</view> </view>
<view class="zd-row"> <view class="zd-row jcenter">
<view class="zd-col-12 zd-row jcflexstart"> <view class="zd-col-22 zd-row">
<button class="confirm-button" :class="{'confirm-button_disabled': checkArr2.length === 0}" @tap="kuwConfirm">{{crType === 'IN' ? '入库' : '出库'}}</button> <view class="zd-col-1 zd-row jcenter">
</view> <view class="zd-checkbox" :class="{'zd-checkbox_active': checkArrActive}" @tap="selectAll"></view>
<view class="zd-col-12 zd-row jcflexend"> </view>
<pagination :total="totalCount2" :page-size="queryParams2.pageSize" :current-page="currentPage2" @page-change="handlePageChange2" /> <view class="zd-col-11 zd-row jcflexstart">
<button class="confirm-button" :class="{'confirm-button_disabled': checkArr2.length === 0}" @tap="kuwConfirm">{{crType === 'IN' ? '入库' : '出库'}}</button>
</view>
<view class="zd-col-12 zd-row jcflexend">
<pagination :total="totalCount2" :page-size="queryParams2.pageSize" :current-page="currentPage2" @page-change="handlePageChange2" />
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -206,6 +211,7 @@
}, },
currentPage2: 1, currentPage2: 1,
checkArr2: [], checkArr2: [],
checkArrActive: false,
disabled2: false, disabled2: false,
show: false, show: false,
type: '', type: '',
@@ -236,6 +242,7 @@
this.toSearch() this.toSearch()
}, },
methods: { methods: {
// 查询一级表格
toSearch () { toSearch () {
this.queryParams1 = { this.queryParams1 = {
pageSize: 10, pageSize: 10,
@@ -246,6 +253,7 @@
this.pkId = '' this.pkId = ''
this._easOutInBillPage() this._easOutInBillPage()
}, },
// 一级表格接口
async _easOutInBillPage () { async _easOutInBillPage () {
let res = await easOutInBillPage(this.val1, this.id, this.value, this.value1, this.queryParams1.pageNum + '', this.queryParams1.pageSize + '') let res = await easOutInBillPage(this.val1, this.id, this.value, this.value1, this.queryParams1.pageNum + '', this.queryParams1.pageSize + '')
if (res.code === 1) { if (res.code === 1) {
@@ -264,10 +272,12 @@
}) })
} }
}, },
// 二级表格接口
async _easOutInBillDetailPage () { async _easOutInBillDetailPage () {
let res = await easOutInBillDetailPage(this.pkObj.djid, this.queryParams2.pageNum + '', this.queryParams2.pageSize + '') let res = await easOutInBillDetailPage(this.pkObj.djid, this.queryParams2.pageNum + '', this.queryParams2.pageSize + '')
if (res.code === 1) { if (res.code === 1) {
this.checkArr2 = [] this.checkArr2 = []
this.checkArrActive = false
res.result.map(el => { res.result.map(el => {
this.$set(el, 'checked', false) this.$set(el, 'checked', false)
}) })
@@ -282,6 +292,7 @@
}) })
} }
}, },
// 一级表格切换分页
handlePageChange1(page) { handlePageChange1(page) {
this.queryParams1.pageNum = page this.queryParams1.pageNum = page
this.currentPage1 = page this.currentPage1 = page
@@ -289,11 +300,13 @@
this.pkId = '' this.pkId = ''
this._easOutInBillPage() this._easOutInBillPage()
}, },
// 二级表格切换分页
handlePageChange2(page) { handlePageChange2(page) {
this.queryParams2.pageNum = page this.queryParams2.pageNum = page
this.currentPage2 = page this.currentPage2 = page
this._easOutInBillDetailPage() this._easOutInBillDetailPage()
}, },
// 点击一级表格一行加载二级表格
toCollapse (e) { toCollapse (e) {
this.pkId = this.pkId === e.djid ? '' : e.djid this.pkId = this.pkId === e.djid ? '' : e.djid
this.pkObj = this.pkId === e.djid ? e : {} this.pkObj = this.pkId === e.djid ? e : {}
@@ -307,6 +320,7 @@
this._easOutInBillDetailPage() this._easOutInBillDetailPage()
} }
}, },
// 一级表格选中一行
toCheck1 (e) { toCheck1 (e) {
e.checked = !e.checked e.checked = !e.checked
let arr = this.dataList1.filter(el => el.checked === true) let arr = this.dataList1.filter(el => el.checked === true)
@@ -317,6 +331,7 @@
// this.btnActive1 = false // this.btnActive1 = false
// } // }
}, },
// 点击单据审核按钮
async toSure () { async toSure () {
this.disabled1 = true this.disabled1 = true
// if (this.checkArr1.length === 0 || this.btnActive1) { // if (this.checkArr1.length === 0 || this.btnActive1) {
@@ -348,10 +363,23 @@
this.disabled1 = false this.disabled1 = false
} }
}, },
// 二级表格多选
toCheck2 (e) { toCheck2 (e) {
e.checked = !e.checked e.checked = !e.checked
this.checkArr2 = this.dataList2.filter(el => el.checked === true) this.checkArr2 = this.dataList2.filter(el => el.checked === true)
if (this.checkArr2.length === this.dataList2.length) {
this.checkArrActive = true
}
}, },
// 二级表格全选
selectAll () {
this.checkArrActive = !this.checkArrActive
this.dataList2.map(el => {
el.checked = this.checkArrActive
})
this.checkArr2 = this.dataList2.filter(el => el.checked === true)
},
// 点击出入库按钮
kuwConfirm () { kuwConfirm () {
if (this.checkArr2.length === 0) { if (this.checkArr2.length === 0) {
return return
@@ -381,11 +409,13 @@
return return
} else { } else {
this.type = '2' this.type = '2'
this.show = true // this.show = true
this.kwCode = '' // this.kwCode = ''
this.$refs.alertDialog.open()
} }
} }
}, },
// 选择二级表格一行,点击出入库按钮,弹窗加载出入库表格
async _queryInventoryInfo () { async _queryInventoryInfo () {
let res = await queryInventoryInfo(this.checkArr2) let res = await queryInventoryInfo(this.checkArr2)
if (res.code ===1) { if (res.code ===1) {
@@ -402,6 +432,7 @@
}) })
} }
}, },
// 出入库表格输入框计算,功能暂时隐藏
handleBlur (ele) { handleBlur (ele) {
if (Number(ele.sysl) >= Number(ele.yqty)) { if (Number(ele.sysl) >= Number(ele.yqty)) {
ele.sysl = ele.yqty ele.sysl = ele.yqty
@@ -419,6 +450,7 @@
this.dataList3.splice(index+1, 0, obj) this.dataList3.splice(index+1, 0, obj)
this.dataList3 = [...this.dataList3] this.dataList3 = [...this.dataList3]
}, },
// 点击出入库弹窗确定按钮
modalConfirm () { modalConfirm () {
this.disabled2 = true this.disabled2 = true
let arr = [] let arr = []
@@ -442,10 +474,16 @@
} }
this._easOutInBillDetailUpdate(arr) this._easOutInBillDetailUpdate(arr)
}, },
// 提示弹窗确定按钮
dialogConfirm () { dialogConfirm () {
this._easOutInBillDetailUpdate(this.checkArr3) if (this.type === '2') {
this._easOutInBillDetailUpdate(this.checkArr2)
} else {
this._easOutInBillDetailUpdate(this.checkArr3)
}
}, },
dialogClose () {}, dialogClose () {},
// 出入库确定接口
async _easOutInBillDetailUpdate (arr) { async _easOutInBillDetailUpdate (arr) {
try { try {
@@ -474,6 +512,7 @@
this.disabled2 = false this.disabled2 = false
} }
}, },
// 详情弹窗
getDetails (type,e) { getDetails (type,e) {
this.delShow = !this.delShow this.delShow = !this.delShow
this.detailObj = {type: type, data:e} this.detailObj = {type: type, data:e}