|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
|
|
|
:options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
|
|
|
- :operation="operation" :exportList="exportList">
|
|
|
+ :operation="operation()" :exportList="exportList">
|
|
|
<el-dialog title="" width="500px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
|
|
|
:show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
|
|
|
<zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
|
|
@@ -23,32 +23,12 @@ import import_mixin from '@/components/template/import_mixin.js'
|
|
|
import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
|
|
|
import { carouselMapListPageV2, carouselMapPageExport, changeBannerStatus, addBanner, editBanner, getBannerDetail, deleteBanner, getGoodsList, batchDeleteBanner } from '@/api/setting'
|
|
|
import ImageUpload from '@/components/file-upload'
|
|
|
+import operation_mixin from '@/components/template/operation_mixin.js'
|
|
|
export default {
|
|
|
components: { TemplatePage, ImageUpload },
|
|
|
- mixins: [import_mixin],
|
|
|
+ mixins: [import_mixin, operation_mixin],
|
|
|
data() {
|
|
|
return {
|
|
|
- // 事件组合
|
|
|
- optionsEvensGroup: [
|
|
|
- [
|
|
|
- [
|
|
|
- {
|
|
|
- name: '新增轮播图',
|
|
|
- isRole: true,
|
|
|
- click: this.addData
|
|
|
- }
|
|
|
- ],
|
|
|
- ],
|
|
|
- [
|
|
|
- [
|
|
|
- {
|
|
|
- name: '批量删除',
|
|
|
- isRole: true,
|
|
|
- click: this.batchDelete
|
|
|
- }
|
|
|
- ],
|
|
|
- ],
|
|
|
- ],
|
|
|
// 表格属性
|
|
|
tableAttributes: {
|
|
|
// 启用勾选列
|
|
@@ -78,6 +58,30 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ // 事件组合
|
|
|
+ optionsEvensGroup() {
|
|
|
+ return [
|
|
|
+ [
|
|
|
+ [
|
|
|
+ this.optionsEvensAuth("add", {
|
|
|
+ click: () => {
|
|
|
+ this.addData
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ [
|
|
|
+ this.optionsEvensAuth("del", {
|
|
|
+ name: '批量删除',
|
|
|
+ click: () => {
|
|
|
+ this.batchDelete
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ },
|
|
|
// 更多参数
|
|
|
moreParameters() {
|
|
|
return []
|
|
@@ -219,42 +223,43 @@ export default {
|
|
|
this.recordSelected = data
|
|
|
},
|
|
|
// 表格操作列
|
|
|
- operation(h, { row, index, column }) {
|
|
|
- return (
|
|
|
- <div class='operation-btns'>
|
|
|
- <el-button type="text" onClick={() => {
|
|
|
- getBannerDetail({ id: row.id }).then(res => {
|
|
|
- Object.assign(this.formData, res.data, {
|
|
|
- imgSrc: res.data.imgSrc ? [{ url: res.data.imgSrc }] : [],
|
|
|
- })
|
|
|
- this.formDialogType = 1
|
|
|
- this.openForm()
|
|
|
- })
|
|
|
- }}>编辑</el-button>
|
|
|
- <el-popconfirm
|
|
|
- title="确定删除吗?"
|
|
|
- onConfirm={() => {
|
|
|
- deleteBanner({ carouselMapId: row.id }).then(() => {
|
|
|
- this.$message({ type: 'success', message: '删除成功!' })
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- })
|
|
|
- }}
|
|
|
- >
|
|
|
- <el-button type="text" slot="reference">删除</el-button>
|
|
|
- </el-popconfirm>
|
|
|
- <el-popconfirm
|
|
|
- title={`确定${row.state ? '隐藏' : '显示'}吗?`}
|
|
|
- onConfirm={() => {
|
|
|
- changeBannerStatus({ carouselMapId: row.id, state: !row.state }).then(() => {
|
|
|
- this.$message({ type: 'success', message: `${row.state ? '隐藏' : '显示'}成功!` })
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- })
|
|
|
- }}
|
|
|
- >
|
|
|
- <el-button type="text" slot="reference">{row.state ? '隐藏' : '显示'}</el-button>
|
|
|
- </el-popconfirm>
|
|
|
- </div>
|
|
|
- )
|
|
|
+ operation() {
|
|
|
+ return this.operationBtn({
|
|
|
+ edit: {
|
|
|
+ click: ({ row, index, column }) => {
|
|
|
+ getBannerDetail({ id: row.id }).then(res => {
|
|
|
+ Object.assign(this.formData, res.data, {
|
|
|
+ imgSrc: res.data.imgSrc ? [{ url: res.data.imgSrc }] : [],
|
|
|
+ })
|
|
|
+ this.formDialogType = 1
|
|
|
+ this.openForm()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ del: {
|
|
|
+ prompt: '确定删除吗?',
|
|
|
+ click: ({ row, index, column }) => {
|
|
|
+ deleteBanner({ carouselMapId: row.id }).then(() => {
|
|
|
+ this.$message({ type: 'success', message: '删除成功!' })
|
|
|
+ this.$refs.pageRef.refreshList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ status: {
|
|
|
+ name: ({ row, index, column }) => {
|
|
|
+ return row.state ? '隐藏' : '显示'
|
|
|
+ },
|
|
|
+ prompt: ({ row, index, column }) => {
|
|
|
+ return `确定${row.state ? '隐藏' : '显示'}吗?`
|
|
|
+ },
|
|
|
+ click: ({ row, index, column }) => {
|
|
|
+ changeBannerStatus({ carouselMapId: row.id, state: !row.state }).then(() => {
|
|
|
+ this.$message({ type: 'success', message: `${row.state ? '隐藏' : '显示'}成功!` })
|
|
|
+ this.$refs.pageRef.refreshList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
},
|
|
|
addData() {
|
|
|
this.formDialogType = 0
|