Browse Source

共享图片接口对接

luckysheet_xiaowang
是小王呀\24601 6 months ago
parent
commit
dff4b103cd
  1. 124
      src/views/modules/base/smartExcel/cpts/picture-add.vue
  2. 101
      src/views/modules/base/smartExcel/cpts/picture-collection.vue

124
src/views/modules/base/smartExcel/cpts/picture-add.vue

@ -11,7 +11,7 @@
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="图片集封面" label-width="150px" prop="fileList">
<el-form-item label="图片集封面" label-width="150px" prop="coverPicture">
<template>
<upload-image :defaultFileList="fileList" :limit="1" @change="onChangeFileList"
@file-removed="removedImg"></upload-image>
@ -33,7 +33,7 @@
</div>
<div class="div_btn">
<el-button size="small" @click="handleCancle"> </el-button>
<el-button size="small" v-if="formType != 'detail'" type="primary" :disabled="btnDisable"
<el-button size="small" type="primary"
@click="handleComfirm"> </el-button>
</div>
@ -80,8 +80,10 @@
label:"本级和直接上下级组织共享"
},
],
formType:"add",
formData:
{
coverPicture:"",
albumName:"",
sharedScope:""
@ -97,27 +99,15 @@
components: {Tinymce, UploadImage },
mounted() {
this.activityType()
this.listServerOrg()
},
methods: {
async activityType() {
this.$nextTick(() => {
if (!map) {
this.initMap(this.formData.latitude, this.formData.longitude);
console.log("map", map,this.formData.latitude, this.formData.longitude)
} else {
map.setCenter(this.formData.latitude, this.formData.longitude);
map.setMarker(this.formData.latitude, this.formData.longitude);
console.log("mapmapmap", map)
}
})
},
removedImg() {
this.formData.coverPic = ''
this.formData.coverPicture = ''
},
onChangeFileList(e) {
this.startLoading()
console.log(e, 'sssssb');
this.fileList = e.length > 0 ? e.map(item => ({
fileType: '0',
@ -128,21 +118,21 @@
} else {
this.formData.coverPicture = '';
}
this.endLoading()
},
async initForm(type, activityId) {
this.startLoading()
this.formType = type
console.log(type,activityId,"进行修改");
if (type === 'edit') {
this.formData = activityId
if (activityId.coverPic) {
if (activityId.coverPicture) {
let ob = {
fileType: '0',
fileUrl: activityId.coverPic
fileUrl: activityId.coverPicture
};
this.fileList = [ob];
this.formData.coverPic = ob.fileUrl;
this.formData.coverPicture = ob.fileUrl;
}
} else {
@ -150,74 +140,20 @@
this.endLoading()
},
async getDemandOptions() {
this.$http
.post("/actual/base/serviceitem/listAllCategory",{})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
console.log(res.data);
this.demandOptions = this.getFlagData(
this.getTreeData(res.data),
"usableFlag"
);
}
})
.catch(() => {
return this.$message.error("网络错误");
});
},
getFlagData(data, flag) {
if (!Array.isArray(data)) return [];
let arr1 = data.filter((item) => item[flag]);
let arr2 = arr1.map((item) => {
if (item.childCateList)
return { ...item, childCateList: this.getFlagData(item.childCateList, flag) };
else return item;
});
return arr2;
},
getTreeData(data) {
if (!Array.isArray(data)) return [];
let arr = data.map((item) => {
let _item = {};
if (item.childCateList) {
if (item.childCateList.length === 0)
_item = { ...item, childCateList: undefined };
else _item = { ...item, childCateList: this.getTreeData(item.childCateList) };
} else {
_item = { ...item };
async handleComfirm() {
if(!this.formData.albumName){
return this.$message.error("请输入图片集名称")
}
return _item;
});
return arr;
},
async loadGrid() {
const url = "/gov/org/customergrid/gridoption"
let params = {
agencyId: this.agencyId
if(!this.formData.coverPicture){
return this.$message.error("请上传封面图片")
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.gridList = data
} else {
this.$message.error(msg)
if(!this.formData.sharedScope){
return this.$message.error("请选择共享范围")
}
},
async handleComfirm() {
this.addActivity()
},
async addActivity() {
if(this.formType=="add"){
let url = '/actual/base/albums/save'
const { data, code, msg } = await requestPost(url, this.formData)
if (code === 0) {
@ -228,12 +164,22 @@
} else {
this.$message.error(msg)
}
console.log("sdlkfjklsdf ");
this.$emit('closeAdd')
},
}else{
let url = '/actual/base/albums/update'
const { data, code, msg } = await requestPost(url, this.formData)
if (code === 0) {
this.$message({
type: 'success',
message: '操作成功'
})
} else {
this.$message.error(msg)
}
this.$emit('closeAdd')
}
},
handleCancle() {
console.log("sdlkfjklsdf ");
this.$emit('closeAdd')
@ -260,13 +206,13 @@
computed: {
dataRule() {
return {
columnId: [
albumName: [
{ required: true, message: '请输入图片集名称', trigger: 'blur' }
],
title: [
sharedScope: [
{ required: true, message: '请选择共享范围', trigger: 'blur' }
],
fileList: [
coverPicture: [
{ required: true, message: '请选择图片集封面', trigger: 'blur' }
]
}

101
src/views/modules/base/smartExcel/cpts/picture-collection.vue

@ -13,24 +13,24 @@
<div style="margin: 30px 30px 100px 30px ">
<div style="position: relative;">
<div style="position: absolute;z-index: 10; right: 20px;top: -20px; ">
<el-dropdown @command="onClickEdit">
<el-dropdown >
<span class="el-dropdown-link" style="color: blue;">
. . .
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="item">修改</el-dropdown-item>
<el-dropdown-item :command="item">删除</el-dropdown-item>
<el-dropdown-item @click.native="onClickEdit(item,'edit')">修改</el-dropdown-item>
<el-dropdown-item @click.native="onClickEdit(item,'del')">删除</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<img :src="require(`@/assets/images/index/imageBackground.png`)" alt=""
style=" position: absolute; cursor:pointer; height: 180px;width: 200px; ">
<img :src="item.src ? `${item.src}` : require(`@/assets/images/index/noPictures.png`)"
<img :src="item.coverPicture ? `${item.coverPicture}` : require(`@/assets/images/index/noPictures.png`)"
@click="onPictureList" alt="" style=" top: -20px;
left: -20px;; position: absolute; cursor:pointer; height: 180px; width: 200px;">
</div>
</div>
<div style="position: relative; bottom: -120px;left: 30px; font-size: 14px;">{{ item.title }}
<div style="position: relative; bottom: -120px;left: 30px; font-size: 14px;">{{ item.albumName }}
</div>
</div>
</div>
@ -57,40 +57,6 @@ data() {
showPictureList:false,
formShow:false,
pictureList:[
{
id:"1001",
src:"https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/dev/20250224/8b8a174ea85e48e684267ce1a3f10dd1.jpg",
title:"嘉定山社区网格巡查"
},
{
src:"https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/dev/20250224/8b8a174ea85e48e684267ce1a3f10dd1.jpg",
title:"嘉定山社区网格巡查"
},
{
src:"https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/dev/20250224/8b8a174ea85e48e684267ce1a3f10dd1.jpg",
title:"嘉定山社区网格巡查"
},
{
src:"https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/dev/20250224/8b8a174ea85e48e684267ce1a3f10dd1.jpg",
title:"嘉定山社区网格巡查"
},
{
src:"https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/dev/20250224/8b8a174ea85e48e684267ce1a3f10dd1.jpg",
title:"嘉定山社区网格巡查"
},
{
src:"https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/dev/20250224/8b8a174ea85e48e684267ce1a3f10dd1.jpg",
title:"嘉定山社区网格巡查"
},
{
src:"https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/dev/20250224/8b8a174ea85e48e684267ce1a3f10dd1.jpg",
title:"嘉定山社区网格巡查"
},
{
src:"",
title:"嘉定山社区网格巡查"
},
],
name:"",
pageNo: 1,
@ -106,13 +72,22 @@ mounted() {
this.getTableData()
},
methods: {
onSelect(){
console.log(this.name,"dsflkjslkdf");
async getTableData() {
const url = "/actual/base/albums/page";
const { data, code, msg } = await requestGet(url, {
name:this.name,
});
if (code === 0) {
this.pictureList=data.list
} else {
this.$message.error(msg);
}
},
onSelect(){
this.getTableData()
},
closePictureList(){
console.log("dslkfjklsd");
this.showPictureList=false
},
onPictureList(){
@ -120,8 +95,8 @@ methods: {
},
closeAdd(){
console.log("dsfjklsdfjl");
this.formShow=false
this.getTableData()
},
onClick(type,id){
console.log(type,"这是点击");
@ -130,11 +105,43 @@ methods: {
this.$refs.ref_form.initForm(type,id);
});
},
onClickEdit(item){
this.formShow=true
onClickEdit(item,val){
console.log(item,val,"ds.lm;sd");
if (val === 'del') {
this.$confirm("确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.handleDelete(item)
})
.catch(err => {
if (err == "cancel") {
}
});
} else {
this.formShow = true
this.$nextTick(() => {
this.$refs.ref_form.initForm("edit",item);
this.$refs.ref_form.initForm("edit", item);
});
}
},
async handleDelete(row) {
const url = "/actual/base/albums/delete"
let ids = [row.id]
const { data, code, msg } = await requestPost(url, ids)
if (code === 0) {
this.$message({
type: "success",
message: "删除成功"
});
this.getTableData()
this.loadTable()
} else {
this.$message.error(msg)
}
},
},

Loading…
Cancel
Save