Commit bfa172ae by zhangzhen

功能优化

parent c81c3e13
......@@ -360,6 +360,17 @@
}
},
{
"path" : "pages/picking/selectInvent",
"style" :
{
"navigationBarTitleText" : "请选择存货",
"navigationBarBackgroundColor": "#0072fc",
"navigationBarTextStyle": "white",
"navigationStyle": "custom",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/picking/selectProject",
"style" :
{
......
......@@ -69,14 +69,11 @@
<text class="text-xl text-red">*</text>
<text>存货名称:</text>
</view>
<view class="text-blue">
<picker @change="onInventRecordChange($event,k)" :value="item.inventRecordIndex" :range="inventRecordList"
range-key="label">
<view class="text-blue" @tap="onInventChange(k)">
<view class="uni-input form-item-label">
<text class="text-blue">{{item.inventRecordIndex>=0 ? inventRecordList[item.inventRecordIndex].label:'请选择存货名称'}}</text>
<text class="text-blue">{{item.inventText || '请选择存货名称'}}</text>
<text class="cuIcon-right text-blue"></text>
</view>
</picker>
</view>
</view>
<view class="cu-form-group">
......@@ -232,8 +229,8 @@
inventRecordIndex:-1,
inventRecordList:[],
inventTypeBoxList:[],
inventTypeBoxEnum:{}
inventTypeBoxEnum:{},
subList:[]
};
},
onLoad(option) {
......@@ -263,11 +260,39 @@
inventRecordIndex:-1
})
},
onInventRecordChange(e,i){
let index = Number(e.target.value);
if (this.formList[i].inventRecordIndex === index) return
this.formList[i].inventRecordIndex = index;
let list = this.inventRecordList[index];
onInventChange(k){
uni.navigateTo({
url:"/pages/picking/selectInvent",
events:{
acceptDataFromInventPage: (data) => {
if(data.data){
this.onInventRecordChange(data.data,data.index)
}
}
},
success: (res) => {
let filterList = []
if(this.subList && this.subList.length){
filterList = this.subList.map(item => item.inventCode)
}
if(this.formList.length){
let l= this.formList.filter(item => item.inventCode).map(item => item.inventCode);
filterList.push(...l)
}
res.eventChannel.emit('sendDataToInventPage', {
index:k,
inventCode: this.formList[k].inventCode || '',
whCode:this.orderInfo.whCode,
companyCode:this.orderInfo.companyCode,
filterList
})
}
})
},
onInventRecordChange(list,i){
if (this.formList[i].inventRecordIndex === list.value) return
this.formList[i].inventType = list.param1Field;
this.formList[i].inventRecordId = list.param2Field;
this.formList[i].invSpec = list.param3Field;
......@@ -282,12 +307,13 @@
this.formList[i].inventCode =list.value
this.formList[i].price = 0
this.formList[i].amount = 0
this.formList[i].inventText = list.label
this.$forceUpdate();
},
onSubmit() {
let len = this.formList.filter(item => item.inventRecordIndex === -1)
if(len.length){
let len = this.formList.filter(item => item.inventCode)
if(!len.length){
uni.showToast({
icon:"none",
title:"请将数据补充完整后提交"
......@@ -413,7 +439,15 @@
if (list && list.length) {
this.orderInfo = list[0];
}
this.onGetInventInfo();
this.onGetSubList();
})
},
onGetSubList() {
getSubList({
receiveId: this.id
}).then(res => {
this.subList = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta.columns);
this.onAddSub();
})
},
onGetInventInfo(){
......
......@@ -107,14 +107,11 @@
<text class="text-xl text-red">*</text>
<text>存货名称:</text>
</view>
<view class="text-blue">
<picker @change="onInventRecordChange($event,k)" :value="item.inventRecordIndex" :range="inventRecordList"
range-key="label">
<view class="text-blue" @tap="onInventChange(k)">
<view class="uni-input form-item-label">
<text class="text-blue">{{item.inventRecordIndex>=0 ? inventRecordList[item.inventRecordIndex].label:'请选择存货名称'}}</text>
<text class="text-blue">{{item.inventText || '请选择存货名称'}}</text>
<text class="cuIcon-right text-blue"></text>
</view>
</picker>
</view>
</view>
<view class="cu-form-group">
......@@ -318,11 +315,29 @@
inventRecordIndex:-1
})
},
onInventRecordChange(e,i){
let index = Number(e.target.value);
if (this.formList[i].inventRecordIndex === index) return
this.formList[i].inventRecordIndex = index;
let list = this.inventRecordList[index];
onInventChange(k){
uni.navigateTo({
url:"/pages/picking/selectInvent",
events:{
acceptDataFromInventPage: (data) => {
if(data.data){
this.onInventRecordChange(data.data,data.index)
}
}
},
success: (res) => {
res.eventChannel.emit('sendDataToInventPage', {
index:k,
inventCode: this.formList[k].inventCode || '',
companyCode: this.factoryList[this.factoryIndex].value,
whCode: this.projectList[this.projectIndex].value,
filterList: this.formList.length? this.formList.filter(item => item.inventCode).map(item => item.inventCode):[]
})
}
})
},
onInventRecordChange(list,i){
if (this.formList[i].inventCode === list.value) return
this.formList[i].inventType = list.param1Field;
this.formList[i].inventRecordId = list.param2Field;
this.formList[i].invSpec = list.param3Field;
......@@ -337,8 +352,8 @@
this.formList[i].inventCode =list.value
this.formList[i].price = 0
this.formList[i].amount = 0
this.formList[i].inventText = list.label
this.$forceUpdate();
},
onSubmit() {
if(this.confirmBtn) return;
......@@ -371,7 +386,7 @@
})
return
}
let len = this.formList.filter(item=> item.inventRecordIndex>=0)
let len = this.formList.filter(item=> item.inventCode)
if(!len.length){
uni.showToast({
icon: "none",
......@@ -482,7 +497,7 @@
}
if(this.projectIndex>=0){
this.projectIndex= -1;
this.onGetInventInfo();
// this.onGetInventInfo();
}
},
// onListChange(e){
......@@ -495,7 +510,6 @@
url:"/pages/picking/selectUser",
events:{
acceptDataFromOpenedPage: (data) => {
console.log(data,"收到的数据")
if(data){
this.userIndex = this.userList.findIndex(item => item.value === data.data);
}
......@@ -522,7 +536,6 @@
url:"/pages/picking/selectProject",
events:{
acceptDataFromProject: (data) => {
console.log(data,"收到的数据")
if(data){
this.index = this.list.findIndex(item => item.value === data.data);
}
......@@ -530,8 +543,8 @@
},
success: (res) => {
let sendData = { companyCode: this.factoryList[this.factoryIndex].value}
if(this.projectIndex>=0){
sendData.projectCode = this.list[this.projectIndex].value
if(this.index>=0){
sendData.projectCode = this.list[this.index].value
}
res.eventChannel.emit('sendDataFromProject',sendData)
}
......@@ -542,7 +555,7 @@
let index = Number(e.target.value);
if (this.projectIndex === index) return
this.projectIndex = index;
this.onGetInventInfo();
// this.onGetInventInfo();
if(this.formList.length){
this.formList = [];
this.onAddSub()
......@@ -603,7 +616,6 @@
},
onGetPickingUsers(){
getPickingUsers().then(res => {
console.log(res,9999999)
if(res.data.__sys__.status === 0){
this.userList = toJsonData(res.data.__blocks__.user_block_id.rows, res.data.__blocks__
.user_block_id.meta.columns).map(item => {
......
<template>
<view>
<cu-custom bgColor="bg-blue" :isBack="true">
<block slot="backText">
<view class="list-icon" @tap="onBack">
<text class="cuIcon-back text-white text-bold text-xl"></text>
</view>
</block>
<block slot="content">
<text class="text-white">选择存货</text>
</block>
<block slot="right">
<view class="right-box" @tap="onSelected">
<text class="text-white">确定</text>
</view>
</block>
</cu-custom>
<view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}">
</view>
<view class="flex-col">
<view class="flex-1 margin">
<u--input placeholder="请输入存货名称" v-model="queryData.text" suffixIcon="search"
suffixIconStyle="color: #909399" :customStyle="{padding:'3px 6px'}" :fontSize="13"
confirmType="search" @input="onInput"></u--input>
</view>
<view v-if="list && list.length" class="uni-list">
<radio-group class="radio-group" @change="onRadioChange">
<label class="flex-between item" v-for="(item, index) in list" :key="index">
<view>
<text>{{item.label}}(剩余:{{item.param7Field}})</text>
</view>
<view>
<radio style="transform: scale(0.8);" :value="item.value" :checked="index === current" />
</view>
</label>
</radio-group>
</view>
<view v-if="list.length <= 0" class="empty-box">
<u-empty text="暂无数据" textColor='#C1C1C1' width="120"></u-empty>
</view>
</view>
</view>
</template>
<script>
import {
toJsonData
} from "@/utils/tools.js";
import {
getInventInfo
} from "@/api/picking.js";
export default {
data() {
return {
statusBarHeight: uni.getStorageSync("statusHeight") || 0,
list: [],
current: -1,
queryData:{
companyCode:'',
whCode:'',
text:''
},
selectedValue:""
};
},
onLoad() {
this.eventChannel = this.getOpenerEventChannel();
this.eventChannel.on('sendDataToInventPage', (data) => {
console.log(data,99999)
if(data){
this.queryData = data;
}
if(data && data.inventCode){
this.selectedValue = data.inventCode
}
})
this.onGetInventInfo();
},
methods: {
onRadioChange(e){
this.selectedValue = e.target.value
},
onSelected() {
if(!this.selectedValue){
uni.showToast({
icon:"none",
title:"请先选择存货"
})
return
}
let obj = this.list.find(item => item.value === this.selectedValue)
this.eventChannel.emit('acceptDataFromInventPage', {data:obj,index:this.queryData.index});
this.onBack();
},
onBack() {
uni.navigateBack()
},
onInput(){
this.selectedValue = ''
this.current = -1;
this.onGetInventInfo();
},
onGetInventInfo(){
getInventInfo({
companyCode: this.queryData.companyCode,
whCode: this.queryData.whCode,
inventName: this.queryData.text
}).then(res => {
let list = toJsonData(res.data.__blocks__.invent_code_box_block_id.rows, res.data
.__blocks__.invent_code_box_block_id.meta.columns).filter(item=> Number(item.param7Field))
if(this.queryData.filterList && this.queryData.filterList.length){
list = list.filter(item => !this.queryData.filterList.includes(item.valueField))
}
if(list && list.length){
this.list = list.map(item => {
let spec = item.param3Field;
if(!spec.trim()){
spec = `${Number(item.param4Field)}*${Number(item.param5Field)}*${Number(item.param6Field)}`
}
return {
...item,
label: `${item.textField}_${spec}` ,
value: item.valueField,
name: item.textField
}
});
if(this.selectedValue){
this.current = this.list.findIndex(item => item.value === this.selectedValue);
}
}else{
this.list = []
}
})
}
}
}
</script>
<style>
page {
background-color: #ffffff;
}
</style>
<style lang="scss" scoped>
.right-box{
padding: 0 24upx;
}
.uni-list{
display: flex;
justify-content: center;
width: 100%;
box-shadow: 0 0 10upx rgba(0, 0, 0, 0.23);
padding: 12upx 0;
.radio-group{
width: 100%;
.item{
align-items: center;
width: 100%;
padding: 12upx 5%;
border-bottom: 1px solid #e5e5e5;
}
.item:last-child{
border-bottom: none;
}
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment