7 changed files with 1557 additions and 333 deletions
@ -0,0 +1,388 @@ |
|||
<template> |
|||
<div> |
|||
<div class="dialog-h-content scroll-h" |
|||
:class="{ 'visiual-form': source === 'visiual' }"> |
|||
<el-form ref="ref_add_form" |
|||
:inline="true" |
|||
:model="formData" |
|||
:rules="dataRule" |
|||
class="div_form"> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="info-prop" |
|||
v-if="formType == 'detail'||formType == 'edit'"> |
|||
<span class="info-title-2">所属组织: </span> |
|||
<span>{{ formData.agencyName || "--" }}</span> |
|||
</div> |
|||
<el-form-item v-else |
|||
label="所属组织" |
|||
label-width="100px" |
|||
prop="agencyId"> |
|||
<el-cascader ref="ref_cascader_agency" |
|||
class="width-two" |
|||
v-model="formData.agencyId" |
|||
:options="optionsA" |
|||
@change="handleChangeAngency" |
|||
:props="{ checkStrictly: true, emitPath: false,children:'subAgencyList',label:'agencyName',value:'agencyId'}" |
|||
clearable /> |
|||
|
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" |
|||
v-if="formType == 'detail'"> |
|||
<span class="info-title-2">姓名: </span> |
|||
<span>{{ formData.name || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" |
|||
label="姓名" |
|||
prop="name" |
|||
v-else> |
|||
<el-input v-model="formData.name" |
|||
placeholder="请输入" |
|||
clearable></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" |
|||
v-if="formType == 'detail'"> |
|||
<span class="info-title-2">联系电话: </span> |
|||
<span>{{ formData.mobile || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" |
|||
label="联系电话" |
|||
prop="mobile" |
|||
v-else> |
|||
<el-input v-model="formData.mobile" |
|||
placeholder="请输入" |
|||
clearable></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-row> |
|||
|
|||
<el-col :span="12"> |
|||
<div class="info-prop" |
|||
v-if="formType == 'detail'"> |
|||
<span class="info-title-2">身份证号: </span> |
|||
<span>{{ formData.idNum || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" |
|||
label="证件号" |
|||
prop="idNum" |
|||
v-else> |
|||
<el-input v-model="formData.idNum" |
|||
placeholder="请输入" |
|||
clearable></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
<el-col :span="12"> |
|||
<div class="info-prop" |
|||
v-if="formType == 'detail'"> |
|||
<span class="info-title-2">类型: </span> |
|||
<span>{{ formData.dormitoryTypeName || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" |
|||
label="类型" |
|||
prop="dormitoryType" |
|||
v-else> |
|||
<el-select v-model="formData.dormitoryType" |
|||
clearable> |
|||
<el-option v-for="item in dormitoryTypeList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="info-prop" |
|||
v-if="formType == 'detail'"> |
|||
<span class="info-title-2">管理范围: </span> |
|||
<span>{{ formData.rangeName || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" |
|||
label="管理范围" |
|||
prop="rangeList" |
|||
v-else> |
|||
|
|||
<el-cascader ref="cascaderUnit" |
|||
class="width-two" |
|||
v-model="formData.rangeList" |
|||
:options="optionsRange" |
|||
@change="handleChangeRange" |
|||
:props="props" |
|||
clearable /> |
|||
|
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
</el-form> |
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button size="small" |
|||
@click="handleCancle">取 消</el-button> |
|||
<el-button size="small" |
|||
type="primary" |
|||
:disabled="btnDisable" |
|||
@click="handleComfirm">确 定</el-button> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { Loading } from "element-ui"; // 引入Loading服务 |
|||
import { requestPost, requestGet } from "@/js/dai/request"; |
|||
import nextTick from "dai-js/tools/nextTick"; |
|||
import { dormitoryTypeList, } from "@/js/columns/constants"; |
|||
|
|||
let loading; // 加载动画 |
|||
|
|||
export default { |
|||
props: { |
|||
formType: { |
|||
type: String, |
|||
default: "add", |
|||
}, |
|||
source: { |
|||
//展示来源:manage 管理平台 visiual 可视化平台 |
|||
type: String, |
|||
default: "manage", |
|||
}, |
|||
}, |
|||
|
|||
data () { |
|||
return { |
|||
btnDisable: false, |
|||
optionsA: [], |
|||
selManageList: [], |
|||
optionsRange: [], |
|||
props: { |
|||
multiple: true, |
|||
checkStrictly: true, |
|||
// emitPath: true, |
|||
children: 'subAgencyList', |
|||
label: 'agencyName', |
|||
value: 'agencyId' |
|||
}, |
|||
|
|||
formData: { |
|||
agencyId: '',//所属组织 |
|||
name: "", |
|||
mobile: "", |
|||
idNum: "", |
|||
dormitoryType: "", |
|||
|
|||
rangeList: [] |
|||
|
|||
}, |
|||
dormitoryTypeList, |
|||
|
|||
dataRule: { |
|||
agencyId: [{ required: true, message: "所属组织不能为空", trigger: "change" }], |
|||
name: [{ required: true, message: "姓名不能为空", trigger: "change" }], |
|||
mobile: [{ required: true, message: "联系电话不能为空", trigger: "change" }], |
|||
idNum: [{ required: true, message: "身份证号不能为空", trigger: "change" }], |
|||
|
|||
dormitoryType: [ |
|||
{ required: true, message: "类型不能为空", trigger: "change" }, |
|||
], |
|||
rangeList: [ |
|||
{ required: true, message: "管理范围不能为空", trigger: "change" }, |
|||
], |
|||
}, |
|||
|
|||
}; |
|||
}, |
|||
|
|||
watch: {}, |
|||
|
|||
components: {}, |
|||
async created () { |
|||
|
|||
|
|||
}, |
|||
async mounted () { |
|||
this.startLoading(); |
|||
await this.endLoading(); |
|||
}, |
|||
|
|||
methods: { |
|||
async initForm (type, row) { |
|||
this.formType = type; |
|||
if (this.formType === 'add') { |
|||
await this.getGridList() |
|||
} else { |
|||
await this.getDetail(row.categorizedResiId); |
|||
} |
|||
|
|||
|
|||
|
|||
}, |
|||
async getDetail (categorizedResiId) { |
|||
const url = `/actual/base/resiCategorized/disability/detail/${categorizedResiId}`; |
|||
const { data, code, msg } = await requestGet(url); |
|||
if (code === 0) { |
|||
console.log(data); |
|||
this.formData = { ...data }; |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
handleChangeAngency (val) { |
|||
|
|||
let obj = this.$refs["ref_cascader_agency"].getCheckedNodes()[0].data; |
|||
console.log('改变组织', obj) |
|||
if (obj) { |
|||
if (obj.level !== 'community') { |
|||
this.$message.info('请选择社区') |
|||
this.formData.agencyId = [] |
|||
return false |
|||
} else { |
|||
this.formData.agencyId = val |
|||
} |
|||
} |
|||
}, |
|||
|
|||
handleChangeRange (val) { |
|||
console.log('改变范围', val) |
|||
// this.sarr = [] |
|||
// const map = new Map(); |
|||
// this.getLastItem( |
|||
// this.orgOptions, |
|||
// val, |
|||
// "agencyId" |
|||
// ); |
|||
// this.level = this.sarr[this.sarr.length - 1].level |
|||
// this.getValiheList() |
|||
}, |
|||
getGridList () { |
|||
const { user } = this.$store.state |
|||
this.dataListLoading = true |
|||
const params = { |
|||
agencyId: user.agencyId, |
|||
client: 'gov' |
|||
} |
|||
this.$http |
|||
// .post('/gov/org/userhouse/service/serviceScopeTree') |
|||
// .post('/data/aggregator/org/agencytree', params) |
|||
.post('/gov/org/customeragency/staffinagencylist') |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} else { |
|||
console.log('获取查询详情成功', res.data) |
|||
let { agencyList, subAgencyList } = res.data |
|||
|
|||
const _arr = [{ ...agencyList, subAgencyList: [...subAgencyList] }] |
|||
this.optionsA = this.deepTree(_arr) |
|||
this.optionsRange = this.deepTree(_arr) |
|||
console.log('optionsA----', this.optionsA) |
|||
} |
|||
}) |
|||
.catch(() => { |
|||
this.dataListLoading = false |
|||
return this.$message.error('网络错误') |
|||
}) |
|||
this.dataListLoading = false |
|||
}, |
|||
deepTree (arr) { |
|||
if (Array.isArray(arr)) { |
|||
return arr.map(item => { |
|||
return { |
|||
...item, |
|||
subAgencyList: item.subAgencyList.length > 0 && this.deepTree(item.subAgencyList) || null |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
|
|||
|
|||
async handleComfirm () { |
|||
this.$refs["ref_add_form"].validate(async (valid) => { |
|||
if (!valid) { |
|||
return false; |
|||
} |
|||
if (this.formType == 'edit') { |
|||
// this.formData.categorizedResiId = this.scopeId |
|||
} |
|||
console.log(this.formData); |
|||
const url = |
|||
this.formType === "edit" |
|||
? "/actual/base/resiCategorized/disability/update" |
|||
: "/actual/base/resiCategorized/disability/create"; |
|||
|
|||
const { data, code, msg } = await requestPost(url, this.formData); |
|||
if (code === 0) { |
|||
this.$message.success( |
|||
this.formType == "add" ? "添加成功" : "修改成功" |
|||
); |
|||
this.resetData(); |
|||
this.$emit("handleComfirm"); |
|||
} else if (code >= 8000) { |
|||
this.$message.error(msg); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
handleCancle () { |
|||
this.resetData(); |
|||
this.$emit("handleClose"); |
|||
}, |
|||
|
|||
resetData () { |
|||
this.formData = {}; |
|||
}, |
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: "正在加载……", // 加载中需要显示的文字 |
|||
background: "rgba(0,0,0,.7)", // 背景颜色 |
|||
}); |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
if (loading) { |
|||
loading.close(); |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
@import "@/assets/scss/modules/management/form-main.scss"; |
|||
@import "@/assets/scss/modules/visual/a_customize.scss"; |
|||
@import "@/assets/scss/modules/management/detail-main.scss"; |
|||
|
|||
.form-item::v-deep .el-form-item__label { |
|||
color: #fff; |
|||
} |
|||
|
|||
.info-prop { |
|||
margin-top: 29px; |
|||
.info-title-2 { |
|||
width: 100px; |
|||
text-align: right; |
|||
display: inline-block; |
|||
padding-right: 10px; |
|||
} |
|||
} |
|||
|
|||
.width-two { |
|||
width: 553px; |
|||
} |
|||
</style> |
|||
|
|||
|
@ -0,0 +1,725 @@ |
|||
<template> |
|||
<div class="g-main"> |
|||
<div> |
|||
<div class="m-search"> |
|||
<el-form :inline="true" |
|||
:model="formData" |
|||
ref="ref_searchform" |
|||
:label-width="'100px'"> |
|||
<el-form-item label="姓名"> |
|||
<el-input v-model="formData.name" |
|||
placeholder="请输入" |
|||
size="small" |
|||
class="u-item-width-normal" |
|||
clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="联系电话"> |
|||
<el-input v-model="formData.mobile" |
|||
placeholder="请输入" |
|||
size="small" |
|||
class="u-item-width-normal" |
|||
clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="证件号"> |
|||
<el-input v-model="formData.idNum" |
|||
placeholder="请输入" |
|||
size="small" |
|||
class="u-item-width-normal" |
|||
clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="类别"> |
|||
<el-select v-model="formData.dormitoryType" |
|||
placeholder="请输入" |
|||
size="small" |
|||
class="u-item-width-normal" |
|||
clearable> |
|||
<el-option v-for="item in dormitoryTypeList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item prop="villageId"> |
|||
<div class="resi-cell"> |
|||
<div class="resi-cell-value"> |
|||
<span style="width:100px;text-align: right;padding-right:14px;display: inline-block; ">所属房屋:</span> |
|||
<el-select v-model.trim="formData.villageId" |
|||
placeholder="请选择小区" |
|||
size="small" |
|||
filterable |
|||
clearable |
|||
class="u-item-width-communitycascader" |
|||
@clear="handleClearVillage" |
|||
@change="handleChangeV"> |
|||
<el-option v-for="item in optionsV" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
<el-select v-model.trim="formData.buildId" |
|||
placeholder="楼号" |
|||
size="small" |
|||
filterable |
|||
clearable |
|||
style="margin-left: 5px" |
|||
class="u-item-width-buildcascader" |
|||
:disabled="changeVDisabled" |
|||
@clear="handleClearBuild" |
|||
@change="handleChangeB"> |
|||
<el-option v-for="item in optionsB" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
<el-select v-model.trim="formData.unitId" |
|||
:disabled="changeBDisabled" |
|||
placeholder="单元" |
|||
size="small" |
|||
filterable |
|||
clearable |
|||
style="margin-left: 5px" |
|||
class="u-item-width-buildcascader" |
|||
@click="handleClearDan" |
|||
@change="handleChangeD"> |
|||
<el-option v-for="item in optionsD" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
</div> |
|||
</div> |
|||
</el-form-item> |
|||
<el-row type="flex"> |
|||
<el-col :span="24" |
|||
align="right"> |
|||
<el-button style="margin-left: 30px" |
|||
size="small" |
|||
type="primary " |
|||
@click="handleSearch">查询</el-button> |
|||
<el-button style="margin-left: 10px" |
|||
is-plain |
|||
class="diy-button--white el-button--default" |
|||
size="small" |
|||
@click="resetSearch">重置</el-button> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
</div> |
|||
|
|||
<div class="m-table"> |
|||
<div class="div_btn"> |
|||
<div class="div_btn_left"> |
|||
<el-button size="small" |
|||
@click="handleAdd" |
|||
type="primary" |
|||
icon="el-icon-plus">新增</el-button> |
|||
</div> |
|||
<el-button @click="handleExport" |
|||
type="primary" |
|||
size="small" |
|||
class="diy-button--white el-button--default">导出</el-button> |
|||
<el-button @click="onDeleteBatch" |
|||
style="margin: 0 10px" |
|||
size="small" |
|||
type="primary"> |
|||
批量删除 |
|||
</el-button> |
|||
<el-upload :headers="$getElUploadHeaders()" |
|||
ref="upload" |
|||
class="upload-btn" |
|||
action="uploadUlr" |
|||
:limit="1" |
|||
:accept="'.xls,.xlsx'" |
|||
:with-credentials="true" |
|||
:show-file-list="false" |
|||
:auto-upload="true" |
|||
:before-upload="beforeExcelUpload" |
|||
:http-request="uploadHttpRequest"> |
|||
<el-button type="primary" |
|||
size="small" |
|||
class="diy-button--white el-button--default" |
|||
:loading="importLoading">导入</el-button> |
|||
</el-upload> |
|||
<el-button style="margin-left: 10px" |
|||
class="diy-button--blue" |
|||
size="small" |
|||
@click="handleExportModule('room')">下载模板</el-button> |
|||
</div> |
|||
|
|||
<el-table :data="tableData" |
|||
border |
|||
v-loading="tableLoading" |
|||
class="m-table-item" |
|||
style="width: 100%" |
|||
:height="maxTableHeight" |
|||
@selection-change="onMultiSelection"> |
|||
<el-table-column type="selection" |
|||
fixed="left" |
|||
align="center" |
|||
width="50" /> |
|||
|
|||
<el-table-column label="序号" |
|||
fixed="left" |
|||
type="index" |
|||
align="center" |
|||
width="50" /> |
|||
|
|||
<el-table-column prop="prefectureName" |
|||
align="center" |
|||
width="150" |
|||
label="所属组织" |
|||
:show-overflow-tooltip="true"> |
|||
</el-table-column> |
|||
<el-table-column prop="name" |
|||
align="center" |
|||
width="100" |
|||
label="姓名" |
|||
:show-overflow-tooltip="true"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="mobile" |
|||
align="center" |
|||
width="200" |
|||
label="联系电话" |
|||
:show-overflow-tooltip="true"> |
|||
</el-table-column> |
|||
<el-table-column prop="idNum" |
|||
align="center" |
|||
width="200" |
|||
label="身份证号" |
|||
:show-overflow-tooltip="true"> |
|||
</el-table-column> |
|||
<el-table-column prop="genderName" |
|||
align="center" |
|||
width="80" |
|||
label="类型" |
|||
:show-overflow-tooltip="true"> |
|||
<template slot-scope="scope"> |
|||
<span>{{ |
|||
scope.row.gender |
|||
? scope.row.gender == "0" |
|||
? "楼长" |
|||
: scope.row.gender == "1" |
|||
? "单元长" |
|||
: "--" |
|||
: "--" |
|||
}}</span> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="currentResidence" |
|||
align="center" |
|||
min-width="200" |
|||
label="管理小区" |
|||
:show-overflow-tooltip="true"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column fixed="right" |
|||
label="操作" |
|||
align="center" |
|||
width="220"> |
|||
<template slot-scope="scope"> |
|||
<el-button @click="handleDetail(scope.row)" |
|||
type="text" |
|||
size="small">查看</el-button> |
|||
<!-- v-if="scope.row.serviceStatus === 'in_service'" --> |
|||
<el-button @click="handleEdit(scope.row)" |
|||
type="text" |
|||
size="small">编辑</el-button> |
|||
|
|||
<el-button @click="handleDel(scope.row)" |
|||
type="text" |
|||
size="small">删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div> |
|||
<el-pagination @size-change="handleSizeChange" |
|||
@current-change="handleCurrentChange" |
|||
:current-page.sync="pageNo" |
|||
:page-sizes="[20, 50, 100, 200]" |
|||
:page-size="parseInt(pageSize)" |
|||
layout="sizes, prev, pager, next, total" |
|||
:total="total"> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<el-dialog v-if="showAdd" |
|||
:visible.sync="showAdd" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="addDiaTitle" |
|||
:modal-append-to-body="false" |
|||
width="720px" |
|||
top="5vh" |
|||
class="dialog-h" |
|||
@closed="showAdd = false"> |
|||
<add-form ref="ref_add_form" |
|||
:formType="formType" |
|||
@handleComfirm="handleComfirm" |
|||
@handleClose="handleClose"></add-form> |
|||
</el-dialog> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { dormitoryTypeList } from "@/js/columns/constants"; |
|||
import { mapGetters } from "vuex"; |
|||
import axios from "axios"; |
|||
import addForm from "./addForm"; |
|||
|
|||
// import detailForm from "./detailForm"; |
|||
|
|||
export default { |
|||
// detailForm |
|||
components: { addForm }, |
|||
|
|||
data () { |
|||
|
|||
return { |
|||
tableLoading: false, |
|||
user: {}, |
|||
agencyId: "", |
|||
searchH: 170, |
|||
tableData: [], |
|||
dormitoryTypeList,//类型数组 |
|||
|
|||
optionsV: [], |
|||
optionsB: [], |
|||
optionsD: [], |
|||
|
|||
formData: { |
|||
name: '', |
|||
mobile: '', |
|||
idNum: '', |
|||
dormitoryType: '',//楼长1 单元长0 |
|||
|
|||
villageId: '',//小区id |
|||
buildId: '',//楼栋id |
|||
unitId: '',//单元id |
|||
}, |
|||
pageNo: 1, |
|||
pageSize: window.localStorage.getItem("pageSize") || 20, |
|||
total: 1, |
|||
|
|||
showAdd: false, |
|||
showEdit: false, |
|||
// showDetail: false, |
|||
formType: "add", |
|||
addDiaTitle: "新增", |
|||
detailDiaTitle: "详情", |
|||
|
|||
multiSelection: [], // 多选结果 |
|||
importLoading: false, |
|||
|
|||
}; |
|||
}, |
|||
computed: { |
|||
maxTableHeight () { |
|||
const h = this.clientHeight - this.searchH - 330 + this.iframeHeight; |
|||
const _h = this.clientHeight - 330 - this.searchH; |
|||
return this.$store.state.inIframe ? h : _h; |
|||
}, |
|||
...mapGetters(["clientHeight", "iframeHeight"]), |
|||
|
|||
changeVDisabled () { |
|||
return !this.formData.villageId |
|||
}, |
|||
changeBDisabled () { |
|||
return !this.formData.buildId |
|||
}, |
|||
|
|||
}, |
|||
watch: {}, |
|||
async created () { |
|||
this.getValiheList() |
|||
}, |
|||
mounted () { |
|||
console.log(this.$store.state); |
|||
this.user = this.$store.state.user; |
|||
this.agencyId = this.user.agencyId; |
|||
|
|||
this.getTableData(); |
|||
}, |
|||
methods: { |
|||
|
|||
handleChangeV (val) { |
|||
console.log('小区val', val) |
|||
this.formData.buildId = '' |
|||
this.formData.unitId = '' |
|||
this.getBuildList() |
|||
}, |
|||
handleChangeB (val) { |
|||
console.log('楼号val', val) |
|||
this.formData.unitId = '' |
|||
|
|||
this.getUniList() |
|||
}, |
|||
handleChangeD (val) { |
|||
console.log('单元val', val) |
|||
|
|||
}, |
|||
|
|||
|
|||
getValiheList () { |
|||
|
|||
this.$http |
|||
.post('/gov/org/icneighborhood/neighborhoodoption', { |
|||
gridId: '', |
|||
agencyId: '', |
|||
// agencyId: user.agencyId |
|||
}) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} else { |
|||
console.log('获取查询详情成功', res.data) |
|||
this.optionsV = res.data |
|||
} |
|||
}) |
|||
.catch(() => { |
|||
return this.$message.error('网络错误') |
|||
}) |
|||
}, |
|||
getBuildList () { |
|||
this.$http |
|||
.post('/gov/org/icbuilding/buildingoption', { |
|||
neighborHoodId: this.formData.villageId |
|||
}) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} else { |
|||
console.log('获取查询详情成功', res.data) |
|||
this.optionsB = res.data |
|||
} |
|||
}) |
|||
.catch(() => { |
|||
return this.$message.error('网络错误') |
|||
}) |
|||
}, |
|||
getUniList () { |
|||
this.$http |
|||
.post('/gov/org/icbuildingunit/unitoption', { |
|||
buildingId: this.formData.buildId |
|||
}) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} else { |
|||
console.log('获取查询详情成功', res.data) |
|||
this.optionsD = res.data |
|||
} |
|||
}) |
|||
.catch(() => { |
|||
return this.$message.error('网络错误') |
|||
}) |
|||
}, |
|||
|
|||
|
|||
handleClearVillage () { |
|||
this.formData.buildId = '' |
|||
|
|||
}, |
|||
handleClearBuild () { |
|||
this.formData.buildId = '' |
|||
this.formData.unitId = '' |
|||
|
|||
}, |
|||
handleClearDan () { |
|||
this.formData.unitId = '' |
|||
|
|||
}, |
|||
|
|||
// ------------------------------------事件------------------------------------------ |
|||
// 搜索事件 |
|||
handleSearch (val) { |
|||
console.log(this.formData); |
|||
this.pageNo = 1; |
|||
this.getTableData(); |
|||
}, |
|||
|
|||
// 调出新增组件 |
|||
async handleAdd () { |
|||
this.addDiaTitle = "新增"; |
|||
this.formType = "add"; |
|||
this.showAdd = true; |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_add_form.initForm("add"); |
|||
}); |
|||
}, |
|||
// 查看详情触发事件 |
|||
async handleDetail (row) { |
|||
this.addDiaTitle = "详情"; |
|||
this.formType = "detail"; |
|||
this.showAdd = true; |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_add_form.initForm("detail", row); |
|||
}); |
|||
}, |
|||
// 详情弹出框取消事件 |
|||
diaDetailClose () { |
|||
this.$refs.ref_detail_form.diaDestroy(); |
|||
this.showDetail = false; |
|||
}, |
|||
// 编辑触发事件 |
|||
async handleEdit (row) { |
|||
this.addDiaTitle = "编辑"; |
|||
this.formType = "edit"; |
|||
this.showAdd = true; |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_add_form.initForm("edit", row); |
|||
}); |
|||
}, |
|||
// 新增弹出框组件取消事件 |
|||
handleClose () { |
|||
this.formType = ""; |
|||
this.showAdd = false; |
|||
this.showDetail = false; |
|||
this.showEdit = false; |
|||
}, |
|||
// 新增弹出框组件确定事件 |
|||
handleComfirm () { |
|||
this.handleClose(); |
|||
this.pageNo = 1; |
|||
this.getTableData(); |
|||
}, |
|||
// 删除触发事件 |
|||
async handleDel (row) { |
|||
this.$confirm("确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning", |
|||
}) |
|||
.then(() => { |
|||
this.cancelFuwu([row.categorizedResiId]); |
|||
}) |
|||
.catch((err) => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
}); |
|||
}, |
|||
// 删除处理 |
|||
async cancelFuwu (id) { |
|||
const url = "/actual/base/resiCategorized/disability/deleteBatch"; |
|||
const { data, code, msg } = await requestPost(url, id); |
|||
if (code === 0) { |
|||
this.$message.success("删除成功!"); |
|||
this.getTableData(); |
|||
} else { |
|||
this.$message.error("操作失败!"); |
|||
} |
|||
}, |
|||
// 获取列表 |
|||
async getTableData () { |
|||
this.tableLoading = true; |
|||
const url = "/actual/base/resiCategorized/disability/page"; |
|||
const { pageSize, pageNo, formData } = this; |
|||
const { data, code, msg } = await requestPost(url, { |
|||
pageSize, |
|||
pageNo, |
|||
...formData, |
|||
}); |
|||
this.tableLoading = false; |
|||
if (code === 0) { |
|||
this.total = data.total || 0; |
|||
this.tableData = data.list; |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
// 导出 |
|||
async handleExport () { |
|||
const url = "/actual/base/resiCategorized/disability/export"; |
|||
const { pageSize, pageNo, formData } = this; |
|||
axios({ |
|||
url: window.SITE_CONFIG["apiURL"] + url, |
|||
method: "post", |
|||
data: { |
|||
pageSize, |
|||
pageNo, |
|||
...formData, |
|||
}, |
|||
responseType: "blob", |
|||
}) |
|||
.then((res) => { |
|||
let fileName = window.decodeURI( |
|||
res.headers["content-disposition"].split(";")[1].split("=")[1] |
|||
); |
|||
console.log("filename", fileName); |
|||
let blob = new Blob([res.data], { |
|||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
|||
}); |
|||
var url = window.URL.createObjectURL(blob); |
|||
var aLink = document.createElement("a"); |
|||
aLink.style.display = "none"; |
|||
aLink.href = url; |
|||
aLink.setAttribute("download", fileName); |
|||
document.body.appendChild(aLink); |
|||
aLink.click(); |
|||
document.body.removeChild(aLink); //下载完成移除元素 |
|||
window.URL.revokeObjectURL(url); //释放掉blob对象 |
|||
}) |
|||
.catch((err) => { |
|||
console.log("获取导出情失败", err); |
|||
return this.$message.error("网络错误"); |
|||
}); |
|||
}, |
|||
// 下载模板 |
|||
async handleExportModule () { |
|||
let url = |
|||
"/actual/base/resiCategorized/disability/downloadImportTemplate"; |
|||
let params = {}; |
|||
await this.$http({ |
|||
method: "get", |
|||
url, |
|||
responseType: "blob", |
|||
data: params, |
|||
}) |
|||
.then((res) => { |
|||
console.log("res----dddd", res); |
|||
// this.download(res.data, title + '.xls') |
|||
if (res.headers["content-disposition"]) { |
|||
let fileName = window.decodeURI( |
|||
res.headers["content-disposition"].split(";")[1].split("=")[1] |
|||
); |
|||
console.log("filename", fileName); |
|||
let blob = new Blob([res.data], { |
|||
type: "application/vnd.ms-excel", |
|||
}); |
|||
var url = window.URL.createObjectURL(blob); |
|||
var aLink = document.createElement("a"); |
|||
aLink.style.display = "none"; |
|||
aLink.href = url; |
|||
aLink.setAttribute("download", fileName); |
|||
document.body.appendChild(aLink); |
|||
aLink.click(); |
|||
document.body.removeChild(aLink); //下载完成移除元素 |
|||
window.URL.revokeObjectURL(url); //释放掉blob对象 |
|||
} else this.$message.error("下载失败"); |
|||
}) |
|||
.catch((err) => { |
|||
console.log("err", err); |
|||
return this.$message.error("网络错误"); |
|||
}); |
|||
}, |
|||
// 导入 |
|||
beforeExcelUpload (file) { |
|||
console.log("file", file); |
|||
const isType = file.type === "application/vnd.ms-excel"; |
|||
const isTypeComputer = |
|||
file.type === |
|||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; |
|||
const fileType = isType || isTypeComputer; |
|||
const isLt1M = file.size / 1024 / 1024 < 10; |
|||
if (!fileType) { |
|||
this.$message.error("上传文件只能是xls/xlsx格式!"); |
|||
} |
|||
|
|||
if (!isLt1M) { |
|||
this.$message.error("上传文件大小不能超过 10MB!"); |
|||
} |
|||
return fileType && isLt1M; |
|||
}, |
|||
|
|||
async uploadHttpRequest (file) { |
|||
this.$message({ |
|||
showClose: true, |
|||
dangerouslyUseHTMLString: true, |
|||
message: |
|||
"导入中,请到系统管理-<a id='clickA' style='cursor: pointer;'>导入记录</a>中查看进度", |
|||
duration: 3000, |
|||
}); |
|||
let than = this; |
|||
document.getElementById("clickA").addEventListener("click", function () { |
|||
than.$router.replace("/main/importRecord-index"); |
|||
}); |
|||
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|||
formData.append("file", file.file); //添加文件对象 |
|||
await this.$http |
|||
.post("/actual/base/resiCategorized/disability/import", formData) |
|||
.then((res) => { |
|||
console.log("res-up", res); |
|||
if (res.data.code == 0 && res.data.msg == "success") { |
|||
this.$message.success("导入成功"); |
|||
this.getTableData(); |
|||
this.$refs.upload.clearFiles(); |
|||
} else this.$message.error(res.data.msg); |
|||
}) |
|||
.catch((err) => { |
|||
console.log("失败", err); |
|||
file.onError(); //上传失败的文件会从文件列表中删除 |
|||
// this.$message.error('导入失败') |
|||
}); |
|||
}, |
|||
// 分页 |
|||
handleSizeChange (val) { |
|||
this.pageSize = val; |
|||
window.localStorage.setItem("pageSize", val); |
|||
this.getTableData(); |
|||
}, |
|||
|
|||
// 分页 |
|||
handleCurrentChange (val) { |
|||
this.pageNo = val; |
|||
this.getTableData(); |
|||
}, |
|||
// 重置 |
|||
resetSearch () { |
|||
this.formData = {}; |
|||
|
|||
this.pageNo = 1; |
|||
this.getTableData(); |
|||
}, |
|||
// 多选事件 |
|||
onMultiSelection (rows) { |
|||
this.multiSelection = rows; |
|||
}, |
|||
|
|||
// 批量删除 |
|||
onDeleteBatch () { |
|||
if (this.multiSelection.length == 0) { |
|||
this.$message.warning("请先选中至少一项"); |
|||
return; |
|||
} |
|||
|
|||
this.$confirm("删除之后无法恢复,确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning", |
|||
}) |
|||
.then(() => { |
|||
this.cancelFuwu(this.multiSelection.map((e) => e.categorizedResiId)); |
|||
}) |
|||
.catch((err) => { |
|||
console.error(err); |
|||
this.$message.error("删除失败"); |
|||
}); |
|||
}, |
|||
}, |
|||
|
|||
props: {}, |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/assets/scss/buttonstyle.scss"; |
|||
@import "@/assets/scss/modules/management/list-main.scss"; |
|||
@import "@/assets/scss/modules/shequzhili/event-info.scss"; |
|||
.div_btn_left > * { |
|||
margin-right: 10px; |
|||
} |
|||
</style> |
|||
|
Loading…
Reference in new issue