5 changed files with 1776 additions and 1 deletions
@ -0,0 +1,819 @@ |
|||
<template> |
|||
<div> |
|||
<div class="dialog-h-content scroll-h"> |
|||
|
|||
<el-form ref="ref_form" |
|||
:inline="true" |
|||
:model="formData" |
|||
:rules="dataRule" |
|||
:disabled="formType === 'detail'" |
|||
class="div_form "> |
|||
<div class="form_flex"> |
|||
|
|||
<div class="form_item"> |
|||
<el-form-item label="主办方" |
|||
prop="sponsorId" |
|||
label-width="150px"> |
|||
<el-cascader class="customer_cascader" |
|||
ref="myCascader" |
|||
v-model="agencyIdArray" |
|||
:options="orgOptions" |
|||
:props="orgOptionProps" |
|||
:show-all-levels="false" |
|||
@change="handleChangeAgency"></el-cascader> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="活动标题" |
|||
prop="title" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_5" |
|||
type="textarea" |
|||
maxlength="50" |
|||
show-word-limit |
|||
:rows="2" |
|||
placeholder="请输入活动标题,不超过50字" |
|||
v-model="formData.title"></el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="封面" |
|||
label-width="150px" |
|||
style="display:block"> |
|||
<el-upload :class="['avatar-uploader', {'hide': hideUploadBtn}] " |
|||
ref="uploadPic" |
|||
:action="uploadUlr" |
|||
list-type="picture-card" |
|||
:on-exceed="exceedPic" |
|||
:on-remove="removePic" |
|||
:file-list="replayImgList" |
|||
:on-change="handleEditChange" |
|||
:on-success="handleSuccess" |
|||
:limit="1"> |
|||
<span class="font-14">选择图片</span> |
|||
|
|||
</el-upload> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="活动时间" |
|||
label-width="150px" |
|||
prop="actStartTime"> |
|||
<el-date-picker v-model="formData.actStartTime" |
|||
:picker-options="startPickerOptions" |
|||
class="list_item_width_1" |
|||
type="date" |
|||
value-format="yyyy-MM-dd" |
|||
value="yyyy-MM-dd" |
|||
placeholder="开始时间"> |
|||
</el-date-picker> |
|||
<span class="data-tag">至</span> |
|||
<el-date-picker v-model="formData.actEndTime" |
|||
:picker-options="endPickerOptions" |
|||
class="list_item_width_1 data-tag" |
|||
type="date" |
|||
value-format="yyyy-MM-dd" |
|||
value="yyyy-MM-dd" |
|||
placeholder="结束时间"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="活动人数" |
|||
prop="actQuota" |
|||
style="display: block" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_5" |
|||
v-model="formData.actQuota" |
|||
label="活动人数"></el-input-number> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="活动积分" |
|||
prop="reward" |
|||
style="display: block" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_5" |
|||
v-model="formData.reward" |
|||
label="活动积分"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="联系人" |
|||
prop="sponsorContacts" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_5" |
|||
maxlength="10" |
|||
placeholder="请输入联系人" |
|||
v-model="formData.sponsorContacts"> |
|||
</el-input> |
|||
</el-form-item> |
|||
</div> |
|||
<div class="form_item"> |
|||
|
|||
<el-form-item label="联系电话" |
|||
prop="sponsorTel" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_5" |
|||
maxlength="10" |
|||
placeholder="请输入联系电话" |
|||
v-model="formData.sponsorTel"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="报名仅限志愿者" |
|||
prop="volunteerLimit" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-checkbox v-model="formData.volunteerLimit"></el-checkbox> |
|||
|
|||
</el-form-item> |
|||
|
|||
<el-form-item label="报名无需审核" |
|||
prop="auditSwitch" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-checkbox v-model="formData.auditSwitch"></el-checkbox> |
|||
|
|||
</el-form-item> |
|||
|
|||
<el-form-item label="报名截止时间" |
|||
style="display: block" |
|||
prop="signUpEndTime" |
|||
label-width="150px"> |
|||
<el-date-picker v-model="formData.signUpEndTime" |
|||
value-format="yyyy-MM-dd HH:mm:ss" |
|||
type="date" |
|||
placeholder="选择事件"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="报名条件" |
|||
prop="requirement" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_5" |
|||
type="textarea" |
|||
maxlength="200" |
|||
show-word-limit |
|||
:rows="5" |
|||
placeholder="请输入报名条件,不超过200字" |
|||
v-model="formData.requirement"></el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="签到时间" |
|||
label-width="150px" |
|||
prop="signInStartTime"> |
|||
<el-date-picker v-model="formData.signInStartTime" |
|||
:picker-options="startPickerOptions" |
|||
class="list_item_width_1" |
|||
type="date" |
|||
value-format="yyyy-MM-dd" |
|||
value="yyyy-MM-dd" |
|||
placeholder="开始时间"> |
|||
</el-date-picker> |
|||
<span class="data-tag">至</span> |
|||
<el-date-picker v-model="formData.signInEndTime" |
|||
:picker-options="endPickerOptions" |
|||
class="list_item_width_1 data-tag" |
|||
type="date" |
|||
value-format="yyyy-MM-dd" |
|||
value="yyyy-MM-dd" |
|||
placeholder="结束时间"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="签到有效范围(米)" |
|||
prop="signInRadius" |
|||
style="display: block" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_5" |
|||
v-model="formData.signInRadius" |
|||
label="签到有效范围"></el-input-number> |
|||
</el-form-item> |
|||
</div> |
|||
</div> |
|||
<div class="form_flex"> |
|||
<div class="form_item"> |
|||
<el-form-item label="活动地点" |
|||
prop="longitude" |
|||
label-width="150px"> |
|||
<div style="width: 400px"> |
|||
<el-input class="item_width_4" |
|||
maxlength="100" |
|||
style="width: 330px" |
|||
show-word-limit |
|||
placeholder="请输入所在地址" |
|||
v-model="formData.actAddress"> |
|||
</el-input> |
|||
<el-button style="margin-left: 10px" |
|||
type="default" |
|||
size="small" |
|||
@click="handleSearchMapAct">查询</el-button> |
|||
<div id="map_act_id" |
|||
class="div_map"></div> |
|||
<!-- <div style="margin-top: 10px"> |
|||
<span>经度</span> |
|||
<el-input class="item_width_3" |
|||
maxlength="50" |
|||
placeholder="请输入经度" |
|||
v-model="formData.actLatitude"> |
|||
</el-input> |
|||
<span style="margin-left: 20px">纬度</span> |
|||
<el-input class="item_width_3" |
|||
maxlength="50" |
|||
placeholder="请输入纬度" |
|||
v-model="formData.actLongitude"> |
|||
</el-input> |
|||
</div> --> |
|||
</div> |
|||
</el-form-item> |
|||
</div> |
|||
<div class="form_item"> |
|||
<el-form-item label="签到地点" |
|||
prop="longitude" |
|||
label-width="150px"> |
|||
<div style="width: 400px"> |
|||
<el-input class="item_width_4" |
|||
maxlength="100" |
|||
style="width: 330px" |
|||
show-word-limit |
|||
placeholder="请输入所在地址" |
|||
v-model="formData.signInAddress"> |
|||
</el-input> |
|||
<el-button style="margin-left: 10px" |
|||
type="default" |
|||
size="small" |
|||
@click="handleSearchMapSignin">查询</el-button> |
|||
<div id="map_signin_id" |
|||
class="div_map"></div> |
|||
<!-- <div style="margin-top: 10px"> |
|||
<span>经度</span> |
|||
<el-input class="item_width_3" |
|||
maxlength="50" |
|||
placeholder="请输入经度" |
|||
v-model="formData.signInLatitude"> |
|||
</el-input> |
|||
<span style="margin-left: 20px">纬度</span> |
|||
<el-input class="item_width_3" |
|||
maxlength="50" |
|||
placeholder="请输入纬度" |
|||
v-model="formData.signInLongitude"> |
|||
</el-input> |
|||
</div> --> |
|||
</div> |
|||
</el-form-item> |
|||
</div> |
|||
</div> |
|||
<el-form-item label="活动内容" |
|||
prop="longitude" |
|||
label-width="150px"> |
|||
<!-- <div style="width:400px"> --> |
|||
<Tinymce class="tinymce_view" |
|||
v-if="formType!='detail'" |
|||
v-model="formData.actContent" |
|||
:height="250" |
|||
style="width:1000px" |
|||
:customerId="customerId" |
|||
placeholder="在这里输入文字" /> |
|||
<p v-else |
|||
class="text_p" |
|||
v-html="formData.actContent"></p> |
|||
<!-- </div> --> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button size="small" |
|||
@click="handleCancle">取 消</el-button> |
|||
<el-button size="small" |
|||
v-if="formType != 'detail'" |
|||
type="primary" |
|||
:disabled="btnDisable" |
|||
@click="handleComfirm">确 定</el-button> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import { requestPost } from '@/js/dai/request' |
|||
|
|||
import Tinymce from '@c/tinymce2/index.vue' |
|||
|
|||
let loading // 加载动画 |
|||
|
|||
var map_act; |
|||
var search_act; |
|||
var markers_act; |
|||
var infoWindowList_act; |
|||
var geocoder_act; // 新建一个正逆地址解析类 |
|||
|
|||
var map_signin; |
|||
var search_signin; |
|||
var markers_signin; |
|||
var infoWindowList_signin; |
|||
var geocoder_signin; // 新建一个正逆地址解析类 |
|||
|
|||
export default { |
|||
data () { |
|||
let endDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
let nowData = Date.now() |
|||
if (this.formData.serviceTimeStart) { |
|||
let serviceTimeStart = new Date(this.formData.serviceTimeStart) |
|||
return time.getTime() > nowData || time.getTime() < serviceTimeStart || time.getTime() === serviceTimeStart |
|||
} else { |
|||
return time.getTime() > nowData |
|||
} |
|||
|
|||
} |
|||
let startDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
let nowData = Date.now() |
|||
return time.getTime() > nowData |
|||
} |
|||
return { |
|||
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|||
btnDisable: false, |
|||
customerId: '', |
|||
|
|||
placesList: [],//场景列表 |
|||
teamsList: [],//分队列表 |
|||
inspectorsList: [],//检查人员列表 |
|||
|
|||
placePatrolRecordId: '', |
|||
formData: { |
|||
actAddress: "市北区海泊桥青岛市市北区政府(延吉路北)", |
|||
actContent: "", |
|||
actDraftId: "", |
|||
actEndTime: "2022-08-30 13:34", |
|||
actId: "", |
|||
actLatitude: 36.08743, |
|||
actLongitude: 120.37479, |
|||
actQuota: "10", |
|||
actStartTime: "2022-07-30 13:34", |
|||
actType: "heart", |
|||
auditSwitch: true, |
|||
coverPic: "https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20220629/db05fed5cc56417299364ab8362ac9a0.png", |
|||
coverPicAuditStatus: "", |
|||
customerId: "45687aa479955f9d06204d415238f7cc", |
|||
|
|||
noticePassedPeople: false, |
|||
requirement: "", |
|||
reward: "10", |
|||
|
|||
signInAddress: "市北区海泊桥青岛市市北区政府(延吉路北)", |
|||
signInEndTime: "2022-07-30 10:34", |
|||
signInLatitude: 36.08743, |
|||
signInLongitude: 120.37479, |
|||
signInRadius: "100", |
|||
signInStartTime: "2022-07-29 13:34", |
|||
signUpEndTime: "2022-07-28 13:34", |
|||
sponsorContacts: "张三", |
|||
sponsorId: "7b6f9a9f9f38d5f9fa7ce94a93d6eb28", |
|||
sponsorName: "市北区", |
|||
sponsorTel: "15111111111", |
|||
sponsorType: "agency", |
|||
target: "", |
|||
title: "312313", |
|||
|
|||
volunteerLimit: false, |
|||
}, |
|||
|
|||
|
|||
orgOptions: [], |
|||
orgOptionProps: { |
|||
multiple: false, |
|||
value: 'gridId', |
|||
label: 'agencyGridName', |
|||
children: 'agencyGridList', |
|||
checkStrictly: true |
|||
}, |
|||
agencyIdArray: [], |
|||
|
|||
endPickerOptions: { |
|||
disabledDate: endDisabledDate |
|||
}, |
|||
startPickerOptions: { |
|||
disabledDate: startDisabledDate |
|||
}, |
|||
|
|||
//图片相关 oss/file/uploadvariedfile |
|||
dialogImageUrl: 'oss/file/uploadvariedfile', |
|||
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadvariedfile', |
|||
// upload_url: '', // 上传URL |
|||
upload_name: '', // 图片或视频名称 |
|||
replayImgList: [], |
|||
hideUploadBtn: false |
|||
|
|||
} |
|||
}, |
|||
components: { Tinymce }, |
|||
mounted () { |
|||
this.customerId = localStorage.getItem('customerId') |
|||
this.initMap() |
|||
this.loadSponsorlist() |
|||
}, |
|||
|
|||
methods: { |
|||
|
|||
async initForm (type, placePatrolRecordId) { |
|||
this.$refs.ref_form.resetFields(); |
|||
this.startLoading() |
|||
|
|||
this.formType = type |
|||
if (placePatrolRecordId) { |
|||
this.placePatrolRecordId = placePatrolRecordId |
|||
this.formData.placePatrolRecordId = placePatrolRecordId |
|||
await this.loadFormData() |
|||
|
|||
} |
|||
this.endLoading() |
|||
}, |
|||
|
|||
//获取主办方 |
|||
async loadSponsorlist () { |
|||
const url = "/heart/work/act/sponsorlist" |
|||
|
|||
let params = {} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
|
|||
data.agencyGridName = data.agencyName |
|||
data.gridId = data.agencyId |
|||
data.level = 'agency' |
|||
this.orgOptions.push(data) |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
handleChangeAgency (val) { |
|||
let obj = this.$refs["myCascader"].getCheckedNodes()[0].data |
|||
if (obj) { |
|||
this.formData.sponsorId = obj.gridId |
|||
this.formData.sponsorName = obj.agencyName |
|||
|
|||
if (obj.level === 'agency') { |
|||
|
|||
this.formData.sponsorType = 'agency' |
|||
} else { |
|||
|
|||
this.formData.sponsorType = 'grid' |
|||
} |
|||
|
|||
} else { |
|||
this.formData.sponsorId = '' |
|||
this.formData.sponsorName = '' |
|||
this.formData.sponsorType = '' |
|||
} |
|||
|
|||
|
|||
}, |
|||
|
|||
|
|||
//加载form |
|||
async loadFormData () { |
|||
const url = '/gov/org/placepatrolrecord/detail' |
|||
|
|||
let params = { |
|||
placePatrolRecordId: this.placePatrolRecordId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
data.inspectorArray = data.inspectors.split(',') |
|||
this.formData = { ...data } |
|||
|
|||
|
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
|
|||
async handleComfirm () { |
|||
|
|||
this.btnDisable = true |
|||
setTimeout(() => { |
|||
this.btnDisable = false |
|||
}, 10000) |
|||
this.$refs['ref_form'].validate((valid, messageObj) => { |
|||
if (!valid) { |
|||
app.util.validateRule(messageObj) |
|||
this.btnDisable = false |
|||
} else { |
|||
this.addRecord() |
|||
} |
|||
|
|||
}) |
|||
|
|||
}, |
|||
async addRecord () { |
|||
this.formData.actContent = this.dormatHtml(this.formData.actContent) |
|||
|
|||
let url = "/gov/org/placepatrolrecord/add" |
|||
// let url = "http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolrecord/add" |
|||
this.formData.inspectors = this.formData.inspectorArray.join(',') |
|||
|
|||
const { data, code, msg } = await requestPost(url, this.formData) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: 'success', |
|||
message: '操作成功' |
|||
}) |
|||
this.resetData() |
|||
this.$emit('dialogOk') |
|||
this.btnDisable = false |
|||
} else { |
|||
this.btnDisable = false |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
dormatHtml (content) { |
|||
let c = '' |
|||
if (content.indexOf('DOCTYPE') != -1) { |
|||
c = content.slice(45, -16); |
|||
} |
|||
console.log('content', typeof content) |
|||
return c || content |
|||
}, |
|||
|
|||
removePic (file, fileList) { |
|||
|
|||
this.formData.imageList.splice(this.formData.imageList.findIndex(item => item === file.url), 1) |
|||
this.replayImgList.splice(this.replayImgList.findIndex(item => item.uid === file.uid), 1) |
|||
this.hideUploadBtn = fileList.length >= 1; |
|||
|
|||
}, |
|||
// 最多上传3张图,超过时隐藏上传按钮 |
|||
handleEditChange (file, fileList) { |
|||
|
|||
this.hideUploadBtn = fileList.length >= 1; |
|||
}, |
|||
exceedPic () { |
|||
this.$message.warning("只能上传1张封面图") |
|||
|
|||
}, |
|||
handleSuccess (response, file, fileList) { |
|||
this.replayImgList.push(file) |
|||
this.formData.imageList.push(response.data.url) |
|||
|
|||
}, |
|||
|
|||
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|||
initMap () { |
|||
// 定义地图中心点坐标 |
|||
var center = new window.TMap.LatLng(36.0722275, 120.38945519); |
|||
// 定义map变量,调用 TMap.Map() 构造函数创建地图 |
|||
map_act = new window.TMap.Map(document.getElementById("map_act_id"), { |
|||
center: center, // 设置地图中心点坐标 |
|||
zoom: 17.2, // 设置地图缩放级别 |
|||
pitch: 43.5, // 设置俯仰角 |
|||
rotation: 45, // 设置地图旋转角度 |
|||
}); |
|||
map_signin = new window.TMap.Map(document.getElementById("map_signin_id"), { |
|||
center: center, // 设置地图中心点坐标 |
|||
zoom: 17.2, // 设置地图缩放级别 |
|||
pitch: 43.5, // 设置俯仰角 |
|||
rotation: 45, // 设置地图旋转角度 |
|||
}); |
|||
|
|||
search_act = new window.TMap.service.Search({ pageSize: 10 }); |
|||
// 新建一个地点搜索类 |
|||
markers_act = new TMap.MultiMarker({ |
|||
map: map_act, |
|||
geometries: [], |
|||
}); |
|||
infoWindowList_act = Array(10); |
|||
|
|||
geocoder_act = new TMap.service.Geocoder(); // 新建一个正逆地址解析类 |
|||
|
|||
search_signin = new window.TMap.service.Search({ pageSize: 10 }); |
|||
// 新建一个地点搜索类 |
|||
markers_signin = new TMap.MultiMarker({ |
|||
map: map_signin, |
|||
geometries: [], |
|||
}); |
|||
infoWindowList_signin = Array(10); |
|||
|
|||
geocoder_signin = new TMap.service.Geocoder(); // 新建一个正逆地址解析类 |
|||
|
|||
// 监听地图平移结束 |
|||
map_act.on("panend", (e) => { |
|||
this.handleMoveCenterAct(e); |
|||
}); |
|||
this.handleMoveCenterAct(); |
|||
|
|||
// 监听地图平移结束 |
|||
map_signin.on("panend", (e) => { |
|||
this.handleMoveCenterSignin(e); |
|||
}); |
|||
this.handleMoveCenterSignin(); |
|||
}, |
|||
|
|||
setMarkerAct (lat, lng) { |
|||
markers_act.setGeometries([]); |
|||
markers_act.add([ |
|||
{ |
|||
id: "4", |
|||
styleId: "marker", |
|||
position: new TMap.LatLng(lat, lng), |
|||
properties: { |
|||
title: "marker4", |
|||
}, |
|||
}, |
|||
]); |
|||
}, |
|||
|
|||
handleSearchMapAct () { |
|||
infoWindowList_act.forEach((infoWindow) => { |
|||
infoWindow.close(); |
|||
}); |
|||
infoWindowList_act.length = 0; |
|||
markers_act.setGeometries([]); |
|||
// 在地图显示范围内以给定的关键字搜索地点 |
|||
search_act |
|||
.searchRectangle({ |
|||
keyword: this.formData.actAddress, |
|||
bounds: map_act.getBounds(), |
|||
}) |
|||
.then((result) => { |
|||
let { data } = result; |
|||
if (Array.isArray(data) && data.length > 0) { |
|||
const { |
|||
location: { lat, lng }, |
|||
} = data[0]; |
|||
map_act.setCenter(new TMap.LatLng(lat, lng)); |
|||
this.setMarkerAct(lat, lng); |
|||
this.formData.actLatitude = lat; |
|||
this.formData.actLongitude = lng; |
|||
} else { |
|||
this.$message.error("未检索到相关位置坐标"); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
handleMoveCenterAct (e) { |
|||
//修改地图中心点 |
|||
const center = map_act.getCenter(); |
|||
const lat = center.getLat(); |
|||
const lng = center.getLng(); |
|||
this.formData.actLatitude = lat; |
|||
this.formData.actLongitude = lng; |
|||
this.setMarkerAct(lat, lng); |
|||
|
|||
if (e && e.originalEvent) { |
|||
geocoder_act |
|||
.getAddress({ location: new TMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址 |
|||
.then((result) => { |
|||
this.formData.actAddress = result.result.address; |
|||
}); |
|||
} |
|||
}, |
|||
setMarkerSignin (lat, lng) { |
|||
markers_signin.setGeometries([]); |
|||
markers_signin.add([ |
|||
{ |
|||
id: "4", |
|||
styleId: "marker", |
|||
position: new TMap.LatLng(lat, lng), |
|||
properties: { |
|||
title: "marker4", |
|||
}, |
|||
}, |
|||
]); |
|||
}, |
|||
|
|||
handleSearchMapSignin () { |
|||
infoWindowList_signin.forEach((infoWindow) => { |
|||
infoWindow.close(); |
|||
}); |
|||
infoWindowList_signin.length = 0; |
|||
markers_signin.setGeometries([]); |
|||
// 在地图显示范围内以给定的关键字搜索地点 |
|||
search_signin |
|||
.searchRectangle({ |
|||
keyword: this.formData.signInAddress, |
|||
bounds: map_signin.getBounds(), |
|||
}) |
|||
.then((result) => { |
|||
let { data } = result; |
|||
if (Array.isArray(data) && data.length > 0) { |
|||
const { |
|||
location: { lat, lng }, |
|||
} = data[0]; |
|||
map_signin.setCenter(new TMap.LatLng(lat, lng)); |
|||
this.setMarkerSignin(lat, lng); |
|||
this.formData.signInLatitude = lat; |
|||
this.formData.signInLongitude = lng; |
|||
} else { |
|||
this.$message.error("未检索到相关位置坐标"); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
handleMoveCenterSignin (e) { |
|||
//修改地图中心点 |
|||
const center = map_signin.getCenter(); |
|||
const lat = center.getLat(); |
|||
const lng = center.getLng(); |
|||
this.formData.signInLatitude = lat; |
|||
this.formData.signInLongitude = lng; |
|||
this.setMarkerSignin(lat, lng); |
|||
|
|||
if (e && e.originalEvent) { |
|||
geocoder_signin |
|||
.getAddress({ location: new TMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址 |
|||
.then((result) => { |
|||
this.formData.signInAddress = result.result.address; |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
handleCancle () { |
|||
|
|||
this.resetData() |
|||
this.$emit('dialogCancle') |
|||
|
|||
}, |
|||
|
|||
resetData () { |
|||
this.formData = { |
|||
gridId: '',//网格Id |
|||
ninePlaceVal: '',//九小场所类型value值 |
|||
placeOrgId: '',//场所下的组织Id-场所名称 |
|||
placePatrolTeamId: '',//场所下分队Id |
|||
inspectorArray: [],//检查人员数组 |
|||
inspectors: '',//检查人员Id,逗号分隔 |
|||
firstTime: '',//首次巡查时间 |
|||
detailed: '',//隐患明细 |
|||
firstResult: '',//首次检查结果【0:合格 1:不合格】 |
|||
reviewTime: '',//拟复查时间 |
|||
} |
|||
}, |
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
|
|||
gridId: [ |
|||
{ required: true, message: '场所网格不能为空', trigger: 'blur' } |
|||
], |
|||
ninePlaceVal: [ |
|||
{ required: true, message: '场所类型不能为空', trigger: 'blur' }, |
|||
], |
|||
placeOrgId: [ |
|||
{ required: true, message: '场所名称不能为空', trigger: 'blur' } |
|||
], |
|||
placePatrolTeamId: [ |
|||
{ required: true, message: '分队不能为空', trigger: 'blur' } |
|||
], |
|||
|
|||
inspectorArray: [ |
|||
{ required: true, message: '巡检人员不能为空', trigger: 'blur' } |
|||
], |
|||
firstTime: [ |
|||
{ required: true, message: '首次巡查时间不能为空', trigger: 'blur' } |
|||
], |
|||
detailed: [ |
|||
{ required: true, message: '隐患明细不能为空', trigger: 'blur' } |
|||
], |
|||
firstResult: [ |
|||
{ required: true, message: '首次巡查结果不能为空', trigger: 'blur' } |
|||
] |
|||
} |
|||
}, |
|||
|
|||
}, |
|||
props: { |
|||
|
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/management/form-main.scss"; |
|||
</style> |
|||
|
@ -0,0 +1,495 @@ |
|||
<template> |
|||
<div class="div_main"> |
|||
<div class="div_search"> |
|||
<el-form :inline="true" |
|||
:model="formData" |
|||
ref="ref_searchform" |
|||
:label-width="'100px'"> |
|||
|
|||
<el-form-item label="活动标题" |
|||
prop="title"> |
|||
<el-input v-model="formData.title" |
|||
size="small" |
|||
class="item_width_1" |
|||
clearable |
|||
placeholder="请输入活动标题"> |
|||
</el-input> |
|||
|
|||
</el-form-item> |
|||
|
|||
<el-form-item label="上报时间" |
|||
prop="startTime"> |
|||
<el-date-picker v-model="formData.startTime" |
|||
:picker-options="startPickerOptions" |
|||
class="item_width_2" |
|||
size="small" |
|||
type="date" |
|||
value-format="yyyy-MM-dd HH:mm:ss" |
|||
value="yyyy-MM-dd" |
|||
placeholder="开始时间"> |
|||
</el-date-picker> |
|||
<span class="data-tag">至</span> |
|||
<el-date-picker v-model="formData.endTime" |
|||
:picker-options="endPickerOptions" |
|||
class="item_width_2 data-tag" |
|||
size="small" |
|||
type="date" |
|||
value-format="yyyy-MM-dd HH:mm:ss" |
|||
value="yyyy-MM-dd" |
|||
placeholder="结束时间"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="状态" |
|||
prop="firstResult"> |
|||
<el-select class="item_width_1" |
|||
v-model="formData.firstResult" |
|||
size="small" |
|||
placeholder="请选择" |
|||
clearable> |
|||
<el-option v-for="item in statusList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-button style="margin-left:30px" |
|||
size="small" |
|||
class="diy-button--search" |
|||
@click="handleSearch">查询</el-button> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--reset" |
|||
@click="resetSearch">重置</el-button> |
|||
|
|||
</el-form> |
|||
</div> |
|||
<div class="div_table"> |
|||
<el-button class="diy-button--add" |
|||
size="small" |
|||
@click="handleAdd">新增</el-button> |
|||
|
|||
<el-table class="table" |
|||
:data="tableData" |
|||
border |
|||
:height="tableHeight" |
|||
v-loading="tableLoading" |
|||
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}" |
|||
style="width: 100%"> |
|||
<el-table-column label="序号" |
|||
header-align="center" |
|||
align="center" |
|||
type="index" |
|||
width="50"></el-table-column> |
|||
|
|||
<el-table-column prop="title" |
|||
header-align="center" |
|||
align="center" |
|||
label="活动标题" |
|||
min-width="180"> |
|||
</el-table-column> |
|||
<el-table-column prop="actAddress" |
|||
header-align="center" |
|||
align="center" |
|||
label="活动地址" |
|||
min-width="180"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="actStartTime" |
|||
header-align="center" |
|||
align="center" |
|||
label="活动时间" |
|||
min-width="180"> |
|||
<template slot-scope="scope"> |
|||
<span>{{scope.row.actStartTime+'至'+scope.row.actEndTime}}</span> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="signUpEndTime" |
|||
header-align="center" |
|||
align="center" |
|||
label="报名截止时间" |
|||
min-width="110"> |
|||
</el-table-column> |
|||
<el-table-column prop="status" |
|||
header-align="center" |
|||
align="center" |
|||
label="状态" |
|||
min-width="100"> |
|||
</el-table-column> |
|||
<el-table-column prop="firstResult" |
|||
header-align="center" |
|||
align="center" |
|||
label="来源" |
|||
width="100"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column label="操作" |
|||
fixed="right" |
|||
width="140" |
|||
header-align="center" |
|||
align="center" |
|||
class="operate"> |
|||
<template slot-scope="scope"> |
|||
<el-button type="text" |
|||
class="div-table-button--detail" |
|||
size="small" |
|||
@click="handleDetail(scope.row)">查看</el-button> |
|||
<el-button type="text" |
|||
class="div-table-button--edit" |
|||
size="small" |
|||
@click="handleEdit(scope.row)">修改</el-button> |
|||
|
|||
<el-popover popper-class="btn-popper" |
|||
placement="bottom" |
|||
style="margin-left:10px" |
|||
width="20" |
|||
trigger="click"> |
|||
<div class="table-more-btn"> |
|||
<el-button type="text" |
|||
class="div-table-button--edit" |
|||
size="small" |
|||
@click="handleReview(scope.row)">复查记录</el-button> |
|||
</div> |
|||
|
|||
<div class="table-more-btn"> |
|||
<el-button type="text" |
|||
class="div-table-button--delete" |
|||
size="small" |
|||
@click="handleDelete(scope.row)">删除</el-button> |
|||
</div> |
|||
|
|||
<el-button type="text" |
|||
size="small" |
|||
class="div-table-button--more" |
|||
slot="reference">更多<i class="el-icon-caret-bottom"></i></el-button> |
|||
</el-popover> |
|||
|
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div> |
|||
<el-pagination @size-change="handleSizeChange" |
|||
@current-change="handleCurrentChange" |
|||
:current-page.sync="pageNo" |
|||
:page-sizes="[20, 50, 100, 200]" |
|||
:page-size="pageSize" |
|||
layout="sizes, prev, pager, next, total" |
|||
:total="total"> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 修改弹出框 --> |
|||
<el-dialog :visible.sync="formShow" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="formTitle" |
|||
width="1250px" |
|||
top="5vh" |
|||
class="dialog-h" |
|||
@closed="diaClose"> |
|||
<heart-form ref="ref_form" |
|||
@dialogCancle="addFormCancle" |
|||
@dialogOk="addFormOk"></heart-form> |
|||
</el-dialog> |
|||
|
|||
<!-- 复查记录弹出框 --> |
|||
<el-dialog :visible.sync="reviewShow" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="'复查记录'" |
|||
width="80%" |
|||
top="5vh" |
|||
class="dialog-h" |
|||
@closed="reviewDiaClose"> |
|||
<heart-review ref="ref_review" |
|||
:statusList="statusList" |
|||
@reviewDiaClose="reviewDiaClose"></heart-review> |
|||
</el-dialog> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
import heartForm from './heartForm' |
|||
import heartReview from './heartReview' |
|||
|
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
let endDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
let nowData = Date.now() |
|||
if (this.formData.startTime) { |
|||
let startTime = new Date(this.formData.startTime) |
|||
return time.getTime() > nowData || time.getTime() < startTime || time.getTime() === startTime |
|||
} else { |
|||
return time.getTime() > nowData |
|||
} |
|||
|
|||
} |
|||
let startDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
let nowData = Date.now() |
|||
return time.getTime() > nowData |
|||
} |
|||
return { |
|||
loading: false, |
|||
total: 0, |
|||
pageSize: 20, |
|||
pageNo: 0, |
|||
tableLoading: false, |
|||
endPickerOptions: { |
|||
disabledDate: endDisabledDate |
|||
}, |
|||
startPickerOptions: { |
|||
disabledDate: startDisabledDate |
|||
}, |
|||
|
|||
agencyId: '', |
|||
gridList: [],//所属网格list--场所区域 |
|||
statusList: [ |
|||
{ |
|||
value: '0', |
|||
label: '进行中' |
|||
}, |
|||
{ |
|||
value: '1', |
|||
label: '已结束' |
|||
}, |
|||
{ |
|||
value: '2', |
|||
label: '已取消' |
|||
} |
|||
],//是否合格list |
|||
placeTypeList: [],//场所类型list |
|||
|
|||
formData: { |
|||
title: '',//活动标题 |
|||
firstResult: '',//首次检查结果【0:合格 1:不合格】 |
|||
gridId: '',//场所区域【网格Id】 |
|||
ninePlaceVal: '',//场所类型【九小场所Value值】 |
|||
finalResult: '',//最终检查结果【0:合格 1:不合格】 |
|||
startTime: '', |
|||
endTime: '' |
|||
}, |
|||
|
|||
tableData: [], |
|||
|
|||
//form相关 |
|||
formShow: false, |
|||
formTitle: '新增巡查', |
|||
|
|||
reviewShow: false |
|||
|
|||
} |
|||
}, |
|||
components: { |
|||
heartForm, heartReview |
|||
}, |
|||
async created () { |
|||
|
|||
}, |
|||
async mounted () { |
|||
|
|||
this.customerId = localStorage.getItem('customerId') |
|||
const { user } = this.$store.state |
|||
this.agencyId = user.agencyId |
|||
|
|||
await this.loadTable() |
|||
}, |
|||
|
|||
methods: { |
|||
handleSearch () { |
|||
this.loadTable() |
|||
}, |
|||
|
|||
|
|||
|
|||
|
|||
async loadTable () { |
|||
this.tableLoading = true |
|||
|
|||
const url = "/heart/work/act/inprogresslist" |
|||
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolrecord/getlist" |
|||
let params = { |
|||
customerId: this.customerId, |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo, |
|||
...this.formData |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.total = 1000 |
|||
this.tableData = data |
|||
if (this.tableData && this.tableData.length > 0) { |
|||
|
|||
} |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
this.tableLoading = false |
|||
}, |
|||
|
|||
|
|||
|
|||
diaClose () { |
|||
this.$refs.ref_form.resetData() |
|||
this.formShow = false |
|||
}, |
|||
|
|||
reviewDiaClose () { |
|||
this.reviewShow = false |
|||
}, |
|||
|
|||
handleDetail (row) { |
|||
this.formTitle = '详情' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('detail', row.placePatrolRecordId) |
|||
}) |
|||
}, |
|||
|
|||
handleAdd () { |
|||
this.formTitle = '新增' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('add', null) |
|||
}) |
|||
}, |
|||
|
|||
handleEdit (row) { |
|||
this.formTitle = '编辑' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('edit', row.placePatrolRecordId) |
|||
}) |
|||
}, |
|||
|
|||
handleReview (row) { |
|||
this.reviewShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_review.initTable(row.placePatrolRecordId) |
|||
}) |
|||
}, |
|||
|
|||
addFormCancle () { |
|||
this.formShow = false |
|||
}, |
|||
|
|||
addFormOk () { |
|||
this.formShow = false |
|||
this.loadTable() |
|||
}, |
|||
|
|||
async handleDelete (row) { |
|||
|
|||
this.$confirm("确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
this.deleteRecord(row) |
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
|
|||
} |
|||
|
|||
}); |
|||
}, |
|||
|
|||
async deleteRecord (row) { |
|||
const url = "/gov/org/placepatrolrecord/del" |
|||
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolrecord/del" |
|||
|
|||
let params = { |
|||
placePatrolRecordId: row.placePatrolRecordId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
|
|||
this.loadTable() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//重置搜索条件 |
|||
resetSearch () { |
|||
this.formData = { |
|||
title: '',//活动标题 |
|||
mobile: '',//联系电话 |
|||
scale: '',//场所规模【 0:10人以下 1:10-20人 2:21-40人 3:41-100人 4:100人以上】 |
|||
gridId: '',//场所区域【网格Id】 |
|||
ninePlaceVal: '',//场所类型【九小场所Value值】 |
|||
isPage: true,//是否分页(是:true 否:false) 有这个参数是给新增巡查记录时用的,默认是 |
|||
} |
|||
this.pageSize = 10 |
|||
this.pageNo = 0 |
|||
this.loadTable() |
|||
}, |
|||
|
|||
|
|||
handleSizeChange (val) { |
|||
this.pageSize = val |
|||
this.pageNo = 1 |
|||
this.loadTable() |
|||
}, |
|||
handleCurrentChange (val) { |
|||
this.pageNo = val |
|||
this.loadTable() |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
|
|||
return this.$store.state.inIframe ? this.clientHeight - 340 + this.iframeHeight : this.clientHeight - 340 |
|||
|
|||
}, |
|||
|
|||
...mapGetters(['clientHeight', 'iframeHeight']) |
|||
}, |
|||
watch: { |
|||
|
|||
}, |
|||
props: { |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/management/list-main.scss"; |
|||
</style> |
@ -0,0 +1,450 @@ |
|||
<template> |
|||
<div class="dialog-h-content scroll-h"> |
|||
<div class="div_table"> |
|||
<el-button size="small" |
|||
class="diy-button--add" |
|||
@click="handleAdd">新增</el-button> |
|||
|
|||
<el-table class="table" |
|||
:data="tableData" |
|||
border |
|||
:height="tableHeight" |
|||
v-loading="tableLoading" |
|||
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}" |
|||
style="width: 100%"> |
|||
<el-table-column label="序号" |
|||
header-align="center" |
|||
align="center" |
|||
type="index" |
|||
width="50"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="reviewTime" |
|||
header-align="center" |
|||
align="center" |
|||
label="复查时间" |
|||
width="250"> |
|||
<template slot-scope="scope"> |
|||
<div v-if="scope.row.isEdit"> |
|||
<el-date-picker v-model="scope.row.reviewTime" |
|||
value-format="yyyy-MM-dd" |
|||
type="date" |
|||
placeholder="选择日期"> |
|||
</el-date-picker> |
|||
</div> |
|||
<span v-else>{{scope.row.reviewTime}}</span> |
|||
</template> |
|||
|
|||
</el-table-column> |
|||
<el-table-column prop="ninePlaceName" |
|||
header-align="center" |
|||
align="center" |
|||
label="分队名称" |
|||
width="280"> |
|||
|
|||
<template slot-scope="scope"> |
|||
<div v-if="scope.row.isEdit"> |
|||
<el-select class="item_width_1" |
|||
v-model="scope.row.placePatrolTeamId" |
|||
placeholder="请选择" |
|||
clearable> |
|||
<el-option v-for="(item,index) in teamsList" |
|||
@click.native="hancleChangeTeam(scope.row,index,scope.$index)" |
|||
:key="item.teamId" |
|||
:label="item.teamName" |
|||
:value="item.teamId"> |
|||
</el-option> |
|||
</el-select> |
|||
</div> |
|||
<span v-else>{{scope.row.placePatrolTeamName}}</span> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="inspectorsNames" |
|||
header-align="center" |
|||
align="center" |
|||
label="检查人员" |
|||
min-width="380"> |
|||
|
|||
<template slot-scope="scope"> |
|||
<div v-if="scope.row.isEdit"> |
|||
<el-checkbox-group style="display:flex;flex-wrap:wrap" |
|||
v-model="scope.row.inspectorArray"> |
|||
<el-checkbox v-for="item in scope.row.inspectorsList" |
|||
:key="item.id" |
|||
:label="item.id">{{item.name}}</el-checkbox> |
|||
|
|||
</el-checkbox-group> |
|||
</div> |
|||
<span v-else>{{scope.row.inspectorsNames}}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="reviewResult" |
|||
header-align="center" |
|||
align="center" |
|||
label="复查结论" |
|||
width="120"> |
|||
<template slot-scope="scope"> |
|||
<div v-if="scope.row.isEdit"> |
|||
<el-select class="item_width_2" |
|||
v-model="scope.row.reviewResult" |
|||
placeholder="全部" |
|||
clearable> |
|||
<el-option v-for="item in resultList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</div> |
|||
<span v-else>{{scope.row.reviewResult==='0'?'合格':'不合格'}}</span> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column label="操作" |
|||
fixed="right" |
|||
width="180" |
|||
header-align="center" |
|||
align="center" |
|||
class="operate"> |
|||
<template slot-scope="scope"> |
|||
<el-button v-if="scope.row.isEdit" |
|||
type="text" |
|||
style="color:#00A7A9;text-decoration: underline;" |
|||
size="small" |
|||
@click="handleComfirm(scope.row,scope.$index)">保存</el-button> |
|||
<el-button v-if="!scope.row.isEdit" |
|||
type="text" |
|||
style="color:#1C6AFD;text-decoration: underline;" |
|||
size="small" |
|||
@click="handleEdit(scope.row,scope.$index)">修改</el-button> |
|||
|
|||
<el-button type="text" |
|||
style="color:#D51010;text-decoration: underline;" |
|||
size="small" |
|||
@click="handleDelete(scope.row,scope.$index)">删除</el-button> |
|||
|
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
</div> |
|||
<!-- <div class="div_btn"> |
|||
<el-button @click="handleCancle">取 消</el-button> |
|||
|
|||
</div> --> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import { requestPost } from '@/js/dai/request' |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
tableLoading: false, |
|||
placePatrolRecordId: '', |
|||
tableData: [], |
|||
|
|||
|
|||
} |
|||
}, |
|||
components: {}, |
|||
mounted () { |
|||
|
|||
}, |
|||
|
|||
methods: { |
|||
|
|||
async initTable (placePatrolRecordId) { |
|||
this.placePatrolRecordId = placePatrolRecordId |
|||
await this.loadTeams() |
|||
|
|||
await this.loadTable() |
|||
|
|||
}, |
|||
|
|||
|
|||
//加载分队 |
|||
async loadTeams () { |
|||
const url = '/gov/org/placepatrolteam/getlist' |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolteam/getlist' |
|||
let params = { |
|||
isPage: false |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.teamsList = data.list |
|||
|
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//点击分队切换人员 |
|||
async hancleChangeTeam (row, index, tableIndex) { |
|||
this.tableData[tableIndex].inspectorArray = [...[]] |
|||
let teamId = this.teamsList[index].teamId |
|||
await this.loadInspectors(teamId, tableIndex) |
|||
}, |
|||
|
|||
//加载分队下人员 |
|||
async loadInspectors (teamId, tableIndex) { |
|||
|
|||
const url = '/gov/org/placepatrolteamstaff/getlist' |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolteamstaff/getlist' |
|||
let params = { |
|||
teamId: teamId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
// let obj = this.tableData[tableIndex] |
|||
this.tableData[tableIndex].inspectorsList = [...data] |
|||
// this.tableData[tableIndex]= |
|||
// obj.inspectorsList = data |
|||
// this.$set(this.tableData, tableIndex, obj) |
|||
console.log(this.tableData) |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
//加载form |
|||
async loadTable () { |
|||
this.tableLoading = true |
|||
const url = '/gov/org/placepatrolreviewrecord/getlist' |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolreviewrecord/getlist' |
|||
let params = { |
|||
placePatrolRecordId: this.placePatrolRecordId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
this.tableLoading = false |
|||
if (code === 0) { |
|||
|
|||
if (data.list && data.list.length > 0) { |
|||
data.list.forEach(item => { |
|||
item.isEdit = false |
|||
item.isNew = false |
|||
let arrayInspectors = item.inspectors.split(',') |
|||
item.inspectorArray = [...arrayInspectors] |
|||
|
|||
let arrayReviewTime = item.reviewTime.split(' ') |
|||
item.reviewTime = arrayReviewTime[0] |
|||
}); |
|||
|
|||
this.tableData = [...data.list] |
|||
} else { |
|||
this.tableData = [] |
|||
} |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
handleAdd () { |
|||
let obj = { |
|||
isNew: true,//是否新增 |
|||
isEdit: true,//是否编辑 |
|||
placePatrolRecordId: this.placePatrolRecordId, |
|||
reviewTime: '', |
|||
placePatrolTeamId: '', |
|||
inspectors: '', |
|||
inspectorArray: [], |
|||
inspectorsList: [], |
|||
reviewResult: '', |
|||
} |
|||
this.tableData.push(obj) |
|||
}, |
|||
|
|||
async handleEdit (row, tableIndex) { |
|||
let teamId = row.placePatrolTeamId |
|||
await this.loadInspectors(teamId, tableIndex) |
|||
|
|||
let rowData = JSON.parse(JSON.stringify(row)) |
|||
rowData.isEdit = true |
|||
rowData.isNew = false |
|||
rowData.inspectorArray = rowData.inspectors.split(',') |
|||
|
|||
console.log(rowData) |
|||
this.$set(this.tableData, tableIndex, rowData) |
|||
}, |
|||
|
|||
async handleComfirm (row, tableIndex) { |
|||
let valiMsg = this.validata(row) |
|||
if (valiMsg) { |
|||
this.$message({ |
|||
type: 'warning', |
|||
message: valiMsg |
|||
}) |
|||
return false |
|||
} |
|||
|
|||
this.addReview(row, tableIndex) |
|||
|
|||
}, |
|||
async addReview (row, tableIndex) { |
|||
|
|||
let url = "/gov/org/placepatrolreviewrecord/add" |
|||
if (row.placePatrolReviewRecordId) { |
|||
url = "/gov/org/placepatrolreviewrecord/edit" |
|||
} |
|||
|
|||
let params = JSON.parse(JSON.stringify(row)) |
|||
params.inspectors = params.inspectorArray.join(',') |
|||
params.reviewTime = params.reviewTime + ' 00:00:00' |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
let array = data.reviewTime.split(' ') |
|||
data.reviewTime = array[0] |
|||
data.isEdit = false |
|||
data.isNew = false |
|||
|
|||
this.$set(this.tableData, tableIndex, data) |
|||
|
|||
} else { |
|||
|
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
validata (row) { |
|||
let message = '' |
|||
if (row.reviewTime === '') { |
|||
message = message + '复查时间不能为空;' |
|||
} |
|||
if (row.placePatrolTeamId === '') { |
|||
message = message + '分队名称不能为空;' |
|||
} |
|||
if (row.inspectorArray.length === 0) { |
|||
message = message + '检查人员不能为空;' |
|||
} |
|||
if (row.reviewResult === '') { |
|||
message = message + '复查结论不能为空;' |
|||
} |
|||
return message |
|||
}, |
|||
|
|||
async handleDelete (row, tableIndex) { |
|||
|
|||
this.$confirm("确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
if (row.placePatrolReviewRecordId) {//存在id,调用服务删除 |
|||
this.deleteRecord(row, tableIndex) |
|||
} else {//不存在id,直接删除数组数据 |
|||
this.tableData.splice(tableIndex, 1); |
|||
} |
|||
|
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
|
|||
} |
|||
|
|||
}); |
|||
}, |
|||
|
|||
async deleteRecord (row, tableIndex) { |
|||
|
|||
const url = "/gov/org/placepatrolreviewrecord/del" |
|||
|
|||
let params = { |
|||
placePatrolReviewRecordId: row.placePatrolReviewRecordId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
// this.$message({ |
|||
// type: "success", |
|||
// message: "删除成功" |
|||
// }); |
|||
|
|||
this.tableData.splice(tableIndex, 1); |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
handleCancle () { |
|||
this.$emit('dialogCancle') |
|||
|
|||
}, |
|||
|
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
|
|||
return (this.clientHeight - 360) |
|||
|
|||
}, |
|||
|
|||
...mapGetters(['clientHeight']) |
|||
|
|||
}, |
|||
props: { |
|||
|
|||
|
|||
resultList: { |
|||
type: Array, |
|||
default: [] |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
|
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/buttonstyle.scss"; |
|||
.item_width_1 { |
|||
width: 250px; |
|||
} |
|||
.item_width_2 { |
|||
width: 100px; |
|||
} |
|||
.div_table { |
|||
// background: #ffffff; |
|||
// box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.1); |
|||
// border-radius: 4px; |
|||
|
|||
.table { |
|||
margin-top: 20px; |
|||
} |
|||
} |
|||
.div_btn { |
|||
margin-top: 10px; |
|||
display: flex; |
|||
justify-content: flex-end; |
|||
} |
|||
</style> |
Loading…
Reference in new issue