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

fea(焊装车间): 焊装车间联调完成

parent c09d2284
......@@ -38,16 +38,27 @@
</div>
<div class="tool-pack clear-float pl-15 pr-15">
<Search
searchCode="MATERIEL_TYPE"
v-if="searchComponentRenderToggle"
:searchCode="currentSearchCode"
@search="doSearchClick"
@reset="doResetClick">
</Search>
<div class="float-left">
<el-button
size="small"
type="primary"
@click="doExportClick">
导出
</el-button>
</div>
</div>
<div class="general-list-main-pack pl-15 pr-15">
<div>
<Table
:tableConfig="tableConfig">
</Table>
<PreviewTable
:tableConfig="tableConfig"
@onPageSizeChange="onPageSizeChange"
@onCurrentPageChange="onCurrentPageChange">
</PreviewTable>
</div>
</div>
</div>
......@@ -55,13 +66,14 @@
</template>
<script>
import Table from '@/components/Table/index.vue'
import PreviewTable from '@/components/PreviewTable'
import Search from '@/components/Search'
import request from '@/utils/request'
export default {
name: 'Welding',
components: {
Table,
PreviewTable,
Search
},
data () {
......@@ -89,10 +101,18 @@
code: 'ROTARY_ROLLER_BED'
}
],
// 搜索组件关键字列表
searchList: {},
// 设备分类树高度
treeHeight: {},
// 当前选中分类
currentSort: {},
// 当前设备searchcode
currentSearchCode: '',
// 当前车间code
currentWorkshopCode: 'WELDING',
// 是否重新加载搜索组件
searchComponentRenderToggle: false,
// 表格配置项
tableConfig: {
height: 0,
......@@ -109,22 +129,129 @@
},
methods: {
// 点击刷新按钮
doRefreshClick () {},
doRefreshClick () {
this.getTableData().then(() => {
this.$message.success('刷新成功!')
})
},
// 点击分类树
doSortTreeClick (treeNode) {
this.currentSort = _.cloneDeep(treeNode)
this.currentSearchCode = 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 () {
let queryParams = { searchCode: this.currentSearchCode }
this.$fetch('show-field-controller/showField-get', queryParams).then((response) => {
this.tableConfig.fieldList = _.cloneDeep(response)
})
},
// 获取列表数据
getTableData () {
let queryParams = {
searchCode: this.currentSearchCode,
filters: _.cloneDeep(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()
},
// 点击程序下发按钮
doProgramIssuedClick () {
this.$refs.ProgramIssued.dialogToggle = true
},
// 点击导出按钮
async doExportClick () {
let queryParams = {
searchCode: this.currentSearchCode,
filters: _.cloneDeep(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 () {
setTimeout(() => {
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.currentSort = _.cloneDeep(this.sortTreeData[0])
this.currentSearchCode = _.cloneDeep(this.sortTreeData[0].code)
// 搜索组件渲染开启
this.searchComponentRenderToggle = true
// 获取列表表头展示字段
this.getTableLabel()
// 获取列表数据
this.getTableData()
}, 0)
}
}
......
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