|
@@ -7,40 +7,113 @@
|
|
|
size="36%"
|
|
|
:visible.sync="dialogVisible"
|
|
|
>
|
|
|
- <el-form ref="ruleForm" :model="formData" :rules="rules" label-position="right" label-width="160px">
|
|
|
+ <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-input
|
|
|
+ v-model="formData.goafDevName"
|
|
|
+ placeholder="请输入设备名称"
|
|
|
+ style="width: 260px"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="安装区域" required>
|
|
|
<div class="safe-area">
|
|
|
- <el-select v-model="formData.goafOrebelt" class="safe-area-item" filterable placeholder="矿带" @change="changeArea(1)">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.goafOrebelt"
|
|
|
+ class="safe-area-item"
|
|
|
+ filterable
|
|
|
+ placeholder="矿带"
|
|
|
+ @change="changeArea(1)"
|
|
|
+ >
|
|
|
<el-option :value="0" label="请选择矿带" disabled />
|
|
|
- <el-option v-for="(item,index) in goafOrebelts" :key="index" :value="item.goafOrebelt" :label="item.goafOrebelt" />
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in goafOrebelts"
|
|
|
+ :key="index"
|
|
|
+ :value="item.goafOrebelt"
|
|
|
+ :label="item.goafOrebelt"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
- <el-select v-model="formData.goafOrebody" class="safe-area-item" filterable placeholder="矿体" @change="changeArea(2)">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.goafOrebody"
|
|
|
+ class="safe-area-item"
|
|
|
+ filterable
|
|
|
+ placeholder="矿体"
|
|
|
+ @change="changeArea(2)"
|
|
|
+ >
|
|
|
<el-option :value="0" label="请选择矿体" disabled />
|
|
|
- <el-option v-for="(item,index) in goafOrebodys" :key="index" :value="item.goafOrebody" :label="item.goafOrebody" />
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in goafOrebodys"
|
|
|
+ :key="index"
|
|
|
+ :value="item.goafOrebody"
|
|
|
+ :label="item.goafOrebody"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
- <el-select v-model="formData.goafOreheight" class="safe-area-item" filterable placeholder="中段" @change="changeArea(3)">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.goafOreheight"
|
|
|
+ class="safe-area-item"
|
|
|
+ filterable
|
|
|
+ placeholder="中段"
|
|
|
+ @change="changeArea(3)"
|
|
|
+ >
|
|
|
<el-option :value="0" label="请选择中段" disabled />
|
|
|
- <el-option v-for="(item,index) in goafOreheights" :key="index" :value="item.goafOreheight" :label="item.goafOreheight" />
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in goafOreheights"
|
|
|
+ :key="index"
|
|
|
+ :value="item.goafOreheight"
|
|
|
+ :label="item.goafOreheight"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
- <el-select v-model="formData.goafId" class="safe-area-item" filterable placeholder="采空区名称" @change="changeArea(4)">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.goafId"
|
|
|
+ class="safe-area-item"
|
|
|
+ filterable
|
|
|
+ placeholder="采空区名称"
|
|
|
+ @change="changeArea(4)"
|
|
|
+ >
|
|
|
<el-option :value="0" label="请选择采空区" disabled />
|
|
|
- <el-option v-for="item in goafNames" :key="item.goafId" :value="item.goafId" :label="item.goafName" />
|
|
|
+ <el-option
|
|
|
+ v-for="item in goafNames"
|
|
|
+ :key="item.goafId"
|
|
|
+ :value="item.goafId"
|
|
|
+ :label="item.goafName"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="安装地点" required>
|
|
|
<!-- <el-input v-model="formData.goafDevLocation" placeholder="请输入安装地点" style="width:260px" /> -->
|
|
|
- <el-select v-model="formData.goafDevLocation" class="safe-area-item" filterable placeholder="请输入安装地点">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.goafDevLocation"
|
|
|
+ class="safe-area-item"
|
|
|
+ filterable
|
|
|
+ placeholder="请输入安装地点"
|
|
|
+ >
|
|
|
<el-option :value="0" label="请输入安装地点" disabled />
|
|
|
- <el-option v-for="item in goaf" :key="item.goafId" :value="item.goafId" :label="item.goafName" />
|
|
|
+ <el-option
|
|
|
+ v-for="item in goaf"
|
|
|
+ :key="item.goafId"
|
|
|
+ :value="item.goafId"
|
|
|
+ :label="item.goafName"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="设备类型" required>
|
|
|
- <el-select v-model="formData.sensorTypeId" style="width:260px" @change="changeSensorCat">
|
|
|
- <el-option v-for="item in sensorCats" :key="item.sensorTypeId" :value="item.sensorTypeId" :label="item.sensorTypeName" />
|
|
|
+ <el-select
|
|
|
+ v-model="formData.sensorTypeId"
|
|
|
+ style="width: 260px"
|
|
|
+ @change="changeSensorCat"
|
|
|
+ >
|
|
|
+ <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="设备安装时间">
|
|
@@ -55,8 +128,8 @@
|
|
|
<el-form-item label="组织部门">
|
|
|
<el-cascader
|
|
|
:options="treeData"
|
|
|
- :props="{ checkStrictly: true ,emitPath:false}"
|
|
|
- style="min-width:260px"
|
|
|
+ :props="{ checkStrictly: true, emitPath: false }"
|
|
|
+ style="min-width: 260px"
|
|
|
filterable
|
|
|
clearable
|
|
|
@change="handleChange"
|
|
@@ -68,8 +141,19 @@
|
|
|
</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
|
|
|
+ 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>
|
|
@@ -103,21 +187,20 @@ export default {
|
|
|
sensorCats: [],
|
|
|
goaf: [],
|
|
|
formData: {
|
|
|
- 'goafOrebelt': 0,
|
|
|
- 'goafOrebody': 0,
|
|
|
- 'goafOreheight': 0,
|
|
|
- 'goafId': 0,
|
|
|
- 'goafName': '',
|
|
|
- 'goafDevLocation': '',
|
|
|
- 'ocId': undefined,
|
|
|
- 'goafDevName': '',
|
|
|
- 'goafDevTypename': '',
|
|
|
- 'goafDevAccountId': undefined,
|
|
|
- 'goafDevAccountName': '',
|
|
|
- 'goafInstallTime': ''
|
|
|
- },
|
|
|
- rules: {
|
|
|
+ goafOrebelt: 0,
|
|
|
+ goafOrebody: 0,
|
|
|
+ goafOreheight: 0,
|
|
|
+ goafId: 0,
|
|
|
+ goafName: '',
|
|
|
+ goafDevLocation: '',
|
|
|
+ ocId: undefined,
|
|
|
+ goafDevName: '',
|
|
|
+ goafDevTypename: '',
|
|
|
+ goafDevAccountId: undefined,
|
|
|
+ goafDevAccountName: '',
|
|
|
+ goafInstallTime: ''
|
|
|
},
|
|
|
+ rules: {},
|
|
|
ctrlLevelList: [],
|
|
|
positionList: [],
|
|
|
viewData: {},
|
|
@@ -145,15 +228,19 @@ export default {
|
|
|
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'
|
|
|
- })
|
|
|
+ const temp = toTree(
|
|
|
+ data,
|
|
|
+ {
|
|
|
+ value: 'value',
|
|
|
+ name: 'label',
|
|
|
+ pValue: 'parentId'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'groupId',
|
|
|
+ name: 'groupName',
|
|
|
+ pValue: 'parentId'
|
|
|
+ }
|
|
|
+ )
|
|
|
this.treeData = temp
|
|
|
}
|
|
|
})
|
|
@@ -164,7 +251,6 @@ export default {
|
|
|
limit: 999999,
|
|
|
keyword: '',
|
|
|
groupId
|
|
|
-
|
|
|
}).then((resp) => {
|
|
|
const { data } = resp
|
|
|
this.userList = data
|
|
@@ -176,7 +262,9 @@ export default {
|
|
|
let goafOreheights = this.deeepClone(this.goafOreheights)
|
|
|
let goafNames = this.deeepClone(this.goafNames)
|
|
|
if (type === 1) {
|
|
|
- goafOrebodys = goafOrebelts.filter(item => item.goafOrebelt === this.formData.goafOrebelt)
|
|
|
+ goafOrebodys = goafOrebelts.filter(
|
|
|
+ (item) => item.goafOrebelt === this.formData.goafOrebelt
|
|
|
+ )
|
|
|
goafOrebodys = this.unique(goafOrebodys, 'goafOrebelt')
|
|
|
this.goafOrebodys = goafOrebodys
|
|
|
this.goafOreheights = []
|
|
@@ -185,14 +273,18 @@ export default {
|
|
|
this.formData.goafOreheight = ''
|
|
|
this.formData.goafId = ''
|
|
|
} else if (type === 2) {
|
|
|
- goafOreheights = goafOrebodys.filter(item => item.goafOrebody === this.formData.goafOrebody)
|
|
|
+ goafOreheights = goafOrebodys.filter(
|
|
|
+ (item) => item.goafOrebody === this.formData.goafOrebody
|
|
|
+ )
|
|
|
goafOreheights = this.unique(goafOreheights, 'goafOreheight')
|
|
|
this.goafOreheights = goafOreheights
|
|
|
this.goafNames = []
|
|
|
this.formData.goafOreheights = ''
|
|
|
this.formData.goafId = ''
|
|
|
} else if (type === 3) {
|
|
|
- goafNames = goafOreheights.filter(item => item.goafOreheight === this.formData.goafOreheight)
|
|
|
+ goafNames = goafOreheights.filter(
|
|
|
+ (item) => item.goafOreheight === this.formData.goafOreheight
|
|
|
+ )
|
|
|
goafNames = this.unique(goafNames, 'goafName')
|
|
|
this.goafNames = goafNames
|
|
|
this.formData.goafId = ''
|
|
@@ -225,22 +317,22 @@ export default {
|
|
|
// Reset Form Data
|
|
|
resetFormData() {
|
|
|
this.formData = {
|
|
|
- 'goafOrebelt': 0,
|
|
|
- 'goafOrebody': 0,
|
|
|
- 'goafOreheight': 0,
|
|
|
- 'goafId': 0,
|
|
|
- 'goafName': '',
|
|
|
- 'goafDevLocation': '',
|
|
|
- 'ocId': undefined,
|
|
|
- 'goafDevName': '',
|
|
|
- 'goafDevTypename': '',
|
|
|
- 'goafDevAccountId': undefined,
|
|
|
- 'goafDevAccountName': '',
|
|
|
- 'goafInstallTime': ''
|
|
|
+ goafOrebelt: 0,
|
|
|
+ goafOrebody: 0,
|
|
|
+ goafOreheight: 0,
|
|
|
+ goafId: 0,
|
|
|
+ goafName: '',
|
|
|
+ goafDevLocation: '',
|
|
|
+ ocId: undefined,
|
|
|
+ goafDevName: '',
|
|
|
+ goafDevTypename: '',
|
|
|
+ goafDevAccountId: undefined,
|
|
|
+ goafDevAccountName: '',
|
|
|
+ goafInstallTime: ''
|
|
|
}
|
|
|
},
|
|
|
handleUserSelect(accountId) {
|
|
|
- const item = this.userList.filter(item => item.accountId === accountId)
|
|
|
+ const item = this.userList.filter((item) => item.accountId === accountId)
|
|
|
const user = item[0]
|
|
|
this.formData.groupId = user.groupId
|
|
|
this.formData.groupName = user.groupName
|
|
@@ -252,39 +344,47 @@ export default {
|
|
|
submitForm(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if (this.formData.goafId === undefined || this.formData.goafId === 'undefined' || this.formData.goafId === '') {
|
|
|
+ if (
|
|
|
+ this.formData.goafId === undefined ||
|
|
|
+ this.formData.goafId === 'undefined' ||
|
|
|
+ this.formData.goafId === ''
|
|
|
+ ) {
|
|
|
this.$message.error('请选择采空区!')
|
|
|
return
|
|
|
}
|
|
|
switch (this.actionType) {
|
|
|
case 'ADD':
|
|
|
- createSensor(this.formData).then((resp) => {
|
|
|
- const { code, msg } = resp
|
|
|
- if (code === 0) {
|
|
|
- this.dialogVisible = false
|
|
|
- this.$message.success(msg)
|
|
|
- this.formSuccess()
|
|
|
- } else {
|
|
|
- this.$message.error(msg)
|
|
|
- }
|
|
|
- }).catch((error) => {
|
|
|
- console.log(error)
|
|
|
- })
|
|
|
+ createSensor(this.formData)
|
|
|
+ .then((resp) => {
|
|
|
+ const { code, msg } = resp
|
|
|
+ if (code === 0) {
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.$message.success(msg)
|
|
|
+ this.formSuccess()
|
|
|
+ } else {
|
|
|
+ this.$message.error(msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
break
|
|
|
|
|
|
case 'UPDATE':
|
|
|
- updateSensor(this.formData).then((resp) => {
|
|
|
- const { code, msg } = resp
|
|
|
- if (code === 0) {
|
|
|
- this.dialogVisible = false
|
|
|
- this.$message.success(msg)
|
|
|
- this.formSuccess()
|
|
|
- } else {
|
|
|
- this.$message.error(msg)
|
|
|
- }
|
|
|
- }).catch((error) => {
|
|
|
- console.log(error)
|
|
|
- })
|
|
|
+ updateSensor(this.formData)
|
|
|
+ .then((resp) => {
|
|
|
+ const { code, msg } = resp
|
|
|
+ if (code === 0) {
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.$message.success(msg)
|
|
|
+ this.formSuccess()
|
|
|
+ } else {
|
|
|
+ this.$message.error(msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
break
|
|
|
}
|
|
|
} else {
|
|
@@ -300,7 +400,9 @@ export default {
|
|
|
this.$refs[formName].resetFields()
|
|
|
},
|
|
|
changeSensorCat() {
|
|
|
- const sensorCat = this.sensorCats.filter(item => item.sensorTypeId === this.formData.sensorTypeId)[0]
|
|
|
+ const sensorCat = this.sensorCats.filter(
|
|
|
+ (item) => item.sensorTypeId === this.formData.sensorTypeId
|
|
|
+ )[0]
|
|
|
this.formData.goafDevTypename = sensorCat.sensorTypeName
|
|
|
this.formData.ocId = sensorCat.ocId
|
|
|
},
|
|
@@ -315,33 +417,31 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-.btn-group{
|
|
|
+.btn-group {
|
|
|
padding-left: 160px;
|
|
|
margin-top: 50px;
|
|
|
}
|
|
|
-.safe-area{
|
|
|
+.safe-area {
|
|
|
color: #fff;
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
- .safe-area-item{
|
|
|
- margin:0 5px 10px 0;
|
|
|
+ .safe-area-item {
|
|
|
+ margin: 0 5px 10px 0;
|
|
|
width: 20%;
|
|
|
- min-width: 120px
|
|
|
-
|
|
|
+ min-width: 120px;
|
|
|
}
|
|
|
- .el-input__inner{
|
|
|
+ .el-input__inner {
|
|
|
text-align: left !important;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-::v-deep.el-select-tree{
|
|
|
- .label{
|
|
|
- color:#606266 !important;
|
|
|
- }
|
|
|
- .el-tree-node.is-current > .el-tree-node__content,
|
|
|
- .el-tree-node__content:hover{
|
|
|
- background-color: #fff !important;
|
|
|
- color: #606266;
|
|
|
- }
|
|
|
+::v-deep.el-select-tree {
|
|
|
+ .label {
|
|
|
+ color: #606266 !important;
|
|
|
+ }
|
|
|
+ .el-tree-node.is-current > .el-tree-node__content,
|
|
|
+ .el-tree-node__content:hover {
|
|
|
+ background-color: #fff !important;
|
|
|
+ color: #606266;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|