服务设备配置增加读取mes的设备台账编码

This commit is contained in:
wu
2022-08-20 17:03:52 +08:00
parent 7926287dd8
commit f7140382b4
3 changed files with 34 additions and 12 deletions

View File

@@ -371,7 +371,7 @@ export default {
async getCodesByWorkingSubclass (workingSubclass) {
try {
const nodeCode = await this.$api.QUERY_CODES(workingSubclass)
let nodeCodeData = []
const nodeCodeData = []
each(nodeCode, (o) => {
nodeCodeData.push({ value: o, label: o })
}
@@ -388,7 +388,7 @@ export default {
async getworkingSubclasses () {
try {
const workingSubclasses = await this.$api.QUERY_WORKING_SUBCLASSES()
let workingSubclassesData = []
const workingSubclassesData = []
each(workingSubclasses, (o) => {
workingSubclassesData.push({ value: o, label: o })
}
@@ -449,7 +449,7 @@ export default {
})
},
async delDevice () {
let deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD)
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD)
let deviceNode = deviceConfigure.Content.Settings.GroupNode[0].DeviceNode
if (deviceNode !== undefined && isArray(deviceNode)) {
deviceNode = filter(deviceNode, item => {
@@ -516,8 +516,8 @@ export default {
return false
}
})
let deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD)
let deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD)
const deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue
if (this.devicePointData.length > 0) {
let devicePointData = this.devicePointData
devicePointData = each(devicePointData, (item) => {
@@ -565,7 +565,7 @@ export default {
console.log(e)
}
},
async getDeviceStatus () {
const res = await this.$api.GET_SERVER_DEVICE_STATUS('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD)
if (res) {

View File

@@ -9,12 +9,20 @@
</el-select>
</el-form-item>
<el-form-item label="设备编码" v-if="choosable === 'true'">
<el-select v-model="deviceConfigureModelValue.parent_device_code" placeholder="请选择">
<el-option v-for="(item, i) in deviceCodeData" :key="i" :label="item.name" :value="item.code">
</el-option>
</el-select>
</el-form-item>
<template v-for="(item, i) in deviceConfigureFormItem">
<el-form-item :key="i" :label="item.labelName" :prop="item.key" v-if="!item.isShow">
<template v-if="item.type === 'text'">
<el-input v-model='deviceConfigureModelValue[item.key]' :disabled="item.disabled"
:placeholder="item.placeholder"></el-input>
</template>
<template v-if="item.type === 'number'">
<el-input-number v-model='deviceConfigureModelValue[item.key]' :disabled="item.disabled" :controls="false"
:placeholder="item.placeholder"></el-input-number>
@@ -43,7 +51,9 @@
<script>
import deviceConfigureFormItemData from './deviceSetting/index.json'
import { each } from 'lodash'
import { each, assign } from 'lodash'
// import { getDeviceAll } from '@/api/basic/device'
export default {
name: 'deviceConfigure',
props: {
@@ -59,7 +69,6 @@ export default {
},
computed: {
},
watch: {
defaultDeviceName: {
@@ -80,6 +89,9 @@ export default {
return {
deviceConfigureFormItem: [],
defaultDeviceTypeNameValue: '',
deviceCode: '',
deviceCodeData: [],
choosable: process.env.VUE_APP_CHOOSABLE,
deviceConfigureModelValue: {},
rules: {},
deviceSelectedVlaue: '',
@@ -103,11 +115,15 @@ export default {
}
})
this.rules = rules
this.deviceConfigureModelValue = deviceConfigureModelValue
this.deviceConfigureModelValue = this.choosable === 'true' ? assign(deviceConfigureModelValue, { parent_device_code: '' }) : deviceConfigureModelValue
console.log(this.deviceConfigureModelValue)
this.deviceConfigureFormItem = deviceConfigureFormItemData[e]
},
setDeviceDefaultFormItemValue (val) {
const deviceConfigureModelValue = {}
if (this.choosable === 'true') {
deviceConfigureModelValue.parent_device_code = val.parent_device_code
}
each(deviceConfigureFormItemData[this.defaultDeviceTypeNameValue], (item) => {
if (item.type === 'time') {
deviceConfigureModelValue[item.key] = val[item.key] ? val[item.key] : new Date()
@@ -120,9 +136,17 @@ export default {
},
getDeviceType () {
this.deviceTypeData = Object.keys(deviceConfigureFormItemData)
},
getDeviceAll () {
// getDeviceAll().then(res => {
// this.deviceCodeData = res.data
// })
}
},
mounted () {
if (this.choosable === 'true') {
this.getDeviceAll()
}
this.getDeviceType()
}

View File

@@ -39,8 +39,6 @@
<device :server='server' @changeStatus='changeSelectedServerStatus' @changeServerConfig='changeSelectedServerConfig' />
</el-drawer>
</d2-container>
</template>
@@ -351,7 +349,7 @@ export default {
console.log(e)
}
},
handleDialogCancel (done) {
this.$message({
message: '用户放弃改动',