|
@@ -38,6 +38,13 @@
|
|
|
size="small"
|
|
|
@click="handleViewCargoWay(scope.row)"
|
|
|
>查看设备货道</el-button>
|
|
|
+ <el-button type="text"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-download"
|
|
|
+ plain
|
|
|
+ class="none-border"
|
|
|
+ @click="handleGenerareQrcode(scope.row)"
|
|
|
+ >下载设备码</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
|
|
@@ -52,7 +59,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {getList, getDetail, add, update, remove} from "@/api/facility/facility";
|
|
|
+ import {getList, getDetail, add, update, remove, buildQrcode} from "@/api/facility/facility";
|
|
|
import {mapGetters} from "vuex";
|
|
|
import CargoWay from "@/views/business/facilitycargoway.vue";
|
|
|
|
|
@@ -336,6 +343,27 @@
|
|
|
handleViewCargoWay(row) {
|
|
|
this.facilityId = row.id;
|
|
|
this.cargowayBox = true;
|
|
|
+ },
|
|
|
+ handleGenerareQrcode(row) {
|
|
|
+ buildQrcode(row.id).then((res) => {
|
|
|
+ var fileName = row.facilityNo+'.jpg';
|
|
|
+ let blob = new Blob([res.data]); //res为从后台返回的数据
|
|
|
+ if (!fileName) {
|
|
|
+ fileName = res.headers['content-disposition'].split('filename=').pop();
|
|
|
+ }
|
|
|
+ if ('msSaveOrOpenBlob' in navigator) {
|
|
|
+ window.navigator.msSaveOrOpenBlob(blob, fileName);
|
|
|
+ } else {
|
|
|
+ const elink = document.createElement('a');
|
|
|
+ elink.download = fileName;
|
|
|
+ elink.style.display = 'none';
|
|
|
+ elink.href = URL.createObjectURL(blob);
|
|
|
+ document.body.appendChild(elink);
|
|
|
+ elink.click();
|
|
|
+ URL.revokeObjectURL(elink.href);
|
|
|
+ document.body.removeChild(elink);
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
};
|