Files
pad-nl-three-uni/pages/management/alloc-maintenance.vue
2024-07-23 08:51:43 +08:00

585 lines
20 KiB
Vue

<template>
<view class="content">
<nav-bar title="调拨维护"></nav-bar>
<view class="search-confirm-wrap">
<view class="zd-row">
<view class="zd-col-24 zd-row jcflexstart">
<view class="zd-col-7"><search-box v-model="val1" /></view>
<view class="zd-col-8 select_wraper mgl10">
<zxz-uni-data-select placeholder="请选择调出组织信息" v-model="value2" filterable :localdata="range1"></zxz-uni-data-select>
</view>
<view class="zd-col-8 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-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-3 zd-th"><text>计划调入日期</text></view>
<view class="zd-col-4 zd-th"><text>审核结果</text></view>
<view class="zd-col-2 zd-th">更多</view>
</view>
<view class="zd-td-wraper" v-for="(e, i) in dataList1" :key="e.id">
<view class="zd-row" :class="{'zd-td-checked': pkId === e.id}" @tap="toCollapse(e)">
<view class="zd-col-1 zd-td"><text>{{i+1}}</text></view>
<view class="zd-col-2 zd-td fontcol1"><text>{{e.djbh}}</text></view>
<view class="zd-col-2 zd-td"><text>{{e.ywrq}}</text></view>
<view class="zd-col-2 zd-td"><text>{{e.dckcmc}}</text></view>
<view class="zd-col-2 zd-td"><text>{{e.dcckmc}}</text></view>
<view class="zd-col-2 zd-td"><text>{{e.drkcmc}}</text></view>
<view class="zd-col-2 zd-td"><text>{{e.drckmc}}</text></view>
<view class="zd-col-2 zd-td"><text class="fontbg1">{{e.djzt}}</text></view>
<view class="zd-col-3 zd-td"><text>{{e.jhdrrq}}</text></view>
<view class="zd-col-4 zd-td"><text>{{e.shjg}}</text></view>
<view class="zd-col-2 zd-td" @tap.stop="getDetails(3,e)">
<uni-icons type="more-filled" size="14" color="#fff"></uni-icons>
</view>
</view>
<!-- 二级表格start -->
<view v-if="pkId === e.djid" class="zd-sec-wraper pd0">
<view class="table-wrap">
<table class="grid-table">
<thead>
<tr>
<th>序号</th>
<th v-if="pkObj.djzt !== '审核后'">选择</th>
<th><text class="fontcol1">物料编码</text></th>
<th>物料名称</th>
<th>计里单位</th>
<th>库存类型</th>
<th>库存状态</th>
<th>数量</th>
<th>调出仓库</th>
<th>调出仓库名称</th>
<th>调出库位</th>
<th>调入仓库</th>
<th>调入仓库名称</th>
<th>调入库位</th>
<th>计划调入日期</th>
<th>计划调出日期</th>
<th>跟踪号</th>
<th>更多</th>
</tr>
</thead>
<tbody v-if="pkObj.djzt !== '审核后'">
<tr v-for="(el, j) in dataList2" :key="el.id">
<td>{{j+1}}</td>
<td @tap="toCheck2(el)">
<view class="zd-row jcenter">
<view class="zd-checkbox" :class="{'zd-checkbox_active': el.checked}"></view>
</view>
</td>
<td><view class="fontcol1">{{el.wlbm}}</view></td>
<td>{{el.wlmc}}</td>
<td>{{el.jldw}}</td>
<td>{{el.kclx}}</td>
<td>{{el.kczt}}</td>
<td>
<input class="td_input" type="number" confirm-type="go" v-model="el.sl" @blur="_allocationBillUpdate(el)" @confirm="_allocationBillUpdate(el)" />
</td>
<td @tap.stop="checkWarehouse(1, '修改调出仓库', el)">
<view class="zd-row td_change">
<uni-icons type="shop" size="16" color="#fff"></uni-icons>
<view class="mgl10">{{el.dcckbm}}</view>
</view>
</td>
<td>{{el.dcckmc}}</td>
<td>
<view class="td_scan_wraper">
<scan-input v-model="el.dckwbm" @handleChange="_allocationBillUpdate(el)" />
</view>
</td>
<td @tap.stop="checkWarehouse(2, '修改调入仓库', el)">
<view class="zd-row td_change">
<uni-icons type="shop" size="16" color="#fff"></uni-icons>
<view class="mgl10">{{el.drckbm}}</view>
</view>
</td>
<td>{{el.drckmc}}</td>
<td>
<view class="td_scan_wraper">
<scan-input v-model="el.drkwbm" @handleChange="_allocationBillUpdate(el)" />
</view>
</td>
<td @tap.stop="openCalendar(1,el)">
<view class="zd-row td_change">
<uni-icons type="calendar" size="16" color="#fff"></uni-icons>
<view class="mgl10">{{el.jhdrrq}}</view>
</view>
</td>
<td @tap.stop="openCalendar(2,el)">
<view class="zd-row td_change">
<uni-icons type="calendar" size="16" color="#fff"></uni-icons>
<view class="mgl10">{{el.jhdcrq}}</view>
</view>
</td>
<td>
<view class="zd-row td_change" :class="{'td_change_focus': fstate}">
<input class="td_input_1" type="text" confirm-type="go" v-model="el.gzh" @focus="fstate = true" @blur="fstate = false, _allocationBillUpdate(el)" @confirm="fstate = false,_allocationBillUpdate(el)" />
<uni-icons class="mgl10" type="search" size="20" color="#a2b6cc" @tap="checkWarehouse(5, '库存信息', el)"></uni-icons>
</view>
</td>
<td @tap.stop="getDetails(3,el)"><uni-icons type="more-filled" size="14" color="#fff"></uni-icons></td>
</tr>
</tbody>
<tbody v-else>
<tr v-for="(el, j) in dataList2" :key="el.id">
<td>{{j+1}}</td>
<td>{{el.wlbm}}</td>
<td>{{el.wlmc}}</td>
<td>{{el.jldw}}</td>
<td>{{el.kclx}}</td>
<td>{{el.kczt}}</td>
<td>{{el.sl}}</td>
<td>{{el.dcckbm}}</td>
<td>{{el.dcckmc}}</td>
<td>{{el.dckwbm}}</td>
<td>{{el.drckbm}}</td>
<td>{{el.drckmc}}</td>
<td>{{el.drkwbm}}</td>
<td>{{el.jhdrrq}}</td>
<td>{{el.jhdcrq}}</td>
<td>{{el.gzh}}</td>
<td @tap.stop="getDetails(3,el)"><uni-icons type="more-filled" size="14" color="#fff"></uni-icons></td>
</tr>
</tbody>
</table>
</view>
<view v-if="pkObj.djzt !== '审核后'" class="zd-row jcflexstart mgt10 mgb20">
<view class="zd-col-1 zd-row jcenter mgl52">
<view class="zd-checkbox" :class="{'zd-checkbox_active': checkArrActive}" @tap="selectAll"></view>
</view>
<button class="confirm-button" :class="{'confirm-button_disabled': checkArr.length === 0}" :disabled="disabled" @tap="_allocationBillConfirm">直接调拨</button>
<view class="zd-col-10">
<!-- <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>
<!-- 二级表格end -->
</view>
</view>
<view class="zd-row jcenter pd20">
<pagination v-show="dataList1.length > 0" :total="totalCount1" :page-size="queryParams1.pageSize" :current-page="currentPage1" @page-change="handlePageChange1" />
</view>
</view>
<view class="footer"></view>
<grid-detail :show="delShow" :data="detailObj" @closeDetail="delShow=false"></grid-detail>
<view class="pop-wraper" :class="{'popshow': show, 'pophide': !show}">
<view class="allwidth pop-title">{{modalObj.title}}</view>
<view v-if="modalObj.type === 1 || modalObj.type === 2" class="zd-row jcenter kwcode_wraper">
<view class="zd-col-12 select_wraper">
<zxz-uni-data-select placeholder="请选择仓库名称" v-model="value" filterable :localdata="range"></zxz-uni-data-select>
</view>
</view>
<view v-if="modalObj.type === 3 || modalObj.type === 4" class="zd-row jcenter kwcode_wraper">
<view class="zd-col-12 grid-data">
<uni-datetime-picker type="date" v-model="date" @change="_allocationBillUpdate(el)" />
</view>
</view>
<view v-if="modalObj.type === 5" class="pop-grid-wraper">
<view class="zd-row sticky zd-sec-th-wraper zd-pop-th-wraper">
<view class="zd-col-2 zd-sec-th"><text>序号</text></view>
<view class="zd-col-3 zd-sec-th"><text>物料名称</text></view>
<view class="zd-col-3 zd-sec-th"><text>物料编码</text></view>
<view class="zd-col-3 zd-sec-th"><text>计量单位</text></view>
<view class="zd-col-3 zd-sec-th"><text>可用数量</text></view>
<view class="zd-col-3 zd-sec-th"><text>批次</text></view>
<view class="zd-col-3 zd-sec-th"><text>仓库</text></view>
<view class="zd-col-3 zd-sec-th"><text>库位</text></view>
<view class="zd-col-3 zd-sec-th"><text>跟踪号</text></view>
</view>
<view class="zd-row zd-td-wraper" v-for="(ele, t) in dataList3" :key="ele.id" @tap="toCheck3(ele)" :class="{'popChecked': ele.id === iid}">
<view class="zd-col-2 zd-sec-td zd-pop-td"><text>{{t+1}}</text></view>
<view class="zd-col-3 zd-sec-td zd-pop-td"><text>{{ele.materialName}}</text></view>
<view class="zd-col-3 zd-sec-td zd-pop-td"><text>{{ele.materialNo}}</text></view>
<view class="zd-col-3 zd-sec-td zd-pop-td"><text>{{ele.unitNo}}</text></view>
<view class="zd-col-3 zd-sec-td zd-pop-td"><text>{{ele.curStoreQty}}</text></view>
<view class="zd-col-3 zd-sec-td zd-pop-td"><text>{{ele.pc}}</text></view>
<view class="zd-col-3 zd-sec-td zd-pop-td"><text>{{ele.warehouseName}}</text></view>
<view class="zd-col-3 zd-sec-td zd-pop-td"><text>{{ele.locationName}}</text></view>
<view class="zd-col-3 zd-sec-td zd-pop-td"><text>{{ele.trackno}}</text></view>
</view>
</view>
<view class="mgb20 zd-row jcenter">
<view class="zd-col-10 zd-row">
<button class="confirm-button confirm-button_cancle mgl0" @tap="show = false">取消</button>
<button class="confirm-button mgl0" @tap="modalConfirm">确定</button>
</view>
</view>
</view>
<view v-if="show" class="modal" @click.stop="show = false"></view>
<uni-calendar ref="calendar" :insert="false" :date="date" @confirm="calendarConfirm" />
</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, getOrganizationInfo, allocationPage, allocationBillPage, allocationBillUpdate, allocationBillConfirm, allocationBillInventoryInfo} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox,
ScanInput,
Pagination,
GridDetail
},
data() {
return {
val1: '',
dataList1: [],
totalCount1: 0,
queryParams1:{
pageSize: 10,
pageNum: 1
},
currentPage1: 1,
pkId: '',
pkObj: {},
dataList2: [],
totalCount2: 0,
queryParams2:{
pageSize: 200,
pageNum: 1
},
currentPage2: 1,
checkArr: [],
checkArrActive: false,
delShow: false,
detailObj: {},
value: '',
range: [],
date: '',
show: false,
modalObj: {},
disabled: false,
value1: '',
value2: '',
range1: [],
dataList3: [],
iid: '',
iobj: {},
fstate: false
};
},
onLoad () {
this._getWarehouseInfo()
this._getOrganizationInfo()
},
methods: {
// 仓库下拉框
async _getWarehouseInfo () {
let res = await getWarehouseInfo()
if (res.code === 1) {
this.range = [...res.result]
this.range.map(e => {
this.$set(e, 'text', e.ckmc)
this.$set(e, 'value', e.ckbm)
})
this.toSearch()
}
},
// 组织信息下拉框
async _getOrganizationInfo () {
let res = await getOrganizationInfo()
if (res.code === 1) {
this.range1 = [...res.result]
this.range1.map(e => {
this.$set(e, 'text', e.kczzmc)
this.$set(e, 'value', e.kczzbm)
})
this.toSearch()
}
},
// 查询一级表格
toSearch () {
this.queryParams1 = {
pageSize: 10,
pageNum: 1
}
this.currentPage1 = 1
this.dataList2 = []
this.pkId = ''
this._allocationPage()
},
// 一级表格接口
async _allocationPage () {
let res = await allocationPage(this.val1, this.value1, this.value2, this.queryParams1.pageNum + '', this.queryParams1.pageSize + '')
if (res.code === 1) {
this.dataList1 = [...res.result]
this.totalCount1 = Number(res.totalElements)
this.queryParams1.pageSize = Number(res.pageSize)
this.queryParams1.pageNum = Number(res.pageNum)
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
},
// 二级表格接口
async _allocationBillPage () {
let res = await allocationBillPage(this.pkObj.djid, this.queryParams2.pageNum + '', this.queryParams2.pageSize + '')
if (res.code === 1) {
res.result.map(el => {
this.$set(el, 'checked', true)
})
this.dataList2 = [...res.result]
this.checkArr = [...this.dataList2]
this.checkArrActive = true
this.totalCount2 = Number(res.totalElements)
this.queryParams2.pageSize = Number(res.pageSize)
this.queryParams2.pageNum = Number(res.pageNum)
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
},
// 一级表格切换分页
handlePageChange1(page) {
this.queryParams1.pageNum = page
this.currentPage1 = page
this.dataList2 = []
this.pkId = ''
this._allocationPage()
},
// 二级表格切换分页
handlePageChange2(page) {
this.queryParams2.pageNum = page
this.currentPage2 = page
this._allocationBillPage()
},
// 点击一级表格一行加载二级表格
toCollapse (e) {
this.pkId = this.pkId === e.djid ? '' : e.djid
this.pkObj = this.pkId === e.djid ? e : {}
this.dataList2 = []
if (this.pkId === e.djid) {
this.queryParams2 = {
pageSize: 200,
pageNum: 1
}
this.currentPage2 = 1
this._allocationBillPage()
}
},
// 二级表格多选
toCheck2 (e) {
e.checked = !e.checked
this.checkArr = this.dataList2.filter(el => el.checked === true)
if (this.checkArr.length === this.dataList2.length) {
this.checkArrActive = true
}
},
// 二级表格全选
selectAll () {
this.checkArrActive = !this.checkArrActive
this.dataList2.map(el => {
el.checked = this.checkArrActive
})
this.checkArr = this.dataList2.filter(el => el.checked === true)
},
// 二级表格详情修改接口
async _allocationBillUpdate (e) {
console.log(e)
try {
let res = await allocationBillUpdate(e)
uni.showToast({
title: res.desc,
icon: 'none'
})
} catch (e) {
console.log(e)
}
},
// 根据跟踪号查询库存列表
async _allocationBillInventoryInfo (obj) {
let res = await allocationBillInventoryInfo(obj)
if (res.code === 1) {
this.dataList3 = [...res.result]
}
},
// 跟踪号查询库存列表选中一行
toCheck3 (e) {
this.iid = e.id === this.iid ? '' : e.id
this.iobj = e.id === this.iid ? e : {}
},
// 修改调出仓库弹窗
checkWarehouse (type, title, e) {
this.modalObj = {type: type, title: title, id: e.flid}
if (type === 1) {
this.value = e.dcckbm
} else if (type === 2) {
this.value = e.drckbm
} else if (type === 5) {
let {gzh, dckcbm, dcckbm, dckwbm, pc, wlbm} = {...e}
let obj = {gzh, dckcbm, dcckbm, dckwbm, pc, wlbm}
this._allocationBillInventoryInfo(obj)
}
this.show = true
},
// 修改调出仓库确定和修改跟踪号
modalConfirm () {
let mc = ''
this.range.map(el => {
if (el.value === this.value) {
mc = el.text
}
})
let obj = {}
if (this.modalObj.type === 1) {
this.dataList2.map(e => {
if (e.flid === this.modalObj.id) {
e.dcckbm = this.value
e.dcckmc = mc
obj = e
}
})
} else if (this.modalObj.type === 2) {
this.dataList2.map(e => {
if (e.flid === this.modalObj.id) {
e.drckbm = this.value
e.drckmc = mc
obj = e
}
})
} else if (this.modalObj.type === 5) {
this.dataList2.map(e => {
if (e.flid === this.modalObj.id) {
e.gzh = this.iobj.trackno
obj = e
}
})
}
this.show = false
this._allocationBillUpdate(obj)
},
// 修改日期
openCalendar (type, e) {
this.modalObj = {type: type, id: e.flid}
this.$refs.calendar.open()
if (type === 1) {
this.date = e.jhdrrq
} else if (type === 2) {
this.date = e.jhdcrq
}
},
calendarConfirm (e) {
let obj = {}
if (this.modalObj.type === 1) {
this.dataList2.map(el => {
if (el.flid === this.modalObj.id) {
el.jhdrrq = e.fulldate
obj = el
}
})
} else if (this.modalObj.type === 2) {
this.dataList2.map(el => {
if (el.flid === this.modalObj.id) {
el.jhdcrq = e.fulldate
obj = el
}
})
}
this._allocationBillUpdate(obj)
},
// 点击直接调拨按钮
async _allocationBillConfirm () {
this.disabled = true
if (!this.checkArr.length) {
this.disabled = false
return
}
try {
let arr = []
this.checkArr.map(el => {
let {djid, djbh, ywrq, btbz, flxh, flid, jldw, sl, dcckbm, dckwbm, drckbm, drkwbm, jhdrrq, jhdcrq, flbz} = {...el}
let obj = {djid, djbh, ywrq, btbz, flxh, flid, jldw, sl, dcckbm, dckwbm, drckbm, drkwbm, jhdrrq, jhdcrq, flbz}
arr.push(obj)
})
let res = await allocationBillConfirm(arr)
if (res.code === 1) {
this.queryParams2 = {
pageSize: 200,
pageNum: 1
}
this.currentPage2 = 1
this._allocationBillPage()
uni.showToast({
title: res.desc,
icon: 'none'
})
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
this.disabled = false
} catch (e) {
this.disabled = false
}
},
// 详情弹窗
getDetails (type,e) {
this.delShow = !this.delShow
this.detailObj = {type: type, data:e}
}
}
}
</script>
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.mgr30
margin-right 30rpx
.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
color #fff
/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;
</style>