<template>
|
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false"
|
:close-on-press-escape="false">
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()"
|
label-width="120px">
|
<el-row :gutter="20">
|
<el-col :span="8">
|
<el-form-item prop="codeNum" :label="$t('hikDevice.codeNum')">
|
<el-input v-model="dataForm.codeNum" :placeholder="$t('hikDevice.codeNum')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="deviceType" :label="$t('hikDevice.deviceType')">
|
<el-input v-model="dataForm.deviceType" :placeholder="$t('hikDevice.deviceType')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="activationStatus" :label="$t('hikDevice.activationStatus')">
|
<el-input v-model="dataForm.activationStatus" :placeholder="$t('hikDevice.activationStatus')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="location" :label="$t('hikDevice.location')">
|
<el-input v-model="dataForm.location" :placeholder="$t('hikDevice.location')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="ability" :label="$t('hikDevice.ability')">
|
<el-input v-model="dataForm.ability" :placeholder="$t('hikDevice.ability')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="ipAddress" :label="$t('hikDevice.ipAddress')">
|
<el-input v-model="dataForm.ipAddress" :placeholder="$t('hikDevice.ipAddress')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="port" :label="$t('hikDevice.port')">
|
<el-input v-model="dataForm.port" :placeholder="$t('hikDevice.port')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="enhancementPort" :label="$t('hikDevice.enhancementPort')">
|
<el-input v-model="dataForm.enhancementPort" :placeholder="$t('hikDevice.enhancementPort')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="softwareVersion" :label="$t('hikDevice.softwareVersion')">
|
<el-input v-model="dataForm.softwareVersion" :placeholder="$t('hikDevice.softwareVersion')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="port" :label="$t('hikDevice.ipv4Gateway')">
|
<el-input v-model="dataForm.ipv4Gateway" :placeholder="$t('hikDevice.ipv4Gateway')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="httpPort" :label="$t('hikDevice.httpPort')">
|
<el-input v-model="dataForm.httpPort" :placeholder="$t('hikDevice.httpPort')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="serialNumber" :label="$t('hikDevice.serialNumber')">
|
<el-input v-model="dataForm.serialNumber" :placeholder="$t('hikDevice.serialNumber')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="subnetMask" :label="$t('hikDevice.subnetMask')">
|
<el-input v-model="dataForm.subnetMask" :placeholder="$t('hikDevice.subnetMask')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="physicalAddress" :label="$t('hikDevice.physicalAddress')">
|
<el-input v-model="dataForm.physicalAddress" :placeholder="$t('hikDevice.physicalAddress')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="channelNumber" :label="$t('hikDevice.channelNumber')">
|
<el-input v-model="dataForm.channelNumber" :placeholder="$t('hikDevice.channelNumber')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="dspVersion" :label="$t('hikDevice.dspVersion')">
|
<el-input v-model="dataForm.dspVersion" :placeholder="$t('hikDevice.dspVersion')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="menuRoute" :label="$t('hikDevice.menuRoute')">
|
<el-input v-model="dataForm.menuRoute" :placeholder="$t('hikDevice.menuRoute')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="sort" :label="$t('hikDevice.sort')">
|
<el-input v-model="dataForm.sort" :placeholder="$t('hikDevice.sort')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="deviceUsername" :label="$t('hikDevice.deviceUsername')">
|
<el-input v-model="dataForm.deviceUsername" :placeholder="$t('hikDevice.deviceUsername')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="devicePassword" :label="$t('hikDevice.devicePassword')">
|
<el-input v-model="dataForm.devicePassword" :placeholder="$t('hikDevice.devicePassword')"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item prop="isShow" :label="$t('hikDevice.isShow')">
|
<el-input v-model="dataForm.isShow" :placeholder="$t('hikDevice.isShow')"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<template slot="footer">
|
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
</template>
|
</el-dialog>
|
</template>
|
|
<script>
|
import debounce from 'lodash/debounce'
|
import {cron} from 'vue-cron'
|
|
export default {
|
data() {
|
return {
|
visible: false,
|
dataForm: {
|
id: '',
|
codeNum: '',
|
deviceType: '',
|
activationStatus: '',
|
location: '',
|
ability: '',
|
ipAddress: '',
|
port: '',
|
enhancementPort: '',
|
softwareVersion: '',
|
ipv4Gateway: '',
|
httpPort: '',
|
serialNumber: '',
|
subnetMask: '',
|
physicalAddress: '',
|
channelNumber: '',
|
dspVersion: '',
|
menuRoute: '',
|
deviceUsername: '',
|
devicePassword: '',
|
sort: '',
|
isShow: ''
|
},
|
cronPopover: false
|
}
|
},
|
components: {
|
cron
|
},
|
computed: {
|
dataRule() {
|
return {
|
codeNum: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
deviceType: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
activationStatus: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
location: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
ipAddress: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
port: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
}
|
}
|
},
|
methods: {
|
init() {
|
this.visible = true
|
this.$nextTick(() => {
|
this.$refs['dataForm'].resetFields()
|
if (this.dataForm.id) {
|
this.getInfo()
|
}
|
})
|
},
|
changeCron(val) {
|
this.dataForm.cronExpression = val
|
},
|
// 获取信息
|
getInfo() {
|
this.$http.get(`/iailab-iems-coal-proddisp/hikvision/device/${this.dataForm.id}`).then(({data: res}) => {
|
if (res.code !== 0) {
|
return this.$message.error(res.msg)
|
}
|
this.dataForm = res.data
|
}).catch(() => {
|
})
|
},
|
// 表单提交
|
dataFormSubmitHandle: debounce(function () {
|
this.$refs['dataForm'].validate((valid) => {
|
if (!valid) {
|
return false
|
}
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/iailab-iems-coal-proddisp/hikvision/device', this.dataForm).then(({data: res}) => {
|
if (res.code !== 0) {
|
return this.$message.error(res.msg)
|
}
|
this.$message({
|
message: this.$t('prompt.success'),
|
type: 'success',
|
duration: 500,
|
onClose: () => {
|
this.visible = false
|
this.$emit('refreshDataList')
|
}
|
})
|
}).catch(() => {
|
})
|
})
|
}, 1000, {'leading': true, 'trailing': false})
|
}
|
}
|
</script>
|