<template>
|
<view class="content">
|
<view class="form">
|
<view class="form-item">
|
<view class="title">开始时间:</view>
|
<view class="right">
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="hform.HBeginDate">
|
<input :value="hform.HBeginDate" />
|
</uni-datetime-picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">结束时间:</view>
|
<view class="right">
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="hform.HEndDate">
|
<input :value="hform.HEndDate" />
|
</uni-datetime-picker>
|
</view>
|
</view>
|
<view v-if="showmore">
|
<view class="form-item">
|
<view class="title">单据号:</view>
|
<view class="right">
|
<input v-model="hform.HBillNo" placeholder="请输入单据号" />
|
</view>
|
</view>
|
|
</view>
|
<view class="other">
|
<view v-if="!showmore" @tap="changeShowMore">
|
展开其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons>
|
</view>
|
<view v-if="showmore" @tap="changeShowMore">
|
折叠其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="top"></uni-icons>
|
</view>
|
</view>
|
|
<view class="buttons">
|
<button class="btn-a" size="mini" type="default" @tap="clear">重置</button>
|
<button class="btn-b" size="mini" type="default" @tap="add">新增</button>
|
<button class="btn-c" size="mini" type="default" @tap="search">查询</button>
|
</view>
|
</view>
|
|
<view id="divide" style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
|
<view :style="{
|
height: calcContentHeight + 'px',
|
overflowY: 'auto'
|
}">
|
<view class="list" v-for="(item,index) in showList" :key="index" v-if="tabs==0">
|
<uni-card :title="item.制单日期.substr(0,10)" :extra="item.单据号" style="margin: 10px;"
|
@tap="showDetail = showDetail==index?-1:index">
|
<view class="card-detail">
|
<template
|
v-for="(HBillField, index) in CommonUtils.emptyValueFilter(item,HFieldList).slice(0,10)">
|
<view class="detail" v-if="HBillField.ColmType == 'DateTime'">
|
<text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] ? dayjs(item[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }}
|
</view>
|
<view class="detail" v-else>
|
<text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] }}
|
</view>
|
</template>
|
</view>
|
<view class="card-detail" v-if="showDetail == index">
|
<view class="card-detail">
|
<template
|
v-for="(HBillField, index) in CommonUtils.emptyValueFilter(item,HFieldList).slice(10,-1)">
|
<view class="detail" v-if="HBillField.ColmType == 'DateTime'">
|
<text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] ? dayjs(item[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }}
|
</view>
|
<view class="detail" v-else>
|
<text>{{ HBillField.ColmCols }}:</text>{{ item[HBillField.ColmCols] }}</view>
|
</template>
|
|
</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="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>
|
<view class="pagination-zone" id="pagination-zone">
|
<uni-pagination show-icon :page-size="size" :total="dataLength" :current="page"
|
@change="onPaginationChangeHandler"></uni-pagination>
|
</view>
|
<BarCodePopupVue ref="barcodePopup"></BarCodePopupVue>
|
</view>
|
</template>
|
|
<script>
|
import {
|
getUserInfo
|
} from "@/utils/auth.js";
|
import BarCodePopupVue from "@/components/BarCodePopup/BarCodePopup.vue";
|
import {
|
CommonUtils
|
} from "@/utils/common";
|
import dayjs from "dayjs";
|
export default {
|
data() {
|
return {
|
dayjs,
|
CommonUtils,
|
userInfo: getUserInfo(),
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
tabs: 0,
|
urls: '/Web/GetEquipmentBillsList',
|
MvarReportTitle: '设备故障登记单缓存',
|
hform: {
|
HBillNo: '',
|
HSourceBillNo: '',
|
HBillType: '',
|
user: uni.getStorageSync('HUserName'),
|
HStockOrgID: uni.getStorageSync('OrganizationID'),
|
Type: "GZ",
|
sWhere: "",
|
HBeginDate: dayjs(new Date()).subtract(30, 'day').format("YYYY-MM-DD"),
|
HEndDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
},
|
sWhere: '',
|
listData: [],
|
showList: [],
|
HFieldList: [],
|
showDetail: -1,
|
operations: -1,
|
|
page: 1,
|
size: 20,
|
dataLength: 0,
|
divideBottom: 0,
|
paginationTop: 0,
|
showmore: false,
|
}
|
},
|
computed: {
|
calcContentHeight: {
|
get() {
|
return this.paginationTop - this.divideBottom
|
}
|
}
|
},
|
onShow() {
|
//用户模块权限判断
|
// this.CheckModRight()
|
this.changeTab(0)
|
console.log(this.userInfo, uni.getStorageSync('HUserName'))
|
},
|
components: {
|
BarCodePopupVue
|
},
|
onPullDownRefresh: function() {
|
this.clear()
|
setTimeout(() => {
|
uni.stopPullDownRefresh();
|
}, 1000);
|
},
|
onReady() {
|
this.getCalcHeight()
|
},
|
methods: {
|
changeShowMore() {
|
this.showmore = !this.showmore
|
this.$nextTick(() => {
|
// 重新计算内容视口高度
|
this.getCalcHeight()
|
})
|
},
|
getCalcHeight() {
|
let query = uni.createSelectorQuery().in(this)
|
query
|
.select("#divide")
|
.boundingClientRect()
|
.select("#pagination-zone")
|
.boundingClientRect()
|
.exec(res => {
|
this.divideBottom = Math.ceil(res[0].bottom)
|
this.paginationTop = Math.floor(res[1].top)
|
})
|
},
|
async qrCodeDisplay(item) {
|
this.$refs.barcodePopup.setCodeInfo(item.HBillNo)
|
await this.$nextTick()
|
this.$refs.barcodePopup.open()
|
},
|
CheckModRight() {
|
uni.request({
|
url: this.serverUrl + '/WEBSController/CheckModRight_Json',
|
data: {
|
ModRightName: 'CE_OtherOut',
|
HUserName: uni.getStorageSync('HUserName')
|
},
|
success: (res) => {
|
if (res.data.count == 1) {} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
onPaginationChangeHandler({
|
current
|
}) {
|
this.page = current
|
this.showList = this.getPage(current, this.size, this.listData)
|
},
|
getPage(page, size, list) {
|
let sindex = (parseInt(page) - 1) * size
|
let eindex = parseInt(page) * size
|
let newList = list.slice(sindex, eindex)
|
return newList
|
},
|
changeTab(e) {
|
this.tabs = e
|
this.page = 1
|
this.showList = []
|
|
if (this.tabs == 0) {
|
this.urls = '/Web/GetEquipmentBillsList'
|
}
|
// if (this.tabs == 1) {
|
// this.urls = '/WEBSController/GetKf_ICStockBillQueryList_User_Json'
|
// }
|
this.search()
|
},
|
async getList() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: this.urls,
|
data: this.hform
|
})
|
|
let {
|
count,
|
data,
|
Message,
|
list
|
} = res.data
|
|
if (count == 1) {
|
if (data == null) {
|
data = []
|
}
|
this.listData = data
|
this.showList = this.getPage(this.page, this.size, data)
|
this.dataLength = data.length
|
this.HFieldList = CommonUtils.fieldListFilterRole({
|
ExcludeKeys: ["制单日期", "单据号"],
|
FieldList: Array.from(list)
|
}).data
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `获取设备故障登记单失败: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `获取设备故障登记单失败: ${err}`
|
})
|
}
|
|
},
|
search() {
|
this.hform.sWhere = ''
|
this.listData = []
|
this.page = 1
|
this.showList = []
|
|
if (this.hform.HBillNo) {
|
this.hform.sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'";
|
}
|
if (this.hform.HBeginDate && this.hform.HEndDate) {
|
this.hform.sWhere +=
|
` and convert(date,日期) between convert(date, '${this.hform.HBeginDate}') and convert(date, '${this.hform.HEndDate}')`;
|
}
|
this.getList()
|
},
|
clear() {
|
this.listData = []
|
this.page = 1
|
this.showList = []
|
|
this.sWhere = ''
|
this.hform = {
|
HBillNo: '',
|
HSourceBillNo: '',
|
HBillType: '',
|
user: uni.getStorageSync('HUserName'),
|
HStockOrgID: uni.getStorageSync('OrganizationID'),
|
Type: "GZ",
|
sWhere: "",
|
HBeginDate: dayjs(new Date()).subtract(30, 'day').format("YYYY-MM-DD"),
|
HEndDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
}
|
this.search()
|
},
|
add() {
|
uni.navigateTo({
|
url: '/pages/MJGL/Sb_EquipConkBook/Sb_EquipConkBookBill?operationType=1'
|
})
|
},
|
//编辑
|
edit(item) {
|
return
|
console.log(item)
|
uni.request({
|
url: this.serverUrl + '/WEBSController/TempList_Modify_Json',
|
data: {
|
"HInterID": item.HInterID,
|
"HBillNo": item.单据号,
|
"HBillType": this.hform.HBillType
|
},
|
success: (res) => {
|
console.log(1, res);
|
if (res.data.count == 1) {
|
uni.navigateTo({
|
url: './OtherOutBill?OperationType=2&HInterID=' + item.HInterID
|
})
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.hideLoading()
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
})
|
},
|
//删除
|
del(item) {
|
// console.log(item.hmainid,uni.getStorageSync('HUserName'))
|
uni.showModal({
|
title: '提示',
|
content: '确认要删除记录?删除后不能恢复',
|
success: (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定');
|
uni.request({
|
url: this.serverUrl +
|
'/Sb_EqpRepairWorkBill/DeltetEqpConkBookBill',
|
data: {
|
HInterID: item.hmainid,
|
user: uni.getStorageSync('HUserName'),
|
},
|
success: (res) => {
|
console.log(1, res);
|
if (res.data.count == 1) {
|
this.clear()
|
}
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.hideLoading()
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
} else if (res.cancel) {
|
console.log('用户点击取消');
|
}
|
}
|
});
|
},
|
//撤销
|
revoke(item) {
|
// console.log(item.hmainid,uni.getStorageSync('HUserName'))
|
uni.showModal({
|
title: '提示',
|
content: '是否确认撤销',
|
success: (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定');
|
uni.request({
|
url: this.serverUrl +
|
'/WEBSController/set_DeleteICStockBillAndWMS_Json',
|
data: {
|
HInterID: item.HInterID,
|
HBillNo: item.单据号,
|
HBillType: this.hform.HBillType,
|
HMaker: uni.getStorageSync('HUserName'),
|
MvarReportTitle: this.MvarReportTitle,
|
},
|
success: (res) => {
|
console.log(1, res);
|
if (res.data.count == 1) {
|
this.clear()
|
}
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.hideLoading()
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
} else if (res.cancel) {
|
console.log('用户点击取消');
|
}
|
}
|
});
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import "@/pages/MJGL/style/MJListStyle.scss"
|
</style>
|