Files
JY1.0/src/views/BasicData/EquipmentCapabilitySetting/index.vue
2018-11-23 16:34:20 +08:00

306 lines
12 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container">
<el-card>
<span>设备名称</span>
<el-input v-model="equipmentName" clearable size="small" style="width:200px;margin:10px;"/>
<el-button type="success" class="el-icon-search" size="small" @click="pageCurrent=1;pageSize=10;searchTable()">查询</el-button>
<el-button type="primary" class="el-icon-circle-plus-outline" size="small" @click="handleAdd('form');param = 0">新增</el-button>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" height="580" style="width: 100%;" border highlight-current-row>
<el-table-column
label=" "
align="center"
type="index"
width="50"/>
<el-table-column label="设备名称" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.设备名称 }}
</template>
</el-table-column>
<el-table-column label="设备编号" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.设备编号 }}
</template>
</el-table-column>
<el-table-column label="设备型号" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.设备型号 }}
</template>
</el-table-column>
<el-table-column label="设备性能指标" align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.设备性能指标 }}
</template>
</el-table-column>
<el-table-column label="设备加工能力" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.设备加工能力工时 }}
</template>
</el-table-column>
<el-table-column label="设备工时系数" align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.设备工时系数 }}
</template>
</el-table-column>
<el-table-column label="设备加工工艺" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.工艺属性 }}
</template>
</el-table-column>
<el-table-column label="班次类型" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.班次类型 }}
</template>
</el-table-column>
<el-table-column label="整改工时系数" align="center">
<template slot-scope="scope">
{{ scope.row.整改工时比例 }}
</template>
</el-table-column>
<el-table-column label="预留工时系数" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.设备预留工时系数 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200px" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
class="el-icon-edit"
@click="handleEdit(scope.row);param = 1">编辑</el-button>
<el-button
size="mini"
type="danger"
class="el-icon-delete"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :title="title" :visible.sync="dialogFormVisible" center width="800px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm" style="margin: auto">
<el-row>
<el-col :span="12">
<el-form-item label="设备名称" prop="设备名称">
<el-input v-model="form.设备名称" placeholder="设备名称" clearable size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备型号" prop="设备型号">
<el-input v-model="form.设备型号" placeholder="设备型号" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="性能指标" prop="设备性能指标">
<el-input v-model="form.设备性能指标" placeholder="性能指标" clearable size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="加工能力" prop="设备加工能力工时">
<el-input v-model="form.设备加工能力工时" placeholder="加工能力" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="整改工时系数" prop="整改工时比例">
<el-input v-model="form.整改工时比例" placeholder="设备整改工时系数" clearable size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编号" prop="设备编号">
<el-input v-model="form.设备编号" placeholder="设备编号" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工艺" prop="工艺属性代码">
<el-select v-model="form.工艺属性代码" filterable size="small" style="width:230px;">
<el-option
v-for="item in Technology"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班次类型" prop="班次类型">
<el-select v-model="form.班次类型" filterable size="small" style="width:230px;">
<el-option
v-for="item in ClassType"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工时系数" prop="设备工时系数">
<el-input v-model="form.设备工时系数" placeholder="工时系数" clearable size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="预留工时系数" prop="设备预留工时系数">
<el-input v-model="form.设备预留工时系数" placeholder="设备预留工时系数" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff()">取消</el-button>
<el-button v-show="title==='增加'" type="primary" @click="submitAdd()">确定</el-button>
<el-button v-show="title==='编辑'" type="primary" @click="submitEdit()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getTechnology, searchtable, edittype, handlechange, handledelete } from '@/api/BasicData/EquipmentCapabilitySetting'
export default {
data() {
return {
equipmentNum: '',
num1: '',
equipmentName: '',
loading: false,
tableData: [], // 表格数据
pageSize: 10,
pageCurrent: 1,
total: 0,
dialogFormVisible: false,
title: '',
Technology: [],
ClassType: [{
value: 0,
label: 0
}, {
value: 1,
label: 1
}, {
value: 2,
label: 2
}, {
value: 3,
label: 3
}, {
value: 4,
label: 4
}],
form: {
设备名称: '', // 设备名称
设备型号: '', // 设备型号
设备性能指标: '', // 性能指标
设备加工能力工时: '', // 加工能力
整改工时比例: '', // 设备整改工时指数
设备编号: '', // 设备编号
工艺属性代码: '', // 工艺
班次类型: '', // 班次类型
设备工时系数: '', // 工时系数
设备预留工时系数: '' // 设备预留工时系数
},
rules: {
设备名称: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
设备型号: [{ required: true, message: '请输入设备型号', trigger: 'blur' }],
设备性能指标: [{ required: true, message: '请输入性能指标', trigger: 'blur' }],
设备加工能力工时: [{ required: true, message: '请输入加工能力', trigger: 'blur' }],
整改工时比例: [{ required: true, message: '请输入设备整改工时指数', trigger: 'blur' }],
设备编号: [{ required: true, message: '请输入设备编号', trigger: 'blur' }],
工艺属性代码: [{ required: true, message: '请选择工艺', trigger: 'change' }],
班次类型: [{ required: true, message: '请选择班次类型', trigger: 'change' }],
设备工时系数: [{ required: true, message: '请输入工时系数', trigger: 'blur' }],
设备预留工时系数: [{ required: true, message: '请输入设备预留工时系数', trigger: 'blur' }]
}
}
},
created() {
this.searchTable()
this.fetchData()
},
methods: {
// 初始化获取工艺
fetchData() {
this.getSelect(getTechnology, ['工艺名称', '工艺编号'], 'Technology')
},
// 查询
searchTable() {
this.loading = true
this.equipmentName ? this.num1 = 1 : this.num1 = 0
this.getTable(searchtable, [this.pageCurrent, this.pageSize, this.num1, this.equipmentName], ['tableData', 'total', 'loading'])
},
// 点击增加
handleAdd() {
this.dialogFormVisible = true
this.title = '增加'
this.addForm('form')
},
// 增加确定
submitAdd() {
this.addTable(edittype, [this.form.设备名称, this.form.设备型号, this.form.设备性能指标, this.form.设备工时系数, this.form.工艺属性代码, this.form.班次类型, this.form.设备加工能力工时, this.form.整改工时比例, this.form.设备编号, this.form.设备预留工时系数], 'form', function() { this.searchTable(); this.dialogFormVisible = false })
},
// 编辑打开
handleEdit(row) {
this.dialogFormVisible = true
this.title = '编辑'
this.equipmentNum = row.设备流水号
this.editForm(row, 'form')
},
// 编辑确定
submitEdit() {
this.editTable(handlechange, [this.equipmentNum, this.form.设备名称, this.form.设备型号, this.form.设备性能指标, this.form.设备工时系数, this.form.工艺属性代码, this.form.班次类型, this.form.设备加工能力工时, this.form.整改工时比例, this.form.设备编号, this.form.设备预留工时系数], 'form', function() { this.searchTable(); this.dialogFormVisible = false })
},
// 重置表单
callOff() {
this.dialogFormVisible = false
},
// 删除
handleDelete(index, row) {
this.deleteRow(handledelete, row.设备流水号, function() { this.searchTable() })
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-input{
width: 200px!important;
}
</style>