|
@@ -65,12 +65,17 @@
|
|
</template>
|
|
</template>
|
|
<template slot-scope="{ row }">
|
|
<template slot-scope="{ row }">
|
|
<el-select v-model="row.toolId" filterable :placeholder='$t("common.pleaseEnter")'>
|
|
<el-select v-model="row.toolId" filterable :placeholder='$t("common.pleaseEnter")'>
|
|
- <el-option
|
|
|
|
|
|
+ <el-option-group
|
|
v-for="item in toolSelectList"
|
|
v-for="item in toolSelectList"
|
|
- :key="item.id"
|
|
|
|
- :label="item.cuttingToolName"
|
|
|
|
- :value="item.id">
|
|
|
|
- </el-option>
|
|
|
|
|
|
+ :key="item.label"
|
|
|
|
+ :label="item.label">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="option in item.options"
|
|
|
|
+ :key="option.id"
|
|
|
|
+ :label="option.cuttingToolName"
|
|
|
|
+ :value="option.id">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-option-group>
|
|
</el-select>
|
|
</el-select>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -131,6 +136,7 @@ import programCenterApi from "@/api/resourceProductMgr/programCenter"
|
|
import productionResourcesMgrApi from "@/api/resourceProductMgr/productionResourcesMgr"
|
|
import productionResourcesMgrApi from "@/api/resourceProductMgr/productionResourcesMgr"
|
|
import db from "@/utils/localstorage";
|
|
import db from "@/utils/localstorage";
|
|
import {Base64} from 'js-base64';
|
|
import {Base64} from 'js-base64';
|
|
|
|
+import { initQueryParams } from '@/utils/commons'
|
|
export default {
|
|
export default {
|
|
name: 'ProgramncMgr',
|
|
name: 'ProgramncMgr',
|
|
props: {
|
|
props: {
|
|
@@ -152,7 +158,8 @@ export default {
|
|
tableData: [],
|
|
tableData: [],
|
|
eqList: [], // 设备下拉类别数据
|
|
eqList: [], // 设备下拉类别数据
|
|
toolList: [], // 刀具列表
|
|
toolList: [], // 刀具列表
|
|
- toolSelectList: [], // 刀具下拉数据
|
|
|
|
|
|
+ toolSelectList: [], // 刀具下拉数据
|
|
|
|
+ queryParams: initQueryParams({}),
|
|
pgContent: '', // 程序内容
|
|
pgContent: '', // 程序内容
|
|
type: 'add',
|
|
type: 'add',
|
|
tenant: this.initTenant(),
|
|
tenant: this.initTenant(),
|
|
@@ -194,10 +201,7 @@ export default {
|
|
// 查询【程序】信息
|
|
// 查询【程序】信息
|
|
if(!!this.programId){
|
|
if(!!this.programId){
|
|
this.getProgram(this.programId)
|
|
this.getProgram(this.programId)
|
|
- }
|
|
|
|
-
|
|
|
|
- // 初始化,刀具下拉
|
|
|
|
- this.getToolList();
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
programId(val){
|
|
programId(val){
|
|
@@ -240,12 +244,32 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
// 初始化,【刀具下拉】
|
|
// 初始化,【刀具下拉】
|
|
- getToolList(){
|
|
|
|
- programCenterApi.toolList().then(res => {
|
|
|
|
|
|
+ getToolList(arrs){
|
|
|
|
+ this.queryParams.current = 1
|
|
|
|
+ this.queryParams.size = 9999
|
|
|
|
+ this.queryParams.map.state = '0'
|
|
|
|
+
|
|
|
|
+ if(arrs.length > 0){
|
|
|
|
+ this.queryParams.map.ids = arrs.map(item=>{return item.toolId}).join(',')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ programCenterApi.toolList(this.queryParams).then(res => {
|
|
res = res.data
|
|
res = res.data
|
|
// console.log("【刀具下拉】下拉数据:", res)
|
|
// console.log("【刀具下拉】下拉数据:", res)
|
|
- if(res.isSuccess){
|
|
|
|
- this.toolSelectList = res.data
|
|
|
|
|
|
+ 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
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -334,7 +358,7 @@ export default {
|
|
setTenant (val, selectedEq) {
|
|
setTenant (val, selectedEq) {
|
|
// console.log("设备:", val)
|
|
// console.log("设备:", val)
|
|
// 表单下拉数据,赋值,动态数据
|
|
// 表单下拉数据,赋值,动态数据
|
|
- this.selectedEq = selectedEq;
|
|
|
|
|
|
+ this.selectedEq = selectedEq;
|
|
|
|
|
|
if(val){
|
|
if(val){
|
|
// 刀具管理
|
|
// 刀具管理
|
|
@@ -346,7 +370,7 @@ export default {
|
|
resourceId: val.resourceId,
|
|
resourceId: val.resourceId,
|
|
resourceIds: val.resourceId +','+ val.name,
|
|
resourceIds: val.resourceId +','+ val.name,
|
|
workTime: val.workTime,
|
|
workTime: val.workTime,
|
|
- filePath: val.filePath
|
|
|
|
|
|
+ filePath: val.filePath
|
|
};
|
|
};
|
|
this.fileObj= {
|
|
this.fileObj= {
|
|
nc: '1', // 表示已经上传
|
|
nc: '1', // 表示已经上传
|
|
@@ -364,10 +388,11 @@ export default {
|
|
// 查询【程序】信息
|
|
// 查询【程序】信息
|
|
this.getProgram(pid);
|
|
this.getProgram(pid);
|
|
}
|
|
}
|
|
|
|
+ this.getToolList(this.toolList)
|
|
} else {
|
|
} else {
|
|
// 新增,清空数据
|
|
// 新增,清空数据
|
|
this.resetFile();
|
|
this.resetFile();
|
|
- }
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
// 【新增】按钮-事件
|
|
// 【新增】按钮-事件
|
|
@@ -379,7 +404,8 @@ export default {
|
|
useTime: '',
|
|
useTime: '',
|
|
count: null,
|
|
count: null,
|
|
isEdit: true
|
|
isEdit: true
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ this.getToolList([]);
|
|
},
|
|
},
|
|
|
|
|
|
// 【删除】按钮事件
|
|
// 【删除】按钮事件
|
|
@@ -426,6 +452,7 @@ export default {
|
|
this.$refs.form.clearValidate()
|
|
this.$refs.form.clearValidate()
|
|
this.$refs.form.resetFields()
|
|
this.$refs.form.resetFields()
|
|
this.tenant = this.initTenant()
|
|
this.tenant = this.initTenant()
|
|
|
|
+ this.queryParams = initQueryParams({});
|
|
// 【刀具】清空
|
|
// 【刀具】清空
|
|
this.toolList = []
|
|
this.toolList = []
|
|
// 【程序内容】清空
|
|
// 【程序内容】清空
|