Browse Source

时间管理等

feature
jiangyy 3 years ago
parent
commit
fc69eba815
  1. 14
      src/views/modules/communityParty/heart/heartForm.vue
  2. 290
      src/views/modules/cpts/base/cpts/edit.vue
  3. 146
      src/views/modules/shequzhili/event/cpts/add.vue

14
src/views/modules/communityParty/heart/heartForm.vue

@ -796,13 +796,13 @@ export default {
if (data.resultList && data.resultList.length > 0) {
this.resultListAct = data.resultList
this.searchOptions = this.resultListAct.map(item => {
this.searchOptionsAct = this.resultListAct.map(item => {
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` };
});
}
} else {
this.searchOptions = [
this.searchOptionsAct = [
{
value: '0',
label: '未检索到结果'
@ -810,7 +810,7 @@ export default {
]
}
} else {
this.searchOptions = [];
this.searchOptionsAct = [];
}
},
async remoteMethodSignin (query) {
@ -818,7 +818,7 @@ export default {
if (query !== '') {
this.loadingSign = true;
const { msg, data } = await map.searchNearby(query);
const { msg, data } = await map_signin.searchNearby(query);
this.loadingSign = false;
this.resultListSignin = []
@ -826,13 +826,13 @@ export default {
if (data.resultList && data.resultList.length > 0) {
this.resultListSignin = data.resultList
this.searchOptions = this.resultListSignin.map(item => {
this.searchOptionsSignin = this.resultListSignin.map(item => {
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` };
});
}
} else {
this.searchOptions = [
this.searchOptionsSignin = [
{
value: '0',
label: '未检索到结果'
@ -840,7 +840,7 @@ export default {
]
}
} else {
this.searchOptions = [];
this.searchOptionsSignin = [];
}
},

290
src/views/modules/cpts/base/cpts/edit.vue

@ -1,41 +1,34 @@
<template>
<div>
<div class="dialog-h-content scroll-h">
<el-form
v-if="iniLoaded"
<el-form v-if="iniLoaded"
ref="ref_form"
:model="fmData"
:inline="true"
:disabled="formType === 'watch'"
class="m-fm"
:class="{ 'z-div': editParamsDiv, 'z-watch': formType === 'watch' }"
>
:class="{ 'z-div': editParamsDiv, 'z-watch': formType === 'watch' }">
<div class="list">
<el-form-item
v-for="item in editParams"
<el-form-item v-for="item in editParams"
class="item"
label-width="140px"
style="display: block"
:key="'edit' + item.keyName"
:label="item.field"
:prop="item.keyName"
:rules="item.rules || []"
>
:rules="item.rules || []">
<template v-if="item.type == 'switch'">
<el-switch
v-model="fmData[item.keyName]"
<el-switch v-model="fmData[item.keyName]"
size="small"
:active-text="item.activeText || ''"
:inactive-text="item.inactiveText || ''"
:active-value="item.activeValue || true"
:inactive-value="item.inactiveValue || false"
>
:inactive-value="item.inactiveValue || false">
</el-switch>
</template>
<template v-if="item.type == 'input'">
<el-input
v-if="
<el-input v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
@ -44,18 +37,17 @@
clearable
show-word-limit
:maxlength="item.maxlength || ''"
:placeholder="item.placeholder || '请输入'"
>
:placeholder="item.placeholder || '请输入'">
</el-input>
<div class="item-show" v-else>
<div class="item-show"
v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
<template v-if="item.type == 'textarea'">
<el-input
v-if="
<el-input v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
@ -66,18 +58,17 @@
show-word-limit
:rows="3"
:maxlength="item.maxlength || ''"
:placeholder="item.placeholder || '请输入'"
>
:placeholder="item.placeholder || '请输入'">
</el-input>
<div class="item-show" v-else>
<div class="item-show"
v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
<template v-if="item.type == 'date'">
<el-date-picker
v-if="
<el-date-picker v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
@ -87,18 +78,17 @@
clearable
show-word-limit
:value-format="item.format || 'yyyy-MM-dd'"
:placeholder="item.placeholder || '请输入'"
>
:placeholder="item.placeholder || '请输入'">
</el-date-picker>
<div class="item-show" v-else>
<div class="item-show"
v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
<template v-if="item.type == 'number'">
<el-input-number
v-if="
<el-input-number v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
@ -109,18 +99,17 @@
:step="item.step || 1"
:min="item.min || 0"
:max="item.max || 999999999999"
:placeholder="item.placeholder || '请输入'"
>
:placeholder="item.placeholder || '请输入'">
</el-input-number>
<span class="item-show" v-else>
<span class="item-show"
v-else>
{{ fmData[item.keyName] || "--" }}
</span>
<span v-if="item.unitName">{{ item.unitName }}</span>
</template>
<template v-else-if="item.type == 'select'">
<el-select
v-model="fmData[item.keyName]"
<el-select v-model="fmData[item.keyName]"
:placeholder="item.placeholder || '请选择'"
size="small"
clearable
@ -130,62 +119,48 @@
:allowCreate="item.allowCreate || false"
:collapse-tags="item.collapseTags || false"
default-first-option
@change="(e) => handleChangeSelect(e, item)"
>
@change="(e) => handleChangeSelect(e, item)">
<template v-if="item.optionType == 'group'">
<el-option-group
v-for="group in item.optionList"
<el-option-group v-for="group in item.optionList"
:key="group.label"
:label="group.label"
>
<el-option
v-for="subItem in group.optionList"
:label="group.label">
<el-option v-for="subItem in group.optionList"
:key="subItem.value"
:label="subItem.label"
:value="subItem.value"
>
:value="subItem.value">
</el-option>
</el-option-group>
</template>
<template v-else>
<el-option
v-for="(subItem, subIndex) in item.optionList"
<el-option v-for="(subItem, subIndex) in item.optionList"
:key="subItem.value + subIndex"
:label="subItem.label"
:value="subItem.value"
>
:value="subItem.value">
</el-option>
</template>
</el-select>
</template>
<template v-else-if="item.type == 'rich-text'">
<div
v-if="
<div v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
class="item-rich-text"
>
<Tinymce
:ref="'richText' + item.keyName"
class="item-rich-text">
<Tinymce :ref="'richText' + item.keyName"
v-model="fmData[item.keyName]"
:customerId="customerId"
:placeholder="item.placeholder || '请输入'"
:height="500"
/>
:height="500" />
</div>
<div
v-else
<div v-else
class="item-rich-text z-show"
@click="handleClickHtmlNode"
>
@click="handleClickHtmlNode">
<div v-html="fmData[item.keyName]"></div>
</div>
</template>
<template v-else-if="item.type == 'cascader'">
<el-cascader
v-model="fmData[item.keyName]"
<el-cascader v-model="fmData[item.keyName]"
:placeholder="item.placeholder || '请选择'"
:options="item.optionList"
:props="item.optionProps || {}"
@ -194,14 +169,12 @@
size="small"
clearable
class="item-select"
@change="(e) => handleChangeCascader(e, item)"
>
@change="(e) => handleChangeCascader(e, item)">
</el-cascader>
</template>
<template v-else-if="item.type == 'upload'">
<el-upload
:headers="$getElUploadHeaders()"
<el-upload :headers="$getElUploadHeaders()"
v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
@ -218,110 +191,127 @@
:on-error="(res, file) => handleImgError(res, file, item)"
:on-remove="(res) => handleImgRemove(res, item)"
:on-exceed="(res) => handleImgExceed(res, item)"
:before-upload="(file) => beforeImgUpload(file, item)"
>
:before-upload="(file) => beforeImgUpload(file, item)">
<a><i class="el-icon-plus"></i> 点击上传</a>
</el-upload>
<el-image
v-else-if="fmData[item.keyName].length > 0"
<el-image v-else-if="fmData[item.keyName].length > 0"
style="width: 100px; height: 100px"
:src="fmData[item.keyName][0].url"
fit="cover"
:preview-src-list="fmData[item.keyName].map((item) => item.url)"
></el-image>
:preview-src-list="fmData[item.keyName].map((item) => item.url)"></el-image>
<span v-else>--</span>
</template>
<template v-else-if="item.type == 'address'">
<div class="address-item">
<el-input
class="address-item-input"
<!-- <el-input class="address-item-input"
:placeholder="item.placeholder || '请输入所在地址'"
v-model="fmData[item.keyName]"
:maxlength="item.maxlength || ''"
show-word-limit
size="small"
>
size="small">
</el-input>
<el-button
style="margin-left: 10px"
<el-button style="margin-left: 10px"
type="default"
size="small"
ref="mapSearch"
@click="handleSearchMap(item)"
>查询</el-button
>
<div id="app" class="div_map"></div>
<div style="margin-top: 10px" v-show="false">
@click="handleSearchMap(item)">查询</el-button> -->
<el-select v-model="searchValue"
filterable
class="item-input"
remote
:reserve-keyword="true"
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading">
<el-option v-for="(item,index) in searchOptions"
@click.native="handleClickKey(index)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div id="app_base"
class="div_map"></div>
<div style="margin-top: 10px"
v-show="false">
<span>经度</span>
<el-input
class="address-item-input2"
<el-input class="address-item-input2"
maxlength="50"
placeholder="请输入经度"
v-model="fmData[item.supKeys[0]]"
>
v-model="fmData[item.supKeys[0]]">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input
class="address-item-input2"
<el-input class="address-item-input2"
maxlength="50"
placeholder="请输入纬度"
v-model="fmData[item.supKeys[1]]"
>
v-model="fmData[item.supKeys[1]]">
</el-input>
</div>
</div>
<el-input v-if="
formType == 'add' || (formType == 'edit' && !item.editDisable)
"
v-model="fmData[item.keyName]"
class="item-input"
size="small"
clearable
show-word-limit
:maxlength="item.maxlength || ''"
:placeholder="item.placeholder || '请输入'">
</el-input>
<div class="item-show"
v-else>
{{ fmData[item.keyName] || "--" }}
</div>
</template>
</el-form-item>
</div>
</el-form>
<div class="div_btn resi-btns" v-if="!formBtnFixed">
<el-button size="small" @click="handleCancle">{{
<div class="div_btn resi-btns"
v-if="!formBtnFixed">
<el-button size="small"
@click="handleCancle">{{
editConfig.cancelBtnName || "取消"
}}</el-button>
<el-button
v-if="formType != 'watch'"
<el-button v-if="formType != 'watch'"
type="primary"
size="small"
:disabled="btnDisable"
@click="handleComfirm"
>{{ editConfig.confirmBtnName || "确定" }}</el-button
>
<slot
name="operateSup"
@click="handleComfirm">{{ editConfig.confirmBtnName || "确定" }}</el-button>
<slot name="operateSup"
v-bind:id="formId"
v-bind:info="fmData"
v-bind:formType="formType"
></slot>
v-bind:formType="formType"></slot>
</div>
<slot
name="bottomSup"
<slot name="bottomSup"
v-bind:id="formId"
v-bind:info="fmData"
v-bind:formType="formType"
></slot>
v-bind:formType="formType"></slot>
</div>
<div class="div_btn resi-btns" v-if="formBtnFixed">
<el-button size="small" @click="handleCancle">{{
<div class="div_btn resi-btns"
v-if="formBtnFixed">
<el-button size="small"
@click="handleCancle">{{
editConfig.cancelBtnName || "取消"
}}</el-button>
<el-button
v-if="formType != 'watch'"
<el-button v-if="formType != 'watch'"
type="primary"
size="small"
:disabled="btnDisable"
@click="handleComfirm"
>{{ editConfig.confirmBtnName || "确定" }}</el-button
>
<slot
name="operateSup"
@click="handleComfirm">{{ editConfig.confirmBtnName || "确定" }}</el-button>
<slot name="operateSup"
v-bind:id="formId"
v-bind:info="fmData"
v-bind:formType="formType"
></slot>
v-bind:formType="formType"></slot>
</div>
</div>
</template>
@ -397,7 +387,10 @@ export default {
data () {
return {
iniLoaded: false,
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false,
fmData: {},
@ -407,6 +400,8 @@ export default {
uploadUrl: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadqrcodeV2",
customerId: localStorage.getItem("customerId"),
addressItem: {}
};
},
computed: {},
@ -491,6 +486,8 @@ export default {
} else if (item.type == "address") {
this.$nextTick(async () => {
await nextTick(300);
this.addressItem = item
this.initMap(item);
});
}
@ -625,7 +622,7 @@ export default {
let { latitude, longitude } = this.$store.state.user;
map = new daiMap(
document.getElementById("app"),
document.getElementById("app_base"),
{ latitude, longitude },
{
zoom: 16.2, //
@ -638,9 +635,12 @@ export default {
map.on("dragend", (e) => {
this.handleMoveCenter(item, e);
});
// this.handleMoveCenter(item);
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
},
async handleSearchMap (item) {
const { msg, data } = await map.searchNearby(this.fmData[item.keyName]);
if (msg == "success") {
@ -666,9 +666,59 @@ export default {
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.fmData[item.keyName] = data.address;
this.searchValue = data.address
this.searchOptions = []
}
},
async remoteMethod (query) {
if (query !== '') {
this.loading = true;
const { msg, data } = await map.searchNearby(query);
this.loading = false;
this.resultList = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {
if (data.resultList && data.resultList.length > 0) {
this.resultList = data.resultList
this.searchOptions = this.resultList.map(item => {
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` };
});
}
} else {
this.searchOptions = [
{
value: '0',
label: '未检索到结果'
}
]
}
} else {
this.searchOptions = [];
}
},
handleClickKey (index) {
let selPosition = this.resultList[index]
let lonlat = selPosition.lonlat.split(" ")
map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]);
this.fmData[this.addressItem.supKeys[0]] = lonlat[1];
this.fmData[this.addressItem.supKeys[1]] = lonlat[0];
// this.formData.latitude = lonlat[1];
// this.formData.longitude = lonlat[0];
// this.formData.address = selPosition.address + selPosition.name
this.fmData[this.addressItem.keyName] = selPosition.address + selPosition.name
},
async getInfo () {
let url = this.infoUrl;
if (!url) return;

146
src/views/modules/shequzhili/event/cpts/add.vue

@ -130,49 +130,38 @@
</el-upload>
</el-form-item>
<el-form-item label="地位置"
prop="address"
<el-form-item label="地位置"
prop="longitude"
label-width="150px"
style="display: block">
<el-input class="cell-width-1"
v-model="formData.address">
</el-input>
<div style="width: 500px">
<el-select v-model="searchValue"
filterable
style="width: 500px"
remote
:reserve-keyword="true"
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading">
<el-option v-for="(item,index) in searchOptions"
@click.native="handleClickKey(index)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div id="app_event"
class="div_map"></div>
</div>
</el-form-item>
<el-form-item label="位置坐标"
prop="longitude"
<el-form-item label="详细地址"
prop="address"
label-width="150px"
style="display: block">
<div style="width: 500px">
<el-input class="item_width_4"
maxlength="50"
placeholder="请输入关键字"
<el-input class="cell-width-1"
v-model="formData.address">
</el-input>
<el-button style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="map_event"
class="div_map"></div>
<!-- <div style="margin-top: 10px" v-show="false">
<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>
</div>
@ -249,6 +238,7 @@ var geocoder; // 新建一个正逆地址解析类
function iniFmData () {
return {
gridId: "", //
reportUserId: "", // ID
name: "", //
@ -272,6 +262,10 @@ export default {
data () {
return {
formType: "add", // addeditdetail
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false,
gridList: [], //list--
@ -397,10 +391,9 @@ export default {
this.formData.latitude = latitude;
this.formData.longitude = longitude;
this.initMap();
map.setCenter(this.formData.latitude, this.formData.longitude);
map.setMarker(this.formData.latitude, this.formData.longitude);
this.handleMoveCenter()
this.initMap(this.formData.latitude, this.formData.longitude);
this.loadGrid();
this.getCategoryList();
@ -570,11 +563,10 @@ export default {
},
// init
initMap () {
let { latitude, longitude } = this.$store.state.user;
initMap (latitude, longitude) {
map = new daiMap(
document.getElementById("map_event"),
document.getElementById("app_event"),
{ latitude, longitude },
{
zoom: 16.2, //
@ -587,21 +579,14 @@ export default {
map.on("dragend", (e) => {
this.handleMoveCenter(e);
});
},
async handleSearchMap () {
const { msg, data } = await map.searchNearby(this.formData.address);
if (msg == "success") {
const { lat, lng } = data;
map.setCenter(lat, lng);
map.setMarker(lat, lng);
this.formData.latitude = lat;
this.formData.longitude = lng;
} else {
this.$message.error("未检索到相关位置坐标");
}
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
},
async handleMoveCenter (e) {
async handleMoveCenter () {
//
const { lat, lng } = map.getCenter();
this.formData.latitude = lat;
@ -610,13 +595,60 @@ export default {
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.formData.address = data.address;
this.formData.address = data.address
this.searchValue = data.address
this.searchOptions = []
}
},
async remoteMethod (query) {
if (query !== '') {
this.loading = true;
const { msg, data } = await map.searchNearby(query);
this.loading = false;
this.resultList = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {
if (data.resultList && data.resultList.length > 0) {
this.resultList = data.resultList
this.searchOptions = this.resultList.map(item => {
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` };
});
}
} else {
this.searchOptions = [
{
value: '0',
label: '未检索到结果'
}
]
}
} else {
this.searchOptions = [];
}
},
handleClickKey (index) {
let selPosition = this.resultList[index]
let lonlat = selPosition.lonlat.split(" ")
map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]);
this.formData.latitude = lonlat[1];
this.formData.longitude = lonlat[0];
this.formData.address = selPosition.address + selPosition.name
},
resetData () {
this.formData = iniFmData();
this.replayImgList = [];
this.searchValue = ''
this.searchOptions = []
this.resultList = []
},
//
startLoading () {

Loading…
Cancel
Save