520 lines
16 KiB
Vue
520 lines
16 KiB
Vue
|
<template>
|
||
|
<div class="app-container">
|
||
|
<div class="level-title">
|
||
|
<h1>{{ this.$parent.FIRE_DEVICE_ID == '' ? "新增" : "修改" }}</h1>
|
||
|
</div>
|
||
|
<div>
|
||
|
<el-form ref="form" :model="form" :rules="rules" label-width="180px">
|
||
|
<el-row>
|
||
|
<el-col :span="12">
|
||
|
<el-row>
|
||
|
<el-form-item label="消防区域:" prop="FIRE_REGION_ID">
|
||
|
<el-select v-model="form.FIRE_REGION_ID" placeholder="请选择消防区域" class="filter-item" style="width: 100%;">
|
||
|
<el-option
|
||
|
v-for="item in varRegionList"
|
||
|
:key="item.FIRE_REGION_ID"
|
||
|
:label="item.FIRE_REGION_NAME"
|
||
|
:value="item.FIRE_REGION_ID"/>
|
||
|
</el-select>
|
||
|
</el-form-item>
|
||
|
</el-row>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row>
|
||
|
<el-col :span="12">
|
||
|
<el-form-item label="消防点位:" prop="FIRE_POINT_ID">
|
||
|
<el-select v-model="form.FIRE_POINT_ID" placeholder="请选择点位" style="width: 100%;">
|
||
|
<el-option
|
||
|
v-for="item in pointList"
|
||
|
:key="item.FIRE_POINT_NAME"
|
||
|
:label="item.FIRE_POINT_NAME"
|
||
|
:value="item.FIRE_POINT_ID"/>
|
||
|
</el-select>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row>
|
||
|
<el-col :span="12">
|
||
|
<el-form-item label="负责部门:" prop="DEPARTMENT_ID">
|
||
|
<el-select v-model="form.DEPARTMENT_ID" placeholder="请选择负责部门" style="width: 100%;">
|
||
|
<el-option
|
||
|
v-for="item in departmentList"
|
||
|
:key="item.DEPARTMENT_ID"
|
||
|
:label="item.DEPARTMENT_NAME"
|
||
|
:value="item.DEPARTMENT_ID"/>
|
||
|
</el-select>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row>
|
||
|
<el-col :span="12">
|
||
|
<el-form-item label="消防器材类型:" prop="FIRE_DEVICE_TYPE_ID">
|
||
|
<el-select v-model="form.FIRE_DEVICE_TYPE_ID" placeholder="请选择" style="width: 100%;">
|
||
|
<el-option
|
||
|
v-for="item in typeData"
|
||
|
:key="item.NAME"
|
||
|
:label="item.NAME"
|
||
|
:value="item.BIANMA"/>
|
||
|
</el-select>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
<el-col :span="12">
|
||
|
<el-button v-show="form.FIRE_DEVICE_TYPE_ID" type="primary" style="margin-left: 16px;" @click="showDrawer">
|
||
|
查看检查项
|
||
|
</el-button>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row>
|
||
|
<el-col :span="12">
|
||
|
<el-form-item label="消防器材编码:" prop="FIRE_DEVICE_CODE">
|
||
|
<el-input v-model="form.FIRE_DEVICE_CODE" placeholder="请输入内容"/>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row>
|
||
|
<el-col :span="12">
|
||
|
<el-form-item label="有效期开始/结束时间:" prop="VALIDITY_TIME">
|
||
|
<el-date-picker
|
||
|
v-model="VALIDITY_TIME"
|
||
|
type="daterange"
|
||
|
start-placeholder="有效期开始日期"
|
||
|
end-placeholder="有效期结束日期"
|
||
|
format="yyyy-MM-dd"
|
||
|
value-format="yyyy-MM-dd"
|
||
|
style="width: 100%;"
|
||
|
/>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<el-row>
|
||
|
<el-col :span="12">
|
||
|
<el-form-item label="存放地点:" prop="REMAKE">
|
||
|
<el-input
|
||
|
:autosize="{ minRows: 3, maxRows: 5}"
|
||
|
v-model="form.REMAKE"
|
||
|
type="textarea"
|
||
|
placeholder="请输入内容"
|
||
|
/>
|
||
|
</el-form-item>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
</el-form>
|
||
|
</div>
|
||
|
<div class="ui-foot">
|
||
|
<el-button type="success" @click="confirm">保 存</el-button>
|
||
|
<el-button plain type="info" @click="goBack">返 回</el-button>
|
||
|
</div>
|
||
|
<el-drawer
|
||
|
:visible.sync="drawer"
|
||
|
direction="rtl"
|
||
|
title="检查项列表">
|
||
|
<el-table :data="CHECK_STANDARD_LIST" border>
|
||
|
<el-table-column type="index" label="序号" width="55" align="center"/>
|
||
|
<el-table-column property="FIRE_CHECK_STANDARD_ITEM" label="检查项"/>
|
||
|
</el-table>
|
||
|
</el-drawer>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包
|
||
|
import { requestFN } from '@/utils/request'
|
||
|
import SelectTree from '@/components/SelectTree'
|
||
|
import waves from '@/directive/waves'
|
||
|
import dateformat from '../../../../utils/dateformat'
|
||
|
export default {
|
||
|
|
||
|
components: { Pagination, SelectTree },
|
||
|
directives: { waves },
|
||
|
data() {
|
||
|
// var hasFireDeviceCode = (rule, value, callback) => {
|
||
|
// requestFN(
|
||
|
// '/fireDevice/hasFireDeviceCode',
|
||
|
// {
|
||
|
// FIRE_DEVICE_CODE: value
|
||
|
// }
|
||
|
// ).then((data) => {
|
||
|
// if (data.result == 'success') {
|
||
|
// callback()
|
||
|
// } else {
|
||
|
// callback(new Error('消防器材编码重复'))
|
||
|
// this.form.FIRE_DEVICE_CODE = ''
|
||
|
// }
|
||
|
// }).catch((e) => {
|
||
|
// callback()
|
||
|
// })
|
||
|
// }
|
||
|
return {
|
||
|
drawer: false,
|
||
|
count: 10,
|
||
|
dialogFormVisible: false,
|
||
|
dialogTableVisible: false,
|
||
|
DEPARTMENT_ID: '',
|
||
|
SORTINDEX: '',
|
||
|
PERSON_CHARGE: '',
|
||
|
CHECK_STANDARD_LIST: [],
|
||
|
VALIDITY_TIME: [],
|
||
|
departmentList: [],
|
||
|
form: {
|
||
|
FIRE_DEVICE_ID: '',
|
||
|
FIRE_POINT_NAME: '',
|
||
|
FIRE_POINT_ID: '',
|
||
|
FIRE_REGION_ID: '',
|
||
|
DEPARTMENT_ID: '',
|
||
|
DEPARTMENT_NAME: '',
|
||
|
FIRE_DEVICE_CODE: '',
|
||
|
FIRE_DEVICE_TYPE_ID: '',
|
||
|
VALIDITY_START_TIME: '',
|
||
|
VALIDITY_END_TIME: '',
|
||
|
REMAKE: ''
|
||
|
},
|
||
|
rules: {
|
||
|
FIRE_DEVICE_TYPE_ID: [{ required: true, message: '请选择设备类型', trigger: 'change' }],
|
||
|
// FIRE_DEVICE_CODE: [{ required: true, message: '请输入设备编码', trigger: 'blur' }, { validator: hasFireDeviceCode, trigger: 'blur' }],
|
||
|
FIRE_DEVICE_CODE: [{ required: true, message: '请输入设备编码', trigger: 'blur' }],
|
||
|
FIRE_POINT_ID: [{ required: true, message: '请选择消防点位', trigger: 'change' }],
|
||
|
FIRE_REGION_ID: [{ required: true, message: '请选择消防区域', trigger: 'change' }],
|
||
|
DEPARTMENT_ID: [{ required: true, message: '请选择负责部门', trigger: 'change' }],
|
||
|
REMAKE: [{ required: true, message: '请输入存放地点', trigger: 'blur' }]
|
||
|
},
|
||
|
riskForm: {
|
||
|
},
|
||
|
KEYWORDS: '',
|
||
|
periodList: [],
|
||
|
postList: [],
|
||
|
varList: [],
|
||
|
pointList: [],
|
||
|
varRegionList: [],
|
||
|
checked: false, // 全选框
|
||
|
checkList: [], // 选中的检查项集合
|
||
|
otherItemList: [], // 选中的其他存在风险集合
|
||
|
treeData: [],
|
||
|
typeData: [],
|
||
|
partsList: [],
|
||
|
dates: [], // 时间
|
||
|
defaultProps2: {
|
||
|
value: 'id',
|
||
|
children: 'nodes',
|
||
|
label: 'name'
|
||
|
},
|
||
|
defaultProps: {
|
||
|
value: 'id',
|
||
|
children: 'children',
|
||
|
label: 'name'
|
||
|
},
|
||
|
formLabelWidth: '120px',
|
||
|
total: 0,
|
||
|
listQuery: {
|
||
|
page: 1,
|
||
|
limit: 20
|
||
|
},
|
||
|
deForm: {
|
||
|
DEPARTMENT_ID: '',
|
||
|
DEPARTMENT_NAME: ''
|
||
|
},
|
||
|
multipleSelection: [],
|
||
|
REGION_ID: '',
|
||
|
FIRE_POINT_ID: '',
|
||
|
FIRE_REGION_ID: '',
|
||
|
accidentList: []
|
||
|
}
|
||
|
},
|
||
|
watch: {
|
||
|
'form.FIRE_REGION_ID': {
|
||
|
handler(newVal, oldVal) {
|
||
|
if (oldVal) this.form.FIRE_POINT_ID = ''
|
||
|
this.$nextTick(() => {
|
||
|
this.getPointByRegionId(newVal)
|
||
|
this.getPointDepartmentId(newVal)
|
||
|
})
|
||
|
},
|
||
|
immediate: false
|
||
|
}
|
||
|
},
|
||
|
async created() {
|
||
|
this.FIRE_POINT_ID = this.$parent.FIRE_POINT_ID
|
||
|
this.FIRE_REGION_ID = this.$parent.FIRE_REGION_ID
|
||
|
this.DEPARTMENT_ID = this.$parent.DEPARTMENT_ID
|
||
|
if (this.$parent.row) {
|
||
|
this.form.DEPARTMENT_NAME = this.$parent.row.DEPARTMENT_NAME
|
||
|
this.form.FIRE_POINT_NAME = this.$parent.row.FIRE_POINT_NAME
|
||
|
}
|
||
|
this.getPointByRegionId(this.FIRE_REGION_ID)
|
||
|
this.getFireRegion()
|
||
|
this.getTreeData()
|
||
|
this.getDicListByPID()
|
||
|
this.getDict()
|
||
|
this.getList(this.DEPARTMENT_ID)
|
||
|
},
|
||
|
methods: {
|
||
|
laod() {
|
||
|
this.count += 2
|
||
|
},
|
||
|
showDrawer() {
|
||
|
this.getStandardListByDeviceType(this.form.FIRE_DEVICE_TYPE_ID)
|
||
|
this.drawer = true
|
||
|
},
|
||
|
getStandardListByDeviceType(FIRE_DEVICE_TYPE) {
|
||
|
requestFN(
|
||
|
'/fireCheckStandard/getStandardListByDeviceType',
|
||
|
{
|
||
|
FIRE_DEVICE_TYPE: FIRE_DEVICE_TYPE
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.CHECK_STANDARD_LIST = data.varList
|
||
|
}).catch((e) => {
|
||
|
})
|
||
|
},
|
||
|
|
||
|
getPointDepartmentId(FIRE_REGION_ID) {
|
||
|
this.listLoading = true
|
||
|
this.deForm.DEPARTMENT_ID = ''
|
||
|
this.deForm.DEPARTMENT_NAME = ''
|
||
|
requestFN(
|
||
|
'/fireregion/getFireRegionInfo',
|
||
|
{
|
||
|
FIRE_REGION_ID: FIRE_REGION_ID
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.listLoading = false
|
||
|
this.deForm.DEPARTMENT_ID = data.res.DEPARTMENT_ID
|
||
|
this.form.DEPARTMENT_ID = data.res.DEPARTMENT_ID
|
||
|
this.deForm.DEPARTMENT_NAME = data.res.DEPARTMENT_NAME
|
||
|
this.departmentList = []
|
||
|
this.departmentList.push(this.deForm)
|
||
|
}).catch((e) => {
|
||
|
this.listLoading = false
|
||
|
})
|
||
|
},
|
||
|
getDict() {
|
||
|
requestFN(
|
||
|
'dictionaries/getLevels',
|
||
|
{
|
||
|
DICTIONARIES_ID: '249151f04fd64132a949fdd430a7b9c5'
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.typeData = data.list
|
||
|
})
|
||
|
.catch((e) => {
|
||
|
this.listLoading = false
|
||
|
})
|
||
|
},
|
||
|
async getPointByRegionId(REGION_ID) {
|
||
|
requestFN(
|
||
|
'/fireregion/getAllPointName',
|
||
|
{ FIRE_REGION_ID: REGION_ID }
|
||
|
).then((data) => {
|
||
|
this.$nextTick(() => {
|
||
|
this.pointList = data.varList
|
||
|
})
|
||
|
}).catch((e) => {
|
||
|
})
|
||
|
},
|
||
|
//
|
||
|
getTreeData() {
|
||
|
requestFN(
|
||
|
'/department/listTree',
|
||
|
{}
|
||
|
).then((data) => {
|
||
|
this.treeData = JSON.parse(data.zTreeNodes)
|
||
|
}).catch((e) => {
|
||
|
})
|
||
|
},
|
||
|
// 获取消防区域列表
|
||
|
getFireRegion() {
|
||
|
requestFN(
|
||
|
'/fireregion/getAllRegionName',
|
||
|
{}
|
||
|
).then((data) => {
|
||
|
this.varRegionList = data.varList
|
||
|
}).catch((e) => {
|
||
|
})
|
||
|
},
|
||
|
confirm() {
|
||
|
this.listLoading = true
|
||
|
requestFN(
|
||
|
'/fireDevice/hasFireDeviceCode',
|
||
|
{
|
||
|
FIRE_DEVICE_CODE: this.form.FIRE_DEVICE_CODE,
|
||
|
FIRE_DEVICE_ID: this.form.FIRE_DEVICE_ID
|
||
|
}
|
||
|
).then((data) => {
|
||
|
if (data.result == 'success') {
|
||
|
this.$refs.form.validate(valid => {
|
||
|
if (valid) {
|
||
|
if (this.$parent.FIRE_DEVICE_ID == '') {
|
||
|
this.handleAdd()
|
||
|
} else {
|
||
|
// debugger
|
||
|
if (!this.VALIDITY_TIME) {
|
||
|
this.VALIDITY_TIME = []
|
||
|
}
|
||
|
console.log('add45')
|
||
|
requestFN(
|
||
|
'/fireDevice/updFireDeviceById',
|
||
|
{
|
||
|
FIRE_DEVICE_ID: this.form.FIRE_DEVICE_ID,
|
||
|
FIRE_POINT_ID: this.form.FIRE_POINT_ID,
|
||
|
FIRE_REGION_ID: this.form.FIRE_REGION_ID,
|
||
|
DEPARTMENT_ID: this.form.DEPARTMENT_ID,
|
||
|
FIRE_DEVICE_CODE: this.form.FIRE_DEVICE_CODE,
|
||
|
FIRE_DEVICE_TYPE_ID: this.form.FIRE_DEVICE_TYPE_ID,
|
||
|
VALIDITY_START_TIME: dateformat(this.VALIDITY_TIME[0], 'YYYY-MM-DD'),
|
||
|
VALIDITY_END_TIME: dateformat(this.VALIDITY_TIME[1], 'YYYY-MM-DD'),
|
||
|
REMAKE: this.form.REMAKE
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.listLoading = false
|
||
|
this.dialogFormEdit = false
|
||
|
this.$parent.activeName = 'List'
|
||
|
this.$parent.$refs.list.getList()
|
||
|
}).catch((e) => {
|
||
|
this.listLoading = false
|
||
|
})
|
||
|
}
|
||
|
} else {
|
||
|
console.log(valid)
|
||
|
}
|
||
|
})
|
||
|
} else {
|
||
|
this.$message.warning('消防器材编码重复')
|
||
|
}
|
||
|
}).catch((e) => {
|
||
|
this.listLoading = true
|
||
|
})
|
||
|
},
|
||
|
number() {
|
||
|
this.form.SORTINDEX = this.form.SORTINDEX.replace(/[^\.\d]/g, '')
|
||
|
this.form.SORTINDEX = this.form.SORTINDEX.replace('.', '')
|
||
|
},
|
||
|
handleAdd() {
|
||
|
this.listLoading = true
|
||
|
console.log('1008')
|
||
|
this.form.VALIDITY_START_TIME = dateformat(this.VALIDITY_TIME[0], 'YYYY-MM-DD')
|
||
|
this.form.VALIDITY_END_TIME = dateformat(this.VALIDITY_TIME[1], 'YYYY-MM-DD')
|
||
|
console.log('1008')
|
||
|
requestFN(
|
||
|
'/fireDevice/saveDeviceInfo',
|
||
|
this.form
|
||
|
).then((data) => {
|
||
|
this.$parent.activeName = 'List'
|
||
|
this.$parent.$refs.list.getList()
|
||
|
this.listLoading = false
|
||
|
}).catch((e) => {
|
||
|
this.listLoading = false
|
||
|
})
|
||
|
},
|
||
|
getDicListByPID() {
|
||
|
requestFN(
|
||
|
'/fireDevice/getFireDeviceInfo',
|
||
|
{ FIRE_DEVICE_ID: this.$parent.FIRE_DEVICE_ID }
|
||
|
).then((data) => {
|
||
|
this.form.FIRE_DEVICE_ID = data.res.FIRE_DEVICE_ID
|
||
|
this.form.FIRE_POINT_ID = data.res.FIRE_POINT_ID
|
||
|
this.form.FIRE_REGION_ID = data.res.FIRE_REGION_ID
|
||
|
this.form.FIRE_DEVICE_CODE = data.res.FIRE_DEVICE_CODE
|
||
|
this.form.FIRE_DEVICE_TYPE_ID = data.res.FIRE_DEVICE_TYPE_ID
|
||
|
this.$set(this.VALIDITY_TIME, 0, dateformat(data.res.VALIDITY_START_TIME, 'YYYY-MM-DD'))
|
||
|
this.$set(this.VALIDITY_TIME, 1, dateformat(data.res.VALIDITY_END_TIME, 'YYYY-MM-DD'))
|
||
|
this.form.DEPARTMENT_ID = data.res.DEPARTMENT_ID
|
||
|
this.form.VALIDITY_START_TIME = data.res.VALIDITY_START_TIME
|
||
|
this.form.VALIDITY_END_TIME = data.res.VALIDITY_END_TIME
|
||
|
this.form.REMAKE = data.res.REMAKE
|
||
|
}).catch((e) => {
|
||
|
})
|
||
|
},
|
||
|
|
||
|
getList(DEPARTMENT_ID) {
|
||
|
// debugger
|
||
|
this.listLoading = true
|
||
|
if (DEPARTMENT_ID) {
|
||
|
this.DEPARTMENT_ID = DEPARTMENT_ID
|
||
|
}
|
||
|
requestFN(
|
||
|
'/user/getDepartmentId',
|
||
|
{
|
||
|
KEYWORDS: this.KEYWORDS,
|
||
|
DEPARTMENT_ID: this.DEPARTMENT_ID
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.listLoading = false
|
||
|
this.varList = data.userList
|
||
|
this.total = data.page.totalResult
|
||
|
}).catch((e) => {
|
||
|
this.listLoading = false
|
||
|
})
|
||
|
},
|
||
|
// 条件重置
|
||
|
getReset() {
|
||
|
this.OTHERKEYWORDS = ''
|
||
|
this.OTHERDEPARTMENT_ID = ''
|
||
|
this.$refs.deptTree_Select.clearHandle()
|
||
|
this.OTHERLEVELID = ''
|
||
|
},
|
||
|
// 返回列表
|
||
|
goBack() {
|
||
|
this.$parent.activeName = 'List'/*
|
||
|
this.form.HIDDENREGION_ID = ''
|
||
|
this.form.HIDDENREGION = ''
|
||
|
this.form.SORTINDEX = ''
|
||
|
this.form.COMMENTS = ''
|
||
|
this.$parent.HIDDENREGION_ID = '' */
|
||
|
}
|
||
|
// 数据字典
|
||
|
/* getDict() {
|
||
|
requestFN(
|
||
|
'/dictionaries/getLevels',
|
||
|
{
|
||
|
DICTIONARIES_ID: '5a81e63ec0e94d919b3138bc01dbef6b'
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.levelList = data.list
|
||
|
})
|
||
|
requestFN(
|
||
|
'/dictionaries/getLevels',
|
||
|
{
|
||
|
DICTIONARIES_ID: 'f60cf0e8315b4993b6d6049dd29f2ba5'
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.periodList = data.list
|
||
|
})
|
||
|
requestFN(
|
||
|
'/dictionaries/getLevels',
|
||
|
{
|
||
|
DICTIONARIES_ID: '4a3d0d99b0ea4e268c11dd0b18866917'
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.typeList = data.list
|
||
|
})
|
||
|
requestFN(
|
||
|
'/dictionaries/getLevels',
|
||
|
{
|
||
|
DICTIONARIES_ID: 'dc92de8a375c4b638b1b9f8d374e6426'
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.screenTypeList = data.list
|
||
|
})
|
||
|
|
||
|
requestFN(
|
||
|
'/riskpoint/getPointSelect',
|
||
|
{}
|
||
|
).then((data) => {
|
||
|
this.unitList = data.unitList
|
||
|
}).catch((e) => {
|
||
|
})
|
||
|
requestFN(
|
||
|
'/dictionaries/getLevels',
|
||
|
{
|
||
|
DICTIONARIES_ID: 'cee1190ea96a4ca9b7bca81e11f0d0f8'
|
||
|
}
|
||
|
).then((data) => {
|
||
|
this.accidentList = data.list
|
||
|
})
|
||
|
}*/
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
</style>
|