From b9bc80def4e77e1bd2b224747a4dbf0b486e4c1d Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 02 Apr 2021 16:49:12 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/jfpt-Vue
---
src/views/parcel/parcel.vue | 107 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 97 insertions(+), 10 deletions(-)
diff --git a/src/views/parcel/parcel.vue b/src/views/parcel/parcel.vue
index 0daf120..6eb9cc3 100644
--- a/src/views/parcel/parcel.vue
+++ b/src/views/parcel/parcel.vue
@@ -8,9 +8,11 @@
:before-open="beforeOpen"
v-model="form"
ref="crud"
+ :row-style="rowStyle"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
+ @row-click="rowClick"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@@ -18,19 +20,47 @@
@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> -->
+
</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, getDetail, 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: {},
+ showViewer: false, // 显示查看器
+ imgUrl:'',
loading: true,
page: {
pageSize: 10,
@@ -39,6 +69,7 @@
},
selectionList: [],
option: {
+ menu:false,
height:'auto',
calcHeight: 30,
tip: false,
@@ -50,7 +81,7 @@
viewBtn: true,
selection: true,
labelWidth:120,
- menuWidth:120,
+ menuWidth:220,
dialogClickModal: false,
headerAlign: 'center',
align: 'center',
@@ -80,18 +111,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 +169,7 @@
{
label: "是否违禁",
search: true,
+ searchValue: this.getIsKindParams(),
searchLabelWidth: 120,
searchSpan: 4,
hide: true,
@@ -152,7 +200,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,8 +215,8 @@
},
methods: {
beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
+ if (["view"].includes(type)) {
+ getDetail(this.form.imgUrl).then(res => {
this.form = res.data.data;
});
}
@@ -183,6 +231,13 @@
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 +255,36 @@
refreshChange() {
this.onLoad(this.page, this.query);
},
+ getStartTime(){
+ if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
+ return this.$route.query.startTime
+ }
+ },
+ getEndTime(){
+ if (this.$route.query.endTime != undefined && this.$route.query.endTime != null && this.$route.query.endTime != "" ) {
+ return this.$route.query.endTime
+ }
+ },
+ 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"
+ }
+ }
+ },
onLoad(page, params = {}) {
- debugger;
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;
@@ -232,7 +309,6 @@
}
}
-
if (dateTime) {
values = {
...params,
@@ -256,7 +332,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