Compare commits

..

3 Commits

Author SHA1 Message Date
478baaabd4 Merge pull request 'projects/mesxc-dy' (#201) from projects/mesxc-dy into projects/mesxc-test
Reviewed-on: #201
2024-02-22 09:31:30 +08:00
helloDy
ff19047729 merge 2024-02-21 18:47:46 +08:00
helloDy
ea7c419c6f 基础核心,设备基础 2024-02-21 18:39:48 +08:00
10 changed files with 347 additions and 99 deletions

View File

@ -1,8 +1,8 @@
### ###
# @Author: Do not edit # @Author: Do not edit
# @Date: 2023-08-29 09:40:39 # @Date: 2023-08-29 09:40:39
# @LastEditTime: 2024-02-21 15:27:58 # @LastEditTime: 2024-02-21 18:47:20
# @LastEditors: zhp # @LastEditors: DY
# @Description: # @Description:
### ###
# 开发环境配置 # 开发环境配置
@ -13,7 +13,7 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://100.64.0.26:48082' # VUE_APP_BASE_API = 'http://100.64.0.26:48082'
VUE_APP_BASE_API = 'http://10.70.2.2:8080' # VUE_APP_BASE_API = 'http://10.70.2.2:8080'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082' # VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.4.173:48080' # VUE_APP_BASE_API = 'http://192.168.4.173:48080'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080' # VUE_APP_BASE_API = 'http://192.168.2.173:48080'
@ -22,11 +22,10 @@ VUE_APP_BASE_API = 'http://10.70.2.2:8080'
# VUE_APP_BASE_API = 'http://192.168.4.159:48080' # VUE_APP_BASE_API = 'http://192.168.4.159:48080'
# VUE_APP_BASE_API = 'http://192.168.1.104:48082' # VUE_APP_BASE_API = 'http://192.168.1.104:48082'
# VUE_APP_BASE_API = 'http://192.168.0.30:8888' # VUE_APP_BASE_API = 'http://192.168.0.30:8888'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082' VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082' # VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.1.62:48082' # VUE_APP_BASE_API = 'http://192.168.1.62:48082'
# VUE_APP_BASE_API = 'http://192.168.1.78:48082' # VUE_APP_BASE_API = 'http://192.168.1.78:48082'
# VUE_APP_BASE_API = 'http://192.168.1.78:48082' # VUE_APP_BASE_API = 'http://192.168.1.78:48082'
# socket地址 # socket地址
VUE_APP_Socket_API = 'ws://10.70.2.2:8080' VUE_APP_Socket_API = 'ws://10.70.2.2:8080'

View File

@ -0,0 +1,35 @@
/*
* @Author: Do not edit
* @Date: 2024-02-21 13:43:02
* @LastEditTime: 2024-02-21 15:00:17
* @LastEditors: DY
* @Description:
*/
import request from '@/utils/request'
// 获得关联表名
export function getplcAllList(query) {
return request({
url: '/base/equipment-plc/listAll',
method: 'get',
params: query
})
}
// 获得设备
export function getEquipmentList(query) {
return request({
url: '/base/core-equipment/page',
method: 'get',
params: query
})
}
// 根据产线获得工段
export function listByParentId(query) {
return request({
url: '/base/core-workshop-section/listByParentId',
method: 'get',
params: query
})
}

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-01-08 16:11:03 * @LastEditTime: 2024-02-21 09:04:48
* @Description: * @Description:
--> -->
<template> <template>
@ -27,7 +27,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="产品名称" prop="name"> <el-form-item label="产品名称" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" clearable placeholder="请输入产品名称" /> <el-input v-model="dataForm.name" :disabled="isdetail || isedit" clearable placeholder="请输入产品名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -35,7 +35,7 @@
<el-input <el-input
v-model="dataForm.code" v-model="dataForm.code"
clearable clearable
:disabled="isdetail" :disabled="isdetail || isedit"
placeholder="请输入产品编码" /> placeholder="请输入产品编码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -44,12 +44,12 @@
<el-select <el-select
v-model="dataForm.materialType" v-model="dataForm.materialType"
filterable filterable
:disabled="isdetail" :disabled="isdetail || isedit"
style="width: 100%" style="width: 100%"
placeholder="请选择物料类型"> placeholder="请选择物料类型">
<el-option <el-option
v-for="dict in getDictDatas('material_type')" v-for="(dict, index) in getDictDatas('material_type')"
:key="dict.value" :key="index"
:label="dict.label" :label="dict.label"
:value="dict.value" /> :value="dict.value" />
</el-select> </el-select>
@ -62,12 +62,12 @@
<el-select <el-select
v-model="dataForm.productType" v-model="dataForm.productType"
filterable filterable
:disabled="isdetail" :disabled="isdetail || isedit"
style="width: 100%" style="width: 100%"
placeholder="请选择产品类型"> placeholder="请选择产品类型">
<el-option <el-option
v-for="dict in getDictDatas(DICT_TYPE.PRODUCT_TYPE)" v-for="(dict, index) in getDictDatas(DICT_TYPE.PRODUCT_TYPE)"
:key="dict.value" :key="index"
:label="dict.label" :label="dict.label"
:value="dict.value" /> :value="dict.value" />
</el-select> </el-select>
@ -78,12 +78,12 @@
<el-select <el-select
v-model="dataForm.unit" v-model="dataForm.unit"
filterable filterable
:disabled="isdetail" :disabled="isdetail || isedit"
style="width: 100%" style="width: 100%"
placeholder="请选择单位"> placeholder="请选择单位">
<el-option <el-option
v-for="dict in getDictDatas(DICT_TYPE.UNIT_DICT)" v-for="(dict, index) in getDictDatas(DICT_TYPE.UNIT_DICT)"
:key="dict.value" :key="index"
:label="dict.label" :label="dict.label"
:value="dict.value" /> :value="dict.value" />
</el-select> </el-select>
@ -91,24 +91,24 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="单位平方数" prop="area"> <el-form-item label="单位平方数" prop="area">
<el-input-number v-model="dataForm.area" :precision="6" :min="0" style="width: 100%" :disabled="isdetail" clearable placeholder="请输入单位平方数" /> <el-input-number v-model="dataForm.area" :precision="6" :min="0" style="width: 100%" :disabled="isdetail || isedit" clearable placeholder="请输入单位平方数" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="规格" prop="specifications"> <el-form-item label="规格" prop="specifications">
<el-input v-model="dataForm.specifications" :disabled="isdetail" @blur="setArea" @clear="clearArea" clearable placeholder="请输入规格" /> <el-input v-model="dataForm.specifications" :disabled="isdetail || isedit" @blur="setArea" @clear="clearArea" clearable placeholder="请输入规格" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="产线生产单位用时(S)" prop="processTime"> <el-form-item label="生产节拍(S)" prop="processTime">
<el-input v-model.number="dataForm.processTime" :precision="4" :min="0" type="number" :disabled="isdetail" clearable placeholder="请输入产线生产单位用时" /> <el-input v-model.number="dataForm.processTime" :precision="4" :min="0" type="number" :disabled="isdetail" clearable placeholder="请输入产线生产单位用时" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="重量" prop="weight"> <el-form-item label="重量" prop="weight">
<el-input-number v-model="dataForm.weight" :precision="6" :min="0" style="width: 100%" :disabled="isdetail" clearable placeholder="请输入重量" /> <el-input-number v-model="dataForm.weight" :precision="6" :min="0" style="width: 100%" :disabled="isdetail || isedit" clearable placeholder="请输入重量" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -241,7 +241,7 @@ export default {
productType: undefined, productType: undefined,
area: undefined, area: undefined,
specifications: undefined, specifications: undefined,
processTime: 0, processTime: undefined,
remark: undefined, remark: undefined,
unit: undefined, unit: undefined,
weight: undefined weight: undefined
@ -249,14 +249,14 @@ export default {
productAttrList: [], productAttrList: [],
visible: false, visible: false,
isdetail: false, isdetail: false,
isedit: false,
idAttrShow: false, idAttrShow: false,
dataRule: { dataRule: {
code: [{ required: true, message: "产品编码不能为空", trigger: "blur" }], code: [{ required: true, message: "产品编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "产品名称不能为空", trigger: "blur" }], name: [{ required: true, message: "产品名称不能为空", trigger: "blur" }],
specifications: [{ required: true, message: "规格不能为空", trigger: "blur" }], specifications: [{ required: true, message: "规格不能为空", trigger: "blur" }],
materialType: [{ required: true, message: "物料类型不能为空", trigger: "change" }], materialType: [{ required: true, message: "物料类型不能为空", trigger: "change" }],
productType: [{ required: true, message: "产品类型不能为空", trigger: "change" }], productType: [{ required: true, message: "产品类型不能为空", trigger: "change" }]
processTime: [{ required: true, message: "产线生产单位用时不能为空", trigger: "blur" }]
} }
}; };
}, },
@ -326,6 +326,8 @@ export default {
this.initData(); this.initData();
this.isdetail = isdetail || false; this.isdetail = isdetail || false;
this.dataForm.id = id || undefined; this.dataForm.id = id || undefined;
this.isedit = id ? true : false;
console.log('你好', this.isedit)
this.visible = true; this.visible = true;
if (id) { if (id) {
this.idAttrShow = true this.idAttrShow = true
@ -343,10 +345,9 @@ export default {
// this.dataForm.area = response.data.area || 0 // this.dataForm.area = response.data.area || 0
// this.dataForm.weight = response.data.weight || 0 // this.dataForm.weight = response.data.weight || 0
// this.dataForm.specifications = response.data.specifications || undefined // this.dataForm.specifications = response.data.specifications || undefined
console.log('11res112', this.dataForm.specifications, this.dataForm.weight, this.dataForm.area) // if (this.dataForm.unit !== undefined) {
if (this.dataForm.unit !== undefined) { // this.dataForm.unit = String(this.dataForm.unit)
this.dataForm.unit = String(this.dataForm.unit) // }
}
if (this.dataForm.materialType !== undefined) { if (this.dataForm.materialType !== undefined) {
this.dataForm.materialType = String(this.dataForm.materialType) this.dataForm.materialType = String(this.dataForm.materialType)
} }

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-21 18:59:54 * @LastEditTime: 2024-02-18 13:53:09
* @Description: * @Description:
--> -->
<template> <template>
@ -12,18 +12,6 @@
ref="dataForm" ref="dataForm"
@keyup.enter.native="dataFormSubmit()" @keyup.enter.native="dataFormSubmit()"
label-width="100px"> label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线名称" prop="name">
<el-input v-model="dataForm.name" clearable placeholder="请输入产线名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产线编号" prop="code">
<el-input v-model="dataForm.code" clearable placeholder="请输入产线编号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工厂名称" prop="factoryId"> <el-form-item label="工厂名称" prop="factoryId">
@ -41,6 +29,36 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="车间名称" prop="roomNameDict">
<el-select
v-model="dataForm.roomNameDict"
filterable
:disabled="isdetail || isedit"
style="width: 100%"
placeholder="请选择车间名称">
<el-option
v-for="(dict, index) in getDictDatas('workshop')"
:key="index"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线名称" prop="name">
<el-input v-model="dataForm.name" clearable placeholder="请输入产线名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产线编号" prop="code">
<el-input v-model="dataForm.code" clearable placeholder="请输入产线编号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="产线TT值(h)" prop="tvalue"> <el-form-item label="产线TT值(h)" prop="tvalue">
<el-input <el-input
v-model.number="dataForm.tvalue" v-model.number="dataForm.tvalue"
@ -92,11 +110,13 @@ export default {
tvalue: 0, tvalue: 0,
factoryId: undefined, factoryId: undefined,
remark: undefined, remark: undefined,
roomNameDict: undefined
}, },
factoryList: [], factoryList: [],
dataRule: { dataRule: {
code: [{ required: true, message: "产线编号不能为空", trigger: "blur" }], code: [{ required: true, message: "产线编号不能为空", trigger: "blur" }],
name: [{ required: true, message: "产线名称不能为空", trigger: "blur" }], name: [{ required: true, message: "产线名称不能为空", trigger: "blur" }],
roomNameDict: [{ required: true, message: "车间名称不能为空", trigger: "blur" }],
factoryId: [{ required: true, message: "工厂不能为空", trigger: "blur" }] factoryId: [{ required: true, message: "工厂不能为空", trigger: "blur" }]
} }
}; };

View File

@ -47,6 +47,7 @@ import {
} from '@/api/base/coreProductionLine'; } from '@/api/base/coreProductionLine';
import { getStatus } from '@/api/core/base/productionLine'; import { getStatus } from '@/api/core/base/productionLine';
import codeFilter from '../../core/mixins/code-filter'; import codeFilter from '../../core/mixins/code-filter';
import { publicFormatter } from '@/utils/dict';
const tableProps = [ const tableProps = [
{ {
@ -58,6 +59,11 @@ const tableProps = [
prop: 'factoryName', prop: 'factoryName',
label: '工厂' label: '工厂'
}, },
{
prop: 'roomNameDict',
label: '车间名称',
filter: publicFormatter('workshop')
},
{ {
prop: 'name', prop: 'name',
label: '产线名称' label: '产线名称'
@ -71,10 +77,10 @@ const tableProps = [
label: '当前状态', label: '当前状态',
filter: codeFilter('lineStatus') filter: codeFilter('lineStatus')
}, },
{ // {
prop: 'tvalue', // prop: 'tvalue',
label: '产线TT值(h)' // label: '线TT(h)'
}, // },
{ {
prop: 'description', prop: 'description',
label: '描述' label: '描述'
@ -82,7 +88,7 @@ const tableProps = [
{ {
prop: 'remark', prop: 'remark',
label: '备注' label: '备注'
}, }
]; ];
export default { export default {

View File

@ -116,6 +116,22 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span='8'>
<el-form-item label="负责车间" prop="roomNameDict">
<el-select
v-model="dataForm.roomNameDict"
filterable
:disabled="isdetail || isedit"
style="width: 100%"
placeholder="请选择车间名称">
<el-option
v-for="(dict, index) in getDictDatas('workshop')"
:key="index"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span='8'> <el-col :span='8'>
<el-form-item label="关联产线" prop="productLineIds"> <el-form-item label="关联产线" prop="productLineIds">
<el-select v-model="dataForm.productLineIds" placeholder="请选择关联产线" multiple style="width: 100%;"> <el-select v-model="dataForm.productLineIds" placeholder="请选择关联产线" multiple style="width: 100%;">
@ -180,6 +196,7 @@ export default {
productLineIds: [], productLineIds: [],
type: '', type: '',
workers: '', workers: '',
roomNameDict: '',
status: 1 status: 1
}, },
rules: { rules: {
@ -187,6 +204,7 @@ export default {
planProductId: [{ required: true, message: "产品名称不能为空", trigger: "change" }], planProductId: [{ required: true, message: "产品名称不能为空", trigger: "change" }],
planAssignQuantity: [{ required: true, message: "计划投入数量不能为空", trigger: "blur" }], planAssignQuantity: [{ required: true, message: "计划投入数量不能为空", trigger: "blur" }],
planQuantity: [{ required: true, message: "计划生产数量不能为空", trigger: "blur" }], planQuantity: [{ required: true, message: "计划生产数量不能为空", trigger: "blur" }],
roomNameDict: [{ required: true, message: "车间名称不能为空", trigger: "blur" }],
productLineIds: [{ required: true, message: "关联产线不能为空", trigger: "change" }] productLineIds: [{ required: true, message: "关联产线不能为空", trigger: "change" }]
}, },
productList: [], productList: [],
@ -264,19 +282,19 @@ export default {
this.urlOptions.createURL(this.dataForm).then(response => { this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.visible = false; this.visible = false;
this.$confirm('是否添加预使用主原料信息?', '提示', { // this.$confirm('使?', '', {
confirmButtonText: '确定', // confirmButtonText: '',
cancelButtonText: '取消', // cancelButtonText: '',
type: 'warning' // type: 'warning'
}).then(() => { // }).then(() => {
console.log('121', this.dataForm.name) // console.log('121', this.dataForm.name)
this.$emit("refreshDataList", { // this.$emit("refreshDataList", {
id: response.data, // id: response.data,
name: this.dataForm.name // name: this.dataForm.name
}); // });
}).catch(() => { // }).catch(() => {
this.$emit("refreshDataList"); // this.$emit("refreshDataList");
}); // });
}); });
}); });
}, },

View File

@ -60,6 +60,7 @@ import {
getConOrderList, getConOrderList,
getCoreWOList getCoreWOList
} from '@/api/base/coreWorkOrder'; } from '@/api/base/coreWorkOrder';
import { publicFormatter } from '@/utils/dict';
const tableProps = [ const tableProps = [
@ -82,6 +83,13 @@ const tableProps = [
minWidth: 150, minWidth: 150,
showOverflowtooltip: true showOverflowtooltip: true
}, },
{
prop: 'roomNameDict',
label: '负责车间',
minWidth: 120,
filter: publicFormatter('workshop'),
showOverflowtooltip: true
},
{ {
prop: 'workers', prop: 'workers',
label: '负责人', label: '负责人',
@ -101,7 +109,7 @@ const tableProps = [
{ {
prop: 'status', prop: 'status',
label: '工单状态', label: '工单状态',
filter: (val) => ['', '等待', '激活', '暂停', '完成', '', '', '', '', '作废'][val] filter: (val) => ['', '等待', '激活', '暂停', '完成', '作废', '终止'][val]
}, },
{ {
prop: 'planFinishTime', prop: 'planFinishTime',
@ -223,6 +231,20 @@ export default {
] ]
} }
}, },
{
type: 'stop',
btnName: '终止',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 2
}
]
}
},
this.$auth.hasPermi(`base:core-work-order:detail`) this.$auth.hasPermi(`base:core-work-order:detail`)
? { ? {
type: 'detail', type: 'detail',
@ -289,7 +311,8 @@ export default {
{ id: 2, name: '激活' }, { id: 2, name: '激活' },
{ id: 3, name: '暂停' }, { id: 3, name: '暂停' },
{ id: 4, name: '完成' }, { id: 4, name: '完成' },
{ id: 9, name: '作废' } { id: 5, name: '作废' },
{ id: 6, name: '终止' }
], ],
param: 'status', param: 'status',
clearable: true clearable: true
@ -401,13 +424,17 @@ export default {
opration = '暂停' opration = '暂停'
} }
if (val.type === 'nullify') { if (val.type === 'nullify') {
param.status = 9 param.status = 5
opration = '废' opration = '废'
} }
if (val.type === 'finish') { if (val.type === 'finish') {
param.status = 4 param.status = 4
opration = '完成' opration = '完成'
} }
if (val.type === 'stop') {
param.status = 6
opration = '终止'
}
console.log('22',val) console.log('22',val)
this.$confirm(`确定${opration}${'"工单' + val.data.name + '"'}?`, "提示", { this.$confirm(`确定${opration}${'"工单' + val.data.name + '"'}?`, "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-12-04 15:10:11 * @LastEditTime: 2024-02-21 09:41:39
* @Description: * @Description:
--> -->
<template> <template>
@ -59,7 +59,7 @@
style="width: 100%" style="width: 100%"
placeholder="请选择物料类型"> placeholder="请选择物料类型">
<el-option <el-option
v-for="dict in materialList" v-for="dict in getDictDatas('material_type')"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" /> :value="dict.value" />
@ -238,7 +238,7 @@ export default {
remark: undefined, remark: undefined,
unit: '' unit: ''
}, },
materialList: [], // materialList: [],
supplierList: [], supplierList: [],
materialAttrList: [], materialAttrList: [],
unitList: [], unitList: [],
@ -258,17 +258,18 @@ export default {
methods: { methods: {
async getDict() { async getDict() {
// //
const res = await listData({ // const res = await listData({
pageNo: 1, // pageNo: 1,
pageSize: 99, // pageSize: 99,
dictType: 'material_type', // dictType: 'material_type',
}); // });
this.materialList = res.data.list.map(item => { // this.materialList = res.data.list
return { // this.materialList = res.data.list.map(item => {
label: item.label, // return {
value: Number(item.value) // label: item.label,
} // value: Number(item.value)
}); // }
// });
// //
const supplierRes = await getSupplierList(); const supplierRes = await getSupplierList();
this.supplierList = supplierRes.data; this.supplierList = supplierRes.data;
@ -348,6 +349,9 @@ export default {
if (this.dataForm.unit) { if (this.dataForm.unit) {
this.dataForm.unit = String(this.dataForm.unit) this.dataForm.unit = String(this.dataForm.unit)
} }
if (this.dataForm.type) {
this.dataForm.type = String(this.dataForm.type)
}
}); });
// //
this.getList(); this.getList();

View File

@ -45,7 +45,10 @@
@close="cancel" @close="cancel"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" /> <!-- <DialogForm v-if="open" ref="form" v-model="form" :rows="rows" /> -->
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit" />
</base-dialog> </base-dialog>
<!-- 抽屉 详情 --> <!-- 抽屉 详情 -->
@ -123,11 +126,12 @@ import basicPageMixin from '@/mixins/lb/basicPageMixin';
// import './http'; // import './http';
import BasicDrawer from './components/BasicDrawer.vue'; import BasicDrawer from './components/BasicDrawer.vue';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
import AddOrUpdate from './add-or-updata';
export default { export default {
name: 'EquipmentPlcConnect', name: 'EquipmentPlcConnect',
mixins: [basicPageMixin], mixins: [basicPageMixin],
components: { BasicDrawer }, components: { BasicDrawer, AddOrUpdate },
data() { data() {
return { return {
searchBarKeys: ['equipmentId', 'plcId'], searchBarKeys: ['equipmentId', 'plcId'],
@ -343,6 +347,10 @@ export default {
this.initSearchOptions(); this.initSearchOptions();
}, },
methods: { methods: {
successSubmit() {
this.cancel()
this.getList()
},
async getEquipmentOptions() { async getEquipmentOptions() {
const res = await this.$axios({ const res = await this.$axios({
url: '/base/core-equipment/listAll', url: '/base/core-equipment/listAll',
@ -469,26 +477,7 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs.addOrUpdate.dataFormSubmit()
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
}, },
// //

View File

@ -0,0 +1,149 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-21 18:31:44
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="100px">
<el-form-item label="设备" prop="equipmentId">
<el-cascader
placeholder="请选择设备"
v-model="dataForm.equipmentId"
:options="plLineList"
:props="{value: 'id', label: 'name', children: 'children'}"
filterable />
</el-form-item>
<el-form-item label="关联表名" prop="plcId">
<el-select
v-model="dataForm.plcId"
filterable
placeholder="请选择关联表"
style="width: 100%">
<el-option
v-for="dict in plcList"
:key="dict.id"
:label="dict.plcTableName"
:value="dict.id" />
</el-select>
</el-form-item>
</el-form>
</template>
<script>
import basicAdd from '../../../../core/mixins/basic-add';
import { createCorePL, updateCorePL, getCorePL, getCode, getCorePLList } from "@/api/base/coreProductionLine";
import { createEquipmentPlcConnect, updateEquipmentPlcConnect } from '@/api/base/equipmentPlcConnect';
import { getplcAllList, listByParentId } from "@/api/equipment/base/config/config";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createCorePL,
updateURL: updateCorePL,
infoURL: getCorePL,
},
dataForm: {
id: undefined,
equipmentId: undefined,
plcId: undefined
},
plcList: [],
plLineList: [],
dataRule: {
equipmentId: [{ required: true, message: "设备不能为空", trigger: "blur" }],
plcId: [{ required: true, message: "关联表名不能为空", trigger: "blur" }]
},
options: [{
value: 'zhinan',
label: '指南',
children: [{
value: 'shejiyuanze',
label: '设计原则',
children: [{
value: 'yizhi',
label: '一致'
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '导航'
}]
}]
};
},
created() {
this.getDict()
},
methods: {
async getDict() {
//
const res = await getplcAllList();
this.plcList = res.data;
// 线
const res1 = await getCorePLList();
this.plLineList = res1.data;
this.plLineList.forEach(item => {
listByParentId({ id: item.id }).then(resp => {
if (resp.data.length > 0) {
// item.children = resp.data
this.$set(item, 'children', resp.data)
// this.$forceUpdate()
}
})
})
console.log('你好', this.plLineList)
},
//
dataFormSubmit() {
console.log('11', this.dataForm.equipmentId)
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
updateEquipmentPlcConnect({
id: this.dataForm.id,
equipmentId: this.dataForm.equipmentId[this.dataForm.equipmentId.length],
plcId: this.dataForm.plcId
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
//
createEquipmentPlcConnect({
id: this.dataForm.id,
equipmentId: this.dataForm.equipmentId[this.dataForm.equipmentId.length - 1],
plcId: this.dataForm.plcId
}).then(response => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
}
}
};
</script>