7 changed files with 1886 additions and 655 deletions
@ -0,0 +1,515 @@ |
|||
<template> |
|||
<div> |
|||
<div> |
|||
<el-form |
|||
ref="ref_form" |
|||
:inline="true" |
|||
:model="dataForm" |
|||
:rules="dataRule" |
|||
:disabled="formType === 'detail'" |
|||
class="form" |
|||
> |
|||
<el-form-item |
|||
label="组织名称 " |
|||
prop="organizationName" |
|||
label-width="150px" |
|||
style="display: block" |
|||
> |
|||
<el-input |
|||
class="item_width_1" |
|||
maxlength="50" |
|||
show-word-limit |
|||
placeholder="请输入组织名称 " |
|||
v-model="dataForm.organizationName" |
|||
> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item |
|||
label="组织人数 " |
|||
prop="organizationPersonCount" |
|||
label-width="150px" |
|||
style="display: block" |
|||
> |
|||
<el-input |
|||
class="item_width_1" |
|||
type="number" |
|||
maxlength="50" |
|||
show-word-limit |
|||
placeholder="请输入组织人数 " |
|||
v-model="dataForm.organizationPersonCount" |
|||
> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item |
|||
label="组织成员 " |
|||
prop="organizationPersonnel" |
|||
label-width="150px" |
|||
style="display: block" |
|||
> |
|||
<div class="m-staffs"> |
|||
<div |
|||
class="item" |
|||
:key="'staff' + index" |
|||
v-for="(item, index) in dataForm.organizationPersonnel" |
|||
> |
|||
<el-input |
|||
class="item_width_1" |
|||
maxlength="50" |
|||
show-word-limit |
|||
placeholder="成员姓名" |
|||
v-model="item.personName" |
|||
/> |
|||
|
|||
<el-input |
|||
style="margin-left: 10px" |
|||
class="item_width_1" |
|||
maxlength="50" |
|||
show-word-limit |
|||
placeholder="联系电话" |
|||
v-model="item.personPhone" |
|||
/> |
|||
|
|||
<el-button |
|||
style="margin-left: 10px" |
|||
size="small" |
|||
@click="handleDelStaff(index)" |
|||
>删除</el-button |
|||
> |
|||
</div> |
|||
|
|||
<div class="item-add"> |
|||
<el-button size="small" @click="handleAddStaff">添加</el-button> |
|||
</div> |
|||
</div> |
|||
</el-form-item> |
|||
|
|||
<el-form-item |
|||
label="服务事项" |
|||
prop="serviceItem" |
|||
label-width="150px" |
|||
style="display: block" |
|||
> |
|||
<el-input |
|||
class="item_width_1" |
|||
type="textarea" |
|||
maxlength="1000" |
|||
show-word-limit |
|||
:rows="3" |
|||
placeholder="请输入服务事项,不超过1000字" |
|||
v-model="dataForm.serviceItem" |
|||
></el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item |
|||
label="负责人 " |
|||
prop="principalName" |
|||
label-width="150px" |
|||
style="display: block" |
|||
> |
|||
<el-input |
|||
class="item_width_1" |
|||
maxlength="50" |
|||
show-word-limit |
|||
placeholder="请输入负责人 " |
|||
v-model="dataForm.principalName" |
|||
> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item |
|||
label="联系电话 " |
|||
prop="principalPhone" |
|||
label-width="150px" |
|||
style="display: block" |
|||
> |
|||
<el-input |
|||
class="item_width_1" |
|||
maxlength="50" |
|||
show-word-limit |
|||
placeholder="请输入联系电话 " |
|||
v-model="dataForm.principalPhone" |
|||
> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item |
|||
label="创建时间 " |
|||
prop="organizationCreatedTime" |
|||
label-width="150px" |
|||
style="display: block" |
|||
> |
|||
<el-date-picker |
|||
v-model="dataForm.organizationCreatedTime" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
value-format="yyyy-MM-dd" |
|||
> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
|
|||
<el-form-item |
|||
label="位置坐标" |
|||
prop="longitude" |
|||
label-width="150px" |
|||
style="display: block" |
|||
> |
|||
<div style="width: 500px"> |
|||
<el-input |
|||
class="item_width_4" |
|||
maxlength="50" |
|||
placeholder="请输入关键字" |
|||
v-model="dataForm.address" |
|||
> |
|||
</el-input> |
|||
<el-button |
|||
style="margin-left: 10px" |
|||
type="primary" |
|||
size="small" |
|||
@click="handleSearchMap" |
|||
>查询</el-button |
|||
> |
|||
<div id="app" class="div_map"></div> |
|||
<div style="margin-top: 10px"> |
|||
<span>经度</span> |
|||
<el-input |
|||
class="item_width_3" |
|||
maxlength="50" |
|||
placeholder="请输入经度" |
|||
v-model="dataForm.longitude" |
|||
> |
|||
</el-input> |
|||
<span style="margin-left: 20px">纬度</span> |
|||
<el-input |
|||
class="item_width_3" |
|||
maxlength="50" |
|||
placeholder="请输入纬度" |
|||
v-model="dataForm.latitude" |
|||
> |
|||
</el-input> |
|||
</div> |
|||
</div> |
|||
</el-form-item> |
|||
</el-form> |
|||
</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; |
|||
let loading; // 加载动画 |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
formType: "add", //表单操作类型 add新增,edit编辑,detail详情 |
|||
|
|||
btnDisable: false, |
|||
|
|||
orgId: "", |
|||
dataForm: { |
|||
organizationName: "", |
|||
serviceItem: "", |
|||
organizationPersonCount: "", |
|||
principalName: "", |
|||
principalPhone: "", |
|||
organizationCreatedTime: "", |
|||
address: "", |
|||
longitude: "", |
|||
latitude: "", |
|||
organizationPersonnel: [], |
|||
}, |
|||
}; |
|||
}, |
|||
components: {}, |
|||
computed: { |
|||
dataRule() { |
|||
return { |
|||
organizationName: [ |
|||
{ required: true, message: "组织名称 不能为空", trigger: "blur" }, |
|||
{ |
|||
min: 1, |
|||
max: 50, |
|||
message: "组织名称 长度在 1 到 50个字符", |
|||
trigger: "blur", |
|||
}, |
|||
], |
|||
organizationPersonCount: [ |
|||
{ required: true, message: "组织人数不能为空", trigger: "blur" }, |
|||
], |
|||
serviceItem: [ |
|||
{ required: true, message: "服务事项不能为空", trigger: "blur" }, |
|||
], |
|||
principalName: [ |
|||
{ required: true, message: "负责人不能为空", trigger: "blur" }, |
|||
], |
|||
principalPhone: [ |
|||
{ required: true, message: "联系电话不能为空", trigger: "blur" }, |
|||
], |
|||
longitude: [ |
|||
{ required: true, message: "位置坐标不能为空", trigger: "blur" }, |
|||
], |
|||
}; |
|||
}, |
|||
}, |
|||
props: {}, |
|||
watch: {}, |
|||
|
|||
async mounted() { |
|||
this.initMap(); |
|||
}, |
|||
|
|||
methods: { |
|||
handleAddStaff() { |
|||
this.dataForm.organizationPersonnel = [ |
|||
...this.dataForm.organizationPersonnel, |
|||
{ personName: "", personPhone: "" }, |
|||
]; |
|||
}, |
|||
handleDelStaff(index) { |
|||
const { organizationPersonnel } = this.dataForm; |
|||
organizationPersonnel.splice(index, 1); |
|||
this.dataForm.organizationPersonnel = organizationPersonnel; |
|||
}, |
|||
// 地图初始化函数,本例取名为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); |
|||
|
|||
// 监听地图平移结束 |
|||
map.on("panend", () => { |
|||
this.handleMoveCenter(); |
|||
}); |
|||
this.handleMoveCenter(); |
|||
}, |
|||
|
|||
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.dataForm.address, |
|||
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.dataForm.latitude = lat; |
|||
this.dataForm.longitude = lng; |
|||
} else { |
|||
this.$message.error("未检索到相关位置坐标"); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
handleMoveCenter() { |
|||
//修改地图中心点 |
|||
const center = map.getCenter(); |
|||
const lat = center.getLat(); |
|||
const lng = center.getLng(); |
|||
this.dataForm.latitude = lat; |
|||
this.dataForm.longitude = lng; |
|||
this.setMarker(lat, lng); |
|||
}, |
|||
|
|||
async initForm(type, row) { |
|||
this.$refs.ref_form.resetFields(); |
|||
|
|||
this.formType = type; |
|||
console.log(row); |
|||
if (row) { |
|||
this.dataForm = { ...this.dataForm, ...row }; |
|||
this.orgId = this.dataForm.orgId; |
|||
map.setCenter(new TMap.LatLng(row.latitude, row.longitude)); |
|||
} |
|||
}, |
|||
|
|||
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.submit(); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
async submit() { |
|||
let url = ""; |
|||
if (this.formType === "add") { |
|||
url = "/heart/iccommunityselforganization/addcommunityselforganization"; |
|||
// url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodadd" |
|||
} else { |
|||
url = |
|||
"/heart/iccommunityselforganization/editcommunityselforganization"; |
|||
|
|||
this.dataForm.orgId = this.orgId; |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, this.dataForm); |
|||
|
|||
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.orgId = ""; |
|||
this.dataForm = { |
|||
organizationName: "", |
|||
serviceItem: "", |
|||
organizationPersonCount: "", |
|||
principalName: "", |
|||
principalPhone: "", |
|||
organizationCreatedTime: "", |
|||
address: "", |
|||
longitude: "", |
|||
latitude: "", |
|||
organizationPersonnel: [], |
|||
}; |
|||
}, |
|||
// 开启加载动画 |
|||
startLoading() { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: "正在加载……", // 加载中需要显示的文字 |
|||
background: "rgba(0,0,0,.7)", // 背景颜色 |
|||
}); |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading() { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close(); |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" 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 { |
|||
margin-top: 10px; |
|||
} |
|||
|
|||
.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; |
|||
} |
|||
|
|||
.m-staffs { |
|||
width: 468px; |
|||
.item { |
|||
display: flex; |
|||
justify-content: space-around; |
|||
margin-bottom: 7px; |
|||
} |
|||
.item-add { |
|||
} |
|||
} |
|||
</style> |
|||
|
|||
<style> |
|||
.el-dialog__body { |
|||
padding: 0 10px 20px !important; |
|||
} |
|||
</style> |
@ -0,0 +1,535 @@ |
|||
<template> |
|||
<div> |
|||
<div class="resi-container"> |
|||
<el-card class="resi-card"> |
|||
<el-row class="resi-row-box" :class="openSearch && 'resi-row-more'"> |
|||
<el-row class="resi-row" :gutter="20"> |
|||
<el-col :span="8"> |
|||
<div class="resi-cell"> |
|||
<div class="resi-cell-label">组织名称</div> |
|||
<div class="resi-cell-value" :class="'resi-cell-value-radio'"> |
|||
<el-input |
|||
v-model="fmData.organizationName" |
|||
class="resi-cell-input" |
|||
size="small" |
|||
clearable |
|||
placeholder="请输入" |
|||
> |
|||
</el-input> |
|||
</div> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="16"> |
|||
<div class="resi-cell"> |
|||
<div class="resi-cell-label">创建时间</div> |
|||
<div class="resi-cell-value" :class="'resi-cell-value-radio'"> |
|||
<el-date-picker |
|||
v-model="fmData.createTime" |
|||
type="daterange" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
value-format="yyyy-MM-dd" |
|||
> |
|||
</el-date-picker> |
|||
</div> |
|||
</div> |
|||
</el-col> |
|||
</el-row> |
|||
</el-row> |
|||
<el-row class="resi-search"> |
|||
<el-col :span="24"> |
|||
<el-button type="primary" size="small" @click="handleSearch" |
|||
>查询</el-button |
|||
> |
|||
</el-col> |
|||
</el-row> |
|||
</el-card> |
|||
</div> |
|||
|
|||
<el-card class="resi-card-table"> |
|||
<div class="resi-row-btn"> |
|||
<el-button type="success" size="small" @click="handleAdd" |
|||
>新增</el-button |
|||
> |
|||
<el-upload |
|||
ref="upload" |
|||
class="upload-btn" |
|||
action="uploadUlr" |
|||
:limit="1" |
|||
:with-credentials="true" |
|||
:show-file-list="false" |
|||
:auto-upload="true" |
|||
:on-progress="handleProgress" |
|||
:on-success="handleExcelSuccess" |
|||
:before-upload="beforeExcelUpload" |
|||
:http-request="uploadHttpRequest" |
|||
> |
|||
<el-button type="warning" size="small" :loading="importLoading">{{ |
|||
importBtnTitle |
|||
}}</el-button> |
|||
</el-upload> |
|||
|
|||
<el-button @click="handleChu" type="danger" size="small" |
|||
>excel导出</el-button |
|||
> |
|||
</div> |
|||
<el-table |
|||
:data="tableData" |
|||
border |
|||
style="width: 100%" |
|||
class="resi-table" |
|||
:max-height="maxTableHeight" |
|||
> |
|||
<el-table-column label="序号" type="index" align="center" width="50" /> |
|||
<el-table-column prop="organizationName" label="组织名称"> |
|||
</el-table-column> |
|||
<el-table-column prop="organizationPersonCount" label="组织人数"> |
|||
</el-table-column> |
|||
<el-table-column prop="serviceItem" label="服务事项"> </el-table-column> |
|||
<el-table-column prop="principalName" label="负责人"> </el-table-column> |
|||
<el-table-column prop="principalPhone" label="联系电话"> |
|||
</el-table-column> |
|||
<el-table-column prop="organizationCreatedTime" label="创建时间"> |
|||
</el-table-column> |
|||
<el-table-column fixed="right" label="操作" align="center" width="120"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
@click="handleWatch(scope.$index)" |
|||
type="text" |
|||
size="small" |
|||
>查看</el-button |
|||
> |
|||
|
|||
<el-button |
|||
@click="handleEdit(scope.$index)" |
|||
type="text" |
|||
size="small" |
|||
style="margin-right: 10px; color: #00a7a9" |
|||
>编辑</el-button |
|||
> |
|||
|
|||
<el-popconfirm |
|||
title="删除之后无法回复,确认删除?" |
|||
@onConfirm="handleDel(scope.row, scope.$index)" |
|||
@confirm="handleDel(scope.row, scope.$index)" |
|||
> |
|||
<el-button |
|||
slot="reference" |
|||
type="text" |
|||
size="small" |
|||
style="color: #d51010" |
|||
>删除</el-button |
|||
> |
|||
</el-popconfirm> |
|||
</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" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</el-card> |
|||
|
|||
<!-- 修改弹出框 --> |
|||
<el-dialog |
|||
:visible.sync="formShow" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="formTitle" |
|||
width="850px" |
|||
top="5vh" |
|||
@closed="handleClose" |
|||
> |
|||
<edit-form |
|||
ref="eleEditForm" |
|||
@dialogCancle="handleClose" |
|||
@dialogOk="handleEditSuccess" |
|||
></edit-form> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { requestPost } from "@/js/dai/request"; |
|||
import nextTick from "dai-js/tools/nextTick"; |
|||
import { mapGetters } from "vuex"; |
|||
import editForm from "./cpts/edit"; |
|||
import axios from "axios"; |
|||
|
|||
export default { |
|||
components: { editForm }, |
|||
data() { |
|||
return { |
|||
openSearch: false, |
|||
|
|||
formShow: false, |
|||
formTitle: "", |
|||
formShow: false, |
|||
|
|||
pageNo: 1, |
|||
pageSize: window.localStorage.getItem("pageSize") || 20, |
|||
total: 1, |
|||
|
|||
tableData: [], |
|||
|
|||
fmData: { |
|||
organizationName: "", |
|||
startDate: "", |
|||
endDate: "", |
|||
createTime: ["", ""], |
|||
}, |
|||
|
|||
importBtnTitle: "excel导入", |
|||
importLoading: false, |
|||
}; |
|||
}, |
|||
computed: { |
|||
maxTableHeight() { |
|||
return this.clientHeight - 410; |
|||
}, |
|||
...mapGetters(["clientHeight"]), |
|||
}, |
|||
watch: { |
|||
"fmData.createTime": function (val) { |
|||
if (Array.isArray(val) && val.length == 2) { |
|||
this.fmData.startDate = val[0]; |
|||
this.fmData.endDate = val[1]; |
|||
} else { |
|||
this.fmData.startDate = ""; |
|||
this.fmData.endDate = ""; |
|||
} |
|||
}, |
|||
}, |
|||
mounted() { |
|||
this.getTableData(); |
|||
}, |
|||
methods: { |
|||
// 上传大图标成功 |
|||
handleExcelSuccess(res, file) { |
|||
if (res.code === 0 && res.msg === "success") { |
|||
console.log("resss---ppp", res); |
|||
} else { |
|||
this.$message.error(res.msg); |
|||
} |
|||
}, |
|||
handleProgress(event, file, fileList) { |
|||
console.log("percentage", file.percentage); |
|||
}, |
|||
|
|||
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; |
|||
}, |
|||
uploadHttpRequest(file) { |
|||
this.importLoading = true; |
|||
this.importBtnTitle = "正在上传中..."; |
|||
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|||
formData.append("file", file.file); //添加文件对象 |
|||
axios({ |
|||
url: |
|||
window.SITE_CONFIG["apiURL"] + |
|||
"/heart/iccommunityselforganization/importcommunityselforganization", |
|||
method: "post", |
|||
data: formData, |
|||
responseType: "blob", |
|||
}) |
|||
.then((res) => { |
|||
this.importLoading = false; |
|||
this.importBtnTitle = "excel导入"; |
|||
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对象 |
|||
this.getTableData(); |
|||
}) |
|||
.catch((err) => { |
|||
console.log("失败", err); |
|||
param.onError(); //上传失败的文件会从文件列表中删除 |
|||
}); |
|||
}, |
|||
|
|||
handleSizeChange(val) { |
|||
console.log(`每页 ${val} 条`); |
|||
this.pageSize = val; |
|||
window.localStorage.setItem("pageSize", val); |
|||
this.getTableData(); |
|||
}, |
|||
handleCurrentChange(val) { |
|||
console.log(`当前页: ${val}`); |
|||
this.pageNo = val; |
|||
this.getTableData(); |
|||
}, |
|||
|
|||
handleClose() { |
|||
this.formShow = false; |
|||
}, |
|||
handleSearch(val) { |
|||
console.log(this.fmData); |
|||
this.pageNo = 1; |
|||
this.getTableData(); |
|||
}, |
|||
|
|||
async handleAdd() { |
|||
this.formShow = true; |
|||
await nextTick(); |
|||
console.log(this.$refs); |
|||
this.$refs.eleEditForm.initForm("add"); |
|||
}, |
|||
|
|||
async handleChu() { |
|||
const url = |
|||
"/heart/iccommunityselforganization/exportcommunityselforganization"; |
|||
const { pageSize, pageNo, fmData } = this; |
|||
axios({ |
|||
url: window.SITE_CONFIG["apiURL"] + url, |
|||
method: "post", |
|||
data: { |
|||
pageSize, |
|||
pageNo, |
|||
...fmData, |
|||
}, |
|||
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.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对象 |
|||
}) |
|||
.catch((err) => { |
|||
console.log("获取导出情失败", err); |
|||
return this.$message.error("网络错误"); |
|||
}); |
|||
}, |
|||
|
|||
async handleWatch(rowIndex) { |
|||
this.formShow = true; |
|||
await nextTick(); |
|||
this.$refs.eleEditForm.initForm("detail", this.tableData[rowIndex]); |
|||
}, |
|||
|
|||
async handleEdit(rowIndex) { |
|||
this.formShow = true; |
|||
await nextTick(); |
|||
this.$refs.eleEditForm.initForm("edit", this.tableData[rowIndex]); |
|||
}, |
|||
handleEditSuccess() { |
|||
this.handleClose(); |
|||
this.getTableData(); |
|||
}, |
|||
|
|||
async handleDel(rowData, rowIndex) { |
|||
console.log(rowData, rowIndex); |
|||
const url = |
|||
"/heart/iccommunityselforganization/delcommunityselforganization"; |
|||
const { tableData } = this; |
|||
|
|||
const { data, code, msg } = await requestPost(url, { |
|||
orgId: tableData[rowIndex].orgId, |
|||
}); |
|||
|
|||
if (code === 0) { |
|||
this.$message.success("删除成功!"); |
|||
this.getTableData(); |
|||
} else { |
|||
this.$message.success("操作失败!"); |
|||
} |
|||
}, |
|||
|
|||
async getTableData() { |
|||
const url = |
|||
"/heart/iccommunityselforganization/communityselforganizationlist"; |
|||
const { pageSize, pageNo, fmData } = this; |
|||
const { data, code, msg } = await requestPost(url, { |
|||
pageSize, |
|||
pageNo, |
|||
...fmData, |
|||
}); |
|||
if (code === 0) { |
|||
console.log("列表请求成功!!!!!!!!!!!!!!"); |
|||
this.total = data.total || 0; |
|||
this.tableData = data.list |
|||
? data.list.map((item) => { |
|||
return item; |
|||
}) |
|||
: []; |
|||
} else { |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.tabs-other-info { |
|||
.el-tabs__item { |
|||
// width: 50px; |
|||
height: 20px; |
|||
box-sizing: border-box; |
|||
margin-right: 7px; |
|||
padding: 0 10px !important; |
|||
font-size: 8px; |
|||
font-weight: 500; |
|||
color: #666666; |
|||
line-height: 20px; |
|||
background: #ebecf1; |
|||
border-radius: 2px; |
|||
} |
|||
.el-tabs__nav-wrap::after, |
|||
.el-tabs__active-bar { |
|||
display: none; |
|||
} |
|||
.el-tabs__nav-next, |
|||
.el-tabs__nav-prev { |
|||
line-height: 20px; |
|||
} |
|||
} |
|||
|
|||
.resi-card-table { |
|||
margin-top: 20px; |
|||
} |
|||
.resi-row-btn { |
|||
margin-bottom: 13px; |
|||
.upload-btn { |
|||
display: inline-block; |
|||
margin: 0 10px; |
|||
} |
|||
} |
|||
.resi-other { |
|||
width: 100%; |
|||
display: flex; |
|||
.resi-other-title { |
|||
width: 100px; |
|||
box-sizing: border-box; |
|||
margin-bottom: 10px; |
|||
// padding: 6px 12px 0 0; |
|||
font-size: 16px; |
|||
font-weight: 500; |
|||
color: #333; |
|||
text-align: center; |
|||
} |
|||
.tabs-other-info { |
|||
// padding-left: 60px; |
|||
} |
|||
} |
|||
|
|||
.resi-btns { |
|||
margin-top: 20px; |
|||
text-align: center; |
|||
} |
|||
|
|||
.resi-container .resi-card { |
|||
position: relative; |
|||
overflow: visible; |
|||
} |
|||
.resi-down { |
|||
position: absolute; |
|||
left: 50%; |
|||
bottom: -10px; |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
width: 46px; |
|||
height: 12px; |
|||
box-sizing: border-box; |
|||
margin-left: -23rpx; |
|||
cursor: pointer; |
|||
background: #ffffff; |
|||
border-radius: 0 0 10px 10px; |
|||
img { |
|||
display: block; |
|||
} |
|||
} |
|||
.resi-row-box { |
|||
// height: 104px; |
|||
overflow: hidden; |
|||
transition: height 0.5s; |
|||
} |
|||
.resi-row-more { |
|||
height: max-content; |
|||
transition: height 0.5s; |
|||
} |
|||
.resi-row { |
|||
margin-bottom: 20px; |
|||
} |
|||
.resi-search { |
|||
.el-col { |
|||
text-align: right; |
|||
} |
|||
} |
|||
.resi-cell { |
|||
display: flex; |
|||
align-items: center; |
|||
.resi-cell-label { |
|||
width: 70px; |
|||
box-sizing: border-box; |
|||
margin-right: 15px; |
|||
text-align: right; |
|||
// line-height: 32; |
|||
} |
|||
.resi-cell-value-radio { |
|||
display: flex; |
|||
align-items: center; |
|||
min-height: 32px; |
|||
} |
|||
.resi-cell-input { |
|||
width: 180px; |
|||
} |
|||
.resi-cell-select { |
|||
width: 180px; |
|||
box-sizing: border-box; |
|||
margin-right: 10px; |
|||
&-middle { |
|||
width: 130px; |
|||
} |
|||
&-small { |
|||
width: 88px; |
|||
} |
|||
} |
|||
.resi-cell-select:last-child { |
|||
margin-right: 0; |
|||
} |
|||
} |
|||
</style> |
Loading…
Reference in new issue