|
|
@ -1,188 +1,198 @@ |
|
|
|
<template> |
|
|
|
<div v-if="pageLoading" class="resi-container"> |
|
|
|
<el-card ref="searchCard" class="search-card"> |
|
|
|
<div > |
|
|
|
<el-form ref="searchForm" :inline="true" :model="form" class="demo-form-inline"> |
|
|
|
<div v-if="pageLoading" |
|
|
|
class="resi-container"> |
|
|
|
<el-card ref="searchCard" |
|
|
|
class="search-card"> |
|
|
|
<div> |
|
|
|
<el-form ref="searchForm" |
|
|
|
:inline="true" |
|
|
|
:model="form" |
|
|
|
class="demo-form-inline"> |
|
|
|
<el-form-item label="是否预警"> |
|
|
|
<el-select |
|
|
|
v-model="isWarn" |
|
|
|
placeholder="请选择" |
|
|
|
size="small" |
|
|
|
clearable |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in options" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value" |
|
|
|
> |
|
|
|
</el-option> |
|
|
|
<el-select v-model="isWarn" |
|
|
|
placeholder="请选择" |
|
|
|
size="small" |
|
|
|
clearable> |
|
|
|
<el-option v-for="item in options" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="预警类型"> |
|
|
|
<el-select |
|
|
|
v-model="level" |
|
|
|
placeholder="请选择" |
|
|
|
size="small" |
|
|
|
clearable |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in optionsType" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value" |
|
|
|
> |
|
|
|
</el-option> |
|
|
|
<el-select v-model="level" |
|
|
|
placeholder="请选择" |
|
|
|
size="small" |
|
|
|
clearable> |
|
|
|
<el-option v-for="item in optionsType" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button class="diy-button--search" size="small" @click="handleSearch">查询</el-button> |
|
|
|
<el-button class="diy-button--search" |
|
|
|
size="small" |
|
|
|
@click="handleSearch">查询</el-button> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button class="diy-button--reset" size="small" @click="resetForm('searchForm')">重置</el-button> |
|
|
|
<el-button class="diy-button--reset" |
|
|
|
size="small" |
|
|
|
@click="resetForm('searchForm')">重置</el-button> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
<el-card class="resi-card-table"> |
|
|
|
|
|
|
|
<el-table |
|
|
|
:data="tableData" |
|
|
|
row-key="id" |
|
|
|
v-loading="tableLoading" |
|
|
|
border |
|
|
|
:height="tableHeight" |
|
|
|
style="width: 100%" |
|
|
|
class="resi-table" |
|
|
|
> |
|
|
|
<el-table-column label="序号" type="index" align="center" width="50"> |
|
|
|
|
|
|
|
<el-table :data="tableData" |
|
|
|
row-key="id" |
|
|
|
v-loading="tableLoading" |
|
|
|
border |
|
|
|
:height="tableHeight" |
|
|
|
style="width: 100%" |
|
|
|
class="resi-table"> |
|
|
|
<el-table-column label="序号" |
|
|
|
type="index" |
|
|
|
align="center" |
|
|
|
width="50"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
v-for="item in tableHeader" |
|
|
|
:key="item.columnName" |
|
|
|
:prop="item.columnName" |
|
|
|
:label="item.label" |
|
|
|
align="center" |
|
|
|
min-width="180" |
|
|
|
> |
|
|
|
<el-table-column v-for="item in tableHeader" |
|
|
|
:key="item.columnName" |
|
|
|
:prop="item.columnName" |
|
|
|
:label="item.label" |
|
|
|
align="center" |
|
|
|
min-width="180"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-image |
|
|
|
v-if="filterImage(item.columnName)" |
|
|
|
style="width: 70px; height: 70px" |
|
|
|
:src="handleFilterSpan(scope.row, item) " |
|
|
|
fit="fill"></el-image> |
|
|
|
<el-image v-if="filterImage(item.columnName)" |
|
|
|
style="width: 70px; height: 70px" |
|
|
|
:src="handleFilterSpan(scope.row, item) " |
|
|
|
fit="fill"></el-image> |
|
|
|
<span v-else>{{ handleFilterSpan(scope.row, item) }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column fixed="right" label="操作" align="center" width="120"> |
|
|
|
<el-table-column fixed="right" |
|
|
|
label="操作" |
|
|
|
align="center" |
|
|
|
width="120"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button |
|
|
|
@click="handleLook(scope.row)" |
|
|
|
type="text" |
|
|
|
size="small" |
|
|
|
class="div-table-button--detail" |
|
|
|
>{{(scope.row.status === 'show'&&'隐藏') || '显示'}}</el-button |
|
|
|
> |
|
|
|
<el-button |
|
|
|
@click="handleEdit(scope.row)" |
|
|
|
type="text" |
|
|
|
size="small" |
|
|
|
class="div-table-button--edit" |
|
|
|
>修改</el-button |
|
|
|
> |
|
|
|
<el-button @click="handleLook(scope.row)" |
|
|
|
type="text" |
|
|
|
size="small" |
|
|
|
class="div-table-button--detail">{{(scope.row.status === 'show'&&'隐藏') || '显示'}}</el-button> |
|
|
|
<el-button @click="handleEdit(scope.row)" |
|
|
|
type="text" |
|
|
|
size="small" |
|
|
|
class="div-table-button--edit">修改</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<div> |
|
|
|
<el-pagination |
|
|
|
@size-change="handleSizeChange" |
|
|
|
@current-change="handleCurrentChange" |
|
|
|
:current-page.sync="currentPage" |
|
|
|
:page-sizes="[20, 50, 100, 200]" |
|
|
|
:page-size="pageSize" |
|
|
|
layout="sizes, prev, pager, next, total" |
|
|
|
:total="total" |
|
|
|
> |
|
|
|
<el-pagination @size-change="handleSizeChange" |
|
|
|
@current-change="handleCurrentChange" |
|
|
|
:current-page.sync="currentPage" |
|
|
|
:page-sizes="[20, 50, 100, 200]" |
|
|
|
:page-size="pageSize" |
|
|
|
layout="sizes, prev, pager, next, total" |
|
|
|
:total="total"> |
|
|
|
</el-pagination> |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
|
|
|
|
<el-dialog |
|
|
|
title="居民类别配置" |
|
|
|
:visible.sync="dialogVisible" |
|
|
|
width="50%" |
|
|
|
top="5vh" |
|
|
|
append-to-body |
|
|
|
class="dialog-h" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:before-close="handlerCancle" |
|
|
|
> |
|
|
|
<el-form label-width="150px" :model="form" :rules="rules" ref="ruleForm" class="dialog-h-content scroll-h"> |
|
|
|
<el-dialog title="居民类别配置" |
|
|
|
:visible.sync="dialogVisible" |
|
|
|
width="50%" |
|
|
|
top="5vh" |
|
|
|
append-to-body |
|
|
|
class="dialog-h" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:before-close="handlerCancle"> |
|
|
|
<el-form label-width="150px" |
|
|
|
:model="form" |
|
|
|
:rules="rules" |
|
|
|
ref="ruleForm" |
|
|
|
class="dialog-h-content scroll-h"> |
|
|
|
<el-form-item label="类别名称"> |
|
|
|
<el-input v-model="form.label" size="small" style="width: 180px;" disabled></el-input> |
|
|
|
<el-input v-model="form.label" |
|
|
|
size="small" |
|
|
|
style="width: 180px;" |
|
|
|
disabled></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="管理平台图标" prop="managementIcon"> |
|
|
|
<el-form-item label="管理平台图标" |
|
|
|
prop="managementIcon"> |
|
|
|
<el-upload class="avatar-uploader" |
|
|
|
:action="uploadUlr" |
|
|
|
:data="{customerId:customerId}" |
|
|
|
:show-file-list="false" |
|
|
|
:on-success="(response, file, fileList) => handleImgSuccess('managementIcon', response, file, fileList)" |
|
|
|
:before-upload="beforeImgUpload"> |
|
|
|
:action="uploadUlr" |
|
|
|
:data="{customerId:customerId}" |
|
|
|
:show-file-list="false" |
|
|
|
:on-success="(response, file, fileList) => handleImgSuccess('managementIcon', response, file, fileList)" |
|
|
|
:before-upload="beforeImgUpload"> |
|
|
|
<img v-if="form.managementIcon" |
|
|
|
:src="form.managementIcon" |
|
|
|
style="width:70px;height:70px" |
|
|
|
class="function-icon"> |
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i> |
|
|
|
:src="form.managementIcon" |
|
|
|
style="width:70px;height:70px" |
|
|
|
class="function-icon"> |
|
|
|
<i v-else |
|
|
|
class="el-icon-plus avatar-uploader-icon"></i> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="数据平台图标" prop="dataIcon"> |
|
|
|
<el-form-item label="数据平台图标" |
|
|
|
prop="dataIcon"> |
|
|
|
<el-upload class="avatar-uploader" |
|
|
|
:action="uploadUlr" |
|
|
|
:data="{customerId:customerId}" |
|
|
|
:show-file-list="false" |
|
|
|
:on-success="(response, file, fileList) => handleImgSuccess('dataIcon', response, file, fileList)" |
|
|
|
:before-upload="beforeImgUpload"> |
|
|
|
:action="uploadUlr" |
|
|
|
:data="{customerId:customerId}" |
|
|
|
:show-file-list="false" |
|
|
|
:on-success="(response, file, fileList) => handleImgSuccess('dataIcon', response, file, fileList)" |
|
|
|
:before-upload="beforeImgUpload"> |
|
|
|
<img v-if="form.dataIcon" |
|
|
|
:src="form.dataIcon" |
|
|
|
style="width:70px;height:70px" |
|
|
|
class="function-icon"> |
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i> |
|
|
|
:src="form.dataIcon" |
|
|
|
style="width:70px;height:70px" |
|
|
|
class="function-icon"> |
|
|
|
<i v-else |
|
|
|
class="el-icon-plus avatar-uploader-icon"></i> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="房屋显示图标" prop="houseShowIcon"> |
|
|
|
<el-form-item label="房屋显示图标" |
|
|
|
prop="houseShowIcon"> |
|
|
|
<el-upload class="avatar-uploader" |
|
|
|
:action="uploadUlr" |
|
|
|
:data="{customerId:customerId}" |
|
|
|
:show-file-list="false" |
|
|
|
:on-success="(response, file, fileList) => handleImgSuccess('houseShowIcon', response, file, fileList)" |
|
|
|
:before-upload="beforeImgUpload"> |
|
|
|
:action="uploadUlr" |
|
|
|
:data="{customerId:customerId}" |
|
|
|
:show-file-list="false" |
|
|
|
:on-success="(response, file, fileList) => handleImgSuccess('houseShowIcon', response, file, fileList)" |
|
|
|
:before-upload="beforeImgUpload"> |
|
|
|
<img v-if="form.houseShowIcon" |
|
|
|
:src="form.houseShowIcon" |
|
|
|
style="width:70px;height:70px" |
|
|
|
class="function-icon"> |
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i> |
|
|
|
:src="form.houseShowIcon" |
|
|
|
style="width:70px;height:70px" |
|
|
|
class="function-icon"> |
|
|
|
<i v-else |
|
|
|
class="el-icon-plus avatar-uploader-icon"></i> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="是否预警"> |
|
|
|
<el-switch v-model="form.warn"></el-switch> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="黄色预警"> |
|
|
|
<el-input-number v-model="form.level1" :min="0" size="small" label="描述文字" @change="handleLevelChange"></el-input-number> 人/楼宇 |
|
|
|
<el-input-number v-model="form.level1" |
|
|
|
:min="0" |
|
|
|
size="small" |
|
|
|
label="描述文字" |
|
|
|
@change="handleLevelChange"></el-input-number> 人楼栋 |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="红色预警"> |
|
|
|
<el-input-number v-model="form.level2" :min="form.level1" size="small" label="描述文字" ></el-input-number> 人/楼宇 |
|
|
|
<el-input-number v-model="form.level2" |
|
|
|
:min="form.level1" |
|
|
|
size="small" |
|
|
|
label="描述文字"></el-input-number> 人/楼栋 |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<div class="resi-btns"> |
|
|
|
<el-button size="small" @click="handlerCancle">取消</el-button> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
size="small" |
|
|
|
:loading="btnLoading" |
|
|
|
@click="handleSUbmit" |
|
|
|
>提交</el-button |
|
|
|
> |
|
|
|
<el-button size="small" |
|
|
|
@click="handlerCancle">取消</el-button> |
|
|
|
<el-button type="primary" |
|
|
|
size="small" |
|
|
|
:loading="btnLoading" |
|
|
|
@click="handleSUbmit">提交</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
@ -194,7 +204,7 @@ import axios from 'axios' |
|
|
|
import Sortable from 'sortablejs' |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
tableLoading: false, |
|
|
|
btnLoading: false, |
|
|
@ -214,7 +224,7 @@ export default { |
|
|
|
{ |
|
|
|
label: '是', |
|
|
|
value: 1 |
|
|
|
},{ |
|
|
|
}, { |
|
|
|
label: '否', |
|
|
|
value: 0 |
|
|
|
} |
|
|
@ -223,7 +233,7 @@ export default { |
|
|
|
{ |
|
|
|
label: '黄色预警', |
|
|
|
value: 1 |
|
|
|
},{ |
|
|
|
}, { |
|
|
|
label: '红色预警', |
|
|
|
value: 2 |
|
|
|
} |
|
|
@ -296,12 +306,12 @@ export default { |
|
|
|
|
|
|
|
...mapGetters(['clientHeight', 'iframeHeight']) |
|
|
|
}, |
|
|
|
async created() { |
|
|
|
async created () { |
|
|
|
this.customerId = localStorage.getItem('customerId') |
|
|
|
this.getTableData() |
|
|
|
this.pageLoading = true |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted () { |
|
|
|
this.rowDrop() |
|
|
|
this.$nextTick(() => { |
|
|
|
this.sHeight = this.$refs.searchCard.$el.offsetHeight + 230 |
|
|
@ -309,11 +319,11 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
rowDrop() { |
|
|
|
rowDrop () { |
|
|
|
const tbody = document.querySelector('.el-table__body-wrapper tbody') |
|
|
|
const _this = this |
|
|
|
Sortable.create(tbody, { |
|
|
|
onEnd({ newIndex, oldIndex }) { |
|
|
|
onEnd ({ newIndex, oldIndex }) { |
|
|
|
const currRow = _this.tableData.splice(oldIndex, 1)[0] |
|
|
|
_this.tableData.splice(newIndex, 0, currRow) |
|
|
|
console.log('rowdrap', newIndex, oldIndex) |
|
|
@ -322,25 +332,25 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
computedWidth(label) { |
|
|
|
computedWidth (label) { |
|
|
|
const wd = 20 * label.length |
|
|
|
return wd > 80 ? wd : 80 |
|
|
|
}, |
|
|
|
filterImage(item) { |
|
|
|
filterImage (item) { |
|
|
|
const arr = ['managementIcon', 'dataIcon', 'houseShowIcon'] |
|
|
|
return arr.includes(item) |
|
|
|
}, |
|
|
|
handleSizeChange(val) { |
|
|
|
handleSizeChange (val) { |
|
|
|
console.log(`每页 ${val} 条`) |
|
|
|
this.pageSize = val |
|
|
|
this.getTableData() |
|
|
|
}, |
|
|
|
handleCurrentChange(val) { |
|
|
|
handleCurrentChange (val) { |
|
|
|
console.log(`当前页: ${val}`) |
|
|
|
this.currentPage = val |
|
|
|
this.getTableData() |
|
|
|
}, |
|
|
|
handleFilterSpan(row, item) { |
|
|
|
handleFilterSpan (row, item) { |
|
|
|
let _val = '' |
|
|
|
if (item.options && item.options.length > 0) { |
|
|
|
item.options.forEach((n) => { |
|
|
@ -349,23 +359,23 @@ export default { |
|
|
|
} |
|
|
|
return _val || row[item.columnName] |
|
|
|
}, |
|
|
|
resetForm(formName) { |
|
|
|
|
|
|
|
resetForm (formName) { |
|
|
|
|
|
|
|
this.isWarn = '' |
|
|
|
this.level = '' |
|
|
|
this.handleSearch(); |
|
|
|
}, |
|
|
|
handleSearch(val) { |
|
|
|
handleSearch (val) { |
|
|
|
console.log('searchhh--', val) |
|
|
|
this.currentPage = 1 |
|
|
|
this.conditions = val |
|
|
|
this.getTableData() |
|
|
|
}, |
|
|
|
handleLevelChange(val) { |
|
|
|
handleLevelChange (val) { |
|
|
|
if (val > this.form.level2) this.form.level2 = val |
|
|
|
}, |
|
|
|
|
|
|
|
handlerCancle() { |
|
|
|
|
|
|
|
handlerCancle () { |
|
|
|
this.dialogVisible = false |
|
|
|
}, |
|
|
|
beforeImgUpload (file) { |
|
|
@ -391,7 +401,7 @@ export default { |
|
|
|
this.$message.error(res.msg) |
|
|
|
} |
|
|
|
}, |
|
|
|
async handleLook(row) { |
|
|
|
async handleLook (row) { |
|
|
|
const _show = { |
|
|
|
show: 'hidden', |
|
|
|
hidden: 'show' |
|
|
@ -413,18 +423,18 @@ export default { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
async handleEdit(row) { |
|
|
|
|
|
|
|
this.form = { |
|
|
|
...row, |
|
|
|
warn: row.warn == '1' ? true : false, |
|
|
|
level1: row.level1 || 0, |
|
|
|
async handleEdit (row) { |
|
|
|
|
|
|
|
this.form = { |
|
|
|
...row, |
|
|
|
warn: row.warn == '1' ? true : false, |
|
|
|
level1: row.level1 || 0, |
|
|
|
level2: row.level2 || 0, |
|
|
|
level3: row.level3 || 0 |
|
|
|
level3: row.level3 || 0 |
|
|
|
} |
|
|
|
this.dialogVisible = true |
|
|
|
}, |
|
|
|
async handleSUbmit() { |
|
|
|
async handleSUbmit () { |
|
|
|
this.$refs.ruleForm.validate(async (valid) => { |
|
|
|
if (valid) { |
|
|
|
if (this.form.warn) { |
|
|
@ -443,20 +453,20 @@ export default { |
|
|
|
} else { |
|
|
|
this.dialogVisible = false |
|
|
|
this.getTableData() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
this.btnLoading = false |
|
|
|
this.btnLoading = false |
|
|
|
} else { |
|
|
|
console.log('error submit!!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
handleDel(row) { |
|
|
|
handleDel (row) { |
|
|
|
let params = { |
|
|
|
formCode: 'resi_base_info', |
|
|
|
icResiUserId: row.icResiUserId |
|
|
@ -479,8 +489,8 @@ export default { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
sortData() { |
|
|
|
const _data = this.tableData.map((item, index)=> { |
|
|
|
sortData () { |
|
|
|
const _data = this.tableData.map((item, index) => { |
|
|
|
return { |
|
|
|
id: item.id, |
|
|
|
sort: index |
|
|
@ -500,7 +510,7 @@ export default { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
getTableHeader() { |
|
|
|
getTableHeader () { |
|
|
|
this.$http |
|
|
|
.post('/oper/customize/icform/tableheaders', { |
|
|
|
formCode: 'resi_base_info' |
|
|
@ -516,7 +526,7 @@ export default { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
async getTableData() { |
|
|
|
async getTableData () { |
|
|
|
this.tableLoading = true |
|
|
|
let params = { |
|
|
|
// formCode: 'resi_base_info', |
|
|
@ -540,7 +550,7 @@ export default { |
|
|
|
}) |
|
|
|
this.tableLoading = false |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
@ -580,14 +590,13 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
.avatar-uploader { |
|
|
|
::v-deep |
|
|
|
.el-upload { |
|
|
|
::v-deep .el-upload { |
|
|
|
cursor: pointer; |
|
|
|
position: relative; |
|
|
|
overflow: hidden; |
|
|
|
} |
|
|
|
.el-upload:hover { |
|
|
|
border-color: #409EFF; |
|
|
|
border-color: #409eff; |
|
|
|
} |
|
|
|
.avatar { |
|
|
|
width: 70px; |
|
|
@ -605,8 +614,6 @@ export default { |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.resi-btns { |
|
|
|
margin-top: 20px; |
|
|
|