378 lines
14 KiB
Vue
378 lines
14 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-card style="padding: 3px">
|
|
<el-input v-model="equipmentName" placeholder="设备名称" size="small" clearable style="width:200px;margin-left: 0px"/>
|
|
<el-button type="primary" icon="el-icon-search" size="small" style="margin-left: 20px" plain @click="PageSize = 10;PageCurrent = 1;fetchData()">查询</el-button>
|
|
<el-tooltip effect="dark" content="添加新设备" placement="top">
|
|
<el-button class="button111" icon="el-icon-circle-plus-outline" size="small" style="margin-left: 10px" @click="ADD()">设备</el-button>
|
|
</el-tooltip>
|
|
</el-card>
|
|
|
|
<el-card>
|
|
<el-table :data="List" border size="small" stripe highlight-current-row height="840px" style="width: 750px">
|
|
<el-table-column label="设备名称" prop="设备名称" align="center" width="150px" >
|
|
<template slot-scope="scope">
|
|
{{ scope.row.设备名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="设备编号" prop="设备编号" align="center">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.设备编号 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="设备型号" rop="设备型号" align="center" width="150px" >
|
|
<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="100px">
|
|
<template slot-scope="scope">
|
|
<el-button type="text" size="mini" icon="el-icon-edit" style="margin-left:5px" @click="handleEdit(scope.row)"/>
|
|
<el-button type="text" size="mini" icon="el-icon-delete" style="margin-left:5px" @click="handleDelete(scope.row)"/>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
|
|
<el-dialog v-el-drag-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="700px">
|
|
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="110px" class="demo-ruleForm">
|
|
<el-row>
|
|
<el-col :span = "12">
|
|
<el-form-item label="设备名称" prop="设备名称" >
|
|
<el-input v-model="form.设备名称" placeholder="设备名称" size="small" style="width:200px" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span = "12">
|
|
<el-form-item label="设备编号" prop="设备编号" >
|
|
<el-input v-model="form.设备编号" placeholder="设备编号" size="small" style="width:200px" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span = "12">
|
|
<el-form-item label="设备型号" prop="设备型号" >
|
|
<el-input v-model="form.设备型号" placeholder="设备型号" size="small" style="width:200px" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span = "12">
|
|
<el-form-item label="设备加工工艺" prop="设备加工工艺" >
|
|
<el-select v-model="form.设备加工工艺" placeholder="设备加工工艺" filterable size="small" style="width:200px" clearable >
|
|
<el-option
|
|
v-for="item in processingName"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row v-show="false">
|
|
<el-col :span = "12">
|
|
<el-form-item label="设备加工能力" prop="设备加工能力" >
|
|
<el-input v-model="form.设备加工能力" placeholder="设备加工能力" size="small" style="width:200px" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span = "12">
|
|
<el-form-item label="设备性能指标" prop="设备性能指标" >
|
|
<el-input v-model="form.设备性能指标" placeholder="设备性能指标" size="small" style="width:200px" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row v-show="false">
|
|
<el-col :span = "12">
|
|
<el-form-item label="班次类型" prop="班次类型" >
|
|
<el-select v-model="form.班次类型" placeholder="班次类型" size="small" style="width:200px" clearable >
|
|
<el-option
|
|
v-for="item in typeOfShift"
|
|
: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-input v-model="form.设备工时系数" placeholder="设备工时系数" size="small" style="width:200px" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row v-show="false">
|
|
<el-col :span = "12">
|
|
<el-form-item label="整改工时系数" prop="整改工时系数" >
|
|
<el-input v-model="form.整改工时系数" placeholder="整改工时系数" size="small" style="width:200px" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span = "12">
|
|
<el-form-item label="预留工时系数" prop="预留工时系数" >
|
|
<el-input v-model="form.预留工时系数" placeholder="预留工时系数" size="small" style="width:200px" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="callOff('form')">取消</el-button>
|
|
<el-button :disabled="ADD_disable" type="primary" @click="submit('form')">确定</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
import { getData, initProcessing, addTable, editTable, deleteTable, setUp, generate } from '@/api/ManufacturingCenter/WorkshopEquipmentManagement'
|
|
import { getNowTime } from '@/utils/tool'
|
|
export default {
|
|
data() {
|
|
return {
|
|
ADD_disable: false,
|
|
equipmentName: '', // 设备名称
|
|
List: [],
|
|
check: 0,
|
|
time: '',
|
|
pageCurrent: 1,
|
|
pageSize: 10,
|
|
total: null,
|
|
title: '',
|
|
dialogFormVisible: false,
|
|
processingName: [],
|
|
processing1: '', // 工艺名称简称
|
|
equipmentSerialNumber: '', // 设备流水号
|
|
typeOfShift: [
|
|
{ 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: '请输入设备名称', change: 'blur' }],
|
|
设备编号: [{ required: true, message: '请输入设备编号', change: 'blur' }],
|
|
设备型号: [{ required: true, message: '请输入设备型号', change: 'blur' }],
|
|
设备加工工艺: [{ required: true, message: '请选择设备加工工艺', trigger: 'blur' }]
|
|
// 设备加工能力: [{ required: true, message: '请选择设备加工能力', change: 'blur' }],
|
|
// 班次类型: [{ required: true, message: '请选择班次类型', trigger: 'blur' }],
|
|
// 设备工时系数: [{ required: true, message: '请选择设备工时系数', change: 'blur' }],
|
|
// 整改工时系数: [{ required: true, message: '请选择整改工时系数', change: 'blur' }],
|
|
// 预留工时系数: [{ required: true, message: '请选择预留工时系数', change: 'blur' }]
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
this.initialization()
|
|
this.fetchData()
|
|
},
|
|
methods: {
|
|
fetchData() {
|
|
this.List = []
|
|
if (this.equipmentName !== '') {
|
|
this.check = 1
|
|
} else {
|
|
this.check = 0
|
|
}
|
|
getData(this.check, this.equipmentName, this.pageCurrent, this.pageSize).then(response => {
|
|
this.List = response.data
|
|
})
|
|
},
|
|
initialization() {
|
|
initProcessing().then(response => {
|
|
for (let i = 0; i < response.data.length; i++) {
|
|
this.processingName.push({
|
|
label: response.data[i].工艺名称,
|
|
value: response.data[i].工艺编号,
|
|
processing: response.data[i].工艺名称简称
|
|
})
|
|
}
|
|
})
|
|
},
|
|
handleAdd() {
|
|
if (this.$refs['form'] !== undefined) {
|
|
this.$refs['form'].resetFields()
|
|
}
|
|
this.title = '新增设备'
|
|
this.form = {
|
|
设备名称: '',
|
|
设备编号: '',
|
|
设备型号: '',
|
|
设备加工工艺: ''
|
|
}
|
|
this.form.设备性能指标 = 1
|
|
this.form.设备加工能力 = 1
|
|
this.form.班次类型 = 1
|
|
this.form.设备工时系数 = 1
|
|
this.form.整改工时系数 = 0
|
|
this.form.预留工时系数 = 0
|
|
this.dialogFormVisible = true
|
|
},
|
|
handleEdit(row) {
|
|
if (this.$refs['form'] !== undefined) {
|
|
this.$refs['form'].resetFields()
|
|
}
|
|
this.title = '编辑设备'
|
|
this.form.设备名称 = row.设备名称
|
|
this.form.设备编号 = row.设备编号
|
|
this.form.设备型号 = row.设备型号
|
|
this.form.设备性能指标 = row.设备性能指标
|
|
this.form.设备加工能力 = row.设备加工能力工时
|
|
this.form.设备加工工艺 = parseInt(row.工艺属性代码)
|
|
this.form.班次类型 = row.班次类型
|
|
this.form.设备工时系数 = row.设备工时系数
|
|
this.form.整改工时系数 = row.整改工时比例
|
|
this.form.预留工时系数 = row.设备预留工时系数
|
|
this.equipmentSerialNumber = row.设备流水号
|
|
this.ADD_disable = false
|
|
this.dialogFormVisible = true
|
|
},
|
|
submit(formName) {
|
|
this.$refs[formName].validate((valid) => {
|
|
if (valid) {
|
|
if (this.title === '新增设备') {
|
|
this.submitAdd()
|
|
} else if (this.title === '编辑设备') {
|
|
this.submitEdit()
|
|
}
|
|
}
|
|
})
|
|
},
|
|
submitAdd() {
|
|
this.ADD_disable = true
|
|
for (let i = 0; i < this.processingName.length; i++) {
|
|
if (this.form.设备加工工艺 === this.processingName[i].value) {
|
|
this.processing1 = this.processingName[i].processing
|
|
}
|
|
}
|
|
addTable(this.form.设备名称, this.form.设备型号, this.form.设备性能指标, this.form.设备加工能力, this.form.设备工时系数, this.processing1, this.form.设备加工工艺, this.form.班次类型, this.form.整改工时系数, this.form.设备编号, this.form.预留工时系数).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$notify({
|
|
title: '成功',
|
|
message: '信息添加成功',
|
|
type: 'success'
|
|
})
|
|
this.dialogFormVisible = false
|
|
this.fetchData()
|
|
} else {
|
|
this.ADD_disable = false
|
|
this.$message.error('信息添加失败')
|
|
}
|
|
})
|
|
},
|
|
ADD() {
|
|
this.addForm('form')
|
|
this.form.contractSigningDate = getNowTime()// new Date()
|
|
this.temp = 1
|
|
this.title = '新增设备'
|
|
this.ADD_disable = false
|
|
this.dialogFormVisible = true
|
|
},
|
|
submitEdit() {
|
|
this.ADD_disable = true
|
|
editTable(this.equipmentSerialNumber, this.form.设备名称, this.form.设备型号, this.form.设备性能指标, this.form.设备加工能力, this.form.设备工时系数, this.form.班次类型, this.form.设备加工工艺, this.form.整改工时系数, this.form.设备编号, this.form.预留工时系数).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$notify({
|
|
title: '成功',
|
|
message: '信息编辑成功',
|
|
type: 'success'
|
|
})
|
|
this.dialogFormVisible = false
|
|
this.title = ''
|
|
this.fetchData()
|
|
} else {
|
|
this.ADD_disable = false
|
|
this.$message.error('信息编辑失败')
|
|
}
|
|
})
|
|
},
|
|
callOff(formName) {
|
|
this.dialogFormVisible = false
|
|
this.$refs[formName].resetFields()
|
|
},
|
|
handleDelete(row) {
|
|
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
if (this.List && this.List.length === 1 && this.pageCurrent > 1) {
|
|
this.pageCurrent--
|
|
}
|
|
deleteTable(row.设备流水号).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('删除成功')
|
|
this.fetchData()
|
|
} else { this.$message.error('删除失败') }
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消删除'
|
|
})
|
|
})
|
|
},
|
|
setUp() {
|
|
if (this.time !== '') {
|
|
setUp(this.time).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('设定成功')
|
|
} else { this.$message.error('设定失败') }
|
|
})
|
|
} else {
|
|
this.$message.warning('请选择有效时间')
|
|
}
|
|
},
|
|
generate() {
|
|
generate().then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('生成成功')
|
|
} else { this.$message.error('生成失败') }
|
|
})
|
|
},
|
|
handleSizeChange(val) {
|
|
this.pageSize = val
|
|
this.pageCurrent = 1
|
|
this.fetchData()
|
|
},
|
|
handleCurrentChange(val) {
|
|
this.pageCurrent = val
|
|
this.fetchData()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
.el-card{
|
|
margin-bottom: 1px;
|
|
}
|
|
</style>
|
|
<style lang="scss">
|
|
.button111{
|
|
background:rgb(253,246,236);
|
|
border-color: #ff9759;
|
|
color: #ff9759;
|
|
&:hover{
|
|
background: #ff9759;
|
|
border-color: #ff9759;
|
|
color: white;
|
|
}
|
|
&:focus{
|
|
background: #ff9759;
|
|
border-color: #ff9759;
|
|
color: white;
|
|
}
|
|
}
|
|
</style>
|