工装夹具资源设置

This commit is contained in:
JinLu.Yin 2022-05-12 17:37:24 +08:00
parent 5d549525ad
commit b2977b8c4d
3 changed files with 268 additions and 6 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询工装夹具资源列表
export function listWorkstationtool(query) {
return request({
url: '/mes/md/workstationtool/list',
method: 'get',
params: query
})
}
// 查询工装夹具资源详细
export function getWorkstationtool(recordId) {
return request({
url: '/mes/md/workstationtool/' + recordId,
method: 'get'
})
}
// 新增工装夹具资源
export function addWorkstationtool(data) {
return request({
url: '/mes/md/workstationtool',
method: 'post',
data: data
})
}
// 修改工装夹具资源
export function updateWorkstationtool(data) {
return request({
url: '/mes/md/workstationtool',
method: 'put',
data: data
})
}
// 删除工装夹具资源
export function delWorkstationtool(recordId) {
return request({
url: '/mes/md/workstationtool/' + recordId,
method: 'delete'
})
}

View File

@ -0,0 +1,213 @@
<template>
<div class="app-container">
<el-table v-loading="loading" :data="workstationtoolList" @selection-change="handleSelectionChange">
<el-table-column label="类型名称" align="center" prop="toolTypeName" />
<el-table-column label="数量" align="center" prop="quantity" />
<el-table-column label="操作" align="center" v-if="optType !='view'" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:md:workstationtool:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:md:workstationtool:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改工装夹具资源对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="工装夹具类型" prop="toolTypeId">
<el-select v-model="form.toolTypeId" @change="onToolTypeChanged" placeholder="请选择类型">
<el-option
v-for="dict in toolTypeOptions"
:key="dict.toolTypeId"
:label="dict.toolTypeName"
:value="dict.toolTypeId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="数量" prop="quantity">
<el-input-number :min="1" v-model="form.quantity" placeholder="请输入数量" />
</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 { listWorkstationtool, getWorkstationtool, delWorkstationtool, addWorkstationtool, updateWorkstationtool } from "@/api/mes/md/workstationtool";
import { listAllTooltype } from "@/api/mes/tm/tooltype"
export default {
name: "Workstationtool",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
workstationtoolList: [],
toolTypeOptions: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
workstationId: null,
toolTypeId: null,
toolTypeCode: null,
toolTypeName: null,
quantity: null,
},
//
form: {},
//
rules: {
workstationId: [
{ required: true, message: "工作站ID不能为空", trigger: "blur" }
],
toolTypeId: [
{ required: true, message: "工装夹具类型ID不能为空", trigger: "blur" }
],
quantity: [
{ required: true, message: "数量不能为空", trigger: "blur" }
],
}
};
},
props: {
workstationId: undefined,
optType: undefined,
},
created() {
this.getList();
this.getTypeList();
},
methods: {
/** 查询工装夹具资源列表 */
getList() {
this.loading = true;
listWorkstationtool(this.queryParams).then(response => {
this.workstationtoolList = response.rows;
this.total = response.total;
this.loading = false;
});
},
getTypeList(){
listAllTooltype().then(response =>{
this.toolTypeOptions = response.data;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
recordId: null,
workstationId: this.workstationId,
toolTypeId: null,
toolTypeCode: null,
toolTypeName: null,
quantity: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
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 = "添加工装夹具资源";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const recordId = row.recordId || this.ids
getWorkstationtool(recordId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改工装夹具资源";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.recordId != null) {
updateWorkstationtool(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWorkstationtool(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 delWorkstationtool(recordIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

View File

@ -237,7 +237,7 @@
<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 trigger="click" type="card" :autoplay="false">
<el-carousel-item>
<el-card shadow="always" style="width:450px">
<div slot="header">
@ -260,9 +260,9 @@
<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>
<el-button style="float:right; padding 5px 0" @click="handleToolTypeAdd" v-if="optType !='view'" type="text">新增</el-button>
</div>
工装夹具清单
<WorkStationTool ref="toolList" :optType="optType" :workstationId="form.workstationId"></WorkStationTool>
</el-card>
</el-carousel-item>
</el-carousel>
@ -285,9 +285,9 @@ import MachinerySelectSingle from "@/components/machinerySelect/single.vue";
import {addWorkstationmachine} from "@/api/mes/md/workstationmachine";
//
//
import WorkStationTool from "./components/tool";
import {addWorkstationtool} from "@/api/mes/md/workstationtool";
import {listAllProcess} from "@/api/mes/pro/process";
import {genCode} from "@/api/system/autocode/rule";
@ -295,7 +295,7 @@ import { listAllWorkshop } from "@/api/mes/md/workshop";
export default {
name: "Workstation",
dicts: ['sys_yes_no'],
components: {WorkStationMachine,MachinerySelectSingle},
components: {WorkStationMachine,MachinerySelectSingle,WorkStationTool},
data() {
return {
//
@ -516,6 +516,11 @@ export default {
this.$refs.machineryList.getList();
this.loading = false;
});
},
//
handleToolTypeAdd(){
this.$refs.toolList.handleAdd();
}
}
};