<template>
|
<view>
|
<!-- 部门筛选 -->
|
<view class="form">
|
<view class="form-item">
|
<view class="title">{{$t("Gy.HDept_Search")}}:</view>
|
<view class="right" @click="showPicker">
|
<input type="text" :value="condition.HDeptName" />
|
</view>
|
</view>
|
</view>
|
<!-- 查询条件 -->
|
<view class="form">
|
<view class="form-item">
|
<view class="title">{{$t("Gy.BeginDate_Search")}}:</view>
|
<view class="right">
|
<uni-datetime-picker v-model="condition.HBeginDate" type="date" placeholder="请选择日期"
|
start="2020-01-01" :end="HDateMiddle">
|
<input type="text" :value="condition.HBeginDate" />
|
</uni-datetime-picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{$t("Gy.EndDate_Search")}}:</view>
|
<view class="right">
|
<uni-datetime-picker v-model="condition.HEndDate" type="date" placeholder="请选择日期"
|
:start="HDateMiddle" end="2099-12-31">
|
<input type="text" :value="condition.HEndDate" />
|
</uni-datetime-picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{$t("Gy.EquipNumber_Search")}}:</view>
|
<view class="right">
|
<input type="text" :value="condition.HNumber" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">{{$t("Gy.EquipName_Search")}}:</view>
|
<view class="right">
|
<input type="text" :value="condition.HName" />
|
</view>
|
</view>
|
<view class="search-buttons">
|
<button class="btn-c" size="mini" type="default" @tap="search">查询</button>
|
<button class="btn-a" size="mini" type="default" @tap="clear">重置</button>
|
</view>
|
</view>
|
|
<!-- 显示列表 -->
|
<view class="list" v-for="(item,index) in displayData" :key="index">
|
<uni-card :title="item.设备名称" style="margin: 10px;"
|
>
|
<view class="card-detail">
|
<template v-for="(HBillField, index) in CommonUtils.emptyValueFilter(item,fieldData).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,fieldData).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>
|
<template v-if="displayData.length == 0">
|
<view class="over">暂无数据</view>
|
</template>
|
<template v-else>
|
<view class="over" v-if="!readCompelete">正在获取数据...</view>
|
<view class="over" v-if="readCompelete">没有更多数据...</view>
|
</template>
|
|
<ba-tree-picker ref="treePicker" :multiple='false' @select-change="selectChange" title="选择部门"
|
:localdata="reportTreeList" valueKey="id" textKey="title" childrenKey="children" />
|
</view>
|
</template>
|
|
<script>
|
import {
|
getUserInfo
|
} from '../../../utils/auth';
|
import {
|
CommonUtils
|
} from '../../../utils/common';
|
import baTreePicker from "@/components/ba-tree-picker/ba-tree-picker.vue"
|
import dayjs from 'dayjs';
|
export default {
|
components: {
|
baTreePicker
|
},
|
data() {
|
return {
|
dayjs,
|
CommonUtils,
|
showDetail: -1,
|
operations: -1,
|
|
reportTreeList: [],
|
selectedList: [],
|
displayData: [],
|
fieldData: [],
|
|
readCompelete: false,
|
page: 1,
|
size: 20,
|
|
HDateMiddle: dayjs(new Date()).format("YYYY-MM-DD"),
|
|
|
condition: {
|
HDeptID: 0,
|
HDeptName: "",
|
HBeginDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
HEndDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
HNumber: "",
|
HName: ""
|
}
|
};
|
},
|
methods: {
|
search() {
|
this.page = 1
|
this.getReport()
|
},
|
clear() {
|
|
},
|
showPicker() {
|
this.$refs.treePicker._show();
|
},
|
//监听选择(ids为数组)
|
selectChange(ids, names) {
|
this.condition.HDeptID = ids[0]
|
this.condition.HDeptName = names
|
},
|
async getReport() {
|
try {
|
let sWhere = ""
|
sWhere += this.combineSWhereStr(sWhere)
|
|
let res = await CommonUtils.doRequest2Async({
|
url: "/SB_EquipRunningStatus/Report",
|
data: {
|
sWhere,
|
user: getUserInfo()["Czymc"],
|
page: this.page,
|
size: this.size
|
}
|
})
|
|
let {data, count, Message, list} = res.data
|
|
if(count == 1) {
|
if(data.length == 0) {
|
// 数据已经读完
|
this.page--
|
this.readCompelete = true
|
return
|
}
|
|
this.displayData.push(...data)
|
this.fieldData = CommonUtils.fieldListFilterRole({
|
FieldList: list,
|
ExcludeKeys: ["设备名称"]
|
}).data || []
|
}else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取报表信息失败: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取报表信息失败: ${err}`
|
})
|
}
|
},
|
async GetReportTreeList() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/SB_EquipRunningStatus/ReportTreeGetList",
|
data: {
|
sWhere: "",
|
user: getUserInfo()["Czymc"]
|
}
|
})
|
|
let {
|
data,
|
count,
|
Message
|
} = res.data
|
if (count == 1) {
|
this.reportTreeList = JSON.parse(data)
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取部门信息失败: ${Message}`
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: `获取部门信息失败: ${err}`
|
})
|
}
|
},
|
combineSWhereStr(sWhere) {
|
if (this.condition.HDeptID != 0) {
|
sWhere += ` and HDeptID ='${this.condition.HDeptID}'`
|
}
|
|
if (this.condition.HBeginDate && this.condition.HEndDate) {
|
sWhere +=
|
` and CONVERT(varchar(100),所属日期, 23) >= '${this.condition.HBeginDate}' and CONVERT(varchar(100),所属日期, 23) <= '${this.condition.HEndDate}'`
|
}
|
|
if (this.condition.HNumber) {
|
sWhere += ` and 设备编码 like '%${this.condition.HNumber}'%`
|
}
|
|
if (this.condition.HName) {
|
sWhere += ` and 设备名称 like '%${this.condition.HName}'%`
|
}
|
|
return sWhere
|
}
|
},
|
onLoad() {
|
this.GetReportTreeList()
|
},
|
onReachBottom(){
|
this.page++
|
this.getReport()
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import url("../style/MJListStyle.scss");
|
|
.search-buttons {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
margin-top: 20rpx;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
|
.btn-a {
|
background-color: #acacac;
|
color: #fff;
|
}
|
|
.btn-b {
|
background-color: #41a863;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #3a78ff;
|
color: #fff;
|
}
|
}
|
</style>
|