You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

459 lines
12 KiB

<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item
label="冲孔机编号"
prop="punchNo"
>
<el-input
v-model="queryParams.punchNo"
placeholder="请输入冲孔机编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item
label="冲孔机名称"
label-width="95px"
prop="punchName"
>
<el-input
v-model="queryParams.punchName"
placeholder="输入冲孔机名称"
clearable
>
</el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button>
</el-form-item>
</el-form>
<div class="opt-box">
<div class="opt-box-right">
<el-button
type="primary"
@click="handleAdd"
>新增</el-button>
</div>
</div>
<div class="layout-full">
<heavy-table
class="heavy-table tablem"
highlight-current-row
:data="BasePunchList"
:loading="loading"
:paging="paging"
:config="tableConfig"
:tableProps="tableProps"
@current-change="handleCurrentChange"
@handleUpdate="handleUpdate"
@handleDelete="handleDelete"
@handleTask="handleTask"
>
</heavy-table>
</div>
<!-- 添加或修改区域对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="900px"
append-to-body
>
<el-form
ref="form"
:model="form"
:rules="rules"
style="width: 850px;"
label-width="110px"
>
<el-row>
<el-col :span="12">
<el-form-item
label="冲孔机编号"
prop="punchNo"
>
<el-input
v-model="form.punchNo"
placeholder="请输入设备编码"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="设备名称"
prop="punchName"
>
<el-input
v-model="form.punchName"
placeholder="请输入设备名称"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
placeholder="请输入冲孔模式"
label="冲孔模式"
prop="isState"
>
<el-select
v-model="form.isState"
placeholder="冲孔模式类型"
style="width: 100%;"
clearable
>
<el-option
v-for="item in dict.type.punch_state_dict"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="最大任务量"
prop="maxTask"
>
<el-input
v-model="form.maxTask"
placeholder="请输入最大任务量"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="是否可用"
prop="isActive"
>
<el-select
v-model="form.isActive"
placeholder="请选择"
style="width: 100%;"
clearable
>
<el-option
label="停用"
value="0"
/>
<el-option
label="启用"
value="1"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="单次冲孔数量"
prop="punchQty"
>
<el-input
v-model="form.punchQty"
placeholder="单次冲孔数量(手动是每次冲孔数量)"
>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="备注"
prop="remaks"
>
<el-input
v-model="form.remaks"
placeholder="默认输入提示"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div
slot="footer"
class="dialog-footer"
>
<el-button
type="primary"
@click="submitForm"
>确 定</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { queryBasePunchList, getWcsDeviceId, getBasePunchInfo, addBasePunch, updateBasePunch, delBasePunch } from '@/api/wcs/base/eyeletMachine.js'
export default {
name: 'Configuration',
dicts: ['punch_state_dict', 'application_type_dict'],
data() {
const _that = this
return {
paging: {
page: 1, // 当前页
size: 10, // 页面大小
total: 0
},
tableConfig: [
{
label: '序号',
prop: 'index',
type: 'index',
istrue: true
},
{
label: '冲孔机编号',
prop: 'punchNo',
istrue: true
},
{
label: '冲孔机名称',
prop: 'punchName',
istrue: true
},
{
label: '是否启用',
prop: 'isActive',
istrue: true,
filter(row) {
if (row.isActive === '0') {
return '停用'
} else if (row.isActive === '1') {
return '启用'
} else {
return '--'
}
}
},
{
label: '冲孔模式',
prop: 'isState',
istrue: true,
filter(row, value) {
return _that.getDictLabel(value, _that.dict.type.punch_state_dict)
}
},
{
label: '单次冲孔数量',
prop: 'punchQty',
istrue: true
},
{
label: '备注',
prop: 'remaks',
istrue: true
},
{
label: '最大任务量',
prop: 'maxTask',
istrue: true
},
{
label: '操作',
prop: 'operating',
istrue: true,
type: 'button',
width: 180,
fixed: 'right',
buttons: [
{
name: '任务下发',
event: 'handleTask'
},
{
name: '编辑',
event: 'handleUpdate'
},
{
name: '删除',
event: 'handleDelete'
}
]
}
],
tableProps: {
'max-height': 700
},
// 遮罩层
loading: true,
// 显示搜索条件
showSearch: true,
// 区域表格数据
BasePunchList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
devName: null
},
// 表单参数
form: {},
// 表单校验
rules: {
devNo: [{ required: true, trigger: 'blur', message: '请输入设备编码' }],
devName: [{ required: true, trigger: 'blur', message: '请输入设备名称' }],
devType: [{ required: true, trigger: 'change', message: '请选择设备类型' }],
devDirection: [{ required: true, trigger: 'change', message: '请选择应用类型' }],
tunnel: [{ required: true, trigger: 'change', message: '请选择巷道' }],
isActive: [{ required: true, trigger: 'change', message: '请选择是否可用' }]
}
}
},
created() {
this.getList()
console.log(this.dict.type.punch_state_dict)
},
methods: {
// 分页
handleCurrentChange(val) {
if (Object.prototype.toString.call(val) === '[object Object]') {
this.queryParams.pageSize = val.size
this.paging.size = val.size
this.getList()
} else {
this.paging.page = val
this.queryParams.pageNum = val
this.getList()
}
},
/** 查询区域列表 */
getList() {
this.loading = true
queryBasePunchList(this.queryParams).then((response) => {
this.BasePunchList = response.rows
this.paging.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
id: null,
devName: null,
equipmentStatus: null
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
handleTask(row) {
console.log('点我触发任务')
},
//删除
handleDelete(row) {
this.$confirm('是否确认删除所选冲孔机?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delBasePunch(row.id).then((response) => {
console.log(response)
this.$modal.msgSuccess('删除成功')
this.open = false
if (this.paging.total % 10 === 1) {
this.queryParams.pageNum == 1 ? this.queryParams.pageNum : (this.queryParams.pageNum = this.queryParams.pageNum - 1)
}
this.getList()
})
})
},
/** 修改按钮操作 */
handleUpdate(row) {
let tempRow = JSON.parse(JSON.stringify(row))
this.reset()
let data = {
id: tempRow.id,
punchNo: tempRow.punchNo,
punchName: tempRow.punchName,
isState: tempRow.isState,
maxTask: tempRow.maxTask,
isActive: tempRow.isActive,
punchQty: tempRow.punchQty,
remaks: tempRow.remaks
}
this.form = data
this.open = true
this.title = '编辑'
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '新增'
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.title === '编辑') {
updateBasePunch(this.form).then((response) => {
this.$modal.msgSuccess('编辑成功')
this.open = false
this.getList()
})
} else {
addBasePunch(this.form).then((response) => {
console.log(response)
this.$modal.msgSuccess('添加成功')
this.open = false
this.getList()
})
}
}
})
}
}
}
</script>