<template>
|
<view>
|
<uni-popup ref="popup" type="bottom" @change="popupChangeHandler">
|
<view class="content">
|
<!-- <view class="search-condition">
|
<view class="title"><text>源单单号: </text></view>
|
<view class="right"><input type="text" v-model="HSourceBillNo" @confirm="getBillList" /></view>
|
</view> -->
|
<view class="search-condition">
|
<view class="title"><text>模具: </text></view>
|
<view class="right"><input type="text" :focus="enablefocus" v-model="HMould"
|
@confirm="getBillList" /></view>
|
</view>
|
<!-- <view class="search-condition">
|
<view class="title"><text>关联项: </text></view>
|
<view class="right"><input type="text" v-model="HCustom" @confirm="getBillList" /></view>
|
</view> -->
|
<view class="buttons">
|
<view style="flex: 1;"></view>
|
<button size="mini" type="primary" @click="search">搜索</button>
|
<button v-if="MultiSourceBill" size="mini" type="primary" @click="ret">返回</button>
|
<button size="mini" type="primary" @click="exit">退出</button>
|
</view>
|
<scroll-view id="#BillListPanel" scroll-y="true" style="height: 55vh;">
|
<view class="options-wrapper" v-show="HBillList.length != 0">
|
<uni-card
|
v-for="(bill, index) in HBillList" :key="index" :title="bill['模具名称']" @tap="clickCard(bill, index)">
|
<view class="card-detail" v-for="(HBillField, index) in CommonUtils.emptyValueFilter(bill,HFieldList).slice(0,10)" :key="index">
|
<template v-if="HBillField.ColmType == 'DateTime'"><text>{{ HBillField.ColmCols }}:</text>{{ bill[HBillField.ColmCols] ? dayjs(bill[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }} </template>
|
<template v-else><text>{{ HBillField.ColmCols }}:</text>{{ bill[HBillField.ColmCols] }}</template>
|
</view>
|
<view class="card-detail" v-if="showDetail == index">
|
<view class="card-detail" v-for="(HBillField, index) in CommonUtils.emptyValueFilter(bill,HFieldList).slice(10,-1)" :key="index">
|
<template v-if="HBillField.ColmType == 'DateTime'"><text>{{ HBillField.ColmCols }}:</text>{{ bill[HBillField.ColmCols] ? dayjs(bill[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }} </template>
|
<template v-else><text>{{ HBillField.ColmCols }}:</text>{{ bill[HBillField.ColmCols] }}</template>
|
</view>
|
</view>
|
<view class="more" v-if="showDetail == index && operations != index">
|
<view class="part" style="border-right: 1px solid #eee;" @tap.stop="showDetail = -1">
|
<uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14" ></uni-icons>收起
|
</view>
|
<!-- <view class="part" @tap.stop="operations = operations==index?-1:index">
|
<uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
|
size="14"></uni-icons>操作
|
</view> -->
|
</view>
|
<view class="more" v-if="showDetail != index && operations != index">
|
<view class="part" style="border-right: 1px solid #eee;" @tap.stop="showDetail = index">
|
<uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
|
</view>
|
<!-- <view class="part" @tap.stop="operations = operations==index?-1:index">
|
<uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
|
size="14"></uni-icons>操作
|
</view> -->
|
</view>
|
</uni-card>
|
</view>
|
<view class="over" v-show="HBillList.length == 0">暂无数据</view>
|
</scroll-view>
|
<uni-pagination id="#pagination" title="标题文字" v-model="curPage" :pageSize="size"
|
:total="length"></uni-pagination>
|
</view>
|
|
</uni-popup>
|
</view>
|
</template>
|
|
<script>
|
import { getUserInfo } from '../../utils/auth';
|
import {
|
CommonUtils
|
} from '../../utils/common';
|
import dayjs from 'dayjs';
|
export default {
|
name: "BillListPopup",
|
data() {
|
return {
|
showDetail: -1,
|
operations: -1,
|
CommonUtils,
|
dayjs,
|
enablefocus: false,
|
size: 20,
|
curPage: 1,
|
length: 0,
|
page: 0,
|
HSourceBillNo: '',
|
HMould: '',
|
HCustom: '',
|
HBillList: [],
|
HFieldList: [], // 表单对应字段
|
panelHeight: 0,
|
|
multiSouceBillList: []
|
};
|
},
|
props: {
|
MultiSourceBill: {
|
type: Boolean,
|
default: false,
|
required: false
|
},
|
},
|
model: {
|
prop: "HSourceBill",
|
event: 'change'
|
},
|
methods: {
|
popupChangeHandler(e) {
|
if (e.show === true) {
|
this.getBillList()
|
}
|
},
|
async exit() {
|
this.size = 20
|
this.curPage = 1
|
this.length = 0
|
this.page = 0
|
this.HSourceBillNo = ''
|
this.HMould = ''
|
this.HCustom = ''
|
this.HBillList = []
|
this.HFieldList = []
|
this.enablefocus = false
|
this.multiSouceBillList = []
|
// 需要等待页面内的数据赋值完毕
|
await this.$nextTick()
|
this.$refs.popup.close();
|
},
|
search() {
|
this.getBillList()
|
},
|
ret() {
|
console.log('this.MultiSourceBill: ', this.MultiSourceBill);
|
uni.$emit('BillSelectComplete', {
|
HInterID: 0,
|
HBillNo: 0,
|
enableMultiSourceBill: this.MultiSourceBill,
|
MultiSourceBillList: this.multiSouceBillList
|
})
|
},
|
showPopup() {
|
this.$refs.popup.open();
|
},
|
clickCard(val, index) {
|
if (this.MultiSourceBill == false) { // 非多源单模式
|
// 父子组件之间传递数据
|
this.$emit("BillSelectComplete", {
|
val: [val],
|
enableMultiSourceBill: this.MultiSourceBill,
|
})
|
} else {
|
this.$set(this.HBillList[this.curPage - 1][index], 'isActive', !this.HBillList[this.curPage - 1][
|
index
|
]['isActive'])
|
console.log(this.HBillList[this.curPage - 1][index])
|
// 设置了多源单模式
|
this.setMultiSourceBillList({
|
HInterID: interid,
|
HBillNo: billno,
|
HIsActive: this.HBillList[this.curPage - 1][index]['isActive']
|
})
|
}
|
|
// this.exit()
|
},
|
setMultiSourceBillList(billInfo) {
|
let index = this.multiSouceBillList.findIndex(item => item.HInterID == billInfo.HInterID)
|
if (index == -1) {
|
billInfo['count'] = 1
|
this.multiSouceBillList.push(billInfo)
|
} else {
|
if (billInfo.HIsActive) {
|
// 如果对应单据传入的是否激活数是true,则计数器+1
|
this.multiSouceBillList[index]['count']++;
|
} else {
|
// 如果对应单据传入的是否激活数是false,则计数器-1
|
this.multiSouceBillList[index]['count']--;
|
}
|
if (this.multiSouceBillList[index]['count'] == 0) {
|
// 没有选中的单据,则移除缓存中的数据
|
this.multiSouceBillList.splice(index, 1)
|
}
|
}
|
console.log('this.multiSouceBillList: ', this.multiSouceBillList);
|
},
|
getBillList() {
|
this.HBillList = []
|
this.length = 0
|
this.page = 0
|
this.curPage = 1
|
|
CommonUtils.doRequest(
|
"/Gy_Mould/page", {
|
sWhere: `
|
and HUSEORGID = ${uni.getStorageSync('OrganizationID')}
|
and (isnull(模具编号,'') like '%${this.HMould}%' or isnull(模具名称,'') like '%${this.HMould}%')
|
and 条码编号 != ''
|
`,
|
ModRightNameSelect: 'Gy_MouldFileList',
|
user: getUserInfo()['Czymc'],
|
page: this.curPage,
|
size: this.size
|
},
|
(res) => {
|
let {
|
data,
|
count,
|
Message,
|
list
|
} = res.data
|
if (count > 0) {
|
this.length = count
|
const result = [];
|
|
let fieldList = CommonUtils.fieldListFilterRole({
|
ExcludeKeys: ['模具名称'],
|
FieldList: list
|
})
|
|
if (fieldList.status == false) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取表单结构失败: ${fieldList.Message}`
|
})
|
}
|
|
this.HFieldList = fieldList.data
|
|
// for (let i = 0; i < data.length; i += this.size) {
|
// result.push(data.slice(i, i + this.size));
|
// }
|
this.HBillList = data
|
console.log("HBillList", this.HBillList)
|
this.page = count
|
setTimeout(() => {
|
this.enablefocus = true
|
}, 500)
|
} else {
|
setTimeout(() => {
|
this.enablefocus = true
|
}, 500)
|
uni.showToast({
|
icon: 'none',
|
title: Message
|
})
|
}
|
}
|
)
|
},
|
},
|
}
|
</script>
|
|
<style lang="scss">
|
.content {
|
box-sizing: border-box;
|
border-radius: 15rpx 15rpx 0 0;
|
padding: 20rpx 20rpx 40rpx 20rpx;
|
background-color: #fff;
|
display: flex;
|
flex-direction: column;
|
gap: 10rpx;
|
|
.search-condition {
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
gap: 20rpx;
|
|
.title {
|
width: 5rem;
|
text-align: right;
|
}
|
|
.right {
|
flex: 1;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
height: auto;
|
|
input {
|
width: 100%;
|
padding: 8rpx 20rpx;
|
font-size: 24rpx;
|
}
|
}
|
}
|
|
.buttons {
|
display: flex;
|
flex-direction: row;
|
gap: 20rpx;
|
justify-content: flex-end;
|
|
>button {
|
display: inline-flex;
|
width: 4rem;
|
}
|
}
|
|
.options-wrapper {
|
padding: 20rpx;
|
display: grid;
|
grid-template-columns: repeat(1, 1fr);
|
gap: 20rpx;
|
|
>view {
|
margin: 0 !important;
|
box-sizing: border-box;
|
|
}
|
|
.item {
|
.left {
|
display: inline-block;
|
width: 6rem;
|
}
|
|
.right {
|
display: inline-block;
|
}
|
}
|
|
.card-detail {
|
width: 100%;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
line-height: 120%;
|
|
.detail {
|
// width: 50%;
|
font-size: 26rpx;
|
margin-bottom: 12rpx;
|
color: #555;
|
margin-right: 20rpx;
|
|
text {
|
color: #999;
|
font-size: 26rpx;
|
}
|
}
|
}
|
}
|
|
.uni-card--is-active {
|
background-color: rgba(0, 122, 255, 0.2);
|
}
|
}
|
|
.more {
|
color: #888;
|
font-size: 24rpx;
|
display: flex;
|
border-top: 1px solid #eee;
|
padding-top: 20rpx;
|
|
.part {
|
width: 50%;
|
text-align: center;
|
}
|
}
|
</style>
|