<template>
|
<view class="page" id="pageContent">
|
<view class="search-condition-zone">
|
<view class="form-item">
|
<view class="left">
|
日期:
|
</view>
|
<view class="daterange" style="flex: 1;">
|
<view class="right general">
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="hform.HBeginDate">
|
<view>{{hform.HBeginDate}}</view>
|
</uni-datetime-picker>
|
</view>
|
<view>—</view>
|
<view class="right general">
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="hform.HEndDate">
|
<view>{{hform.HEndDate}}</view>
|
</uni-datetime-picker>
|
</view>
|
</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="addNew">新增</button>
|
<button type="default" class="btn-d" size="mini" @tap="exit">退出</button>
|
</view>
|
<view class="info-list-zone" id="scroll-content" :style="{height: scrollContentHeight + 'px'}">
|
<view class="card-item" v-for="(item, index) in listDataShow" :key="index">
|
<uni-card :title="item['单据号'] " :extra="'日期:' + formatDate(item['日期'])"
|
@tap="showDetail = showDetail==index?-1:index">
|
<view class="card-detail">
|
<view class="detail" v-if="item['组织名称']">
|
<text>组织名称:</text>{{item['组织名称']}}
|
</view>
|
</view>
|
<view class="card-detail" v-if="showDetail == index">
|
<view class="detail" v-if="item['处理结论']">
|
<text>处理结论:</text>{{item['处理结论']}}
|
</view>
|
<view class="detail" v-if="item['表头备注']">
|
<text>表头备注:</text>{{item['表头备注']}}
|
</view>
|
<view class="detail" v-if="item['源单号']">
|
<text>源单号:</text>{{item['源单号']}}
|
</view>
|
<view class="detail" v-if="item['发送人']">
|
<text>发送人:</text>{{item['发送人']}}
|
</view>
|
<view class="detail" v-if="item['接受人']">
|
<text>接收入:</text>{{item['接受人']}}
|
</view>
|
<view class="detail" v-if="item['抄送']">
|
<text>抄送:</text>{{item['抄送']}}
|
</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="edit(item)">编辑</button>
|
<button class="op3" size="mini" plain @tap.stop="audit(item, 0)" v-if="!item['审核人']">审核</button>
|
<button class="op3" size="mini" plain @tap.stop="audit(item, 1)" v-if="item['审核人']">反审核</button>
|
<button class="op4" size="mini" plain @tap.stop="del(item)">删除</button>
|
<button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
|
</view>
|
</uni-card>
|
</view>
|
<view class="over" v-if="listDataShow.length == 0">暂无数据</view>
|
</view>
|
|
<view class="pagination-zone" id="pagination-zone">
|
<uni-pagination show-icon :page-size="paginationMeta.pageSize" :total="paginationMeta.total"
|
:current="paginationMeta.current" @change="onPaginationChangeHandler"></uni-pagination>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
CommonUtils
|
} from '@/utils/common'
|
import {
|
getUserInfo
|
} from '@/utils/auth'
|
import dayjs from 'dayjs'
|
|
export default {
|
data() {
|
return {
|
navHeight: 0,
|
scrollTop: 0,
|
showDetail: -1,
|
operations: -1,
|
|
hform: {
|
HBeginDate: dayjs().subtract(30, 'd').format('YYYY-MM-DD'),
|
HEndDate: dayjs().format('YYYY-MM-DD')
|
},
|
|
paginationMeta: {
|
current: 1,
|
total: 0,
|
pageSize: 30,
|
},
|
|
pageMeta: {
|
scrollContentTop: 0,
|
bottomBtnTop: 0,
|
},
|
|
listData: [],
|
listDataShow: [],
|
|
// 不需要显示的字段
|
titleData: ["sorderid", "HInterID", "HEntryID", "HDeptID", "HCenterWorkID", "HProcID",
|
"HEnvironmentItemID", "HEmpID", "HEnvironmentTestSchemeID", "单据类型"]
|
}
|
},
|
computed: {
|
scrollContentHeight: {
|
get() {
|
return this.pageMeta.bottomBtnTop - this.pageMeta.scrollContentTop
|
}
|
}
|
},
|
methods: {
|
// 格式化日期
|
formatDate(dateStr) {
|
if (!dateStr) return '';
|
return dateStr.split('T')[0];
|
},
|
|
exit() {
|
uni.navigateBack()
|
},
|
|
async cmdSearch() {
|
let sWhere = ''
|
if (this.hform.HBeginDate && this.hform.HEndDate) {
|
sWhere += " and 日期 between '" + this.hform.HBeginDate + "' and '" + this.hform.HEndDate + "' ";
|
}
|
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: '/Sc_ProcessMangement/Get_QC_NoPassProdConclusionBillList',
|
data: {
|
"sWhere": sWhere,
|
"user": getUserInfo()["Czymc"],
|
},
|
})
|
|
if (!res) {
|
return
|
}
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
|
if (count > 0) {
|
this.listData = data
|
this.paginationMeta.total = data.length
|
this.onPaginationChangeHandler({
|
current: 1
|
})
|
} else {
|
uni.showToast({
|
icon: 'none',
|
title: Message || '暂无数据'
|
})
|
}
|
} catch (err) {
|
console.warn(err);
|
uni.showToast({
|
title: '接口请求失败:' + err.message,
|
icon: 'none'
|
})
|
}
|
},
|
|
// 重置查询条件
|
addNew() {
|
|
uni.showLoading({
|
title: '加载中...',
|
mask: true
|
});
|
|
// 延迟一点再跳转,让用户能看到加载提示
|
setTimeout(() => {
|
uni.redirectTo({
|
url: "/pages/ZLGL/QCNoPassProdConclusionBillMain/QCNoPassProdConclusionBillMain?operationType=1",
|
complete: () => {
|
uni.hideLoading();
|
}
|
});
|
}, 300);
|
},
|
|
async onPaginationChangeHandler({current}) {
|
this.listDataShow = this.listData.slice(
|
(current - 1) * this.paginationMeta.pageSize,
|
current * this.paginationMeta.pageSize
|
)
|
this.paginationMeta.current = current;
|
},
|
|
async audit(item, mode) {
|
console.log('审核单据: ', item);
|
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
method: 'GET',
|
url: '/Sc_ProcessMangement/AuditQC_NoPassProdConclusionBill',
|
data: {
|
HInterID: item["hmainid"],
|
IsAudit: mode,
|
CurUserName: getUserInfo()["Czymc"]
|
}
|
})
|
|
if(!res) {
|
return
|
}
|
|
let {count, data, Message} = res.data
|
|
if(count == 1) {
|
CommonUtils.showTips({
|
message: `${item["审核人"]?'反审核':'审核'}成功`
|
})
|
this.$forceUpdate()
|
setTimeout(() => {
|
this.cmdSearch()
|
}, 2000)
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `单据${item["审核人"]?'反审核':'审核'}失败: ${Message}`
|
})
|
}
|
} catch(err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `单据${item["审核人"]?'反审核':'审核'}错误: ${err.message}`
|
})
|
}
|
},
|
|
async del(item) {
|
console.log("delItem: ", item);
|
|
uni.showModal({
|
title: '提示',
|
content: '确认要删除记录?删除后不能恢复',
|
success: async (res) => {
|
if (res.confirm) {
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: '/Sc_ProcessMangement/DeleteQC_NoPassProdConclusionBill',
|
data: {
|
"HInterID": item.hmainid,
|
"user": getUserInfo()["Czymc"]
|
}
|
})
|
|
if (!res) {
|
return
|
}
|
|
let {
|
count,
|
code,
|
Message
|
} = res.data
|
|
if (count == 1) {
|
uni.showToast({
|
title: '删除成功',
|
icon: 'success'
|
})
|
this.cmdSearch()
|
} else {
|
uni.showModal({
|
title: '错误提示',
|
content: `删除错误: ${Message}`,
|
showCancel: false
|
})
|
}
|
} catch (err) {
|
uni.showModal({
|
title: '错误提示',
|
content: `接口请求失败: ${err.message}`,
|
showCancel: false
|
})
|
}
|
}
|
},
|
})
|
},
|
|
edit(item) {
|
console.log("editItem:", item)
|
uni.navigateTo({
|
url: `/pages/ZLGL/QCNoPassProdConclusionBillMain/QCNoPassProdConclusionBillMain?operationType=3&HInterID=${item.hmainid}`,
|
})
|
}
|
},
|
onShow() {
|
this.$nextTick(() => {
|
this.cmdSearch()
|
})
|
},
|
onReady() {
|
// 计算滚动区域高度
|
// #ifndef MP-WEIXIN
|
let query = uni.createSelectorQuery().in(this)
|
query.select("#scroll-content").boundingClientRect((data) => {
|
this.pageMeta.scrollContentTop = data.top
|
}).exec()
|
query.select("#pagination-zone").boundingClientRect((data) => {
|
this.pageMeta.bottomBtnTop = data.top
|
}).exec()
|
// #endif
|
// #ifdef MP-WEIXIN
|
// 微信不支持 uni.createSelectorQuery().in(this)
|
// #endif
|
}
|
}
|
</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-around;
|
flex-wrap: wrap;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
margin: 0 10rpx;
|
}
|
|
.btn-a {
|
background-color: #3a78ff;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #909399;
|
color: #fff;
|
}
|
|
.btn-d {
|
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 {
|
font-size: 26rpx;
|
margin-bottom: 12rpx;
|
color: #555;
|
margin-right: 20rpx;
|
flex: 1;
|
min-width: 45%;
|
|
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%;
|
}
|
|
.over {
|
text-align: center;
|
color: #999;
|
font-size: 28rpx;
|
padding: 40rpx 0;
|
}
|
}
|
</style>
|