南昌市物联网技防平台-前端
zengh
2021-03-24 33c4e059eeb71de6f186bc4ee22e05bfd3bd5aeb
src/views/parcel/parcel.vue
@@ -18,12 +18,33 @@
               @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>
    <el-dialog class="parcel-dialog" title="包裹图片" :visible.sync="dialogTableVisible" :append-to-body="true" :close-on-click-modal="false"
          @opened="parcelConversation = true" @close="(parcelConversation = false), (oldParcelSatart = false)" >
          <div>
            <img :src="'data:image/png;base64,'+imgUrl" >
          </div>
    </el-dialog>
  </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";
  export default {
@@ -31,7 +52,11 @@
      return {
        form: {},
        query: {},
        imgUrl:'',
        loading: true,
        dialogTableVisible: false,
        parcelConversation:false,
        oldParcelSatart:false,
        page: {
          pageSize: 10,
          currentPage: 1,
@@ -44,11 +69,13 @@
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          activeClass: 3,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          labelWidth:120,
          menuWidth:220,
          dialogClickModal: false,
          headerAlign: 'center',
          align: 'center',
@@ -58,7 +85,7 @@
              label: '坐标',
              prop: 'test',
              hide: true,
              span: 24,
              span: 50,
              component: "avueMap",
              clickChild: (obj) => {
                this.form.jd = obj.latitude
@@ -76,13 +103,14 @@
            {
              label: "包裹图片KEY",
              prop: "imgUrl",
              hide:true
            },
            {
              label: "过机时间",
              label: "安检时间",
              prop: "samplingTime",
            },
            {
              label: "过机时间",
              label: "安检时间",
              prop: "dateTime",
              type: "datetime",
              format: "yyyy-MM-dd HH:mm:ss",
@@ -139,22 +167,6 @@
              label: "违禁包裹物品",
              prop: "decisioDiagramResultDetails",
            }
          ],
          group: [
            {
              label: '违禁品信息',
              prop: 'coordsDetailVoList',
              column: [
                {
                  label: '违禁品名称',
                  prop: 'objName'
                },
                {
                  label: '违禁品编号',
                  prop: 'objCode'
                }
              ]
            }
          ]
        },
        data: []
@@ -165,7 +177,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)
        };
@@ -180,8 +192,9 @@
    },
    methods: {
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
        console.log(type);
        if (["view"].includes(type)) {
          getDetail(this.form.imgUrl).then(res => {
            this.form = res.data.data;
          });
        }
@@ -214,27 +227,36 @@
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        debugger;
        const { dateTime } = this.query;
        let values = {
          ...params,
        };
        if (this.$route.query.type && this.$route.query != undefined && this.$route.query != null && this.$route.query != "" ) {
            if (this.$route.query.status != undefined && this.$route.query.status != null && this.$route.query.status == "" ) {
              this.activeClass = this.$route.query.type;
        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;
              params = {
                status:this.$route.query.status,
                type:this.$route.query.type
                startTime:this.$route.query.startTime,
                endTime:this.$route.query.endTime,
                decisioDiagramResult:this.$route.query.decisioDiagramResult
              }
            } else {
              this.activeClass = 0;
              this.page.currentPage = 1;
              params = {
                type:this.$route.query.type
                decisioDiagramResult:this.$route.query.decisioDiagramResult
              };
            }
        }else{
            if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
              this.page.currentPage = 1;
              params = {
                startTime:this.$route.query.startTime,
                endTime:this.$route.query.endTime
              }
            }
        }
        if (dateTime) {
          values = {
@@ -249,8 +271,8 @@
            ...params,
            ...this.query,
          };
        }
        }
        this.loading = true;
        getList(page.currentPage, page.pageSize,values).then(res => {
          const data = res.data.data;
@@ -259,6 +281,13 @@
          this.loading = false;
          this.selectionClear();
        });
      },
      handleParcelPic(row) {
        console.log(row.imgUrl);
        getParcelPic(row.imgUrl).then(res => {
            this.imgUrl = res.data.data.imgBase64;
          });
        this.dialogTableVisible = true;
      }
    }
  };