服务设备配置增加读取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) { async getCodesByWorkingSubclass (workingSubclass) {
try { try {
const nodeCode = await this.$api.QUERY_CODES(workingSubclass) const nodeCode = await this.$api.QUERY_CODES(workingSubclass)
let nodeCodeData = [] const nodeCodeData = []
each(nodeCode, (o) => { each(nodeCode, (o) => {
nodeCodeData.push({ value: o, label: o }) nodeCodeData.push({ value: o, label: o })
} }
@@ -388,7 +388,7 @@ export default {
async getworkingSubclasses () { async getworkingSubclasses () {
try { try {
const workingSubclasses = await this.$api.QUERY_WORKING_SUBCLASSES() const workingSubclasses = await this.$api.QUERY_WORKING_SUBCLASSES()
let workingSubclassesData = [] const workingSubclassesData = []
each(workingSubclasses, (o) => { each(workingSubclasses, (o) => {
workingSubclassesData.push({ value: o, label: o }) workingSubclassesData.push({ value: o, label: o })
} }
@@ -449,7 +449,7 @@ export default {
}) })
}, },
async delDevice () { 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 let deviceNode = deviceConfigure.Content.Settings.GroupNode[0].DeviceNode
if (deviceNode !== undefined && isArray(deviceNode)) { if (deviceNode !== undefined && isArray(deviceNode)) {
deviceNode = filter(deviceNode, item => { deviceNode = filter(deviceNode, item => {
@@ -516,8 +516,8 @@ export default {
return false return false
} }
}) })
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 deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue const deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue
if (this.devicePointData.length > 0) { if (this.devicePointData.length > 0) {
let devicePointData = this.devicePointData let devicePointData = this.devicePointData
devicePointData = each(devicePointData, (item) => { devicePointData = each(devicePointData, (item) => {
@@ -565,7 +565,7 @@ export default {
console.log(e) console.log(e)
} }
}, },
async getDeviceStatus () { 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) 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) { if (res) {

View File

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

View File

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