|
@@ -4,84 +4,109 @@
|
|
|
:modal-append-to-body="false"
|
|
:modal-append-to-body="false"
|
|
|
:modal="false"
|
|
:modal="false"
|
|
|
:wrapper-closable="false"
|
|
:wrapper-closable="false"
|
|
|
- size="36%"
|
|
|
|
|
|
|
+ size="42%"
|
|
|
:visible.sync="dialogVisible"
|
|
:visible.sync="dialogVisible"
|
|
|
>
|
|
>
|
|
|
- <el-form
|
|
|
|
|
- ref="ruleForm"
|
|
|
|
|
- :model="formData"
|
|
|
|
|
- :rules="rules"
|
|
|
|
|
- label-position="right"
|
|
|
|
|
- label-width="160px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-form-item label="设备名称" required>
|
|
|
|
|
- <el-input
|
|
|
|
|
- v-model="formData.goafDevName"
|
|
|
|
|
- placeholder="请输入设备名称"
|
|
|
|
|
- style="width: 260px"
|
|
|
|
|
- />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="安装地点" required>
|
|
|
|
|
- <el-input v-model="formData.goafDevLocation" placeholder="请输入安装地点" style="width:260px" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="告警阈值" required>
|
|
|
|
|
- <el-input-number v-model="formData.goafAlarmThreshold" placeholder="告警阈值" :controls="false" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="设备类型" required>
|
|
|
|
|
- <el-select
|
|
|
|
|
- v-model="formData.goafDevTypeId"
|
|
|
|
|
- style="width: 260px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="item in sensorCats"
|
|
|
|
|
- :key="item.sensorTypeId"
|
|
|
|
|
- :value="item.sensorTypeId"
|
|
|
|
|
- :label="item.sensorTypeName"
|
|
|
|
|
|
|
+ <div class="form-wrap">
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ ref="ruleForm"
|
|
|
|
|
+ :model="formData"
|
|
|
|
|
+ :rules="rules"
|
|
|
|
|
+ label-position="right"
|
|
|
|
|
+ label-width="140px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form-item label="传感器名称(编号)" required>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formData.goafSensorName"
|
|
|
|
|
+ placeholder="请输入传感器名称(编号)"
|
|
|
|
|
+ style="width: 260px"
|
|
|
/>
|
|
/>
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="设备安装时间">
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="formData.goafInstallTime"
|
|
|
|
|
- type="date"
|
|
|
|
|
- placeholder="设备安装时间"
|
|
|
|
|
- format="yyyy-MM-dd"
|
|
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
|
|
- style="width: 260px"
|
|
|
|
|
- />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="设备负责人部门">
|
|
|
|
|
- <el-cascader
|
|
|
|
|
- v-model="formData.goafDevGroupid"
|
|
|
|
|
- :options="treeData"
|
|
|
|
|
- :props="{ checkStrictly: true, emitPath: false }"
|
|
|
|
|
- style="min-width: 260px"
|
|
|
|
|
- filterable
|
|
|
|
|
- clearable
|
|
|
|
|
- @change="handleChange"
|
|
|
|
|
- >
|
|
|
|
|
- <template slot-scope="{ node, data }">
|
|
|
|
|
- <span>{{ data.label }}</span>
|
|
|
|
|
- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-cascader>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="责任人员" prop="executeAccountId">
|
|
|
|
|
- <el-select v-model="formData.goafDevAccountId" style="width:260px" filterable clearable @change="handleUserSelect">
|
|
|
|
|
- <el-option v-for="item in userList" :key="item.accountId" :value="item.accountId" :label="item.accountName" />
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- <div class="btn-group">
|
|
|
|
|
- <el-button type="primary" @click="submitForm('ruleForm')">确定</el-button>
|
|
|
|
|
- <el-button class="cancel-btn" @click="dialogVisible = false">取消</el-button>
|
|
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="设备名称" required>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formData.goafDevName"
|
|
|
|
|
+ placeholder="请输入设备名称"
|
|
|
|
|
+ style="width: 260px"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="检测间隔时间(分)" required>
|
|
|
|
|
+ <el-input-number v-model="formData.goafCheckTimeInterval" placeholder="检测间隔时间(分)" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="波特率" required>
|
|
|
|
|
+ <el-input-number v-model="formData.sensorBaudrate" placeholder="波特率" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="安装地点" required>
|
|
|
|
|
+ <el-input v-model="formData.goafSensorLocation" placeholder="请输入安装地点" style="width:260px" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <div class="flex-wrap">
|
|
|
|
|
+ <el-form-item label="X轴加速度阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvAccX" placeholder="X轴加速度阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="Y轴加速度阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvAccY" placeholder="Y轴加速度阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="Z轴加速度阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvAccZ" placeholder="Z轴加速度阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="flex-wrap">
|
|
|
|
|
+ <el-form-item label="X轴速度阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvVelX" placeholder="X轴速度阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="Y轴速度阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvVelY" placeholder="Y轴速度阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="Z轴速度阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvVelZ" placeholder="Z轴速度阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="flex-wrap">
|
|
|
|
|
+ <el-form-item label="X轴位移阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvDisX" placeholder="X轴位移阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="Y轴位移阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvDisY" placeholder="Y轴位移阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="Z轴位移阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvDisZ" placeholder="Z轴位移阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-form-item label="温度阈值" required>
|
|
|
|
|
+ <el-input-number v-model="formData.thvTemperature" placeholder="温度阈值" :controls="false" style="width: 100px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="设备类型" required>
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="formData.goafDevTypeId"
|
|
|
|
|
+ style="width: 260px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in sensorCats"
|
|
|
|
|
+ :key="item.sensorTypeId"
|
|
|
|
|
+ :value="item.sensorTypeId"
|
|
|
|
|
+ :label="item.sensorTypeName"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="设备安装时间">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="formData.goafInstallTime"
|
|
|
|
|
+ type="date"
|
|
|
|
|
+ placeholder="设备安装时间"
|
|
|
|
|
+ format="yyyy-MM-dd HH:MM:SS"
|
|
|
|
|
+ value-format="yyyy-MM-dd HH:MM:SS"
|
|
|
|
|
+ style="width: 260px"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <div class="btn-group">
|
|
|
|
|
+ <el-button type="primary" @click="submitForm('ruleForm')">确定</el-button>
|
|
|
|
|
+ <el-button class="cancel-btn" @click="dialogVisible = false">取消</el-button>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</el-drawer>
|
|
</el-drawer>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
-import { toTree } from '@/utils/build-tree'
|
|
|
|
|
-import { getGroupByList } from '@/api/system/groupApi'
|
|
|
|
|
-import { getUserByPage } from '@/api/system/userApi'
|
|
|
|
|
|
|
+import { parseTime } from '@/utils'
|
|
|
import { getSensorCat } from '@/api/goaf/sensorCatApi'
|
|
import { getSensorCat } from '@/api/goaf/sensorCatApi'
|
|
|
import { createSensor, updateSensor } from '@/api/goaf/sensor'
|
|
import { createSensor, updateSensor } from '@/api/goaf/sensor'
|
|
|
export default {
|
|
export default {
|
|
@@ -100,21 +125,18 @@ export default {
|
|
|
sensorCats: [],
|
|
sensorCats: [],
|
|
|
goaf: [],
|
|
goaf: [],
|
|
|
formData: {
|
|
formData: {
|
|
|
- goafOrebelt: 0,
|
|
|
|
|
- goafOrebody: 0,
|
|
|
|
|
- goafOreheight: 0,
|
|
|
|
|
- goafId: 0,
|
|
|
|
|
- goafName: '',
|
|
|
|
|
- goafDevLocation: '',
|
|
|
|
|
- ocId: undefined,
|
|
|
|
|
- goafDevName: '',
|
|
|
|
|
- goafDevTypename: '',
|
|
|
|
|
- goafDevTypeId: '',
|
|
|
|
|
- goafDevAccountId: undefined,
|
|
|
|
|
- goafDevGroupid: '',
|
|
|
|
|
- goafDevAccountName: '',
|
|
|
|
|
- goafInstallTime: '',
|
|
|
|
|
- goafAlarmThreshold: 0,
|
|
|
|
|
|
|
+ 'goafSensorId': undefined,
|
|
|
|
|
+ 'ocId': undefined,
|
|
|
|
|
+ 'goafSensorName': '',
|
|
|
|
|
+ 'modbusId': undefined,
|
|
|
|
|
+ 'sensorBaudrate': 0,
|
|
|
|
|
+ 'goafSensorIp': undefined,
|
|
|
|
|
+ 'goafDevName': '',
|
|
|
|
|
+ 'goafDevTypename': '',
|
|
|
|
|
+ 'goafSensorLocation': '',
|
|
|
|
|
+ 'goafCheckTimeInterval': '',
|
|
|
|
|
+ 'goafInstallTime': parseTime(new Date()),
|
|
|
|
|
+ 'goafSensorStatus': 0,
|
|
|
'thvAccX': 0,
|
|
'thvAccX': 0,
|
|
|
'thvAccY': 0,
|
|
'thvAccY': 0,
|
|
|
'thvAccZ': 0,
|
|
'thvAccZ': 0,
|
|
@@ -146,47 +168,7 @@ export default {
|
|
|
methods: {
|
|
methods: {
|
|
|
init() {
|
|
init() {
|
|
|
getSensorCat().then((res) => {
|
|
getSensorCat().then((res) => {
|
|
|
- this.sensorCats = res.data.filter(item => item.sensorTypeName.includes('传感器'))
|
|
|
|
|
- })
|
|
|
|
|
- getGroupByList().then((resp) => {
|
|
|
|
|
- const { code, data } = resp
|
|
|
|
|
- if (code === 0) {
|
|
|
|
|
- const temp = toTree(
|
|
|
|
|
- data,
|
|
|
|
|
- {
|
|
|
|
|
- value: 'value',
|
|
|
|
|
- name: 'label',
|
|
|
|
|
- pValue: 'parentId'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- value: 'groupId',
|
|
|
|
|
- name: 'groupName',
|
|
|
|
|
- pValue: 'parentId'
|
|
|
|
|
- }
|
|
|
|
|
- )
|
|
|
|
|
- this.treeData = temp
|
|
|
|
|
- this.groupList = data
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- getUserByPage({
|
|
|
|
|
- page: 1,
|
|
|
|
|
- limit: 999999
|
|
|
|
|
- }).then((resp) => {
|
|
|
|
|
- const { data } = resp
|
|
|
|
|
- this.userList = data
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- handleChange(groupId) {
|
|
|
|
|
- this.formData.goafDevAccountId = ''
|
|
|
|
|
- this.formData.goafDevAccountName = ''
|
|
|
|
|
- getUserByPage({
|
|
|
|
|
- page: 1,
|
|
|
|
|
- limit: 999999,
|
|
|
|
|
- keyword: '',
|
|
|
|
|
- groupId
|
|
|
|
|
- }).then((resp) => {
|
|
|
|
|
- const { data } = resp
|
|
|
|
|
- this.userList = data
|
|
|
|
|
|
|
+ this.sensorCats = res.data
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
// Show Add Dialog
|
|
// Show Add Dialog
|
|
@@ -204,32 +186,32 @@ export default {
|
|
|
this.title = '修改传感器配置'
|
|
this.title = '修改传感器配置'
|
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
|
// Life minus one
|
|
// Life minus one
|
|
|
- const sensorCat = this.sensorCats.filter(
|
|
|
|
|
- (item) => item.sensorTypeName === data.goafDevTypename
|
|
|
|
|
- )[0]
|
|
|
|
|
|
|
+ var goafDevTypeId = ''
|
|
|
|
|
+ if (data.goafDevTypename) {
|
|
|
|
|
+ goafDevTypeId = this.sensorCats.filter(
|
|
|
|
|
+ (item) => item.sensorTypeName === data.goafDevTypename
|
|
|
|
|
+ )[0]?.sensorTypeId
|
|
|
|
|
+ }
|
|
|
this.formData = {
|
|
this.formData = {
|
|
|
...data,
|
|
...data,
|
|
|
- goafDevTypeId: sensorCat.sensorTypeId
|
|
|
|
|
|
|
+ goafDevTypeId
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
// Reset Form Data
|
|
// Reset Form Data
|
|
|
resetFormData() {
|
|
resetFormData() {
|
|
|
this.formData = {
|
|
this.formData = {
|
|
|
- goafOrebelt: 0,
|
|
|
|
|
- goafOrebody: 0,
|
|
|
|
|
- goafOreheight: 0,
|
|
|
|
|
- goafId: 0,
|
|
|
|
|
- goafName: '',
|
|
|
|
|
- goafDevLocation: '',
|
|
|
|
|
- ocId: undefined,
|
|
|
|
|
- goafDevName: '',
|
|
|
|
|
- goafDevTypename: '',
|
|
|
|
|
- goafDevAccountId: undefined,
|
|
|
|
|
- goafDevAccountName: '',
|
|
|
|
|
- goafInstallTime: '',
|
|
|
|
|
- goafAlarmThreshold: 0,
|
|
|
|
|
- goafDevGroupid: '',
|
|
|
|
|
|
|
+ 'goafSensorId': undefined,
|
|
|
|
|
+ 'ocId': undefined,
|
|
|
|
|
+ 'goafSensorName': '',
|
|
|
|
|
+ 'modbusId': undefined,
|
|
|
|
|
+ 'sensorBaudrate': undefined,
|
|
|
|
|
+ 'goafSensorIp': undefined,
|
|
|
|
|
+ 'goafDevName': '',
|
|
|
|
|
+ 'goafDevTypename': '',
|
|
|
|
|
+ 'goafSensorLocation': '',
|
|
|
|
|
+ 'goafCheckTimeInterval': '',
|
|
|
|
|
+ 'goafInstallTime': parseTime(new Date()),
|
|
|
|
|
+ 'goafSensorStatus': 0,
|
|
|
'thvAccX': 0,
|
|
'thvAccX': 0,
|
|
|
'thvAccY': 0,
|
|
'thvAccY': 0,
|
|
|
'thvAccZ': 0,
|
|
'thvAccZ': 0,
|
|
@@ -242,18 +224,8 @@ export default {
|
|
|
'thvTemperature': 0
|
|
'thvTemperature': 0
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- handleUserSelect(accountId) {
|
|
|
|
|
- const item = this.userList.filter((item) => item.accountId === accountId)
|
|
|
|
|
- const user = item[0]
|
|
|
|
|
- this.formData.groupId = user.groupId
|
|
|
|
|
- this.formData.goafDevGroupname = user.groupName
|
|
|
|
|
- this.formData.goafDevAccountName = user.accountName
|
|
|
|
|
- this.formData.positionId = user.positionId
|
|
|
|
|
- this.formData.positionName = user.positionName
|
|
|
|
|
- },
|
|
|
|
|
// 提交
|
|
// 提交
|
|
|
submitForm(formName) {
|
|
submitForm(formName) {
|
|
|
- this.formData.goafDevGroupname = this.groupList.filter(item => item.groupId === this.formData.goafDevGroupid)[0].groupName
|
|
|
|
|
const sensorCat = this.sensorCats.filter(
|
|
const sensorCat = this.sensorCats.filter(
|
|
|
(item) => item.sensorTypeId === this.formData.goafDevTypeId
|
|
(item) => item.sensorTypeId === this.formData.goafDevTypeId
|
|
|
)[0]
|
|
)[0]
|
|
@@ -261,14 +233,6 @@ export default {
|
|
|
this.formData.ocId = sensorCat.ocId
|
|
this.formData.ocId = sensorCat.ocId
|
|
|
this.$refs[formName].validate((valid) => {
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
- if (
|
|
|
|
|
- this.formData.goafId === undefined ||
|
|
|
|
|
- this.formData.goafId === 'undefined' ||
|
|
|
|
|
- this.formData.goafId === ''
|
|
|
|
|
- ) {
|
|
|
|
|
- this.$message.error('请选择采空区!')
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
switch (this.actionType) {
|
|
switch (this.actionType) {
|
|
|
case 'ADD':
|
|
case 'ADD':
|
|
|
createSensor(this.formData)
|
|
createSensor(this.formData)
|
|
@@ -319,10 +283,6 @@ export default {
|
|
|
resetFormField(formName) {
|
|
resetFormField(formName) {
|
|
|
this.$refs[formName].resetFields()
|
|
this.$refs[formName].resetFields()
|
|
|
},
|
|
},
|
|
|
- unique(arr = [], name = 'name') {
|
|
|
|
|
- const res = new Map()
|
|
|
|
|
- return arr.filter((item) => !res.has(item[name]) && res.set(item[name], 1))
|
|
|
|
|
- },
|
|
|
|
|
deeepClone(params) {
|
|
deeepClone(params) {
|
|
|
return JSON.parse(JSON.stringify(params))
|
|
return JSON.parse(JSON.stringify(params))
|
|
|
}
|
|
}
|
|
@@ -330,10 +290,17 @@ export default {
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
|
+.form-wrap{
|
|
|
|
|
+ padding: 5px 15px;
|
|
|
|
|
+}
|
|
|
.btn-group {
|
|
.btn-group {
|
|
|
padding-left: 160px;
|
|
padding-left: 160px;
|
|
|
margin-top: 50px;
|
|
margin-top: 50px;
|
|
|
}
|
|
}
|
|
|
|
|
+.flex-wrap{
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+}
|
|
|
.safe-area {
|
|
.safe-area {
|
|
|
color: #fff;
|
|
color: #fff;
|
|
|
display: flex;
|
|
display: flex;
|