From 63ad2c3598400370dd7da5534659fd7e768a0a4a Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Mon, 16 May 2022 17:29:46 +0800
Subject: [PATCH] 地址替换
---
src/views/feedbackReport/feedbackReport.vue | 562 ++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 384 insertions(+), 178 deletions(-)
diff --git a/src/views/feedbackReport/feedbackReport.vue b/src/views/feedbackReport/feedbackReport.vue
index c335387..e292e21 100644
--- a/src/views/feedbackReport/feedbackReport.vue
+++ b/src/views/feedbackReport/feedbackReport.vue
@@ -1,41 +1,66 @@
<template>
<basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ >
<template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.feedback_delete"
- @click="handleDelete">删 除
+ <el-button
+
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.feedback_delete"
+ @click="handleDelete"
+ >删 除
</el-button>
</template>
+
+ <template slot-scope="{type,size, row}" slot="menu">
+ <el-button
+ v-if="row.type != 1"
+ icon="el-icon-check" :size="size" :type="type" @click="setReal(row)">接收</el-button>
+ </template>
+
+ <template slot-scope="{ row }" slot="type">
+ <el-tag
+ >{{
+ row.type == 1 ?"已接受":"未接受"
+ }}
+ </el-tag>
+ </template>
+
</avue-crud>
</basic-container>
-
</template>
<script>
- import {getListReport, getDetails, adds, updates, remove} from "@/api/feedback/feedback";
- import {getBaTree} from "@/api/client/client";
+ import {
+ getListReport,
+ getDetails,
+ adds,
+ updates,
+ remove,
+ } from "@/api/feedback/feedback";
+ import {getBaTree} from "@/api/client/client";
import {mapGetters} from "vuex";
+ import AvueMap from "avue-plugin-map";
export default {
data() {
@@ -46,31 +71,36 @@
page: {
pageSize: 10,
currentPage: 1,
- total: 0
+ total: 0,
},
selectionList: [],
option: {
- height:'auto',
+ height: "auto",
calcHeight: 54,
+ menuWidth: 330,
tip: false,
searchShow: true,
searchMenuSpan: 6,
- labelWidth: '125',
+ labelWidth: "125",
dialogWidth: 1150,
border: false,
- stripe:true,
+ //stripe:true,
index: true,
viewBtn: true,
selection: true,
dialogClickModal: false,
- images:[],
- videos:[],
+ images: [],
+ videos: [],
column: [
{
label: "上报人姓名",
prop: "sname",
- addDisplay:false,
- editDisplay:false
+ search: true,
+ searchLabelWidth: 100,
+ searchSpan: 5,
+ width: 100,
+ addDisplay: false,
+ editDisplay: false,
},
{
label: "上报人姓名",
@@ -78,99 +108,219 @@
type: "tree",
dicUrl: "/api/catalogs/catalogs/getBigTree",
props: {
- label: "title"
+ label: "title",
},
- width: 72,
hide: true,
addDisplay: true,
editDisplay: true,
viewDisplay: false,
- rules: [{
- required: true,
- message: "请选择上报人",
- trigger: "blur"
- }],
- },
- {
- label: "上报地址",
- prop: "place",
- rules: [{
- required: true,
- message: "请输入事发地址",
- trigger: "blur"
- }]
- },
- {
- label: "备注",
- prop: "result",
- rules: [{
- required: true,
- message: "请输入处理结果",
- trigger: "blur"
- }]
+ rules: [
+ {
+ required: true,
+ message: "请选择上报人",
+ trigger: "blur",
+ },
+ ],
},
{
label: "上报时间",
prop: "stime",
+ width: 150,
+ type: "datetime",
+ format: "yyyy-MM-dd HH:mm:ss",
+ valueFormat: "yyyy-MM-dd HH:mm:ss",
+ },
+ {
+ label: "上报时间",
+ prop: "dateTime",
type: "datetime",
format: "yyyy-MM-dd HH:mm:ss",
valueFormat: "yyyy-MM-dd HH:mm:ss",
searchRange: true,
- search:true,
- searchLabelWidth:100,
+ search: true,
+ searchLabelWidth: 100,
searchSpan: 6,
- rules: [{
- required: true,
- message: "请输入上报时间",
- trigger: "blur"
- }]
+ addDisplay: false,
+ viewDisplay: false,
+ editDisplay: false,
+ hide: true,
+ rules: [
+ {
+ required: true,
+ message: "请选择上报时间",
+ trigger: "blur",
+ },
+ ],
},
{
- label: '图片',
- prop: 'images',
- dataType: 'array',
- type: 'upload',
+ label: "地址",
+ prop: "place",
+ span: 10,
+ rules: [
+ {
+ required: true,
+ message: "请选择地址",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: null,
+ prop: "map",
+ labelWidth: "0",
+ searchSpan: 0,
+ maxlength: 0,
+ hide: true,
+ span: 2,
+ // display:false,
+ component: "AvueMap",
+ },
+ {
+ label: "经度",
+ hide: true,
+ prop: "jd",
+ searchSpan: 2,
+ width: "100",
+ labelWidth: "120",
+ formatter: (row, value, label, column) => {
+ return (value = value.substring(0, 11));
+ },
+ span: 7,
+ },
+ {
+ label: "纬度",
+ labelWidth: "45",
+ hide: true,
+ prop: "wd",
+ formatter: (row, value, label, column) => {
+ return (value = value.substring(0, 10));
+ },
+ span: 5,
+ },
+ {
+ label: "备注",
+ prop: "result",
span: 24,
- hide:true,
- viewDisplay:true,
- listType: 'picture-card',
+ rules: [
+ {
+ required: true,
+ message: "请输入处理结果",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "接收状态",
+ prop: "type",
+ width: 80,
+ slot: true,
+ addDisplay: false,
+ viewDisplay: false,
+ editDisplay: false,
+ },
+ {
+ label: "图片",
+ prop: "images",
+ dataType: "array",
+ type: "upload",
+ span: 24,
+ hide: true,
+ viewDisplay: true,
+ listType: "picture-card",
action: "/api/blade-resource/oss/endpoint/put-file",
propsHttp: {
res: "data",
url: "link",
- }
+ },
},
{
- label: '视频',
- prop: 'videos',
- type: 'upload',
- accept:"video/mp4",
- hide:true,
- viewDisplay:true,
- listType: 'picture-img',
+ label: "视频",
+ prop: "videos",
+ dataType: "array",
+ type: "upload",
+ accept: "video/mp4",
+ hide: true,
+ viewDisplay: true,
+ editDisabled: true,
+ listType: "picture",
span: 24,
- action: "/api/blade-resource/oss/endpoint/put-file",
+ action: "http://web.byisf.com:82/blade-jfpts/depl/put-depl",
propsHttp: {
res: "data",
url: "link",
- }
+ },
},
- ]
+ ],
},
- data: []
+ data: [],
};
},
- watch:{
- handler(val) {
+ watch: {
+ "form.map": {
+ // form是表单或者表格绑定的数据集,v-model='form'
+ handler(val) {
var that = this;
- if (val != null && val !=""){
- getBaTree(val).then(res => {
- if (res) {
- that.form.sname = res.data.data.records[0].name;
- }
- });
+ if (val) {
+ //重新加载一次页面详情数据,解决新的省市区无法写入问题
+ //判断是新增还是修改
+ if (that.isEdit) {
+ getclient(this.form.id).then((res) => {
+ // that.province = res.data.data.province;
+ // that.city = res.data.data.city;
+ // that.district = res.data.data.district;
+ });
+ }
+
+ //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
+ if (val.formattedAddress == "") {
+ return;
+ }
+
+ //经纬度替换
+ this.form.wd = val.latitude;
+ this.form.jd = val.longitude;
+
+ var address = val.formattedAddress.toString();
+ if (address.search("县") != -1) {
+ this.form.place = address.substring(
+ address.indexOf("县") + 1,
+ address.length
+ );
+ }
+ if (address.search("区") != -1) {
+ this.form.place = address.substring(
+ address.indexOf("区") + 1,
+ address.length
+ );
+ }
+ //写入新的省市区
+ that.form.province = val.addressComponent.province;
+ if (val.addressComponent.city == "") {
+ that.form.city = val.addressComponent.province;
+ } else {
+ that.form.city = val.addressComponent.city;
+ }
+ that.form.district = val.addressComponent.district;
+ } else {
+ that.form.map = {
+ formattedAddress: "",
+ latitude: 28.699957,
+ longitude: 115.862118,
+ };
}
},
+ immediate: true,
+ },
+ handler(val) {
+ var that = this;
+ if (val != null && val != "") {
+ getBaTree(val).then((res) => {
+ if (res) {
+ that.form.sname = res.data.data.records[0].name;
+ }
+ });
+ }
+ },
},
computed: {
...mapGetters(["permission"]),
@@ -179,100 +329,109 @@
addBtn: this.vaildData(this.permission.feedback_add, true),
viewBtn: this.vaildData(this.permission.feedback_view, true),
delBtn: this.vaildData(this.permission.feedback_delete, true),
- editBtn: this.vaildData(this.permission.feedback_edit, true)
+ editBtn: this.vaildData(this.permission.feedback_edit, true),
};
},
ids() {
let ids = [];
- this.selectionList.forEach(ele => {
+ this.selectionList.forEach((ele) => {
ids.push(ele.id);
});
return ids.join(",");
- }
+ },
},
methods: {
rowSave(row, done, loading) {
var data = {
- status:1,
- tpaddress:"",
- spaddress:"",
- sname: row.$snumber,
- snumber: row.snumber,
- stime:row.stime,
- result:row.result,
- place:row.place
- }
+ status: 1,
+ tpaddress: "",
+ spaddress: "",
+ sname: row.$snumber,
+ snumber: row.snumber,
+ stime: row.stime,
+ result: row.result,
+ place: row.place,
+ jd: row.jd,
+ wd: row.wd,
+ };
if (row.images.length > 0) {
- var imageArr = row.images;
- imageArr.forEach( image =>{
- data.tpaddress += image + ",";
- })
- data.tpaddress = data.tpaddress.substring(0,data.tpaddress.length-1);
- }
- if (row.videos.length > 0) {
- //var videoArr = row.videos;
- //videoArr.forEach( video =>{
- //data.spaddress += video + ",";
- //})
- //data.spaddress = data.spaddress.substring(0,data.spaddress.length-1);
- data.spaddress = row.videos;
- }
- adds(data).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
+ var imageArr = row.images;
+ imageArr.forEach((image) => {
+ data.tpaddress += image + ",";
});
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
+ data.tpaddress = data.tpaddress.substring(0, data.tpaddress.length - 1);
+ }
+ if (row.videos.length > 0) {
+ //var videoArr = row.videos;
+ //videoArr.forEach( video =>{
+ //data.spaddress += video + ",";
+ //})
+ //data.spaddress = data.spaddress.substring(0,data.spaddress.length-1);
+ data.spaddress = row.videos;
+ }
+ adds(data).then(
+ () => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ loading();
+ window.console.log(error);
+ }
+ );
},
rowUpdate(row, index, done, loading) {
var data = {
- id:row.id,
- status:1,
- tpaddress:"",
- spaddress:"",
- sname: row.$snumber,
- snumber: row.snumber,
- stime:row.stime,
- result:row.result,
- place:row.place
- }
+ id: row.id,
+ status: 1,
+ tpaddress: "",
+ spaddress: "",
+ sname: row.$snumber,
+ snumber: row.snumber,
+ stime: row.stime,
+ result: row.result,
+ place: row.place,
+ jd: row.jd,
+ wd: row.wd,
+ };
if (row.images.length > 0) {
- var imageArr = row.images;
- imageArr.forEach( image =>{
- data.tpaddress += image + ",";
- })
- data.tpaddress = data.tpaddress.substring(0,data.tpaddress.length-1);
- }
- if (row.videos.length > 0) {
- //var videoArr = row.videos;
- //videoArr.forEach( video =>{
- //data.spaddress += video + ",";
- //})
- //data.spaddress = data.spaddress.substring(0,data.spaddress.length-1);
- data.spaddress = row.videos;
- }
- updates(data).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
+ var imageArr = row.images;
+ imageArr.forEach((image) => {
+ data.tpaddress += image + ",";
});
- done();
- }, error => {
- loading();
- console.log(error);
- });
+ data.tpaddress = data.tpaddress.substring(0, data.tpaddress.length - 1);
+ }
+ if (row.videos.length > 0) {
+ //var videoArr = row.videos;
+ //videoArr.forEach( video =>{
+ //data.spaddress += video + ",";
+ //})
+ //data.spaddress = data.spaddress.substring(0,data.spaddress.length-1);
+ data.spaddress = row.videos;
+ }
+ updates(data).then(
+ () => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ loading();
+ console.log(error);
+ }
+ );
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
+ cancelButtonText: "取消", type: "warning",
})
.then(() => {
return remove(row.id);
@@ -281,7 +440,7 @@
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
});
},
@@ -293,7 +452,7 @@
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
return remove(this.ids);
@@ -302,14 +461,14 @@
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
this.$refs.crud.toggleSelection();
});
},
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
- getDetails(this.form.id).then(res => {
+ getDetails(this.form.id).then((res) => {
this.form = res.data.data;
this.images = res.data.data.images;
this.videos = res.data.data.videos;
@@ -320,6 +479,53 @@
searchReset() {
this.query = {};
this.onLoad(this.page);
+ },
+ //派遣任务
+ setReal(row) {
+ var arr = [];
+ var data = {
+ id: row.id,
+ status: 1,
+ tpaddress: "",
+ spaddress: "",
+ sname: row.$snumber,
+ snumber: row.snumber,
+ stime: row.stime,
+ result: row.result,
+ place: row.place,
+ jd: row.jd,
+ wd: row.wd,
+ type: 1,
+ };
+ updates(data).then(
+ () => {
+ this.onLoad(this.page);
+ // this.$message({
+ // type: "success",
+ // message: "操作成功!",
+ // });
+ done();
+ },
+ (error) => {
+ }
+ );
+
+ this.$store.state.tags.tagList.forEach((item) => {
+ if (item.label != "任务下发") {
+ arr.push(item);
+ }
+ });
+ this.$store.state.tags.tagList = arr;
+
+ row.bz = row.result;
+ row.sjsb = 1;
+
+ window.sessionStorage.setItem('sjsb', 1)
+
+ this.$router.push({
+ path: `/realTimePolice/index`,
+ query: row
+ });
},
searchChange(params, done) {
this.query = params;
@@ -334,21 +540,21 @@
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
- currentChange(currentPage){
+ currentChange(currentPage) {
this.page.currentPage = currentPage;
},
- sizeChange(pageSize){
+ sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
- onLoad(page, params = {status:1}) {
- const { dateTime } = this.query;
+ onLoad(page, params = {status: 1}) {
+ const {dateTime} = this.query;
let values = {
...params,
+ status: 1,
};
-
if (dateTime) {
values = {
...params,
@@ -359,15 +565,15 @@
values.dateTime = null;
}
this.loading = true;
- getListReport(page.currentPage, page.pageSize,values).then(res => {
+ getListReport(page.currentPage, page.pageSize, values).then((res) => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
- }
- }
+ },
+ },
};
</script>
--
Gitblit v1.9.3