巡查养护点击查看

master
lion 3 years ago
parent 87c8c27873
commit 1ad4851181

@ -16,10 +16,10 @@
<el-select class="vm10" filterable v-model="searchFields.area_id" placeholder="请选择所属片区">
<el-option v-for="item in selects.areasList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.maintain_id" placeholder="请选择所属养护单位">
<el-option v-for="item in selects.maintainList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.maintain_id" placeholder="请选择所属养护单位">
<el-option v-for="item in selects.maintainList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.status" placeholder="请选择状态">
<el-option v-for="item in selects.statusList" :key="item.id" :label="item.name" :value="item.id">
@ -49,35 +49,39 @@
<Button type="primary" @click="load(false)" style="margin-left: 10px">查询</Button>
<Button type="primary" @click="edit()" style="margin-left: 10px">新增</Button>
<Button type="primary" @click="review()" style="margin-left: 10px">批量复核</Button>
<Button type="primary" @click="exportExcel()" style="margin-left: 10px">导出</Button>
<Button type="primary" @click="exportExcel()" style="margin-left: 10px">导出</Button>
<Button type="primary" @click="showMap()" style="margin-left: 10px">当月点位</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable">
<el-table :data="tableData" @selection-change="handleSelectionChange" class="v-table" :height="tableHeight"
style="width: 100%">
<el-table :data="tableData" @row-click="clickShowInfo" @selection-change="handleSelectionChange" class="v-table"
:height="tableHeight" style="width: 100%">
<el-table-column type="selection" fixed width="55"></el-table-column>
<el-table-column type="index" width="50" fixed label="序号" align="center"> </el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width" :fixed="column.fixed">
<template slot-scope="scope">
<div v-if="column.type=='opt'">
<Button ghost size="small" @click="showInfo(scope.row,'showform')" type="primary"
style="margin-left: 10px;"
v-if="scope.row['status']==2||scope.row['status']==3||scope.row['end_type']==2">查看</Button>
<Button v-if="scope.row['status']==0" ghost size="small" @click="edit(scope.row)" type="primary"
style="margin-left: 10px;">编辑</Button>
<Button v-if="scope.row['status']==0" ghost size="small" @click="showInfo(scope.row,'auditform')"
type="primary" style="margin-left: 10px;">审核</Button>
<Button v-if="scope.row['status']==1&&scope.row['end_type']!=2" ghost size="small"
@click="showInfo(scope.row,'endform')" type="primary" style="margin-left: 10px;">办结</Button>
<Button ghost size="small"
v-if="scope.row['status']==0||scope.row['status']==1&&scope.row['end_type']!=2"
@click="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
<Button ghost size="small" @click.native.stop="showInfo(scope.row,'showform')" type="primary"
style="margin-left: 10px;">查看</Button>
<el-popover placement="bottom-start" width="200" trigger="hover"
v-if="scope.row['status']!=2&&scope.row['status']!=3&&scope.row['end_type']!=2">
<Button v-if="scope.row['status']==0" ghost size="small" @click.native.stop="edit(scope.row)"
type="primary" style="margin-left: 10px;">编辑</Button>
<Button v-if="scope.row['status']==0" ghost size="small"
@click.native.stop="showInfo(scope.row,'auditform')" type="primary"
style="margin-left: 10px;">审核</Button>
<Button v-if="scope.row['status']==1&&scope.row['end_type']!=2" ghost size="small"
@click.native.stop="showInfo(scope.row,'endform')" type="primary"
style="margin-left: 10px;">办结</Button>
<Button ghost size="small"
v-if="scope.row['status']==0||scope.row['status']==1&&scope.row['end_type']!=2"
@click.native.stop="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
<Button slot="reference" ghost size="small" type="primary" style="margin-left: 10px;">更多</Button>
</el-popover>
</div>
<div v-else-if="column.type=='type'">
<el-tag v-if="scope.row[column.field]==1"></el-tag>
@ -105,9 +109,9 @@
</div>
<div v-else-if="column.type=='admin'">
{{getUserName(scope.row)}}
</div>
<div v-else-if="column.type=='maintain'">
{{getMaintinName(scope.row)}}
</div>
<div v-else-if="column.type=='maintain'">
{{getMaintinName(scope.row)}}
</div>
<div v-else>{{scope.row[column.field]}}</div>
</template>
@ -118,8 +122,8 @@
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
<!-- 地图 -->
</div>
<!-- 地图 -->
<maps ref="maps" @loadMap="loadMap"></maps>
<!-- 初始选择 -->
<el-dialog title="雨管养护类型选择" :visible.sync="rainTypeVisible" width="60%">
@ -186,19 +190,20 @@
} from '../../../api/rain/inspection.js'
import {
getToken
} from '@/utils/auth'
import {
getCurrentMonthFirst,getCurrentMonthLast
} from '@/utils/index'
} from '@/utils/auth'
import {
getCurrentMonthFirst,
getCurrentMonthLast
} from '@/utils/index'
import {
getparameteritem
} from '../../../api/system/dictionary.js'
import {
listarea
} from '../../../api/basic/area.js'
import {
listmaintain
} from '../../../api/basic/area.js'
import {
listmaintain
} from '../../../api/basic/unit.js'
import {
listroad
@ -207,7 +212,7 @@
import showRainEquipmentInfo from '@/views/rain/inspection/components/showRainEquipmentInfo'
import showRainSiteInfo from '@/views/rain/inspection/components/showRainSiteInfo'
import editEquipment from '@/views/rain/inspection/components/editEquipment'
import editSite from '@/views/rain/inspection/components/editSite'
import editSite from '@/views/rain/inspection/components/editSite'
import maps from '@/views/rain/inspection/components/maps'
export default {
components: {
@ -215,31 +220,31 @@
showRainEquipmentInfo,
showRainSiteInfo,
editEquipment,
editSite,
editSite,
maps
},
data() {
return {
tableHeight: 0,
formLabelWidth: "120px",
tableHeight: 0,
formLabelWidth: "120px",
baseurl: "",
rainTypeVisible: false,
rainType: 1,
mapArr :[],
tableData: [],
paginations: {
page: 1,
page_size: 15,
total: 0
mapArr: [],
tableData: [],
paginations: {
page: 1,
page_size: 15,
total: 0
},
searchFields: {
is_export: 0,
is_auth:1
},
datesearch: "",
roadsList: [],
roaddisabled: false,
is_export: 0,
is_auth: 1
},
datesearch: "",
roadsList: [],
roaddisabled: false,
roadloading: false,
selects: {
sunusualList: [{
@ -289,26 +294,26 @@
sequiementList: [{
id: "",
value: "所有"
}],
maintainList: [{
id:"",
name:"所有"
}],
maintainList: [{
id: "",
name: "所有"
}]
},
reviewFormVisible: false,
reviewList: [],
reviewForm: {
ids: [],
audit_status: 0,
audit_reamrk: ""
},
reviewStatusList: [{
id: 0,
value: "待复核"
}, {
id: 1,
value: "已复核"
reviewFormVisible: false,
reviewList: [],
reviewForm: {
ids: [],
audit_status: 0,
audit_reamrk: ""
},
reviewStatusList: [{
id: 0,
value: "待复核"
}, {
id: 1,
value: "已复核"
}],
rules: {
@ -328,13 +333,13 @@
type: "format",
align: "center",
width: 180
},
{
field: "maintain",
title: "所属养护单位",
type: "maintain",
align: "center",
width: 180
},
{
field: "maintain",
title: "所属养护单位",
type: "maintain",
align: "center",
width: 180
},
{
field: "askName",
@ -389,7 +394,7 @@
{
field: "操作",
title: "操作",
width: 220,
width: 180,
type: "opt",
fixed: "right"
}
@ -414,207 +419,212 @@
}
},
methods: {
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 60;
that.tableHeight = tableHeight;
that.baseurl = location.host;
getparameteritem('equiementList').then(res => {
for (var m of res.detail) {
that.selects.sequiementList.push(m)
}
})
getparameteritem('unusualList').then(res => {
for (var m of res.detail) {
that.selects.sunusualList.push(m)
}
})
listarea({
page: 1,
page_size: 999
}).then(res => {
for (var m of res.data) {
that.selects.areasList.push({
id: m.id,
name: m.name
})
}
})
listmaintain({
page: 1,
page_size: 999,
}).then(response => {
for(var m of response.data){
this.selects.maintainList.push(m)
}
}).catch(error => {
console.log(error)
reject(error)
});
},
load(is_export) {
// return
this.mapArr = []
listall({
page: this.paginations.page,
page_size: this.paginations.page_size,
...this.searchFields
}).then(response => {
let tokens = getToken();
if (is_export) {
var url = "/api/admin/rain-maintains/index?token=" + tokens
for (var m in this.searchFields) {
url += "&" + m + "=" + this.searchFields[m]
}
url = this.baseurl + url
console.log(url)
window.open("http://" + url, '_blank')
this.searchFields.is_export = 0
return;
}
for (var m of response.data) {
if (m.rain_equipment_info) {
m.askName = m.rain_equipment_info.ask_content_detail ? m.rain_equipment_info.ask_content_detail :
""
}
}
this.tableData = response.data;
this.paginations.total = response.total;
}).catch(error => {
console.log(error)
reject(error)
});
},
showMap(){
this.loadMap(this.searchFields)
this.$nextTick(function(){
this.$refs.maps.pointArr = this.mapArr
this.$refs.maps.isShow = true
// this.$refs.maps.showMaps()
this.$refs.maps.selects = this.selects
})
},
//
loadMap(search) {
// return
this.mapArr = []
listall({
page: 1,
page_size: 9999999,
start_date:getCurrentMonthFirst(),
end_date:getCurrentMonthLast(),
...search
}).then(response => {
for (var m of response.data) {
if (m.rain_equipment_info) {
this.mapArr.push([
m.rain_equipment_info.longitude,m.rain_equipment_info.latitude,m.rain_equipment_info.address,m.id,m.type
])
}
if (m.building_site_info) {
this.mapArr.push([
m.building_site_info.building_site.longitude,m.building_site_info.building_site.latitude,m.building_site_info.building_site.address,m.id,m.type
])
}
}
this.$refs.maps.showSearch = false
this.$refs.maps.pointArr = this.mapArr
this.$refs.maps.resetPointArr()
}).catch(error => {
console.log(error)
reject(error)
});
},
handleCurrentChange(page) {
this.paginations.page = page;
this.load();
},
//
edit(obj) {
var that = this;
if (obj) {
if (obj.type == 1) {
this.$refs.editEquipment.infoId = obj.id
this.$refs.editEquipment.getEquipmentInfo(obj.id)
this.$refs.editEquipment.isShow = true
}
if (obj.type == 2) {
this.$refs.editSite.infoId = obj.id
this.$refs.editSite.getSiteInfo(obj.id)
this.$refs.editSite.isShow = true
}
} else {
this.rainTypeVisible = true
}
},
submitRainType() {
var that = this
this.rainTypeVisible = false
if (that.rainType == 1) {
this.$refs.editEquipment.infoId = ""
this.$refs.editEquipment.getEquipmentInfo()
this.$refs.editEquipment.isShow = true
} else if (that.rainType == 2) {
this.$refs.editSite.infoId = ""
this.$refs.editSite.getSiteInfo()
this.$refs.editSite.isShow = true
}
},
resetrainType() {
this.rainTypeVisible = false
this.rainType = 1
},
//
showInfo(obj, formtype) {
//
if (obj.type == 1) {
this.$refs.showRainEquipmentInfo.isShow = true
this.$refs.showRainEquipmentInfo.getEquipmentInfo(obj.id)
this.$refs.showRainEquipmentInfo.infoId = obj.id
this.$refs.showRainEquipmentInfo.formType = formtype
}
//
if (obj.type == 2) {
this.$refs.showRainSiteInfo.isShow = true
this.$refs.showRainSiteInfo.getSiteInfo(obj.id)
this.$refs.showRainSiteInfo.infoId = obj.id
this.$refs.showRainSiteInfo.formType = formtype
}
},
del(obj) {
var that = this;
if (obj) {
this.$Modal.confirm({
title: '确认要删除数据?',
onOk: () => {
del(obj.id).then(response => {
this.$Message.success('操作成功');
that.load();
}).catch(error => {
console.log(error)
reject(error)
})
},
onCancel: () => {
//this.$Message.info('Clicked cancel');
}
});
}
},
methods: {
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 60;
that.tableHeight = tableHeight;
that.baseurl = location.host;
getparameteritem('equiementList').then(res => {
for (var m of res.detail) {
that.selects.sequiementList.push(m)
}
})
getparameteritem('unusualList').then(res => {
for (var m of res.detail) {
that.selects.sunusualList.push(m)
}
})
listarea({
page: 1,
page_size: 999
}).then(res => {
for (var m of res.data) {
that.selects.areasList.push({
id: m.id,
name: m.name
})
}
})
listmaintain({
page: 1,
page_size: 999,
}).then(response => {
for (var m of response.data) {
this.selects.maintainList.push(m)
}
}).catch(error => {
console.log(error)
reject(error)
});
},
load(is_export) {
// return
this.mapArr = []
listall({
page: this.paginations.page,
page_size: this.paginations.page_size,
...this.searchFields
}).then(response => {
let tokens = getToken();
if (is_export) {
var url = "/api/admin/rain-maintains/index?token=" + tokens
for (var m in this.searchFields) {
url += "&" + m + "=" + this.searchFields[m]
}
url = this.baseurl + url
console.log(url)
window.open("http://" + url, '_blank')
this.searchFields.is_export = 0
return;
}
for (var m of response.data) {
if (m.rain_equipment_info) {
m.askName = m.rain_equipment_info.ask_content_detail ? m.rain_equipment_info.ask_content_detail :
""
}
}
this.tableData = response.data;
this.paginations.total = response.total;
}).catch(error => {
console.log(error)
reject(error)
});
},
showMap() {
this.loadMap(this.searchFields)
this.$nextTick(function() {
this.$refs.maps.pointArr = this.mapArr
this.$refs.maps.isShow = true
// this.$refs.maps.showMaps()
this.$refs.maps.selects = this.selects
})
},
//
loadMap(search) {
// return
this.mapArr = []
listall({
page: 1,
page_size: 9999999,
start_date: getCurrentMonthFirst(),
end_date: getCurrentMonthLast(),
...search
}).then(response => {
for (var m of response.data) {
if (m.rain_equipment_info) {
this.mapArr.push([
m.rain_equipment_info.longitude, m.rain_equipment_info.latitude, m.rain_equipment_info.address,
m.id, m.type
])
}
if (m.building_site_info) {
this.mapArr.push([
m.building_site_info.building_site.longitude, m.building_site_info.building_site.latitude, m
.building_site_info.building_site.address, m.id, m.type
])
}
}
this.$refs.maps.showSearch = false
this.$refs.maps.pointArr = this.mapArr
this.$refs.maps.resetPointArr()
}).catch(error => {
console.log(error)
reject(error)
});
},
handleCurrentChange(page) {
this.paginations.page = page;
this.load();
},
//
edit(obj) {
var that = this;
if (obj) {
if (obj.type == 1) {
this.$refs.editEquipment.infoId = obj.id
this.$refs.editEquipment.getEquipmentInfo(obj.id)
this.$refs.editEquipment.isShow = true
}
if (obj.type == 2) {
this.$refs.editSite.infoId = obj.id
this.$refs.editSite.getSiteInfo(obj.id)
this.$refs.editSite.isShow = true
}
} else {
this.rainTypeVisible = true
}
},
submitRainType() {
var that = this
this.rainTypeVisible = false
if (that.rainType == 1) {
this.$refs.editEquipment.infoId = ""
this.$refs.editEquipment.getEquipmentInfo()
this.$refs.editEquipment.isShow = true
} else if (that.rainType == 2) {
this.$refs.editSite.infoId = ""
this.$refs.editSite.getSiteInfo()
this.$refs.editSite.isShow = true
}
},
resetrainType() {
this.rainTypeVisible = false
this.rainType = 1
},
clickShowInfo(row) {
this.showInfo(row, 'showform')
},
//
showInfo(obj, formtype) {
//
if (obj.type == 1) {
this.$refs.showRainEquipmentInfo.isShow = true
this.$refs.showRainEquipmentInfo.getEquipmentInfo(obj.id)
this.$refs.showRainEquipmentInfo.infoId = obj.id
this.$refs.showRainEquipmentInfo.formType = formtype
}
//
if (obj.type == 2) {
this.$refs.showRainSiteInfo.isShow = true
this.$refs.showRainSiteInfo.getSiteInfo(obj.id)
this.$refs.showRainSiteInfo.infoId = obj.id
this.$refs.showRainSiteInfo.formType = formtype
}
},
del(obj) {
var that = this;
if (obj) {
this.$Modal.confirm({
title: '确认要删除数据?',
onOk: () => {
del(obj.id).then(response => {
this.$Message.success('操作成功');
that.load();
}).catch(error => {
console.log(error)
reject(error)
})
},
onCancel: () => {
//this.$Message.info('Clicked cancel');
}
});
}
},
//
handleSelectionChange(val) {
console.log(val)
@ -660,27 +670,27 @@
var that = this
that.searchFields.is_export = 1
that.load(true)
},
getUserName(row) {
if (row.admin) {
return row.admin.name;
} else if (row.user) {
return row.user.name;
} else {
return "未知";
}
},
getMaintinName(row) {
if (row.user) {
if(row.user.maintain){
return row.user.maintain.name;
}else{
return "";
}
} else {
return "";
}
},
getUserName(row) {
if (row.admin) {
return row.admin.name;
} else if (row.user) {
return row.user.name;
} else {
return "未知";
}
},
getMaintinName(row) {
if (row.user) {
if (row.user.maintain) {
return row.user.maintain.name;
} else {
return "";
}
} else {
return "";
}
},
remoteRoad() {
this.roadsList = []
@ -698,7 +708,7 @@
} else {
this.roadsList = []
}
}
}
}
}

@ -45,42 +45,47 @@
<Button type="primary" @click="load(false)" style="margin-left: 10px">查询</Button>
<Button type="primary" @click="edit()" style="margin-left: 10px">新增</Button>
<Button type="primary" @click="review()" style="margin-left: 10px">批量复核</Button>
<Button type="primary" @click="exportExcel()" style="margin-left: 10px">导出</Button>
<Button type="primary" @click="exportExcel()" style="margin-left: 10px">导出</Button>
<Button type="primary" @click="showMap()" style="margin-left: 10px">当月点位</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable">
<el-table :data="tableData" class="v-table" @selection-change="handleSelectionChange" :height="tableHeight"
style="width: 100%">
<el-table :data="tableData" class="v-table" @row-click="clickShowInfo" @selection-change="handleSelectionChange"
:height="tableHeight" style="width: 100%">
<el-table-column type="selection" fixed width="55"></el-table-column>
<el-table-column type="index" width="50" fixed label="序号" align="center"> </el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width" :fixed="column.fixed">
<template slot-scope="scope">
<div v-if="column.type=='opt'">
<Button ghost size="small" @click="showInfo(scope.row,'showform')" type="primary"
style="margin-left: 10px;"
v-if="scope.row['status']==2||scope.row['status']==3||scope.row['status']==4||scope.row['end_type']==1">查看</Button>
<Button v-if="scope.row['status']==0" ghost size="small" @click="edit(scope.row)" type="primary"
style="margin-left: 10px;">编辑</Button>
<Button v-if="scope.row['status']==0" ghost size="small" @click="showInfo(scope.row,'auditform')"
type="primary" style="margin-left: 10px;">审核</Button>
<Button v-if="scope.row['status']==1&&scope.row['end_type']!=1" ghost size="small"
@click="showInfo(scope.row,'endform')" type="primary" style="margin-left: 10px;">办结</Button>
<Button ghost size="small"
v-if="scope.row['status']==0||scope.row['status']==1&&scope.row['end_type']!=1"
@click="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
<Button ghost size="small" @click.native.stop="showInfo(scope.row,'showform')" type="primary"
style="margin-left: 10px;">查看</Button>
<el-popover placement="bottom-start" width="200" trigger="hover"
v-if="scope.row['status']!=2&&scope.row['status']!=3&&scope.row['end_type']!=2"
>
<Button v-if="scope.row['status']==0" ghost size="small" @click.native.stop="edit(scope.row)"
type="primary" style="margin-left: 10px;">编辑</Button>
<Button v-if="scope.row['status']==0" ghost size="small"
@click.native.stop="showInfo(scope.row,'auditform')" type="primary"
style="margin-left: 10px;">审核</Button>
<Button v-if="scope.row['status']==1&&scope.row['end_type']!=1" ghost size="small"
@click.native.stop="showInfo(scope.row,'endform')" type="primary"
style="margin-left: 10px;">办结</Button>
<Button ghost size="small"
v-if="scope.row['status']==0||scope.row['status']==1&&scope.row['end_type']!=1"
@click.native.stop="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
<Button slot="reference" ghost size="small" type="primary" style="margin-left: 10px;">更多</Button>
</el-popover>
</div>
<div v-else-if="column.type=='end_type'">
<el-tag v-if="scope.row[column.field]==1" type="warning"></el-tag>
<el-tag v-else></el-tag>
</div>
<div v-else-if="column.type=='old_type'">
<div v-for="item in selects.typeList">
<el-tag v-if="scope.row[column.field]==item.id">{{item.name}}</el-tag>
<div v-else-if="column.type=='old_type'">
<div v-for="item in selects.typeList">
<el-tag v-if="scope.row[column.field]==item.id">{{item.name}}</el-tag>
</div>
</div>
@ -140,7 +145,7 @@
<el-button type="primary" v-preventReClick @click="submitRainType()"></el-button>
</div>
</el-dialog>
<!-- 地图 -->
<!-- 地图 -->
<maps ref="maps" @loadMap="loadMap"></maps>
<el-dialog class="common-dialog" title="批量复核" :visible.sync="reviewFormVisible" width="40%">
@ -183,8 +188,8 @@
<!-- 查看 审核 办结 -->
<showCirculationInfo ref="showCirculationInfo" @auditSuccess="load"></showCirculationInfo>
<showDischargeInfo ref="showDischargeInfo" @auditSuccess="load"></showDischargeInfo>
<showMireInfo ref="showMireInfo" @auditSuccess="load"></showMireInfo>
<showMireInfo ref="showMireInfo" @auditSuccess="load"></showMireInfo>
</div>
@ -220,9 +225,12 @@
import showMireInfo from '@/views/rain/maintain/components/showMireInfo'
import editCirculation from '@/views/rain/maintain/components/editCirculation'
import editMire from '@/views/rain/maintain/components/editMire'
import AvueMap from 'avue-plugin-map'
import maps from '@/views/rain/maintain/components/maps'
import {getCurrentMonthFirst,getCurrentMonthLast} from "@/utils/index"
import AvueMap from 'avue-plugin-map'
import maps from '@/views/rain/maintain/components/maps'
import {
getCurrentMonthFirst,
getCurrentMonthLast
} from "@/utils/index"
export default {
components: {
@ -232,35 +240,35 @@
showDischargeInfo,
showMireInfo,
editCirculation,
editMire,
editMire,
maps
},
data() {
return {
tableHeight: 0,
formLabelWidth: "120px",
mapArr :[],
tableData: [],
paginations: {
page: 1,
page_size: 15,
total: 0
return {
tableHeight: 0,
formLabelWidth: "120px",
mapArr: [],
tableData: [],
paginations: {
page: 1,
page_size: 15,
total: 0
},
tableHeight: 0,
rainTypeVisible: false,
rainType: 1,
datesearch: "",
baseurl: "",
searchFields: {
is_export: 0,
is_auth: 1
},
roadsList: [],
roadName: "",
roaddisabled: false,
baseurl: "",
searchFields: {
is_export: 0,
is_auth: 1
},
roadsList: [],
roadName: "",
roaddisabled: false,
roadloading: false,
selects: {
areasList: [{
@ -416,7 +424,7 @@
{
field: "操作",
title: "操作",
width: 220,
width: 180,
type: "opt",
fixed: "right"
}
@ -457,124 +465,126 @@
}
},
},
methods: {
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 20;
that.tableHeight = tableHeight;
that.baseurl = location.host; //process.env.VUE_APP_BASE_API
// this.uploadOther.token = getToken();
listarea({
page: 1,
page_size: 99
}).then(res => {
for (var m of res.data) {
that.selects.areasList.push({
id: m.id,
name: m.name
})
}
})
listmaintain({
page: 1,
page_size: 999,
}).then(response => {
for (var m of response.data) {
this.selects.maintaingroupList.push(m)
}
}).catch(error => {
console.log(error)
reject(error)
});
},
handleCurrentChange(page) {
this.paginations.page = page;
this.load();
},
load(is_export) {
listmain({
page: this.paginations.page,
page_size: this.paginations.page_size,
...this.searchFields
}).then(response => {
let tokens = getToken();
if (is_export) {
var url = "/api/admin/rain-maintains/index?token=" + tokens
for (var m in this.searchFields) {
url += "&" + m + "=" + this.searchFields[m]
}
url = this.baseurl + url
console.log(url)
window.open("http://" + url, '_blank')
this.searchFields.is_export = 0
return;
}
this.tableData = response.data;
this.paginations.total = response.total;
}).catch(error => {
console.log(error)
reject(error)
});
},
showMap(){
this.loadMap(this.searchFields)
this.$nextTick(function(){
this.$refs.maps.pointArr = this.mapArr
this.$refs.maps.isShow = true
// this.$refs.maps.showMaps()
this.$refs.maps.selects = this.selects
})
},
//
loadMap(search) {
// return
this.mapArr = []
listmain({
page: 1,
page_size: 9999999,
start_date:getCurrentMonthFirst(),
end_date:getCurrentMonthLast(),
...search
}).then(response => {
for (var m of response.data) {
if(m.help_discharge_info){
this.mapArr.push([
m.help_discharge_info.longitude,m.help_discharge_info.latitude,m.help_discharge_info.address,m.id,m.old_type
])
}
if(m.circulation_info){
this.mapArr.push([
m.circulation_info.longitude,m.circulation_info.latitude,m.circulation_info.address,m.id,m.old_type
])
}
if(m.mire_info){
this.mapArr.push([
m.mire_info.longitude,m.mire_info.latitude,m.mire_info.address,m.id,m.old_type
])
}
}
this.$refs.maps.showSearch = false
this.$refs.maps.pointArr = this.mapArr
this.$refs.maps.resetPointArr()
}).catch(error => {
console.log(error)
reject(error)
});
},
exportExcel() {
var that = this
that.searchFields.is_export = 1
that.load(true)
},
methods: {
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 20;
that.tableHeight = tableHeight;
that.baseurl = location.host; //process.env.VUE_APP_BASE_API
// this.uploadOther.token = getToken();
listarea({
page: 1,
page_size: 99
}).then(res => {
for (var m of res.data) {
that.selects.areasList.push({
id: m.id,
name: m.name
})
}
})
listmaintain({
page: 1,
page_size: 999,
}).then(response => {
for (var m of response.data) {
this.selects.maintaingroupList.push(m)
}
}).catch(error => {
console.log(error)
reject(error)
});
},
handleCurrentChange(page) {
this.paginations.page = page;
this.load();
},
load(is_export) {
listmain({
page: this.paginations.page,
page_size: this.paginations.page_size,
...this.searchFields
}).then(response => {
let tokens = getToken();
if (is_export) {
var url = "/api/admin/rain-maintains/index?token=" + tokens
for (var m in this.searchFields) {
url += "&" + m + "=" + this.searchFields[m]
}
url = this.baseurl + url
console.log(url)
window.open("http://" + url, '_blank')
this.searchFields.is_export = 0
return;
}
this.tableData = response.data;
this.paginations.total = response.total;
}).catch(error => {
console.log(error)
reject(error)
});
},
showMap() {
this.loadMap(this.searchFields)
this.$nextTick(function() {
this.$refs.maps.pointArr = this.mapArr
this.$refs.maps.isShow = true
// this.$refs.maps.showMaps()
this.$refs.maps.selects = this.selects
})
},
//
loadMap(search) {
// return
this.mapArr = []
listmain({
page: 1,
page_size: 9999999,
start_date: getCurrentMonthFirst(),
end_date: getCurrentMonthLast(),
...search
}).then(response => {
for (var m of response.data) {
if (m.help_discharge_info) {
this.mapArr.push([
m.help_discharge_info.longitude, m.help_discharge_info.latitude, m.help_discharge_info.address,
m.id, m.old_type
])
}
if (m.circulation_info) {
this.mapArr.push([
m.circulation_info.longitude, m.circulation_info.latitude, m.circulation_info.address, m.id, m
.old_type
])
}
if (m.mire_info) {
this.mapArr.push([
m.mire_info.longitude, m.mire_info.latitude, m.mire_info.address, m.id, m.old_type
])
}
}
this.$refs.maps.showSearch = false
this.$refs.maps.pointArr = this.mapArr
this.$refs.maps.resetPointArr()
}).catch(error => {
console.log(error)
reject(error)
});
},
exportExcel() {
var that = this
that.searchFields.is_export = 1
that.load(true)
},
handleSelectionChange(val) {
console.log(val)
@ -630,46 +640,49 @@
} else {
this.roadsList = []
}
},
resetrainType() {
this.rainType = 1
this.rainTypeVisible = false
},
submitRainType() {
var that = this
this.rainTypeVisible = false
if (that.rainType == 1 || that.rainType == 2 || that.rainType == 3 || that.rainType == 5 || that.rainType ==
6 || that.rainType == 7) {
console.log("a",that.rainType)
this.$refs.editCirculation.infoId = ""
this.$refs.editCirculation.rainType = that.rainType
this.$refs.editCirculation.getInfo()
this.$refs.editCirculation.isShow = true
} else if (that.rainType == 4) {
this.$refs.editMire.infoId = ""
this.$refs.editMire.getInfo()
this.$refs.editMire.isShow = true
}
},
edit(obj) {
var that = this;
if (obj) {
if (obj.old_type == 1 || obj.old_type == 2 || obj.old_type == 3 || obj.old_type == 5 || obj.old_type == 6 ||
obj.old_type ==
7) {
this.$refs.editCirculation.rainType = obj.old_type
this.$refs.editCirculation.infoId = obj.id
this.$refs.editCirculation.getInfo(obj.id)
this.$refs.editCirculation.isShow = true
} else if (obj.old_type == 4) {
this.$refs.editMire.infoId = obj.id
this.$refs.editMire.getInfo(obj.id)
this.$refs.editMire.isShow = true
}
}else{
this.rainTypeVisible = true
}
resetrainType() {
this.rainType = 1
this.rainTypeVisible = false
},
submitRainType() {
var that = this
this.rainTypeVisible = false
if (that.rainType == 1 || that.rainType == 2 || that.rainType == 3 || that.rainType == 5 || that.rainType ==
6 || that.rainType == 7) {
console.log("a", that.rainType)
this.$refs.editCirculation.infoId = ""
this.$refs.editCirculation.rainType = that.rainType
this.$refs.editCirculation.getInfo()
this.$refs.editCirculation.isShow = true
} else if (that.rainType == 4) {
this.$refs.editMire.infoId = ""
this.$refs.editMire.getInfo()
this.$refs.editMire.isShow = true
}
},
edit(obj) {
var that = this;
if (obj) {
if (obj.old_type == 1 || obj.old_type == 2 || obj.old_type == 3 || obj.old_type == 5 || obj.old_type == 6 ||
obj.old_type ==
7) {
this.$refs.editCirculation.rainType = obj.old_type
this.$refs.editCirculation.infoId = obj.id
this.$refs.editCirculation.getInfo(obj.id)
this.$refs.editCirculation.isShow = true
} else if (obj.old_type == 4) {
this.$refs.editMire.infoId = obj.id
this.$refs.editMire.getInfo(obj.id)
this.$refs.editMire.isShow = true
}
} else {
this.rainTypeVisible = true
}
},
clickShowInfo(row) {
this.showInfo(row, 'showform')
},
//
showInfo(obj, formtype) {
@ -709,28 +722,28 @@
}
});
}
},
getUserName(row) {
if (row.admin) {
return row.admin.name;
} else if (row.user) {
return row.user.name;
} else {
return "未知";
}
},
getMaintinName(row) {
if (row.user) {
if (row.user.maintain) {
return row.user.maintain.name;
} else {
return "";
}
} else {
return "";
}
},
getUserName(row) {
if (row.admin) {
return row.admin.name;
} else if (row.user) {
return row.user.name;
} else {
return "未知";
}
},
getMaintinName(row) {
if (row.user) {
if (row.user.maintain) {
return row.user.maintain.name;
} else {
return "";
}
} else {
return "";
}
},
}
}

@ -1,440 +0,0 @@
<template>
<div class="container">
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="养护计划" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content"></div>
<slot>
<div>
<Input style="width: 200px; margin-right: 10px" v-model="searchFields.keyword" placeholder="关键字搜索" />
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
<Button type="primary" @click="edit()" style="margin-left: 10px">新增</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable">
<el-table :data="tableData" class="v-table" :height="tableHeight" style="width: 100%">
<el-table-column type="index" width="50" fixed="left" label="序号" align="center"> </el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width" :fixed="column.fixed">
<template slot-scope="scope">
<div v-if="column.type=='opt'">
<Button ghost size="small" @click="edit(scope.row)" type="primary"
style="margin-left: 10px;">编辑</Button>
<Button ghost size="small" @click="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
</div>
<div v-else-if="column.type=='daterange'">
{{scope.row['start_date']}}{{scope.row['end_date']}}
</div>
<div v-else>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination @current-change="handleCurrentChange" :current-page="paginations.page"
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
<el-dialog class="common-dialog" title="养护计划编辑" :visible.sync="dialogFormVisible" width="40%">
<div class="dialogConcent">
<el-scrollbar style="flex: 1">
<el-form :model="form" :rules="rules" ref="form" label-position="right" :label-width="formLabelWidth">
<el-row>
<el-col :span="24">
<el-form-item label="养护计划名称" prop="name">
<el-input v-model="form.name" placeholder="请填写养护计划名称" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="养护类型" prop="item_type">
<el-select style="width:100%" v-model="form.item_type" placeholder="请选择养护类型">
<el-option
v-for="item in plantypes"
:key="item.id"
:label="item.value"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="养护片区" prop="area_id">
<el-select filterable style="width:100%" v-model="form.area_id" placeholder="请选择养护片区">
<el-option
v-for="item in areaList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="循环机制" prop="day">
<el-select style="width:100%" v-model="form.day" placeholder="请选择循环机制">
<el-option
v-for="item in dayList"
:key="item.id"
:label="item.value"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="养护周期" prop="dateRange">
<el-date-picker
style="width:100%"
v-model="dateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="养护责任人" prop="responsible_id">
<el-select filterable style="width:100%" v-model="form.responsible_id" placeholder="请选择养护责任人">
<el-option
v-for="item in usersList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input type="textarea" v-model="form.remark" placeholder="请填写备注" autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-scrollbar>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="resetForm('form')"> </el-button>
<el-button type="primary" v-preventReClick @click="submitForm('form')"></el-button>
</div>
</el-dialog>
</div>
</div>
</template>
<script>
import {
listplan,
get,
store,
save,
del
} from '../../../api/maintainmanagement/index.js'
import {
listCommonuser
} from '../../../api/common.js'
import {
listarea
} from '../../../api/basic/area.js'
import { getparameteritem } from '../../../api/system/dictionary.js'
import LxHeader from "@/components/LxHeader/index.vue";
export default {
components: {
LxHeader
},
data() {
return {
tableHeight: 0,
dialogFormVisible: false,
formLabelWidth: "120px",
tableData: [],
areaList:[],
plantypes:[{
id:1,
value:"雨水管道疏挖"
},{
id:2,
value:"雨水管道疏通"
},{
id:3,
value:"汛期助排"
},{
id:4,
value:"污泥外运"
},{
id:5,
value:"出水口排查"
},{
id:6,
value:"专项处理"
},{
id:7,
value:"维修"
}],
dayList:[],
dateRange:[],
usersList:[],
tableHeight: 0,
searchFields: {
keyword: ""
},
paginations: {
page: 1,
page_size: 15,
total: 0
},
form: {
name:"",
item_type:"",
area_id:"",
day:"",
start_date:"",
end_date:"",
responsible_id:"",
remark:""
},
rules: {
name:[{
required: true,
message: '请填写养护名称',
trigger: 'blur',
}],
area_id:[{
required: true,
message: '请选择所属片区',
trigger: 'blur',
}]
},
columns: [{
field: "name",
title: "养护名称",
type: "string",
align: "left",
width:240
},
{
field: "item_type_name",
title: "养护类型",
type: "string",
align: "center",
width:180
},
{
field: "area_name",
title: "养护片区",
type: "string",
width:180,
align: "center"
},
{
field: "day",
title: "循环机制",
type: "string",
width:120,
align: "center"
},
{
field: "daterange",
title: "养护周期",
type: "daterange",
width:240,
align:'center'
},
{
field: "responsibleName",
title: "责任人",
type: "string",
align: "center",
width:180,
},
{
field: "created_at",
title: "提交日期",
type: "string",
align: "center",
width:180,
align:'center'
},
{
field: "操作",
title: "操作",
width: 220,
type: "opt",
fixed:"right"
}
],
}
},
created() {
this.initLoad();
this.load();
},
methods: {
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 20;
that.tableHeight = tableHeight;
listarea({
page: 1,
page_size: 999,
}).then(response => {
that.areaList = response.data;
}).catch(error => {
console.log(error)
reject(error)
});
listCommonuser({
page:1,
page_size:999
}).then(res => {
that.usersList = res.data;
}).catch(error => {
console.log(error)
reject(error)
});
// getparameteritem('plan-type').then(res => {
// that.plantypes = res.detail
// })
getparameteritem('plan-day').then(res => {
that.dayList = res.detail
})
},
handleCurrentChange(page) {
this.paginations.page = page;
this.load();
},
load() {
listplan({
page: this.paginations.page,
page_size: this.paginations.page_size,
keyword: this.searchFields.keyword
}).then(response => {
for(var m of response.data){
for(var k of this.plantypes){
if(m.item_type==k.id){
m.item_type_name = k.value
}
}
m.area_name = m.area_info.name
m.responsibleName = m.responsible?m.responsible.name :""
}
this.tableData = response.data;
this.paginations.total = response.total;
}).catch(error => {
console.log(error)
reject(error)
});
},
info(obj) {
var that = this;
get(obj.id).then(res => {
let result = Object.assign(that.form, res);
// this.$set(that.form,res);
that.form = result;
that.dateRange = [result.start_date,result.end_date]
}).catch(error => {
//reject(error)
})
},
edit(obj) {
this.form = this.$options.data().form
if (obj) {
this.info(obj)
}
this.dialogFormVisible = true;
},
del(obj) {
var that = this;
if (obj) {
this.$Modal.confirm({
title: '确认要删除数据?',
onOk: () => {
del(obj.id).then(response => {
this.$Message.success('操作成功');
that.load();
}).catch(error => {
console.log(error)
reject(error)
})
},
onCancel: () => {
//this.$Message.info('Clicked cancel');
}
});
}
},
submitForm(formName) {
this.form.start_date = this.dateRange[0]
this.form.end_date = this.dateRange[1]
var that = this;
this.$refs[formName].validate((valid) => {
if (valid) {
if (that.form.id) {
save(that.form).then(response => {
this.$Message.success('操作成功');
that.load();
that.dialogFormVisible = false;
}).catch(error => {
//reject(error)
})
} else {
store(that.form).then(response => {
this.$Message.success('操作成功');
that.load();
that.dialogFormVisible = false;
}).catch(error => {
//reject(error)
})
}
} else {
this.$Message.error('数据校验失败');
console.log('error submit!!');
return false;
}
});
},
resetForm(formName) {
var that = this;
that.dateRange = [];
this.$refs[formName].resetFields();
that.dialogFormVisible = false;
}
}
}
</script>
<style>
.dialogConcent {
overflow-y: auto;
}
.width100{
width:100%;
}
</style>
Loading…
Cancel
Save