9 changed files with 1149 additions and 931 deletions
@ -0,0 +1,441 @@ |
|||
<template> |
|||
<div> |
|||
<div> |
|||
<div> |
|||
<el-form ref="ref_form" |
|||
:inline="true" |
|||
:model="formData" |
|||
:rules="dataRule" |
|||
:disabled="formType === 'detail'" |
|||
class="form"> |
|||
|
|||
<el-form-item label="场所区域" |
|||
prop="gridId" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-select class="item_width_1" |
|||
v-model="formData.gridId" |
|||
placeholder="全部" |
|||
clearable> |
|||
<el-option v-for="item in gridList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="场所类型" |
|||
label-width="150px" |
|||
prop="ninePlaceVal"> |
|||
<el-select class="item_width_1" |
|||
v-model="formData.ninePlaceVal" |
|||
placeholder="请选择" |
|||
clearable> |
|||
<el-option v-for="item in placeTypeList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
</el-form-item> |
|||
|
|||
<el-form-item label="场所名称" |
|||
label-width="150px" |
|||
prop="placeOrgId"> |
|||
<el-select class="item_width_1" |
|||
v-model="formData.placeOrgId" |
|||
placeholder="请选择" |
|||
clearable> |
|||
<el-option v-for="item in placesList" |
|||
:key="item.placeOrgId" |
|||
:label="item.placeOrgName" |
|||
:value="item.placeOrgId"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
</el-form-item> |
|||
<el-form-item label="分队名称" |
|||
label-width="150px" |
|||
prop="placePatrolTeamId"> |
|||
<el-select class="item_width_1" |
|||
v-model="formData.placePatrolTeamId" |
|||
placeholder="请选择" |
|||
clearable> |
|||
<el-option v-for="(item,index) in teamsList" |
|||
@click.native="hancleChangeTeam(index)" |
|||
:key="item.teamId" |
|||
:label="item.teamName" |
|||
:value="item.teamId"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="检查人员" |
|||
prop="inspectorArray" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-checkbox-group class="item_width_1" |
|||
style="display:flex;flex-wrap:wrap" |
|||
v-model="formData.inspectorArray"> |
|||
<el-checkbox v-for="item in inspectorsList" |
|||
:key="item.name" |
|||
:label="item.name">{{item.name}}</el-checkbox> |
|||
|
|||
</el-checkbox-group> |
|||
|
|||
</el-form-item> |
|||
<el-form-item label="首次巡查时间" |
|||
style="display: block" |
|||
prop="firstTime" |
|||
label-width="150px"> |
|||
<el-date-picker v-model="formData.firstTime" |
|||
value-format="yyyy-MM-dd" |
|||
type="date" |
|||
placeholder="选择日期"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="隐患明细" |
|||
prop="detailed" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
type="textarea" |
|||
maxlength="500" |
|||
show-word-limit |
|||
:rows="3" |
|||
placeholder="请输入备注,不超过500字" |
|||
v-model="formData.detailed"></el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="首次检查结论" |
|||
prop="firstResult" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-select class="item_width_1" |
|||
v-model="formData.firstResult" |
|||
placeholder="全部" |
|||
clearable> |
|||
<el-option v-for="item in resultList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="拟复查时间" |
|||
style="display: block" |
|||
prop="reviewTime" |
|||
label-width="150px"> |
|||
<el-date-picker v-model="formData.reviewTime" |
|||
value-format="yyyy-MM-dd" |
|||
type="date" |
|||
placeholder="选择日期"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button @click="handleCancle">取 消</el-button> |
|||
<el-button 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' |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|||
btnDisable: false, |
|||
|
|||
placesList: [],//场景列表 |
|||
teamsList: [],//分队列表 |
|||
inspectorsList: [],//检查人员列表 |
|||
|
|||
placePatrolRecordId: '', |
|||
formData: { |
|||
gridId: '',//网格Id |
|||
ninePlaceVal: '',//九小场所类型value值 |
|||
placeOrgId: '',//场所下的组织Id-场所名称 |
|||
placePatrolTeamId: '',//场所下分队Id |
|||
inspectorArray: [],//检查人员数组 |
|||
inspectors: '',//检查人员Id,逗号分隔 |
|||
firstTime: '',//首次巡查时间 |
|||
detailed: '',//隐患明细 |
|||
firstResult: '',//首次检查结果【0:合格 1:不合格】 |
|||
reviewTime: '',//拟复查时间 |
|||
}, |
|||
|
|||
} |
|||
}, |
|||
components: {}, |
|||
mounted () { |
|||
|
|||
}, |
|||
|
|||
methods: { |
|||
|
|||
async initForm (type, placeOrgId) { |
|||
this.$refs.ref_form.resetFields(); |
|||
|
|||
await this.loadPlaces() |
|||
await this.loadTeams() |
|||
|
|||
this.formType = type |
|||
if (placeOrgId) { |
|||
this.placeOrgId = placeOrgId |
|||
this.formData.placeOrgId = placeOrgId |
|||
await this.loadFormData() |
|||
} |
|||
|
|||
}, |
|||
|
|||
//加载场所 |
|||
async loadPlaces () { |
|||
// const url = '/gov/org/placeorg/getlist' |
|||
const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/placeorg/getlist' |
|||
let params = { |
|||
isPage: false |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.placesList = data.list |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//加载分队 |
|||
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 |
|||
if (this.teamsList.length > 0) { |
|||
this.formData.placePatrolTeamId = this.teamsList[0].teamId |
|||
|
|||
this.hancleChangeTeam(0) |
|||
} |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//点击分队切换人员 |
|||
async hancleChangeTeam (index) { |
|||
// this.formData.placePatrolTeamId = this.teamsList[index].teamId |
|||
await this.loadInspectors() |
|||
}, |
|||
|
|||
//加载分队下人员 |
|||
async loadInspectors () { |
|||
// const url = '/gov/org/placepatrolteamstaff/getlist' |
|||
const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolteamstaff/getlist' |
|||
let params = { |
|||
teamId: this.formData.placePatrolTeamId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.inspectorsList = data |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
//加载form |
|||
async loadFormData () { |
|||
// const url = '/gov/org/placeorg/detail' |
|||
const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/placeorg/detail' |
|||
let params = { |
|||
placeOrgId: this.placeOrgId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
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 () { |
|||
|
|||
// 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) |
|||
} |
|||
|
|||
}, |
|||
|
|||
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' }, |
|||
], |
|||
placeOrgName: [ |
|||
{ 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: { |
|||
|
|||
gridList: { |
|||
type: Array, |
|||
default: [] |
|||
}, |
|||
resultList: { |
|||
type: Array, |
|||
default: [] |
|||
}, |
|||
placeTypeList: { |
|||
type: Array, |
|||
default: [] |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped> |
|||
.item_width_1 { |
|||
width: 500px; |
|||
} |
|||
.item_width_2 { |
|||
width: 400px; |
|||
} |
|||
.item_width_3 { |
|||
margin-left: 10px; |
|||
width: 200px; |
|||
} |
|||
.item_width_4 { |
|||
width: 200px; |
|||
} |
|||
|
|||
.div_btn { |
|||
display: flex; |
|||
justify-content: flex-end; |
|||
} |
|||
|
|||
.form { |
|||
margin-top: 30px; |
|||
} |
|||
</style> |
|||
|
@ -0,0 +1,439 @@ |
|||
<template> |
|||
<div> |
|||
<div class="div_table"> |
|||
<el-button type="green" |
|||
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="reviewTime" |
|||
header-align="center" |
|||
align="center" |
|||
label="复查时间" |
|||
width="250"> |
|||
<template slot-scope="scope"> |
|||
<div v-if="scope.row.isSet"> |
|||
<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.isSet"> |
|||
<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)" |
|||
: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.isSet"> |
|||
<!-- <el-select class="item_width_1" |
|||
multiple |
|||
v-model="inspectorArray" |
|||
placeholder="请选择" |
|||
clearable> |
|||
<el-option v-for="item in scope.row.inspectorsList" |
|||
:key="item.name" |
|||
:label="item.name" |
|||
:value="item.name"> |
|||
</el-option> |
|||
</el-select> --> |
|||
<el-checkbox-group style="display:flex;flex-wrap:wrap" |
|||
v-model="inspectorArray[scope.$index]"> |
|||
<el-checkbox v-for="item in scope.row.inspectorsList" |
|||
:key="item.name" |
|||
:label="item.name">{{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.isSet"> |
|||
<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 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)">删除</el-button> |
|||
|
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button @click="handleCancle">取 消</el-button> |
|||
<el-button type="primary" |
|||
@click="handleComfirm">确 定</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: [], |
|||
inspectorArray: [], |
|||
|
|||
inspectorsList1: [ |
|||
{ |
|||
name: '张三' |
|||
}, |
|||
{ |
|||
name: '李四' |
|||
}, |
|||
{ |
|||
name: '王二麻' |
|||
}, |
|||
], |
|||
inspectorsList2: [ |
|||
{ |
|||
name: '张三2' |
|||
}, |
|||
{ |
|||
name: '李四2' |
|||
}, |
|||
{ |
|||
name: '王二麻2' |
|||
}, |
|||
], |
|||
inspectorsList3: [ |
|||
{ |
|||
name: '张三3' |
|||
}, |
|||
{ |
|||
name: '李四3' |
|||
}, |
|||
{ |
|||
name: '王二麻3' |
|||
}, |
|||
] |
|||
|
|||
} |
|||
}, |
|||
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 (index) { |
|||
// this.formData.placePatrolTeamId = this.teamsList[index].teamId |
|||
await this.loadInspectors() |
|||
}, |
|||
|
|||
//加载分队下人员 |
|||
async loadInspectors (index) { |
|||
|
|||
|
|||
// const url = '/gov/org/placepatrolteamstaff/getlist' |
|||
const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolteamstaff/getlist' |
|||
let params = { |
|||
teamId: this.tableData[index].placePatrolTeamId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
let obj = this.tableData[index] |
|||
obj.isSet = true |
|||
|
|||
obj.inspectorsList = this.inspectorsList1 |
|||
this.$set(this.tableData, index, 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) { |
|||
this.tableData = data.list |
|||
this.tableData.forEach(item => { |
|||
item.isSet = false |
|||
let array = item.inspectors.split(',') |
|||
this.inspectorArray.push(array) |
|||
}); |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
handleAdd () { |
|||
let obj = { |
|||
isSet: true, |
|||
reviewTime: '', |
|||
placePatrolTeamId: '', |
|||
inspectors: '', |
|||
inspectorArray: [], |
|||
reviewResult: '', |
|||
} |
|||
this.tableData.push(obj) |
|||
}, |
|||
|
|||
handleEdit (row, index) { |
|||
|
|||
|
|||
|
|||
this.loadInspectors(index) |
|||
|
|||
}, |
|||
|
|||
async handleComfirm () { |
|||
|
|||
this.addReview() |
|||
|
|||
}, |
|||
async addReview () { |
|||
|
|||
// 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.$emit('dialogOk') |
|||
|
|||
} else { |
|||
|
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
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/delreview" |
|||
const url = "http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolrecord/delreview" |
|||
|
|||
let params = { |
|||
placePatrolReviewRecordId: row.placePatrolReviewRecordId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
|
|||
this.loadTable() |
|||
} 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> |
@ -1,553 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<div> |
|||
<div> |
|||
<el-form ref="ref_form" |
|||
:inline="true" |
|||
:model="formData" |
|||
:rules="dataRule" |
|||
:disabled="formType === 'detail'" |
|||
class="form"> |
|||
|
|||
<el-form-item label="所属网格" |
|||
prop="gridId" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-select class="item_width_1" |
|||
v-model="formData.gridId" |
|||
placeholder="全部" |
|||
clearable> |
|||
<el-option v-for="item in gridList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="单位名称" |
|||
prop="unitName" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
maxlength="50" |
|||
show-word-limit |
|||
placeholder="请输入单位名称" |
|||
v-model="formData.unitName"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="分类" |
|||
prop="type" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-select class="item_width_1" |
|||
v-model="formData.type" |
|||
placeholder="请选择" |
|||
filterable |
|||
clearable> |
|||
<el-option v-for="item in typeList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
</el-form-item> |
|||
<el-form-item label="服务事项" |
|||
prop="serviceMatter" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-checkbox-group class="item_width_1" |
|||
style="display:flex;flex-wrap:wrap" |
|||
v-model="formData.serviceMatter"> |
|||
<el-checkbox v-for="item in serviceList" |
|||
:key="item.value" |
|||
:label="item.value">{{item.label}}</el-checkbox> |
|||
|
|||
</el-checkbox-group> |
|||
|
|||
</el-form-item> |
|||
<el-form-item label="联系人" |
|||
prop="contact" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
placeholder="请输入联系人姓名" |
|||
v-model="formData.contact"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="联系电话" |
|||
prop="contactMobile" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
placeholder="请输入联系人电话" |
|||
v-model="formData.contactMobile"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="在职党员" |
|||
style="display: block" |
|||
prop="memberCount" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_1" |
|||
v-model="formData.memberCount" |
|||
:min="1" |
|||
label="单元数"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="备注" |
|||
prop="remark" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
type="textarea" |
|||
maxlength="500" |
|||
show-word-limit |
|||
:rows="3" |
|||
placeholder="请输入备注,不超过500字" |
|||
v-model="formData.remark"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="位置坐标" |
|||
prop="longitude" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<div style="width:500px"> |
|||
|
|||
<div class="div_map"> |
|||
<div id="app"> |
|||
|
|||
</div> |
|||
<div class="div_searchmap"> |
|||
<el-input class="item_width_4" |
|||
maxlength="50" |
|||
size="mini" |
|||
placeholder="请输入关键字" |
|||
v-model="keyWords"> |
|||
</el-input> |
|||
<el-button style="margin-left: 10px" |
|||
type="primary" |
|||
size="mini" |
|||
@click="handleSearchMap">查询</el-button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div style="margin-top: 10px"> |
|||
<span>经度</span> |
|||
<el-input class="item_width_3" |
|||
maxlength="50" |
|||
placeholder="请输入经度" |
|||
v-model="formData.longitude"> |
|||
</el-input> |
|||
<span style="margin-left: 20px">纬度</span> |
|||
<el-input class="item_width_3" |
|||
maxlength="50" |
|||
placeholder="请输入纬度" |
|||
v-model="formData.latitude"> |
|||
</el-input> |
|||
</div> |
|||
</div> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="地理位置" |
|||
prop="address" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
|
|||
<el-input class="item_width_1" |
|||
v-model="formData.address"> |
|||
</el-input> |
|||
|
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button @click="handleCancle">取 消</el-button> |
|||
<el-button 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' |
|||
|
|||
|
|||
|
|||
var map |
|||
var search |
|||
var markers |
|||
var infoWindowList |
|||
var geocoder // 新建一个正逆地址解析类 |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|||
|
|||
btnDisable: false, |
|||
|
|||
unitId: '', |
|||
keyWords: '', |
|||
formData: { |
|||
gridId: '', |
|||
unitName: '', |
|||
serviceMatter: [], |
|||
type: '', |
|||
contact: '', |
|||
contactMobile: '', |
|||
memberCount: 0, |
|||
remark: '', //备注【最大500字】 |
|||
address: '', //详细地址 |
|||
longitude: 36.0722275, //经度 |
|||
latitude: 120.38945519 //纬度 |
|||
}, |
|||
|
|||
} |
|||
}, |
|||
components: {}, |
|||
mounted () { |
|||
this.initMap() |
|||
}, |
|||
|
|||
methods: { |
|||
|
|||
async initForm (type, unitId) { |
|||
this.$refs.ref_form.resetFields(); |
|||
|
|||
// debugger |
|||
// map.setCenter(new TMap.LatLng(agencyObj.latitude, agencyObj.longitude)) |
|||
|
|||
this.formType = type |
|||
if (unitId) { |
|||
this.unitId = unitId |
|||
this.formData.id = unitId |
|||
await this.loadFormData() |
|||
} |
|||
|
|||
}, |
|||
|
|||
//加载组织 |
|||
async loadFormData () { |
|||
// const url = '/heart/icpartyunit/detail' |
|||
const url = 'http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/detail' |
|||
let params = { |
|||
id: this.unitId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
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.addUnit() |
|||
} |
|||
|
|||
}) |
|||
|
|||
|
|||
}, |
|||
async addUnit () { |
|||
// const regPhone = /^1(3|4|5|6|7|8|9)\d{9}$/; //手机号码 |
|||
// if (regPhone.test(this.formData.contactMobile) === false) { |
|||
// this.btnDisable = false |
|||
// this.$message({ |
|||
// type: 'warning', |
|||
// message: '请输入正确的手机号码' |
|||
// }) |
|||
// return false; |
|||
// } |
|||
|
|||
// let url = '/heart/icpartyunit/save' |
|||
let url = "http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/save" |
|||
// if (this.formType === 'edit') { |
|||
// this.formData.id = this.unitId |
|||
// } |
|||
|
|||
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) |
|||
} |
|||
|
|||
}, |
|||
|
|||
handleCancle () { |
|||
|
|||
this.resetData() |
|||
this.$emit('dialogCancle') |
|||
|
|||
}, |
|||
|
|||
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|||
initMap () { |
|||
// 定义地图中心点坐标 |
|||
var center = new window.TMap.LatLng(36.0722275, 120.38945519) |
|||
// 定义map变量,调用 TMap.Map() 构造函数创建地图 |
|||
map = new window.TMap.Map(document.getElementById('app'), { |
|||
center: center, // 设置地图中心点坐标 |
|||
zoom: 17.2, // 设置地图缩放级别 |
|||
pitch: 43.5, // 设置俯仰角 |
|||
rotation: 45 // 设置地图旋转角度 |
|||
}) |
|||
|
|||
search = new window.TMap.service.Search({ pageSize: 10 }) |
|||
// 新建一个地点搜索类 |
|||
markers = new TMap.MultiMarker({ |
|||
map: map, |
|||
geometries: [] |
|||
}) |
|||
infoWindowList = Array(10) |
|||
|
|||
geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类 |
|||
|
|||
// 监听地图平移结束 |
|||
map.on('panend', () => { |
|||
this.handleMoveCenter() |
|||
}) |
|||
this.handleMoveCenter() |
|||
this.convert() |
|||
}, |
|||
|
|||
setMarker (lat, lng) { |
|||
markers.setGeometries([]) |
|||
markers.add([ |
|||
{ |
|||
id: '4', |
|||
styleId: 'marker', |
|||
position: new TMap.LatLng(lat, lng), |
|||
properties: { |
|||
title: 'marker4' |
|||
} |
|||
} |
|||
]) |
|||
}, |
|||
|
|||
handleSearchMap () { |
|||
infoWindowList.forEach((infoWindow) => { |
|||
infoWindow.close() |
|||
}) |
|||
infoWindowList.length = 0 |
|||
markers.setGeometries([]) |
|||
// 在地图显示范围内以给定的关键字搜索地点 |
|||
search |
|||
.searchRectangle({ |
|||
keyword: this.keyWords, |
|||
bounds: map.getBounds() |
|||
}) |
|||
.then((result) => { |
|||
let { data } = result |
|||
if (Array.isArray(data) && data.length > 0) { |
|||
const { |
|||
location: { lat, lng } |
|||
} = data[0] |
|||
|
|||
|
|||
map.setCenter(new TMap.LatLng(lat, lng)) |
|||
this.setMarker(lat, lng) |
|||
this.formData.latitude = lat |
|||
this.formData.longitude = lng |
|||
this.convert() |
|||
} else { |
|||
this.$message.error('未检索到相关位置坐标') |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
handleMoveCenter () { |
|||
//修改地图中心点 |
|||
const center = map.getCenter() |
|||
const lat = center.getLat() |
|||
const lng = center.getLng() |
|||
this.formData.latitude = lat |
|||
this.formData.longitude = lng |
|||
this.setMarker(lat, lng) |
|||
this.convert(lat, lng) |
|||
}, |
|||
|
|||
convert (lat, lng) { |
|||
markers.setGeometries([]); |
|||
// var input = document.getElementById('location').value.split(','); |
|||
let location |
|||
if (lat && lng) { |
|||
location = new TMap.LatLng(lat, lng); |
|||
} else { |
|||
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude); |
|||
} |
|||
|
|||
// map.setCenter(location); |
|||
markers.updateGeometries([ |
|||
{ |
|||
id: 'main', // 点标注数据数组 |
|||
position: location, |
|||
}, |
|||
]); |
|||
geocoder |
|||
.getAddress({ location: location }) // 将给定的坐标位置转换为地址 |
|||
.then((result) => { |
|||
this.formData.address = result.result.address |
|||
// 显示搜索到的地址 |
|||
}); |
|||
}, |
|||
|
|||
|
|||
resetData () { |
|||
this.unitId = '' |
|||
this.keyWords = '' |
|||
this.formData = { |
|||
gridId: '', |
|||
unitName: '', |
|||
serviceMatter: [], |
|||
type: '', |
|||
contact: '', |
|||
contactMobile: '', |
|||
memberCount: 0, |
|||
remark: '', //备注【最大500字】 |
|||
address: '', //详细地址 |
|||
longitude: '', //经度 |
|||
latitude: '' //纬度 |
|||
} |
|||
}, |
|||
// 开启加载动画 |
|||
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' } |
|||
], |
|||
unitName: [ |
|||
{ required: true, message: '单位名称不能为空', trigger: 'blur' }, |
|||
], |
|||
type: [ |
|||
{ required: true, message: '分类不能为空', trigger: 'blur' } |
|||
], |
|||
|
|||
contact: [ |
|||
{ required: true, message: '联系人不能为空', trigger: 'blur' } |
|||
], |
|||
contactMobile: [ |
|||
{ required: true, message: '联系电话不能为空', trigger: 'blur' } |
|||
], |
|||
memberCount: [ |
|||
{ required: true, message: '在职党员数不能为空', trigger: 'blur' } |
|||
], |
|||
address: [ |
|||
{ required: true, message: '详细地址不能为空', trigger: 'blur' } |
|||
], |
|||
longitude: [ |
|||
{ required: true, message: '坐标不能为空', trigger: 'blur' } |
|||
] |
|||
} |
|||
}, |
|||
|
|||
}, |
|||
props: { |
|||
|
|||
gridList: { |
|||
type: Array, |
|||
default: [] |
|||
}, |
|||
typeList: { |
|||
type: Array, |
|||
default: [] |
|||
}, |
|||
serviceList: { |
|||
type: Array, |
|||
default: [] |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped> |
|||
.item_width_1 { |
|||
width: 500px; |
|||
} |
|||
.item_width_2 { |
|||
width: 400px; |
|||
} |
|||
.item_width_3 { |
|||
margin-left: 10px; |
|||
width: 200px; |
|||
} |
|||
.item_width_4 { |
|||
width: 200px; |
|||
} |
|||
|
|||
.div_map { |
|||
position: relative; |
|||
} |
|||
.div_searchmap { |
|||
z-index: 5000; |
|||
position: absolute; |
|||
top: 5px; |
|||
left: 5px; |
|||
} |
|||
|
|||
.div_btn { |
|||
display: flex; |
|||
justify-content: flex-end; |
|||
} |
|||
.el-tabs { |
|||
margin: 0 20px; |
|||
} |
|||
.el-upload__tip { |
|||
color: rgb(155, 155, 155); |
|||
margin: 0; |
|||
} |
|||
.form { |
|||
margin-top: 30px; |
|||
} |
|||
</style> |
|||
|
|||
<style lang=scss> |
|||
.el-dialog__body { |
|||
padding: 0 10px 20px !important; |
|||
} |
|||
</style> |
Loading…
Reference in new issue