故障申报更新,广告,系统公告

This commit is contained in:
SjS 2025-04-01 18:02:41 +08:00
parent d6c6669492
commit b7f736f586
2 changed files with 384 additions and 0 deletions

44
src/api/bst/ad.js Normal file
View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询广告列表
export function listAd(query) {
return request({
url: '/bst/ad/list',
method: 'get',
params: query
})
}
// 查询广告详细
export function getAd(adId) {
return request({
url: '/bst/ad/' + adId,
method: 'get'
})
}
// 新增广告
export function addAd(data) {
return request({
url: '/bst/ad',
method: 'post',
data: data
})
}
// 修改广告
export function updateAd(data) {
return request({
url: '/bst/ad',
method: 'put',
data: data
})
}
// 删除广告
export function delAd(adId) {
return request({
url: '/bst/ad/' + adId,
method: 'delete'
})
}

340
src/views/bst/ad/index.vue Normal file
View File

@ -0,0 +1,340 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="广告图片" prop="picture">
<el-input
v-model="queryParams.picture"
placeholder="请输入广告图片"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="跳转链接" prop="url">
<el-input
v-model="queryParams.url"
placeholder="请输入跳转链接"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="逻辑删除标志0否1是" prop="deleted">
<el-input
v-model="queryParams.deleted"
placeholder="请输入逻辑删除标志0否1是"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-has-permi="['bst:ad:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-has-permi="['bst:ad:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-has-permi="['bst:ad:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="adList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
<el-table-column type="selection" width="55" align="center" />
<template v-for="column of showColumns">
<el-table-column
:key="column.key"
:label="column.label"
:prop="column.key"
:align="column.align"
:min-width="column.minWidth"
:sort-orders="orderSorts"
:sortable="column.sortable"
:show-overflow-tooltip="column.overflow"
:width="column.width"
>
<template slot-scope="d">
<template v-if="column.key === 'adId'">
{{d.row[column.key]}}
</template>
<template v-else>
{{d.row[column.key]}}
</template>
</template>
</el-table-column>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-has-permi="['bst:ad:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-has-permi="['bst:ad:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改广告对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<form-col :span="span" label="广告图片" prop="picture">
<el-input v-model="form.picture" placeholder="请输入广告图片" />
</form-col>
<form-col :span="span" label="跳转链接" prop="url">
<el-input v-model="form.url" placeholder="请输入跳转链接" />
</form-col>
<form-col :span="span" label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</form-col>
<form-col :span="span" label="逻辑删除标志0否1是" prop="deleted">
<el-input v-model="form.deleted" placeholder="请输入逻辑删除标志0否1是" />
</form-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listAd, getAd, delAd, addAd, updateAd } from "@/api/bst/ad";
import { $showColumns } from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue";
//
const defaultSort = {
prop: "createTime",
order: "descending"
}
export default {
name: "Ad",
mixins: [$showColumns],
components: {FormCol},
data() {
return {
span: 24,
//
columns: [
{key: 'adId', visible: true, label: '广告ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'type', visible: true, label: '广告类型 1活动推广', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'picture', visible: true, label: '广告图片', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'url', visible: true, label: '跳转链接', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'remark', visible: true, label: '备注', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'deleted', visible: true, label: '逻辑删除标志0否1是', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'urlType', visible: true, label: '跳转类型1外链跳转2站内跳转', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
],
//
orderSorts: ['ascending', 'descending', null],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// 广
adList: [],
//
title: "",
//
open: false,
defaultSort,
//
queryParams: {
pageNum: 1,
pageSize: 20,
orderByColumn: defaultSort.prop,
isAsc: defaultSort.order,
type: null,
picture: null,
url: null,
deleted: null,
urlType: null
},
//
form: {},
//
rules: {
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
deleted: [
{ required: true, message: "逻辑删除标志0否1是不能为空", trigger: "blur" }
],
urlType: [
{ required: true, message: "跳转类型1外链跳转2站内跳转不能为空", trigger: "change" }
]
}
};
},
created() {
this.getList();
},
methods: {
/** 当排序按钮被点击时触发 **/
onSortChange(column) {
if (column.order == null) {
this.queryParams.orderByColumn = defaultSort.prop;
this.queryParams.isAsc = defaultSort.order;
} else {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
}
this.getList();
},
/** 查询广告列表 */
getList() {
this.loading = true;
listAd(this.queryParams).then(response => {
this.adList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
adId: null,
type: null,
picture: null,
url: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
deleted: null,
urlType: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.adId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加广告";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const adId = row.adId || this.ids
getAd(adId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改广告";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.adId != null) {
updateAd(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addAd(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const adIds = row.adId || this.ids;
this.$modal.confirm('是否确认删除广告编号为"' + adIds + '"的数据项?').then(function() {
return delAd(adIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('bst/ad/export', {
...this.queryParams
}, `ad_${new Date().getTime()}.xlsx`)
}
}
};
</script>