Commit bb0152fe authored by 李志鸣's avatar 李志鸣

fea(制件车间): 报表导出功能开发

parent 2db19791
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
show-overflow-tooltip show-overflow-tooltip
v-bind="judgeTableColumnAttribute(item)"> v-bind="judgeTableColumnAttribute(item)">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="item.dataType === 'DATETIME'"> <span v-if="item.dateType === 'DATETIME'">
{{ scope.row[item.value] === null || scope.row[item.value] === '' || scope.row[item.value] === undefined ? '暂无' : format(scope.row[item.value], 'yyyy-MM-dd hh:mm:ss') }} {{ scope.row[item.value] === null || scope.row[item.value] === '' || scope.row[item.value] === undefined ? '暂无' : format(scope.row[item.value], 'yyyy-MM-dd hh:mm:ss') }}
</span> </span>
<span v-if="item.dataType === 'NUMBER'"> <span v-else-if="item.dateType === 'NUMBER'">
{{ scope.row[item.value] === null || scope.row[item.value] === '' || scope.row[item.value] === undefined ? '暂无' : (scope.row[item.value]).toFix(2) }} {{ scope.row[item.value] === null || scope.row[item.value] === '' || scope.row[item.value] === undefined ? '暂无' : (scope.row[item.value]).toFix(2) }}
</span> </span>
<span v-else> <span v-else>
......
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
} }
}, },
"equipment-controller": { "equipment-controller": {
"data-get": { "data-post": {
"url": "/api/equipment/realTime/data", "url": "/api/equipment/realTime/data",
"method": "get" "method": "post"
} }
}, },
"show-field-controller": { "show-field-controller": {
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
UserView: '人员信息视图', UserView: '人员信息视图',
Workbench: '工作台', Workbench: '工作台',
// 车间(设备数据) // 车间(设备数据)
Workshop: '设备数据', Workshop: '设备采集数据',
Parts: '制件车间', Parts: '制件车间',
Welding: '焊装车间', Welding: '焊装车间',
Painting: '涂装车间', Painting: '涂装车间',
......
...@@ -70,27 +70,33 @@ ...@@ -70,27 +70,33 @@
sortTreeData: [ sortTreeData: [
{ {
id: 1, id: 1,
label: '旋转辊床' label: '旋转辊床',
code: 'ROTARY_ROLLER_BED'
}, },
{ {
id: 2, id: 2,
label: '过程扫码设备' label: '过程扫码设备',
code: 'PROCESS_SCAN_CODE'
}, },
{ {
id: 3, id: 3,
label: '智能扭力钣手' label: '智能扭力钣手',
code: 'INTELLIGENT_TORQUE_WRENCH'
}, },
{ {
id: 4, id: 4,
label: '润滑油集中加注' label: '润滑油集中加注',
code: 'LUBRICATING_OIL_CONCENTRATE'
}, },
{ {
id: 5, id: 5,
label: '四轮定位' label: '四轮定位',
code: 'WHEEL_ALIGNMENT'
}, },
{ {
id: 6, id: 6,
label: '铆接设备' label: '铆接设备',
code: 'RIVETING_EQUIPMENT'
} }
], ],
// 设备分类树高度 // 设备分类树高度
...@@ -144,7 +150,7 @@ ...@@ -144,7 +150,7 @@
// 左侧类别树 // 左侧类别树
.tree-pack { .tree-pack {
position: absolute; position: absolute;
width: 300px; width: 250px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
...@@ -158,10 +164,11 @@ ...@@ -158,10 +164,11 @@
// 显示区域 // 显示区域
.view-pack { .view-pack {
margin-left: 310px; margin-left: 260px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
overflow-y: auto;
.title-pack { .title-pack {
height: 38px; height: 38px;
......
...@@ -70,35 +70,43 @@ ...@@ -70,35 +70,43 @@
sortTreeData: [ sortTreeData: [
{ {
id: 1, id: 1,
label: '板链' label: '板链',
code: 'PLATE_CHAIN'
}, },
{ {
id: 2, id: 2,
label: '过程扫码设备' label: '过程扫码设备',
code: 'PROCESS_SCAN_CODE'
}, },
{ {
id: 3, id: 3,
label: '智能扭力钣手' label: '智能扭力钣手',
code: 'INTELLIGENT_TORQUE_WRENCH'
}, },
{ {
id: 4, id: 4,
label: '集中加注冷媒' label: '集中加注冷媒',
code: 'FOCUS_ADDING_REFRIGERANT'
}, },
{ {
id: 5, id: 5,
label: '集中加注离合器' label: '集中加注离合器',
code: 'CENTRALIZED_FILLING_CLUTCH'
}, },
{ {
id: 6, id: 6,
label: '集中加注助力油' label: '集中加注助力油',
code: 'FOCUS_BOOSTER_OIL'
}, },
{ {
id: 7, id: 7,
label: '地板革热熔胶涂布设备' label: '地板革热熔胶涂布设备',
code: 'FLOOR_LEATHER_HOT'
}, },
{ {
id: 8, id: 8,
label: '新能源在线检测点' label: '新能源在线检测点',
code: 'NEW_ENERGY'
} }
], ],
// 设备分类树高度 // 设备分类树高度
...@@ -152,7 +160,7 @@ ...@@ -152,7 +160,7 @@
// 左侧类别树 // 左侧类别树
.tree-pack { .tree-pack {
position: absolute; position: absolute;
width: 300px; width: 250px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
...@@ -166,10 +174,11 @@ ...@@ -166,10 +174,11 @@
// 显示区域 // 显示区域
.view-pack { .view-pack {
margin-left: 310px; margin-left: 260px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
overflow-y: auto;
.title-pack { .title-pack {
height: 38px; height: 38px;
......
...@@ -70,31 +70,38 @@ ...@@ -70,31 +70,38 @@
sortTreeData: [ sortTreeData: [
{ {
id: 1, id: 1,
label: '整车前处理电泳' label: '整车前处理电泳',
code: 'VEHICLE_PRETREATMENT_ELECTROPHORESIS'
}, },
{ {
id: 2, id: 2,
label: '整车电泳输出' label: '整车电泳输出',
code: 'VEHICLE_ELECTROPHORESIS_OUTPUT'
}, },
{ {
id: 3, id: 3,
label: '电泳整流' label: '电泳整流',
code: 'ELECTROPHORESIS_RECTIFICATION'
}, },
{ {
id: 4, id: 4,
label: '喷漆室' label: '喷漆室',
code: 'SPRAY_BOOTH'
}, },
{ {
id: 5, id: 5,
label: '烘干室' label: '烘干室',
code: 'DRYING_ROOM'
}, },
{ {
id: 6, id: 6,
label: '打磨室' label: '打磨室',
code: 'POLISHING_ROOM'
}, },
{ {
id: 7, id: 7,
label: '喷涂机器人' label: '喷涂机器人',
code: 'PAINTING_ROBOT'
} }
], ],
// 设备分类树高度 // 设备分类树高度
...@@ -148,7 +155,7 @@ ...@@ -148,7 +155,7 @@
// 左侧类别树 // 左侧类别树
.tree-pack { .tree-pack {
position: absolute; position: absolute;
width: 300px; width: 250px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
...@@ -162,10 +169,11 @@ ...@@ -162,10 +169,11 @@
// 显示区域 // 显示区域
.view-pack { .view-pack {
margin-left: 310px; margin-left: 260px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
overflow-y: auto;
.title-pack { .title-pack {
height: 38px; height: 38px;
......
...@@ -38,15 +38,30 @@ ...@@ -38,15 +38,30 @@
</div> </div>
<div class="tool-pack clear-float pl-15 pr-15"> <div class="tool-pack clear-float pl-15 pr-15">
<Search <Search
searchCode="3D_LASER_CUTTING" v-if="searchComponentRenderToggle"
:searchCode="currentSearchCode"
@search="doSearchClick" @search="doSearchClick"
@reset="doResetClick"> @reset="doResetClick">
</Search> </Search>
<div class="float-left">
<el-button
size="small"
type="primary"
@click="doExportClick">
导出
</el-button>
<el-button
size="small">
程序下发
</el-button>
</div>
</div> </div>
<div class="general-list-main-pack pl-15 pr-15"> <div class="general-list-main-pack pl-15 pr-15">
<div> <div>
<PreviewTable <PreviewTable
:tableConfig="tableConfig"> :tableConfig="tableConfig"
@onPageSizeChange="onPageSizeChange"
@onCurrentPageChange="onCurrentPageChange">
</PreviewTable> </PreviewTable>
</div> </div>
</div> </div>
...@@ -57,6 +72,7 @@ ...@@ -57,6 +72,7 @@
<script> <script>
import PreviewTable from '@/components/PreviewTable' import PreviewTable from '@/components/PreviewTable'
import Search from '@/components/Search' import Search from '@/components/Search'
import request from '@/utils/request'
export default { export default {
name: 'Parts', name: 'Parts',
...@@ -70,41 +86,57 @@ ...@@ -70,41 +86,57 @@
sortTreeData: [ sortTreeData: [
{ {
id: 1, id: 1,
label: '三维激光切割机' label: '三维激光切割机',
code: '3D_LASER_CUTTING'
}, },
{ {
id: 2, id: 2,
label: '激光切管机' label: '激光切管机',
code: 'LASER_CUTTING'
}, },
{ {
id: 3, id: 3,
label: '平板激光切割机' label: '平板激光切割机',
code: 'FLAT_LASER_CUTTING'
}, },
{ {
id: 4, id: 4,
label: '等离子切割机' label: '等离子切割机',
code: 'PLASMA_CUTTING'
}, },
{ {
id: 5, id: 5,
label: '机器人焊接' label: '机器人焊接',
code: 'WELDING_ROBOT'
}, },
{ {
id: 6, id: 6,
label: '前处理' label: '前处理',
code: 'PRETREATMENT'
}, },
{ {
id: 7, id: 7,
label: '型钢数控下料' label: '型钢数控下料',
code: 'STEEL_CNC_CUTTING'
}, },
{ {
id: 8, id: 8,
label: '喷粉线' label: '喷粉线',
code: 'DUSTING_LINE'
} }
], ],
// 搜索组件关键字列表
searchList: {},
// 设备分类树高度 // 设备分类树高度
treeHeight: {}, treeHeight: {},
// 当前选中分类 // 当前选中分类
currentSort: {}, currentSort: {},
// 当前设备searchcode
currentSearchCode: '',
// 当前车间code
currentWorkshopCode: 'PARTS',
// 是否重新加载搜索组件
searchComponentRenderToggle: false,
// 表格配置项 // 表格配置项
tableConfig: { tableConfig: {
height: 0, height: 0,
...@@ -121,33 +153,125 @@ ...@@ -121,33 +153,125 @@
}, },
methods: { methods: {
// 点击刷新按钮 // 点击刷新按钮
doRefreshClick () {}, doRefreshClick () {
this.getTableData().then(() => {
this.$message.success('刷新成功!')
})
},
// 点击分类树 // 点击分类树
doSortTreeClick (treeNode) { doSortTreeClick (treeNode) {
this.currentSort = _.cloneDeep(treeNode) this.currentSort = _.cloneDeep(treeNode)
this.searchCode = this.currentSort.code
// 重新渲染搜索组件
this.searchComponentRenderToggle = false
this.$nextTick(() => {
this.searchComponentRenderToggle = true
})
// 获取列表表头展示字段
this.getTableLabel()
}, },
// 点击搜索组件搜索按钮 // 点击搜索组件搜索按钮
doSearchClick () {}, doSearchClick (param) {
this.searchList = param
this.tableConfig.paginationConfig.currentPage = 1
// 获取列表数据
this.getTableData()
},
// 点击搜索组件重置按钮 // 点击搜索组件重置按钮
doResetClick () {}, doResetClick (param) {
this.searchList = { ...param, filters: [] }
this.tableConfig.paginationConfig.currentPage = 1
this.tableConfig.paginationConfig.pageSize = 20
// 获取列表数据
this.getTableData()
},
// 获取列表表头展示字段 // 获取列表表头展示字段
getTableLabel () { getTableLabel () {
let queryParams = { searchCode: '3D_LASER_CUTTING' } let queryParams = { searchCode: this.currentSearchCode }
this.$fetch('show-field-controller/showField-get', queryParams).then((response) => { this.$fetch('show-field-controller/showField-get', queryParams).then((response) => {
this.tableConfig.fieldList = _.cloneDeep(response) this.tableConfig.fieldList = _.cloneDeep(response)
}) })
}, },
// 获取列表数据 // 获取列表数据
getTableData () {} getTableData () {
let queryParams = {
searchCode: this.currentSearchCode,
filters: this.searchList.filters || [],
pageSize: this.tableConfig.paginationConfig.pageSize,
pageNum: this.tableConfig.paginationConfig.currentPage
}
queryParams.filters.push({
fieldCode: 'workshopCode',
fieldType: 'STRING',
value: this.currentWorkshopCode
})
return new Promise((resolve, reject) => {
this.$fetch('equipment-controller/data-post', queryParams).then((response) => {
this.tableConfig.data = _.cloneDeep(response.list)
this.tableConfig.paginationConfig.total = _.cloneDeep(response.total)
resolve()
})
})
},
// 表格组件分页数量改变事件
onPageSizeChange (pageSize) {
this.tableConfig.paginationConfig.currentPage = 1
this.tableConfig.paginationConfig.pageSize = pageSize
// 获取列表数据
this.getTableData()
},
// 表格组件分页页数改变事件
onCurrentPageChange (currentPage) {
this.tableConfig.paginationConfig.currentPage = currentPage
// 获取列表数据
this.getTableData()
},
// 点击导出按钮
async doExportClick () {
let queryParams = {
searchCode: this.currentSearchCode,
filters: this.searchList.filters || []
}
queryParams.filters.push({
fieldCode: 'workshopCode',
fieldType: 'STRING',
value: this.currentWorkshopCode
})
try {
let response = await request({
url: `${process.env.API_HOST}/api/equipment/data/export`,
data: queryParams,
method: 'post',
responseType: 'blob'
})
if (response.status === 200) {
let objectUrl = URL.createObjectURL(response.data)
const link = document.createElement('a')
link.download = decodeURI(response.headers.filename)
link.href = objectUrl
link.click()
window.URL.revokeObjectURL(objectUrl)
} else {
this.$message.error(response.message)
}
} catch (error) {
console.log(error)
}
}
}, },
mounted () { mounted () {
setTimeout(() => { setTimeout(() => {
this.treeHeight = { 'height': `${document.body.offsetHeight - 180}px` } this.treeHeight = { 'height': `${document.body.offsetHeight - 180}px` }
this.tableConfig.height = document.querySelector('.page-pack').offsetHeight - 180 this.tableConfig.height = document.querySelector('.page-pack').offsetHeight - 205
this.$refs.sortTree.setCurrentKey(this.sortTreeData[0].id) this.$refs.sortTree.setCurrentKey(this.sortTreeData[0].id)
this.currentSort = _.cloneDeep(this.sortTreeData[0]) this.currentSort = _.cloneDeep(this.sortTreeData[0])
this.currentSearchCode = _.cloneDeep(this.sortTreeData[0].code)
// 搜索组件渲染开启
this.searchComponentRenderToggle = true
// 获取列表表头展示字段 // 获取列表表头展示字段
this.getTableLabel() this.getTableLabel()
// 获取列表数据
this.getTableData()
}, 0) }, 0)
} }
} }
...@@ -163,7 +287,7 @@ ...@@ -163,7 +287,7 @@
// 左侧类别树 // 左侧类别树
.tree-pack { .tree-pack {
position: absolute; position: absolute;
width: 300px; width: 250px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
...@@ -177,10 +301,11 @@ ...@@ -177,10 +301,11 @@
// 显示区域 // 显示区域
.view-pack { .view-pack {
margin-left: 310px; margin-left: 260px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
overflow-y: auto;
.title-pack { .title-pack {
height: 38px; height: 38px;
......
...@@ -70,19 +70,23 @@ ...@@ -70,19 +70,23 @@
sortTreeData: [ sortTreeData: [
{ {
id: 1, id: 1,
label: '检测线' label: '检测线',
code: 'CHECK_LINE'
}, },
{ {
id: 2, id: 2,
label: '充电桩' label: '充电桩',
code: 'CHARGING_PILE'
}, },
{ {
id: 3, id: 3,
label: '动静态测试' label: '动静态测试',
code: 'DYNAMIC_STATIC_TEST'
}, },
{ {
id: 4, id: 4,
label: '加氢站' label: '加氢站',
code: 'HYDROGEN_STATIONVoc'
} }
], ],
// 设备分类树高度 // 设备分类树高度
...@@ -136,7 +140,7 @@ ...@@ -136,7 +140,7 @@
// 左侧类别树 // 左侧类别树
.tree-pack { .tree-pack {
position: absolute; position: absolute;
width: 300px; width: 250px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
...@@ -150,10 +154,11 @@ ...@@ -150,10 +154,11 @@
// 显示区域 // 显示区域
.view-pack { .view-pack {
margin-left: 310px; margin-left: 260px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
overflow-y: auto;
.title-pack { .title-pack {
height: 38px; height: 38px;
......
...@@ -70,19 +70,23 @@ ...@@ -70,19 +70,23 @@
sortTreeData: [ sortTreeData: [
{ {
id: 1, id: 1,
label: '车顶自动点焊' label: '车顶自动点焊',
code: 'AUTOMATIC_SPOT_WELDING'
}, },
{ {
id: 2, id: 2,
label: 'PLC数控合装胎' label: 'PLC数控合装胎',
code: 'PLC_CONTROL_TIRE'
}, },
{ {
id: 3, id: 3,
label: '板链' label: '板链',
code: 'PLATE_CHAIN'
}, },
{ {
id: 4, id: 4,
label: '旋转辊床' label: '旋转辊床',
code: 'ROTARY_ROLLER_BED'
} }
], ],
// 设备分类树高度 // 设备分类树高度
...@@ -136,7 +140,7 @@ ...@@ -136,7 +140,7 @@
// 左侧类别树 // 左侧类别树
.tree-pack { .tree-pack {
position: absolute; position: absolute;
width: 300px; width: 250px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
...@@ -150,10 +154,11 @@ ...@@ -150,10 +154,11 @@
// 显示区域 // 显示区域
.view-pack { .view-pack {
margin-left: 310px; margin-left: 260px;
height: 100%; height: 100%;
border: 1px solid #d2d3d5; border: 1px solid #d2d3d5;
background-color: #fff; background-color: #fff;
overflow-y: auto;
.title-pack { .title-pack {
height: 38px; height: 38px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment