|
@@ -58,31 +58,26 @@
|
|
|
:data="toolList"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
- <el-table-column prop="toolId" :label='$t("resource.table.programTool.toolName")'>
|
|
|
- <template slot="header">
|
|
|
- <span>{{$t("resource.table.programTool.toolName")}}</span>
|
|
|
- <span class="star">*</span>
|
|
|
- </template>
|
|
|
+ <el-table-column prop="cuttingToolCategory" :label='$t("resource.table.programTool.cuttingToolCategory")'>
|
|
|
+ <template slot="header">
|
|
|
+ <span>{{$t("resource.table.programTool.cuttingToolCategory")}}</span>
|
|
|
+ <span class="star">*</span>
|
|
|
+ </template>
|
|
|
<template slot-scope="{ row }">
|
|
|
- <el-select v-model="row.toolId" filterable :placeholder='$t("common.pleaseEnter")'>
|
|
|
- <el-option-group
|
|
|
- v-for="item in toolSelectList"
|
|
|
- :key="item.label"
|
|
|
- :label="item.label">
|
|
|
+ <el-select v-model="row.cuttingToolCategory" filterable :placeholder='$t("common.pleaseEnter")'>
|
|
|
<el-option
|
|
|
- v-for="option in item.options"
|
|
|
- :key="option.id"
|
|
|
- :label="option.cuttingToolName"
|
|
|
- :value="option.id">
|
|
|
- </el-option>
|
|
|
- </el-option-group>
|
|
|
+ v-for="(item,key,index) in dicts.CUTTING_TOOL_CATEGORY"
|
|
|
+ :key="index"
|
|
|
+ :label="item"
|
|
|
+ :value="key">
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="useTime" :label='$t("resource.table.programTool.useTime")'>
|
|
|
- <template slot="header">
|
|
|
+ <template slot="header">
|
|
|
<span>{{$t("resource.table.programTool.useTime")}}</span>
|
|
|
- <span class="star">*</span>
|
|
|
+ <span class="star">*</span>
|
|
|
</template>
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-input-number v-model="row.useTime" :min="1" :max="999999999" label='$t("common.pleaseEnter")'></el-input-number>
|
|
@@ -137,7 +132,7 @@ import productionResourcesMgrApi from "@/api/resourceProductMgr/productionResour
|
|
|
import attachmentMgrApi from "@/api/Attachment"
|
|
|
import db from "@/utils/localstorage";
|
|
|
import {Base64} from 'js-base64';
|
|
|
-import { initQueryParams } from '@/utils/commons'
|
|
|
+import {initDicts, initQueryParams} from '@/utils/commons'
|
|
|
export default {
|
|
|
name: 'ProgramncMgr',
|
|
|
props: {
|
|
@@ -156,10 +151,13 @@ export default {
|
|
|
selectedEq: [], // 新增和修改的设备[设备]数据-来自·(可执行设备(位置))
|
|
|
subBtn: false,
|
|
|
formDisabled: false,
|
|
|
+ dicts: {
|
|
|
+ CUTTING_TOOL_CATEGORY: {}
|
|
|
+ },
|
|
|
tableData: [],
|
|
|
eqList: [], // 设备下拉类别数据
|
|
|
toolList: [], // 刀具列表
|
|
|
- toolSelectList: [], // 刀具下拉数据
|
|
|
+ toolSelectList: [], // 刀具下拉数据
|
|
|
queryParams: initQueryParams({}),
|
|
|
pgContent: '', // 程序内容
|
|
|
type: 'add',
|
|
@@ -190,7 +188,7 @@ export default {
|
|
|
workTime: [
|
|
|
{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
|
],
|
|
|
- toolId: [
|
|
|
+ cuttingToolCategory: [
|
|
|
{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
|
]
|
|
|
|
|
@@ -199,10 +197,11 @@ export default {
|
|
|
},
|
|
|
// 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
created() {
|
|
|
+ initDicts(['CUTTING_TOOL_CATEGORY'], this.dicts);
|
|
|
// 查询【程序】信息
|
|
|
if(!!this.programId){
|
|
|
this.getProgram(this.programId)
|
|
|
- }
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
programId(val){
|
|
@@ -248,33 +247,33 @@ export default {
|
|
|
getToolList(arrs){
|
|
|
this.queryParams.current = 1
|
|
|
this.queryParams.size = 9999
|
|
|
- this.queryParams.map.state = 1
|
|
|
+ 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.toolId}).join(',')
|
|
|
- }
|
|
|
-
|
|
|
+ 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 = []
|
|
|
+ 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
|
|
|
+ let groupObj = {}
|
|
|
+ groupObj.label = item.cuttingToolType.data
|
|
|
groupObj.options = [item]
|
|
|
arr.push(groupObj)
|
|
|
- }
|
|
|
+ }
|
|
|
});
|
|
|
- this.toolSelectList = arr
|
|
|
+ this.toolSelectList = arr
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -302,9 +301,9 @@ export default {
|
|
|
console.log("文件上传成功!", response)
|
|
|
if(response.isSuccess){
|
|
|
// [上传程序]字段的值
|
|
|
- this.tenant.filePath = response.data.url
|
|
|
+ this.tenant.filePath = response.data.url
|
|
|
this.fileObj.filePath = response.data.url
|
|
|
- this.$refs.form.validateField('filePath');
|
|
|
+ this.$refs.form.validateField('filePath');
|
|
|
// [程序大小]字段的值
|
|
|
this.fileObj.size = response.data.size
|
|
|
// [程序id]
|
|
@@ -314,7 +313,7 @@ export default {
|
|
|
// 查询【程序】信息
|
|
|
// this.getProgram(response.data.filename)
|
|
|
//this.getProgram(response.data.bizId);
|
|
|
- this.getProContent(response.data.bizId)
|
|
|
+ this.getProContent(response.data.bizId)
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -333,7 +332,7 @@ export default {
|
|
|
return {
|
|
|
id: '',
|
|
|
resourceIds: '',
|
|
|
- submittedFileName: '',
|
|
|
+ submittedFileName: '',
|
|
|
workTime: '',
|
|
|
filePath: '',
|
|
|
size: null,
|
|
@@ -368,7 +367,7 @@ export default {
|
|
|
setTenant (val, selectedEq) {
|
|
|
// console.log("设备:", val)
|
|
|
// 表单下拉数据,赋值,动态数据
|
|
|
- this.selectedEq = selectedEq;
|
|
|
+ this.selectedEq = selectedEq;
|
|
|
|
|
|
if(val){
|
|
|
// 刀具管理
|
|
@@ -380,7 +379,7 @@ export default {
|
|
|
resourceId: val.resourceId,
|
|
|
resourceIds: val.resourceId +','+ val.name,
|
|
|
workTime: val.workTime,
|
|
|
- filePath: val.filePath
|
|
|
+ filePath: val.filePath
|
|
|
};
|
|
|
this.fileObj= {
|
|
|
nc: '1', // 表示已经上传
|
|
@@ -402,14 +401,14 @@ export default {
|
|
|
} else {
|
|
|
// 新增,清空数据
|
|
|
this.resetFile();
|
|
|
- }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 【新增】按钮-事件
|
|
|
addRes(){
|
|
|
this.toolList.push({
|
|
|
key: "WKS_"+ Math.random(),
|
|
|
- toolId: '',
|
|
|
+ cuttingToolCategory: '',
|
|
|
toolName: '',
|
|
|
useTime: '',
|
|
|
count: null,
|
|
@@ -470,7 +469,7 @@ export default {
|
|
|
// 清空上传附件
|
|
|
this.fileList = []
|
|
|
},
|
|
|
- submitForm () {
|
|
|
+ submitForm () {
|
|
|
let idArr = new Array();
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
let bool = true;
|
|
@@ -478,22 +477,22 @@ export default {
|
|
|
if(this.toolList.length ==0 && this.toolSelectList.length>0){
|
|
|
bool = false
|
|
|
msg = "刀具设备不能为空"
|
|
|
- }else if(this.toolList.length>0) {
|
|
|
+ }else if(this.toolList.length>0) {
|
|
|
this.toolList.forEach(item => {
|
|
|
- if(!item.toolId){
|
|
|
+ if(!item.cuttingToolCategory){
|
|
|
bool = false
|
|
|
- msg = "刀具名称不能为空"
|
|
|
+ msg = "刀具类别不能为空"
|
|
|
return false
|
|
|
}else{
|
|
|
- if(idArr.indexOf(item.toolId)<0){
|
|
|
- idArr.push(item.toolId)
|
|
|
+ if(idArr.indexOf(item.cuttingToolCategory)<0){
|
|
|
+ idArr.push(item.cuttingToolCategory)
|
|
|
}else{
|
|
|
bool = false
|
|
|
- msg = "同名刀具不能重复选择"
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ msg = "同名类别不能重复选择"
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
if(!bool){
|
|
|
this.$message({
|
|
@@ -505,15 +504,15 @@ export default {
|
|
|
|
|
|
if (valid) {
|
|
|
//添加数据
|
|
|
- this.tenant.toolList = this.toolList;
|
|
|
+ this.tenant.toolList = this.toolList;
|
|
|
let obj = {...this.tenant, ...this.fileObj};
|
|
|
// 添加【刀具管理】
|
|
|
if(obj.toolList && obj.toolList.length > 0){
|
|
|
let arr = [];
|
|
|
obj.toolList.map(item => {
|
|
|
- let target = this.toolSelectList.filter(obj => obj.id = item.toolId)[0];
|
|
|
+ let target = this.toolSelectList.filter(obj => obj.id = item.cuttingToolCategory)[0];
|
|
|
// 把刀具名称带出来
|
|
|
- item.toolName = target.cuttingToolName;
|
|
|
+ //item.toolName = target.cuttingToolName;
|
|
|
// 添加数据
|
|
|
arr.push(item);
|
|
|
});
|
|
@@ -555,7 +554,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- getProContent(bizId){
|
|
|
+ getProContent(bizId){
|
|
|
let that = this
|
|
|
programCenterApi.getProgramContent({bizId: bizId}).then(res => {
|
|
|
res = res.data
|
|
@@ -567,7 +566,7 @@ export default {
|
|
|
},
|
|
|
// 根据[程序ID]获取文件内容
|
|
|
getProgram(programId){
|
|
|
-
|
|
|
+
|
|
|
programCenterApi.getProgram({id: programId}).then(res => {
|
|
|
res = res.data
|
|
|
// 上传遮罩-关闭
|
|
@@ -591,7 +590,7 @@ export default {
|
|
|
this.fileObj.submittedFileName = obj.submittedFileName
|
|
|
this.fileObj.filePath = obj.filePath
|
|
|
this.fileObj.pgContent = obj.content
|
|
|
- //this.fileObj.runTime = obj.runTime
|
|
|
+ //this.fileObj.runTime = obj.runTime
|
|
|
//this.fileObj.toolList = obj.toolList
|
|
|
//this.fileObj.toolNums = obj.toolList ? obj.toolList.length : 0
|
|
|
}
|