|
@@ -7,101 +7,124 @@
|
|
|
:close-on-click-modal="false"
|
|
|
@close="cancel"
|
|
|
>
|
|
|
- <div class="form-dialog-box"
|
|
|
- :style="{ overflowY : !loading ? 'auto':'hidden'}"
|
|
|
- v-loading="loading"
|
|
|
- :element-loading-text="loadingText"
|
|
|
- element-loading-spinner="el-icon-loading"
|
|
|
- element-loading-background="rgba(0, 0, 0, 0.8)">
|
|
|
- <el-form :model="form" ref="form" :rules="rules" label-width="120px">
|
|
|
- <el-form-item label="点位名称:" prop="name">
|
|
|
- <el-input style="width: 350px;" v-model="form.name" placeholder="请输入点位名称" maxlength="20" show-word-limit />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="点位类型:" prop="typeId">
|
|
|
- <el-select v-model="form.typeId" clearable placeholder="请选择点位类型">
|
|
|
- <el-option
|
|
|
- v-for="item in pointTypeList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="营业时间:" prop="workTime">
|
|
|
- <el-input style="width: 350px;" v-model="form.workTime" placeholder="请输入营业时间" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="点位图片" prop="imgUrl">
|
|
|
- <div style="display: flex;">
|
|
|
- <div
|
|
|
- v-for="(item,index) in form.imgUrl"
|
|
|
- :key="index"
|
|
|
- style="width: 100px; height: 100px;position: relative;border: 1px solid #999;border-radius: 5px;margin-right: 20px;">
|
|
|
- <el-image
|
|
|
- style="width: 100%; height: 100%"
|
|
|
- :src="item"
|
|
|
- :preview-src-list="form.imgUrl">
|
|
|
- </el-image>
|
|
|
- <span @click="handleRemove(index)" style="position: absolute;top: -15px;right: -15px;color: red;font-size: 24px;z-index: 999;cursor: pointer;">
|
|
|
- <i class="el-icon-error"></i>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- style="width: 100px; height: 100px;"
|
|
|
- v-if="!form.imgUrl||form.imgUrl.length<5"
|
|
|
- v-loading="actionUrlLoading"
|
|
|
- element-loading-text="上传中..."
|
|
|
- element-loading-spinner="el-icon-loading"
|
|
|
- element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
- >
|
|
|
- <el-upload
|
|
|
- class="avatar-uploader"
|
|
|
- :action="actionUrl"
|
|
|
- :data="{
|
|
|
- bucket: 'tourism'
|
|
|
- }"
|
|
|
- :show-file-list="false"
|
|
|
- :before-upload="beforeAvatarUpload"
|
|
|
- :on-success="handleAvatarSuccess"
|
|
|
- :on-progress="handleAvatarProgress"
|
|
|
- :disabled="actionUrlLoading"
|
|
|
- :on-error="handleAvatarError"
|
|
|
- >
|
|
|
- <i class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
- </el-upload>
|
|
|
+ <div
|
|
|
+ class="form-dialog-info"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="form-dialog-box"
|
|
|
+ >
|
|
|
+ <el-form :model="form" ref="form" :rules="rules" label-width="120px">
|
|
|
+ <el-form-item label="点位名称:" prop="name">
|
|
|
+ <el-input style="width: 350px;" v-model="form.name" placeholder="请输入点位名称" maxlength="20" show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="点位类型:" prop="typeId">
|
|
|
+ <el-select v-model="form.typeId" clearable placeholder="请选择点位类型">
|
|
|
+ <el-option
|
|
|
+ v-for="item in pointTypeList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="营业时间:" prop="workTime">
|
|
|
+ <el-input style="width: 350px;" v-model="form.workTime" placeholder="请输入营业时间" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="点位图片" prop="imgUrl">
|
|
|
+ <div style="display: flex;">
|
|
|
+ <div
|
|
|
+ v-for="(item,index) in form.imgUrl"
|
|
|
+ :key="index"
|
|
|
+ style="width: 100px; height: 100px;position: relative;border: 1px solid #999;border-radius: 5px;margin-right: 20px;">
|
|
|
+ <el-image
|
|
|
+ style="width: 100%; height: 100%"
|
|
|
+ :src="item"
|
|
|
+ :preview-src-list="form.imgUrl">
|
|
|
+ </el-image>
|
|
|
+ <span @click="handleRemove(index)" style="position: absolute;top: -15px;right: -15px;color: red;font-size: 24px;z-index: 999;cursor: pointer;">
|
|
|
+ <i class="el-icon-error"></i>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="width: 100px; height: 100px;"
|
|
|
+ v-if="!form.imgUrl||form.imgUrl.length<5"
|
|
|
+ v-loading="actionUrlLoading"
|
|
|
+ element-loading-text="上传中..."
|
|
|
+ element-loading-spinner="el-icon-loading"
|
|
|
+ element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
+ >
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ :action="actionUrl"
|
|
|
+ :data="{
|
|
|
+ bucket: 'tourism'
|
|
|
+ }"
|
|
|
+ :show-file-list="false"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ :on-progress="handleAvatarProgress"
|
|
|
+ :disabled="actionUrlLoading"
|
|
|
+ :on-error="handleAvatarError"
|
|
|
+ >
|
|
|
+ <i class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+
|
|
|
</div>
|
|
|
-
|
|
|
+ <span>建议上传图片尺寸40px X 40px,支持jpg,png,gif,支持5MB大小以内的图片上传</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="语音包上传:" prop="voiceUrl">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ :action="actionUrl"
|
|
|
+ :before-upload="beforeUploadVoicUrl"
|
|
|
+ :on-success="handleSuccessVoicUrl"
|
|
|
+ :on-remove="handleRemoveVoicUrl"
|
|
|
+ :limit="1"
|
|
|
+ :on-exceed="handleExceedVoicUrl"
|
|
|
+ :file-list="form.voiceUrl">
|
|
|
+ <el-button size="small" type="primary">点击上传</el-button>
|
|
|
+ <div slot="tip" class="el-upload__tip">只能上传音频文件</div>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="点位信息:">
|
|
|
+ <el-input :rows="4" v-model="form.remark" type="textarea" placeholder="请输入点位信息" maxlength="500" show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="地图定位:">
|
|
|
+ <div style="display: flex;">
|
|
|
+ <el-form-item label="经度:" label-width="80px" prop="longitude">
|
|
|
+ <el-input style="width: 350px;" v-model="form.longitude" placeholder="请输入经度" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="纬度:" prop="latitude">
|
|
|
+ <el-input style="width: 350px;" v-model="form.latitude" placeholder="请输入纬度" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-button type="primary" @click="findLocation" style="margin-left: 10px;">查找位置</el-button>
|
|
|
</div>
|
|
|
- <span>建议上传图片尺寸40px X 40px,支持jpg,png,gif,支持5MB大小以内的图片上传</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="点位信息:">
|
|
|
- <el-input :rows="4" v-model="form.remark" type="textarea" placeholder="请输入点位信息" maxlength="500" show-word-limit />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="地图定位:">
|
|
|
- <div style="display: flex;">
|
|
|
- <el-form-item label="经度:" label-width="80px" prop="longitude">
|
|
|
- <el-input style="width: 350px;" v-model="form.longitude" placeholder="请输入经度" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="纬度:" prop="latitude">
|
|
|
- <el-input style="width: 350px;" v-model="form.latitude" placeholder="请输入纬度" />
|
|
|
- </el-form-item>
|
|
|
- <el-button type="primary" @click="findLocation" style="margin-left: 10px;">查找位置</el-button>
|
|
|
+ <el-form-item label="地址:" prop="address">
|
|
|
+ <el-input v-model="form.address" placeholder="请输入地址" />
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 腾讯地图 -->
|
|
|
+ <div style="width: 100%;height: 300px;margin-bottom: 20px;">
|
|
|
+ <qqMapBox ref="qqMapBox" @setDot="setDot" />
|
|
|
</div>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="地址:" prop="address">
|
|
|
- <el-input v-model="form.address" placeholder="请输入地址" />
|
|
|
- </el-form-item>
|
|
|
- <!-- 腾讯地图 -->
|
|
|
- <div style="width: 100%;height: 300px;margin-bottom: 20px;">
|
|
|
- <qqMapBox ref="qqMapBox" @setDot="setDot" />
|
|
|
- </div>
|
|
|
- <!-- 手绘图的位置 -->
|
|
|
- <el-form-item label="手绘图定位:" prop="margin">
|
|
|
- <span>{{ form.margin ? form.margin : '请在图上标记出点位' }}</span>
|
|
|
- </el-form-item>
|
|
|
- <div style="width: 100%;height: 600px;">
|
|
|
- <imageContainer v-model="form.margin" ref="imageContainer"></imageContainer>
|
|
|
- </div>
|
|
|
- </el-form>
|
|
|
+ <!-- 手绘图的位置 -->
|
|
|
+ <el-form-item label="手绘图定位:" prop="margin">
|
|
|
+ <span>{{ form.margin ? form.margin : '请在图上标记出点位' }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <div style="width: 100%;height: 600px;">
|
|
|
+ <imageContainer v-model="form.margin" ref="imageContainer"></imageContainer>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ v-if="loading"
|
|
|
+ class="form-dialog-loading"
|
|
|
+ v-loading="loading"
|
|
|
+ :element-loading-text="loadingText"
|
|
|
+ element-loading-spinner="el-icon-loading"
|
|
|
+ element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
+ ></div>
|
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer" v-if="formStatus==1">
|
|
|
<el-button @click="cancel">取消</el-button>
|
|
@@ -117,6 +140,7 @@
|
|
|
</el-button>
|
|
|
</span>
|
|
|
<!-- 添加或修改对话框 End -->
|
|
|
+
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
@@ -165,6 +189,7 @@ export default {
|
|
|
// 上传文件
|
|
|
actionUrl: process.env.VUE_APP_BASE_API + process.env.VUE_APP_UPLOAD_IMAGE,
|
|
|
actionUrlLoading: false,
|
|
|
+ fileList: []
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -181,7 +206,8 @@ export default {
|
|
|
if(model=='ADD') { // 新增
|
|
|
this.$set(this,'form',{
|
|
|
...row,
|
|
|
- imgUrl: []
|
|
|
+ imgUrl: [],
|
|
|
+ voiceUrl: []
|
|
|
})
|
|
|
let res1 = await getTableDeatilsByIdApi(this.configUrl.imageUrl)
|
|
|
if(res1.code == 200){
|
|
@@ -205,7 +231,11 @@ export default {
|
|
|
}else if(model=='EDIT') { // 新增
|
|
|
let obj = {
|
|
|
...row,
|
|
|
- imgUrl: row.imgUrl?row.imgUrl.split(','):[]
|
|
|
+ imgUrl: row.imgUrl?row.imgUrl.split(','):[],
|
|
|
+ voiceUrl: row.voiceUrl ? [{
|
|
|
+ name: row.voiceUrl.substring(row.voiceUrl.lastIndexOf('/')+1),
|
|
|
+ url: row.voiceUrl
|
|
|
+ }] : []
|
|
|
}
|
|
|
if(row.marginLeft) {
|
|
|
obj['margin'] = row.marginLeft + ',' + row.marginTop
|
|
@@ -298,9 +328,19 @@ export default {
|
|
|
this.loading = true
|
|
|
this.loadingText = "提交数据中..."
|
|
|
let params = JSON.parse(JSON.stringify(this.form))
|
|
|
- if(params.imgUrl) {
|
|
|
+ if(params.imgUrl && params.imgUrl.length>0) {
|
|
|
params.imgUrl = params.imgUrl.join(',')
|
|
|
+ }else {
|
|
|
+ params.imgUrl = ''
|
|
|
+ }
|
|
|
+ if(params.voiceUrl && params.voiceUrl.length>0) {
|
|
|
+ params.voiceUrl = params.voiceUrl.map((item)=>{
|
|
|
+ return item.url
|
|
|
+ }).join(',')
|
|
|
+ }else {
|
|
|
+ params.voiceUrl = ''
|
|
|
}
|
|
|
+ console.log('form====',this.form)
|
|
|
if(params.margin) {
|
|
|
let list = params.margin.split(',')
|
|
|
params['marginTop'] = list[1]
|
|
@@ -439,22 +479,59 @@ export default {
|
|
|
}else {
|
|
|
this.$message.error('请输入经纬度!!!');
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ beforeUploadVoicUrl(file) {
|
|
|
+ // 限制文件类型为音频
|
|
|
+ const allowedTypes = ['audio/mpeg', 'audio/ogg', 'audio/mp3', 'audio/mp4', 'audio/wav'];
|
|
|
+ const isAudio = allowedTypes.includes(file.type);
|
|
|
+ if (!isAudio) {
|
|
|
+ this.$message.error('只能上传音频文件!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 其他验证规则...
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ handleSuccessVoicUrl(response, file, fileList) {
|
|
|
+ console.log(response, file, fileList)
|
|
|
+ this.$set(this.form,'voiceUrl',[{
|
|
|
+ name: response.data.name,
|
|
|
+ url: response.data.url
|
|
|
+ }])
|
|
|
+ },
|
|
|
+ handleRemoveVoicUrl(file, fileList) {
|
|
|
+ console.log(file, fileList);
|
|
|
+ this.$set(this.form,'voiceUrl',[])
|
|
|
+ },
|
|
|
+ handleExceedVoicUrl(files, fileList) {
|
|
|
+ this.$message.warning(`只能上传一个文件,请删除除再上传!!!`);
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+.form-dialog-info {
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
+.form-dialog-loading {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ z-index: 99999999;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
.form-dialog-box {
|
|
|
- padding: 0 30px;
|
|
|
- padding: 0 30px;
|
|
|
+ padding: 0 30px;
|
|
|
min-height: 50vh;
|
|
|
max-height: 65vh;
|
|
|
- overflow-y: hidden;
|
|
|
- >div {
|
|
|
- width: 100%;
|
|
|
- min-height: 50vh;
|
|
|
- }
|
|
|
+ overflow-y: auto;
|
|
|
+
|
|
|
+ // >div {
|
|
|
+ // width: 100%;
|
|
|
+ // min-height: 50vh;
|
|
|
+ // }
|
|
|
.form-title {
|
|
|
padding: 0 0 10px 0;
|
|
|
span {
|