|
|
@@ -1,65 +1,71 @@
|
|
|
<template>
|
|
|
- <div class="con" v-loading.fullscreen.lock="loading">
|
|
|
- <el-dialog
|
|
|
- title="场景获取"
|
|
|
- :close-on-click-modal="false"
|
|
|
- :visible.sync="downloadingVisible"
|
|
|
- width="400px"
|
|
|
- >
|
|
|
- <el-form :model="downloading" :label-position="'right'" label-width="100px">
|
|
|
+ <div class="con"
|
|
|
+ v-loading.fullscreen.lock="loading">
|
|
|
+ <el-dialog title="场景下载"
|
|
|
+ :before-close="handleCloseDown"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :visible.sync="downloadingVisible"
|
|
|
+ width="400px">
|
|
|
+ <el-form :model="downloading"
|
|
|
+ :label-position="'right'"
|
|
|
+ label-width="100px">
|
|
|
<div style="padding: 0 30px">
|
|
|
<div class="add-l">
|
|
|
<el-form-item label="场景名称:">
|
|
|
<span>{{ downloading.sceneName }}</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item
|
|
|
- label="下载进度:"
|
|
|
- prop="percent"
|
|
|
- v-if="downloading.status != 1003"
|
|
|
- >
|
|
|
+ <el-form-item label="下载进度:"
|
|
|
+ prop="percent"
|
|
|
+ v-if="downloading.status != 1003">
|
|
|
<!-- <span style="color:#0175dc">100%</span> -->
|
|
|
<span style="color: #0175dc">{{ downloading.percent }}%</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="状态:" prop="status">
|
|
|
- <span v-if="downloading.status == 1002" style="color: #0175dc"
|
|
|
- >获取成功</span
|
|
|
- >
|
|
|
- <span
|
|
|
- v-if="downloading.status == 1000 || downloading.status == 1001"
|
|
|
- style="color: #0175dc"
|
|
|
- >获取中</span
|
|
|
- >
|
|
|
- <span v-if="downloading.status == 1003" style="color: red">获取失败</span>
|
|
|
+ <el-form-item label="状态:"
|
|
|
+ prop="status">
|
|
|
+ <span v-if="downloading.status == 1002"
|
|
|
+ style="color: #0175dc">下载成功</span>
|
|
|
+ <span v-if="downloading.status == 1000 || downloading.status == 1001"
|
|
|
+ style="color: #0175dc">下载中</span>
|
|
|
+ <span v-if="downloading.status == 1003"
|
|
|
+ style="color: red">下载失败</span>
|
|
|
<!-- <span style="color:#0175dc">下载成功</span> -->
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-form>
|
|
|
- <div style="text-align: center" class="dialog-footer">
|
|
|
+ <div style="text-align: center"
|
|
|
+ class="dialog-footer">
|
|
|
<div>
|
|
|
- <el-button
|
|
|
- v-if="downloading.status == 1002 || downloading.status == 1003"
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- @click="downloadingVisible = false"
|
|
|
- >确 定</el-button
|
|
|
- >
|
|
|
+
|
|
|
+ <el-button v-if="downloading.status == 1002 || downloading.status == 1003"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click="downloadingVisible = false; downloading.percent = 0;downloading.status = 1000">确 定</el-button>
|
|
|
+ <el-button v-else
|
|
|
+ size="small"
|
|
|
+ type="default"
|
|
|
+ @click="handleCloseDown">取消下载</el-button>
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<div class="h-header">
|
|
|
<vcenter>
|
|
|
<div class="h-input">
|
|
|
- <el-input v-model="CompanyName" placeholder="请输入公司名称"></el-input>
|
|
|
+ <el-input v-model="CompanyName"
|
|
|
+ placeholder="请输入公司名称"></el-input>
|
|
|
</div>
|
|
|
<div class="h-input">
|
|
|
- <el-input v-model="SceneName" placeholder="请输入场景名称"></el-input>
|
|
|
+ <el-input v-model="SceneName"
|
|
|
+ placeholder="请输入场景名称"></el-input>
|
|
|
</div>
|
|
|
<div class="h-input">
|
|
|
- <el-input v-model="ShebeiID" placeholder="请输入设备ID"></el-input>
|
|
|
+ <el-input v-model="ShebeiID"
|
|
|
+ placeholder="请输入设备ID"></el-input>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <el-button type="primary" @click="search">搜索</el-button>
|
|
|
+ <el-button type="primary"
|
|
|
+ @click="search">搜索</el-button>
|
|
|
</div>
|
|
|
</vcenter>
|
|
|
</div>
|
|
|
@@ -73,41 +79,33 @@
|
|
|
</el-tabs>-->
|
|
|
</vcenter>
|
|
|
</div>
|
|
|
- <el-table
|
|
|
- height="520"
|
|
|
- :data="tableData"
|
|
|
- style="width: 100%; padding: 0 20px"
|
|
|
- :default-sort="{ prop: 'createTime', order: 'descending' }"
|
|
|
- >
|
|
|
- <el-table-column
|
|
|
- v-for="(item, i) in tableHeader"
|
|
|
- :key="i"
|
|
|
- :prop="item.name"
|
|
|
- :label="item.label"
|
|
|
- >
|
|
|
+ <el-table height="520"
|
|
|
+ :data="tableData"
|
|
|
+ style="width: 100%; padding: 0 20px"
|
|
|
+ :default-sort="{ prop: 'createTime', order: 'descending' }">
|
|
|
+ <el-table-column v-for="(item, i) in tableHeader"
|
|
|
+ :key="i"
|
|
|
+ :prop="item.name"
|
|
|
+ :label="item.label">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <span @click="_S_download(scope.row)" style="cursor: pointer; color: #0175dc"
|
|
|
- >下载场景</span
|
|
|
- ><br />
|
|
|
- <span @click="_openEdit(scope.row)" style="cursor: pointer; color: #0175dc"
|
|
|
- >打开编辑器</span
|
|
|
- >
|
|
|
+ <span @click="_S_download(scope.row)"
|
|
|
+ style="cursor: pointer; color: #0175dc">下载场景</span><br />
|
|
|
+ <span @click="_openEdit(scope.row)"
|
|
|
+ style="cursor: pointer; color: #0175dc">打开编辑器</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<div class="p-con">
|
|
|
<!-- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="size" :page-sizes="[10, 30, 50, 100]" layout="total, prev, pager, next, jumper" :total="total"></el-pagination> -->
|
|
|
- <el-pagination
|
|
|
- @size-change="handleSizeChange"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- :current-page.sync="currentPage"
|
|
|
- :page-sizes="[10, 30, 50, 100]"
|
|
|
- :page-size="size"
|
|
|
- layout="sizes, prev, pager, next"
|
|
|
- :total="total"
|
|
|
- >
|
|
|
+ <el-pagination @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page.sync="currentPage"
|
|
|
+ :page-sizes="[10, 30, 50, 100]"
|
|
|
+ :page-size="size"
|
|
|
+ layout="sizes, prev, pager, next"
|
|
|
+ :total="total">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -115,37 +113,38 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import vcenter from "@/components/vcenter";
|
|
|
-import Vue from "vue";
|
|
|
+import vcenter from '@/components/vcenter'
|
|
|
+import Vue from 'vue'
|
|
|
export default {
|
|
|
components: { vcenter },
|
|
|
data() {
|
|
|
return {
|
|
|
- CompanyName: "",
|
|
|
- SceneName: "",
|
|
|
- ShebeiID: "",
|
|
|
+ get_process: null,
|
|
|
+ CompanyName: '',
|
|
|
+ SceneName: '',
|
|
|
+ ShebeiID: '',
|
|
|
currentPage: 1,
|
|
|
size: 10,
|
|
|
total: 0,
|
|
|
tableHeader: [
|
|
|
- { name: "sceneName", label: "场景名称" },
|
|
|
- { name: "webSite", label: "场景链接" },
|
|
|
- { name: "companyName", label: "企业名称" },
|
|
|
- { name: "childName", label: "拍摄设备ID" },
|
|
|
- { name: "createTime", label: "拍摄时间" },
|
|
|
- { name: "viewCount", label: "场景访问量" },
|
|
|
- { name: "num", label: "场景码" },
|
|
|
+ { name: 'sceneName', label: '场景名称' },
|
|
|
+ { name: 'webSite', label: '场景链接' },
|
|
|
+ { name: 'companyName', label: '企业名称' },
|
|
|
+ { name: 'childName', label: '拍摄设备ID' },
|
|
|
+ { name: 'createTime', label: '拍摄时间' },
|
|
|
+ { name: 'viewCount', label: '场景访问量' },
|
|
|
+ { name: 'num', label: '场景码' },
|
|
|
],
|
|
|
tableData: [],
|
|
|
loading: false,
|
|
|
- type: "",
|
|
|
+ type: '',
|
|
|
downloading: {
|
|
|
- sceneName: "",
|
|
|
- status: "",
|
|
|
- percent: "",
|
|
|
+ sceneName: '',
|
|
|
+ status: 1000,
|
|
|
+ percent: 0,
|
|
|
},
|
|
|
downloadingVisible: false,
|
|
|
- };
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
// S_download(row){
|
|
|
@@ -178,165 +177,179 @@ export default {
|
|
|
// })
|
|
|
// },
|
|
|
async _openEdit(row) {
|
|
|
- let zfb_token = localStorage.getItem("zfb_token");
|
|
|
- let userName = localStorage.getItem("zfb_username");
|
|
|
+ let zfb_token = localStorage.getItem('zfb_token')
|
|
|
+ let userName = localStorage.getItem('zfb_username')
|
|
|
let params = {
|
|
|
sceneNum: row.num,
|
|
|
- userName:userName
|
|
|
- };
|
|
|
+ userName: userName,
|
|
|
+ }
|
|
|
let result = await this.$http({
|
|
|
- method: "post",
|
|
|
+ method: 'post',
|
|
|
data: params,
|
|
|
// url: "/token/renewToken",
|
|
|
- url: "/api/platform/generateSceneEditToken",
|
|
|
+ url: '/api/platform/generateSceneEditToken',
|
|
|
headers: {
|
|
|
token: zfb_token,
|
|
|
},
|
|
|
- });
|
|
|
+ })
|
|
|
if (result.code === 200) {
|
|
|
- let url = row.webSite.replace("smobile", "epc") + "&token=" + result.message;
|
|
|
- window.open(url);
|
|
|
+ let url =
|
|
|
+ row.webSite.replace('smobile', 'epc') + '&token=' + result.message
|
|
|
+ window.open(url)
|
|
|
}
|
|
|
},
|
|
|
_S_download(row) {
|
|
|
- let webSite = row.num;
|
|
|
- this.downloading.sceneName = row.sceneName;
|
|
|
- this.loading = true;
|
|
|
+ let webSite = row.num
|
|
|
+ this.downloading.sceneName = row.sceneName
|
|
|
+ this.loading = true
|
|
|
this.$http({
|
|
|
- method: "get",
|
|
|
+ method: 'get',
|
|
|
url: `/scene/downloadSceneData?sceneNum=${webSite}`,
|
|
|
headers: {
|
|
|
- token: window.localStorage.getItem("zfb_token"),
|
|
|
+ token: window.localStorage.getItem('zfb_token'),
|
|
|
},
|
|
|
}).then((res) => {
|
|
|
- this.loading = false;
|
|
|
+ this.loading = false
|
|
|
+ this.downloadingVisible = true
|
|
|
if (res.code === 200) {
|
|
|
//链接存在时直接下载
|
|
|
- if (res.message.indexOf("zip") != -1 && res.message.indexOf("http") == -1) {
|
|
|
- window.open(`/zfb/${res.message}`, "_blank");
|
|
|
+ if (
|
|
|
+ res.message.indexOf('zip') != -1 &&
|
|
|
+ res.message.indexOf('http') == -1
|
|
|
+ ) {
|
|
|
+ window.open(`/zfb/${res.message}`, '_blank')
|
|
|
}
|
|
|
//如果是完整的链接则直接下载
|
|
|
- else if (res.message.indexOf("http") != -1) {
|
|
|
- window.open(res.message, "_blank");
|
|
|
+ else if (res.message.indexOf('http') != -1) {
|
|
|
+ window.open(res.message, '_blank')
|
|
|
}
|
|
|
//设置定时器实时获取下载链接的status和percent
|
|
|
- else if (res.message == "success") {
|
|
|
- // setTimeout(()=>{
|
|
|
- // var get_process = setInterval(()=>{
|
|
|
- // this.getProcess(row , get_process)
|
|
|
- // },2000)
|
|
|
- // },3000)
|
|
|
- var get_process = setInterval(() => {
|
|
|
- this.getProcess(row, get_process);
|
|
|
- }, 2000);
|
|
|
+ else if (res.message == 'success') {
|
|
|
+ this.get_process = setInterval(() => {
|
|
|
+ this.getProcess(row)
|
|
|
+ }, 2000)
|
|
|
} else {
|
|
|
- return this.$alert(res.error, "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- });
|
|
|
+ return this.$alert(res.error, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ })
|
|
|
}
|
|
|
} else if (res.code === 400) {
|
|
|
- return this.$alert(res.message, "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- });
|
|
|
+ return this.$alert(res.message, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ })
|
|
|
} else {
|
|
|
- return this.$alert(res.error, "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- });
|
|
|
+ return this.$alert(res.error, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ })
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
- getProcess(row, get_process) {
|
|
|
+
|
|
|
+ getProcess(row) {
|
|
|
// let params = {
|
|
|
// sceneNum: row.num
|
|
|
// }
|
|
|
this.$http({
|
|
|
- method: "get",
|
|
|
+ method: 'get',
|
|
|
url: `/scene/getDownloadProcess?sceneNum=${row.num}`,
|
|
|
// data: params,
|
|
|
headers: {
|
|
|
- token: window.localStorage.getItem("zfb_token"),
|
|
|
+ token: window.localStorage.getItem('zfb_token'),
|
|
|
},
|
|
|
}).then((res) => {
|
|
|
if (res.code === 200) {
|
|
|
- this.downloadingVisible = true;
|
|
|
- this.downloading.status = res.message.status;
|
|
|
- this.downloading.percent = res.message.percent;
|
|
|
- if (this.downloading.status == 1002 || this.downloading.status == 1003) {
|
|
|
- clearInterval(get_process);
|
|
|
+ // this.downloadingVisible = true
|
|
|
+ this.downloading.status = res.message.status
|
|
|
+ this.downloading.percent = res.message.percent
|
|
|
+ if (
|
|
|
+ this.downloading.status == 1002 ||
|
|
|
+ this.downloading.status == 1003
|
|
|
+ ) {
|
|
|
+ clearInterval(this.get_process)
|
|
|
if (res.message.url && this.downloading.status == 1002) {
|
|
|
- window.open(res.message.url, "_blank");
|
|
|
+ window.open(res.message.url, '_blank')
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- return this.$alert(res.error, "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- });
|
|
|
+ return this.$alert(res.error, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ })
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleCloseDown() {
|
|
|
+ this.$confirm('是否取消下载?', '提示')
|
|
|
+ .then(() => {
|
|
|
+ this.downloading.percent = 0
|
|
|
+ this.downloading.status = 1000
|
|
|
+ clearInterval(this.get_process)
|
|
|
+ this.downloadingVisible = false
|
|
|
+ })
|
|
|
+ .catch((_) => {})
|
|
|
},
|
|
|
handleSizeChange(val) {
|
|
|
- this.size = val;
|
|
|
- this.refresh();
|
|
|
- console.log(`每页 ${val} 条`);
|
|
|
+ this.size = val
|
|
|
+ this.refresh()
|
|
|
+ console.log(`每页 ${val} 条`)
|
|
|
},
|
|
|
handleCurrentChange(val) {
|
|
|
// this.loading = true
|
|
|
- console.log(`当前页: ${val}`);
|
|
|
+ console.log(`当前页: ${val}`)
|
|
|
},
|
|
|
async getData() {
|
|
|
- this.loading = true;
|
|
|
+ this.loading = true
|
|
|
let params = {
|
|
|
- companyName: this.CompanyName || "",
|
|
|
- childName: this.ShebeiID || "",
|
|
|
- sceneName: this.SceneName || "",
|
|
|
+ companyName: this.CompanyName || '',
|
|
|
+ childName: this.ShebeiID || '',
|
|
|
+ sceneName: this.SceneName || '',
|
|
|
//startTime: this.value5 ? this.value5[0] : '',
|
|
|
//endTime: this.value5 ? this.value5[1] : '',
|
|
|
//state: this.dropdown_active.id !== '' ? this.dropdown_active.id : '',
|
|
|
type: this.type,
|
|
|
- };
|
|
|
+ }
|
|
|
let result = await this.$http({
|
|
|
- method: "post",
|
|
|
+ method: 'post',
|
|
|
data: params,
|
|
|
- url: "/scene/pageList",
|
|
|
+ url: '/scene/pageList',
|
|
|
headers: {
|
|
|
- token: window.localStorage.getItem("zfb_token"),
|
|
|
+ token: window.localStorage.getItem('zfb_token'),
|
|
|
pageNum: this.currentPage,
|
|
|
pageSize: this.size,
|
|
|
},
|
|
|
- });
|
|
|
+ })
|
|
|
//发布日期和状态格式规范
|
|
|
/*for (let i = 0; i < result.message.list.length; i++) {
|
|
|
result.message.list[i].createTime = this.$base.dateFormat('yyyy-MM-dd hh:mm', new Date(result.message.list[i].createTime))
|
|
|
result.message.list[i].state = this.fixState(result.message.list[i].state)
|
|
|
}*/
|
|
|
if (result.code === 200) {
|
|
|
- this.tableData = result.message.list;
|
|
|
+ this.tableData = result.message.list
|
|
|
} else {
|
|
|
- return this.$alert(result.error, "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- });
|
|
|
+ return this.$alert(result.error, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
- this.total = result.message.total;
|
|
|
- this.currentPage = result.message.pageNum;
|
|
|
+ this.total = result.message.total
|
|
|
+ this.currentPage = result.message.pageNum
|
|
|
|
|
|
- this.loading = false;
|
|
|
+ this.loading = false
|
|
|
},
|
|
|
refresh() {
|
|
|
// this.loading = true
|
|
|
- this.getData();
|
|
|
+ this.getData()
|
|
|
// this.loading = false
|
|
|
},
|
|
|
search() {
|
|
|
- this.currentPage === 1 ? this.refresh() : (this.currentPage = 1);
|
|
|
+ this.currentPage === 1 ? this.refresh() : (this.currentPage = 1)
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.refresh();
|
|
|
+ this.refresh()
|
|
|
},
|
|
|
watch: {
|
|
|
currentPage() {
|
|
|
- this.refresh();
|
|
|
+ this.refresh()
|
|
|
},
|
|
|
// size(){
|
|
|
// this.refresh()
|
|
|
@@ -344,16 +357,16 @@ export default {
|
|
|
num(newVal, oldVal) {
|
|
|
if (newVal > oldVal) {
|
|
|
this.addDevies.push({
|
|
|
- value: "",
|
|
|
+ value: '',
|
|
|
isAvailable: false,
|
|
|
hasCheck: false,
|
|
|
- });
|
|
|
+ })
|
|
|
} else {
|
|
|
- this.addDevies.pop();
|
|
|
+ this.addDevies.pop()
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
-};
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
@@ -426,8 +439,8 @@ export default {
|
|
|
line-height: 1;
|
|
|
color: #999;
|
|
|
}
|
|
|
- input[type="number"]::-webkit-inner-spin-button,
|
|
|
- input[type="number"]::-webkit-outer-spin-button {
|
|
|
+ input[type='number']::-webkit-inner-spin-button,
|
|
|
+ input[type='number']::-webkit-outer-spin-button {
|
|
|
-webkit-appearance: none;
|
|
|
margin: 0;
|
|
|
}
|