Commit d7a9e3e3 by zhangzhen

功能优化

parent 8705034b
......@@ -349,6 +349,28 @@
}
},
{
"path" : "pages/picking/selectUser",
"style" :
{
"navigationBarTitleText" : "请选择领料人",
"navigationBarBackgroundColor": "#0072fc",
"navigationBarTextStyle": "white",
"navigationStyle": "custom",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/picking/selectProject",
"style" :
{
"navigationBarTitleText" : "请选择项目",
"navigationBarBackgroundColor": "#0072fc",
"navigationBarTextStyle": "white",
"navigationStyle": "custom",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/picking/add-sub",
"style" :
{
......
......@@ -42,13 +42,11 @@
<text>项目名称:</text>
</view>
<view class="text-blue">
<picker @change="onListChange" :value="index" :range="list" range-key="label">
<view class="uni-input">
<view class="uni-input" @tap="onListChange">
<text
class="text-blue">{{ index>=0 && list.length ? list[index].label:'请选择项目'}}</text>
<text class="cuIcon-right"></text>
</view>
</picker>
</view>
</view>
</view>
<view class="cu-form-group">
......@@ -85,13 +83,11 @@
<text>领料人:</text>
</view>
<view class="text-blue">
<picker @change="onUserChange" :value="index" :range="userList" range-key="label">
<view class="uni-input">
<text
class="text-blue">{{ userIndex>=0 && userList.length ? userList[userIndex].label:'请选择领料人'}}</text>
<text class="cuIcon-right"></text>
</view>
</picker>
<view class="uni-input" @tap="onUserChange">
<text
class="text-blue">{{ userIndex>=0 && userList.length ? userList[userIndex].label:'请选择领料人'}}</text>
<text class="cuIcon-right"></text>
</view>
</view>
</view>
......@@ -489,16 +485,59 @@
this.onGetInventInfo();
}
},
onListChange(e){
let index = Number(e.target.value);
if (this.index === index) return
this.index = index;
},
// onListChange(e){
// let index = Number(e.target.value);
// if (this.index === index) return
// this.index = index;
// },
onUserChange(e){
let index = Number(e.target.value);
if (this.userIndex === index) return
this.userIndex = index;
uni.navigateTo({
url:"/pages/picking/selectUser",
events:{
acceptDataFromOpenedPage: (data) => {
console.log(data,"收到的数据")
if(data){
this.userIndex = this.userList.findIndex(item => item.value === data.data);
}
}
},
success: (res) => {
if(this.userIndex>=0){
res.eventChannel.emit('acceptDataFromOpenerPage', { data: this.userList[this.userIndex].value})
}
}
})
},
onListChange(e){
if(this.factoryIndex <0){
uni.showToast({
icon:"none",
title:"请先选择公司"
})
return
}
uni.navigateTo({
url:"/pages/picking/selectProject",
events:{
acceptDataFromProject: (data) => {
console.log(data,"收到的数据")
if(data){
this.index = this.list.findIndex(item => item.value === data.data);
}
}
},
success: (res) => {
let sendData = { companyCode: this.factoryList[this.factoryIndex].value}
if(this.projectIndex>=0){
sendData.projectCode = this.list[this.projectIndex].value
}
res.eventChannel.emit('sendDataFromProject',sendData)
}
})
},
onProjectChange(e) {
let index = Number(e.target.value);
if (this.projectIndex === index) return
......
<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.projName" 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="item.value">
<view>
<text>{{item.label}}</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 {
getProjComboBox
} from "@/api/picking.js";
export default {
data() {
return {
statusBarHeight: uni.getStorageSync("statusHeight") || 0,
list: [],
current: -1,
queryData:{
companyCode:'',
projName:''
},
projectCode:''
};
},
onLoad() {
this.eventChannel = this.getOpenerEventChannel();
this.eventChannel.on('sendDataFromProject', (data) => {
console.log(data, 9999)
if(data){
this.queryData.companyCode = data.companyCode;
}
if(data && data.projectCode){
this.selectedValue = data.projectCode
}
})
this.onGetProjComboBox();
},
methods: {
onRadioChange(e){
console.log(e.target.value,9999)
this.selectedValue = e.target.value
},
onSelected() {
if(!this.selectedValue){
uni.showToast({
icon:"none",
title:"请先选择项目"
})
return
}
this.eventChannel.emit('acceptDataFromProject', {data:this.selectedValue});
this.onBack();
},
onBack() {
uni.navigateBack()
},
onInput(){
this.selectedValue = ''
this.current = -1;
this.onGetProjComboBox();
},
onGetProjComboBox() {
getProjComboBox({
...this.queryData,
approvalStatus: 2
}).then(res => {
this.list = toJsonData(res.data.__blocks__.projRecordByRole_block_id.rows, res.data.__blocks__
.projRecordByRole_block_id.meta.columns).map(item => {
return {
label: item.textField,
value: item.valueField
}
});
if(this.selectedValue){
this.current = this.list.findIndex(item => item.value === this.selectedValue);
}
})
},
}
}
</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
<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.receiveUserName" suffixIcon="search"
suffixIconStyle="color: #909399" :customStyle="{padding:'3px 6px'}" :fontSize="13"
confirmType="search" @input="onInput"></u--input>
</view>
<view v-if="userList && userList.length" class="uni-list">
<radio-group class="radio-group" @change="onRadioChange">
<label class="flex-between item" v-for="(item, index) in userList" :key="item.value">
<view>
<text>{{item.label}}</text>
</view>
<view>
<radio style="transform: scale(0.8);" :value="item.value" :checked="index === userIndex" />
</view>
</label>
</radio-group>
</view>
<view v-if="userList.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 {
getPickingUsers
} from "@/api/picking.js";
export default {
data() {
return {
statusBarHeight: uni.getStorageSync("statusHeight") || 0,
userList: [],
userIndex: -1,
queryData:{
receiveUserName:''
},
selectedValue:''
};
},
onLoad() {
this.eventChannel = this.getOpenerEventChannel();
this.eventChannel.on('acceptDataFromOpenerPage', (data) => {
console.log(data, 9999)
if(data){
this.selectedValue = data.data
}
})
this.onGetPickingUsers();
},
methods: {
onRadioChange(e){
console.log(e.target.value,9999)
this.selectedValue = e.target.value
},
onSelected() {
if(!this.selectedValue){
uni.showToast({
icon:"none",
title:"请先选择领料人"
})
return
}
this.eventChannel.emit('acceptDataFromOpenedPage', {data:this.selectedValue});
this.onBack();
},
onBack() {
uni.navigateBack()
},
onInput(){
this.selectedValue = '';
this.userIndex = -1;
this.onGetPickingUsers();
},
onGetPickingUsers() {
getPickingUsers(this.queryData).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 => {
return {
label: item.textField,
value: item.valueField
}
});
if(this.selectedValue){
this.userIndex = this.userList.findIndex(item => item.value === this.selectedValue);
}
}
})
}
}
}
</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
<template>
<view class="web-page">
<web-view v-if="urlStr" :src="urlStr"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
urlStr:''
}
},
onLoad(option) {
if(option && option.url){
this.urlStr = option.url;
}
if(option && option.title){
uni.setNavigationBarTitle({
title:option.title
})
}
},
methods: {
}
}
</script>
<style>
.web-page{
width: 100vw;
}
</style>
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