Browse Source

3d库房配置修改

master
z_yu 3 years ago
parent
commit
19aaa8ee42
  1. 30
      src/views/storeManage/warehouse3DConfig/index.vue

30
src/views/storeManage/warehouse3DConfig/index.vue

@ -25,8 +25,8 @@
</el-table-column> </el-table-column>
<el-table-column prop="paramName" label="参数名称" align="center"> <el-table-column prop="paramName" label="参数名称" align="center">
<template slot-scope="scope"> <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> </template>
</el-table-column> </el-table-column>
<el-table-column prop="bindState" label="绑定状态" align="center" width="150"> <el-table-column prop="bindState" label="绑定状态" align="center" width="150">
@ -58,9 +58,9 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </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 }}&nbsp;-&nbsp;{{ item.info }}</span> <span style="float: left">{{ item.label }}&nbsp;-&nbsp;{{ item.info }}</span>
</el-option> </el-option>
</el-select> </el-select>
@ -158,6 +158,11 @@ export default {
if (!isCAM && this.form.deviceInfo.id) { if (!isCAM && this.form.deviceInfo.id) {
this.getParamsOptionsList() 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 this.dialogVisible = true
} else { } else {
this.$message({ this.$message({
@ -172,17 +177,16 @@ export default {
}, },
handleConfirm() { handleConfirm() {
this.form.deviceInfo = this.devOptions.find((option) => { return option.value === this.form.deviceInfo.id }).self 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) { 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(() => { displayConfigApi.bind(this.form).then(() => {
this.$message.success('绑定成功 ') this.$message.success('绑定成功 ')
this.dialogVisible = false this.dialogVisible = false

Loading…
Cancel
Save