工作站设置设备资源
This commit is contained in:
146
src/views/mes/md/workstation/components/machine.vue
Normal file
146
src/views/mes/md/workstation/components/machine.vue
Normal file
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-table v-loading="loading" :data="workstationmachineList">
|
||||
<el-table-column label="设备编号" align="center" prop="machineryCode" />
|
||||
<el-table-column label="设备名称" align="center" width="150px" prop="machineryName" />
|
||||
<el-table-column label="数量" width="50px" align="center" prop="quantity" />
|
||||
<el-table-column label="操作" v-if="optType !='view'" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['md:workstationmachine:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listWorkstationmachine, getWorkstationmachine, delWorkstationmachine, addWorkstationmachine, updateWorkstationmachine } from "@/api/mes/md/workstationmachine";
|
||||
|
||||
export default {
|
||||
name: "Workstationmachine",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备资源表格数据
|
||||
workstationmachineList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
workstationId: null,
|
||||
machineId: null,
|
||||
machineCode: null,
|
||||
machineName: null,
|
||||
quantity: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {}
|
||||
};
|
||||
},
|
||||
props: {
|
||||
workstationId: undefined,
|
||||
optType: undefined,
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备资源列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.workstationId = this.workstationId;
|
||||
listWorkstationmachine(this.queryParams).then(response => {
|
||||
this.workstationmachineList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
recordId: null,
|
||||
workstationId: null,
|
||||
machineId: null,
|
||||
machineCode: null,
|
||||
machineName: null,
|
||||
quantity: null,
|
||||
remark: null,
|
||||
attr1: null,
|
||||
attr2: null,
|
||||
attr3: null,
|
||||
attr4: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.recordId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加设备资源";
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.recordId != null) {
|
||||
updateWorkstationmachine(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addWorkstationmachine(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const recordIds = row.recordId || this.ids;
|
||||
this.$modal.confirm('是否确认删除设备资源?').then(function() {
|
||||
return delWorkstationmachine(recordIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
<el-table v-loading="loading" :data="workstationList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="工作站编码" align="center" prop="workstationCode" >
|
||||
<el-table-column label="工作站编号" align="center" prop="workstationCode" >
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
@@ -155,7 +155,7 @@
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工作站编码" prop="workstationCode">
|
||||
<el-form-item label="工作站编号" prop="workstationCode">
|
||||
<el-input v-model="form.workstationCode" placeholder="请输入工作站编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -233,10 +233,45 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-divider content-position="center" v-if="form.workstationId !=null">工作站资源</el-divider>
|
||||
<MachinerySelectSingle ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelectSingle>
|
||||
<el-row v-if="form.workstationId !=null">
|
||||
<el-col :span=24>
|
||||
<el-carousel trigger="click" type="card" :autoplay="false" height="300px">
|
||||
<el-carousel-item>
|
||||
<el-card shadow="always" style="width:450px">
|
||||
<div slot="header">
|
||||
<span>设备资源</span>
|
||||
<el-button style="float:right; padding 3px 0" @click="handleMachineryAdd" v-if="optType !='view'" type="text">新增</el-button>
|
||||
</div>
|
||||
<WorkStationMachine ref="machineryList" :optType="optType" :workstationId="form.workstationId" style="align:center"></WorkStationMachine>
|
||||
</el-card>
|
||||
</el-carousel-item>
|
||||
<el-carousel-item>
|
||||
<el-card shadow="always" style="width:400px">
|
||||
<div slot="header">
|
||||
<span>人力资源</span>
|
||||
<el-button style="float:right; padding 3px 0" v-if="optType !='view'" type="text">新增</el-button>
|
||||
</div>
|
||||
人员清单
|
||||
</el-card>
|
||||
</el-carousel-item>
|
||||
<el-carousel-item>
|
||||
<el-card shadow="always" style="width:400px">
|
||||
<div slot="header">
|
||||
<span>工装夹具</span>
|
||||
<el-button style="float:right; padding 5px 0" v-if="optType !='view'" type="text">新增</el-button>
|
||||
</div>
|
||||
工装夹具清单
|
||||
</el-card>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
|
||||
<el-button type="primary" @click="submitForm" v-else>确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm" v-else>保 存</el-button>
|
||||
<el-button @click="cancel">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
@@ -244,12 +279,23 @@
|
||||
|
||||
<script>
|
||||
import { listWorkstation, getWorkstation, delWorkstation, addWorkstation, updateWorkstation } from "@/api/mes/md/workstation";
|
||||
//设备资源选择与保存
|
||||
import WorkStationMachine from "./components/machine";
|
||||
import MachinerySelectSingle from "@/components/machinerySelect/single.vue";
|
||||
import {addWorkstationmachine} from "@/api/mes/md/workstationmachine";
|
||||
//人力资源选择与保存
|
||||
|
||||
|
||||
//工装夹具资源选择与保存
|
||||
|
||||
|
||||
import {listAllProcess} from "@/api/mes/pro/process";
|
||||
import {genCode} from "@/api/system/autocode/rule";
|
||||
import { listAllWorkshop } from "@/api/mes/md/workshop";
|
||||
export default {
|
||||
name: "Workstation",
|
||||
dicts: ['sys_yes_no'],
|
||||
components: {WorkStationMachine,MachinerySelectSingle},
|
||||
data() {
|
||||
return {
|
||||
//自动生成编码
|
||||
@@ -297,7 +343,7 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
workstationCode: [
|
||||
{ required: true, message: "工作站编码不能为空", trigger: "blur" }
|
||||
{ required: true, message: "工作站编号不能为空", trigger: "blur" }
|
||||
],
|
||||
workstationName: [
|
||||
{ required: true, message: "工作站名称不能为空", trigger: "blur" }
|
||||
@@ -332,7 +378,6 @@ export default {
|
||||
//查询工序信息
|
||||
getProcess(){
|
||||
listAllProcess().then( response =>{
|
||||
debugger;
|
||||
this.processOptions = response.data;
|
||||
});
|
||||
},
|
||||
@@ -457,6 +502,20 @@ export default {
|
||||
}else{
|
||||
this.form.workstationCode = null;
|
||||
}
|
||||
},
|
||||
//设备资源选择弹出
|
||||
handleMachineryAdd(){
|
||||
this.$refs.machinerySelect.showFlag = true;
|
||||
},
|
||||
//设备资源选择回调
|
||||
onMachineryAdd(rows){
|
||||
debugger
|
||||
this.loading = true;
|
||||
rows.workstationId = this.form.workstationId;
|
||||
addWorkstationmachine(rows).then(response =>{
|
||||
this.$refs.machineryList.getList();
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user