From 8aa3edd56c279100c9053576f3e90fa55459fe77 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Mon, 16 Jan 2023 16:15:55 +0800
Subject: [PATCH] 修改
---
src/views/parcel/parcel.vue | 296 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 279 insertions(+), 17 deletions(-)
diff --git a/src/views/parcel/parcel.vue b/src/views/parcel/parcel.vue
index 0daf120..6e98766 100644
--- a/src/views/parcel/parcel.vue
+++ b/src/views/parcel/parcel.vue
@@ -8,9 +8,12 @@
:before-open="beforeOpen"
v-model="form"
ref="crud"
+ :row-style="rowStyle"
+ :search.sync="search"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
+ @row-click="rowClick"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@@ -18,19 +21,86 @@
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad">
+
+ <!-- <template slot-scope="{ type, size, row }" slot="menu">
+
+ <el-button
+ v-if="row.imgUrl != null || row.imgUrl != ''"
+ icon="el-icon-view"
+ :size="size"
+ :type="type"
+ @click.stop="handleParcelPic(row)"
+ >查看包裹图片
+ </el-button>
+ </template> -->
+
+ <template slot="menuLeft">
+ <el-button
+ v-bind:class="activeClass == 0 ? 'btn-color' : ''"
+ size="small "
+ @click="getParcelData(0)"
+ >本日
+ </el-button>
+ <el-button
+ v-bind:class="activeClass == 1 ? 'btn-color' : ''"
+ size="small "
+ @click="getParcelData(1)"
+ >本周
+ </el-button>
+ <el-button
+ v-bind:class="activeClass == 2 ? 'btn-color' : ''"
+ size="small "
+ @click="getParcelData(2)"
+ >本月
+ </el-button>
+ </template>
+
+ <template slot="menuLeft">
+ <el-button type="warning"
+ size="small"
+ plain
+ icon="el-icon-download"
+ @click="handleExport">导出
+ </el-button>
+
+ <el-button type="warning"
+ size="small"
+ plain
+ icon="el-icon-pie-chart"
+ @click="handleExportStatis">导出报表
+ </el-button>
+ </template>
+
</avue-crud>
+ <template>
+ <div>
+ <el-image-viewer
+ class="img"
+ v-if="showViewer"
+ :on-close="closeViewer"
+ :url-list="['data:image/png;base64,'+imgUrl]" />
+ </div>
+ </template>
+
</basic-container>
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/parcel/parcel";
+ import {getList,exportParcelStatis, getParcelPic} from "@/api/parcel/parcel";
import {mapGetters} from "vuex";
+ import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
export default {
+ name:'index',
+ components: { ElImageViewer },
data() {
return {
form: {},
query: {},
+ search:{},
+ showViewer: false, // 显示查看器
+ activeClass: 0,
+ imgUrl:'',
loading: true,
page: {
pageSize: 10,
@@ -39,18 +109,19 @@
},
selectionList: [],
option: {
+ menu:false,
height:'auto',
- calcHeight: 30,
+ calcHeight: 54,
tip: false,
searchShow: true,
searchMenuSpan: 6,
- activeClass: 3,
- border: true,
+ border: false,
+ stripe:true,
index: true,
viewBtn: true,
selection: true,
labelWidth:120,
- menuWidth:120,
+ menuWidth:220,
dialogClickModal: false,
headerAlign: 'center',
align: 'center',
@@ -80,18 +151,34 @@
prop: "imgUrl",
hide:true
},
+ // {
+ // label: '包裹图片',
+ // prop: 'imgUrl',
+ // type: 'upload',
+ // width: 300,
+ // listType: 'data:image/png;base64',
+ // span: 24,
+ // propsHttp: {
+ // res: 'data'
+ // },
+ // canvasOption: {
+ // text: 'avue',
+ // ratio: 0.1
+ // }
+ // },
{
- label: "过机时间",
+ label: "安检时间",
prop: "samplingTime",
},
{
- label: "过机时间",
+ label: "安检时间",
prop: "dateTime",
type: "datetime",
format: "yyyy-MM-dd HH:mm:ss",
valueFormat: "yyyy-MM-dd HH:mm:ss",
searchRange: true,
searchSpan: 8,
+ searchValue:[this.getStartTime(),this.getEndTime()],
hide: true,
addDisplay: false,
editDisplay: false,
@@ -122,6 +209,7 @@
{
label: "是否违禁",
search: true,
+ searchValue: this.getIsKindParams(),
searchLabelWidth: 120,
searchSpan: 4,
hide: true,
@@ -152,7 +240,7 @@
permissionList() {
return {
addBtn: this.vaildData(null, false),
- viewBtn: this.vaildData(this.permission.parcel_pic_view, true),
+ viewBtn: this.vaildData(null, false),
delBtn: this.vaildData(null, false),
editBtn: this.vaildData(null, false)
};
@@ -167,22 +255,30 @@
},
methods: {
beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
done();
},
searchReset() {
+ //清空搜索框中的内容
this.query = {};
+ //清空this.$route.query
+ this.$router.push({ query: {} });
+ this.activeClass=0;
this.onLoad(this.page);
},
searchChange(params, done) {
+ //清空this.$route.query
+ this.$router.push({ query: {} });
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
+ },
+ rowClick(row){
+ var that=this;
+ getParcelPic(row.imgUrl).then(res => {
+ that.imgUrl = res.data.data.imgBase64;
+ this.showViewer = true
+ });
},
selectionChange(list) {
this.selectionList = list;
@@ -200,14 +296,152 @@
refreshChange() {
this.onLoad(this.page, this.query);
},
- onLoad(page, params = {}) {
- debugger;
+ getStartTime(){
+ if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
+ return this.$route.query.startTime
+ }
+ // 当前时间
+ var date = new Date();
+ //年
+ var Y = date.getFullYear();
+ //月
+ var M = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
+ //日
+ var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
+ return Y + "-" + M + "-" + D+ " 00:00:00";
+ },
+ getEndTime(){
+ if (this.$route.query.endTime != undefined && this.$route.query.endTime != null && this.$route.query.endTime != "" ) {
+ return this.$route.query.endTime
+ }
+ // 当前时间
+ var date = new Date();
+ //年
+ var Y = date.getFullYear();
+ //月
+ var M = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
+ //日
+ var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
+ return Y + "-" + M + "-" + D+ " 23:59:59";
+ },
+ getIsKindParams(){
+ if(this.$route.query.decisioDiagramResult && this.$route.query!='' && this.$route.query!=null && this.$route.query!=undefined){
+ //回显
+ return this.$route.query.decisioDiagramResult
+ }
+ },
+ //给行加颜色
+ rowStyle({row, column, rowIndex}){
+ if(row.mechineMark==1){
+ return {
+ color:"#fe1515"
+ }
+ }
+ },
+ getParcelData(e) {
+ var that = this;
+ this.query={};
+ //清空this.$route.query
+ this.$router.push({ query: {} });
+ that.activeClass = e;
+ var today = new Date();
+ var params ={};
+ if(e==0){
+ params = {
+ startTime:this.showToDay(today)+ " 00:00:00",
+ endTime:this.showToDay(today)+ " 23:59:59"
+ };
+ //修改搜索框中的值
+ this.search.dateTime=[this.showToDay(today)+ " 00:00:00",this.showToDay(today)+ " 23:59:59"]
+ }
+ if(e==1){
+ params = {
+ startTime:this.showWeekFirstDay(today)+ " 00:00:00",
+ endTime:this.showToDay(today)+ " 23:59:59"
+ };
+ //修改搜索框中的值
+ this.search.dateTime=[this.showWeekFirstDay(today)+ " 00:00:00",this.showToDay(today)+ " 23:59:59"]
+ }
+ if(e==2){
+ params = {
+ startTime:this.showMonthFirstDay(today)+ " 00:00:00",
+ endTime:this.showToDay(today)+ " 23:59:59"
+ };
+ //修改搜索框中的值
+ this.search.dateTime=[this.showMonthFirstDay(today)+ " 00:00:00",this.showToDay(today)+ " 23:59:59"]
+ }
+
+ if(this.search.decisioDiagramResult){
+ params= {
+ ... params,
+ decisioDiagramResult:this.search.decisioDiagramResult
+ }
+ }
+ this.query = params;
+ this.page.currentPage = 1;
+ this.onLoad(this.page, params);
+ },
+ //本日
+ showToDay(Nowdate){
+ var M=Number(Nowdate.getMonth())+1;
+ if(M<10){
+ M="0"+M;
+ }
+ var day = Nowdate.getDate();
+ if(day<10){
+ day = "0"+day;
+ }
+ return Nowdate.getFullYear()+"-"+M+"-"+day;
+ },
+
+ //本周第一天
+ showWeekFirstDay(Nowdate){
+ var WeekFirstDay=new Date(Nowdate-(Nowdate.getDay()-1)*86400000);
+ var M=Number(WeekFirstDay.getMonth())+1;
+ if(M<10){
+ M="0"+M;
+ }
+ var day = WeekFirstDay.getDate();
+ if(day<10){
+ day = "0"+day;
+ }
+ return WeekFirstDay.getFullYear()+"-"+M+"-"+day;
+ },
+
+ //本月第一天
+ showMonthFirstDay(Nowdate){
+ var MonthFirstDay=new Date(Nowdate.getFullYear(),Nowdate.getMonth(),1);
+ var M=Number(MonthFirstDay.getMonth())+1;
+ if(M<10){
+ M="0"+M;
+ }
+ return MonthFirstDay.getFullYear()+"-"+M+"-"+"0"+MonthFirstDay.getDate();
+ },
+ //数据导出
+ handleExport() {
+ this.$confirm("是否导出包裹数据?", "提示", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ }).then(() => {
+ window.open(`/api/blade-jfpts/parcel/parcel/export-parcel?startTime=${this.$route.query.startTime}&endTime=${this.$route.query.endTime}&decisioDiagramResult=${this.$route.query.decisioDiagramResult}`);
+ });
+ },
+ //数据报表导出
+ handleExportStatis() {
+ let startTime = this.$route.query.startTime==undefined? '':this.$route.query.startTime;
+ let endTime = this.$route.query.endTime==undefined? '':this.$route.query.endTime;
+ let decisioDiagramResult = this.$route.query.decisioDiagramResult==undefined? '':this.$route.query.decisioDiagramResult;
+ let timeDesc = this.$route.query.timeDesc==undefined? '':this.$route.query.timeDesc;
+ //window.open(`http://localhost:8108/ureport/excel?_u=blade-parcel.statis.ureport.xml&startTime=${startTime}&endTime=${endTime}&decisioDiagramResult=${decisioDiagramResult}&timeDesc=${timeDesc}`);
+ window.open(`https://web.byisf.com/api/blade-report/ureport/preview?_u=blade-parcel.statis.ureport.xml&startTime=${startTime}&endTime=${endTime}&decisioDiagramResult=${decisioDiagramResult}&timeDesc=${timeDesc}`);
+ },
+ onLoad(page, params={}) {
const { dateTime } = this.query;
let values = {
...params,
};
- debugger;
if (this.$route.query.decisioDiagramResult && this.$route.query!='' && this.$route.query!=null && this.$route.query!=undefined ) {
if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
this.page.currentPage = 1;
@@ -222,6 +456,7 @@
decisioDiagramResult:this.$route.query.decisioDiagramResult
};
}
+ this.activeClass=4;
}else{
if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
this.page.currentPage = 1;
@@ -229,9 +464,25 @@
startTime:this.$route.query.startTime,
endTime:this.$route.query.endTime
}
+ this.activeClass=4;
+ }
+
+ if(this.activeClass==0){
+ this.page.currentPage = 1;
+ // 当前时间
+ var date = new Date();
+ //年
+ var Y = date.getFullYear();
+ //月
+ var M = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
+ //日
+ var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
+ params = {
+ startTime:Y + "-" + M + "-" + D + " 00:00:00",
+ endTime:Y +"-" +M +"-" + D + " 23:59:59"
+ }
}
}
-
if (dateTime) {
values = {
@@ -256,7 +507,18 @@
this.loading = false;
this.selectionClear();
});
+ },
+ // 关闭查看器
+ closeViewer() {
+ this.showViewer = false
}
}
};
</script>
+<style lang="scss">
+ .img {
+ .el-icon-circle-close {
+ color: white;
+ }
+ }
+</style>
--
Gitblit v1.9.3