<template>
<el-dialog :title="'编辑参数'" :close-on-click-modal="false" append-to-body :visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center" lock-scroll width="1600px">
<el-row :gutter="15" class="">
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px"
label-position="right">
<template v-if="!loading">
<el-col :span="12" v-if="jnpf.hasFormP('equipmentledgerid')">
<el-form-item label="设备设施" prop="equipmentledgerid">
<JNPFTreeSelect v-model="getequipmentledger" @change="selectequipment(), eqchangeData()"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable
:options="equipmentledgeridOptions" :props="equipmentledgeridProps">
</JNPFTreeSelect>
</el-form-item>
</el-col>
<el-col :span="12" v-if="jnpf.hasFormP('processid')">
<el-form-item label="工序" prop="processid">
<JNPFTreeSelect v-model="getprocess" placeholder="请选择" clearable :disabled="true"
:style='{ "width": "100%" }' filterable :options="processidOptions"
:props="processidProps">
</JNPFTreeSelect>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label-width="0">
<div class="JNPF-common-title">
<h2>设备参数明细</h2>
<el-button
style="position: absolute; left: 20vh; z-index: 99; background-color: #409EFF; color: white;"
icon="el-icon-search" @click="getequiptypepara()">
获取设备类型参数
</el-button>
</div>
<el-table :data="dataForms" size='mini' overflow-x: scroll>
<el-table-column type="index" width="50" label="序号" align="center" fixed="left" />
<el-table-column prop="processid" label="工序" width="150" align="center">
<template slot="header">
<span class="required-sign">*</span>工序
</template>
<template slot-scope="scope">
<JNPFTreeSelect v-model="scope.row.processid" :disabled="true"
@change="changeData('processid', -1)" placeholder="请选择" clearable
:style='{ "width": "100%" }' filterable :options="processidOptions"
:props="processidProps">
</JNPFTreeSelect>
</template>
</el-table-column>
<el-table-column prop="equipmentledgerid" label="设备设施" width="200" align="center">
<template slot="header">
<span class="required-sign">*</span>设备设施
</template>
<template slot-scope="scope">
<JNPFTreeSelect v-model="scope.row.equipmentledgerid" :disabled="true"
@change="changeData('equipmentledgerid', -1)" placeholder="请选择" clearable
:style='{ "width": "100%" }' filterable :options="equipmentledgeridOptions"
:props="equipmentledgeridProps">
</JNPFTreeSelect>
</template>
</el-table-column>
<el-table-column prop="fullname" label="参数名称" width="150" align="center" fixed="left">
<template slot="header">
<span class="required-sign">*</span>参数名称
</template>
<template slot-scope="scope">
<el-input v-model="scope.row.fullname" @change="changeData('fullname', -1)"
:disabled="true" placeholder="请输入" clearable :style='{ "width": "100%" }'>
</el-input>
</template>
</el-table-column>
<el-table-column prop="tag" label="DAtag" width="200" align="center">
<template slot="header">
<span class="required-sign">*</span>DAtag
</template>
<template slot-scope="scope">
<el-input v-model="scope.row.tag" @change="changeData('tag', -1)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</el-input>
</template>
</el-table-column>
<el-table-column prop="datatypes" label="数据类型" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>数据类型
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.datatypes" @change="changeData('datatypes', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in datatypesOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="parametertype" label="参数类型" width="100" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.parametertype"
@change="changeData('parametertype', -1)" placeholder="请选择" clearable
:style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in parametertypeOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="unit" label="单位" width="100" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.unit" @change="changeData('unit', -1)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</el-input>
</template>
</el-table-column>
<el-table-column prop="isrealtime" label="曲线" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>曲线
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.isrealtime" @change="changeData('isrealtime', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in isrealtimeOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="enabledmark" label="可用" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>可用
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.enabledmark"
@change="changeData('enabledmark', -1)" placeholder="请选择" clearable
:style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in enabledmarkOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="isconstantvalue" label="恒值" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>恒值
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.isconstantvalue"
@change="changeData('isconstantvalue', -1)" placeholder="请选择" clearable
:style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in isconstantvalueOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="isonline" label="在线" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>在线
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.isonline" @change="changeData('isonline', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in isonlineOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="isrunning" label="运行" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>运行
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.isrunning" @change="changeData('isrunning', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in isrunningOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="iszero" label="0值" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>0值
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.iszero" @change="changeData('iszero', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in iszeroOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="ishahf" label="高幅高频" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>高幅高频
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.ishahf" @change="changeData('ishahf', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in ishahfOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="isontime" label="实时" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>实时
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.isontime" @change="changeData('isontime', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in isontimeOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="isdispatch" label="调度" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>调度
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.isdispatch" @change="changeData('isdispatch', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in isdispatchOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="ishigh" label="上限" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>上限
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.ishigh" @change="changeData('ishigh', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in ishighOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="highthreshold" label="上阈值" width="150" align="center">
<template slot-scope="scope">
<el-input-number v-model="scope.row.highthreshold" :controls="false"
@change="changeData('highthreshold', -1)" placeholder="数字文本" :step="1"
:precision="2">
</el-input-number>
</template>
</el-table-column>
<el-table-column prop="islow" label="下限" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>下限
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.islow" @change="changeData('islow', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in islowOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="lowthreshold" label="下阈值" width="150" align="center">
<template slot-scope="scope">
<el-input-number v-model="scope.row.lowthreshold" :controls="false"
@change="changeData('lowthreshold', -1)" placeholder="数字文本" :step="1"
:precision="2">
</el-input-number>
</template>
</el-table-column>
<el-table-column prop="runtag" label="运行tag" width="200" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.runtag" @change="changeData('runtag', -1)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</el-input>
</template>
</el-table-column>
<el-table-column prop="labels" label="功能标签" width="200" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.labels" @change="changeData('labels', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable
:multiple="true">
<el-option v-for="(item, index) in labelsOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="issync" label="同步" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>同步
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.issync" @change="changeData('issync', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }' filterable>
<el-option v-for="(item, index) in issyncOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="syncparaencode" label="同步参数编码" width="150" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.syncparaencode"
@change="changeData('syncparaencode', -1)" placeholder="请输入" clearable
:style='{ "width": "100%" }'>
</el-input>
</template>
</el-table-column>
<el-table-column prop="accuracys" label="数据精度" width="100" align="center">
<template slot="header">
<span class="required-sign">*</span>数据精度
</template>
<template slot-scope="scope">
<el-select v-model="scope.row.accuracys" @change="changeData('accuracys', -1)"
placeholder="请选择" clearable :style='{ "width": "100%" }'>
<el-option v-for="(item, index) in accuracysOptions" :key="index"
:label="item.fullName" :value="item.enCode"
:disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="duration" label="时长" width="150" align="center">
<template slot-scope="scope">
<el-input-number v-model="scope.row.duration" :controls="false"
@change="changeData('duration', -1)" placeholder="数字文本" :step="1">
</el-input-number>
</template>
</el-table-column>
<el-table-column prop="sortcode" label="排序" width="150" align="center">
<template slot-scope="scope">
<el-input-number v-model="scope.row.sortcode" :controls="false"
@change="changeData('sortcode', -1)" placeholder="数字文本" :step="1">
</el-input-number>
</template>
</el-table-column>
<el-table-column prop="description" label="描述" width="200" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.description"
@change="changeData('description', -1)" placeholder="请输入" clearable
:style='{ "width": "100%" }'>
</el-input>
</template>
</el-table-column>
<el-table-column label="操作" width="50" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delentryList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- <div class="table-actions" @click="addentryList()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div> -->
</el-form-item>
</el-col>
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible = false" />
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> 取 消</el-button>
<el-button type="primary" @click="dataFormSubmits()" :loading="btnLoading"> 确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
export default {
components: {},
props: [],
data() {
return {
visible: false,
loading: false,
btnLoading: false,
selectDialogVisible: false,
currTableConf: {},
addTableConf: {
},
tableRows: {
},
currVmodel: "",
getequipmentledger: "",
devicetypeparalist: [],
getprocess: "",
dataForms: [],
dataForm: {
equipmentledgerid: "",
processid: "",
encode: '',
fullname: '',
tag: '',
datatypes: "",
parametertype: "",
unit: '',
isrealtime: "0",
enabledmark: "1",
isconstantvalue: "0",
isonline: "0",
isrunning: "0",
iszero: "0",
ishahf: "0",
isontime: "0",
isdispatch: "0",
ishigh: "0",
highthreshold: undefined,
islow: "0",
lowthreshold: undefined,
runtag: '',
labels: [],
issync: "0",
syncparaencode: '',
accuracys: "ma",
duration: undefined,
sortcode: undefined,
description: '',
creatoruserid: "",
creatortime: "",
lastmodifyuserid: "",
lastmodifytime: "",
},
rules:
{
getequipmentledger: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
getprocessid: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
fullname: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
tag: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
datatypes: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
isrealtime: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
enabledmark: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
isconstantvalue: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
isonline: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
isrunning: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
iszero: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
ishahf: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
isontime: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
isdispatch: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
ishigh: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
islow: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
issync: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
},
equipmentledgeridOptions: [],
equipmentledgeridProps: { "label": "F_FullName", "value": "F_Id", "children": "children" },
processidOptions: [],
processidProps: { "label": "processname", "value": "id", "children": "children" },
datatypesOptions: [],
parametertypeOptions: [],
isrealtimeOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
enabledmarkOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
isconstantvalueOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
isonlineOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
isrunningOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
iszeroOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
ishahfOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
isontimeOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
isdispatchOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
ishighOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
islowOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
labelsOptions: [],
issyncOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "0" }],
accuracysOptions: [],
eqinfolist: [],
childIndex: -1,
isEdit: false,
interfaceRes: {
equipmentledgerid: [
],
processid: [
],
encode: [
],
fullname: [
],
tag: [
],
datatypes: [
],
parametertype: [
],
unit: [
],
isrealtime: [
],
enabledmark: [
],
isconstantvalue: [
],
isonline: [
],
isrunning: [
],
iszero: [
],
ishahf: [
],
isontime: [
],
isdispatch: [
],
ishigh: [
],
highthreshold: [
],
islow: [
],
lowthreshold: [
],
runtag: [
],
labels: [
],
issync: [
],
syncparaencode: [
],
accuracys: [
],
duration: [
],
sortcode: [
],
description: [
],
creatoruserid: [
],
creatortime: [
],
lastmodifyuserid: [
],
lastmodifytime: [
],
},
}
},
computed: {},
watch: {},
created() {
this.dataAll()
},
mounted() { },
methods: {
sparepartscostentryExist() {
let isOk = true;
for (let i = 0; i < this.dataForms.length; i++) {
const e = this.dataForms[i];
if (!e.equipmentledgerid) {
this.$message({
message: '设备设施不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.processid) {
this.$message({
message: '工序不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.fullname) {
this.$message({
message: '参数名称不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.tag) {
this.$message({
message: 'tag不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.datatypes) {
this.$message({
message: '数据类型不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.isrealtime) {
this.$message({
message: '曲线不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.enabledmark) {
this.$message({
message: '是否有效不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.isconstantvalue) {
this.$message({
message: '恒值不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.isonline) {
this.$message({
message: '在线不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.isrunning) {
this.$message({
message: '运行不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.iszero) {
this.$message({
message: '0值不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.ishahf) {
this.$message({
message: '高幅高频不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.isontime) {
this.$message({
message: '实时不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.isdispatch) {
this.$message({
message: '调度不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.ishigh) {
this.$message({
message: '是否上限不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (e.ishigh == "1" && !e.highthreshold) {
this.$message({
message: '是否上限为是,上阈值不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.islow) {
this.$message({
message: '是否下限不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (e.islow == "1" && !e.lowthreshold) {
this.$message({
message: '是否下限为是,下阈值不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.issync) {
this.$message({
message: '同步分析不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (e.issync == "1" && !e.syncparaencode) {
this.$message({
message: '是否同步分析为是,同步分析参数编码不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.accuracys) {
this.$message({
message: '数据精度不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
}
return isOk;
},
selectequipment() {
if (this.getequipmentledger != null && this.getequipmentledger != '') {
// console.log("this.getequipmentledger", this.getequipmentledger);
//工序赋值
//调取列表接口
request({
url: '/api/example/Equipmentparameter/getparalist',
method: 'post',
data: { "equipmentid": this.getequipmentledger }
}).then(res => {
this.dataForms = res.data
if (this.dataForms.length == 0) {
this.getequiptypepara()
}
});
}
},
geteqinfolist() {
getDataInterfaceRes('626301338401114181', null).then(res => {
let data = res.data
this.eqinfolist = data
})
},
eqchangeData() {
const selectedOption = this.eqinfolist.find(option => option.F_id === this.getequipmentledger);
if (selectedOption) {
this.getprocess = selectedOption.F_processCode
}
},
getequiptypepara() {
request({
url: '/api/example/Equipmentparameter/getDevicetypeparalist',
method: 'post',
data: { "equipmentid": this.getequipmentledger }
}).then(res => {
this.devicetypeparalist = res.data
console.log("this.devicetypeparalist", this.devicetypeparalist);
if (this.dataForms.length == 0) {
this.devicetypeparalist.forEach(item => {
let item1 = {
equipmentledgerid: this.getequipmentledger,
processid: this.getprocess,
encode: '',
fullname: item.parametername,
tag: '',
datatypes: item.datatype,
parametertype: "",
unit: item.unit,
isrealtime: "0",
enabledmark: "1",
isconstantvalue: "0",
isonline: "0",
isrunning: "0",
iszero: "0",
ishahf: "0",
isontime: "0",
isdispatch: "0",
ishigh: "0",
highthreshold: undefined,
islow: "0",
lowthreshold: undefined,
runtag: '',
labels: [],
issync: "0",
syncparaencode: '',
accuracys: "ma",
duration: undefined,
sortcode: item.sort,
description: '',
creatoruserid: "",
creatortime: "",
lastmodifyuserid: "",
lastmodifytime: "",
}
console.log("this.dataForms", this.dataForms);
this.dataForms.push(item1)
})
}
else {
for (let h = 0; h < this.devicetypeparalist.length; h++) {
let numbers = 0
for (let j = 0; j < this.dataForms.length; j++) {
if (this.dataForms[j].fullname == this.devicetypeparalist[h].parametername) {
numbers++
}
}
if (numbers == 0) {
let item1111 = {
equipmentledgerid: this.getequipmentledger,
processid: this.getprocess,
encode: '',
fullname: this.devicetypeparalist[h].parametername,
tag: '',
datatypes: this.devicetypeparalist[h].datatype,
parametertype: "",
unit: this.devicetypeparalist[h].unit,
isrealtime: "0",
enabledmark: "1",
isconstantvalue: "0",
isonline: "0",
isrunning: "0",
iszero: "0",
ishahf: "0",
isontime: "0",
isdispatch: "0",
ishigh: "0",
highthreshold: undefined,
islow: "0",
lowthreshold: undefined,
runtag: '',
labels: [],
issync: "0",
syncparaencode: '',
accuracys: "ma",
duration: undefined,
sortcode: undefined,
description: '',
creatoruserid: "",
creatortime: "",
lastmodifyuserid: "",
lastmodifytime: "",
}
this.dataForms.push(item1111)
}
}
}
console.log("this.dataForms", this.dataForms);
});
},
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if (this[options]) {
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model, index, defaultValue) {
if (!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll() {
this.getequipmentledgeridOptions();
this.getprocessidOptions();
this.getdatatypesOptions();
this.getparametertypeOptions();
this.getlabelsOptions();
this.getaccuracysOptions();
this.geteqinfolist();
},
getequipmentledgeridOptions() {
const index = this.childIndex
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes.equipmentledgerid))
for (let i = 0; i < templateJsonList.length; i++) {
let json = templateJsonList[i];
if (json.relationField) {
let relationFieldAll = json.relationField.split("-");
let val = json.defaultValue;
if (relationFieldAll.length > 1 && index > -1) {
val = this.dataForm[relationFieldAll[0] + 'List'] && this.dataForm[relationFieldAll[0] + 'List'].length ? this.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[1]] : ''
} else {
val = this.dataForm[relationFieldAll]
}
json.defaultValue = val
}
}
let template = {
paramList: templateJsonList
}
getDataInterfaceRes('626403889863723077', template).then(res => {
let data = res.data
this.equipmentledgeridOptions = data
this.changeDataFormData(1, 'equipmentledgerid', 'equipmentledgerid', index, '')
})
},
getprocessidOptions() {
const index = this.childIndex
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes.processid))
for (let i = 0; i < templateJsonList.length; i++) {
let json = templateJsonList[i];
if (json.relationField) {
let relationFieldAll = json.relationField.split("-");
let val = json.defaultValue;
if (relationFieldAll.length > 1 && index > -1) {
val = this.dataForm[relationFieldAll[0] + 'List'] && this.dataForm[relationFieldAll[0] + 'List'].length ? this.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[1]] : ''
} else {
val = this.dataForm[relationFieldAll]
}
json.defaultValue = val
}
}
let template = {
paramList: templateJsonList
}
getDataInterfaceRes('629188405816723525', template).then(res => {
let data = res.data
this.processidOptions = data
this.changeDataFormData(1, 'processid', 'processid', index, '')
})
},
getdatatypesOptions() {
getDictionaryDataSelector('434610983026105029').then(res => {
this.datatypesOptions = res.data.list
})
},
getparametertypeOptions() {
getDictionaryDataSelector('434611137372297925').then(res => {
this.parametertypeOptions = res.data.list
})
},
getlabelsOptions() {
getDictionaryDataSelector('625963845608802373').then(res => {
this.labelsOptions = res.data.list
})
},
getaccuracysOptions() {
getDictionaryDataSelector('700226475051192965').then(res => {
this.accuracysOptions = res.data.list
})
},
clearData() {
this.dataForm.equipmentledgerid = "";
this.dataForm.processid = "";
this.dataForm.encode = '';
this.dataForm.fullname = '';
this.dataForm.tag = '';
this.dataForm.datatypes = "";
this.dataForm.parametertype = "";
this.dataForm.unit = '';
this.dataForm.isrealtime = "0";
this.dataForm.enabledmark = "1";
this.dataForm.isconstantvalue = "0";
this.dataForm.isonline = "0";
this.dataForm.isrunning = "0";
this.dataForm.iszero = "0";
this.dataForm.ishahf = "0";
this.dataForm.isontime = "0";
this.dataForm.isdispatch = "0";
this.dataForm.ishigh = "0";
this.dataForm.highthreshold = undefined,
this.dataForm.islow = "0";
this.dataForm.lowthreshold = undefined,
this.dataForm.runtag = '';
this.dataForm.labels = [];
this.dataForm.issync = "0";
this.dataForm.syncparaencode = '';
this.dataForm.accuracys = "ma";
this.dataForm.duration = undefined,
this.dataForm.sortcode = undefined,
this.dataForm.description = '';
this.dataForm.creatoruserid = "";
this.dataForm.creatortime = "";
this.dataForm.lastmodifyuserid = "";
this.dataForm.lastmodifytime = "";
},
addentryList() {
let item = {
equipmentledgerid: "",
processid: "",
encode: '',
fullname: '',
tag: '',
datatypes: "",
parametertype: "",
unit: '',
isrealtime: "0",
enabledmark: "1",
isconstantvalue: "0",
isonline: "0",
isrunning: "0",
iszero: "0",
ishahf: "0",
isontime: "0",
isdispatch: "0",
ishigh: "0",
highthreshold: undefined,
islow: "0",
lowthreshold: undefined,
runtag: '',
labels: [],
issync: "0",
syncparaencode: '',
accuracys: "ma",
duration: undefined,
sortcode: undefined,
description: '',
creatoruserid: "",
creatortime: "",
lastmodifyuserid: "",
lastmodifytime: "",
}
this.dataForms.push(item)
},
delentryList(index) {
this.dataForms.splice(index, 1);
},
init(id) {
if (id) {
this.getequipmentledger = id;
this.visible = true;
this.eqchangeData()
this.selectequipment()
}
else {
this.visible = true;
// this.$nextTick(() => {
// this.$refs['elForm'].resetFields();
// if (this.dataForm.id) {
// this.loading = true
// request({
// url: '/api/example/Equipmentparameter/' + this.dataForm.id,
// method: 'get'
// }).then(res => {
// this.dataInfo(res.data)
// this.loading = false
// });
// } else {
this.clearData()
// }
// });
// this.$store.commit('generator/UPDATE_RELATION_DATA', {})
}
},
dataFormSubmits() {
if (!this.sparepartscostentryExist()) return
this.btnLoading = true
request({
url: '/api/example/Equipmentparameter/createlist',
method: 'post',
data: {
list: JSON.stringify(this.dataForms), // 假设后端需要这个列表
equipid: this.getequipmentledger // 假设 getequipmentledger 是一个对象,并且有 id 属性
}
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => { this.btnLoading = false })
},
// 表单提交
dataFormSubmit() {
this.$refs['elForm'].validate((valid) => {
if (valid) {
this.request()
}
})
},
request() {
this.btnLoading = true
let _data = this.dataList()
if (!this.dataForm.id) {
request({
url: '/api/example/Equipmentparameter',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => { this.btnLoading = false })
} else {
request({
url: '/api/example/Equipmentparameter/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => { this.btnLoading = false })
}
},
openSelectDialog(key) {
this.currTableConf = this.addTableConf[key]
this.currVmodel = key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let item = { ...this.tableRows[this.currVmodel], ...data[i] }
this.dataForm[this.currVmodel].push(item)
}
},
dataList() {
var _data = JSON.parse(JSON.stringify(this.dataForms));
_data.labels = Array.isArray(_data.labels) ? JSON.stringify(_data.labels) : '[]'
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll
_dataAll.labels = _dataAll.labels ? JSON.parse(_dataAll.labels) : []
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
this.childIndex = -1
},
},
}
</script>
上述代码,运行时在列表中功能标签不显示数据,实际有数据,而且点击下拉已选数据有显示<el-table-column prop="labels" label="功能标签" width="200" align="center"> <template slot-scope="scope"> <el-select v-model="scope.row.labels" @change="changeData('labels', -1)" placeholder="请选择" clearable :style='{ "width": "100%" }' filterable :multiple="true"> <el-option v-for="(item, index) in labelsOptions" :key="index" :label="item.fullName" :value="item.id" :disabled="item.disabled"></el-option> </el-select> </template> </el-table-column>,但不能选择操作。