This commit is contained in:
joylink_cuiweidong 2020-07-16 13:34:11 +08:00
commit 8a34f47dbc
7 changed files with 222 additions and 47 deletions

View File

@ -68,6 +68,22 @@ export function setSwitchConfig(id, data) {
data: data
});
}
/** 添加/修改端头控制盒网关映射配置 */
export function setPslConfig(id, data) {
return request({
url: `/api/device/${id}/config/psl`,
method: 'put',
data: data
});
}
/** 添加/修改ibp盘网关映射配置 */
export function setIbpConfig(id, data) {
return request({
url: `/api/device/${id}/config/ibp`,
method: 'put',
data: data
});
}
/** 查询项目下的所有设备 */
export function getAllDeviceInProject(params) {
return request({

View File

@ -1,5 +1,5 @@
<template>
<el-form ref="form" :rules="rules" :model="formModel" :label-width="form.labelWidth">
<el-form ref="form" :rules="rules" :model="formModel" :inline="inline" :label-width="form.labelWidth">
<template v-for="item in form.items">
<template v-if="checkFieldType(item, 'text')">
<el-form-item :key="item.prop" :prop="item.prop" :label="item.label" :required="item.required">
@ -346,6 +346,12 @@ export default {
default() {
return {};
}
},
inline: {
type: Boolean,
default() {
return false;
}
}
},
data() {

View File

@ -230,7 +230,8 @@ export default {
{label: '中心综合监控', value: 'ISCS_CW'},
{label: '车辆段终端', value: 'DEPOT'},
{label: '虚拟CCTV', value: 'CCTV'},
{label: 'PLC网关', value: 'PLC_GATEWAY'}
{label: 'PLC网关', value: 'PLC_GATEWAY'},
{label: '端头控制盒', value: 'PSL'}
]
}
};

View File

@ -37,6 +37,7 @@
</div>
<div class="chat-box-footer">
<div style="width: 400px;font-size: 14px;">{{ userString }}</div>
<!--<el-button size="mini" type="primary" class="chat-box-footer-create">公共会话</el-button>-->
<el-button size="mini" type="primary" class="chat-box-footer-create" :loading="createLoading" @click="createCoversition()">创建群聊</el-button>
</div>
</div>
@ -73,6 +74,9 @@
<div class="chat-box-footer">
<div class="chat-box-footer-tool" />
<el-button v-if="isConversitionCreator && isButtonShow" size="mini" type="danger" class="chat-box-footer-quit" :loading="quitLoading" @click="quitConversition()">退出群聊</el-button>
<!--<el-button class="chat-box-footer-send" size="mini" type="primary">公共会话</el-button>-->
<!--<el-button class="chat-box-footer-send" size="mini" type="primary">成员列表</el-button>-->
<!--<el-button class="chat-box-footer-send" size="mini" type="primary">私有会话</el-button>-->
<el-button v-if="isButtonShow" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button>
</div>
</div>

View File

@ -1,6 +1,6 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="60%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="datatop" :form="formTop" :form-model="formModel" :rules="topRules" />
<data-form ref="datatop" :form="formTop" :inline="inline" :form-model="formModel" :rules="topRules" />
<el-row :gutter="20">
<el-col :span="12">
<el-card class="box-card">
@ -31,21 +31,23 @@
</template>
<script>
import { getDeviceDetail, setPsdConfig, setSignalConfig, setSwitchConfig } from '@/api/project';
import { getDeviceDetail, setPsdConfig, setSignalConfig, setSwitchConfig, setPslConfig } from '@/api/project';
export default {
name: 'EditConfigGateway',
data() {
return {
dialogVisible: false,
inline: true,
formModel: {},
formLeft: {},
formRight: {},
leftRules: {},
rightRules: {},
gatewayList: [],
setDeviceConfigFunction: null,
data: null,
addrName: '',
data: {},
titleMap: { SWITCH: '道岔', PSD:'屏蔽门', SIGNAL: '信号机', PSL:'端头控制盒' },
psdLeftValue: [
{label: '输入-是否关门位', value: 'i_c'},
{label: '输入-PSL关门按钮位', value: 'i_dc_b'},
@ -86,6 +88,22 @@ export default {
{label: '输出-红灯控制位', value: 'o_r'},
{label: '输出-黄灯控制位', value: 'o_y'},
{label: '输出-黄红灯控制位', value: 'o_yr'}
],
pslLeftValue: [
{label: '读PSL操作旋钮位', value: 'rpslcz'},
{label: '读关门按钮位', value: 'rgman'},
{label: '读开门按钮位', value: 'rkman'},
{label: '读互锁解除开关位', value: 'rjc'},
{label: '读试灯按钮位', value: 'rsdan'},
{label: '读紧急停车按钮位', value: 'rjtan'}
],
pslRightValue: [
{label: '写全部关门指示灯位', value: 'wqbgbd'},
{label: '写开门到位指示灯位', value: 'wkmdwd'},
{label: '写PSL允许指示灯位', value: 'wpslyxd'},
{label: '写互锁解除指示灯位', value: 'wjcd'},
{label: '写IBP盘操作指示灯位', value: 'wibpczd'},
{label: '写PST操作指示灯位', value: 'wpstczd'}
]
};
},
@ -94,23 +112,23 @@ export default {
return {
labelWidth: '220px',
items: [
{ prop: 'gatewayCode', label: '网关编码:', type: 'select', required: true, options: this.gatewayList, placeholder: '请选择网关编码' },
{ prop:'addr', label:'网关地址:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0}
{ prop:'addr', label: this.addrName, type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'quantity', label: '位数量:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0 }
]
};
},
topRules() {
return {
gatewayCode: [
{ required: true, message: '请选择网关编码', trigger: 'change' }
],
addr: [
{ required: true, message: '请填写网关地址', trigger: 'blur' }
],
quantity: [
{ required: true, message: '请填写位数量', trigger: 'blur'}
]
};
},
title() {
return '编辑设备配置';
return `编辑${this.titleMap[this.data.type]}配置`;
}
},
methods: {
@ -118,27 +136,16 @@ export default {
var validateDevice = (rule, value, callback) => {
const list = [];
rule.list.forEach(item=> {
if (item.value !== rule.field && this.formModel[item.value] === value) {
if (item.value !== rule.field && this.formModel[item.value] && this.formModel[item.value] === value) {
list.push(item.label);
} else if (item.value === rule.field) {
list.push(item.label);
}
});
let flag = false;
if (value && value.length) {
for (var i = 0; i < value.length; i++) {
const ascallCode = value.charCodeAt(i);
if (ascallCode > 70 || ascallCode < 48 || (ascallCode > 57 && ascallCode < 65)) {
flag = true;
if (!this.formModel.quantity) {
this.$refs.datatop.validateForm();
}
}
}
if (!value) {
callback(new Error(rule.messageEmpty));
} else if (flag) {
callback(new Error('输入的每一位应为十六进制0-F,请修改'));
} else if (list.length > 1) {
if (list.length > 1) {
let repeatedValue = '';
list.forEach((item, index) => {
repeatedValue += item;
@ -147,6 +154,8 @@ export default {
}
});
callback(new Error(repeatedValue + '位置重复,请调整!'));
} else if (this.formModel.quantity && value >= this.formModel.quantity) {
callback(new Error('网关位应小于位数量!'));
} else {
callback();
}
@ -313,39 +322,124 @@ export default {
}
case 'SWITCH': {
this.setDeviceConfigFunction = setSwitchConfig;
this.addrName = '网关地址:';
this.formTop.labelWidth = '160px';
this.formLeft = {
labelWidth: '160px',
items: [
{ prop: 'rnp', label: '输入-定位表示位:', type: 'text', rightWidth: '100px', maxlength: 4},
{ prop: 'rrp', label: '输入-反位表示位:', type: 'text', rightWidth: '100px', maxlength: 4},
{ prop: 'rl', label: '输入-锁闭表示位:', type: 'text', rightWidth: '100px', maxlength: 4}
{ prop: 'rnp', label: '输入-定位表示位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'rrp', label: '输入-反位表示位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'rl', label: '输入-锁闭表示位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0}
]
};
this.leftRules = {
rnp: [
{ validator: validateDevice, messageEmpty: '请填写输入-定位表示位', list: this.switchLeftValue, trigger: 'blur' }
{ required: true, message: '请填写\'输入-定位表示位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.switchLeftValue, trigger: ['blur', 'change'] }
],
rrp: [
{ validator: validateDevice, messageEmpty: '请填写输入-反位表示位', list: this.switchLeftValue, trigger: 'blur' }
{ required: true, message: '请填写\'输入-反位表示位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.switchLeftValue, trigger: ['blur', 'change'] }
],
rl: [
{ validator: validateDevice, messageEmpty: '请填写输入-锁闭表示位', list: this.switchLeftValue, trigger: 'blur' }
{ required: true, message: '请填写\'输入-锁闭表示位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.switchLeftValue, trigger: ['blur', 'change'] }
]
};
this.formRight = {
labelWidth: '160px',
items: [
{ prop: 'wnp', label: '输出-定操控制位:', type: 'text', rightWidth: '100px', maxlength: 4},
{ prop: 'wrp', label: '输出-反操控制位:', type: 'text', rightWidth: '100px', maxlength: 4}
{ prop: 'wnp', label: '输出-定操控制位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'wrp', label: '输出-反操控制位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0}
]
};
this.rightRules = {
wnp: [
{ validator: validateDevice, messageEmpty: '请填写输出-定操(normal)控制位', list: this.switchRightValue, trigger: 'blur' }
{ required: true, message: '请填写\'输出-定操(normal)控制位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.switchRightValue, trigger: ['blur', 'change'] }
],
wrp: [
{ validator: validateDevice, messageEmpty: '请填写输出-反操(reverse)控制位', list: this.switchRightValue, trigger: 'blur' }
{ required: true, message: '请填写\'输出-反操(reverse)控制位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.switchRightValue, trigger: ['blur', 'change'] }
]
};
break;
}
case 'PSL': {
this.setDeviceConfigFunction = setPslConfig;
this.addrName = '网关地址:';
this.formLeft = {
labelWidth: '170px',
items: [
{ prop: 'rpslcz', label: '读PSL操作旋钮位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'rgman', label: '读关门按钮位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'rkman', label: '读开门按钮位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'rjc', label: '读互锁解除开关位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'rsdan', label: '读试灯按钮位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'rjtan', label: '读紧急停车按钮位', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0}
]
};
this.leftRules = {
rpslcz: [
{ required: true, message: '请填写\'读PSL操作旋钮位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslLeftValue, trigger: ['blur', 'change'] }
],
rgman: [
{ required: true, message: '请填写\'读关门按钮位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslLeftValue, trigger: ['blur', 'change'] }
],
rkman: [
{ required: true, message: '请填写\'读开门按钮位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslLeftValue, trigger: ['blur', 'change'] }
],
rjc: [
{ required: true, message: '请填写\'读互锁解除开关位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslLeftValue, trigger: ['blur', 'change'] }
],
rsdan: [
{ required: true, message: '请填写\'读试灯按钮位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslLeftValue, trigger: ['blur', 'change'] }
],
rjtan: [
{ required: true, message: '请填写\'读紧急停车按钮位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslLeftValue, trigger: ['blur', 'change'] }
]
};
this.formRight = {
labelWidth: '170px',
items: [
{ prop: 'wqbgbd', label: '写全部关门指示灯位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'wkmdwd', label: '写开门到位指示灯位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'wpslyxd', label: '写PSL允许指示灯位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'wjcd', label: '写互锁解除指示灯位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'wibpczd', label: '写IBP盘操作指示灯位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0},
{ prop: 'wpstczd', label: '写PST操作指示灯位:', type: 'number', min: 0, max: 20000, step: 1, precisionFlag: true, precision: 0}
]
};
this.rightRules = {
wqbgbd: [
{ required: true, message: '请填写\'写全部关门指示灯位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslRightValue, trigger: ['blur', 'change'] }
],
wkmdwd: [
{ required: true, message: '请填写\'写开门到位指示灯位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslRightValue, trigger: ['blur', 'change'] }
],
wpslyxd: [
{ required: true, message: '请填写\'写PSL允许指示灯位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslRightValue, trigger: ['blur', 'change'] }
],
wjcd: [
{ required: true, message: '请填写\'写互锁解除指示灯位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslRightValue, trigger: ['blur', 'change'] }
],
wibpczd: [
{ required: true, message: '请填写\'写IBP盘操作指示灯位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslRightValue, trigger: ['blur', 'change'] }
],
wpstczd: [
{ required: true, message: '请填写\'写PST操作指示灯位\'', trigger: 'blur' },
{ validator: validateDevice, list: this.pslRightValue, trigger: ['blur', 'change'] }
]
};
break;
@ -360,11 +454,6 @@ export default {
}).catch(()=> {
this.$message.error('获取项目设备详情失败!');
});
if (row.project === 'XTY') {
this.gatewayList = [{lable:'XTY', value: 'XTY'}];
} else if (row.project === 'GZB') {
this.gatewayList = [{label: 'GZB_1', value: 'GZB_1'}];
}
},
doShow(row) {
this.initData(row);
@ -388,13 +477,13 @@ export default {
});
});
},
handleClose(done) {
handleClose() {
this.formModel = {};
this.formLeft = {};
this.formRight = {};
this.leftRules = {};
this.rightRules = {};
this.gatewayList = [];
this.data = {};
this.dialogVisible = false;
this.$refs.datatop.resetForm();
this.$refs.dataleft.resetForm();

View File

@ -0,0 +1,53 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="60%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="datatop" :form="formTop" :inline="inline" :form-model="formModel" :rules="topRules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getDeviceDetail, setIbpConfig} from '@/api/project';
export default {
name: 'EditConfigIbp',
data() {
return {
title: '编辑IBP盘配置',
formTop: {},
formModel: {},
topRules: {},
dialogVisible: false,
inline: true
};
},
computed: {
},
methods: {
doShow() {
this.dialogVisible = true;
},
initData(row) {
getDeviceDetail(row.id).then(resp => {
if (resp.data.config) {
this.formModel = JSON.parse(resp.data.config);
}
}).catch(()=> {
this.$message.error('获取项目设备详情失败!');
});
},
doSave() {
},
handleClose() {
this.formModel = {};
this.dialogVisible = false;
}
}
};
</script>
<style scoped>
</style>

View File

@ -5,6 +5,7 @@
<edit-config-gateway ref="editConfigGateway" @reloadTable="reloadTable" />
<edit-config ref="editConfig" @reloadTable="reloadTable" />
<edit-config-screen ref="editConfigScreen" @reloadTable="reloadTable" />
<edit-config-ibp ref="editConfigIbp" @reloadTable="reloadTable" />
<input id="device-manage-url" v-model="url" style="opacity: 0;">
</div>
</template>
@ -15,6 +16,7 @@ import DeviceAdd from './add';
import EditConfigGateway from './editConfigGateway';
import EditConfig from './editConfig';
import EditConfigScreen from './editConfigScreen';
import EditConfigIbp from './editConfigIbp';
import { getSessionStorage } from '@/utils/auth';
import ConstConfig from '@/scripts/ConstConfig';
export default {
@ -23,9 +25,11 @@ export default {
DeviceAdd,
EditConfigGateway,
EditConfig,
EditConfigScreen
EditConfigScreen,
EditConfigIbp
},
data() {
const noShowPathType = ['SWITCH', 'SIGNAL', 'PSD', 'PSL', 'IBP'];
return {
examResultList: [],
url: '',
@ -106,7 +110,7 @@ export default {
{
name: '登录路径',
handleClick: this.getPath,
showControl: (row) => { return row.type !== 'SWITCH' && row.type !== 'SIGNAL' && row.type !== 'PSD'; }
showControl: (row) => { return !noShowPathType.includes(row.type); }
}
]
}
@ -177,10 +181,12 @@ export default {
editConfig(index, row) {
if (row.type === 'LW' || row.type === 'VR_IBP' || row.type === 'ISCS_LW' || row.type === 'ISCS_CW') {
this.$refs.editConfig.doShow(row);
} else if (row.type === 'SWITCH' || row.type === 'SIGNAL' || row.type === 'PSD') {
} else if (row.type === 'SWITCH' || row.type === 'SIGNAL' || row.type === 'PSD' || row.type === 'PSL') {
this.$refs.editConfigGateway.doShow(row);
} else if (row.type == 'LSW' || row.type == 'CCTV' || row.type == 'VR_PSD') {
this.$refs.editConfigScreen.doShow(row);
} else if (row.type === 'IBP') {
this.$refs.editConfigIbp.doShow(row);
} else {
this.$messageBox('暂无配置内容');
}