<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="HCode" @confirm="getBillList" /></view>
|
</view>
|
<view class="search-condition">
|
<view class="title"><text>名称: </text></view>
|
<view class="right"><input type="text" v-model="HName" @confirm="getBillList" /></view>
|
</view>
|
<view class="buttons">
|
<button size="mini" type="primary" @click="search">查询</button>
|
<view style="flex: 1;"></view>
|
<button size="mini" type="primary" @click="exit">退出</button>
|
</view>
|
<scroll-view id="#BillListPanel" scroll-y="true" style="height: 55vh;">
|
<view class="card-item" v-show="HBillList.length != 0">
|
<uni-card
|
v-for="(bill, index) in HBillList[curPage-1]" :key="index" @tap="clickCard(bill, index)">
|
<view class="card-detail" v-for="(HBillField, index) in emptyValueFilter(bill,HBillFieldsList).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 emptyValueFilter(bill,HBillFieldsList).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 dayjs from 'dayjs';
|
import {
|
CommonUtils
|
} from '@/utils/common';
|
import {
|
getUserInfo
|
} from '@/utils/auth';
|
export default {
|
name: "BadReasonPopup",
|
emits: ["update:modelValue"],
|
data() {
|
return {
|
showDetail: -1,
|
operations: -1,
|
dayjs: dayjs,
|
enablefocus: false,
|
size: 20,
|
curPage: 1,
|
length: 0,
|
page: 0,
|
HName: '',
|
HCode: '',
|
HBillList: [], // 表单数据集合
|
HBillFieldsList: [], // 表单字段集合
|
panelHeight: 0,
|
|
refTargetKey: 0,
|
multiSouceBillList: [],
|
|
};
|
},
|
props: {
|
HStockOrgID: {
|
type: [String, Number],
|
},
|
HMaterID:
|
{
|
type: [String, Number],
|
},
|
HBillType:{
|
type: [String, Number],
|
},
|
},
|
mounted() {},
|
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.HMater = ''
|
this.HCustom = ''
|
this.HBillList = []
|
this.enablefocus = false
|
this.multiSouceBillList = []
|
// 需要等待页面内的数据赋值完毕
|
await this.$nextTick()
|
this.$refs.popup.close();
|
},
|
search() {
|
this.getBillList()
|
},
|
showPopup(index) {
|
this.$refs.popup.open();
|
this.refTargetKey = index
|
},
|
clickCard(bill, index) {
|
let retVal = {}
|
retVal[0] = bill
|
this.$emit("update", {
|
retVal: retVal,
|
index: this.refTargetKey
|
})
|
},
|
getsWhere() {
|
let sWhere =
|
` and a.HStopFlag =0 and ISNULL(a.HCheckEmp,'')!='' and a.HUSEORGID = '${ uni.getStorageSync("OrganizationID")}'`
|
// ` and 禁用标记 !='Y' and ISNULL(审核人,'')!='' and a.HUSEORGID = '${ uni.getStorageSync("OrganizationID")}'`
|
|
|
if (this.HCode) {
|
// swhere += ` and 不良原因代码 like '%${this.HCode}%'`
|
swhere += ` and a.HNumber like '%${this.HCode}%'`
|
}
|
if (this.HName) {
|
// swhere += ` and 不良原因名称 like '%${this.HName}%'`
|
swhere += ` and a.HName like '%${this.HName}%'`
|
}
|
|
console.log("sWhere",sWhere)
|
return sWhere
|
},
|
getBillList() {
|
this.HBillList = []
|
this.length = 0
|
this.page = 0
|
this.curPage = 1
|
CommonUtils.doRequest(
|
"/Gy_BadReason/list_1", {
|
sWhere: this.getsWhere(),
|
user: getUserInfo()['Czymc'],
|
HMaterID:this.HMaterID,
|
HBillType:this.HBillType,
|
OrgID:uni.getStorageSync("OrganizationID")
|
},
|
(res) => {
|
let {
|
data,
|
count,
|
list,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.length = Array.from(data).length
|
const result = [];
|
for (let i = 0; i < data.length; i += this.size) {
|
result.push(data.slice(i, i + this.size));
|
}
|
this.HBillList = result
|
// 过滤不需要显示的字段
|
this.HBillFieldsList = Array.from(list)
|
.filter(e => this.shouldShowField(e.ColmCols) == true)
|
this.page = result.length
|
setTimeout(() => {
|
this.enablefocus = true
|
}, 500)
|
} else {
|
setTimeout(() => {
|
this.enablefocus = true
|
}, 500)
|
uni.showToast({
|
icon: 'none',
|
title: Message
|
})
|
}
|
}
|
)
|
},
|
// 判断哪些字段需要显示
|
shouldShowField(key) {
|
// 排除不需要显示的字段
|
const excludeKeys = ['单据号', '日期']; // 这些字段已经在其他地方显示了
|
|
// 判断key是否全英文(不包含中文)
|
const isAllEnglish = /^[a-zA-Z]+$/.test(key);
|
|
// 判断key是否包含"ID"(不区分大小写)
|
const containsID = key.toUpperCase().includes('ID');
|
|
return !excludeKeys.includes(key) &&
|
!isAllEnglish && // 排除全英文的key
|
!containsID // 排除包含ID的key
|
},
|
emptyValueFilter(item, fieldList){
|
return fieldList.filter(e => item[e.ColmCols])
|
}
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.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-s: center;
|
gap: 20rpx;
|
font-size: 30rpx;
|
|
.title {
|
width: 5rem;
|
text-align: right;
|
}
|
|
.right {
|
flex: 1;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
height: auto;
|
padding: 8rpx 16rpx;
|
|
input {
|
width: 100%;
|
font-size: 30rpx;
|
}
|
}
|
}
|
|
.buttons {
|
display: flex;
|
flex-direction: row;
|
gap: 20rpx;
|
justify-content: flex-end;
|
|
>button {
|
display: inline-flex;
|
width: 4rem;
|
}
|
}
|
|
.card-item {
|
.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);
|
}
|
|
.daterange {
|
display: flex;
|
flex-direction: row;
|
gap: 10rpx;
|
justify-content: center;
|
align-items: center;
|
|
}
|
}
|
|
.more {
|
color: #888;
|
font-size: 24rpx;
|
display: flex;
|
border-top: 1px solid #eee;
|
padding-top: 20rpx;
|
|
.part {
|
width: 50%;
|
text-align: center;
|
}
|
}
|
</style>
|