<template>
|
<view class="page" id="pageContent">
|
<view class="search-condition-zone">
|
<view class="form-item">
|
<view class="left">源单类型</view>
|
|
<uni-combox :candidates="arrayHSourceBillTypeName" placeholder="请选择源单类型" v-model="hform.HSourceBillTypeName"
|
@input="HSourceBillTypeNameChange"></uni-combox>
|
</view>
|
<view class="form-item">
|
<view class="left">
|
单据号:
|
</view>
|
<view class="right general">
|
<input type="text" v-model="hform.HBillNo" />
|
</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="op3" size="mini" plain @tap.stop="audit(item, 1)">反审核</button>
|
<button class="op3" size="mini" plain @tap.stop="Reject(item)">驳回</button>
|
<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,
|
hform: {
|
HSourceBillType:'8505',
|
HSourceBillTypeName: "首件检验单",
|
HBillNo: ''
|
},
|
sWhere: '',
|
listData: [],
|
showList: [],
|
page: 1,
|
HSourceBillTypeList: {首件检验单:'8505',末件检验单:'8507'},
|
arrayHSourceBillTypeName: [
|
"首件检验单",
|
"末件检验单",
|
],
|
}
|
},
|
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;
|
},
|
HSourceBillTypeNameChange(e) {
|
console.log(e);
|
this.hform.HSourceBillType = this.HSourceBillTypeList[this.hform.HSourceBillTypeName];
|
console.log(this.hform.HSourceBillType);
|
this.cmdSearch();
|
},
|
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.HBillNo != "") {
|
sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'"
|
}
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: '/LEMS/CheckFlowList',
|
data: {
|
"sWhere": sWhere,
|
"billType":this.hform.HSourceBillType,
|
"type":3,
|
"userid": getUserInfo()["Czybm"]
|
},
|
})
|
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 audit(item, mode) {
|
console.log('审核单据: ',item);
|
let url = '';
|
let ajaxData = '';
|
if(this.hform.HSourceBillType=='8505'){
|
url = 'QC_FirstPieceCheckBill/AuditFlow',
|
ajaxData= {
|
HInterID: item["hmainid"],
|
IsAudit: mode,
|
CurUserName: getUserInfo()["Czymc"],
|
CurUserID:getUserInfo()["Czybm"],
|
}
|
}else if(this.hform.HSourceBillType=='8507'){
|
url = 'QC_ProcessCheckBill/AuditFlow',
|
ajaxData= {
|
HInterID: item["hmainid"],
|
IsAudit: mode,
|
CurUserName: getUserInfo()["Czymc"],
|
CurUserID:getUserInfo()["Czybm"],
|
}
|
}
|
try{
|
let res = await CommonUtils.doRequest2Sync({
|
method: 'GET',
|
url: url,
|
data: ajaxData
|
})
|
|
if(!res) {
|
return
|
}
|
|
let {count, data, Message} = res.data
|
|
if(count == 1) {
|
CommonUtils.showTips({
|
message: `审核成功`
|
})
|
this.$forceUpdate()
|
setTimeout(() => {
|
this.cmdSearch()
|
}, 2000)
|
}else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `审核失败: ${Message}`
|
})
|
}
|
}catch(err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `单据审核出现错误: ${err}`
|
})
|
}
|
},
|
async Reject(item) {
|
console.log("delItem: ", item);
|
let url = '';
|
let ajaxData = '';
|
if(this.hform.HSourceBillType=='8505'){
|
url = 'QC_FirstPieceCheckBill/RejectCheckFlow',
|
ajaxData= {
|
HInterID: item["hmainid"],
|
CurUserID:getUserInfo()["Czybm"],
|
}
|
}else if(this.hform.HSourceBillType=='8507'){
|
url = 'QC_ProcessCheckBill/RejectCheckFlow',
|
ajaxData= {
|
HInterID: item["hmainid"],
|
CurUserID:getUserInfo()["Czybm"],
|
}
|
}
|
uni.showModal({
|
title: '提示',
|
content: '确认要驳回记录?',
|
success: async (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定');
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: url,
|
data: ajaxData
|
})
|
|
if (!res) {
|
return
|
}
|
|
let {
|
count,
|
code,
|
Message
|
} = res.data
|
if (count == 0) {
|
return uni.showModal({
|
title: '错误提示',
|
content: `驳回错误: ${Message}`,
|
showCancel: false
|
})
|
}
|
uni.showToast({
|
title: '驳回成功',
|
icon: 'none'
|
})
|
this.cmdSearch()
|
} catch (err) {
|
uni.showModal({
|
title: '错误提示',
|
content: `接口请求失败: ${err}`,
|
showCancel: false
|
})
|
}
|
}
|
},
|
})
|
|
},
|
|
},
|
onShow() {
|
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>
|