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.
 
 
 
 
 

425 lines
10 KiB

<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item
label="分组名称"
prop="groupName"
>
<el-input
v-model="queryParams.groupName"
placeholder="请输入分组名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item
label="AGV形态"
label-width="80px"
prop="isDown"
>
<el-select
v-model="queryParams.isDown"
placeholder="请选择AGV形态"
clearable
>
<el-option
v-for="item in dict.type.agv_form"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</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="pointGroupList"
:loading="loading"
:paging="paging"
:config="tableConfig"
:tableProps="tableProps"
@current-change="handleCurrentChange"
@handleUpdate="handleUpdate"
@handleDelete="handleDelete"
>
</heavy-table>
</div>
<!-- 添加或修改区域对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="500px"
append-to-body
>
<el-form
ref="form"
:model="form"
:rules="rules"
style="width: 380px;"
label-width="95px"
>
<el-form-item
label="分组编码"
prop="groupNo"
>
<el-input
v-model="form.groupNo"
placeholder="请输入分组编码"
/>
</el-form-item>
<el-form-item
label="分组名称"
prop="groupName"
>
<el-input
v-model="form.groupName"
placeholder="请输入分组名称"
/>
</el-form-item>
<el-form-item
label="最大任务量"
prop="maxTaskQty"
>
<el-input
v-model="form.maxTaskQty"
placeholder="请输入最大任务量"
/>
</el-form-item>
<el-form-item
label="AGV形态"
prop="isDown"
>
<el-select
v-model="form.isDown"
placeholder="请选择AGV形态"
style="width: 100%;"
clearable
>
<el-option
v-for="item in dict.type.agv_form"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="治具载体"
prop="groupType"
>
<el-select
v-model="form.groupType"
placeholder="请选择治具载体"
style="width: 100%;"
clearable
>
<el-option
v-for="item in dict.type.fixture_carrier"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="是否可用"
prop="isActivity"
>
<el-select
v-model="form.isActivity"
placeholder="请选择"
style="width: 100%;"
clearable
>
<el-option
label="停用"
value="0"
/>
<el-option
label="启用"
value="1"
/>
</el-select>
</el-form-item>
</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 { queryGroupList, updateGroup, addGroup, delGroup } from '@/api/wcs/base/pointGroup.js'
export default {
name: 'Configuration',
dicts: ['agv_form', 'fixture_carrier'],
data() {
const _that = this
return {
paging: {
page: 1, // 当前页
size: 10, // 页面大小
total: 0
},
tableConfig: [
{
label: '序号',
prop: 'index',
type: 'index',
istrue: true
},
{
label: '分组编码',
prop: 'groupNo',
istrue: true
},
{
label: '分组名称',
prop: 'groupName',
istrue: true
},
{
label: '最大任务量',
prop: 'maxTaskQty',
istrue: true
},
{
label: 'AGV形态',
prop: 'isDown',
istrue: true,
filter(row, value) {
return _that.getDictLabel(value, _that.dict.type.agv_form)
}
},
{
label: '治具载体',
prop: 'groupType',
istrue: true,
filter(row, value) {
return _that.getDictLabel(value, _that.dict.type.fixture_carrier)
}
},
{
label: '状态',
prop: 'isActivity',
istrue: true,
filter(row, value) {
if (value === '0') {
return '停用'
} else if (value === '1') {
return '启用'
} else {
return '--'
}
}
},
{
label: '操作',
prop: 'operating',
istrue: true,
type: 'button',
width: 100,
fixed: 'right',
buttons: [
{
name: '修改',
event: 'handleUpdate'
},
{
name: '删除',
event: 'handleDelete'
}
]
}
],
tableProps: {
'max-height': 700
},
// 遮罩层
loading: true,
// 显示搜索条件
showSearch: true,
// 区域表格数据
pointGroupList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
groupName: null
},
// 表单参数
form: {},
// 表单校验
rules: {
groupNo: [{ required: true, trigger: 'blur', message: '请输入分组编码' }],
maxTaskQty: [{ required: true, trigger: 'blur', message: '请输入最大任务量' }],
isDown: [{ required: true, trigger: 'change', message: '请选择AGV形态' }],
groupType: [{ required: true, trigger: 'change', message: '请选择治具载体' }],
isActivity: [{ required: true, trigger: 'change', message: '请选择是否可用' }]
}
}
},
created() {
this.getList()
},
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
queryGroupList(this.queryParams).then((response) => {
this.pointGroupList = response.rows
this.paging.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
id: null,
groupName: null,
equipmentStatus: null
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
//删除
handleDelete(row) {
this.$confirm('是否确认删除所选点位分组?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delGroup(row.id).then((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,
groupName: tempRow.groupName,
groupNo: tempRow.groupNo,
maxTaskQty: tempRow.maxTaskQty,
isDown: tempRow.isDown,
groupType: tempRow.groupType,
isActivity: tempRow.isActivity
}
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 === '修改') {
updateGroup(this.form).then((response) => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addGroup(this.form).then((response) => {
this.$modal.msgSuccess('添加成功')
this.open = false
this.getList()
})
}
}
})
}
}
}
</script>