Merge branch 'master' of ssh://118.195.187.246:10022/ysun/EdgeManager
This commit is contained in:
5
.env
5
.env
@@ -15,3 +15,8 @@ VUE_APP_I18N_FALLBACK_LOCALE=en
|
||||
|
||||
# element 颜色
|
||||
VUE_APP_ELEMENT_COLOR=#409EFF
|
||||
VUE_APP_HSLSERVER_PASSWORD=123456
|
||||
|
||||
#==true出现下拉,数据来源于MES
|
||||
#==false 手动输入,以及不渲染mes的设备编码
|
||||
VUE_APP_CHOOSABLE=false
|
||||
@@ -53,22 +53,6 @@
|
||||
</d2-crud>
|
||||
</el-card>
|
||||
</el-main>
|
||||
|
||||
<el-dialog title="服务账号登录" :visible.sync="dialogFormVisible" :modal="false">
|
||||
<el-alert title="请先输入该服务的账号密码,再进行后续操作" type="warning" style="width:400px;display: inline-block;vertical-align: middle; margin-left: 5px;" :closable="false" />
|
||||
<el-form :model="userForm" :rules="userRules" ref="userForm">
|
||||
<el-form-item label="账号" prop="username">
|
||||
<el-input v-model="userForm.username"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input type="password" v-model="userForm.password"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
||||
<el-button type="primary" @click="setUserInfo">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
@@ -136,11 +120,6 @@ export default {
|
||||
value: 'float',
|
||||
label: 'float (浮点数)'
|
||||
},
|
||||
{
|
||||
value: 'short',
|
||||
label: 'short'
|
||||
},
|
||||
|
||||
{
|
||||
value: 'bool',
|
||||
label: 'bool (逻辑值)'
|
||||
@@ -264,11 +243,6 @@ export default {
|
||||
value: 'float',
|
||||
label: 'float (浮点数)'
|
||||
},
|
||||
{
|
||||
value: 'short',
|
||||
label: 'short'
|
||||
},
|
||||
|
||||
{
|
||||
value: 'bool',
|
||||
label: 'bool (逻辑值)'
|
||||
@@ -296,21 +270,7 @@ export default {
|
||||
'@DisplayName': [{ required: true, type: 'string', message: '请输入显示名称', trigger: 'blur' }],
|
||||
'@RequestType': [{ required: true, type: 'string', message: '请输入请求类型', trigger: 'blur' }],
|
||||
'@DataTypeCode': [{ required: true, type: 'string', message: '请选择类型', trigger: 'blur' }],
|
||||
'@RequestInterval': [{ required: true, message: '请输入采集周期(ms)', trigger: 'blur' }],
|
||||
'@Length': [{ required: true, message: '请输入长度', trigger: 'blur' }]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
userForm: {
|
||||
username: '',
|
||||
password: ''
|
||||
},
|
||||
userRules: {
|
||||
username: [
|
||||
{ required: true, message: '请输入账号', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' }
|
||||
]
|
||||
'@RequestInterval': [{ required: true, message: '请输入采集周期(ms)', trigger: 'blur' }]
|
||||
},
|
||||
serverData: {},
|
||||
devicePointData: [],
|
||||
@@ -351,7 +311,6 @@ export default {
|
||||
},
|
||||
handleCellDataChange ({ rowIndex, row }) {
|
||||
this.devicePointData[rowIndex] = row
|
||||
this.setDeviceConfigure()
|
||||
},
|
||||
bandingNodeTemplate ({ index }) {
|
||||
this.$refs.d2Crud.showDialog({
|
||||
@@ -432,6 +391,9 @@ export default {
|
||||
this.deviceData = await this.$api.GET_DEVICE(this.serverData.id)
|
||||
if (this.deviceData.length > 0) {
|
||||
this.getDeviceConfigure(this.deviceActiveStatus)
|
||||
} else {
|
||||
this.devicePointData = [] // 如果没有设备,防止显示上一次打开的设备数据先清空数据
|
||||
this.defaultDeviceName = ''
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
@@ -478,10 +440,7 @@ export default {
|
||||
})
|
||||
},
|
||||
async delDevice () {
|
||||
// 校验是否已经有账号和密码
|
||||
const userInfo = this.getUserInfo()
|
||||
|
||||
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.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 => {
|
||||
@@ -493,7 +452,7 @@ export default {
|
||||
}
|
||||
|
||||
try {
|
||||
await this.$api.SET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.password, { data: deviceConfigure.Content })
|
||||
await this.$api.SET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD, { data: deviceConfigure.Content })
|
||||
await this.$api.DEL_DEVICE({ action: 'remove_device', id: this.deviceData[this.deviceActiveStatus].id })
|
||||
this.$message({
|
||||
message: '删除设备成功',
|
||||
@@ -513,18 +472,23 @@ export default {
|
||||
})
|
||||
done(false)
|
||||
} else {
|
||||
if (row['@DataTypeCode'] === 'string' && !row['@Length']) {
|
||||
this.$message({
|
||||
message: '数据类型为string,长度不能为空',
|
||||
type: 'error'
|
||||
})
|
||||
this.formOptions.saveLoading = false
|
||||
return false
|
||||
}
|
||||
assign(row, { id: this.devicePointData.length + 1, showBindButton: true, showCopyButton: true, showRemoveButton: true, showSendButton: true })
|
||||
this.devicePointData.push(row)
|
||||
await this.setDeviceConfigure()
|
||||
await this.getDevice()
|
||||
done()
|
||||
}
|
||||
this.formOptions.saveLoading = false
|
||||
},
|
||||
|
||||
async delDevicePoint ({ index, row }, done) {
|
||||
this.devicePointData.splice(index, 1)
|
||||
this.$refs.deviceConfigure.deviceConfigureModelValue.RequestNode = this.devicePointData
|
||||
await this.setDeviceConfigure()
|
||||
this.$delete(this.devicePointData, index)
|
||||
done()
|
||||
},
|
||||
async getDevicePoint () {
|
||||
@@ -536,21 +500,10 @@ export default {
|
||||
}
|
||||
},
|
||||
async devicePointBandingNode ({ index, row }, done) {
|
||||
this.devicePointData[index]['@Binding'] = row.nodeCode
|
||||
this.setDeviceConfigure()
|
||||
this.$set(this.devicePointData[index], '@Binding', row.nodeCode)
|
||||
done()
|
||||
},
|
||||
setUserInfo () {
|
||||
this.$refs.userForm.validate((valid) => {
|
||||
if (valid) {
|
||||
sessionStorage.setItem(this.serverData.id, JSON.stringify(this.userForm))
|
||||
this.dialogFormVisible = false
|
||||
}
|
||||
})
|
||||
},
|
||||
async setDeviceConfigure () {
|
||||
// 校验是否已经有账号和密码
|
||||
const userInfo = this.getUserInfo()
|
||||
try {
|
||||
// 验证表单
|
||||
this.$refs.deviceConfigure.$refs.form.validate((valid) => {
|
||||
@@ -558,11 +511,14 @@ export default {
|
||||
return false
|
||||
}
|
||||
})
|
||||
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.password)
|
||||
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) => {
|
||||
if (item['@DataTypeCode'] !== 'string') {
|
||||
unset(item, '@Length')
|
||||
}
|
||||
unset(item, 'id')
|
||||
unset(item, 'showBindButton')
|
||||
unset(item, 'showCopyButton')
|
||||
@@ -572,6 +528,7 @@ export default {
|
||||
})
|
||||
deviceConfigureModelValue.RequestNode = devicePointData
|
||||
}
|
||||
|
||||
deviceConfigureModelValue['@Name'] = this.deviceData[this.deviceActiveStatus].name
|
||||
let deviceNode = deviceConfigure.Content.Settings.GroupNode[0].DeviceNode || []
|
||||
let isExist = false
|
||||
@@ -590,7 +547,7 @@ export default {
|
||||
deviceNode.push(deviceConfigureModelValue)
|
||||
}
|
||||
deviceConfigure.Content.Settings.GroupNode[0].DeviceNode = deviceNode
|
||||
await this.$api.SET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.password, { data: deviceConfigure.Content })
|
||||
await this.$api.SET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD, { data: deviceConfigure.Content })
|
||||
deviceConfigureModelValue.DeviceTypeName = this.$refs.deviceConfigure.defaultDeviceTypeNameValue
|
||||
const data = {
|
||||
action: 'update_device',
|
||||
@@ -607,17 +564,9 @@ export default {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
getUserInfo () {
|
||||
const userInfo = sessionStorage.getItem(this.serverData.id)
|
||||
if (!userInfo) {
|
||||
this.dialogFormVisible = true
|
||||
return false
|
||||
}
|
||||
return JSON.parse(userInfo)
|
||||
},
|
||||
|
||||
async getDeviceStatus () {
|
||||
const userInfo = this.getUserInfo()
|
||||
const res = await this.$api.GET_SERVER_DEVICE_STATUS('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.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) {
|
||||
this.$emit('changeStatus', 'online')
|
||||
const deviceStatus = {}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -39,21 +39,6 @@
|
||||
<device :server='server' @changeStatus='changeSelectedServerStatus' @changeServerConfig='changeSelectedServerConfig' />
|
||||
</el-drawer>
|
||||
|
||||
<el-dialog title="服务账号登录" :visible.sync="dialogFormVisible">
|
||||
<el-alert title="请先输入该服务的账号密码,再进行后续操作" type="warning" style="width:400px;display: inline-block;vertical-align: middle; margin-left: 5px;" :closable="false" />
|
||||
<el-form :model="form" :rules="rules" ref="form">
|
||||
<el-form-item label="账号" prop="username">
|
||||
<el-input v-model="form.username" ></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input type="password" v-model="form.password" ></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleDialogFormVisible">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</d2-container>
|
||||
</template>
|
||||
|
||||
@@ -99,20 +84,6 @@ export default {
|
||||
}
|
||||
],
|
||||
isDrawerShow: false,
|
||||
dialogFormVisible: false,
|
||||
form: {
|
||||
username: '',
|
||||
password: ''
|
||||
},
|
||||
rules: {
|
||||
username: [
|
||||
{ required: true, message: '请输入账号', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
dialogFormServerId: 0,
|
||||
server: {},
|
||||
serveStatus: {
|
||||
online: {
|
||||
@@ -169,7 +140,7 @@ export default {
|
||||
emit: 'set-device'
|
||||
},
|
||||
{
|
||||
text: '配置应用',
|
||||
text: '重启服务',
|
||||
size: 'small',
|
||||
emit: 'exec'
|
||||
}
|
||||
@@ -360,43 +331,25 @@ export default {
|
||||
})
|
||||
done()
|
||||
},
|
||||
|
||||
async setServerExec ({ row }) {
|
||||
let userInfo = sessionStorage.getItem(row.id)
|
||||
this.dialogFormServerId = row.id
|
||||
if (!userInfo) {
|
||||
this.dialogFormVisible = true
|
||||
return false
|
||||
}
|
||||
userInfo = JSON.parse(userInfo)
|
||||
|
||||
try {
|
||||
await this.$api.SET_SERVER_EXEC({
|
||||
action: 'exec',
|
||||
server_id: row.id,
|
||||
command: 'server_restart',
|
||||
username: userInfo.username,
|
||||
password: userInfo.password
|
||||
username: 'admin',
|
||||
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||
})
|
||||
this.$message({
|
||||
message: '服务应用请求成功,请求动作已添加至请求队列中,请从服务监控页面查看结果',
|
||||
type: 'success'
|
||||
})
|
||||
this.dialogFormServerId = 0
|
||||
this.getServers()
|
||||
this.dialogFormVisible = false
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
handleDialogFormVisible () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
sessionStorage.setItem(this.dialogFormServerId, JSON.stringify(this.form))
|
||||
this.dialogFormVisible = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
handleDialogCancel (done) {
|
||||
this.$message({
|
||||
message: '用户放弃改动',
|
||||
|
||||
@@ -1,158 +1,174 @@
|
||||
<template>
|
||||
<d2-container>
|
||||
<div>
|
||||
<el-card class="box-card" v-for="(item, index) in serverData" :key="index">
|
||||
<el-card
|
||||
class="box-card"
|
||||
v-for="(item, index) in serverData"
|
||||
:key="index"
|
||||
>
|
||||
<div slot="header" class="device-header">
|
||||
<span>前置服务 {{ item.server_name }} ({{ item.url }}:{{ item.port }} )</span>
|
||||
<span
|
||||
>前置服务 {{ item.server_name }} ({{ item.url }}:{{ item.port }} )
|
||||
<el-tag
|
||||
:color="serveStatus[item.status].backgroundColor"
|
||||
:style="{
|
||||
color: serveStatus[item.status].textColor,
|
||||
borderColor: serveStatus[item.status].borderColor,
|
||||
}"
|
||||
>
|
||||
{{ serveStatus[item.status].name }}
|
||||
</el-tag>
|
||||
</span>
|
||||
</div>
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="6" v-for="(i, k) in item.devices" :key="k">
|
||||
<el-popover placement="top" trigger="click">
|
||||
<el-menu @select="(index) => setServerExec(i, index, item)"
|
||||
:style="{ 'borderRight': 'none' }">
|
||||
<el-menu
|
||||
@select="(index) => setDeviceExec(i, index, item)"
|
||||
:style="{ borderRight: 'none' }"
|
||||
>
|
||||
<el-menu-item index="device_stop">
|
||||
<span slot="title">暂停</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="device_continue">
|
||||
<span slot="title">启动</span>
|
||||
</el-menu-item>
|
||||
|
||||
</el-menu>
|
||||
<el-card slot="reference"
|
||||
:class="{ 'box-card': true, 'online': i.deviceStatus, 'offline': !i.deviceStatus }">
|
||||
<el-card
|
||||
slot="reference"
|
||||
:class="{
|
||||
'box-card': true,
|
||||
online: i.deviceStatus,
|
||||
offline: !i.deviceStatus,
|
||||
}"
|
||||
>
|
||||
<div slot="header" class="header-title">
|
||||
<span>{{ i.device_name }}</span>
|
||||
</div>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||
<el-col
|
||||
:span="5"
|
||||
style="padding-right: 0px; margin-bottom: 5px"
|
||||
>
|
||||
<span>设备类型</span>
|
||||
</el-col>
|
||||
<el-col :span="14" style="padding-left:0px;">:{{ i.device_type }}</el-col>
|
||||
<el-col :span="14" style="padding-left: 0px"
|
||||
>:{{ i.device_type }}</el-col
|
||||
>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||
<el-col
|
||||
:span="5"
|
||||
style="padding-right: 0px; margin-bottom: 5px"
|
||||
>
|
||||
<span>IP/端口</span>
|
||||
</el-col>
|
||||
<el-col :span="14" style="padding-left:0px;">:{{ i.config }}
|
||||
<el-col :span="14" style="padding-left: 0px"
|
||||
>:{{ i.config }}
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||
<el-col
|
||||
:span="5"
|
||||
style="padding-right: 0px; margin-bottom: 5px"
|
||||
>
|
||||
<span>活动时间</span>
|
||||
</el-col>
|
||||
<el-col :span="14" style="padding-left:0px;">:{{ i.startTime }}</el-col>
|
||||
<el-col :span="14" style="padding-left: 0px"
|
||||
>:{{ i.startTime }}</el-col
|
||||
>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||
<el-col
|
||||
:span="5"
|
||||
style="padding-right: 0px; margin-bottom: 5px"
|
||||
>
|
||||
<span>采集耗时</span>
|
||||
</el-col>
|
||||
<el-col :span="14" style="padding-left:0px;">:{{ i.captureSpendTime }}</el-col>
|
||||
<el-col :span="14" style="padding-left: 0px"
|
||||
>:{{ i.captureSpendTime }}</el-col
|
||||
>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||
<el-col
|
||||
:span="5"
|
||||
style="padding-right: 0px; margin-bottom: 5px"
|
||||
>
|
||||
<span>成功次数</span>
|
||||
</el-col>
|
||||
<el-col :span="14" style="padding-left:0px;">:{{ i.success }}</el-col>
|
||||
<el-col :span="14" style="padding-left: 0px"
|
||||
>:{{ i.success }}</el-col
|
||||
>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="5" style="padding-right:0px;margin-bottom: 5px;">
|
||||
<el-col
|
||||
:span="5"
|
||||
style="padding-right: 0px; margin-bottom: 5px"
|
||||
>
|
||||
<span>失败次数</span>
|
||||
</el-col>
|
||||
<el-col :span="14" style="padding-left:0px;">:{{ i.failed }}</el-col>
|
||||
<el-col :span="14" style="padding-left: 0px"
|
||||
>:{{ i.failed }}</el-col
|
||||
>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-alert v-if="i.failedMsg" :title="i.failedMsg" type="error" :closable="false">
|
||||
<el-alert
|
||||
v-if="i.failedMsg"
|
||||
:title="i.failedMsg"
|
||||
type="error"
|
||||
:closable="false"
|
||||
>
|
||||
</el-alert>
|
||||
<div v-else style="height:35px;"></div>
|
||||
<div v-else style="height: 35px"></div>
|
||||
</el-row>
|
||||
|
||||
</el-card>
|
||||
</el-popover>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<el-dialog title="服务账号登录" :visible.sync="dialogFormVisible">
|
||||
<el-alert title="请先输入该服务的账号密码,再进行后续操作" type="warning" :closable="false" />
|
||||
<el-form :model="form" :rules="rules" ref="form">
|
||||
<el-form-item label="账号" prop="username">
|
||||
<el-input v-model="form.username"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input type="password" v-model="form.password"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
||||
<el-button type="primary" @click="setUserInfo">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</d2-container>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import { unset, map } from 'lodash'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
dialogFormVisible: false,
|
||||
form: {
|
||||
username: '',
|
||||
password: ''
|
||||
},
|
||||
rules: {
|
||||
username: [
|
||||
{ required: true, message: '请输入账号', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
serverData: [],
|
||||
deviceData: [],
|
||||
deviceCommand: {}
|
||||
deviceCommand: {},
|
||||
serveStatus: {
|
||||
online: {
|
||||
name: '在线',
|
||||
textColor: '#67c23a',
|
||||
backgroundColor: '#f0f9eb',
|
||||
borderColor: '#e1f3d8'
|
||||
},
|
||||
offline: {
|
||||
name: '离线',
|
||||
textColor: '#67c23a',
|
||||
backgroundColor: '#f0f9eb',
|
||||
borderColor: '#e1f3d8'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
setUserInfo () {
|
||||
this.$refs.form.validate(async (valid) => {
|
||||
if (valid) {
|
||||
sessionStorage.setItem(this.deviceCommand.serverId, JSON.stringify(this.form))
|
||||
this.form = {
|
||||
username: '',
|
||||
password: ''
|
||||
}
|
||||
this.dialogFormVisible = false
|
||||
}
|
||||
})
|
||||
},
|
||||
async setServerExec (device, command, server) {
|
||||
let userInfo = sessionStorage.getItem(server.id)
|
||||
if (!userInfo) {
|
||||
this.deviceCommand = {
|
||||
serverId: server.id
|
||||
}
|
||||
|
||||
this.dialogFormVisible = true
|
||||
return false
|
||||
}
|
||||
userInfo = JSON.parse(userInfo)
|
||||
async setDeviceExec (device, command, server) {
|
||||
try {
|
||||
await this.$api.SET_SERVER_EXEC({
|
||||
action: 'exec',
|
||||
server_id: server.id,
|
||||
command: command,
|
||||
device_name: device.device_name,
|
||||
username: userInfo.username,
|
||||
password: userInfo.password
|
||||
username: 'admin',
|
||||
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||
})
|
||||
this.$message({
|
||||
message: '请求成功,请求动作已添加至请求队列中',
|
||||
type: 'success'
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.getServe()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
@@ -161,11 +177,17 @@ export default {
|
||||
async getServe () {
|
||||
this.serverData = await this.$api.QUERY_SERVERS()
|
||||
this.serverData.forEach((element, index) => {
|
||||
this.$api.GET_SERVE_DEVICE_MONITORING('http://' + element.url + ':' + element.port, 'admin', '123456').then((deviceStatus) => {
|
||||
this.$api
|
||||
.GET_SERVE_DEVICE_MONITORING(
|
||||
'http://' + element.url + ':' + element.port,
|
||||
'admin',
|
||||
process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||
)
|
||||
.then((deviceStatus) => {
|
||||
if (deviceStatus.IsSuccess) {
|
||||
const data = deviceStatus.Content
|
||||
unset(data, '__status')
|
||||
const deviceData = map(data, element => {
|
||||
const deviceData = map(data, (element) => {
|
||||
const config = element.__config.split(' ')
|
||||
return {
|
||||
config: config.length > 0 ? config[2] : '',
|
||||
@@ -180,13 +202,17 @@ export default {
|
||||
}
|
||||
})
|
||||
this.$set(this.serverData[index], 'devices', deviceData)
|
||||
this.$set(this.serverData[index], 'status', 'online')
|
||||
}
|
||||
}).catch(() => {
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
message: this.serverData[index].name + '服务请求失败',
|
||||
type: 'error'
|
||||
})
|
||||
this.$delete(this.serverData, index)
|
||||
this.$set(this.serverData[index], 'status', 'offline')
|
||||
|
||||
// this.$delete(this.serverData, index);
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -226,7 +252,6 @@ export default {
|
||||
}
|
||||
|
||||
.header-title {
|
||||
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -42,11 +42,13 @@
|
||||
import tips from './tips.md'
|
||||
import jschardet from 'jschardet'
|
||||
import { assign, each, pick, pickBy, startsWith, includes, every } from 'lodash'
|
||||
// import { getWorkingsubclassAll } from '@/api/basic/device'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
tips,
|
||||
choosable: process.env.VUE_APP_CHOOSABLE,
|
||||
columns: [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -65,17 +67,13 @@ export default {
|
||||
key: 'type'
|
||||
},
|
||||
{
|
||||
title: '流程',
|
||||
key: 'flow_code'
|
||||
title: '数据类别',
|
||||
key: 'category'
|
||||
},
|
||||
{
|
||||
title: '工序单元',
|
||||
key: 'working_subclass'
|
||||
},
|
||||
{
|
||||
title: '工作站',
|
||||
key: 'workstation'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
key: 'create_date'
|
||||
@@ -145,14 +143,49 @@ export default {
|
||||
span: 12
|
||||
}
|
||||
},
|
||||
flow_code: {
|
||||
title: '流程'
|
||||
category: {
|
||||
title: '数据类别',
|
||||
value: '',
|
||||
component: {
|
||||
name: 'el-select',
|
||||
options: [
|
||||
{
|
||||
value: 'DEVICE_STATUS',
|
||||
label: '设备状态'
|
||||
},
|
||||
{
|
||||
value: 'ITEM_ID_ITEM',
|
||||
label: '编号'
|
||||
},
|
||||
{
|
||||
value: 'DEVICE_DATA',
|
||||
label: '运行数据'
|
||||
},
|
||||
{
|
||||
value: 'PROCESS_DATA',
|
||||
label: '过程数据'
|
||||
},
|
||||
{
|
||||
value: 'RESULT_DATA',
|
||||
label: '结果数据'
|
||||
},
|
||||
{
|
||||
value: 'STATISTICAL_DATA',
|
||||
label: '统计数据'
|
||||
}
|
||||
],
|
||||
span: 12
|
||||
}
|
||||
},
|
||||
working_subclass: {
|
||||
title: '工序单元'
|
||||
},
|
||||
workstation: {
|
||||
title: '工作站'
|
||||
title: '工序单元',
|
||||
component: {
|
||||
name: 'el-select',
|
||||
filterable: true,
|
||||
allowCreate: true,
|
||||
options: this.WorkingsubclassData,
|
||||
span: 12
|
||||
}
|
||||
},
|
||||
note: {
|
||||
title: '备注'
|
||||
@@ -162,12 +195,6 @@ export default {
|
||||
name: {
|
||||
title: '节点名称'
|
||||
},
|
||||
flow_code: {
|
||||
title: '流程'
|
||||
},
|
||||
workstation: {
|
||||
title: '工作站'
|
||||
},
|
||||
note: {
|
||||
title: '备注'
|
||||
}
|
||||
@@ -181,6 +208,7 @@ export default {
|
||||
code: [{ required: true, type: 'string', message: '节点编码必须填写', trigger: 'blur' }],
|
||||
name: [{ required: true, type: 'string', message: '节点名称必须填写', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '必须指定节点类型', trigger: 'blur' }],
|
||||
category: [{ required: true, message: '必须指定数据类别', trigger: 'blur' }],
|
||||
working_subclass: [{
|
||||
required: true,
|
||||
type: 'string',
|
||||
@@ -206,6 +234,10 @@ export default {
|
||||
},
|
||||
// 普通的新增
|
||||
addRow () {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.d2Crud.handleFormTemplateMode('working_subclass').component.options = this.WorkingsubclassData
|
||||
this.$refs.d2Crud.$forceUpdate()
|
||||
})
|
||||
this.$refs.d2Crud.showDialog({
|
||||
mode: 'add'
|
||||
})
|
||||
@@ -294,9 +326,19 @@ export default {
|
||||
type: 'warning'
|
||||
})
|
||||
done()
|
||||
},
|
||||
getWorkingsubclassAll () {
|
||||
// getWorkingsubclassAll().then(res=>{
|
||||
// this.WorkingsubclassData = map(res.data, (o) => {
|
||||
// return { value: o.code, label: o.name }
|
||||
// })
|
||||
// })
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (this.choosable === 'true') {
|
||||
this.getWorkingsubclassAll()
|
||||
}
|
||||
this.getNodes()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user