视频监控
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

656 lines
19 KiB

<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="120px" size="small">
<el-form-item label="巡更任务名称" prop="patrolTaskName">
<el-input
v-model="queryParams.patrolTaskName"
clearable
placeholder="请输入巡更任务名称"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="任务状态" prop="taskState">
<el-select v-model="queryParams.taskState" placeholder="请选择">
<el-option
v-for="dict in dict.type.patrol_task_state"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-hasPermi="['patrol:patrolTask:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- v-hasPermi="['patrol:patrolTask:edit']"-->
<!-- :disabled="single"-->
<!-- icon="el-icon-edit"-->
<!-- plain-->
<!-- size="mini"-->
<!-- type="success"-->
<!-- @click="handleUpdate"-->
<!-- >修改-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- v-hasPermi="['patrol:patrolTask:remove']"-->
<!-- :disabled="multiple"-->
<!-- icon="el-icon-delete"-->
<!-- plain-->
<!-- size="mini"-->
<!-- type="danger"-->
<!-- @click="handleDelete"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- v-hasPermi="['patrol:patrolTask:export']"-->
<!-- icon="el-icon-download"-->
<!-- plain-->
<!-- size="mini"-->
<!-- type="warning"-->
<!-- @click="handleExport"-->
<!-- >导出-->
<!-- </el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="patrolTaskList" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<el-table-column align="center" label="巡更任务名称" prop="patrolTaskName"/>
<el-table-column align="center" label="排序编码" prop="sort"/>
<el-table-column align="center" label="巡更日期" prop="patrolCustomizeDate" width="180">
<template slot-scope="scope" v-if="scope.row.patrolType ==2">
<span>{{ parseTime(scope.row.patrolCustomizeDate, '{y}-{m}-{d}') }}</span>
</template>
<template slot-scope="scope" v-if="scope.row.patrolType ==1">
<span> 按排班日期</span>
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark"/>
<el-table-column align="center" label="任务状态 " prop="taskState">
<template slot-scope="scope">
<dict-tag :options="dict.type.patrol_task_state" :value="scope.row.taskState" />
</template>
</el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope">
<el-button
v-hasPermi="['patrol:patrolTask:edit']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>详情
</el-button>
<el-button
v-hasPermi="['patrol:patrolTask:edit']"
v-if="scope.row.taskState!=4"
size="mini"
type="text"
@click="startAndStop(scope.row)"
>{{scope.row.taskState == 1?'开始任务':scope.row.taskState == 3?'开始任务':'停止任务'}}
</el-button>
<el-button
v-hasPermi="['patrol:patrolTask:edit']"
v-if="scope.row.taskState==2"
size="mini"
type="text"
@click="assignPersonnel(scope.row)"
>分配人员
</el-button>
<el-button
v-hasPermi="['patrol:patrolTask:remove']"
v-if="scope.row.taskState==1 || scope.row.taskState == 3"
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<!-- 人员分配弹窗 -->
<transfer :group-type="8"
:group-id = 'groupId'
:noSelect="noSelect" :selected="selected"
:close.sync='open'
:visible="open" append-to-body
></transfer>
<!-- 添加或修改巡更任务对话框 -->
<el-dialog :close-on-click-modal="false" ref="contentDialog" :title="title" :visible.sync="opens" append-to-body class="m-form-box" width="80%"
@close="destroyMap">
<div class="m-box">
<div class="m-box-left">
<el-form ref="form" :disabled="disabled" :model="form" :rules="rules" label-width="120px">
<el-form-item label="巡更任务名称" prop="patrolTaskName">
<el-input v-model="form.patrolTaskName" placeholder="请输入巡更任务名称"/>
</el-form-item>
<el-form-item label="排序编码" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序编码"/>
</el-form-item>
<el-form-item label="巡更时间" prop="patrolType">
<el-radio-group v-model="form.patrolType">
<el-radio v-for="dict in dict.type.patrol_type" :key="dict.value" :label="dict.value" :value="dict.value">
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.patrolType == 2" label="巡更自定义时间" prop="patrolCustomizeDate">
<el-date-picker v-model="form.patrolCustomizeDate"
clearable
placeholder="请选择巡更自定义时间"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item v-if='form.taskMatter!=undefined&& form.taskMatter!=null && form.taskMatter.length>0'
label="任务事项" prop="taskMatter">
<div v-for="(item,index) in form.taskMatter">
<el-time-picker
v-model="item.startDate"
class="m-time-pick"
type="time"
value-format="HH:mm:ss">
placeholder="选择时间">
</el-time-picker>
<el-input v-model="item.patrolPointName" class="input-with-select"
placeholder="请输入内容">
<el-button v-if="!disabled" slot="append" @click="selectPoint(item,index)">选择点位</el-button>
</el-input>
<el-button v-if="!disabled" @click="deleteEvent(item,index)">删除</el-button>
</div>
</el-form-item>
<el-button v-if="!disabled" class="m-add-event" icon="el-icon-plus" @click="addEvent">添加任务事项
</el-button>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea"/>
</el-form-item>
</el-form>
</div>
<div v-if="!disabled " class="m-box-right">
<div ref="container" class="m-right-map"></div>
</div>
<div v-if="disabled" class="m-userList-box">
<el-form ref="form" :disabled="disabled" :model="form" :rules="rules" label-width="120px">
<div v-for="(item,index) in form.userList" class="m-userList">
<el-form-item label="人员部门">
<el-input v-model="item.deptName" placeholder="请输入内容" type="input"/>
</el-form-item>
<el-form-item label="巡更人员">
<el-input v-model="item.userName" placeholder="请输入内容" type="input"/>
</el-form-item>
</div>
</el-form>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listPatrolTask,
getPatrolTask,
delPatrolTask,
addPatrolTask,
updatePatrolTask,
getAllPortalPoint, startTask, stopTask, getTaskUndistributedGroupingUsers, getTaskDistributedGroupingUsers
} from "@/api/patrol/patrolTask";
import tickt from "@/views/system/management/ticket-data/ticket-check-flow/tickt";
import Transfer from "@/components/CommonComponents/PublicCoponents/transfer/Transfer";
import AMapLoader from "@amap/amap-jsapi-loader";
export default {
name: "PatrolTask",
mixins: [tickt],
dicts: ['check_in_way','patrol_task_state','patrol_type'],
components: {Transfer},
data() {
return {
//选中的
groupId:null,
//已分未分配
noSelect: [], selected: [],
//已选中点位
selectedMarker: null,
selectedMarkers:[],
change: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
//禁用表单
disabled: false,
// 巡更任务表格数据
patrolTaskList: [],
// 弹出层标题
title: "",
//巡察点位
markList: [],
// 是否显示弹出层
opens: false,
open: false,
//右侧地图
map: null,
//点
myMarker: null,
markers: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
patrolTaskName: null,
sort: null,
patrolType: null,
patrolCustomizeDate: null,
taskState: null,
organCode: null
},
// 表单参数
form: {},
// 表单校验
rules: {
patrolTaskName: [
{required: true, message: "巡更任务名称不能为空", trigger: "blur"}
],
sort: [
{required: true, message: "排序编码不能为空", trigger: "blur"}
],
patrolType: [
{required: true, message: "巡更类型不能为空", trigger: "change"}
],
taskState: [
{required: true, message: "任务状态 1:未开始2:执行中3:已停止4:已过期不能为空", trigger: "blur"}
],
delFlag: [
{required: true, message: "数据状态 新增:0 修改:1删除:2不能为空", trigger: "blur"}
],
organCode: [
{required: true, message: "机构id不能为空", trigger: "blur"}
],
taskMatter: [
{required: true, message: '任务事项不能为空', trigger: 'change'}
]
}
};
},
watch: {
'opens': {
deep: true,
immediate: true,
handler(val) {
if (val == false) {
this.change = false
} else {
this.change = true
}
}
}
},
created() {
this.getList();
},
methods: {
/** 查询巡更任务列表 */
getList() {
this.loading = true;
listPatrolTask(this.queryParams).then(response => {
this.patrolTaskList = response.rows;
this.total = response.total;
this.loading = false;
});
this.getAllPortalPoint()
},
// 取消按钮
cancel() {
this.opens = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
patrolTaskName: null,
sort: null,
patrolType: null,
patrolCustomizeDate: null,
remark: null,
taskState: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
organCode: null,
taskMatter: []
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.opens = true;
this.creatMap()
this.title = "添加巡更任务";
this.disabled = false
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getPatrolTask(id).then(response => {
this.form = response.data;
this.disabled = true
this.opens = true;
this.title = "查看巡更任务";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
if (this.form.taskMatter != undefined && this.form.taskMatter != null && this.form.taskMatter.length > 0) {
updatePatrolTask(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.opens = false;
this.getList();
});
} else {
this.$message.error('任务事项不能为空')
return
}
} else {
if (this.form.taskMatter != undefined && this.form.taskMatter != null && this.form.taskMatter.length > 0) {
addPatrolTask(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.opens = false;
this.getList();
});
} else {
this.$message.error('任务事项不能为空')
return
}
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除巡更任务编号为"' + ids + '"的数据项?').then(function () {
return delPatrolTask(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('patrol/patrolTask/export', {
...this.queryParams
}, `patrolTask_${new Date().getTime()}.xlsx`)
},
//开始停止任务
startAndStop(val){
if (val.taskState !=4){
if (val.taskState == 1 || val.taskState == 3){
let params = {
id:val.id
}
startTask(params).then(response=>{
this.$message.success('已开始')
this.getList()
})
}else if (val.taskState == 2){
let params = {
id:val.id
}
stopTask(params).then(response=>{
this.$message.success('已停止')
this.getList()
})
}
}
},
//分配人员
assignPersonnel(val){
this.groupId = val.id
this.open = true
let params ={
patrolTaskId : val.id
}
getTaskUndistributedGroupingUsers(params).then(val=>{
this.noSelect = val.data
}),
getTaskDistributedGroupingUsers(params).then(val=>{
this.selected = val.data
})
},
creatMap() {
this.$nextTick(() => {
if (this.$refs.container) {
this.initAMap()
setTimeout(() => {
this.markList.forEach(item => {
this.setMarker(item)
})
}, 500)
}
})
},
//所有巡察点位
getAllPortalPoint() {
getAllPortalPoint().then(value => {
this.markList = value.rows.map(item => ({
lang: item.longitude,
lat: item.dimension,
patrolPointName: item.patrolPointName,
id: item.id
}))
})
},
initAMap(lng, lat) {
const map = new window.AMap.Map(this.$refs.container, {
plugins: ['AMap.AutoComplete'],
zoom: 13
})
this.map = map
},
setMarker(val) {
this.myMarker = new window.AMap.Marker({
icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
position: [val.lang, val.lat],
offset: new AMap.Pixel(-16, -60),
})
this.myMarker.setExtData(val)
this.map.add(this.myMarker)
this.myMarker.on('click',(e)=>{
console.log(e)
})
this.markers.push(this.myMarker)
this.map.setFitView()
},
destroyMap() {
// if (this.map !== null) {
// this.map.destroy()
// }
},
addEvent() {
this.form.taskMatter.push({
patrolDate: '',
patrolPointId: ''
})
},
deleteEvent(val, num) {
this.form.taskMatter.splice(num, 1)
},
selectPoint(val, index) {
console.log(val, index, this.form.taskMatter, 'jjj')
this.markers.forEach(marker => {
marker.on('click', () => {
if (this.selectedMarker) {
this.selectedMarker.setIcon(
"//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png"
);
}
this.selectedMarker = marker
marker.setIcon('//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-red.png')
});
});
if (this.selectedMarker!==null){
this.setData(this.selectedMarker, val, index)
}else {
this.$message.warning('选择右侧点位')
}
},
setData(point, val, index) {
console.log(point, val, index)
let obj ={
id:point.getExtData().id,
patrolPointName:point.getExtData().patrolPointName
}
this.$nextTick(()=>{
this.form.taskMatter[index] = obj
})
},
},
mounted() {
}
};
</script>
<style lang="scss" scoped>
.m-mark-point {
height: 500vh;
}
.m-form-box {
.m-box {
display: flex;
}
.m-box-left {
width: 50%;
padding: 0 10px 0 0;
}
.m-box-right {
width: 50%;
#container {
position: relative;
top: 0;
width: 100%;
height: 100%;
}
}
.m-add-event {
width: 82%;
margin-left: 18%;
margin-bottom: 1vh;
}
.m-time-pick {
width: 100%;
margin-bottom: 1vh;
}
.input-with-select {
width: 75%;
margin-right: 1%;
margin-bottom: 1vh;
}
}
.m-userList-box {
width: 50%;
}
.m-right-map{
width: 100%;
height: 100%;
}
</style>