典型工艺维护:分页

This commit is contained in:
chenjianan
2018-11-24 10:35:48 +08:00
parent dd02774695
commit 6e1dd7193a
2 changed files with 68 additions and 39 deletions

View File

@@ -23,14 +23,15 @@ export function getPartsName(num) {
})
}
export function getTableData(partsCategoriesCheck, partsCategories, partsNameCheck, partsName) {
export function getTableData(pageCurrent, pageSize, partsCategoriesCheck, partsCategories, partsNameCheck, partsName) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '车间生产管理工艺_基础表_典型工艺名称_查询数据_综合查询',
param: `典型工艺名称分类流水号_check=${partsCategoriesCheck}&典型工艺名称分类流水号=${partsCategories}&典型工艺流水号_check=${partsNameCheck}&典型工艺流水号=${partsName}&典型工艺流水号1_check=0`
param: `典型工艺名称分类流水号_check=${partsCategoriesCheck}&典型工艺名称分类流水号=${partsCategories}&典型工艺流水号_check=${partsNameCheck}&典型工艺流水号=${partsName}&典型工艺流水号1_check=0`,
Pagination: pageCurrent + '&' + pageSize
}
})
}

View File

@@ -2,38 +2,36 @@
<template>
<div class="app-container">
<el-card>
<div style="margin-top: -10px;">
<el-row>
<span>零件分类:</span>
<el-select v-model="partsCategoriesValue" size="small" filterable clearable placeholder="零件分类" @change="getPartsName">
<el-option
v-for="item in partsCategories"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件名称:</span>
<el-select v-model="partsNameValue" size="small" filterable clearable placeholder="零件名称" @change="getTableData" >
<el-option
v-for="item in partsName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>典型工艺号:</span>
<el-input v-model="typicalNumValue" auto-complete="off" style="width: 200px" size="small" />
<el-button size="small" type="primary" icon="el-icon-search" style="margin: 10px 0 0 10px" @click="getTableData">查询</el-button>
<el-button size="small" type="info" icon="el-icon-circle-plus-outline" style="margin: 10px 0 0 10px" @click="addTableData">增加</el-button>
<el-button size="small" type="success" icon="el-icon-cjn-09" style="margin: 10px 0 0 10px" @click="editConfirm">保存</el-button>
</el-row>
</div>
<span>零件分类:</span>
<el-select v-model="partsCategoriesValue" size="small" filterable clearable placeholder="零件分类" @change="getPartsName">
<el-option
v-for="item in partsCategories"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件名称:</span>
<el-select v-model="partsNameValue" size="small" filterable clearable placeholder="零件名称" @change="getTableData" >
<el-option
v-for="item in partsName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>典型工艺号:</span>
<el-input v-model="typicalNumValue" auto-complete="off" style="width: 100px" size="small" readonly/>
<el-button size="small" type="success" icon="el-icon-search" style="margin-left: 10px" @click="total=0;pageCurrent=1;pageSize=20;getTableData()">查询</el-button>
<el-button size="small" type="primary" icon="el-icon-circle-plus-outline" style="margin-left: 10px" @click="addTableData">增加</el-button>
<el-button size="small" type="warning" icon="el-icon-menu" style="margin-left: 10px" @click="editConfirm">保存</el-button>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" border style="width: 100%;max-height: 550px;" size="mini" height="550px">
<el-table-column prop="num" label="序号" width="50" align="center" type="index"/>
<el-table-column prop="num" label="序号" width="50" align="center" type="index">
<template slot-scope="scope">
{{ scope.row.工艺序号 }}
</template>
</el-table-column>
<el-table-column prop="name" label="工艺名称" width="230" align="center">
<template slot-scope="scope">
<el-input
@@ -66,12 +64,12 @@
</el-table-column>
<el-table-column prop="name" label="单件" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.单件定额工时" style="width:90px" placeholder="单件定额"/>
<el-input v-model="scope.row.单件定额工时" size="mini" style="width:90px" placeholder="单件定额"/>
</template>
</el-table-column>
<el-table-column prop="name" label="准结" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.准结定额工时" style="width:90px" placeholder="准结定额"/>
<el-input v-model="scope.row.准结定额工时" size="mini" style="width:90px" placeholder="准结定额"/>
</template>
</el-table-column>
<el-table-column label="操作" width="300" align="center" fixed="right">
@@ -101,6 +99,16 @@
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[20, 30, 40, 50]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible" title="工艺名称、工艺要求选择" center width="400px">
@@ -145,6 +153,9 @@ import { getPartsCategories, getPartsName, getTableData, upMove, downMove, deleR
export default {
data() {
return {
pageCurrent: 1,
pageSize: 20,
total: 0,
partsCategories: [],
partsCategoriesCheck: null,
partsCategoriesValue: '',
@@ -181,7 +192,7 @@ export default {
getPartsName(this.partsCategoriesValue).then(res => {
const data = res.data
data.length > 0 ? this.partsNameValue = data[0].典型工艺流水号 : this.partsNameValue = ''
this.typicalNumValue = data[0].典型工艺号
this.typicalNumValue = data.length > 0 ? data[0].典型工艺号 : ''
data.map(item => {
this.partsName.push({
label: item.典型工艺名称,
@@ -193,11 +204,25 @@ export default {
getTableData() {
this.partsCategoriesValue ? this.partsCategoriesCheck = 1 : this.partsCategoriesCheck = 0
this.partsNameValue ? this.partsNameCheck = 1 : this.partsNameCheck = 0
this.loading = true
getTableData(this.partsCategoriesCheck, this.partsCategoriesValue, this.partsNameCheck, this.partsNameValue).then(res => {
this.loading = false
this.tableData = res.data
})
if (this.partsCategoriesCheck === 0 && this.partsNameCheck === 0) {
this.$message.error('请选择查询条件')
} else {
this.loading = true
getTableData(this.pageCurrent, this.pageSize, this.partsCategoriesCheck, this.partsCategoriesValue, this.partsNameCheck, this.partsNameValue).then(res => {
this.loading = false
this.tableData = res.data.rows
this.total = res.data.total
})
}
},
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.getTableData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.getTableData()
},
upMove(row) {
upMove(row.典型工艺流水号, row.典型工艺工序流水号).then(res => {
@@ -234,7 +259,7 @@ export default {
if (res.data[0].result === '1') {
index++
} else {
this.$message.error('零件保存失败')
this.$message.error('零件工艺保存失败')
}
if (index === this.tableData.length) {
this.$message.success('保存修改成功')
@@ -302,4 +327,7 @@ export default {
span{
margin: 20px;
}
.el-card{
margin-bottom: 15px;
}
</style>