|
|
@ -25,8 +25,8 @@ |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="paramName" label="参数名称" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span v-if="scope.row.displayParams && scope.row.displayParams.map">{{ scope.row.displayParams.map(x => x.paramName).join(',') }}</span> |
|
|
|
<span v-else>{{ scope.row.displayParams?scope.row.displayParams:'' }}</span> |
|
|
|
<span v-if="scope.row.deviceSpecParams && scope.row.deviceSpecParams.map">{{ scope.row.deviceSpecParams.map(x => x.paramName).join(',') }}</span> |
|
|
|
<span v-else>{{ scope.row.deviceSpecParams?scope.row.deviceSpecParams:'' }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="bindState" label="绑定状态" align="center" width="150"> |
|
|
@ -58,9 +58,9 @@ |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="参数绑定" prop="displayParams"> |
|
|
|
<el-select ref="paramsSelect" v-model="form.displayParams" filterable :multiple="form.divPosition && form.divPosition.includes('OAO')" clearable placeholder="请选择" :disabled="form.divPosition && form.divPosition.includes('CAM')"> |
|
|
|
<el-option v-for="item in paramsOptions" :key="item.value" :label="item.label" :value="item.value"> |
|
|
|
<el-form-item label="参数绑定" prop="deviceSpecParams"> |
|
|
|
<el-select ref="paramsSelect" v-model="form.deviceSpecParams" filterable :multiple="form.divPosition && form.divPosition.includes('OAO')" clearable placeholder="请选择" :disabled="form.divPosition && form.divPosition.includes('CAM')"> |
|
|
|
<el-option v-for="item in paramsOptions" :key="item.id" :label="item.label" :value="item.value"> |
|
|
|
<span style="float: left">{{ item.label }} - {{ item.info }}</span> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
@ -158,6 +158,11 @@ export default { |
|
|
|
if (!isCAM && this.form.deviceInfo.id) { |
|
|
|
this.getParamsOptionsList() |
|
|
|
} |
|
|
|
if (this.form.deviceSpecParams && this.form.deviceSpecParams.length > 0) { |
|
|
|
const deviceSpecParams = this.form.deviceSpecParams.map((item) => { return item.id }) |
|
|
|
this.$set(this.form, 'deviceSpecParams', deviceSpecParams) |
|
|
|
// this.form.deviceSpecParams.splice(0, this.form.deviceSpecParams.length, ...deviceSpecParams) |
|
|
|
} |
|
|
|
this.dialogVisible = true |
|
|
|
} else { |
|
|
|
this.$message({ |
|
|
@ -172,17 +177,16 @@ export default { |
|
|
|
}, |
|
|
|
handleConfirm() { |
|
|
|
this.form.deviceInfo = this.devOptions.find((option) => { return option.value === this.form.deviceInfo.id }).self |
|
|
|
if (Array.isArray(this.form.displayParams)) { |
|
|
|
const paramValues = this.paramsOptions.filter((option) => { return this.form.displayParams.includes(option.value) }) |
|
|
|
this.form.displayParams = paramValues.map((paramValue) => { return { paramName: paramValue.self.paramName, paramValue: paramValue.self.paramId, unit: paramValue.self.unit } }) |
|
|
|
} else if (this.form.displayParams !== null) { |
|
|
|
const paramValue = this.paramsOptions.find((option) => { return option.value === this.form.displayParams }) |
|
|
|
if (Array.isArray(this.form.deviceSpecParams)) { |
|
|
|
const paramValues = this.paramsOptions.filter((option) => { return this.form.deviceSpecParams.includes(option.value) }) |
|
|
|
this.form.deviceSpecParams = paramValues.map((paramValue) => { return paramValue.self }) |
|
|
|
} else if (this.form.deviceSpecParams !== null) { |
|
|
|
const paramValue = this.paramsOptions.find((option) => { return option.value === this.form.deviceSpecParams }) |
|
|
|
if (paramValue) { |
|
|
|
this.form.displayParams = [] |
|
|
|
this.form.displayParams.push({ paramName: paramValue.self.paramName, paramValue: paramValue.self.paramId, unit: paramValue.self.paramId }) |
|
|
|
this.form.deviceSpecParams = [] |
|
|
|
this.form.deviceSpecParams.push(paramValue.self) |
|
|
|
} |
|
|
|
} |
|
|
|
this.form.id = null |
|
|
|
displayConfigApi.bind(this.form).then(() => { |
|
|
|
this.$message.success('绑定成功 ') |
|
|
|
this.dialogVisible = false |
|
|
|