|
|
@ -20,11 +20,12 @@ |
|
|
|
<div slot="value-label" slot-scope="{ node }">{{ getAutoNameUnknown(node.label) }}</div> |
|
|
|
</treeselect> |
|
|
|
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="crud.toQuery">搜索</el-button> |
|
|
|
<el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery()">重置</el-button> |
|
|
|
<!-- <el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery()">重置</el-button> --> |
|
|
|
</div> |
|
|
|
<crudOperation> |
|
|
|
<template v-slot:right> |
|
|
|
<el-button :loading="crud.downloadLoading" size="mini" @click="doExport(crud.selections)"> |
|
|
|
<!-- :disabled="isShelfType === 'seq' && crud.data.length === 0" --> |
|
|
|
<el-button :loading="crud.downloadLoading" size="mini" @click="doExport()"> |
|
|
|
<i class="iconfont icon-daochu" /> |
|
|
|
导出 |
|
|
|
</el-button> |
|
|
@ -38,10 +39,9 @@ import { FetchRegionTree } from '@/api/deviceVI/index' |
|
|
|
import CRUD, { header, crud } from '@crud/crud' |
|
|
|
import crudOperation from '@crud/CRUD.operation' |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
import { exportFile } from '@/utils/index' |
|
|
|
import { parseTime, saveAs, getBlob } from '@/utils/index' |
|
|
|
import Treeselect from '@riophae/vue-treeselect' |
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
|
|
|
import qs from 'qs' |
|
|
|
export default { |
|
|
|
components: { crudOperation, Treeselect }, |
|
|
|
mixins: [header(), crud()], |
|
|
@ -55,7 +55,8 @@ export default { |
|
|
|
return { |
|
|
|
search: null, |
|
|
|
regionOptions: [], |
|
|
|
levelNumber: 4 |
|
|
|
levelNumber: 4, |
|
|
|
defaultSelectedValue: null |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
@ -67,10 +68,45 @@ export default { |
|
|
|
created() { |
|
|
|
FetchRegionTree().then(res => { |
|
|
|
this.regionOptions = [this.transformData(res)] |
|
|
|
console.log('regionOptions', this.regionOptions) |
|
|
|
const targetNode = this.findRegionNode(this.regionOptions) |
|
|
|
if (targetNode) { |
|
|
|
console.log('targetNode', targetNode) |
|
|
|
this.search = targetNode.id |
|
|
|
this.handleSugList(targetNode) |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
findRegionNode(nodes) { |
|
|
|
for (const node of nodes) { |
|
|
|
if (node.regionId) { |
|
|
|
return node |
|
|
|
} |
|
|
|
if (node.children && node.children.length > 0) { |
|
|
|
const result = this.findRegionNode(node.children) |
|
|
|
if (result) { |
|
|
|
return result |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return null |
|
|
|
}, |
|
|
|
// findNodeWithoutFondsId(nodes) { |
|
|
|
// for (const node of nodes) { |
|
|
|
// if (!node.fondsId) { |
|
|
|
// return node |
|
|
|
// } |
|
|
|
// if (node.children && node.children.length > 0) { |
|
|
|
// const result = this.findNodeWithoutFondsId(node.children) |
|
|
|
// if (result) { |
|
|
|
// return result |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// return null |
|
|
|
// }, |
|
|
|
getAutoNameUnknown(name) { |
|
|
|
if (name.lastIndexOf('unknown') > -1) { |
|
|
|
return name.split('(')[0] |
|
|
@ -113,6 +149,9 @@ export default { |
|
|
|
treeSelectInput(value) { |
|
|
|
console.log(value) |
|
|
|
const selectKey = value |
|
|
|
this.handleSugList(selectKey) |
|
|
|
}, |
|
|
|
handleSugList(selectKey) { |
|
|
|
if (selectKey.hasOwnProperty('floorId')) { |
|
|
|
this.crud.query.floorId = selectKey.id |
|
|
|
} else if (selectKey.hasOwnProperty('regionId')) { |
|
|
@ -133,8 +172,7 @@ export default { |
|
|
|
this.crud.query.regionId = null |
|
|
|
this.crud.toQuery() |
|
|
|
}, |
|
|
|
doExport(data) { |
|
|
|
console.log(data) |
|
|
|
doExport() { |
|
|
|
crud.downloadLoading = true |
|
|
|
this.$confirm('此操作将导出所选数据' + '<span>你是否还要继续?</span>', '提示', { |
|
|
|
confirmButtonText: '继续', |
|
|
@ -142,24 +180,37 @@ export default { |
|
|
|
type: 'warning', |
|
|
|
dangerouslyUseHTMLString: true |
|
|
|
}).then(() => { |
|
|
|
const ids = [] |
|
|
|
data.forEach(val => { |
|
|
|
ids.push(val.id) |
|
|
|
const { floorId, regionId } = this.crud.query |
|
|
|
const params = { floorId, regionId } |
|
|
|
if (this.isShelfType === 'seq') { |
|
|
|
const url = this.baseApi + '/api/stocktask-task/exportErrorProbaDesc' + '?' + new URLSearchParams(params).toString() |
|
|
|
getBlob(url, (blob) => { |
|
|
|
const fileName = '建议顺架-' + parseTime(new Date()) + '.xlsx' |
|
|
|
saveAs(blob, fileName) |
|
|
|
}) |
|
|
|
const params = { |
|
|
|
'ids': ids |
|
|
|
} |
|
|
|
if (this.isLogType === 'login') { |
|
|
|
exportFile(this.baseApi + '/api/log/downloadLoginLog?' + qs.stringify(params, { indices: false })) |
|
|
|
} else if (this.isLogType === 'operate') { |
|
|
|
exportFile(this.baseApi + '/api/log/downloadLog?' + qs.stringify(params, { indices: false })) |
|
|
|
} else { |
|
|
|
exportFile(this.baseApi + '/api/log/downloadErrorLog?' + qs.stringify(params, { indices: false })) |
|
|
|
const url = this.baseApi + '/api/stocktask-task/exportSuggestTilting' + '?' + new URLSearchParams(params).toString() |
|
|
|
getBlob(url, (blob) => { |
|
|
|
const fileName = '建议倒架-' + parseTime(new Date()) + '.xlsx' |
|
|
|
saveAs(blob, fileName) |
|
|
|
}) |
|
|
|
// const params1 = { ...params, orderType: 1 } |
|
|
|
// const url1 = this.baseApi + '/api/stocktask-task/exportSuggestTilting' + '?' + new URLSearchParams(params1).toString() |
|
|
|
// getBlob(url1, (blob) => { |
|
|
|
// const fileName = '建议倒架架满列表-' + parseTime(new Date()) + '.xlsx' |
|
|
|
// saveAs(blob, fileName) |
|
|
|
// }) |
|
|
|
|
|
|
|
// const params2 = { ...params, orderType: 2 } |
|
|
|
// const url2 = this.baseApi + '/api/stocktask-task/exportSuggestTilting' + '?' + new URLSearchParams(params2).toString() |
|
|
|
// getBlob(url2, (blob) => { |
|
|
|
// const fileName = '建议倒架架空列表-' + parseTime(new Date()) + '.xlsx' |
|
|
|
// saveAs(blob, fileName) |
|
|
|
// }) |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|