Quellcode durchsuchen

Update - 哨兵-应急中心 事件修改接口联调

yhfu vor 3 Tagen
Ursprung
Commit
51fb60a7d8
2 geänderte Dateien mit 155 neuen und 41 gelöschten Zeilen
  1. 11 0
      src/api/event.js
  2. 144 41
      src/views/SentryEmergencyCenter.vue

+ 11 - 0
src/api/event.js

@@ -51,6 +51,17 @@ export function eventReport(param) {
 }
 
 /**
+ * 事件修改
+ */
+export function updateEventContingencyDetail(param) {
+  return request({
+    url: '/sooka-digital-construction/eventSubject/updateEventContingencyDetail',
+    method: 'post',
+    data: param
+  })
+}
+
+/**
  * 应急事件详情
  */
 export function getDescriptionByContingency(eventId) {

+ 144 - 41
src/views/SentryEmergencyCenter.vue

@@ -219,9 +219,31 @@
 					<el-form-item label="纬度" prop="latitude" style="width: 350px;height: 40px;">
 						<el-input v-model="ruleForm.latitude"></el-input>
 					</el-form-item>
+					<!-- <el-form-item label="部门" prop="deptList" style="width: 350px;height: 40px;">
+						<el-select v-model="ruleForm.deptList" placeholder="选择部门" popper-class="deptDropdown" @clear="clearall" ref="mySelect clearable">
+							<el-row class="blRow">
+								<el-col>
+									<el-option :value="deptList" disabled>
+										<el-tree
+											:data="deptOptions"
+											:props="defaultProps"
+											ref="tree"
+											show-checkbox
+											check-strictly
+											:expand-on-click-node="false"
+											node-key="id"
+											check-on-click-node
+											@check-change="handleNodeClick"
+										></el-tree>
+									</el-option>
+								</el-col>
+							</el-row>
+						</el-select>
+					</el-form-item> -->
 					<el-form-item label="图片" prop="fileList" style="width: 1200px;height: 40px;">
 						<ImageUpload :fileType="['jpg', 'png','jpeg']" :limit="5" :value="fileList"  @input="getUrl"></ImageUpload>
-					</el-form-item>
+					     <template #label></template>
+     				</el-form-item>
 					<el-form-item label="事件描述" prop="eventDescription" style="width: 1000px;height: 100px;margin-top: 9%;">
 						<el-input type="textarea" v-model="ruleForm.eventDescription" class="descInput"></el-input>
 					</el-form-item>
@@ -302,7 +324,7 @@
 					</el-form-item>
 				</div>
                 <el-form-item style="float: right;">
-                    <el-button type="primary" @click="submitForm('ruleForm')">发起</el-button>
+                    <el-button type="primary" @click="submitForm('ruleForm')">{{ currentFormStatus == 0 ? '发起' : '修改' }}</el-button>
                     <el-button @click="resetForm('ruleForm')">重置</el-button>
                 </el-form-item>
             </el-form>
@@ -315,11 +337,13 @@
 	import { getToken } from '@/utils/auth'
 	import supermap from '@/components/supermap-2.5d' //超图
 	import {getUserProfile} from "@/api/system/user";
+	import {treeselectAll} from '@/api/system/dept.js'
     import {
         getEventList,
 		getPlanList,
         getDescriptionByContingency,
 		eventReport,
+		updateEventContingencyDetail,
 		getEmergencyStatisticsByYear
     } from "@/api/event.js"
 	import {
@@ -330,7 +354,6 @@
 	import ImageUpload from '@/components/ImageUpload'
 
 	import '../assets/styles/sb_body.css';
-
 	import {
 		selectConfigKey
 	} from "@/api/system/config";
@@ -362,15 +385,20 @@
 			// this.getSuperMapUrl();
 			this.getEventList()
 			this.getPlanList()
+			this.deptId = Cookies.get("deptId")
 			getEmergencyStatisticsByYear().then(res => {
 				this.eventTotalCountYear = res.data.countSum || ''
 			})
+			treeselectAll().then(res => {
+				this.deptOptions = res.data
+			})
 			setTimeout(() => {
 				this.title = '四平市智慧哨兵监管平台'
 			}, 1000);
 		},
 		data() {
 			return {
+				deptId:null,
 				isVisible: false, // 初始时设置为false,不显示内容
 				input:'',
 				input1: '',
@@ -381,8 +409,13 @@
 				headers: {
 					Authorization: 'Bearer ' + getToken()
 				},
+				defaultProps: {
+					children: "children",
+					label: "label",
+				},
+				deptOptions:[],
 				// 数量限制
-				limit: 5,
+				limit: 1,
 				fileList:[],
 				videoList:[],
 				uploadList:[],
@@ -423,16 +456,7 @@
 					eventType: {
 						eventTypeCode: "2" 			//内部自定义编码
 					},
-					"deptList": [
-						{
-						"mapDeptId": "370", //部门id
-						"mapDeptName": "铁东区" //部门名称
-						},
-						{
-						"mapDeptId": "365", //部门id
-						"mapDeptName": "四平市" //部门名称
-						}
-					], //事件接受部门集合
+					deptList: [], //事件接受部门集合
 					contingencyDetail:{
 						eventLocation:'',
 						eventReason:'',
@@ -448,22 +472,53 @@
                 rules: {
                     eventTitle: [
                         { required: true, message: '请输入事件名称', trigger: 'blur' },
-                        { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
+                        { min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' }
                     ],
                     eventDescription: [
                         { required: true, message: '请填写事件描述', trigger: 'blur' }
                     ]
                 },
+				currentFormStatus:0,            // 当前表单状态 0:发起 1:修改
 				eventTotalCountYear:'',
 				reportParams:{},  // 发起事件参数
 				planTotal:null,
 				planList:[],
 				planListSearch:[],
 				emergencyEventDetails:{},       // 应急事件详情信息
-				attachExamine:[]
+				attachExamine:[],
+				deptList:[]
 			}
 		},
 		methods: {
+			handleNodeClick(data, self, child) {
+				console.log('this.ruleForm.deptList',this.ruleForm)
+				this.ruleForm.deptList.push({
+					mapDeptName:data.label,
+					mapDeptId:data.id,
+				})
+				return
+				let datalist = this.$refs.tree.getCheckedNodes()
+				let dataLennth = datalist.length
+				if (dataLennth == 1 && !this.alreadySet) {
+					console.log('11111111111')
+					this.form.deptId = data.id
+					this.form.selectTree = data.deptName
+					this.$refs.mySelect.handleClose()
+				}
+				if (dataLennth > 1) {
+					this.alreadySet = true
+					let dataArray = []
+					dataArray.push(data)
+					this.form.deptId = data.id
+					this.form.selectTree = data.deptName
+					console.log('dataArray:', dataArray)
+					this.$nextTick(() => {
+						this.$refs.mySelect.handleClose()
+						this.$refs.tree.setCheckedNodes(dataArray)
+					})
+				}
+
+			},
             // 发起应急事件
             setEmergencyEvent(){
                 this.setEventDialogVisible = true
@@ -472,6 +527,7 @@
 				})
             },
 			getDescriptionByContingency(){
+				this.currentFormStatus = 1
 				let form = {
 					eventTitle: this.emergencyEventDetails.eventTitle || '',
                     latitude: this.emergencyEventDetails.latitude || '',
@@ -482,16 +538,7 @@
 					eventType: {
 						eventTypeCode: "2" 			//内部自定义编码
 					},
-					"deptList": [
-						{
-							"mapDeptId": "370", //部门id
-							"mapDeptName": "铁东区" //部门名称
-						},
-						{
-							"mapDeptId": "365", //部门id
-							"mapDeptName": "四平市" //部门名称
-						}
-					], //事件接受部门集合
+					deptList:  this.emergencyEventDetails.deptList || [], //事件接受部门集合
 					contingencyDetail:{
 						eventLocation: this.emergencyEventDetails.eventLocation || '',
 						eventReason : this.emergencyEventDetails.eventReason || '',
@@ -504,10 +551,23 @@
 					}
 				}
 				this.fileList = this.emergencyEventDetails.attachPath || []
-				this.videoList = [this.emergencyEventDetails.videoPath] || [],
-				this.videoUploadList = [this.emergencyEventDetails.videoPath] || []
 
-				console.log('this.fileList',this.fileList)
+				this.videoList = []
+				this.videoUploadList = []
+				try {
+					this.videoList.push({
+						name:'111',
+						webName:'111',
+						url:this.emergencyEventDetails.videoPath.split("/").slice(3).join("/")
+					})
+					this.videoUploadList.push({
+						name:'111',
+						webName:'111',
+						url:this.emergencyEventDetails.videoPath.split("/").slice(3).join("/")
+					})
+				} catch (error) {
+				}
+				console.log('this.videoList',this.videoList)
 				setTimeout(() => {
 					this.ruleForm = form
 					this.emergencyEventDetails = {}
@@ -553,18 +613,43 @@
 							this.reportParams.contingencyDetail.videoPath = this.videoList[0].url
 						}
 						this.reportParams.attachList = this.attachExamine
-						// return
-						eventReport(this.reportParams).then(res => {
-							this.setEventDialogVisible = false
-							// 重置表单状态
-							this.resetForm('ruleForm');
-							if(res.code == 200){
-								this.fileList = [],
-								this.videoList = [],
-								this.uploadList = [],
-								this.videoUploadList = []
-							}
-						})
+						console.log('this.videoList',this.videoList)
+						console.log('this.videoUploadList',this.videoUploadList)
+						if(this.currentFormStatus == 0){
+							// 发起上报新事件
+							eventReport(this.reportParams).then(res => {
+								this.$message.success(`上报成功!`)
+								this.setEventDialogVisible = false
+								// 重置表单状态
+								this.resetForm('ruleForm');
+								if(res.code == 200){
+									this.fileList = [],
+									this.videoList = [],
+									this.uploadList = [],
+									this.videoUploadList = []
+									// 刷新事件列表
+									this.getEventList()
+								}
+							})
+						} else {
+							let params = this.reportParams
+							params.eventId = this.eventId
+							// 修改上报事件信息
+							updateEventContingencyDetail(params).then(res => {
+								this.$message.success(`修改成功!`)
+								this.setEventDialogVisible = false
+								// 重置表单状态
+								this.resetForm('ruleForm');
+								if(res.code == 200){
+									this.fileList = [],
+									this.videoList = [],
+									this.uploadList = [],
+									this.videoUploadList = []
+									// 刷新事件列表
+									this.getEventList()
+								}
+							})
+						}
 					} else {
 						console.log('error submit!!');
 						return false;
@@ -1037,6 +1122,17 @@
 	}
 </script>
 <style rel="stylesheet/scss" lang="scss">
+
+	.deptDropdown{
+		width: 300px !important;
+		height: 265px !important;
+		.el-tree{
+			height: 240px;
+		}
+	}
+	.el-select-dropdown__item.is-disabled:hover {
+		background-color: #0A4C5C;
+	}
 	.visual-con .el-input__inner {
 		border: 1px solid #3bb8a4;
 		background-color: rgba(20, 107, 115, 0.3);
@@ -1397,4 +1493,11 @@
 			transform: skewX(-2deg);
 		}
 	}
+	.blRow {
+		height: 250px !important;
+		overflow-y: auto;
+		.el-select-dropdown__item {
+			height: 240px !important;
+		}
+	}
 </style>