|
@@ -48,7 +48,7 @@
|
|
|
<el-form-item :label='$t("resource.form.pgContent")+":"' prop="pgContent">
|
|
|
<el-input v-model="pgContent" :readOnly="true" type="textarea" :rows="6" style="width: 100%;"/>
|
|
|
</el-form-item>
|
|
|
- <!-- 刀具管理 -->
|
|
|
+ <!-- 刀具分组管理 -->
|
|
|
<div>
|
|
|
<h2 class="editTitle">{{$t("prepare.common.toolMgr")}}
|
|
|
<!-- 新增 -->
|
|
@@ -58,36 +58,32 @@
|
|
|
:data="toolList"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
- <el-table-column prop="cuttingToolCategory" :label='$t("resource.table.programTool.cuttingToolCategory")'>
|
|
|
+ <el-table-column prop="partsAlias" label='零件编号'>
|
|
|
<template slot="header">
|
|
|
- <span>{{$t("resource.table.programTool.cuttingToolCategory")}}</span>
|
|
|
- <span class="star">*</span>
|
|
|
+ <span>零件编号</span>
|
|
|
</template>
|
|
|
<template slot-scope="{ row }">
|
|
|
- <el-select v-model="row.cuttingToolCategory" filterable :placeholder='$t("common.pleaseEnter")'>
|
|
|
- <el-option
|
|
|
- v-for="(item,key,index) in dicts.CUTTING_TOOL_CATEGORY"
|
|
|
- :key="index"
|
|
|
- :label="item"
|
|
|
- :value="key">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
+ <span>{{ row.partsNo}}</span>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="useTime" :label='$t("resource.table.programTool.useTime")'>
|
|
|
+
|
|
|
+ <el-table-column prop="procedureNo" label='工序编号'>
|
|
|
<template slot="header">
|
|
|
- <span>{{$t("resource.table.programTool.useTime")}}</span>
|
|
|
- <span class="star">*</span>
|
|
|
+ <span>工序编号</span>
|
|
|
</template>
|
|
|
<template slot-scope="{ row }">
|
|
|
- <el-input-number v-model="row.useTime" :min="1" :max="999999999" label='$t("common.pleaseEnter")'></el-input-number>
|
|
|
- </template>
|
|
|
+ <span>{{ row.procedureNo}}</span>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <!--<el-table-column prop="count" :label='$t("resource.table.programTool.count")'>
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-input-number v-model="row.count" :min="1" :max="999999999" label="数量"></el-input-number>
|
|
|
- </template>
|
|
|
- </el-table-column>-->
|
|
|
+
|
|
|
+ <el-table-column label='刀具数量'>
|
|
|
+ <template slot="header">
|
|
|
+ <span>刀具数量</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span v-if="row.count">{{ row.count}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<!-- 操作 -->
|
|
|
<el-table-column
|
|
|
:label="$t('table.operation')"
|
|
@@ -114,6 +110,13 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ <el-row :gutter="12" v-show="toolList.length>0">
|
|
|
+ <el-col :xs="24">
|
|
|
+ <el-input v-model="cuttingToolNames" :readOnly="true" type="textarea" :rows="8" style="width: 100%;"/>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
</el-form>
|
|
@@ -130,6 +133,7 @@ import programCenterApi from "@/api/resourceProductMgr/programCenter"
|
|
|
// 【设备(生产资源)】-API
|
|
|
import productionResourcesMgrApi from "@/api/resourceProductMgr/productionResourcesMgr"
|
|
|
import attachmentMgrApi from "@/api/Attachment"
|
|
|
+import bomMgrApi from "@/api/prepareProductMgr/bomMgr"
|
|
|
import db from "@/utils/localstorage";
|
|
|
import {Base64} from 'js-base64';
|
|
|
import {initDicts, initQueryParams} from '@/utils/commons'
|
|
@@ -151,9 +155,11 @@ export default {
|
|
|
selectedEq: [], // 新增和修改的设备[设备]数据-来自·(可执行设备(位置))
|
|
|
subBtn: false,
|
|
|
formDisabled: false,
|
|
|
- dicts: {
|
|
|
- CUTTING_TOOL_CATEGORY: {}
|
|
|
- },
|
|
|
+ dicts: {
|
|
|
+ CUTTING_TOOL_CATEGORY: {}
|
|
|
+ },
|
|
|
+ cuttingToolCategory:{},
|
|
|
+ cuttingToolNames:"",
|
|
|
tableData: [],
|
|
|
eqList: [], // 设备下拉类别数据
|
|
|
toolList: [], // 刀具列表
|
|
@@ -245,36 +251,32 @@ export default {
|
|
|
|
|
|
// 初始化,【刀具下拉】
|
|
|
getToolList(arrs){
|
|
|
+ if(arrs.length == 0)
|
|
|
+ {
|
|
|
+ this.$message.warning('刀具分组数据不存在')
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let arr = arrs[0].cuttingToolCategory.split("_")
|
|
|
+
|
|
|
this.queryParams.current = 1
|
|
|
this.queryParams.size = 9999
|
|
|
- this.queryParams.map.state = 1
|
|
|
- let arr = this.tenant.resourceIds.split(",")
|
|
|
- if(arr.length>0){
|
|
|
- this.queryParams.model.deviceId = arr[0]
|
|
|
- }
|
|
|
-
|
|
|
- if(arrs.length > 0){
|
|
|
- this.queryParams.map.ids = arrs.map(item=>{return item.cuttingToolCategory}).join(',')
|
|
|
- }
|
|
|
-
|
|
|
- programCenterApi.toolList(this.queryParams).then(res => {
|
|
|
- res = res.data
|
|
|
- // console.log("【刀具下拉】下拉数据:", res)
|
|
|
- if(res.isSuccess){
|
|
|
- let arr = []
|
|
|
- res.data.records.forEach(item =>{
|
|
|
- const parent = arr.find(cur => cur.label === item.cuttingToolType.data)
|
|
|
- if(parent){
|
|
|
- parent.options.push(item)
|
|
|
- }else{
|
|
|
- let groupObj = {}
|
|
|
- groupObj.label = item.cuttingToolType.data
|
|
|
- groupObj.options = [item]
|
|
|
- arr.push(groupObj)
|
|
|
- }
|
|
|
- });
|
|
|
- this.toolSelectList = arr
|
|
|
- }
|
|
|
+ this.queryParams.model.partsNo = arr[0]
|
|
|
+ this.queryParams.model.procedureNo = arr[1]
|
|
|
+ let that = this
|
|
|
+ programCenterApi.getCutterCategory(this.queryParams).then(res => {
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ that.cuttingToolNames = res.data.records.map(item=>item.cutterName).join('\n')
|
|
|
+ that.toolList = []
|
|
|
+ that.toolList.push({
|
|
|
+ id: arrs[0].id,
|
|
|
+ cuttingToolCategory: arrs[0].cuttingToolCategory,
|
|
|
+ partsNo: arr[0],
|
|
|
+ procedureNo: arr[1],
|
|
|
+ count: res.data.total,
|
|
|
+ isEdit: false
|
|
|
+ });
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -365,10 +367,19 @@ export default {
|
|
|
|
|
|
// 父组件,设置子组件的值-方法
|
|
|
setTenant (val, selectedEq) {
|
|
|
- // console.log("设备:", val)
|
|
|
+ console.log("设备:", selectedEq)
|
|
|
+ console.log("val:", val)
|
|
|
// 表单下拉数据,赋值,动态数据
|
|
|
- this.selectedEq = selectedEq;
|
|
|
+ this.selectedEq = selectedEq;
|
|
|
|
|
|
+ bomMgrApi.get({id:this.selectedEq[0].bomId}).then(res => {
|
|
|
+ console.log("根据id,查询详情BOM:", res.data);
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.cuttingToolCategory = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
if(val){
|
|
|
// 刀具管理
|
|
|
this.toolList = val.toolList?val.toolList:new Array();
|
|
@@ -405,16 +416,35 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 【新增】按钮-事件
|
|
|
- addRes(){
|
|
|
- this.toolList.push({
|
|
|
- key: "WKS_"+ Math.random(),
|
|
|
- cuttingToolCategory: '',
|
|
|
- toolName: '',
|
|
|
- useTime: '',
|
|
|
- count: null,
|
|
|
- isEdit: true
|
|
|
- });
|
|
|
- this.getToolList([]);
|
|
|
+ addRes(){
|
|
|
+ if(this.toolList.length>0){
|
|
|
+ this.$message.warning('刀具分组已经存在,请勿重复添加')
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.queryParams.current = 1
|
|
|
+ this.queryParams.size = 9999
|
|
|
+ this.queryParams.model.partsNo = this.cuttingToolCategory.parts_no
|
|
|
+ this.queryParams.model.procedureNo = this.cuttingToolCategory.no
|
|
|
+ let that = this
|
|
|
+ programCenterApi.getCutterCategory(this.queryParams).then(res => {
|
|
|
+ console.log("根据id,查询详情BOM:", res.data);
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ that.cuttingToolNames = res.data.records.map(item=>item.cutterName).join('\n')
|
|
|
+ that.toolList.push({
|
|
|
+ key: "WKS_"+ Math.random(),
|
|
|
+ cuttingToolCategory: that.cuttingToolCategory.parts_no+"_"+ that.cuttingToolCategory.no,
|
|
|
+ partsNo: that.cuttingToolCategory.parts_no,
|
|
|
+ procedureNo: that.cuttingToolCategory.no,
|
|
|
+ count: res.data.total,
|
|
|
+ isEdit: false
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
// 【删除】按钮事件
|
|
@@ -474,25 +504,22 @@ export default {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
let bool = true;
|
|
|
let msg = ""
|
|
|
- if(this.toolList.length ==0 && this.toolSelectList.length>0){
|
|
|
+ if(this.toolList.length ==0){
|
|
|
bool = false
|
|
|
msg = "刀具设备不能为空"
|
|
|
- }else if(this.toolList.length>0) {
|
|
|
+ }else if(this.toolList.length == 1) {
|
|
|
this.toolList.forEach(item => {
|
|
|
if(!item.cuttingToolCategory){
|
|
|
bool = false
|
|
|
msg = "刀具类别不能为空"
|
|
|
return false
|
|
|
}else{
|
|
|
- if(idArr.indexOf(item.cuttingToolCategory)<0){
|
|
|
- idArr.push(item.cuttingToolCategory)
|
|
|
- }else{
|
|
|
- bool = false
|
|
|
- msg = "同名类别不能重复选择"
|
|
|
- return false
|
|
|
- }
|
|
|
+ idArr.push(item.cuttingToolCategory)
|
|
|
}
|
|
|
});
|
|
|
+ }else if(this.toolList.length > 1){
|
|
|
+ bool = false
|
|
|
+ msg = "刀具分组数量大于1"
|
|
|
}
|
|
|
if(!bool){
|
|
|
this.$message({
|
|
@@ -510,7 +537,7 @@ export default {
|
|
|
if(obj.toolList && obj.toolList.length > 0){
|
|
|
let arr = [];
|
|
|
obj.toolList.map(item => {
|
|
|
- let target = this.toolSelectList.filter(obj => obj.id = item.cuttingToolCategory)[0];
|
|
|
+ //let target = this.toolSelectList.filter(obj => obj.id = item.cuttingToolCategory)[0];
|
|
|
// 把刀具名称带出来
|
|
|
//item.toolName = target.cuttingToolName;
|
|
|
// 添加数据
|
|
@@ -528,7 +555,7 @@ export default {
|
|
|
// 添加关键字
|
|
|
obj.keys = ''+ Math.random();
|
|
|
}
|
|
|
- // console.log("Form最终数据:", obj);
|
|
|
+ console.log("Form最终数据:", obj);
|
|
|
// return false;
|
|
|
// 恢复按钮
|
|
|
this.confirmDisabled = true;
|