395 lines
12 KiB
Vue
395 lines
12 KiB
Vue
<template>
|
|
<view class="content">
|
|
<nav-bar title="盘点"></nav-bar>
|
|
<view class="search-confirm-wrap">
|
|
<view class="zd-row">
|
|
<view class="zd-row zd-col-14">
|
|
<view class="zd-col-12"><search-box placeholder="输入查询条件" v-model="val1" /></view>
|
|
<view class="zd-col-12 select_wraper mgl10">
|
|
<zxz-uni-data-select placeholder="选择仓库" v-model="value1" filterable :localdata="range1"></zxz-uni-data-select>
|
|
</view>
|
|
</view>
|
|
<button class="confirm-button" @tap="toSearch">查询</button>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row jcflexstart table-title_wraper">盘点</view>
|
|
<view class="grid-wrap">
|
|
<view class="zdrow-wrap">
|
|
<view class="zd-row sticky zd-th-wraper">
|
|
<view class="zd-col-1 zd-th"><text>序号</text></view>
|
|
<view class="zd-col-2 zd-th"><text class="fontcol1">盘点单号</text></view>
|
|
<view class="zd-col-3 zd-th"><text>库存组织</text></view>
|
|
<view class="zd-col-3 zd-th"><text>仓库名称</text></view>
|
|
<view class="zd-col-2 zd-th"><text>明细数</text></view>
|
|
<view class="zd-col-2 zd-th"><text>单据状态</text></view>
|
|
<view class="zd-col-2 zd-th"><text>盘点状态</text></view>
|
|
<view class="zd-col-2 zd-th"><text>制单日期</text></view>
|
|
<view class="zd-col-2 zd-th"><text>制单人</text></view>
|
|
<view class="zd-col-2 zd-th"><text>业务类型</text></view>
|
|
<view class="zd-col-4 zd-th"><text>备注</text></view>
|
|
</view>
|
|
<view class="zd-td-wraper" v-for="(e, i) in dataList" :key="e.id">
|
|
<view class="zd-row" @tap="loadSubData(e)">
|
|
<view class="zd-col-1 zd-td"><text>{{i+1}}</text></view>
|
|
<view class="zd-col-2 zd-td fontcol1"><text>{{e.check_code}}</text></view>
|
|
<view class="zd-col-3 zd-td"><text>{{e.org_name}}</text></view>
|
|
<view class="zd-col-3 zd-td"><text>{{e.stor_name}}</text></view>
|
|
<view class="zd-col-2 zd-td"><text>{{e.dtl_num}}</text></view>
|
|
<view class="zd-col-2 zd-td"><text>{{e.status}}</text></view>
|
|
<view class="zd-col-2 zd-td"><text>{{e.is_nok}}</text></view>
|
|
<view class="zd-col-2 zd-td"><text>{{e.input_time}}</text></view>
|
|
<view class="zd-col-2 zd-td"><text>{{e.input_name}}</text></view>
|
|
<view class="zd-col-2 zd-td"><text>{{e.check_type}}</text></view>
|
|
<view class="zd-col-4 zd-td"><text>{{e.remark}}</text></view>
|
|
</view>
|
|
<!-- 二级表格start -->
|
|
<view v-if="e.subData.length > 0" class="zd-sec-wraper">
|
|
<view class="search-confirm-wrap_2">
|
|
<view class="zd-row jcflexend">
|
|
<button class="confirm-button" :class="{'confirm-button_disabled': !e.subOneChecked || !e.subStatus1}" :disabled="disabled1" @tap="_stIvtCheckdtlCheckFinish(e)">盘点完成</button>
|
|
<button class="confirm-button" :class="{'confirm-button_disabled': !e.subOneChecked || !e.subStatus2}" :disabled="disabled1" @tap="_stIvtCheckdtlReally(e)">实物为准</button>
|
|
<button class="confirm-button" :class="{'confirm-button_disabled': !e.subOneChecked || !e.subStatus2}" :disabled="disabled1" @tap="_stIvtCheckdtlBasedOnFinance(e)">财务为准</button>
|
|
</view>
|
|
</view>
|
|
<view class="table-wrap table-wrap_1">
|
|
<table class="grid-table">
|
|
<thead>
|
|
<tr>
|
|
<th>序号</th>
|
|
<th>
|
|
<view class="zd-row jcenter">
|
|
<view class="zd-checkbox zd-checkbox_i" :class="{'zd-checkbox_active': e.subAllChecked}" @tap="toSubAllCheckbox(e)"></view>
|
|
</view>
|
|
</th>
|
|
<th>盘点库位编码</th>
|
|
<th>盘点库位名称</th>
|
|
<th>物料编码</th>
|
|
<th>物料名称</th>
|
|
<th>数量</th>
|
|
<th>盘点数量</th>
|
|
<th>单位</th>
|
|
<th>盘点结果</th>
|
|
<th>状态</th>
|
|
<th>盘点人</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(el, j) in e.subData" :key="el.id">
|
|
<td>{{j+1}}</td>
|
|
<td @tap="toSubCheckbox(e, el)">
|
|
<view class="zd-row jcenter">
|
|
<view class="zd-checkbox zd-checkbox_i" :class="{'zd-checkbox_active': el.checked}"></view>
|
|
</view>
|
|
</td>
|
|
<td>{{el.struct_code}}</td>
|
|
<td>{{el.struct_name}}</td>
|
|
<td>{{el.material_code}}</td>
|
|
<td>{{el.material_name}}</td>
|
|
<td>{{el.qty}}</td>
|
|
<td><input class="td_input" type="number" confirm-type="go" v-model="el.fac_qty" @focus="focusInput(e, el)" @blur="updateNum(e, el)" @confirm="updateNum(e, el)"/></td>
|
|
<td>{{el.unit}}</td>
|
|
<td>{{el.check_result}}</td>
|
|
<td>{{el.status}}</td>
|
|
<td>{{el.check_name}}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</view>
|
|
</view>
|
|
<!-- 二级表格end -->
|
|
</view>
|
|
</view>
|
|
<view class="zd-row jcenter pd20">
|
|
<pagination v-show="dataList.length > 0" :total="totalCount1" :page-size="queryParams1.pageSize" :current-page="currentPage1" @page-change="handlePageChange1" />
|
|
</view>
|
|
</view>
|
|
<view class="footer"></view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import ScanInput from '@/components/ScanInput.vue'
|
|
import Pagination from '@/components/Pagination.vue'
|
|
import GridDetail from '@/components/GridDetail.vue'
|
|
import {getWarehouseInfo, stIvtCheckdtlCheckPage, checkDtlByCheckCode, stIvtCheckdtlUpdateDtl, stIvtCheckdtlCheckFinish, stIvtCheckdtlReally, stIvtCheckdtlBasedOnFinance} from '@/utils/getData2.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox,
|
|
ScanInput,
|
|
Pagination,
|
|
GridDetail
|
|
},
|
|
data() {
|
|
return {
|
|
val1: '', // 模糊查询
|
|
value1: '', // 仓库信息
|
|
range1: [],
|
|
totalCount1: 0, // 分页
|
|
queryParams1:{
|
|
pageSize: 10,
|
|
pageNum: 1
|
|
},
|
|
currentPage1: 1,
|
|
dataList: [], // 一级表格数据
|
|
disabled1: false,
|
|
raw: '', // 副表格修改前输入框数据
|
|
rawObj: {} // 副表格修改前行数据
|
|
};
|
|
},
|
|
onLoad () {
|
|
this.toSearch()
|
|
setTimeout(() => {
|
|
this._getWarehouseInfo()
|
|
}, 3000)
|
|
},
|
|
methods: {
|
|
// 仓库下拉框
|
|
async _getWarehouseInfo () {
|
|
let res = await getWarehouseInfo()
|
|
if (res.code === 1) {
|
|
this.range1 = [...res.result]
|
|
this.range1.map(e => {
|
|
this.$set(e, 'text', e.ckmc)
|
|
this.$set(e, 'value', e.ckbm)
|
|
})
|
|
}
|
|
},
|
|
// 查询一级表格
|
|
toSearch () {
|
|
this.queryParams1 = {
|
|
pageSize: 10,
|
|
pageNum: 1
|
|
}
|
|
this.currentPage1 = 1
|
|
this._stIvtCheckdtlCheckPage()
|
|
},
|
|
// 一级表格接口
|
|
async _stIvtCheckdtlCheckPage (e) {
|
|
let res = await stIvtCheckdtlCheckPage(this.val1, this.value1, this.queryParams1.pageNum + '', this.queryParams1.pageSize + '')
|
|
if (res.code === 200) {
|
|
res.content.map(el => {
|
|
this.$set(el, 'checked', false)
|
|
this.$set(el, 'subData', [])
|
|
this.$set(el, 'subAllChecked', false)
|
|
this.$set(el, 'subOneChecked', false)
|
|
this.$set(el, 'subStatus1', false)
|
|
this.$set(el, 'subStatus2', false)
|
|
})
|
|
this.dataList = [...res.content]
|
|
this.totalCount1 = Number(res.totalElements)
|
|
this.queryParams1.pageSize = Number(this.queryParams1.pageSize + '')
|
|
this.queryParams1.pageNum = Number(this.queryParams1.pageNum + '')
|
|
if (e) {
|
|
this._checkDtlByCheckCode(e)
|
|
}
|
|
} else {
|
|
uni.showToast({
|
|
title: res.desc,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
},
|
|
// 一级表格切换分页
|
|
handlePageChange1(page) {
|
|
this.queryParams1.pageNum = page
|
|
this.currentPage1 = page
|
|
this._stIvtCheckdtlCheckPage()
|
|
},
|
|
// 点击一级表格一行加载二级表格
|
|
loadSubData (e) {
|
|
if (e.subData.length > 0) {
|
|
e.subData = []
|
|
} else if (e.subData.length === 0) {
|
|
this._checkDtlByCheckCode(e)
|
|
}
|
|
e.subAllChecked = false
|
|
e.subOneChecked = false
|
|
e.subStatus1 = false
|
|
e.subStatus2 = false
|
|
},
|
|
// 二级表格接口
|
|
async _checkDtlByCheckCode (e) {
|
|
let res = await checkDtlByCheckCode(e.id)
|
|
res.map(el => {
|
|
this.$set(el, 'subChecked', false)
|
|
})
|
|
this.dataList.map(el => {
|
|
if (el.djid === e.djid) {
|
|
el.subData = [...res]
|
|
}
|
|
})
|
|
},
|
|
// 二级表格全选
|
|
toSubAllCheckbox (e) {
|
|
e.subAllChecked = !e.subAllChecked
|
|
e.subOneChecked = e.subAllChecked
|
|
e.subData.map(el => {
|
|
el.checked = e.subAllChecked
|
|
})
|
|
let arr = e.subData.filter(el => el.check_result === '正常')
|
|
let arr1 = e.subData.filter(el => el.check_result !== '正常')
|
|
e.subStatus1 = e.subAllChecked && e.subData.length > 0 && e.subData.length === arr.length
|
|
e.subStatus2 = e.subAllChecked && e.subData.length > 0 && e.subData.length === arr1.length
|
|
},
|
|
// 二级表格多选
|
|
toSubCheckbox (e,el) {
|
|
if (el.checked) {
|
|
this.$set(el, 'checked', false)
|
|
} else if (!el.checked) {
|
|
this.$set(el, 'checked', true)
|
|
}
|
|
let arr = e.subData.filter(ele => ele.checked === true)
|
|
e.subAllChecked = arr.length === e.subData.length
|
|
e.subOneChecked = arr.length > 0
|
|
let arr1 = arr.filter(el => el.check_result === '正常')
|
|
let arr2 = arr.filter(el => el.check_result !== '正常')
|
|
e.subStatus1 = arr.length > 0 && arr.length === arr1.length
|
|
e.subStatus2 = arr.length > 0 && arr.length === arr2.length
|
|
},
|
|
// 副表格单行数量获取焦点
|
|
focusInput (e, el) {
|
|
this.raw = el.qty
|
|
},
|
|
// 修改副表格单行数量
|
|
updateNum (e, el) {
|
|
this._stIvtCheckdtlUpdateDtl(e, el, 'sl')
|
|
},
|
|
// 二级表格单行盘点数量接口
|
|
async _stIvtCheckdtlUpdateDtl (e, el, type) {
|
|
try {
|
|
let res = await stIvtCheckdtlUpdateDtl(el)
|
|
if (res.code === 1) {
|
|
setTimeout(() => {
|
|
this._checkDtlByCheckCode(e)
|
|
}, 1500)
|
|
} else {
|
|
this.dataList.map(ele => {
|
|
if (e.id === ele.id) {
|
|
e.subData.map(elem => {
|
|
if (elem.id === el.id) {
|
|
if (type === 'sl') {
|
|
elem.fac_qty = this.raw
|
|
}
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
uni.showToast({
|
|
title: res.desc,
|
|
icon: 'none'
|
|
})
|
|
} catch (e) {
|
|
console.log(e)
|
|
}
|
|
},
|
|
// 盘点完成按钮
|
|
async _stIvtCheckdtlCheckFinish (e) {
|
|
this.disabled1 = true
|
|
if (!e.subOneChecked || !e.subStatus1) {
|
|
this.disabled1 = false
|
|
return
|
|
}
|
|
let arr = e.subData.filter(ele => ele.checked === true)
|
|
try {
|
|
let res = await stIvtCheckdtlCheckFinish(arr)
|
|
if (res.code === 1) {
|
|
this._stIvtCheckdtlCheckPage(e)
|
|
}
|
|
this.disabled1 = false
|
|
uni.showToast({
|
|
title: res.desc,
|
|
icon: 'none'
|
|
})
|
|
} catch (e) {
|
|
this.disabled1 = false
|
|
}
|
|
},
|
|
// 实物为准按钮
|
|
async _stIvtCheckdtlReally (e) {
|
|
this.disabled1 = true
|
|
if (!e.subOneChecked || !e.subStatus2) {
|
|
this.disabled1 = false
|
|
return
|
|
}
|
|
let arr = e.subData.filter(ele => ele.checked === true)
|
|
try {
|
|
let res = await stIvtCheckdtlReally(arr)
|
|
if (res.code === 1) {
|
|
this._stIvtCheckdtlCheckPage(e)
|
|
}
|
|
this.disabled1 = false
|
|
uni.showToast({
|
|
title: res.desc,
|
|
icon: 'none'
|
|
})
|
|
} catch (e) {
|
|
this.disabled1 = false
|
|
}
|
|
},
|
|
// 财务为准
|
|
async _stIvtCheckdtlBasedOnFinance (e) {
|
|
this.disabled1 = true
|
|
if (!e.subOneChecked || !e.subStatus2) {
|
|
this.disabled1 = false
|
|
return
|
|
}
|
|
let arr = e.subData.filter(ele => ele.checked === true)
|
|
try {
|
|
let res = await stIvtCheckdtlBasedOnFinance(arr)
|
|
if (res.code === 1) {
|
|
this._stIvtCheckdtlCheckPage(e)
|
|
}
|
|
this.disabled1 = false
|
|
uni.showToast({
|
|
title: res.desc,
|
|
icon: 'none'
|
|
})
|
|
} catch (e) {
|
|
this.disabled1 = false
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="stylus" scoped>
|
|
@import '../../common/style/mixin.styl';
|
|
.select_wraper
|
|
/deep/ .uni-select__input-box
|
|
height 30px
|
|
/deep/ .uni-select__selector
|
|
z-index 11
|
|
/deep/ .uni-select
|
|
height: 30px;
|
|
min-height: 30px;
|
|
line-height: 30px;
|
|
padding: 0 2px 0 12px;
|
|
border: 1px solid #4980bd;
|
|
background-color: rgba(45,88,184,0.1);
|
|
border-radius: 6px;
|
|
/deep/ .uni-select__input-placeholder, /deep/ .uni-select__input-text
|
|
font-size 13px
|
|
/deep/ .uni-select__selector
|
|
background-color #071F3E
|
|
border-color #0c3162
|
|
/deep/ .uni-popper__arrow
|
|
border-bottom-color #0c3162
|
|
&:after
|
|
border-bottom-color #071F3E
|
|
/deep/ .uni-select__selector-item
|
|
color #fff
|
|
.zd-th
|
|
font-size: 12px;
|
|
line-height: 13px;
|
|
height: 36px;
|
|
.grid-table th:last-child, .grid-table td:last-child
|
|
position: inherit;
|
|
box-shadow: none;
|
|
.grid-table td:last-child
|
|
background-color: rgba(63,106,202,0.3);
|
|
</style>
|