feat(系统公告管理): 修改弹窗的图片上传问题修复

This commit is contained in:
hzj 2025-10-16 14:13:13 +08:00
parent e0ed82f60f
commit 99ae9e0957

View File

@ -15,10 +15,8 @@
:value="item.value"
>
<span style="float: left;">
<sys-origin-icon
:icon="item.value"
:desc="item.value"
/></span>
<sys-origin-icon :icon="item.value" :desc="item.value"
/></span>
<span style="float: left;margin-left:10px">{{ item.label }}</span>
</el-option>
</el-select>
@ -115,11 +113,7 @@
/>
</template>
</el-table-column>
<el-table-column
prop="announcementTime"
label="发布时间"
align="center"
>
<el-table-column prop="announcementTime" label="发布时间" align="center">
<template slot-scope="scope">
{{ scope.row.announcementTime | dateFormat }}
</template>
@ -139,14 +133,12 @@
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button
type="text"
@click.native="handleUpdate(scope.row)"
>修改</el-button>
<el-button
type="text"
@click.native="handlDel(scope.row.id)"
>删除</el-button>
<el-button type="text" @click.native="handleUpdate(scope.row)"
>修改</el-button
>
<el-button type="text" @click.native="handlDel(scope.row.id)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@ -180,11 +172,9 @@
fit="fill"
style="width: 50px; height: 50px"
/>
<el-button
v-loading="uploadLoading"
size="small"
type="primary"
>点击上传</el-button>
<el-button v-loading="uploadLoading" size="small" type="primary"
>点击上传</el-button
>
</el-upload>
</el-form-item>
<el-form-item label="系统" prop="sysOrigin">
@ -201,10 +191,8 @@
:value="item.value"
>
<span style="float: left;">
<sys-origin-icon
:icon="item.value"
:desc="item.value"
/></span>
<sys-origin-icon :icon="item.value" :desc="item.value"
/></span>
<span style="float: left;margin-left:10px">{{
item.label
}}</span>
@ -228,7 +216,8 @@
<span
class="numberV"
style="position: absolute; right: 10px;bottom: 0;"
>{{ txtVal }}/300</span>
>{{ txtVal }}/300</span
>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm()">保存</el-button>
@ -248,21 +237,21 @@ import {
addNoticeMessage,
changeAnnouncementStatus,
changeShelfStatus
} from '@/api/notice-message'
import Pagination from '@/components/Pagination'
import { getAddressUrl } from '@/api/oss'
import { productConfigShowcase, announcementArray } from '@/constant/type'
import { pickerOptions } from '@/constant/el-const'
import { mapGetters } from 'vuex'
} from "@/api/notice-message";
import Pagination from "@/components/Pagination";
import { getAccessImgUrl } from "@/api/oss";
import { productConfigShowcase, announcementArray } from "@/constant/type";
import { pickerOptions } from "@/constant/el-const";
import { mapGetters } from "vuex";
function getFormData() {
return {
id: '',
cover: '',
sysOrigin: '',
title: '',
link: '',
description: ''
}
id: "",
cover: "",
sysOrigin: "",
title: "",
link: "",
description: ""
};
}
export default {
components: { Pagination },
@ -272,7 +261,7 @@ export default {
productConfigShowcase,
pickerOptions,
txtVal: 0,
activeGiftId: '',
activeGiftId: "",
pushTextHistoryLoading: false,
pushTextHistoryVisible: false,
pushTextHistory: [],
@ -282,28 +271,28 @@ export default {
listQuery: {
cursor: 1,
limit: 20,
sysOrigin: '',
startTime: '',
endTime: ''
sysOrigin: "",
startTime: "",
endTime: ""
},
formVisible: false,
textOptTitle: '',
textOptTitle: "",
form: getFormData(),
submitLoading: false,
rules: {
sysOrigin: [{ required: true, message: '请选择系统', trigger: 'blur' }],
title: [{ required: true, message: '请填写标题', trigger: 'blur' }],
sysOrigin: [{ required: true, message: "请选择系统", trigger: "blur" }],
title: [{ required: true, message: "请填写标题", trigger: "blur" }],
description: [
{ required: true, message: '请填写描述', trigger: 'blur' }
{ required: true, message: "请填写描述", trigger: "blur" }
]
},
rangeDate: '',
rangeDate: "",
listLoading: true,
uploadLoading: false
}
};
},
computed: {
...mapGetters(['permissionsSysOriginPlatforms'])
...mapGetters(["permissionsSysOriginPlatforms"])
},
watch: {
rangeDate: {
@ -311,185 +300,183 @@ export default {
deep: true,
handler(newVal) {
if (newVal && newVal.length > 0) {
this.listQuery.startTime = newVal[0]
this.listQuery.endTime = newVal[1]
return
this.listQuery.startTime = newVal[0];
this.listQuery.endTime = newVal[1];
return;
}
this.listQuery.startTime = ''
this.listQuery.endTime = ''
this.listQuery.startTime = "";
this.listQuery.endTime = "";
}
}
},
created() {
const that = this
const querySystem = this.permissionsSysOriginPlatforms[0]
const that = this;
const querySystem = this.permissionsSysOriginPlatforms[0];
if (!querySystem) {
return
return;
}
that.listQuery.sysOrigin = querySystem.value
that.renderData()
that.listQuery.sysOrigin = querySystem.value;
that.renderData();
},
methods: {
renderData() {
const that = this
that.listLoading = true
const that = this;
that.listLoading = true;
noticeMessageTable(that.listQuery).then(res => {
const { body } = res
that.total = body.total || 0
that.list = body.records
that.listLoading = false
})
const { body } = res;
that.total = body.total || 0;
that.list = body.records;
that.listLoading = false;
});
},
handleSearch() {
this.renderData()
this.renderData();
},
handleSwitchAnnouncementChange(row) {
const that = this
const that = this;
if (!row.announcement) {
this.$message({
message: '不可以取消发布',
type: 'error'
})
row.announcement = true
return
message: "不可以取消发布",
type: "error"
});
row.announcement = true;
return;
}
that
.$confirm('确认发布公告吗?发布后不可以取消!', '提示', {
type: 'warning'
.$confirm("确认发布公告吗?发布后不可以取消!", "提示", {
type: "warning"
})
.then(() => {
that.listLoading = true
that.listLoading = true;
changeAnnouncementStatus(row.id)
.then(res => {
this.listLoading = false
this.listLoading = false;
this.$message({
message: '发布成功',
type: 'success'
})
this.renderData()
message: "发布成功",
type: "success"
});
this.renderData();
})
.catch(() => {})
.catch(() => {});
})
.catch(() => {
if (!row.announcement) {
row.announcement = true
row.announcement = true;
} else if (row.announcement) {
row.announcement = false
row.announcement = false;
}
})
});
},
handleSwitchShelfStatusChange(row) {
changeShelfStatus(row.id, row.shelfStatus)
.then(res => {
this.$message({
message: row.shelfStatus ? '上架 成功' : '下架 成功',
type: 'success'
})
message: row.shelfStatus ? "上架 成功" : "下架 成功",
type: "success"
});
})
.catch(er => {
if (row.status === 0) {
row.status = 1
row.status = 1;
} else if (row.status === 1) {
row.status = 0
row.status = 0;
}
})
});
},
renderDataSuccess() {
this.$message({
message: 'Successful',
type: 'success'
})
this.renderData()
message: "Successful",
type: "success"
});
this.renderData();
},
queryUserDetails(row) {
this.userDeatilsDrawer = true
this.thatSelectedUserId = row.id
this.userDeatilsDrawer = true;
this.thatSelectedUserId = row.id;
},
submitForm() {
const that = this
const that = this;
that.$refs.form.validate(valid => {
if (valid) {
that.submitLoading = true
that.submitLoading = true;
if (that.form.id) {
updateNoticeMessage(that.form)
.then(res => {
that.submitLoading = false
that.formVisible = false
that.form = getFormData()
that.renderData()
that.submitLoading = false;
that.formVisible = false;
that.form = getFormData();
that.renderData();
})
.catch(er => {
that.submitLoading = false
that.$emit('fial', er)
})
return
that.submitLoading = false;
that.$emit("fial", er);
});
return;
}
addNoticeMessage(that.form)
.then(res => {
that.submitLoading = false
that.formVisible = false
that.form = getFormData()
that.renderData()
that.submitLoading = false;
that.formVisible = false;
that.form = getFormData();
that.renderData();
})
.catch(er => {
that.submitLoading = false
console.error(er)
that.$emit('fial', er)
})
that.submitLoading = false;
console.error(er);
that.$emit("fial", er);
});
} else {
console.error('error submit!!')
return false
console.error("error submit!!");
return false;
}
})
});
},
//
handlDel(id) {
this.$confirm('确认删除吗?', '提示', {
type: 'warning'
this.$confirm("确认删除吗?", "提示", {
type: "warning"
})
.then(() => {
this.listLoading = true
this.listLoading = true;
deleteNoticeMessage(id).then(res => {
this.listLoading = false
this.listLoading = false;
this.$message({
message: '删除成功',
type: 'success'
})
this.renderData()
})
message: "删除成功",
type: "success"
});
this.renderData();
});
})
.catch(() => {})
.catch(() => {});
},
handleClose() {
this.formVisible = false
this.formVisible = false;
},
descInput() {
this.txtVal = this.form.description.length
this.txtVal = this.form.description.length;
},
httpRequest(file) {
const that = this
that.uploadLoading = true
const that = this;
that.uploadLoading = true;
this.$simpleUploadFlie(file)
.then(res => {
that.uploadLoading = false
getAddressUrl(res.name).then(result => {
that.form.cover = result.body
})
that.uploadLoading = false;
that.form.cover = getAccessImgUrl(res.name);
})
.catch(er => {
that.uploadLoading = false
})
that.uploadLoading = false;
});
},
handleCreate() {
this.formVisible = true
this.textOptTitle = '添加'
this.form = getFormData()
this.formVisible = true;
this.textOptTitle = "添加";
this.form = getFormData();
},
handleUpdate(row) {
this.textOptTitle = '修改'
this.formVisible = true
this.form = Object.assign(this.form, row)
this.textOptTitle = "修改";
this.formVisible = true;
this.form = Object.assign(this.form, row);
}
}
}
};
</script>