|
@@ -9,7 +9,7 @@
|
|
|
>
|
|
|
<el-form ref="ruleForm" :model="formData" :rules="rules" label-position="right" label-width="160px">
|
|
|
<el-form-item label="设备名称" required>
|
|
|
- <el-input v-model="formData.name" 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">
|
|
@@ -32,13 +32,26 @@
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="安装地点" required>
|
|
|
- <el-input v-model="formData.address" placeholder="请输入安装地点" style="width:260px" />
|
|
|
+ <!-- <el-input v-model="formData.goafDevLocation" placeholder="请输入安装地点" style="width:260px" /> -->
|
|
|
+ <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-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="传感器类型">
|
|
|
- <el-select v-model="formData.sensorTypeId" style="width:260px">
|
|
|
- <el-option v-for="item in sensors" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
+ <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>
|
|
|
</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"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="组织部门">
|
|
|
<el-cascader
|
|
|
:options="treeData"
|
|
@@ -55,7 +68,7 @@
|
|
|
</el-cascader>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="责任人员" prop="executeAccountId">
|
|
|
- <el-select v-model="formData.user" style="width:260px" filterable clearable @change="handleUserSelect">
|
|
|
+ <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>
|
|
@@ -68,12 +81,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getSensorCat } from '@/api/goaf/sensorCatApi'
|
|
|
-import { getGoafBaseInfo } from '@/api/goaf/info'
|
|
|
-import { createSensor, updateSensor } from '@/api/goaf/sensor'
|
|
|
import { toTree } from '@/utils/build-tree'
|
|
|
import { getGroupByList } from '@/api/system/groupApi'
|
|
|
import { getUserByPage } from '@/api/system/userApi'
|
|
|
+import { getSensorCat } from '@/api/goaf/sensorCatApi'
|
|
|
+import { getGoafBaseInfo } from '@/api/goaf/info'
|
|
|
+import { createSensor, updateSensor } from '@/api/goaf/sensor'
|
|
|
export default {
|
|
|
name: 'SensorModel',
|
|
|
data() {
|
|
@@ -87,12 +100,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
dialogVisible: false,
|
|
|
- sensors: [
|
|
|
- { id: 1, name: '摄像头' },
|
|
|
- { id: 2, name: '压力传感器' },
|
|
|
- { id: 3, name: '位移传感器' },
|
|
|
- { id: 4, name: '气体传感器' }
|
|
|
- ],
|
|
|
sensorCats: [],
|
|
|
goaf: [],
|
|
|
formData: {
|
|
@@ -101,12 +108,13 @@ export default {
|
|
|
'goafOreheight': 0,
|
|
|
'goafId': 0,
|
|
|
'goafName': '',
|
|
|
- 'sensorTypeId': '',
|
|
|
- 'sensorType': '',
|
|
|
- 'sensorTypeName': '',
|
|
|
- 'address': '',
|
|
|
- 'executeAccountId': '',
|
|
|
- 'accountId': ''
|
|
|
+ 'goafDevLocation': '',
|
|
|
+ 'ocId': undefined,
|
|
|
+ 'goafDevName': '',
|
|
|
+ 'goafDevTypename': '',
|
|
|
+ 'goafDevAccountId': undefined,
|
|
|
+ 'goafDevAccountName': '',
|
|
|
+ 'goafInstallTime': ''
|
|
|
},
|
|
|
rules: {
|
|
|
},
|
|
@@ -222,29 +230,32 @@ export default {
|
|
|
'goafOreheight': 0,
|
|
|
'goafId': 0,
|
|
|
'goafName': '',
|
|
|
- 'sensorTypeId': '',
|
|
|
- 'sensorType': '',
|
|
|
- 'sensorTypeName': '',
|
|
|
- 'address': '',
|
|
|
- 'executeAccountId': '',
|
|
|
- 'accountId': ''
|
|
|
+ 'goafDevLocation': '',
|
|
|
+ 'ocId': undefined,
|
|
|
+ 'goafDevName': '',
|
|
|
+ 'goafDevTypename': '',
|
|
|
+ 'goafDevAccountId': undefined,
|
|
|
+ 'goafDevAccountName': '',
|
|
|
+ 'goafInstallTime': ''
|
|
|
}
|
|
|
},
|
|
|
- // 选择执行人员
|
|
|
- handleUserSelect(obj) {
|
|
|
- this.formData.executeAccountId = obj.accountId
|
|
|
- this.formData.executeGroupId = obj.groupId
|
|
|
- this.formData.executePosition = obj.positionId
|
|
|
+ handleUserSelect(accountId) {
|
|
|
+ const item = this.userList.filter(item => item.accountId === accountId)
|
|
|
+ const user = item[0]
|
|
|
+ this.formData.groupId = user.groupId
|
|
|
+ this.formData.groupName = user.groupName
|
|
|
+ this.formData.goafDevAccountName = user.accountName
|
|
|
+ this.formData.positionId = user.positionId
|
|
|
+ this.formData.positionName = user.positionName
|
|
|
},
|
|
|
// 提交
|
|
|
submitForm(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if (this.formData.goafId) {
|
|
|
+ if (this.formData.goafId === undefined || this.formData.goafId === 'undefined' || this.formData.goafId === '') {
|
|
|
this.$message.error('请选择采空区!')
|
|
|
return
|
|
|
}
|
|
|
- this.formData.sensorTypeName = this.sensors.filter(item => item.id === this.formData.sensorTypeId)[0].name
|
|
|
switch (this.actionType) {
|
|
|
case 'ADD':
|
|
|
createSensor(this.formData).then((resp) => {
|
|
@@ -288,6 +299,11 @@ export default {
|
|
|
resetFormField(formName) {
|
|
|
this.$refs[formName].resetFields()
|
|
|
},
|
|
|
+ changeSensorCat() {
|
|
|
+ const sensorCat = this.sensorCats.filter(item => item.sensorTypeId === this.formData.sensorTypeId)[0]
|
|
|
+ this.formData.goafDevTypename = sensorCat.sensorTypeName
|
|
|
+ this.formData.ocId = sensorCat.ocId
|
|
|
+ },
|
|
|
unique(arr = [], name = 'name') {
|
|
|
const res = new Map()
|
|
|
return arr.filter((item) => !res.has(item[name]) && res.set(item[name], 1))
|