| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="" style="display: inline-block;margin-left: 10px"> |
| | | <!-- <el-select v-model="item.regionId" filterable multiple clearable placeholder="请选择发生区域" > |
| | | <!-- <el-select v-model="item.regionId" filterable multiple clearable placeholder="请选择发生区域" > |
| | | <el-option v-for="item in regionList" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select>--> |
| | |
| | | noChildrenText="没有子选项" |
| | | noOptionsText="没有可选项" |
| | | noResultsText="没有匹配的结果" /> |
| | | </el-form-item> |
| | | <el-form-item label="" style="display: inline-block;margin-left: 10px; " > |
| | | <el-select v-model="item.deviceId" filterable placeholder="请选择监控点" @change="changeCamera(item)" > |
| | | <el-option v-for="item1 in item.carmeraList" :label="item1.name" :value="item1.indexCode" ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-button type="danger" style="margin-left: 10px;height: 32px; " @click="delDo(index)" v-if="index>0 || form.detailList.length>1">删除</el-button> |
| | | </div> |
| | |
| | | components: { GlobalWindow }, |
| | | data () { |
| | | var validIdDetals = (rule, value, callback) => { |
| | | if (this.form.detailList == null || this.form.detailList.length==0) { |
| | | if (this.form.detailList == null || this.form.detailList.length == 0) { |
| | | callback(new Error('请配置规则')) |
| | | return |
| | | } |
| | |
| | | intervalSec: '', |
| | | sortnum: '', |
| | | status: 0, |
| | | detailList: [{ random: Math.random(), regionId: null, regionName: null, regionCode: null, warningId: null }] |
| | | detailList: [{ random: Math.random(), regionId: null, regionName: null, deviceId: null, deviceName: null, regionCode: null, warningId: null }] |
| | | }, |
| | | deviceSelect: [], |
| | | memberSelect: [], |
| | |
| | | detailList: [{ required: true, validator: validIdDetals, message: '请正确配置规则', tigger: 'blur' }], |
| | | memberNotice: [{ required: true, message: '请选择钉钉通知' }], |
| | | deviceNotice: [{ required: true, message: '请选择是否广播通知' }], |
| | | deviceIds: [{ required: true, message: '请选择播报广播'}], |
| | | memberIds: [{ required: true, message: '请选择通知人员'}], |
| | | deviceIds: [{ required: true, message: '请选择播报广播' }], |
| | | memberIds: [{ required: true, message: '请选择通知人员' }], |
| | | status: [{ required: true, message: '请选择状态' }] |
| | | } |
| | | } |
| | |
| | | api: '/business/warningRule', |
| | | 'field.id': 'id' |
| | | }) |
| | | this.loadRegions() |
| | | }, |
| | | methods: { |
| | | normalizeOptions (node) { |
| | |
| | | children: node.childList |
| | | } |
| | | }, |
| | | changeCamera (curitem) { |
| | | var list = curitem.carmeraList |
| | | if (list && list.length) { |
| | | list.forEach(item => { |
| | | if (curitem.deviceId === item.indexCode) { |
| | | curitem.deviceName = item.name |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | changeSel (opt) { |
| | | var item = this.form.detailList[opt] |
| | | this.form.detailList[opt].regionCode = null |
| | | this.form.detailList[opt].regionName = null |
| | | if (item.regionId) { |
| | | var reg = this.getSelectedObject(item.regionId) |
| | | if (reg) { |
| | | this.form.detailList[opt].regionCode = reg.indexCode |
| | | this.form.detailList[opt].regionName = reg.name |
| | | this.$nextTick(() => { |
| | | console.log('=================changeSel',opt,this.form.detailList) |
| | | var item = this.form.detailList[opt] |
| | | this.form.detailList[opt].regionCode = null |
| | | this.form.detailList[opt].regionName = null |
| | | this.form.detailList[opt].carmeraList = [] |
| | | // this.form.detailList[opt].deviceId = null |
| | | // this.form.detailList[opt].deviceName = null |
| | | if (item.regionId) { |
| | | var reg = this.getSelectedObject(item.regionId) |
| | | if (reg) { |
| | | this.form.detailList[opt].regionCode = reg.indexCode |
| | | this.form.detailList[opt].regionName = reg.name |
| | | this.form.detailList[opt].carmeraList = reg.carmeraList |
| | | } |
| | | } |
| | | console.log('=================changeSel1' , this.form.detailList[opt].carmeraList,this.form.detailList[opt].deviceId) |
| | | if(this.notInCarmeraList( this.form.detailList[opt].carmeraList,this.form.detailList[opt].deviceId) ){ |
| | | this.form.detailList[opt].deviceId = null |
| | | this.form.detailList[opt].deviceName = null |
| | | } |
| | | }) |
| | | }, |
| | | notInCarmeraList (list, id) { |
| | | var r = true |
| | | if (list && list.length) { |
| | | for (const item of list) { |
| | | if (item.indexCode === id) { |
| | | r = false |
| | | } |
| | | } |
| | | } |
| | | console.log(' this.form.detailList[opt]', reg, this.form.detailList[opt]) |
| | | return r |
| | | }, |
| | | getSelectedObject (id) { |
| | | if (!id) { |
| | |
| | | return findSelected(this.regionList) // 开始搜索并返回结果 |
| | | }, |
| | | addDo () { |
| | | this.form.detailList.push({ random: Math.random(), regionId: null, regionName: null, regionCode: null, warningId: null }) |
| | | this.form.detailList.push({ random: Math.random(), deviceId: null, deviceName: null, regionId: null, regionName: null, regionCode: null, warningId: null }) |
| | | }, |
| | | delDo (index) { |
| | | if (this.form.detailList.length > 1 && this.form.detailList.length > index) { |
| | |
| | | deviceNoticeContent: '', |
| | | memberNotice: 1, |
| | | status: 0, |
| | | detailList: [{ random: Math.random(), regionId: null, regionName: null, regionCode: null, warningId: null }] |
| | | detailList: [{ random: Math.random(), deviceId: null, deviceName: null, regionId: null, regionName: null, regionCode: null, warningId: null }] |
| | | } |
| | | // 新建 |
| | | if (target == null) { |
| | |
| | | this.$refs.form.resetFields() |
| | | this.form[this.configData['field.id']] = null |
| | | }) |
| | | |
| | | return |
| | | } |
| | | // 编辑 |
| | | this.$nextTick(() => { |
| | | this.form.detailList =target.detailList |
| | | for (const key in this.form) { |
| | | this.form[key] = target[key] |
| | | this.form.memberNotice = this.form.memberNotice || 0 |
| | | this.form.deviceNotice = this.form.deviceNotice || 0 |
| | | this.form.status = this.form.status || 0 |
| | | } |
| | | console.log('===========================', this.form.detailList, target.detailList) |
| | | if (!this.form.detailList || !this.form.detailList.length) { |
| | | this.form.detailList = [{ random: Math.random(), regionId: null, regionName: null, regionCode: null, warningId: null }] |
| | | this.form.detailList = [{ random: Math.random(), deviceId: null, deviceName: null, regionId: null, regionName: null, regionCode: null, warningId: null }] |
| | | } else { |
| | | this.form.detailList.forEach((item, index) => { |
| | | if (item.regionId != null) { |
| | | var region = this.getSelectedObject(item.regionId) |
| | | if (region) { |
| | | item.carmeraList = region.carmeraList || [] |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | if (this.form.memberIds) { |
| | | this.memberSelect = this.form.memberIds.split(',') |