工作站设置设备资源
This commit is contained in:
parent
1629e7f625
commit
5d549525ad
44
src/api/mes/md/workstationmachine.js
Normal file
44
src/api/mes/md/workstationmachine.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询设备资源列表
|
||||||
|
export function listWorkstationmachine(query) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/md/workstationmachine/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询设备资源详细
|
||||||
|
export function getWorkstationmachine(recordId) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/md/workstationmachine/' + recordId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增设备资源
|
||||||
|
export function addWorkstationmachine(data) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/md/workstationmachine',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改设备资源
|
||||||
|
export function updateWorkstationmachine(data) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/md/workstationmachine',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除设备资源
|
||||||
|
export function delWorkstationmachine(recordId) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/md/workstationmachine/' + recordId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
@ -103,7 +103,7 @@ import Treeselect from "@riophae/vue-treeselect";
|
|||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MdItem",
|
name: "MdItemSelect",
|
||||||
dicts: ['sys_yes_no','mes_item_product'],
|
dicts: ['sys_yes_no','mes_item_product'],
|
||||||
components: { Treeselect },
|
components: { Treeselect },
|
||||||
data() {
|
data() {
|
||||||
|
251
src/components/machinerySelect/index.vue
Normal file
251
src/components/machinerySelect/index.vue
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="设备选择"
|
||||||
|
v-if="showFlag"
|
||||||
|
:visible.sync="showFlag"
|
||||||
|
:modal= false
|
||||||
|
width="80%"
|
||||||
|
center
|
||||||
|
>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<!--分类数据-->
|
||||||
|
<el-col :span="4" :xs="24">
|
||||||
|
<div class="head-container">
|
||||||
|
<el-input
|
||||||
|
v-model="machineryTypeName"
|
||||||
|
placeholder="请输入分类名称"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
prefix-icon="el-icon-search"
|
||||||
|
style="margin-bottom: 20px"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="head-container">
|
||||||
|
<el-tree
|
||||||
|
:data="machineryTypeOptions"
|
||||||
|
:props="defaultProps"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
:filter-node-method="filterNode"
|
||||||
|
ref="tree"
|
||||||
|
default-expand-all
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<!--设备数据-->
|
||||||
|
<el-col :span="20" :xs="24">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="设备编码" prop="machineryCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.machineryCode"
|
||||||
|
placeholder="请输入设备编码"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备名称" prop="machineryName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.machineryName"
|
||||||
|
placeholder="请输入设备名称"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</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>
|
||||||
|
<el-table v-loading="loading" :data="machineryList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
|
<el-table-column label="设备编码" width = "120" align="center" key="machineryCode" prop="machineryCode">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="设备名称" min-width="120" align="left" key="machineryName" prop="machineryName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="品牌" align="left" key="machineryBrand" prop="machineryBrand" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="规格型号" align="left" key="machinerySpec" prop="machinerySpec" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="所属车间" align="center" key="machineryTypeName" prop="machineryTypeName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="设备状态" align="center" key="status" prop="status" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.mes_machinery_status" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="confirmSelect">确 定</el-button>
|
||||||
|
<el-button @click="showFlag=false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listMachinery, getMachinery, delMachinery, addMachinery, updateMachinery } from "@/api/mes/dv/machinery";
|
||||||
|
import { listMachinerytype } from "@/api/mes/dv/machinerytype";
|
||||||
|
import { listAllWorkshop } from "@/api/mes/md/workshop";
|
||||||
|
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MachinerySelect",
|
||||||
|
dicts: ['sys_yes_no','mes_machinery_status'],
|
||||||
|
components: { Treeselect },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showFlag: false,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
selectedRows: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 物料产品表格数据
|
||||||
|
machineryList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 设备类型树选项
|
||||||
|
machineryTypeOptions: [],
|
||||||
|
//车间选项
|
||||||
|
workshopOptions:[],
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 设备类型名称
|
||||||
|
machineryTypeName: undefined,
|
||||||
|
//自动生成物料编码标识
|
||||||
|
autoGenFlag: false,
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
defaultProps: {
|
||||||
|
children: "children",
|
||||||
|
label: "machineryTypeName"
|
||||||
|
},
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
machineryCode: null,
|
||||||
|
machineryName: null,
|
||||||
|
machineryBrand: null,
|
||||||
|
machinerySpec: null,
|
||||||
|
machineryTypeId: null,
|
||||||
|
machineryTypeCode: null,
|
||||||
|
machineryTypeName: null,
|
||||||
|
workshopId: null,
|
||||||
|
workshopCode: null,
|
||||||
|
workshopName: null,
|
||||||
|
status: null
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 根据设备分类名称筛选分类树
|
||||||
|
machineryTypeName(val) {
|
||||||
|
this.$refs.tree.filter(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getTreeselect();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询物料编码列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listMachinery(this.queryParams).then(response => {
|
||||||
|
this.machineryList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
getWorkshops(){
|
||||||
|
listAllWorkshop().then( response => {
|
||||||
|
debugger;
|
||||||
|
this.workshopOptions =response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 转换设备类型数据结构 */
|
||||||
|
normalizer(node) {
|
||||||
|
if (node.children && !node.children.length) {
|
||||||
|
delete node.children;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: node.machineryTypeId,
|
||||||
|
label: node.machineryTypeName,
|
||||||
|
children: node.children
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/** 查询设备类型下拉树结构 */
|
||||||
|
getTreeselect() {
|
||||||
|
listMachinerytype().then(response => {
|
||||||
|
debugger;
|
||||||
|
this.machineryTypeOptions = [];
|
||||||
|
const data = this.handleTree(response.data, "machineryTypeId", "parentTypeId")[0];
|
||||||
|
this.machineryTypeOptions.push(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 筛选节点
|
||||||
|
filterNode(value, data) {
|
||||||
|
if (!value) return true;
|
||||||
|
return data.machineryTypeName.indexOf(value) !== -1;
|
||||||
|
},
|
||||||
|
// 节点单击事件
|
||||||
|
handleNodeClick(data) {
|
||||||
|
this.queryParams.machineryTypeId = data.machineryTypeId;
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.machineryId);
|
||||||
|
this.single = selection.length != 1;
|
||||||
|
this.multiple = !selection.length;
|
||||||
|
},
|
||||||
|
//确定选中
|
||||||
|
confirmSelect(){
|
||||||
|
if(this.ids ==[] || this.ids.length==0){
|
||||||
|
this.$notify({
|
||||||
|
title:'提示',
|
||||||
|
type:'warning',
|
||||||
|
message: '请至少选择一条数据!'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$emit('onSelected',this.selectedRows);
|
||||||
|
this.showFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
268
src/components/machinerySelect/single.vue
Normal file
268
src/components/machinerySelect/single.vue
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="设备选择"
|
||||||
|
v-if="showFlag"
|
||||||
|
:visible.sync="showFlag"
|
||||||
|
:modal= false
|
||||||
|
width="80%"
|
||||||
|
center
|
||||||
|
>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<!--分类数据-->
|
||||||
|
<el-col :span="4" :xs="24">
|
||||||
|
<div class="head-container">
|
||||||
|
<el-input
|
||||||
|
v-model="machineryTypeName"
|
||||||
|
placeholder="请输入分类名称"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
prefix-icon="el-icon-search"
|
||||||
|
style="margin-bottom: 20px"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="head-container">
|
||||||
|
<el-tree
|
||||||
|
:data="machineryTypeOptions"
|
||||||
|
:props="defaultProps"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
:filter-node-method="filterNode"
|
||||||
|
ref="tree"
|
||||||
|
default-expand-all
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<!--设备数据-->
|
||||||
|
<el-col :span="20" :xs="24">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="设备编码" prop="machineryCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.machineryCode"
|
||||||
|
placeholder="请输入设备编码"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备名称" prop="machineryName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.machineryName"
|
||||||
|
placeholder="请输入设备名称"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</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>
|
||||||
|
<el-table v-loading="loading" :data="machineryList" @current-change="handleCurrent" @row-dblclick="handleRowDbClick">
|
||||||
|
<el-table-column width="50" align="center" >
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-radio v-model="selectedMachineryId" :label="scope.row.machineryId" @change="handleRowChange(scope.row)">{{""}}</el-radio>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="设备编码" width = "120" align="center" key="machineryCode" prop="machineryCode">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="设备名称" min-width="120" align="left" key="machineryName" prop="machineryName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="品牌" align="left" key="machineryBrand" prop="machineryBrand" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="规格型号" align="left" key="machinerySpec" prop="machinerySpec" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="所属车间" align="center" key="machineryTypeName" prop="machineryTypeName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="设备状态" align="center" key="status" prop="status" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.mes_machinery_status" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="confirmSelect">确 定</el-button>
|
||||||
|
<el-button @click="showFlag=false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listMachinery, getMachinery, delMachinery, addMachinery, updateMachinery } from "@/api/mes/dv/machinery";
|
||||||
|
import { listMachinerytype } from "@/api/mes/dv/machinerytype";
|
||||||
|
import { listAllWorkshop } from "@/api/mes/md/workshop";
|
||||||
|
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MachinerySelectSingle",
|
||||||
|
dicts: ['sys_yes_no','mes_machinery_status'],
|
||||||
|
components: { Treeselect },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showFlag: false,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
selectedMachineryId: undefined,
|
||||||
|
selectedRows: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 物料产品表格数据
|
||||||
|
machineryList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 设备类型树选项
|
||||||
|
machineryTypeOptions: [],
|
||||||
|
//车间选项
|
||||||
|
workshopOptions:[],
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 设备类型名称
|
||||||
|
machineryTypeName: undefined,
|
||||||
|
//自动生成物料编码标识
|
||||||
|
autoGenFlag: false,
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
defaultProps: {
|
||||||
|
children: "children",
|
||||||
|
label: "machineryTypeName"
|
||||||
|
},
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
machineryCode: null,
|
||||||
|
machineryName: null,
|
||||||
|
machineryBrand: null,
|
||||||
|
machinerySpec: null,
|
||||||
|
machineryTypeId: null,
|
||||||
|
machineryTypeCode: null,
|
||||||
|
machineryTypeName: null,
|
||||||
|
workshopId: null,
|
||||||
|
workshopCode: null,
|
||||||
|
workshopName: null,
|
||||||
|
status: null
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 根据设备分类名称筛选分类树
|
||||||
|
machineryTypeName(val) {
|
||||||
|
this.$refs.tree.filter(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getTreeselect();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询物料编码列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listMachinery(this.queryParams).then(response => {
|
||||||
|
this.machineryList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
getWorkshops(){
|
||||||
|
listAllWorkshop().then( response => {
|
||||||
|
debugger;
|
||||||
|
this.workshopOptions =response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 转换设备类型数据结构 */
|
||||||
|
normalizer(node) {
|
||||||
|
if (node.children && !node.children.length) {
|
||||||
|
delete node.children;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: node.machineryTypeId,
|
||||||
|
label: node.machineryTypeName,
|
||||||
|
children: node.children
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/** 查询设备类型下拉树结构 */
|
||||||
|
getTreeselect() {
|
||||||
|
listMachinerytype().then(response => {
|
||||||
|
debugger;
|
||||||
|
this.machineryTypeOptions = [];
|
||||||
|
const data = this.handleTree(response.data, "machineryTypeId", "parentTypeId")[0];
|
||||||
|
this.machineryTypeOptions.push(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 筛选节点
|
||||||
|
filterNode(value, data) {
|
||||||
|
if (!value) return true;
|
||||||
|
return data.machineryTypeName.indexOf(value) !== -1;
|
||||||
|
},
|
||||||
|
// 节点单击事件
|
||||||
|
handleNodeClick(data) {
|
||||||
|
this.queryParams.machineryTypeId = data.machineryTypeId;
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
handleCurrent(row){
|
||||||
|
if(row){
|
||||||
|
this.selectedRows = row;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//双击选中
|
||||||
|
handleRowDbClick(row){
|
||||||
|
if(row){
|
||||||
|
this.selectedRows = row;
|
||||||
|
this.$emit('onSelected',this.selectedRows);
|
||||||
|
this.showFlag = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 单选选中数据
|
||||||
|
handleRowChange(row) {
|
||||||
|
if(row){
|
||||||
|
this.selectedRows = row;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//确定选中
|
||||||
|
confirmSelect(){
|
||||||
|
if(this.selectedMachineryId == null || this.selectedMachineryId == 0){
|
||||||
|
this.$notify({
|
||||||
|
title:'提示',
|
||||||
|
type:'warning',
|
||||||
|
message: '请至少选择一条数据!'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$emit('onSelected',this.selectedRows);
|
||||||
|
this.showFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
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 v-loading="loading" :data="workstationList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<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">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
@ -155,7 +155,7 @@
|
|||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="工作站编码" prop="workstationCode">
|
<el-form-item label="工作站编号" prop="workstationCode">
|
||||||
<el-input v-model="form.workstationCode" placeholder="请输入工作站编码" />
|
<el-input v-model="form.workstationCode" placeholder="请输入工作站编码" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -233,10 +233,45 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</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">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
|
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
|
||||||
<el-button type="primary" @click="submitForm" v-else>确 定</el-button>
|
<el-button type="primary" @click="submitForm" v-else>保 存</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">关 闭</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
@ -244,12 +279,23 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listWorkstation, getWorkstation, delWorkstation, addWorkstation, updateWorkstation } from "@/api/mes/md/workstation";
|
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 {listAllProcess} from "@/api/mes/pro/process";
|
||||||
import {genCode} from "@/api/system/autocode/rule";
|
import {genCode} from "@/api/system/autocode/rule";
|
||||||
import { listAllWorkshop } from "@/api/mes/md/workshop";
|
import { listAllWorkshop } from "@/api/mes/md/workshop";
|
||||||
export default {
|
export default {
|
||||||
name: "Workstation",
|
name: "Workstation",
|
||||||
dicts: ['sys_yes_no'],
|
dicts: ['sys_yes_no'],
|
||||||
|
components: {WorkStationMachine,MachinerySelectSingle},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//自动生成编码
|
//自动生成编码
|
||||||
@ -297,7 +343,7 @@ export default {
|
|||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
workstationCode: [
|
workstationCode: [
|
||||||
{ required: true, message: "工作站编码不能为空", trigger: "blur" }
|
{ required: true, message: "工作站编号不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
workstationName: [
|
workstationName: [
|
||||||
{ required: true, message: "工作站名称不能为空", trigger: "blur" }
|
{ required: true, message: "工作站名称不能为空", trigger: "blur" }
|
||||||
@ -332,7 +378,6 @@ export default {
|
|||||||
//查询工序信息
|
//查询工序信息
|
||||||
getProcess(){
|
getProcess(){
|
||||||
listAllProcess().then( response =>{
|
listAllProcess().then( response =>{
|
||||||
debugger;
|
|
||||||
this.processOptions = response.data;
|
this.processOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -457,6 +502,20 @@ export default {
|
|||||||
}else{
|
}else{
|
||||||
this.form.workstationCode = null;
|
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;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user