fix: 公告内容排版处理
This commit is contained in:
parent
8dbaa7aa36
commit
477519867e
|
@ -71,7 +71,7 @@
|
|||
</el-row>
|
||||
</el-card>
|
||||
|
||||
<el-card class="table-card" shadow="never">
|
||||
<div class="table-container">
|
||||
<div style="margin-bottom: 15px;">
|
||||
<el-button type="primary" size="small" @click="addProduct">添加商品</el-button>
|
||||
<el-button :disabled="selectList.length <= 0" type="danger" size="small" @click="deleteProduct">批量删除</el-button>
|
||||
|
@ -169,7 +169,7 @@
|
|||
:total="pagination.total"
|
||||
class="pagination-container"
|
||||
></el-pagination>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<!-- 添加或编辑 -->
|
||||
<add-or-update @queryList="fetchData" ref="addOrUpdate"></add-or-update>
|
||||
|
|
|
@ -1,130 +1,65 @@
|
|||
<template>
|
||||
<div>
|
||||
<div style="height: calc(100vh - 200px)">
|
||||
<obj-table-plus
|
||||
ref="oTable"
|
||||
style="height: 100%"
|
||||
:tableCols="tableCols"
|
||||
:tableProp="tableProp"
|
||||
@query="queryList"
|
||||
v-model="dataList"
|
||||
:tableEvent="tableEvent"
|
||||
>
|
||||
<template slot="tableTop">
|
||||
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
||||
<!-- <el-form-item label="模块">
|
||||
<el-select
|
||||
@change="changePosition"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
v-model="formInline.position"
|
||||
placeholder="请选择模块"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in [
|
||||
{
|
||||
label: '菜市场详情页',
|
||||
value: '2',
|
||||
},
|
||||
{
|
||||
label: '摊位详情',
|
||||
value: '3',
|
||||
},
|
||||
]"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="storeList.length > 1 && formInline.position === '3'"
|
||||
label="摊铺"
|
||||
>
|
||||
<el-select
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
v-model="formInline.targetId"
|
||||
placeholder="请选择摊铺"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storeList"
|
||||
:key="item.shopId"
|
||||
:label="item.shopName"
|
||||
:value="item.shopId"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型">
|
||||
<el-select
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
v-model="formInline.type"
|
||||
placeholder="请选择分类类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in type"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="应用">
|
||||
<el-select
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
v-model="formInline.app"
|
||||
placeholder="请选择分类类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in application"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="$refs.oTable.reload()"
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button type="primary" @click="Reset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane
|
||||
v-for="item in statusList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:name="item.value"
|
||||
></el-tab-pane>
|
||||
</el-tabs> -->
|
||||
<div class="mb-2">
|
||||
<el-button type="primary" size="small" @click="addBanner"
|
||||
>新增公告</el-button
|
||||
>
|
||||
<el-button type="primary" size="small" @click="setSort"
|
||||
>排序</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</obj-table-plus>
|
||||
<div class="page-container">
|
||||
<el-card class="search-card" shadow="never">
|
||||
<el-form :model="formInline" :inline="true" ref="searchForm" class="search-form" size="small">
|
||||
<el-form-item label="应用" prop="app">
|
||||
<el-select v-model="formInline.app" placeholder="请选择应用" style="width: 200px;">
|
||||
<el-option v-for="item in application" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery" icon="el-icon-search" size="small">查询</el-button>
|
||||
<el-button @click="Reset" icon="el-icon-refresh" size="small">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<div class="table-container">
|
||||
<div style="margin-bottom: 15px;">
|
||||
<el-button type="primary" size="small" @click="addBanner">新增公告</el-button>
|
||||
<el-button type="primary" size="small" @click="setSort">排序</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="dataList" style="width: 100%">
|
||||
<el-table-column type="index" width="60" align="center" label="序号" />
|
||||
<el-table-column prop="title" label="公告通知" align="center" />
|
||||
<el-table-column label="位置" align="center" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ getPosition(scope.row.position) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.status ? 'success' : 'info'">{{ scope.row.status ? "已启用" : "已禁用" }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort" label="排序" align="center" width="80" />
|
||||
<el-table-column label="操作" fixed="right" align="center" width="220">
|
||||
<template slot-scope="scope">
|
||||
<el-button style="margin-right: 10px" size="mini" type="primary" @click="updateBanner(scope.row)">编辑</el-button>
|
||||
<el-popconfirm @onConfirm="deleteBanner(scope.row)" confirm-button-text="确定" cancel-button-text="取消" icon="el-icon-info" icon-color="red" title="确定删除吗?">
|
||||
<el-button size="mini" type="danger" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="limit"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
class="pagination-container"
|
||||
></el-pagination>
|
||||
</div>
|
||||
|
||||
<!-- 轮播图 -->
|
||||
<addOrUpdate
|
||||
ref="addOrUpdate"
|
||||
@queryList="$refs.oTable.reload()"
|
||||
></addOrUpdate>
|
||||
<addOrUpdate ref="addOrUpdate" @queryList="queryList"></addOrUpdate>
|
||||
<!-- 排序 -->
|
||||
<setSorting
|
||||
@queryList="$refs.oTable.reload()"
|
||||
ref="setSorting"
|
||||
></setSorting>
|
||||
<setSorting @queryList="queryList" ref="setSorting"></setSorting>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -136,31 +71,15 @@ export default {
|
|||
components: { addOrUpdate, setSorting },
|
||||
data() {
|
||||
return {
|
||||
activeName: "5",
|
||||
advanceSellStatus: "",
|
||||
dataList: [],
|
||||
formInline: {
|
||||
targetId: "",
|
||||
position: "3",
|
||||
app: 1,
|
||||
},
|
||||
tableProp: {
|
||||
"auto-resize": true,
|
||||
border: true,
|
||||
height: "auto",
|
||||
"row-id": "id",
|
||||
"show-overflow": false,
|
||||
},
|
||||
selectList: [],
|
||||
type: [
|
||||
{
|
||||
value: 0,
|
||||
label: "菜市场分类",
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: "云店分类",
|
||||
},
|
||||
],
|
||||
page: 1,
|
||||
limit: 10,
|
||||
total: 0,
|
||||
application: [
|
||||
{ label: "用户端", value: 1 },
|
||||
{
|
||||
|
@ -190,165 +109,72 @@ export default {
|
|||
app: 1,
|
||||
};
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.oTable.reload();
|
||||
});
|
||||
this.queryList();
|
||||
},
|
||||
methods: {
|
||||
// getData() {
|
||||
// this.$api.mer_admin
|
||||
// .storeList({ marketId: this.formInline.marketId })
|
||||
// .then((res) => {
|
||||
// this.storeList = res.data.data;
|
||||
// this.formInline.shopId = res.data.data[0].shopId;
|
||||
// this.$nextTick(() => {
|
||||
// this.$refs.oTable.reload();
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
addBanner() {
|
||||
this.$refs.addOrUpdate.toggle().add(this.formInline);
|
||||
handleQuery() {
|
||||
this.page = 1;
|
||||
this.queryList();
|
||||
},
|
||||
changePosition(e) {
|
||||
console.log(e, this.shopId, this.marketId);
|
||||
|
||||
if (e == 3) {
|
||||
this.formInline.targetId = this.shopId;
|
||||
} else {
|
||||
this.formInline.targetId = this.marketId;
|
||||
}
|
||||
console.log(e);
|
||||
},
|
||||
queryList(pageNo, pageSize) {
|
||||
queryList() {
|
||||
this.$api.mer_admin
|
||||
.noticePage({
|
||||
pageNumber: pageNo,
|
||||
pageSize: pageSize,
|
||||
pageNumber: this.page,
|
||||
pageSize: this.limit,
|
||||
...this.formInline,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
this.$refs.oTable.complete(
|
||||
res.data.data.data,
|
||||
Number(res.data.data.total)
|
||||
);
|
||||
this.dataList = res.data.data.data;
|
||||
this.total = Number(res.data.data.total);
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$refs.oTable.complete(false);
|
||||
// Handle error
|
||||
});
|
||||
},
|
||||
addBanner() {
|
||||
this.$refs.addOrUpdate.add(this.formInline);
|
||||
this.$refs.addOrUpdate.toggle();
|
||||
},
|
||||
updateBanner(row) {
|
||||
this.$refs.addOrUpdate.update(row);
|
||||
this.$refs.addOrUpdate.toggle();
|
||||
},
|
||||
deleteBanner(row) {
|
||||
this.$api.mer_admin.noticeDelete({ id: row.id }).then((res) => {
|
||||
this.queryList();
|
||||
});
|
||||
},
|
||||
Reset() {
|
||||
this.formInline = {
|
||||
targetId: this.shopId,
|
||||
position: "3",
|
||||
app: 1,
|
||||
};
|
||||
this.$refs.oTable.reload();
|
||||
this.handleQuery();
|
||||
},
|
||||
//排序
|
||||
setSort() {
|
||||
this.$refs.setSorting.init(this.dataList);
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.limit = val;
|
||||
this.queryList();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.page = val;
|
||||
this.queryList();
|
||||
},
|
||||
getPosition(position) {
|
||||
if (position == "1") {
|
||||
return "首页";
|
||||
} else if (position == "2") {
|
||||
return "菜市场详情页";
|
||||
} else if (position == "3") {
|
||||
return "摊位详情";
|
||||
}
|
||||
return "";
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
tableCols() {
|
||||
return [
|
||||
// { type: "checkbox", width: "60px", fixed: "left" },
|
||||
{ type: "seq", width: "60px", align: "center", title: "序号" },
|
||||
{
|
||||
title: "公告通知",
|
||||
align: "center",
|
||||
field: "title",
|
||||
},
|
||||
{
|
||||
title: "位置",
|
||||
align: "center",
|
||||
field: "startTime",
|
||||
type: "jsx",
|
||||
width: "120px",
|
||||
render: ({ row }) => {
|
||||
let getPosition = (row) => {
|
||||
if (row == "1") {
|
||||
return "首页";
|
||||
} else if (row == "2") {
|
||||
return "菜市场详情页";
|
||||
} else if (row == "3") {
|
||||
return "摊位详情";
|
||||
}
|
||||
};
|
||||
return <span>{getPosition(row.position)}</span>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
align: "center",
|
||||
field: "status",
|
||||
type: "jsx",
|
||||
width: "120px",
|
||||
render: ({ row }) => {
|
||||
return <span>{row.status ? "已启用" : "已禁用"}</span>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
fixed: "right",
|
||||
type: "jsx",
|
||||
align: "center",
|
||||
width: "220px",
|
||||
render: ({ row }) => {
|
||||
let updateBanner = () => {
|
||||
this.$refs.addOrUpdate.toggle(row).update();
|
||||
};
|
||||
let deleteBanner = () => {
|
||||
this.$api.mer_admin
|
||||
.noticeDelete({ id: row.id })
|
||||
.then((res) => {
|
||||
this.$refs.oTable.reload();
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$refs.oTable.reload();
|
||||
});
|
||||
};
|
||||
let onCancel = () => {};
|
||||
return (
|
||||
<div>
|
||||
<el-button
|
||||
style="margin-right:10px"
|
||||
size="mini"
|
||||
type="primary"
|
||||
onClick={updateBanner}
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-popconfirm
|
||||
onConfirm={deleteBanner}
|
||||
onCancel={onCancel}
|
||||
confirm-button-text="确定"
|
||||
cancel-button-text="取消"
|
||||
icon="el-icon-info"
|
||||
icon-color="red"
|
||||
title="确定删除吗?"
|
||||
>
|
||||
<el-button size="mini" type="danger" slot="reference">
|
||||
删除
|
||||
</el-button>
|
||||
</el-popconfirm>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
},
|
||||
tableEvent() {
|
||||
return {
|
||||
"checkbox-all": ({ records, reserves }) => {
|
||||
this.selectList = [...records, ...reserves];
|
||||
},
|
||||
"checkbox-change": ({ records, reserves }) => {
|
||||
this.selectList = [...records, ...reserves];
|
||||
},
|
||||
};
|
||||
},
|
||||
...mapState("userData", [
|
||||
"isMerchant",
|
||||
"marketList",
|
||||
|
@ -360,4 +186,24 @@ export default {
|
|||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped>
|
||||
.page-container {
|
||||
}
|
||||
.search-card {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.search-form .el-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.pagination-container {
|
||||
margin-top: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.search-form .el-form-item__label {
|
||||
padding-bottom: 0px !important;
|
||||
font-size: 14px;
|
||||
line-height: 32px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,218 +1,107 @@
|
|||
<template>
|
||||
<div>
|
||||
<obj-modal
|
||||
ref="modal"
|
||||
labelWidth="150px"
|
||||
:modalCols="modalCols"
|
||||
:modalConfig="modalConfig"
|
||||
:modalData="modalData"
|
||||
:modalHandles="modalHandles"
|
||||
>
|
||||
<template slot="dialog__after"> </template>
|
||||
</obj-modal>
|
||||
</div>
|
||||
<el-dialog :title="modalConfig.title" :visible.sync="modalConfig.show" width="700px" @close="handleClose">
|
||||
<el-form ref="form" :model="modalData" :rules="rules" label-width="150px">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="modalData.sort" controls-position="right" :min="0"></el-input-number>
|
||||
<div class="form-tip">序号越大越靠前显示,建议设置为10、20、30等便于后续插入</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="公告内容" prop="title">
|
||||
<el-input type="textarea" v-model="modalData.title" :rows="5" maxlength="120"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-switch v-model="modalData.status" active-text="启用" inactive-text="禁用"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用" prop="app">
|
||||
<el-select v-model="modalData.app" placeholder="请选择应用">
|
||||
<el-option label="用户" :value="1"></el-option>
|
||||
<el-option label="商家" :value="2"></el-option>
|
||||
<el-option label="专员" :value="3"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="toggle">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { debounce, cloneDeep } from "lodash";
|
||||
import { Divider } from "element-ui";
|
||||
import { cloneDeep } from "lodash";
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
isAdd: true,
|
||||
//表格属性
|
||||
modalConfig: {
|
||||
title: "",
|
||||
show: false,
|
||||
width: "700px",
|
||||
},
|
||||
modalData: {},
|
||||
settingId: "",
|
||||
form: {},
|
||||
modalData: {
|
||||
sort: 10,
|
||||
title: "",
|
||||
status: true,
|
||||
app: 1,
|
||||
targetId: "",
|
||||
position: "",
|
||||
},
|
||||
rules: {
|
||||
title: [{ required: true, message: "请输入公告内容", trigger: "blur" }],
|
||||
app: [{ required: true, message: "请选择应用", trigger: "change" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
"modalConfig.show"(newVal) {
|
||||
if (!newVal) {
|
||||
//关闭弹窗清空校验
|
||||
setTimeout(() => {
|
||||
this.$refs.modal.resetFields();
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
queryTableData(pageNo, pageSize) {},
|
||||
toggle(e) {
|
||||
if (this.modalConfig.show == false) {
|
||||
this.modalConfig.show = true;
|
||||
} else {
|
||||
this.modalConfig.show = false;
|
||||
}
|
||||
if (e) {
|
||||
this.init(cloneDeep(e));
|
||||
}
|
||||
return {
|
||||
add: (row) => {
|
||||
console.log(row);
|
||||
this.modalData = {
|
||||
targetId: row.targetId,
|
||||
title: "",
|
||||
position: row.position,
|
||||
status: true,
|
||||
app: 1,
|
||||
};
|
||||
this.fileList = [];
|
||||
this.modalConfig.title = "添加公告";
|
||||
this.isAdd = true;
|
||||
},
|
||||
update: () => {
|
||||
this.modalConfig.title = "编辑公告";
|
||||
this.isAdd = false;
|
||||
},
|
||||
};
|
||||
toggle() {
|
||||
this.modalConfig.show = !this.modalConfig.show;
|
||||
},
|
||||
handleClose() {
|
||||
this.$refs.form.resetFields();
|
||||
},
|
||||
init(row) {
|
||||
this.modalData = row;
|
||||
this.modalData = { ...this.modalData, ...row };
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
modalCols() {
|
||||
return [
|
||||
{
|
||||
label: "公告内容",
|
||||
prop: "title",
|
||||
type: "Textarea",
|
||||
required: true,
|
||||
maxlength: "120",
|
||||
rows: "5",
|
||||
rules: {
|
||||
required: true,
|
||||
message: "请输入公告内容",
|
||||
trigger: "blur",
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: "分类",
|
||||
// prop: "type",
|
||||
// maxlength: "30",
|
||||
// rules: {
|
||||
// required: true,
|
||||
// message: "请输入分类",
|
||||
// trigger: "blur",
|
||||
// },
|
||||
// type: "jsx",
|
||||
// render: () => {
|
||||
// return (
|
||||
// <el-select
|
||||
// v-model={this.modalData.type}
|
||||
// placeholder="请选择销售单位"
|
||||
// >
|
||||
// {[
|
||||
// { label: "菜市场", value: 0 },
|
||||
// {
|
||||
// label: "云店",
|
||||
// value: 1,
|
||||
// },
|
||||
// ].map((item) => {
|
||||
// return (
|
||||
// <el-option
|
||||
// label={item.label}
|
||||
// value={item.value}
|
||||
// ></el-option>
|
||||
// );
|
||||
// })}
|
||||
// </el-select>
|
||||
// );
|
||||
// },
|
||||
// },
|
||||
{
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
maxlength: "30",
|
||||
type: "jsx",
|
||||
render: () => {
|
||||
return (
|
||||
<el-switch
|
||||
v-model={this.modalData.status}
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "应用",
|
||||
prop: "app",
|
||||
maxlength: "30",
|
||||
rules: {
|
||||
required: true,
|
||||
message: "请输入轮播图名称",
|
||||
trigger: "blur",
|
||||
},
|
||||
type: "jsx",
|
||||
render: () => {
|
||||
return (
|
||||
<el-select
|
||||
v-model={this.modalData.app}
|
||||
placeholder="请选择销售单位"
|
||||
>
|
||||
{[
|
||||
{ label: "用户", value: 1 },
|
||||
{
|
||||
label: "商家",
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: "专员",
|
||||
value: 3,
|
||||
},
|
||||
].map((item) => {
|
||||
return (
|
||||
<el-option
|
||||
label={item.label}
|
||||
value={item.value}
|
||||
></el-option>
|
||||
);
|
||||
})}
|
||||
</el-select>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
add(row) {
|
||||
this.isAdd = true;
|
||||
this.modalConfig.title = "添加公告";
|
||||
this.modalData = {
|
||||
sort: 10,
|
||||
title: "",
|
||||
status: true,
|
||||
app: 1,
|
||||
targetId: row.targetId,
|
||||
position: row.position,
|
||||
};
|
||||
},
|
||||
modalHandles() {
|
||||
return [
|
||||
{
|
||||
label: "取消",
|
||||
handle: () => {
|
||||
update(row) {
|
||||
this.isAdd = false;
|
||||
this.modalConfig.title = "编辑公告";
|
||||
this.init(cloneDeep(row));
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const apiCall = this.isAdd
|
||||
? this.$api.mer_admin.noticeAdd(this.modalData)
|
||||
: this.$api.mer_admin.noticeUpdate(this.modalData);
|
||||
|
||||
apiCall.then(() => {
|
||||
this.$message.success(this.isAdd ? "添加成功" : "编辑成功");
|
||||
this.toggle();
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "确认",
|
||||
type: "primary",
|
||||
submit: true,
|
||||
handle: () => {
|
||||
console.log(this.modalData);
|
||||
if (this.isAdd) {
|
||||
this.$api.mer_admin.noticeAdd(this.modalData).then((res) => {
|
||||
this.toggle();
|
||||
this.$emit("queryList");
|
||||
});
|
||||
} else {
|
||||
this.$api.mer_admin.noticeUpdate(this.modalData).then((res) => {
|
||||
this.toggle();
|
||||
this.$emit("queryList");
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
this.$emit("queryList");
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
asyncComputed: {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.form-tip {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
Loading…
Reference in New Issue