<template>
|
<view class="page" id="pageContent">
|
<view class="search-condition-zone">
|
<view class="form-item">
|
<view class="left">模具分类</view>
|
<!-- <uni-data-select
|
v-model="hform.HMouldTypeID"
|
:localdata="HMouldTypeList"
|
@change=""
|
:clear="false"
|
></uni-data-select> -->
|
<zxz-uni-data-select
|
v-model="hform.HMouldTypeID"
|
dataKey="器具分类名称"
|
dataValue="HItemID"
|
:filterable="true"
|
:localdata="HMouldTypeList"
|
:clear="false"
|
></zxz-uni-data-select>
|
</view>
|
<view class="form-item">
|
<view class="left">
|
器具编号:
|
</view>
|
<view class="right general">
|
<input type="text" v-model="hform.HMouldNumber" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">
|
器具名称:
|
</view>
|
<view class="right general">
|
<input type="text" v-model="hform.HMouldName" />
|
</view>
|
</view>
|
</view>
|
<view class="button-zone">
|
<button type="default" class="btn-a" size="mini" @tap="cmdSearch">查询</button>
|
<button type="default" class="btn-c" size="mini" @tap="exit">退出</button>
|
</view>
|
|
<view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
|
|
<view class="card-item" v-for="(item, index) in showList" :key="index">
|
<uni-card :title="item['单据号']" :extra="'日期:' + item['日期'].split('T')[0]"
|
@tap="showDetail = showDetail==index?-1:index">
|
<view class="card-detail">
|
<!-- 动态生成所有非空字段 -->
|
<view
|
class="detail"
|
v-for="(value, key,keyIndex) in item"
|
:key="key"
|
v-if="keyIndex<=10 && shouldShowField(key, value)"
|
>
|
<text>{{ formatFieldName(key) }}:</text>{{ value }}
|
</view>
|
</view>
|
<view class="card-detail" v-if="showDetail == index">
|
<view
|
class="detail"
|
v-for="(value, key,keyIndex) in item"
|
:key="key"
|
v-if="keyIndex>=15 && shouldShowField(key, value)"
|
>
|
<text>{{ formatFieldName(key) }}:</text>{{ value }}
|
</view>
|
|
</view>
|
<view class="more" v-if="showDetail == index && operations != index">
|
<view class="part" style="border-right: 1px solid #eee;">
|
<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;">
|
<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>
|
<view class="op" v-if="operations == index">
|
<button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
|
</view>
|
</uni-card>
|
</view>
|
<view class="over" v-if="listData.length == 0">暂无数据</view>
|
<view class="over" v-if="listData.length != 0 && listData.length != showList.length">加载中...</view>
|
<view class="over" v-if="listData.length != 0 && listData.length == showList.length">已到底</view>
|
|
|
</view>
|
</template>
|
|
<script>
|
import {
|
CommonUtils
|
} from '@/utils/common'
|
import {
|
getUserInfo
|
} from '@/utils/auth'
|
import dayjs, {
|
Dayjs
|
} from 'dayjs'
|
export default {
|
data() {
|
return {
|
showDetail: -1,
|
operations : -1,
|
HMouldTypeList: [
|
{ HItemID: 0, 器具分类名称: "全部" },
|
],
|
hform: {
|
HMouldTypeID:0,
|
HMouldNumber: '',
|
HMouldName:''
|
},
|
sWhere: '',
|
listData: [],
|
showList: [],
|
page: 1,
|
|
}
|
},
|
onReachBottom: function() {
|
this.page++
|
setTimeout(() => {
|
this.showList = this.showList.concat(this.getPage(this.page, this.listData))
|
}, 100)
|
},
|
onPullDownRefresh: function() {
|
this.cmdSearch()
|
setTimeout(() => {
|
uni.stopPullDownRefresh();
|
}, 1000);
|
},
|
computed: {
|
|
},
|
methods: {
|
// 判断哪些字段需要显示
|
shouldShowField(key, value) {
|
// 排除不需要显示的字段
|
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
|
// value !== null &&
|
value !== undefined
|
// &&
|
// value !== '';
|
},
|
|
// 格式化字段名显示
|
formatFieldName(key) {
|
// 你可以根据需求自定义显示名称
|
const nameMap = {
|
'物料代码': '物料代码',
|
'物料名称': '物料名称',
|
'规格型号': '规格型号',
|
// ... 其他字段映射
|
};
|
return nameMap[key] || key;
|
},
|
|
exit() {
|
uni.navigateBack()
|
},
|
getPage(page, list) {
|
let sindex = (parseInt(page) - 1) * 20
|
let eindex = parseInt(page) * 20
|
let newList = list.slice(sindex, eindex)
|
return newList
|
},
|
async cmdSearch() {
|
let sWhere = ' '
|
|
if (this.hform.HMouldName != "") {
|
sWhere += " and 模具名称 like '%" + this.hform.HMouldName + "%'"
|
}
|
if (this.hform.HMouldNumber != "") {
|
sWhere += " and 模具编号 like '%" + this.hform.HMouldNumber + "%'"
|
}
|
if (this.hform.HMouldTypeID != "0") {
|
sWhere += " and HMouldTypeID = '" + this.hform.HMouldTypeID + "'"
|
}
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: '/Gy_Mould/list1',
|
data: {
|
"sWhere": sWhere,
|
"ModRightNameSelect":"Gy_MouldFileList",
|
"user": getUserInfo()["Czymc"]
|
},
|
})
|
if (!res) {
|
return
|
}
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count > 0) {
|
this.listData = res.data.data
|
this.showList = this.getPage(this.page, this.listData)
|
|
} else {
|
uni.showToast({
|
icon: 'none',
|
title: Message
|
})
|
}
|
} catch (err) {
|
console.warn(err);
|
uni.showToast({
|
title: '接口请求失败:' + err,
|
icon: 'none'
|
})
|
}
|
},
|
//模具档案分类获取接口
|
async mouldTypeSearch() {
|
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: '/Gy_ModelType/list',
|
data: {
|
"sWhere": '',
|
"ModRightNameSelect":"Gy_MouldTypeList",
|
"user": getUserInfo()["Czymc"]
|
},
|
})
|
if (!res) {
|
return
|
}
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count > 0) {
|
console.log(res.data.data)
|
this.HMouldTypeList.push(...res.data.data)
|
|
} else {
|
uni.showToast({
|
icon: 'none',
|
title: Message
|
})
|
}
|
} catch (err) {
|
console.warn(err);
|
uni.showToast({
|
title: '接口请求失败:' + err,
|
icon: 'none'
|
})
|
}
|
},
|
|
},
|
async onShow() {
|
await this.mouldTypeSearch();
|
this.$nextTick(() => {
|
this.cmdSearch()
|
})
|
},
|
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.page {
|
box-sizing: border-box;
|
display: flex;
|
flex-direction: column;
|
gap: 20rpx;
|
padding: 20rpx 0;
|
position: relative;
|
|
.button-zone {
|
height: auto;
|
box-sizing: border-box;
|
padding-top: 20rpx;
|
display: flex;
|
flex-direction: row;
|
justify-content: space-between;
|
flex-wrap: wrap;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
|
.btn-a {
|
background-color: #3a78ff;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #ff5722;
|
color: #fff;
|
}
|
}
|
|
.search-condition-zone {
|
height: auto;
|
box-sizing: border-box;
|
padding: 0 60rpx;
|
display: flex;
|
flex-direction: column;
|
gap: 20rpx;
|
|
.form-item {
|
display: flex;
|
flex-direction: row;
|
gap: 20rpx;
|
align-items: center;
|
font-size: 28rpx;
|
|
.left {
|
width: 4rem;
|
}
|
|
.right {
|
flex: 1;
|
padding: 8rpx 16rpx;
|
|
.search {
|
width: 28rpx;
|
height: 28rpx;
|
}
|
|
input {
|
font-size: 28rpx;
|
}
|
|
.uni-combox {
|
padding: 0;
|
margin: 0;
|
|
::v-deep .uni-combox__input {
|
font-size: 28rpx;
|
height: auto;
|
}
|
}
|
}
|
|
.general {
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
}
|
|
.disabled {
|
border-radius: 22rpx;
|
border: 1px solid #e4e4e4;
|
background-color: #e4e4e4;
|
}
|
}
|
}
|
|
.info-list-zone {
|
overflow-y: auto;
|
|
.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;
|
}
|
}
|
}
|
}
|
}
|
|
.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;
|
}
|
}
|
|
.op {
|
display: flex;
|
justify-content: space-between;
|
gap: 20rpx;
|
margin-top: 20rpx;
|
flex-wrap: wrap;
|
align-content: flex-start;
|
button {
|
margin: 0;
|
flex-shrink: 0;
|
padding: 0;
|
width: 150rpx;
|
flex-basis: 150rpx;
|
font-size: 25rpx;
|
}
|
|
.op1 {
|
border: 1px solid #41a863;
|
color: #41a863;
|
}
|
|
.op2 {
|
border: 1px solid #d98d00;
|
color: #d98d00;
|
}
|
|
.op3 {
|
border: 1px solid #3a78ff;
|
color: #3a78ff;
|
}
|
|
.op4 {
|
border: 1px solid #da0000;
|
color: #da0000;
|
}
|
|
.op5 {
|
border: 1px solid #888;
|
color: #888;
|
}
|
}
|
|
.pagination-zone {
|
position: fixed;
|
bottom: 0;
|
box-sizing: border-box;
|
background-color: #fff;
|
box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
|
padding: 20rpx 40rpx 20rpx 40rpx;
|
display: flex;
|
flex-direction: column;
|
gap: 20rpx;
|
justify-content: space-between;
|
width: 100%;
|
}
|
}
|
</style>
|