Browse Source

生活圈功能优化

feature-bug
mk 10 months ago
parent
commit
7288eca14b
  1. 234
      src/views/modules/volunteer/LifeCircleManagement/add.vue
  2. 4
      src/views/modules/volunteer/LifeCircleManagement/index.vue

234
src/views/modules/volunteer/LifeCircleManagement/add.vue

@ -5,19 +5,15 @@
<el-form ref="ref_form" :inline="true" :model="formData" :rules="dataRule" class="form"> <el-form ref="ref_form" :inline="true" :model="formData" :rules="dataRule" class="form">
<el-row> <el-row>
<!-- <el-col :span="12">
<el-form-item label="所属组织" prop="agencyName" label-width="100px">
<el-input v-model.trim="formData.agencyName" size="small" clearable placeholder="请输入活动名称" :disabled="true"
class="u-item-width-normal"></el-input>
</el-form-item>
</el-col> -->
<el-col :span="12"> <el-col :span="12">
<el-form-item label="类型" prop="type" label-width="100px"> <el-form-item label="类型" prop="type" label-width="100px">
<!-- <el-cascader @change="handleChangeAgency" :options="options" :disabled="showdisabled" :props="{ checkStrictly: true }"></el-cascader>
<el-form-item label="类型" prop="type" label-width="100px"> -->
<el-cascader v-model="this.formData.type" @change="handleChangeAgency" :options="options" <el-cascader v-model="this.formData.type" @change="handleChangeAgency" :options="options"
:disabled="showdisabled" :props="{emitPath: false, :disabled="showdisabled" :props="{
multiple: false, }"></el-cascader> emitPath: false,
multiple: false,
}"></el-cascader>
</el-form-item> </el-form-item>
@ -28,16 +24,7 @@
:disabled="showdisabled" class="u-item-width-normal"></el-input> :disabled="showdisabled" class="u-item-width-normal"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="12">
<el-form-item label="组织类型" label-width="100px" prop="orgType">
<el-select class="u-item-width-normal" v-model.trim="formData.orgType" placeholder="请选择"
clearable>
<el-option v-for="item in OrganizationaltypeList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col> -->
<el-col :span="24"> <el-col :span="24">
<el-form-item label="位置" prop="searchValue" label-width="100px" style="display: block"> <el-form-item label="位置" prop="searchValue" label-width="100px" style="display: block">
<div style="width: 634px"> <div style="width: 634px">
@ -65,30 +52,17 @@
:disabled="showdisabled" class="u-item-width-normal"></el-input> :disabled="showdisabled" class="u-item-width-normal"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="12">
<div style="display: flex; ">
<div >
<div v-for="(item, index) in formData.tags" :label="index" :key="item.name" :prop=index style="display: flex;">
<el-form-item label="标签" prop="tags" label-width="100px" >
<el-input :disabled="showdisabled" v-model="formData.tags" placeholder="请输入(最多添加四个)" lass="u-item-width-normal"></el-input>
</el-form-item>
<div v-if="index > 0" @click="removeDomain(item)" style="color: blue; font-size: 12px; margin-top: 15px">删除
</div>
</div>
</div>
<div @click="addDomain" style="color: blue; font-size: 12px; margin-top: 15px">添加
</div>
<i class="el-icon-circle-plus" @click="addDomain" style="font-size: 20px; margin-top:7px;"></i>
</div>
</el-col> -->
<el-col :span="12"> <el-col :span="12">
<div v-if="formData.tags1" style="display: flex;"> <div v-if="tags1" style="display: flex;">
<div> <div>
<div v-for="(item, index) in formData.tags1" :key="item.name + index" <div v-for="(item, index) in tags1" :key="index"
style="display: flex;"> style="display: flex;">
<el-form-item label="标签" prop="tags1" label-width="100px"> <el-form-item label="标签" label-width="100px" :rules="[
<el-input :disabled="showdisabled" v-model="item.tab" placeholder="请输入(最多添加四个)" { required: true, message: '请输入', trigger: 'blur' },
class="u-item-width-normal"></el-input> ]">
<el-input :disabled="showdisabled" v-model="tags1[index].tag"
placeholder="请输入(最多添加四个)" class="u-item-width-normal"></el-input>
</el-form-item> </el-form-item>
<div v-if="index > 0" @click="removeDomain(index)" <div v-if="index > 0" @click="removeDomain(index)"
style="color: blue; font-size: 12px; margin-top: 15px"> style="color: blue; font-size: 12px; margin-top: 15px">
@ -122,27 +96,6 @@
:disabled="showdisabled" class="u-item-width-normal"></el-input> :disabled="showdisabled" class="u-item-width-normal"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-form-item label="组织介绍" prop="introduction" label-width="100px" style="display: block">
<div class="item_width_1">
<el-input type="textarea" autosize placeholder="请填写组织介绍"
v-model.trim="formData.introduction" :autosize="{ minRows:4., maxRows: 10}">
</el-input>
</div>
</el-form-item> -->
<!--
<el-form-item label="志愿品牌" prop="brand" label-width="100px" style="display: block">
<div class="item_width_1">
<el-input type="textarea" autosize placeholder="请输入内容" v-model.trim="formData.brand"
:autosize="{ minRows:4., maxRows: 10}">
</el-input>
</div>
</el-form-item>
<el-form-item label="品牌展示图" label-width="100px" prop="brandImg">
<template>
<upload-image :defaultFileList="formData.brandImg" :limit="1" @change="onChangeFileList1"
@file-removed="removedImg"></upload-image>
</template>
</el-form-item> -->
</el-row></el-form> </el-row></el-form>
</div> </div>
<div class="div_btn"> <div class="div_btn">
@ -370,6 +323,7 @@
{ label: "学校", value: 3 }, { label: "学校", value: 3 },
], ],
tableDate: {}, tableDate: {},
tags1: [],
formData: formData:
{ {
agencyName: "", agencyName: "",
@ -377,9 +331,6 @@
linkPhone: "", linkPhone: "",
workTime: "", workTime: "",
type: "", type: "",
tags1: [
{}
],
tags: "",// tags: "",//
agencyId: this.$store.state.user.agencyId, agencyId: this.$store.state.user.agencyId,
address: "",// address: "",//
@ -406,39 +357,33 @@
this.formData.latitude = latitude; this.formData.latitude = latitude;
this.formData.longitude = longitude; this.formData.longitude = longitude;
this.activityType() this.activityType()
this.listServerOrg()
}, },
methods: { methods: {
// //
async initForm(type, unitId) { async initForm(type, unitId) {
console.log(type, unitId,"i就理解哦i");
if (type == "info") { if (type == "info") {
this.showdisabled = true this.showdisabled = true
} }
this.$nextTick(() => {
let { latitude, longitude } = this.$store.state.user;
this.formData.latitude = latitude;
this.formData.longitude = longitude;
if (!map) {
this.initMap(this.formData.latitude, this.formData.longitude);
map.setMarker(this.formData.latitude, this.formData.longitude);
} else {
map.setCenter(this.formData.latitude, this.formData.longitude);
map.setMarker(this.formData.latitude, this.formData.longitude);
}
})
if (type == "edit") { if (type == "edit") {
this.getTableDetail(unitId) await this.getTableDetail(unitId)
}
if (type == "add") {
this.tags1.push({tag:''})
} }
// await this.getDemandOptions()
// console.log(this.demandOptions);
// let { latitude, longitude } = this.$store.state.user;
// this.formType = type;
// if (unitId) {
// this.unitId = unitId;
// this.formData.id = unitId;
// await this.loadFormData();
// } else {
// this.formData.latitude = latitude;
// this.formData.longitude = longitude;
// }
// // if (!map) {
// this.initMap(this.formData.latitude, this.formData.longitude);
// // }
// this.endLoading();
}, },
// //
handleChangeAgency(val) { handleChangeAgency(val) {
@ -446,30 +391,26 @@
this.formData.type = val this.formData.type = val
}, },
// //
getTableDetail(id) { async getTableDetail(id) {
console.log(id,"dskljfksdljf");
let url = `/voluntary/sphereLife/detail/${id}`; let url = `/voluntary/sphereLife/detail/${id}`;
console.log(url,"url"); const res = await requestGet(url)
requestGet(url).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.formData = res.data this.formData = res.data
this.fileList=[{fileUrl:res.data.attrs[0].url}] this.fileList=[{fileUrl:res.data.attrs[0].url}]
this.searchValue=res.data.address this.searchValue=res.data.address
this.formData.tags1=res.data.tags.split(',').map(item => ({ tab: item.trim() })); this.fileList1=[{fileUrl:res.data.couponUrl}]
this.tags1=res.data.tags.split(',').map(item => ({ tag: item.trim() }));
map.setCenter(this.formData.latitude, this.formData.longitude);
map.setMarker(this.formData.latitude, this.formData.longitude);
} else { } else {
this.$message.error(res.msg) this.$message.error(res.msg)
} }
})
}, },
// //
addDomain() { addDomain() {
if (this.tags1.length < 4) {
this.tags1.push({ tab: '' });
if (this.formData.tags1.length < 4) {
this.formData.tags1.push({tab: '' });
} else { } else {
this.$message.error("最多添加4个标签"); this.$message.error("最多添加4个标签");
} }
@ -478,26 +419,8 @@
// //
removeDomain(item) { removeDomain(item) {
console.log(item); console.log(item);
this.formData.tags1.splice(item, 1); this.tags1.splice(item, 1);
// var index = this.formData.sponsors.indexOf(item)
// if (index !== -1) {
// this.formData.sponsors.splice(index, 1)
// this.tableDate = {}
// }
},
validateContent() {
// 使HTML
const textContent = this.stripHtml(this.formData.sumUp);
if (textContent.trim() === '') {
this.formData.sumUp = null;
}
}, },
stripHtml(html) {
const div = document.createElement('div');
div.innerHTML = html;
return div.textContent || div.innerText || '';
},
async activityType() { async activityType() {
@ -512,20 +435,7 @@
} }
}) })
}, },
handleOnlineRegistration(value) {
//
if (value) {
this.online = true;
this.formData.online = 1;
} else {
this.online = false;
this.formData.cutOffTime = ''
this.formData.online = 0;
}
},
onChangeFileList(e) { onChangeFileList(e) {
console.log(e, 'sssssb');
this.fileList = e.length > 0 ? e.map(item => ({ this.fileList = e.length > 0 ? e.map(item => ({
fileType: '0', fileType: '0',
type: 'image', type: 'image',
@ -549,43 +459,10 @@
}, },
onChangeImgs(e, rowIndex = 0) {
console.log('onChangeFileList', e)
if (e.length > 0) {
this.activityImgs = []
e.forEach(item => {
let ob = {
fileType: '0',
fileUrl: item.response.data.url
}
this.activityImgs.push(ob)
})
}
},
handleTimeChange(time) {
if (time) {
const startTimeArray = util.dateFormatter(time[0], 'time').split('-')
console.log(startTimeArray);
const endTimeArray = util.dateFormatter(time[1], 'time').split('-')
console.log(endTimeArray);
this.formData.startTime = startTimeArray[0] + '-' + startTimeArray[1] + '-' + startTimeArray[2]
this.formData.endTime = endTimeArray[0] + '-' + endTimeArray[1] + '-' + endTimeArray[2]
// this.startTimeShow = startTimeArray[0] + '' + startTimeArray[1] + '' + startTimeArray[2] + ''
// this.endTimeShow = endTimeArray[0] + '' + endTimeArray[1] + '' + endTimeArray[2] + ''
} else {
this.formData.startTime = ''
this.formData.endTime = ''
}
},
async handleComfirm() { async handleComfirm() {
if (this.formData.tags1) { if (this.tags1) {
let one=this.formData.tags1.map(item => item.tab).join(', ') let one = this.tags1.map(item => item.tag).join(', ')
this.formData.tags = one; this.formData.tags = one;
console.log(this.formData, "this.formData"); console.log(this.formData, "this.formData");
} }
@ -615,16 +492,6 @@
this.$message.error('请输入联系人'); this.$message.error('请输入联系人');
return; return;
} }
// if (this.formData.tabs.length === 0) {
// this.$message.error('');
// return;
// }
// if (!this.formData.serviceTypeList) {
// this.$message.error('');
// return;
// }
console.log(this.formData, "this.formData"); console.log(this.formData, "this.formData");
this.addActivity() this.addActivity()
}, },
@ -645,16 +512,10 @@
this.btnDisable = false this.btnDisable = false
this.$message.error(msg) this.$message.error(msg)
} }
}, },
handleCancle() { handleCancle() {
console.log("sdlkfjklsdf ");
this.$emit('showAddClose') this.$emit('showAddClose')
}, },
// init // init
@ -747,11 +608,7 @@
this.formData.address = selPosition.address + selPosition.name this.formData.address = selPosition.address + selPosition.name
this.searchValue = selPosition.address + selPosition.name this.searchValue = selPosition.address + selPosition.name
console.log(this.formData.latitude, this.formData.longitude, "this.formData.latitude, this.formData.longitude"); console.log(this.formData.latitude, this.formData.longitude, "this.formData.latitude, this.formData.longitude");
}, },
}, },
computed: { computed: {
dataRule() { dataRule() {
@ -764,7 +621,6 @@
], ],
searchValue: [ searchValue: [
{ required: true, message: '请选择地址', trigger: 'blur' }, { required: true, message: '请选择地址', trigger: 'blur' },
], ],
linkPhone: [ linkPhone: [
{ required: true, message: '联系电话不能为空', trigger: 'blur' }, { required: true, message: '联系电话不能为空', trigger: 'blur' },
@ -784,9 +640,6 @@
}, },
props: { props: {
}, },
destroyed() { destroyed() {
map = null map = null
@ -806,6 +659,7 @@
z-index: 20000; z-index: 20000;
} }
} }
.u-item-width-normal { .u-item-width-normal {
width: 222px; width: 222px;
} }

4
src/views/modules/volunteer/LifeCircleManagement/index.vue

@ -87,7 +87,7 @@
</el-dialog> </el-dialog>
<el-dialog :visible.sync="showInfo" :close-on-click-modal="false" :close-on-press-escape="false" title="查看" <el-dialog :visible.sync="showInfo" :close-on-click-modal="false" :close-on-press-escape="false" title="查看"
width="850px" top="10vh" class="dialog-h" @closed="showInfoClose"> width="850px" top="10vh" class="dialog-h" @closed="showInfoClose">
<info ref="ref_form" v-if="showInfo" :VolunteerList="fmData" @showInfoClose="showInfoClose" /> <info ref="ref_form_info" v-if="showInfo" :VolunteerList="fmData" @showInfoClose="showInfoClose" />
</el-dialog> </el-dialog>
@ -421,7 +421,7 @@ export default {
this.showInfo=true this.showInfo=true
this.formTitle="查看" this.formTitle="查看"
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.ref_form.initForm("info", row.id); this.$refs.ref_form_info.initForm("info", row.id);
}); });

Loading…
Cancel
Save