Browse Source

功能点完善

master
liaoxiping 4 years ago
parent
commit
1dd5924d42
  1. 2
      .env.development
  2. 8
      package-lock.json
  3. 58
      src/api/ActivityTweets.js
  4. 2
      src/api/AxiosApi.js
  5. 96
      src/api/Brand.js
  6. 16
      src/api/creditGoods/CreditGoodsImg.js
  7. 12
      src/components/Management/Container.vue
  8. 16
      src/components/Management/checkDialog.vue
  9. 36
      src/components/Tinymce/components/EditorImage.vue
  10. 2
      src/components/Tinymce/index.vue
  11. 9
      src/lang/en.js
  12. 23
      src/lang/zh.js
  13. 32
      src/router/index.js
  14. 78
      src/store/modules/account.js
  15. 513
      src/views/System/posSystem/index.vue
  16. 30
      src/views/banner/Edit.vue
  17. 2
      src/views/banner/index.vue
  18. 225
      src/views/brand/Edit.vue
  19. 352
      src/views/brand/Index.vue
  20. 184
      src/views/brand/edit/BrandEdit.vue
  21. 25
      src/views/brand/lang/BrandLang.java
  22. 347
      src/views/brand/pageIndex/BrandPageIndex.vue
  23. 356
      src/views/brand/treeIndex/BrandTreeIndex.vue
  24. 16
      src/views/creditGoods/goods/Edit.vue
  25. 25
      src/views/creditGoods/goods/index.vue
  26. 387
      src/views/information/Edit.vue
  27. 497
      src/views/information/index.vue
  28. 2
      vue.config.js

2
.env.development

@ -3,7 +3,7 @@ ENV = 'development'
VUE_APP_PROJECT_NAME = 'cereshop-admin-web'
# 请求服务配置
VUE_APP_DEV_REQUEST_DOMAIN_PREFIX = 'http://192.168.10.236:8764'
VUE_APP_DEV_REQUEST_DOMAIN_PREFIX = 'http://192.168.10.130:8764'
# 是否启用验证码
VUE_APP_IS_CAPTCHA = true

8
package-lock.json generated

@ -3820,9 +3820,9 @@
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.2.0",
"resolved": "https://registry.nlark.com/vue-loader/download/vue-loader-16.2.0.tgz",
"integrity": "sha1-BGpTMI3Ufljv4g3ewe3sAnzjtG4=",
"version": "npm:vue-loader@16.3.0",
"resolved": "https://registry.nlark.com/vue-loader/download/vue-loader-16.3.0.tgz?cache=0&sync_timestamp=1624996813170&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue-loader%2Fdownload%2Fvue-loader-16.3.0.tgz",
"integrity": "sha1-LxleS6D7DiY1ltaDDfF9Gjbok2w=",
"dev": true,
"optional": true,
"requires": {
@ -3833,7 +3833,7 @@
"dependencies": {
"json5": {
"version": "2.2.0",
"resolved": "https://registry.npm.taobao.org/json5/download/json5-2.2.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjson5%2Fdownload%2Fjson5-2.2.0.tgz",
"resolved": "https://registry.npm.taobao.org/json5/download/json5-2.2.0.tgz",
"integrity": "sha1-Lf7+cgxrpSXZ69kJlQ8FFTFsiaM=",
"dev": true,
"optional": true,

58
src/api/ActivityTweets.js

@ -0,0 +1,58 @@
import axiosApi from './AxiosApi.js'
const apiList = {
page: {
method: 'POST',
url: `/information/list`,
},
update: {
method: 'PUT',
url: `/information`
},
save: {
method: 'POST',
url: `/information`
},
delete: {
method: 'DELETE',
url: `/information`
},
}
export default {
page (data, custom = {}) {
return axiosApi({
...apiList.page,
data,
custom
})
},
// query (data, custom = {}) {
// return axiosApi({
// ...apiList.query,
// data,
// custom
// })
// },
save (data, custom = {}) {
return axiosApi({
...apiList.save,
data,
custom
})
},
update (data, custom = {}) {
return axiosApi({
...apiList.update,
data,
custom
})
},
delete (data, custom = {}) {
return axiosApi({
...apiList.delete,
data,
custom
})
},
}

2
src/api/AxiosApi.js

@ -81,6 +81,7 @@ function handleSuccess(res, resolve) {
// http请求
const httpServer = opts => {
console.log(opts,"opts")
// 公共参数
const publicParams = {
ts: Date.now()
@ -133,5 +134,4 @@ const httpServer = opts => {
})
return promise
}
export default httpServer

96
src/api/Brand.js

@ -0,0 +1,96 @@
import axiosApi from './AxiosApi.js'
const apiList = {
page: {
method: 'POST',
url: `/brand/page`,
},
query: {
method: 'POST',
url: `/brand/query`,
},
update: {
method: 'PUT',
url: `/brand`
},
save: {
method: 'POST',
url: `/brand`
},
delete: {
method: 'DELETE',
url: `/brand`
},
export: {
method: 'POST',
url: `/brand/export`
},
preview: {
method: 'POST',
url: `/brand/preview`
},
import: {
method: 'POST',
url: `/brand/import`
}
}
export default {
page (data, custom = {}) {
return axiosApi({
...apiList.page,
data,
custom
})
},
query (data, custom = {}) {
return axiosApi({
...apiList.query,
data,
custom
})
},
save (data, custom = {}) {
return axiosApi({
...apiList.save,
data,
custom
})
},
update (data, custom = {}) {
return axiosApi({
...apiList.update,
data,
custom
})
},
delete (data, custom = {}) {
return axiosApi({
...apiList.delete,
data,
custom
})
},
export (data, custom = {}) {
return axiosApi({
...apiList.export,
responseType: "blob",
data,
custom
})
},
preview (data, custom = {}) {
return axiosApi({
...apiList.preview,
data,
custom
})
},
import (data, custom = {}) {
return axiosApi({
...apiList.import,
data,
custom
})
}
}

16
src/api/creditGoods/CreditGoodsImg.js

@ -3,35 +3,35 @@ import axiosApi from '../AxiosApi.js'
const apiList = {
page: {
method: 'POST',
url: `/store/creditGoodsImg/page`,
url: `/creditGoodsImg/page`,
},
query: {
method: 'POST',
url: `/store/creditGoodsImg/query`,
url: `/creditGoodsImg/query`,
},
update: {
method: 'PUT',
url: `/store/creditGoodsImg`
url: `/creditGoodsImg`
},
save: {
method: 'POST',
url: `/store/creditGoodsImg`
url: `/creditGoodsImg`
},
delete: {
method: 'DELETE',
url: `/store/creditGoodsImg`
url: `/creditGoodsImg`
},
export: {
method: 'POST',
url: `/store/creditGoodsImg/export`
url: `/creditGoodsImg/export`
},
preview: {
method: 'POST',
url: `/store/creditGoodsImg/preview`
url: `/creditGoodsImg/preview`
},
import: {
method: 'POST',
url: `/store/creditGoodsImg/import`
url: `/creditGoodsImg/import`
}
}

12
src/components/Management/Container.vue

@ -3,7 +3,7 @@
<Table :data="dataList.records" style="width: 100%" border>
<table-column prop="name" label="店铺名称" />
<table-column prop="code" label="店铺编码" />
<table-column prop="posType.desc" label="店铺类型" width="180" />
<!-- <table-column prop="posType.desc" label="店铺类型" width="180" /> -->
<table-column prop="duty" label="负责人" width="180" />
<table-column prop="contactTel" label="联系电话" width="180" />
<table-column label="合同状态" width="180">
@ -61,7 +61,7 @@
class="check-dialog"
width="55%"
>
<checkDialog v-if="checkVisible" :data-map="checkData" @close="closeCheckDialog" />
<checkDialog ref="checkDialog" v-if="checkVisible" :dataMap="list" @close="closeCheckDialog" />
</Dialog>
</div>
</template>
@ -100,12 +100,14 @@ export default {
return {
checkVisible: false,
checkData: {
status: {}
status: {},
defaultPay: false
},
form: {
current: 1,
size: 10
}
},
list: {}
}
},
methods: {
@ -116,11 +118,13 @@ export default {
item.check = v
this.checkVisible = true
this.checkData = item
this.list = item
console.log(this.checkData, 11)
},
closeCheckDialog() {
this.checkVisible = false
this.checkData = {}
console.log(this.$refs.checkDialog.dataMap,"dataMap")
},
prohibit(item) {
const code = item.status.code

16
src/components/Management/checkDialog.vue

@ -62,11 +62,17 @@
clearable
/>
</form-item>
<form-item label="合同状态">
<!-- <form-item label="合同状态">
<Select v-model="dataMap.status.code" disabled size="mini">
<Option label="有效" value="NORMAL" />
<Option label="无效" value="FORBIDDEN" />
</Select>
</form-item> -->
<form-item label="是否使用平台收款" prop="mobile">
<el-radio-group size="small" v-model="dataMap.defaultPay">
<el-radio-button :label="true">{{ $t('common.yes') }}</el-radio-button>
<el-radio-button :label="false">{{ $t('common.no') }}</el-radio-button>
</el-radio-group>
</form-item>
<form-item label="账号" prop="mobile">
<Input
@ -79,13 +85,13 @@
/>
</form-item>
<form-item label="收单类型">
<!-- <form-item label="收单类型">
<Select v-model="dataMap.posType.code" size="mini">
<Option label="普通餐饮" value="NORMALSTORE" />
<Option label="快消餐饮" value="FASTSTORE" />
<Option label="零售店" value="RETAILSTORE" />
</Select>
</form-item>
</form-item> -->
<form-item size="large">
<Button v-if="!dataMap.check" type="primary" @click="sumbit">确定</Button>
@ -106,8 +112,8 @@ export default {
FormItem,
Input,
Button,
Select,
Option,
// Select,
// Option,
DatePicker
},
props: {

36
src/components/Tinymce/components/EditorImage.vue

@ -8,16 +8,17 @@
<!-- upload -->
上传
</el-button>
<el-dialog :visible.sync="dialogVisible">
<el-dialog :visible.sync="dialogVisible" :append-to-body="true">
<el-upload
:multiple="true"
:headers="headers"
:file-list="fileList"
:show-file-list="true"
:on-remove="handleRemove"
:on-success="handleSuccess"
:before-upload="beforeUpload"
:data="dataObj"
class="editor-slide-upload"
action="https://httpbin.org/post"
:action="action"
list-type="picture-card"
>
<el-button size="small" type="primary">
@ -39,7 +40,7 @@
<script>
// import { getToken } from 'api/qiniu'
import db from '@/utils/localstorage'
export default {
name: 'EditorSlideUpload',
props: {
@ -52,25 +53,44 @@ export default {
return {
dialogVisible: false,
listObj: {},
fileList: []
fileList: [],
action: `${process.env.VUE_APP_DEV_REQUEST_DOMAIN_PREFIX}/file/upload`,
list: [],
headers: {
Authorization: '',
},
dataObj: {
folderId: 1
},
}
},
created() {
this.headers.token = 'Bearer ' + db.get('TOKEN', '')
this.headers.tenant = 'MDAwMA=='
},
methods: {
checkAllSuccess() {
return Object.keys(this.listObj).every(item => this.listObj[item].hasSuccess)
},
handleSubmit() {
const arr = Object.keys(this.listObj).map(v => this.listObj[v])
if (!this.checkAllSuccess()) {
this.$message('Please wait for all images to be uploaded successfully. If there is a network problem, please refresh the page and upload again!')
// const arr = Object.keys(this.listObj).map(v => this.listObj[v])
// if (!this.checkAllSuccess()) {
// this.$message('Please wait for all images to be uploaded successfully. If there is a network problem, please refresh the page and upload again!')
// return
// }
if(!this.list.length) {
this.$message('请上传图片')
return
}
let arr = this.list
this.$emit('successCBK', arr)
this.listObj = {}
this.fileList = []
this.list = []
this.dialogVisible = false
},
handleSuccess(response, file) {
this.list.push(response.data.url)
const uid = file.uid
const objKeyArr = Object.keys(this.listObj)
for (let i = 0, len = objKeyArr.length; i < len; i++) {

2
src/components/Tinymce/index.vue

@ -210,7 +210,7 @@ export default {
imageSuccessCBK(arr) {
const _this = this
arr.forEach(v => {
window.tinymce.get(_this.tinymceId).insertContent(`<img class="wscnph" src="${v.url}" >`)
window.tinymce.get(_this.tinymceId).insertContent(`<img class="wscnph" src="${v}" >`)
})
}
}

9
src/lang/en.js

@ -32,6 +32,15 @@ export default {
github: 'Github Repository'
},
table: {
brand: {
id: 'ID',
name: 'name',
image: 'image',
video: 'video',
desc: 'desc',
content: 'content',
sort: 'sort',
},
banner: {
id: 'ID',
imgUrl: 'imgUrl',

23
src/lang/zh.js

@ -32,6 +32,15 @@ export default {
github: '项目地址'
},
table: {
brand: {
id: 'ID',
name: '名称',
image: '图片',
video: '视频',
desc: '描述',
content: '富文本',
sort: 'sort',
},
banner: {
id: 'ID',
imgUrl: '图片',
@ -49,7 +58,7 @@ export default {
startTime: '开始时间',
endTime: '结束时间',
state: '状态:1-上架,0-下架',
isDelete: '逻辑删除:1-删除 0-未删除',
isDelete: '逻辑删除:',
},
creditOrder: {
id: 'ID',
@ -58,7 +67,7 @@ export default {
amount: '金额',
state: '状态:1-未完成,2-已完成,9-已取消',
useTyped: '使用类型:1-配送,2-自提,3-虚拟',
isDelete: '逻辑删除:1-删除 0-未删除',
isDelete: '逻辑删除:',
},
creditOrderDetail: {
id: 'ID',
@ -75,7 +84,7 @@ export default {
goodsMainImg: '商品主图路径',
goodsViceImg: '商品副图的路径集合',
goodsNumber: '商品数量',
isDelete: '逻辑删除:1-删除 0-未删除',
isDelete: '逻辑删除:',
},
creditOrderDelivery: {
id: 'ID',
@ -90,7 +99,7 @@ export default {
address: '收货详细地址',
longitude: '经度',
latitude: '纬度',
isDelete: '逻辑删除:1-删除 0-未删除',
isDelete: '逻辑删除:',
},
creditGoods: {
id: 'ID',
@ -118,7 +127,7 @@ export default {
sortOrder: '显示顺序',
typed: '类型:1-主图,2-副图',
enabled: '是否启用:1-已启用,0-未启用',
isDelete: '逻辑删除:1-删除 0-未删除',
isDelete: '逻辑删除:',
},
creditGoodsCategory: {
id: 'ID',
@ -127,7 +136,7 @@ export default {
miniShow: '小程序是否显示',
// miniShow: '小程序是否显示:1-显示,0-不显示',
sortOrder: '显示顺序',
isDelete: '逻辑删除:1-删除 0-未删除',
isDelete: '逻辑删除:',
},
memberRank: {
id: 'ID',
@ -353,7 +362,7 @@ export default {
},
dictionary: {
type: "类型",
name: "名称",
name: "编码",
describe: "描述",
status: "状态"
},

32
src/router/index.js

@ -256,14 +256,14 @@ const constRouter = [{
affix: true
}
},
{
path: '/creditGoods/goodsImg',
component: () => import('@/views/creditGoods/goodsImg/index'),
meta: {
title: '商品图片',
affix: true
}
},
// {
// path: '/creditGoods/goodsImg',
// component: () => import('@/views/creditGoods/goodsImg/index'),
// meta: {
// title: '商品图片',
// affix: true
// }
// },
{
path: '/creditGoods/goodsCategory',
component: () => import('@/views/creditGoods/goodsCategory/index'),
@ -801,7 +801,21 @@ const constRouter = [{
},
"hidden": false,
"alwaysShow": false
}],
},
{
"sortValue": 2,
path: "/brand",
name: "品牌设置",
component: resolve => require(['@/views/brand/Index'], resolve),
meta: {
"title": "品牌设置",
"icon": "",
"breadcrumb": true
},
"hidden": false,
"alwaysShow": false
},
],
path: "/system",
name: "设置",
component: Layout,

78
src/store/modules/account.js

@ -201,14 +201,14 @@ export default {
icon: ''
}
},
{
path: '/creditGoods/goodsImg',
name: '商品图片',
meta: {
title: '商品图片',
icon: ''
}
},
// {
// path: '/creditGoods/goodsImg',
// name: '商品图片',
// meta: {
// title: '商品图片',
// icon: ''
// }
// },
{
path: '/creditGoods/goodsCategory',
name: '商品分类',
@ -217,30 +217,30 @@ export default {
icon: ''
}
},
{
path: '/creditGoods/order',
name: '订单管理',
meta: {
title: '订单管理',
icon: ''
}
},
{
path: '/creditGoods/orderDetail',
name: '订单详情',
meta: {
title: '订单详情',
icon: ''
}
},
{
path: '/creditGoods/orderDelivery',
name: '订单物流',
meta: {
title: '订单物流',
icon: ''
}
}
// {
// path: '/creditGoods/order',
// name: '订单管理',
// meta: {
// title: '订单管理',
// icon: ''
// }
// },
// {
// path: '/creditGoods/orderDetail',
// name: '订单详情',
// meta: {
// title: '订单详情',
// icon: ''
// }
// },
// {
// path: '/creditGoods/orderDelivery',
// name: '订单物流',
// meta: {
// title: '订单物流',
// icon: ''
// }
// }
]
},
{
@ -657,7 +657,19 @@ export default {
},
"hidden": false,
"alwaysShow": false
}],
},{
"sortValue": 2,
"path": "/brand",
"name": "品牌介绍",
"component": "brand/Index",
"meta": {
"title": "品牌介绍",
"icon": "",
"breadcrumb": true
},
"hidden": false,
"alwaysShow": false
},],
"path": "/system",
"name": "设置",
"component": "Layout",

513
src/views/System/posSystem/index.vue

@ -1,4 +1,5 @@
<template>
<div>
<div>
<el-form
label-position="right"
@ -20,20 +21,294 @@
</el-select>
</el-form-item> -->
<h4 style="font-size: 18px; margin-left: 150px; color: red">
移动端设置
移动端设置(百年川椒)
</h4>
<h5 style="font-size: 18px; margin-left: 150px;">
<!-- <h5 style="font-size: 18px; margin-left: 150px;">
安卓版本设置
</h5>
<el-form-item label="版本号android_version:">
</h5> -->
<el-form-item label="版本号:">
<el-input v-model="formLabelAlign.android_version"></el-input>
</el-form-item>
<el-form-item label="下载地址android_apk_url:">
<el-form-item label="下载地址:">
<el-input v-model="formLabelAlign.android_apk_url"></el-input>
</el-form-item>
<el-form-item label="积分规则Integral_rules:">
<Tinymce ref="content" v-model="formLabelAlign.Integral_rules" :height="300" />
<el-form-item label="积分规则:">
<Tinymce
ref="content"
v-model="formLabelAlign.Integral_rules"
:height="300"
/>
<!-- <el-input v-model="formLabelAlign.Integral_rules"></el-input> -->
</el-form-item>
<el-form-item label="百年川椒品牌介绍:">
<Tinymce
ref="content"
v-model="formLabelAlign.bncj"
:height="300"
/>
<!-- <el-input v-model="formLabelAlign.Integral_rules"></el-input> -->
</el-form-item>
<el-form-item label="前进麦味品牌介绍:">
<Tinymce
ref="content"
v-model="formLabelAlign.qjmw"
:height="300"
/>
<!-- <el-input v-model="formLabelAlign.Integral_rules"></el-input> -->
</el-form-item>
<el-form-item label="海峡姐妹品牌介绍:">
<Tinymce
ref="content"
v-model="formLabelAlign.hxjm"
:height="300"
/>
<!-- <el-input v-model="formLabelAlign.Integral_rules"></el-input> -->
</el-form-item>
<el-form-item label="创始人设置:">
<Tinymce
ref="content"
v-model="formLabelAlign.founder"
:height="300"
/>
<!-- <el-input v-model="formLabelAlign.Integral_rules"></el-input> -->
</el-form-item>
<h5 style="font-size: 18px; margin-left: 150px; color: red">
支付宝设置
</h5>
<el-form-item label="支付宝应用ID:">
<el-input v-model="formLabelAlign.alipay_app_id"></el-input>
</el-form-item>
<el-form-item label="应用公钥证书:">
<el-upload
class="upload-demo"
:action="actions"
:on-preview="handlePreviewg"
:on-remove="handleRemoveg"
:before-remove="beforeRemoveg"
:on-success="handleImageSuccessg"
:on-change="handleChangeg"
multiple
:headers="headers"
:data="dataObj"
:file-list="fileListg"
style="width: 130%"
>
<el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
<span style="color:red">支付宝下载的应用公钥证书:appCertPublicKey.crt</span>
</el-upload>
</el-form-item>
<el-form-item label="支付宝公钥证书:">
<el-upload
class="upload-demo"
:action="actions"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-success="handleImageSuccess"
:on-change="handleChangeSuccess"
multiple
:headers="headers"
:data="dataObj"
:file-list="fileList"
style="width: 130%"
>
<el-button size="small" type="primary" icon="el-icon-upload"
>点击上传</el-button
>
<span style="font-size: 12px; color: red "
>支付宝下载的公钥证书alipayCertPublicKey_RSA2.crt</span
>
</el-upload>
</el-form-item>
<!-- <el-form-item label="私钥:">
<el-upload
class="upload-demo"
:action="actions"
:on-preview="handlePreviewm"
:on-remove="handleRemovem"
:before-remove="beforeRemovem"
:on-success="handleImageSuccessm"
multiple
:headers="headers"
:data="dataObj"
:file-list="fileListm"
style="width:130%"
>
<el-button size="small" type="primary">点击上传</el-button>
<span style="font-size:12px; color:" >请上传CSR的私钥</span>
</el-upload>
</el-form-item> -->
<el-form-item label="支付宝根证书:">
<el-upload
class="upload-demo"
:action="actions"
:on-preview="handlePreviewz"
:on-remove="handleRemovez"
:before-remove="beforeRemovez"
:on-success="handleImageSuccessz"
:on-change="handleChangez"
multiple
:headers="headers"
:data="dataObj"
:file-list="fileListz"
style="width: 130%"
>
<el-button size="small" type="primary" icon="el-icon-upload"
>点击上传</el-button
>
<span style="color:red">支付宝下载的根证书alipayRootCert.crt</span>
</el-upload>
</el-form-item>
<el-form-item label="应用私钥证书:">
<el-upload
class="upload-demo"
:action="actions"
:on-preview="handlePreviewm"
:on-remove="handleRemovem"
:before-remove="beforeRemovem"
:on-success="handleImageSuccessm"
:on-change="handleChangem"
multiple
:headers="headers"
:data="dataObj"
:file-list="fileListm"
style="width: 130%"
>
<el-button size="small" type="primary" icon="el-icon-upload"
>点击上传</el-button
>
<span style="font-size: 12px; color: red ">用户生成的csr私钥csr/私钥.txt </span>
</el-upload>
</el-form-item>
<el-form-item label="阿里支付网关:">
<el-input v-model="formLabelAlign.alipay_gateway"></el-input>
</el-form-item>
<h5 style="font-size: 18px; margin-left: 150px; color: red">微信设置</h5>
<el-form-item label="微信商户v3接口的密钥:">
<el-input v-model="formLabelAlign.mini_v3_mch_key"></el-input>
</el-form-item>
<el-form-item label="微信商户v3接口开关:">
<el-switch v-model="value2"> </el-switch>
</el-form-item>
<h5 style="font-size: 18px; margin-left: 150px; color: red">
小程序设置
</h5>
<el-form-item label="小程序appid:">
<el-input v-model="formLabelAlign.mini_program_appId"></el-input>
</el-form-item>
<el-form-item label="小程序secret:">
<el-input v-model="formLabelAlign.mini_program_secret"></el-input>
</el-form-item>
<el-form-item label="商户id:">
<el-input v-model="formLabelAlign.mini_mch_id"></el-input>
</el-form-item>
<el-form-item label="商户密钥:">
<el-input v-model="formLabelAlign.mini_mch_key"></el-input>
</el-form-item>
<!-- <el-form-item label="通知地址:">
<el-input v-model="formLabelAlign.mini_notify_url"></el-input>
</el-form-item>
<el-form-item label="退款通知地址:">
<el-input v-model="formLabelAlign.mini_refund_notify_url"></el-input>
</el-form-item> -->
<!-- <el-form-item label="证书地址:">
<el-input v-model="formLabelAlign.mini_key_path"></el-input>
<el-upload
class="upload-demo"
:action="actions"
:on-preview="handlePreviewsh"
:on-remove="handleRemovesh"
:before-remove="beforeRemovesh"
:on-success="handleImageSuccesssh"
multiple
:headers="headers"
:data="dataObj"
:file-list="fileListsh"
style="width:130%"
>
<el-button size="small" type="primary">点击上传</el-button>
<span>请上传正确的证书</span>
</el-form-item> -->
<el-form-item label="p12证书文件:">
<el-upload
class="upload-demo"
:action="actions"
:on-preview="handlePreviewzs"
:on-remove="handleRemovezs"
:before-remove="beforeRemovezs"
:on-success="handleImageSuccesszs"
:on-change="handleChangezs"
multiple
:headers="headers"
:data="dataObj"
:file-list="fileListzs"
style="width: 130%"
>
<el-button size="small" type="primary" icon="el-icon-upload"
>点击上传</el-button
>
<span>请上传正确的p12证书文件</span>
</el-upload>
</el-form-item>
<el-form-item label="p12文件编码:">
<el-input
type="password"
v-model="formLabelAlign.mini_key_sn_no"
></el-input>
</el-form-item>
<el-form-item label="cert证书文件:">
<el-upload
class="upload-demo"
:action="actions"
:on-preview="handlePCertificate"
:on-remove="handleRCertificate"
:before-remove="beforeCertificate"
:on-success="handleImageCertificate"
:on-change="handleChangeCertificate"
multiple
:headers="headers"
:data="dataObj"
:file-list="fileListdz"
style="width: 130%"
>
<el-button size="small" type="primary" icon="el-icon-upload"
>点击上传</el-button
>
<span style="font-size: 12px; color: "
>请上传cert证书文件地址(p12导出,v3接口使用)</span
>
</el-upload>
</el-form-item>
<el-form-item label="key文件:">
<el-upload
class="upload-demo"
:action="actions"
:on-preview="handlePSecretkey"
:on-remove="handleRSecretkey"
:before-remove="beforeCerSecretkey"
:on-success="handleImageSecretkey"
:on-change="handleChangeSecretkey"
multiple
:headers="headers"
:data="dataObj"
:file-list="fileListmy"
style="width: 130%"
>
<el-button size="small" type="primary" icon="el-icon-upload"
>点击上传</el-button
>
<span style="font-size: 12px; color: "
>请上传key文件(p12导出,v3接口使用)</span
>
</el-upload>
</el-form-item>
<!-- <h5 style="font-size: 18px; margin-left: 150px; color: red">
支付方式设置
@ -445,8 +720,6 @@
<el-input v-model="formLabelAlign.alipay_gateway"></el-input>
</el-form-item> -->
<!-- <el-form-item label="厨房打印机:">
<el-input v-model="formLabelAlign.printerSN"></el-input>
</el-form-item> -->
@ -490,19 +763,18 @@
<el-input v-model="formLabelAlign.AutomaticSN"></el-input>
</el-form-item> -->
<!-- <el-button size="small" type="primary" @click="newlyAdded" style="float:right">新增</el-button> -->
</el-form>
<div style="margin-top: 100px; margin-left: 10.5%; margin-bottom: 30px">
<el-button size="small" type="primary" @click="Submits">提交</el-button>
</div>
</div>
</div>
</template>
<script>
import Tables from '@/api/ceresConfig.js'
import db from '@/utils/localstorage'
// import Setting from '@/api/Setting'
import Setting from '@/api/Setting'
import Tinymce from '@/components/Tinymce'
export default {
inject: ['reload'],
@ -535,6 +807,31 @@ export default {
{ name: 'android_version', value: '', id: '' },
{ name: 'android_apk_url', value: '', id: '' },
{ name: 'Integral_rules', value: '', id: '' },
{ name: 'bncj', value: '', id: '' },
{ name: 'qjmw', value: '', id: '' },
{ name: 'hxjm', value: '', id: '' },
{ name: 'founder', value: '', id: '' },
//
{ name: 'alipay_app_id', value: '', id: '' },
{ name: 'alipay_app_public_key', value: '', id: '' },
{ name: 'alipay_public_key', value: '', id: '' },
{ name: 'alipay_root_key', value: '', id: '' },
{ name: 'alipay_private_key', value: '', id: '' },
{ name: 'alipay_gateway', value: '', id: '' },
//
{ name: 'mini_v3_mch_key', value: '', id: '' },
{ name: 'switch', value: '', id: '' },
//
{ name: 'mini_program_appId', value: '', id: '' },
{ name: 'mini_program_secret', value: '', id: '' },
{ name: 'mini_mch_id', value: '', id: '' },
{ name: 'mini_mch_key', value: '', id: '' },
{ name: 'mini_key_path', value: '', id: '' },
{ name: 'mini_key_sn_no', value: '', id: '' },
{ name: 'mini_key_cert_path', value: '', id: '' },
{ name: 'mini_key_key_path', value: '', id: '' },
{ name: 'mini_version', value: '', id: '' },
{ name: 'mini_download_url', value: '', id: '' }
/* { name: 'mini_program_appId', value: '', id: '' },
{ name: 'mini_program_secret', value: '', id: '' },
{ name: 'receipt_top', value: '', id: '' },
@ -572,13 +869,35 @@ export default {
android_version: '',
android_apk_url: '',
Integral_rules: '',
bncj: '',
qjmw: '',
hxjm: '',
founder: '',
alipay_app_id: '',
alipay_app_public_key: '',
alipay_public_key: '',
alipay_root_key: '',
alipay_private_key: '',
alipay_gateway: '',
mini_v3_mch_key: '',
switch: '',
mini_program_appId: '',
mini_program_secret: '',
mini_mch_id: '',
mini_mch_key: '',
mini_key_path: '',
mini_key_sn_no: '',
mini_key_cert_path: '',
mini_key_key_path: '',
mini_version: '',
mini_download_url: ''
/* // printer_sn: 30,
mini_program_appId: '',
mini_program_secret: '',
receipt_top: '',
receipt_bottom: '',
printer_order_sn: '',
printer_pay_sn: '',
printer_pay_sn: '',alipay_app_id
mini_mch_id: '',
mini_mch_key: '',
mini_notify_url: '',
@ -614,6 +933,28 @@ export default {
android_version: '',
android_apk_url: '',
Integral_rules: '',
bncj: '',
qjmw: '',
hxjm: '',
founder: '',
alipay_app_id: '',
alipay_app_public_key: '',
alipay_public_key: '',
alipay_root_key: '',
alipay_private_key: '',
alipay_gateway: '',
mini_v3_mch_key: '',
switch: '',
mini_program_appId: '',
mini_program_secret: '',
mini_mch_id: '',
mini_mch_key: '',
mini_key_path: '',
mini_key_sn_no: '',
mini_key_cert_path: '',
mini_key_key_path: '',
mini_version: '',
mini_download_url: ''
/* // printer_sn: 30,
mini_program_appId: '',
mini_program_secret: '',
@ -654,10 +995,10 @@ export default {
},
payMents: [
{ label: '现金支付', value: '0' },
{label:'微信支付 ',value:"1"},
{label:'支付宝支付',value:"2"},
{label:'商户会员余额支付',value:"3"},
{label:'平台会员余额支付',value:"4"},
{ label: '微信支付 ', value: '1' },
{ label: '支付宝支付', value: '2' },
{ label: '商户会员余额支付', value: '3' },
{ label: '平台会员余额支付', value: '4' },
],
payChannelChooses: [],
// logistics:[]
@ -665,11 +1006,11 @@ export default {
},
created() {
// console.log('ddd')
// this.kiu()
console.log(db.get("TENANT"))
this.kiu()
console.log(db.get('TENANT'))
// this.formLabelAlign.storeId = sessionStorage.getItem('UserID')
this.headers.token = 'Bearer ' + db.get('TOKEN', '')
this.headers.tenant = db.get("TENANT")
this.headers.tenant = db.get('TENANT')
// this.queryse()
// this.getLogistics()
},
@ -734,7 +1075,6 @@ export default {
handleImageSuccessg(file) {
// console.log(file, '')
this.formLabelAlign.alipay_app_public_key = file.data.url
},
handleChangeg(file, fileList) {
if (fileList.length > 0) {
@ -1029,11 +1369,62 @@ export default {
payChannel.value = payChannelChooses;
this.formLabelAlignss.push(payChannel) */
// console.log(this.payChannelChooses)
if (this.value2 == true) {
this.formLabelAlign.switch = 'true'
} else if (this.value2 == false) {
this.formLabelAlign.switch = 'false'
}
this.formLabelAlignss.forEach((item, index) => {
if (item.name == 'android_version') {
item.value = this.formLabelAlign.android_version
} else if (item.name == 'android_apk_url') {
item.value = this.formLabelAlign.android_apk_url
}else if (item.name == 'Integral_rules') {
item.value = this.formLabelAlign.Integral_rules
}else if (item.name == 'bncj') {
item.value = this.formLabelAlign.bncj
}else if (item.name == 'qjmw') {
item.value = this.formLabelAlign.qjmw
}else if (item.name == 'hxjm') {
item.value = this.formLabelAlign.hxjm
}else if (item.name == 'founder') {
item.value = this.formLabelAlign.founder
}else if (item.name == 'alipay_app_id') {
item.value = this.formLabelAlign.alipay_app_id
}else if (item.name == 'alipay_app_public_key') {
item.value = this.formLabelAlign.alipay_app_public_key
}else if (item.name == 'alipay_public_key') {
item.value = this.formLabelAlign.alipay_public_key
}else if (item.name == 'alipay_root_key') {
item.value = this.formLabelAlign.alipay_root_key
}else if (item.name == 'alipay_private_key') {
item.value = this.formLabelAlign.alipay_private_key
}else if (item.name == 'alipay_gateway') {
item.value = this.formLabelAlign.alipay_gateway
}else if (item.name == 'mini_v3_mch_key') {
item.value = this.formLabelAlign.mini_v3_mch_key
}else if (item.name == 'switch') {
item.value = this.formLabelAlign.switch
}else if (item.name == 'mini_program_appId') {
item.value = this.formLabelAlign.mini_program_appId
}else if (item.name == 'mini_program_secret') {
item.value = this.formLabelAlign.mini_program_secret
}else if (item.name == 'mini_mch_id') {
item.value = this.formLabelAlign.mini_mch_id
}else if (item.name == 'mini_mch_key') {
item.value = this.formLabelAlign.mini_mch_key
}else if (item.name == 'mini_key_path') {
item.value = this.formLabelAlign.mini_key_path
}else if (item.name == 'mini_key_sn_no') {
item.value = this.formLabelAlign.mini_key_sn_no
}else if (item.name == 'mini_key_cert_path') {
item.value = this.formLabelAlign.mini_key_cert_path
}else if (item.name == 'mini_key_key_path') {
item.value = this.formLabelAlign.mini_key_key_path
}else if (item.name == 'mini_version') {
item.value = this.formLabelAlign.mini_version
}else if (item.name == 'mini_download_url') {
item.value = this.formLabelAlign.mini_download_url
}
})
console.log(this.formLabelAlignss)
@ -1041,7 +1432,11 @@ export default {
Tables.setdata(this.formLabelAlignss).then((res) => {
// console.log(res)
if (res.data.msg == 'ok') {
this.reload()
this.$message({
message: '修改成功',
type: 'success'
})
this.kiu()
}
})
// }
@ -1055,80 +1450,56 @@ export default {
red.data.data.forEach((item, index) => {
// console.log(item)
if (item.name == 'mini_program_appId') {
if (item.name == 'android_version') {
this.formLabelAlignss[0].id = item.id
} else if (item.name == 'mini_program_secret') {
} else if (item.name == 'android_apk_url') {
this.formLabelAlignss[1].id = item.id
} else if (item.name == 'receipt_top') {
} else if (item.name == 'Integral_rules') {
this.formLabelAlignss[2].id = item.id
} else if (item.name == 'receipt_bottom') {
} else if (item.name == 'bncj') {
this.formLabelAlignss[3].id = item.id
} else if (item.name == 'printer_order_sn') {
} else if (item.name == 'qjmw') {
this.formLabelAlignss[4].id = item.id
} else if (item.name == 'printer_pay_sn') {
} else if (item.name == 'hxjm') {
this.formLabelAlignss[5].id = item.id
} else if (item.name == 'mini_mch_id') {
} else if (item.name == 'founder') {
this.formLabelAlignss[6].id = item.id
} else if (item.name == 'mini_mch_key') {
} else if (item.name == 'alipay_app_id') {
this.formLabelAlignss[7].id = item.id
} else if (item.name == 'mini_notify_url') {
}else if (item.name == 'alipay_app_public_key') {
this.formLabelAlignss[8].id = item.id
} else if (item.name == 'mini_refund_notify_url') {
}else if (item.name == 'alipay_public_key') {
this.formLabelAlignss[9].id = item.id
} else if (item.name == 'mini_key_path') {
}else if (item.name == 'alipay_root_key') {
this.formLabelAlignss[10].id = item.id
this.fileListzs[0].name = item.value
} else if (item.name == 'merchant_table_price') {
}else if (item.name == 'alipay_private_key') {
this.formLabelAlignss[11].id = item.id
} else if (item.name == 'merchant_table_price_switch') {
}else if (item.name == 'alipay_gateway') {
this.formLabelAlignss[12].id = item.id
} else if (item.name == 'alipay_app_id') {
}else if (item.name == 'mini_v3_mch_key') {
this.formLabelAlignss[13].id = item.id
} else if (item.name == 'alipay_public_key') {
}else if (item.name == 'switch') {
this.formLabelAlignss[14].id = item.id
this.fileList[0].name = item.value
} else if (item.name == 'alipay_private_key') {
}else if (item.name == 'mini_program_appId') {
this.formLabelAlignss[15].id = item.id
this.fileListm[0].name = item.value
} else if (item.name == 'alipay_gateway') {
}else if (item.name == 'mini_program_secret') {
this.formLabelAlignss[16].id = item.id
} else if (item.name == 'alipay_app_public_key') {
}else if (item.name == 'mini_mch_id') {
this.formLabelAlignss[17].id = item.id
this.fileListg[0].name = item.value
} else if (item.name == 'alipay_root_key') {
}else if (item.name == 'mini_mch_key') {
this.formLabelAlignss[18].id = item.id
this.fileListz[0].name = item.value
} else if (item.name == 'printer_bar_code') {
}else if (item.name == 'mini_key_path') {
this.formLabelAlignss[19].id = item.id
} else if (item.name == 'mini_key_cert_path') {
}else if (item.name == 'mini_key_sn_no') {
this.formLabelAlignss[20].id = item.id
this.fileListdz[0].name = item.value
} else if (item.name == 'mini_key_key_path') {
}else if (item.name == 'mini_key_cert_path') {
this.formLabelAlignss[21].id = item.id
this.fileListmy[0].name = item.value
} else if (item.name == 'mini_key_sn_no') {
}else if (item.name == 'mini_key_key_path') {
this.formLabelAlignss[22].id = item.id
} else if (item.name == 'printer_logo') {
}else if (item.name == 'mini_version') {
this.formLabelAlignss[23].id = item.id
this.fileLogo[0].name = item.value
} else if (item.name == 'mini_v3_mch_key') {
}else if (item.name == 'mini_download_url') {
this.formLabelAlignss[24].id = item.id
} else if (item.name == 'switch') {
this.formLabelAlignss[25].id = item.id
} else if (item.name == 'printer_kitchen_total') { //
this.formLabelAlignss[26].id = item.id
} else if (item.name == 'printer_bar_code_width') { //
this.formLabelAlignss[27].id = item.id
} else if(item.name == 'pay_channel_chooses'){
this.payChannelChooses = item.value.split(',')
} else if(item.name == 'sending_threshold'){
this.formLabelAlignss[28].id = item.value
}else if(item.name == 'sending_price'){
this.formLabelAlignss[29].id = item.value
}else if(item.name == 'free_package_price'){
this.formLabelAlignss[30].id = item.value
} else if(item.name == 'default_logistics'){
this.formLabelAlignss[31].id = item.value
}
})
// console.log(this.payChannelChooses)

30
src/views/banner/Edit.vue

@ -105,6 +105,10 @@ export default {
type: String,
default: 'add',
},
enums: {
type: Object,
default: () => {}
}
},
data() {
return {
@ -115,7 +119,7 @@ export default {
width: this.initWidth(),
rules: {},
//
enums: {},
// enums: {},
//
dicts: {},
headers: {
@ -154,18 +158,6 @@ export default {
this.width = this.initWidth()
})()
}
initMsgsEnums(['banner_type'], this.enums)
setTimeout(() => {
let obj = this.enums.banner_type
for (let key in obj) {
let val = {
value: key,
label: obj[key],
}
this.typeOptions.push(val)
}
console.log(this.typeOptions, 'this.typeOptions')
}, 100)
},
methods: {
handleAvatarSuccess (response) {
@ -199,6 +191,18 @@ export default {
if (val['row']) {
vm.banner = { ...val['row'] }
}
this.typeOptions = []
let obj = this.enums.banner_type
for (let key in obj) {
let val = {
value: key,
label: obj[key],
}
if(this.banner.type == obj[key]) {
this.banner.type = key
}
this.typeOptions.push(val)
}
},
close() {
this.$emit('close')

2
src/views/banner/index.vue

@ -99,7 +99,7 @@
</el-table>
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current"
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/>
<banner-edit :dialog-visible="dialog.isVisible" :type="dialog.type"
<banner-edit :dialog-visible="dialog.isVisible" :type="dialog.type" :enums="enums"
@close="editClose" @success="editSuccess" ref="edit"/>
<banner-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type"
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" />

225
src/views/brand/Edit.vue

@ -0,0 +1,225 @@
<template>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type"
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog>
<el-form :model="brand" :rules="rules" label-position="right" label-width="100px" ref="form">
<el-form-item :label="$t('table.brand.name')" prop="name">
<el-input type="" v-model="brand.name" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.image')" prop="image">
<!-- <el-input type="" v-model="brand.image" placeholder=""/> -->
<el-upload
class="avatar-uploader"
:headers="headers"
:data="dataObj"
:action="action"
:show-file-list="false"
:on-success="handleAvatarSuccess"
>
<el-button size="small" type="primary"
>点击上传</el-button
>
</el-upload>
<img
style="margin-top:5px"
v-if="brand.image"
:src="brand.image"
class="avatar"
width="80"
height="80"
/>
</el-form-item>
<el-form-item :label="$t('table.brand.video')" prop="video">
<el-input type="" v-model="brand.video" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.desc')" prop="desc">
<el-input type="" v-model="brand.desc" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.content')" prop="content">
<!-- <el-input type="" v-model="brand.content" placeholder=""/> -->
<Tinymce ref="content" v-if="isVisible" v-model="brand.content" :height="200" />
</el-form-item>
<!-- <el-form-item :label="$t('table.brand.sort')" prop="sort">
<el-input type="" v-model="brand.sort" placeholder=""/>
</el-form-item> -->
</el-form>
<div class="dialog-footer" slot="footer">
<el-button @click="isVisible = false" plain type="warning">
{{ $t("common.cancel") }}
</el-button>
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary">
{{ $t("common.confirm") }}
</el-button>
</div>
</el-dialog>
</template>
<script>
import elDragDialog from '@/directive/el-drag-dialog'
import brandApi from "@/api/Brand.js";
import db from '@/utils/localstorage'
import Tinymce from '@/components/Tinymce'
export default {
name: "BrandEdit",
directives: { elDragDialog },
components: {Tinymce },
props: {
dialogVisible: {
type: Boolean,
default: false
},
type: {
type: String,
default: "add"
}
},
data() {
return {
confirmDisabled: false,
brand: this.initBrand(),
screenWidth: 0,
width: this.initWidth(),
rules: {
},
//
enums: {
},
//
dicts: {
},
//
headers: {
Authorization: '',
},
action: `${process.env.VUE_APP_DEV_REQUEST_DOMAIN_PREFIX}/file/upload`,
dataObj: {
folderId: 1
},
fileList: []
};
},
computed: {
isVisible: {
get() {
return this.dialogVisible;
},
set() {
this.close();
this.reset();
}
},
title() {
return this.$t("common." + this.type);
}
},
watch: {},
created() {
this.headers.token = 'Bearer ' + db.get('TOKEN', '')
this.headers.tenant = 'MDAwMA=='
},
mounted() {
window.onresize = () => {
return (() => {
this.width = this.initWidth();
})();
};
},
methods: {
handleAvatarSuccess (response) {
const { url } = response.data
this.brand.image = url
console.log(response,"response")
},
initBrand() {
return {
id: "",
name: '',
image: '',
video: '',
desc: '',
content: '',
sort: 50,
};
},
initWidth() {
this.screenWidth = document.body.clientWidth;
if (this.screenWidth < 991) {
return "90%";
} else if (this.screenWidth < 1400) {
return "45%";
} else {
return "800px";
}
},
setBrand(val = {}) {
const vm = this;
vm.dicts = val['dicts'];
vm.enums = val['enums'];
if (val['row']) {
vm.brand = { ...val['row'] };
}
},
close() {
this.$emit("close");
},
reset() {
// bug
this.$refs.form.clearValidate();
this.$refs.form.resetFields();
this.confirmDisabled = false;
this.brand = this.initBrand();
},
submitForm() {
const vm = this;
this.$refs.form.validate(valid => {
if (valid) {
vm.editSubmit();
} else {
return false;
}
});
},
editSubmit() {
const vm = this;
if (vm.type === "edit") {
vm.update();
} else {
vm.save();
}
},
save() {
const vm = this;
vm.confirmDisabled = true;
brandApi.save(this.brand).then(response => {
const res = response.data;
if (res.isSuccess) {
vm.isVisible = false;
vm.$message({
message: vm.$t("tips.createSuccess"),
type: "success"
});
vm.$emit("success");
}
}).finally(()=> vm.confirmDisabled = false);
},
update() {
const vm = this;
vm.confirmDisabled = true;
brandApi.update(this.brand).then(response => {
const res = response.data;
if (res.isSuccess) {
vm.isVisible = false;
vm.$message({
message: this.$t("tips.updateSuccess"),
type: "success"
});
vm.$emit("success");
}
}).finally(()=> vm.confirmDisabled = false);
}
}
};
</script>
<style lang="scss" scoped></style>

352
src/views/brand/Index.vue

@ -0,0 +1,352 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item"
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期"
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss"
/>
<el-button @click="search" class="filter-item" plain type="primary">
{{ $t("table.search") }}
</el-button>
<el-button @click="reset" class="filter-item" plain type="warning">
{{ $t("table.reset") }}
</el-button>
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['brand:add']">
{{ $t("table.add") }}
</el-button>
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['brand:delete', 'brand:export',
'brand:import']">
<el-button>
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="batchDelete" v-has-permission="['brand:delete']">
{{ $t("table.delete") }}
</el-dropdown-item>
<el-dropdown-item @click.native="exportExcel" v-has-permission="['brand:export']">
{{ $t("table.export") }}
</el-dropdown-item>
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['brand:export']">
{{ $t("table.exportPreview") }}
</el-dropdown-item>
<el-dropdown-item @click.native="importExcel" v-has-permission="['brand:import']">
{{ $t("table.import") }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick"
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange"
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading">
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/>
<el-table-column :label="$t('table.brand.name')" :show-overflow-tooltip="true" align="center" prop="name"
width="">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.image')" :show-overflow-tooltip="true" align="center" prop="image"
width="">
<template slot-scope="scope">
<!-- <span>{{ scope.row.image }}</span> -->
<img
v-if="scope.row.image"
:src="scope.row.image"
class="avatar"
width="80"
height="80"
/>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.video')" :show-overflow-tooltip="true" align="center" prop="video"
width="">
<template slot-scope="scope">
<span>{{ scope.row.video }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.desc')" :show-overflow-tooltip="true" align="center" prop="desc"
width="">
<template slot-scope="scope">
<span>{{ scope.row.desc }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.content')" :show-overflow-tooltip="true" align="center" prop="content"
width="">
<template slot-scope="scope">
<span>{{ scope.row.content }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.sort')" :show-overflow-tooltip="true" align="center" prop="sort"
width="">
<template slot-scope="scope">
<span>{{ scope.row.sort }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('table.createTime')"
align="center"
prop="createTime"
sortable="custom"
width="170px">
<template slot-scope="scope">
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px">
<template slot-scope="{ row }">
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')"
style="color: #2db7f5;" v-hasPermission="['brand:add']"/>
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')"
style="color: #2db7f5;" v-hasPermission="['brand:update']"/>
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')"
style="color: #f50;" v-hasPermission="['brand:delete']"/>
<el-link class="no-perm" v-has-no-permission="['brand:update', 'brand:copy', 'brand:delete']">
{{ $t("tips.noPermission") }}
</el-link>
</template>
</el-table-column>
</el-table>
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current"
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/>
<brand-edit :dialog-visible="dialog.isVisible" :type="dialog.type"
@close="editClose" @success="editSuccess" ref="edit"/>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true"
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog>
<el-scrollbar>
<div v-html="preview.context"></div>
</el-scrollbar>
</el-dialog>
</div>
</template>
<script>
import Pagination from "@/components/Pagination";
import elDragDialog from '@/directive/el-drag-dialog'
import BrandEdit from "./Edit";
import brandApi from "@/api/Brand.js";
import {convertEnum} from '@/utils/utils'
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons'
export default {
name: "BrandManage",
directives: { elDragDialog },
components: { Pagination, BrandEdit},
filters: {
},
data() {
return {
//
dialog: {
isVisible: false,
type: "add"
},
//
preview: {
isVisible: false,
context: ''
},
//
fileImport: {
isVisible: false,
type: "import",
action: `${process.env.VUE_APP_BASE_API}/brand/brand/import`
},
tableKey: 0,
queryParams: initQueryParams(),
selection: [],
loading: false,
tableData: {
total: 0
},
//
enums: {
},
//
dicts: {
}
};
},
computed: {
},
watch: {
},
mounted() {
this.fetch();
//
const enumList = [];
const dictList = [];
loadEnums(enumList, this.enums, 'brand');
initDicts(dictList, this.dicts);
},
methods: {
editClose() {
this.dialog.isVisible = false;
},
editSuccess() {
this.search();
},
onSelectChange(selection) {
this.selection = selection;
},
search() {
this.fetch({
...this.queryParams
});
},
reset() {
this.queryParams = initQueryParams();
this.$refs.table.clearSort();
this.$refs.table.clearFilter();
this.search();
},
exportExcelPreview() {
if (this.queryParams.timeRange) {
this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
}
this.queryParams.map.fileName = '导出数据';
brandApi.preview(this.queryParams).then(response => {
const res = response.data;
this.preview.isVisible = true;
this.preview.context = res.data;
});
},
exportExcel() {
if (this.queryParams.timeRange) {
this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
}
this.queryParams.map.fileName = '导出数据';
brandApi.export(this.queryParams).then(response => {
downloadFile(response);
});
},
importExcel() {
this.fileImport.type = "upload";
this.fileImport.isVisible = true;
this.$refs.import.setModel(false);
},
importSuccess() {
this.search();
},
importClose() {
this.fileImport.isVisible = false;
},
singleDelete(row) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(row, true);
this.batchDelete();
},
batchDelete() {
if (!this.selection.length) {
this.$message({
message: this.$t("tips.noDataSelected"),
type: "warning"
});
return;
}
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), {
confirmButtonText: this.$t("common.confirm"),
cancelButtonText: this.$t("common.cancel"),
type: "warning"
})
.then(() => {
const ids = this.selection.map(u => u.id);
this.delete(ids);
})
.catch(() => {
this.clearSelections();
});
},
clearSelections() {
this.$refs.table.clearSelection();
},
delete(ids) {
brandApi.delete({ ids: ids }).then(response => {
const res = response.data;
if (res.isSuccess) {
this.$message({
message: this.$t("tips.deleteSuccess"),
type: "success"
});
this.search();
}
});
},
add() {
this.dialog.type = "add";
this.dialog.isVisible = true;
this.$refs.edit.setBrand({ enums: this.enums, dicts: this.dicts});
},
copy(row) {
this.$refs.edit.setBrand({row, enums: this.enums, dicts: this.dicts});
this.dialog.type = "copy";
this.dialog.isVisible = true;
},
edit(row) {
this.$refs.edit.setBrand({row, enums: this.enums, dicts: this.dicts});
this.dialog.type = "edit";
this.dialog.isVisible = true;
},
fetch(params = {}) {
this.loading = true;
if (this.queryParams.timeRange) {
this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
}
this.queryParams.current = params.current ? params.current : this.queryParams.current;
this.queryParams.size = params.size ? params.size : this.queryParams.size;
brandApi.page(this.queryParams).then(response => {
const res = response.data;
if (res.isSuccess) {
this.tableData = res.data;
}
}).finally(() => this.loading = false);
},
sortChange(val) {
this.queryParams.sort = val.prop;
this.queryParams.order = val.order;
if (this.queryParams.sort) {
this.search();
}
},
filterChange (filters) {
for (const key in filters) {
if(key.includes('.')) {
const val = { };
val[key.split('.')[1]] = filters[key][0];
this.queryParams.model[key.split('.')[0]] = val;
} else {
this.queryParams.model[key] = filters[key][0]
}
}
this.search()
},
cellClick (row, column) {
if (column['columnKey'] === "operation") {
return;
}
let flag = false;
this.selection.forEach((item)=>{
if(item.id === row.id) {
flag = true;
this.$refs.table.toggleRowSelection(row);
}
})
if(!flag){
this.$refs.table.toggleRowSelection(row, true);
}
},
}
};
</script>
<style lang="scss" scoped></style>

184
src/views/brand/edit/BrandEdit.vue

@ -0,0 +1,184 @@
<template>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type"
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog>
<el-form :model="brand" :rules="rules" label-position="right" label-width="100px" ref="form">
<el-form-item :label="$t('table.brand.name')" prop="name">
<el-input type="" v-model="brand.name" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.image')" prop="image">
<el-input type="" v-model="brand.image" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.video')" prop="video">
<el-input type="" v-model="brand.video" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.desc')" prop="desc">
<el-input type="" v-model="brand.desc" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.content')" prop="content">
<el-input type="" v-model="brand.content" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.sort')" prop="sort">
<el-input type="" v-model="brand.sort" placeholder=""/>
</el-form-item>
</el-form>
<div class="dialog-footer" slot="footer">
<el-button @click="isVisible = false" plain type="warning">
{{ $t("common.cancel") }}
</el-button>
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary">
{{ $t("common.confirm") }}
</el-button>
</div>
</el-dialog>
</template>
<script>
import elDragDialog from '@/directive/el-drag-dialog'
import brandApi from "@/api/Brand.js";
export default {
name: "BrandEdit",
directives: { elDragDialog },
components: { },
props: {
dialogVisible: {
type: Boolean,
default: false
},
type: {
type: String,
default: "add"
}
},
data() {
return {
confirmDisabled: false,
brand: this.initBrand(),
screenWidth: 0,
width: this.initWidth(),
rules: {
},
//
enums: {
},
//
dicts: {
}
};
},
computed: {
isVisible: {
get() {
return this.dialogVisible;
},
set() {
this.close();
this.reset();
}
},
title() {
return this.$t("common." + this.type);
}
},
watch: {},
mounted() {
window.onresize = () => {
return (() => {
this.width = this.initWidth();
})();
};
},
methods: {
initBrand() {
return {
id: "",
name: '',
image: '',
video: '',
desc: '',
content: '',
sort: null,
};
},
initWidth() {
this.screenWidth = document.body.clientWidth;
if (this.screenWidth < 991) {
return "90%";
} else if (this.screenWidth < 1400) {
return "45%";
} else {
return "800px";
}
},
setBrand(val = {}) {
const vm = this;
vm.dicts = val['dicts'];
vm.enums = val['enums'];
if (val['row']) {
vm.brand = { ...val['row'] };
}
},
close() {
this.$emit("close");
},
reset() {
// bug
this.$refs.form.clearValidate();
this.$refs.form.resetFields();
this.confirmDisabled = false;
this.brand = this.initBrand();
},
submitForm() {
const vm = this;
this.$refs.form.validate(valid => {
if (valid) {
vm.editSubmit();
} else {
return false;
}
});
},
editSubmit() {
const vm = this;
if (vm.type === "edit") {
vm.update();
} else {
vm.save();
}
},
save() {
const vm = this;
vm.confirmDisabled = true;
brandApi.save(this.brand).then(response => {
const res = response.data;
if (res.isSuccess) {
vm.isVisible = false;
vm.$message({
message: vm.$t("tips.createSuccess"),
type: "success"
});
vm.$emit("success");
}
}).finally(()=> vm.confirmDisabled = false);
},
update() {
const vm = this;
vm.confirmDisabled = true;
brandApi.update(this.brand).then(response => {
const res = response.data;
if (res.isSuccess) {
vm.isVisible = false;
vm.$message({
message: this.$t("tips.updateSuccess"),
type: "success"
});
vm.$emit("success");
}
}).finally(()=> vm.confirmDisabled = false);
}
}
};
</script>
<style lang="scss" scoped></style>

25
src/views/brand/lang/BrandLang.java

@ -0,0 +1,25 @@
export default {
table: {
// 以下复制到en.js
brand: {
id: 'ID',
name: 'name',
image: 'image',
video: 'video',
desc: 'desc',
content: 'content',
sort: 'sort',
},
// 以下复制到zh.js
brand: {
id: 'ID',
name: 'name',
image: 'image',
video: 'video',
desc: 'desc',
content: 'content',
sort: 'sort',
},
// 复制之后,删除 lang.js
},
}

347
src/views/brand/pageIndex/BrandPageIndex.vue

@ -0,0 +1,347 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item"
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期"
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss"
/>
<el-button @click="search" class="filter-item" plain type="primary">
{{ $t("table.search") }}
</el-button>
<el-button @click="reset" class="filter-item" plain type="warning">
{{ $t("table.reset") }}
</el-button>
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['brand:add']">
{{ $t("table.add") }}
</el-button>
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['brand:delete', 'brand:export',
'brand:import']">
<el-button>
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="batchDelete" v-has-permission="['brand:delete']">
{{ $t("table.delete") }}
</el-dropdown-item>
<el-dropdown-item @click.native="exportExcel" v-has-permission="['brand:export']">
{{ $t("table.export") }}
</el-dropdown-item>
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['brand:export']">
{{ $t("table.exportPreview") }}
</el-dropdown-item>
<el-dropdown-item @click.native="importExcel" v-has-permission="['brand:import']">
{{ $t("table.import") }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick"
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange"
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading">
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/>
<el-table-column :label="$t('table.brand.name')" :show-overflow-tooltip="true" align="center" prop="name"
width="">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.image')" :show-overflow-tooltip="true" align="center" prop="image"
width="">
<template slot-scope="scope">
<span>{{ scope.row.image }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.video')" :show-overflow-tooltip="true" align="center" prop="video"
width="">
<template slot-scope="scope">
<span>{{ scope.row.video }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.desc')" :show-overflow-tooltip="true" align="center" prop="desc"
width="">
<template slot-scope="scope">
<span>{{ scope.row.desc }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.content')" :show-overflow-tooltip="true" align="center" prop="content"
width="">
<template slot-scope="scope">
<span>{{ scope.row.content }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.brand.sort')" :show-overflow-tooltip="true" align="center" prop="sort"
width="">
<template slot-scope="scope">
<span>{{ scope.row.sort }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('table.createTime')"
align="center"
prop="createTime"
sortable="custom"
width="170px">
<template slot-scope="scope">
<span>{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px">
<template slot-scope="{ row }">
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')"
style="color: #2db7f5;" v-hasPermission="['brand:add']"/>
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')"
style="color: #2db7f5;" v-hasPermission="['brand:update']"/>
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')"
style="color: #f50;" v-hasPermission="['brand:delete']"/>
<el-link class="no-perm" v-has-no-permission="['brand:update', 'brand:copy', 'brand:delete']">
{{ $t("tips.noPermission") }}
</el-link>
</template>
</el-table-column>
</el-table>
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current"
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/>
<brand-edit :dialog-visible="dialog.isVisible" :type="dialog.type"
@close="editClose" @success="editSuccess" ref="edit"/>
<brand-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type"
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" />
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true"
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog>
<el-scrollbar>
<div v-html="preview.context"></div>
</el-scrollbar>
</el-dialog>
</div>
</template>
<script>
import Pagination from "@/components/Pagination";
import elDragDialog from '@/directive/el-drag-dialog'
import BrandEdit from "./Edit";
import brandApi from "@/api/Brand.js";
import BrandImport from "@/components/zsw/Import"
import {convertEnum} from '@/utils/utils'
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons'
export default {
name: "BrandManage",
directives: { elDragDialog },
components: { Pagination, BrandEdit, BrandImport},
filters: {
},
data() {
return {
//
dialog: {
isVisible: false,
type: "add"
},
//
preview: {
isVisible: false,
context: ''
},
//
fileImport: {
isVisible: false,
type: "import",
action: `${process.env.VUE_APP_BASE_API}/brand/brand/import`
},
tableKey: 0,
queryParams: initQueryParams(),
selection: [],
loading: false,
tableData: {
total: 0
},
//
enums: {
},
//
dicts: {
}
};
},
computed: {
},
watch: {
},
mounted() {
this.fetch();
//
const enumList = [];
const dictList = [];
loadEnums(enumList, this.enums, 'brand');
initDicts(dictList, this.dicts);
},
methods: {
editClose() {
this.dialog.isVisible = false;
},
editSuccess() {
this.search();
},
onSelectChange(selection) {
this.selection = selection;
},
search() {
this.fetch({
...this.queryParams
});
},
reset() {
this.queryParams = initQueryParams();
this.$refs.table.clearSort();
this.$refs.table.clearFilter();
this.search();
},
exportExcelPreview() {
if (this.queryParams.timeRange) {
this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
}
this.queryParams.map.fileName = '导出数据';
brandApi.preview(this.queryParams).then(response => {
const res = response.data;
this.preview.isVisible = true;
this.preview.context = res.data;
});
},
exportExcel() {
if (this.queryParams.timeRange) {
this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
}
this.queryParams.map.fileName = '导出数据';
brandApi.export(this.queryParams).then(response => {
downloadFile(response);
});
},
importExcel() {
this.fileImport.type = "upload";
this.fileImport.isVisible = true;
this.$refs.import.setModel(false);
},
importSuccess() {
this.search();
},
importClose() {
this.fileImport.isVisible = false;
},
singleDelete(row) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(row, true);
this.batchDelete();
},
batchDelete() {
if (!this.selection.length) {
this.$message({
message: this.$t("tips.noDataSelected"),
type: "warning"
});
return;
}
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), {
confirmButtonText: this.$t("common.confirm"),
cancelButtonText: this.$t("common.cancel"),
type: "warning"
})
.then(() => {
const ids = this.selection.map(u => u.id);
this.delete(ids);
})
.catch(() => {
this.clearSelections();
});
},
clearSelections() {
this.$refs.table.clearSelection();
},
delete(ids) {
brandApi.delete({ ids: ids }).then(response => {
const res = response.data;
if (res.isSuccess) {
this.$message({
message: this.$t("tips.deleteSuccess"),
type: "success"
});
this.search();
}
});
},
add() {
this.dialog.type = "add";
this.dialog.isVisible = true;
this.$refs.edit.setBrand({ enums: this.enums, dicts: this.dicts});
},
copy(row) {
this.$refs.edit.setBrand({row, enums: this.enums, dicts: this.dicts});
this.dialog.type = "copy";
this.dialog.isVisible = true;
},
edit(row) {
this.$refs.edit.setBrand({row, enums: this.enums, dicts: this.dicts});
this.dialog.type = "edit";
this.dialog.isVisible = true;
},
fetch(params = {}) {
this.loading = true;
if (this.queryParams.timeRange) {
this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
}
this.queryParams.current = params.current ? params.current : this.queryParams.current;
this.queryParams.size = params.size ? params.size : this.queryParams.size;
brandApi.page(this.queryParams).then(response => {
const res = response.data;
if (res.isSuccess) {
this.tableData = res.data;
}
}).finally(() => this.loading = false);
},
sortChange(val) {
this.queryParams.sort = val.prop;
this.queryParams.order = val.order;
if (this.queryParams.sort) {
this.search();
}
},
filterChange (filters) {
for (const key in filters) {
if(key.includes('.')) {
const val = { };
val[key.split('.')[1]] = filters[key][0];
this.queryParams.model[key.split('.')[0]] = val;
} else {
this.queryParams.model[key] = filters[key][0]
}
}
this.search()
},
cellClick (row, column) {
if (column['columnKey'] === "operation") {
return;
}
let flag = false;
this.selection.forEach((item)=>{
if(item.id === row.id) {
flag = true;
this.$refs.table.toggleRowSelection(row);
}
})
if(!flag){
this.$refs.table.toggleRowSelection(row, true);
}
},
}
};
</script>
<style lang="scss" scoped></style>

356
src/views/brand/treeIndex/BrandTreeIndex.vue

@ -0,0 +1,356 @@
<template>
<div class="brand">
<el-row :gutter="10">
<el-col :sm="12" :xs="24">
<div class="app-container">
<div class="filter-container">
<el-input :placeholder="$t('table.brand.label')" class="filter-item search-item" v-model="label"/>
<el-button @click="search" class="filter-item" plain type="primary">
{{ $t("table.search") }}
</el-button>
<el-button @click="reset" class="filter-item" plain type="warning">
{{ $t("table.reset") }}
</el-button>
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['brand:add']">
{{ $t("table.add") }}
</el-button>
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['brand:import', 'brand:delete', 'brand:export']">
<el-button>
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right"/>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="batchDelete" v-has-permission="['brand:delete']">
{{ $t("table.delete") }}
</el-dropdown-item>
<el-dropdown-item @click.native="exportExcel" v-has-permission="['brand:export']">
{{ $t("table.export") }}
</el-dropdown-item>
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['brand:export']">
{{ $t("table.exportPreview") }}
</el-dropdown-item>
<el-dropdown-item @click.native="importExcel" v-has-permission="['brand:import']">
{{ $t("table.import") }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-tree
:check-strictly="true"
:data="brandTree"
:filter-node-method="filterNode"
@node-click="nodeClick"
:load="loadTree"
highlight-current
node-key="id"
ref="brandTree"
:lazy="true"
show-checkbox/>
</div>
</el-col>
<el-col :sm="12" :xs="24">
<el-card class="box-card">
<div class="clearfix" slot="header">
<span>
{{brand.id === "" ? this.$t("common.add") : this.$t("common.edit")}}
</span>
</div>
<div>
<el-form :model="brand" :rules="rules" label-position="right" label-width="100px" ref="form">
<el-form-item :hidden="true" :label="$t('table.brand.parentId')" prop="parentId">
<el-tooltip :content="$t('tips.topId')" class="item" effect="dark" placement="top-start">
<el-input readonly v-model="brand.parentId"/>
</el-tooltip>
</el-form-item>
<el-form-item :label="$t('table.brand.parentId')" prop="parentLabel">
<el-input readonly disabled="disabled" v-model="brand.parentLabel"/>
</el-form-item>
<el-form-item :label="$t('table.brand.label')" prop="label">
<el-input v-model="brand.label"/>
</el-form-item>
<el-form-item :label="$t('table.brand.name')" prop="name">
<el-input type="" v-model="brand.name" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.image')" prop="image">
<el-input type="" v-model="brand.image" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.video')" prop="video">
<el-input type="" v-model="brand.video" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.desc')" prop="desc">
<el-input type="" v-model="brand.desc" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.content')" prop="content">
<el-input type="" v-model="brand.content" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.sort')" prop="sort">
<el-input type="" v-model="brand.sort" placeholder=""/>
</el-form-item>
<el-form-item :label="$t('table.brand.sortValue')" prop="sortValue">
<el-input-number :max="100" :min="0" @change="handleNumChange" v-model="brand.sortValue"/>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="box-card" style="margin-top: -2rem;">
<el-row>
<el-col :span="24" style="text-align: right">
<el-button @click="submit" plain type="primary">
{{brand.id === "" ? this.$t("common.add") : this.$t("common.edit") }}
</el-button>
</el-col>
</el-row>
</el-card>
</el-col>
</el-row>
<brand-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type"
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" />
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true"
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog>
<el-scrollbar>
<div v-html="preview.context"></div>
</el-scrollbar>
</el-dialog>
</div>
</template>
<script>
import brandApi from "@/api/Brand.js";
import elDragDialog from '@/directive/el-drag-dialog'
import BrandImport from "@/components/zsw/Import"
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons'
export default {
name: "BrandManager",
directives: { elDragDialog },
components: { BrandImport },
data() {
return {
label: "",
brandTree: [],
brand: this.initBrand(),
rules: {
},
//
preview: {
isVisible: false,
context: ''
},
//
fileImport: {
isVisible: false,
type: "import",
action: `${process.env.VUE_APP_BASE_API}/brand/brand/import`
},
//
enums: {
},
//
dicts: {
}
};
},
mounted() {
//
const enumList = [];
const dictList = [];
loadEnums(enumList, this.enums, 'brand');
initDicts(dictList, this.dicts);
},
methods: {
initBrand() {
return {
id: "",
label: "",
sortValue: 0,
parentId: 0,
parentLabel: "",
name: '',
image: '',
video: '',
desc: '',
content: '',
sort: null,
};
},
initBrandTree(parentId = 0) {
brandApi.query({parentId: parentId}).then(response => {
const res = response.data;
this.brandTree = res.data;
});
},
loadTree(node, resolve) {
brandApi.query({parentId: node.data.id ? node.data.id : 0}).then(response => {
const res = response.data;
resolve(res.data);
});
},
exportExcelPreview() {
const queryParams = initQueryParams();
queryParams.map.fileName = '导出数据';
brandApi.preview(queryParams).then(response => {
const res = response.data;
this.preview.isVisible = true;
this.preview.context = res.data;
});
},
exportExcel() {
const queryParams = initQueryParams();
queryParams.map.fileName = '导出数据';
brandApi.export(queryParams).then(response => {
downloadFile(response);
});
},
importExcel() {
this.fileImport.type = "upload";
this.fileImport.isVisible = true;
this.$refs.import.setModel(false);
},
importSuccess() {
this.initBrandTree(0);
},
importClose() {
this.fileImport.isVisible = false;
},
handleNumChange(val) {
this.brand.sortValue = val;
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
nodeClick(val) {
const vm = this;
if(val){
this.brand = {...val};
}
const parent = this.$refs.brandTree.getNode(val.parentId);
if (parent) {
this.brand.parentLabel = parent.label;
}
this.$refs.form.clearValidate();
},
add() {
this.resetForm();
const checked = this.$refs.brandTree.getCheckedNodes();
if (checked.length > 1) {
this.$message({
message: this.$t("tips.onlyChooseOne"),
type: "warning"
});
} else if (checked.length > 0) {
this.brand.parentId = checked[0].id;
this.brand.parentLabel = checked[0].label;
} else {
this.brand.parentId = 0;
this.brand.parentLabel = "";
}
},
batchDelete() {
const checked = this.$refs.brandTree.getCheckedKeys();
if (checked.length === 0) {
this.$message({
message: this.$t("tips.noNodeSelected"),
type: "warning"
});
} else {
this.$confirm(this.$t("tips.confirmDeleteNode"), this.$t("common.tips"), {
confirmButtonText: this.$t("common.confirm"),
cancelButtonText: this.$t("common.cancel"),
type: "warning"
}).then(() => {
brandApi.delete({ids: checked}).then(response => {
const res = response.data;
if (res.isSuccess) {
this.$message({
message: this.$t("tips.deleteSuccess"),
type: "success"
});
}
this.reset();
});
}).catch(() => {
this.$refs.brandTree.setCheckedKeys([]);
});
}
},
search() {
this.$refs.brandTree.filter(this.label);
},
reset() {
this.initBrandTree();
this.label = "";
this.resetForm();
},
submit() {
this.$refs.form.validate(valid => {
if (valid) {
if (this.brand.id) {
this.update();
} else {
this.save();
}
} else {
return false;
}
});
},
save() {
brandApi.save({...this.brand}).then(response => {
const res = response.data;
if (res.isSuccess) {
this.$message({
message: this.$t("tips.createSuccess"),
type: "success"
});
}
this.reset();
});
},
update() {
brandApi.update({...this.brand}).then(response => {
const res = response.data;
if (res.isSuccess) {
this.$message({
message: this.$t("tips.updateSuccess"),
type: "success"
});
}
this.reset();
});
},
resetForm() {
this.$refs.form.clearValidate();
this.$refs.form.resetFields();
this.brand = this.initBrand();
}
}
};
</script>
<style lang="scss" scoped>
.brand {
margin: 10px;
.app-container {
margin: 0 0 10px 0 !important;
}
}
.el-card.is-always-shadow {
box-shadow: none;
}
.el-card {
border-radius: 0;
border: none;
.el-card__header {
padding: 10px 20px !important;
border-bottom: 1px solid #f1f1f1 !important;
}
}
</style>

16
src/views/creditGoods/goods/Edit.vue

@ -20,11 +20,19 @@
:label="$t('table.creditGoods.categoryId')"
prop="categoryId"
>
<el-input
<!-- <el-input
type=""
v-model="creditGoods.categoryId"
placeholder="分类ID"
/>
/> -->
<el-select v-model="creditGoods.categoryId" placeholder="请选择">
<el-option
v-for="item in classification.records"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('table.creditGoods.name')" prop="name">
<el-input type="" v-model="creditGoods.name" placeholder="商品名" />
@ -209,6 +217,10 @@ export default {
type: String,
default: 'add',
},
classification:{
type: Object,
default: () => {}
}
},
data() {
return {

25
src/views/creditGoods/goods/index.vue

@ -174,7 +174,7 @@
</el-table>
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current"
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/>
<creditGoods-edit :dialog-visible="dialog.isVisible" :type="dialog.type"
<creditGoods-edit :dialog-visible="dialog.isVisible" :type="dialog.type" :classification="classification"
@close="editClose" @success="editSuccess" ref="edit"/>
<creditGoods-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type"
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" />
@ -195,7 +195,7 @@ import creditGoodsApi from "@/api/creditGoods/CreditGoods.js";
import CreditGoodsImport from "@/components/ceres/Import"
import {convertEnum} from '@/utils/utils'
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons'
import creditGoodsCategoryApi from "@/api/creditGoods/CreditGoodsCategory.js";
export default {
name: "CreditGoodsManage",
directives: { elDragDialog },
@ -234,7 +234,8 @@ export default {
},
//
dicts: {
}
},
classification:{}
};
},
computed: {
@ -243,7 +244,7 @@ export default {
},
mounted() {
this.fetch();
this.getclassification()
//
const enumList = [];
const dictList = [];
@ -251,6 +252,22 @@ export default {
initDicts(dictList, this.dicts);
},
methods: {
//
getclassification() {
this.loading = true;
let queryParams = {
current: 1,
size: 999,
model: {}
}
creditGoodsCategoryApi.page(queryParams).then(response => {
const res = response.data;
if (res.isSuccess) {
this.classification = res.data;
console.log(this.classification,"this.classification")
}
}).finally(() => this.loading = false);
},
editClose() {
this.dialog.isVisible = false;
},

387
src/views/information/Edit.vue

@ -1,210 +1,297 @@
<template>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type"
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog>
<el-form :model="information" :rules="rules" label-position="right" label-width="100px" ref="form">
<el-form-item :label="$t('table.information.storeId')" prop="storeId">
<el-input type="" v-model="information.storeId" placeholder="店铺ID"/>
<el-dialog
:close-on-click-modal="false"
:title="title"
:type="type"
:visible.sync="isVisible"
width="800px"
top="50px"
class="group-dialog"
>
<el-form :model="params" label-width="100px" :rules="rules" ref="params">
<el-form-item label="活动标题" prop="mainTitle">
<el-input v-model="params.mainTitle" style="width: 200px" />
</el-form-item>
<el-form-item :label="$t('table.information.mainTitle')" prop="mainTitle">
<el-input type="" v-model="information.mainTitle" placeholder="主标题"/>
<el-form-item label="活动简介" prop="viceTitle">
<el-input v-model="params.viceTitle" style="width: 200px" />
</el-form-item>
<el-form-item :label="$t('table.information.viceTitle')" prop="viceTitle">
<el-input type="" v-model="information.viceTitle" placeholder="副标题"/>
<el-form-item label="作者" prop="name">
<el-input v-model="params.name" style="width: 200px" />
</el-form-item>
<el-form-item :label="$t('table.information.content')" prop="content">
<el-input type="" v-model="information.content" placeholder="内容"/>
<el-form-item label="作者头像" prop="avatar">
<!-- <el-input v-model="params.author.avatar" style="width: 200px" /> -->
<el-upload
class="avatar-uploader"
:headers="headers"
:data="dataObj"
:action="action"
:show-file-list="false"
:on-success="handleAvatarSuccessAvatar"
>
<!-- <img
v-if="params.avatar"
:src="params.avatar"
class="avatar"
width="80"
height="80"
/> -->
<!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i> -->
<el-button size="small" type="primary"
>点击上传</el-button
>
</el-upload>
<img
style="margin-top:5px"
v-if="params.avatar"
:src="params.avatar"
class="avatar"
width="80"
height="80"
/>
</el-form-item>
<el-form-item :label="$t('table.information.coverImg')" prop="coverImg">
<el-input type="" v-model="information.coverImg" placeholder="封面图"/>
<el-form-item label="活动封面图" prop="coverImg">
<!-- <el-input v-model="params.coverImg" style="width: 200px" /> -->
<el-upload
class="avatar-uploader"
:headers="headers"
:data="dataObj"
:action="action"
:show-file-list="false"
:on-success="handleAvatarSuccess"
>
<!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i> -->
<el-button size="small" type="primary"
>点击上传</el-button
>
</el-upload>
<img
style="margin-top:5px"
v-if="params.coverImg"
:src="params.coverImg"
class="avatar"
width="80"
height="80"
/>
</el-form-item>
<el-form-item :label="$t('table.information.startTime')" prop="startTime">
<el-form-item label="开始时间" prop="startTime">
<el-date-picker
v-model="information.startTime"
placeholder="开始时间"
:start-placeholder="$t('table.information.startTime')"
v-model="params.startTime"
type="datetime"
placeholder="选择日期时间"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
class="filter-item date-range-item"
type="datetime"/>
>
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('table.information.endTime')" prop="endTime">
<el-form-item label="结束时间" prop="endTime">
<el-date-picker
v-model="information.endTime"
placeholder="结束时间"
:start-placeholder="$t('table.information.endTime')"
v-model="params.endTime"
type="datetime"
placeholder="选择日期时间"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
class="filter-item date-range-item"
type="datetime"/>
</el-form-item>
<el-form-item :label="$t('table.information.state')" prop="state">
<el-input type="" v-model="information.state" placeholder="状态:1-上架,0-下架"/>
>
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('table.information.isDelete')" prop="isDelete">
<el-input type="" v-model="information.isDelete" placeholder="逻辑删除:1-删除 0-未删除"/>
<el-form-item label="富文本" prop="content">
<Tinymce ref="content" v-if="isVisible" v-model="params.content" :height="200" />
</el-form-item>
<!-- <el-form-item label="是否上架" prop="state">
<el-radio-group v-model="params.state" size="medium">
<el-radio-button :label="0">{{
$t('common.yes')
}}</el-radio-button>
<el-radio-button :label="1">{{
$t('common.no')
}}</el-radio-button>
</el-radio-group>
</el-form-item> -->
</el-form>
<div class="dialog-footer" slot="footer">
<el-button @click="isVisible = false" plain type="warning">
{{ $t("common.cancel") }}
{{ $t('common.cancel') }}
</el-button>
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary">
{{ $t("common.confirm") }}
<el-button
@click="submitForm('params')"
plain
type="primary"
>
{{ $t('common.confirm') }}
</el-button>
</div>
</el-dialog>
</template>
<script>
import elDragDialog from '@/directive/el-drag-dialog'
import informationApi from "@/api/InformationApi.js";
import db from '@/utils/localstorage'
import ActivityTweets from '@/api/ActivityTweets'
import Tinymce from '@/components/Tinymce'
// import moment from 'moment'
export default {
name: "InformationEdit",
directives: { elDragDialog },
components: { },
components:{
Tinymce
},
props: {
dialogVisible: {
type: Boolean,
default: false
default: false,
},
type: {
type: String,
default: "add"
}
default: 'add',
},
},
data() {
return {
confirmDisabled: false,
information: this.initInformation(),
screenWidth: 0,
width: this.initWidth(),
rules: {
options: [],
sizeForm: {},
headers: {
Authorization: '',
},
//
enums: {
action: `${process.env.VUE_APP_DEV_REQUEST_DOMAIN_PREFIX}/file/upload`,
dataObj: {
folderId: 1,
},
params: {
id: '',
mainTitle: '',
viceTitle: 1,
coverImg: '',
startTime: '',
endTime: '',
content: '',
name: '',
avatar: ''
},
rules: {
groupName: [{ required: true, message: '不可为空', trigger: 'blur' }],
},
//
dicts: {
}
};
},
computed: {
isVisible: {
get() {
return this.dialogVisible;
return this.dialogVisible
},
set() {
this.close();
this.reset();
}
this.close()
this.reset()
},
title() {
return this.$t("common." + this.type);
}
},
watch: {},
mounted() {
window.onresize = () => {
return (() => {
this.width = this.initWidth();
})();
};
title() {
return this.type === 'add' ? '新建活动' : '查看活动'
},
methods: {
initInformation() {
return {
id: "",
storeId: null,
mainTitle: '',
viceTitle: '',
content: '',
coverImg: '',
startTime: null,
endTime: null,
state: null,
isDelete: null,
};
},
initWidth() {
this.screenWidth = document.body.clientWidth;
if (this.screenWidth < 991) {
return "90%";
} else if (this.screenWidth < 1400) {
return "45%";
} else {
return "800px";
}
},
setInformation(val = {}) {
const vm = this;
vm.dicts = val['dicts'];
vm.enums = val['enums'];
if (val['row']) {
vm.information = { ...val['row'] };
}
created() {
this.headers.token = 'Bearer ' + db.get('TOKEN', '')
this.headers.tenant = db.get('TENANT')
},
methods: {
close() {
this.$emit("close");
this.$emit('close')
},
reset() {
// bug
this.$refs.form.clearValidate();
this.$refs.form.resetFields();
this.confirmDisabled = false;
this.information = this.initInformation();
},
submitForm() {
const vm = this;
this.$refs.form.validate(valid => {
this.params = {}
},
async submitForm(params) {
this.$refs[params].validate((valid) => {
if (valid) {
vm.editSubmit();
if (this.type === 'add') {
this.addGroup()
} else if (this.type === 'edit') {
this.updateGroup()
}
} else {
return false;
// console.log(false+'123')
// if(
// !this.params.groupName ||
// !this.params.printerId ){
// this.$message.warning("");
// }else{
// }
}
});
})
},
editSubmit() {
const vm = this;
if (vm.type === "edit") {
vm.update();
} else {
vm.save();
async addGroup() {
// this.params.startTime = moment(this.params.startTime).format('YYYY-MM-DD HH:mm:ss')
// this.params.endTime = moment(this.params.endTime).format('YYYY-MM-DD HH:mm:ss')
this.params.type = 2
let data = {
name: this.params.name,
avatar: this.params.avatar
}
this.params.author = JSON.stringify(data)
// console.log(this.params, '')
const res = await ActivityTweets.save(this.params)
// console.log(res, 'resxinz')
const resData = res.data
const { code } = resData
if (code === 0) {
this.isVisible = false
this.$message({
message: this.$t('tips.createSuccess'),
type: 'success',
})
this.$emit('success')
}
},
save() {
const vm = this;
vm.confirmDisabled = true;
informationApi.save(this.information).then(response => {
const res = response.data;
if (res.isSuccess) {
vm.isVisible = false;
vm.$message({
message: vm.$t("tips.createSuccess"),
type: "success"
});
vm.$emit("success");
async updateGroup() {
let data = {
name: this.params.name,
avatar: this.params.avatar
}
}).finally(()=> vm.confirmDisabled = false);
},
update() {
const vm = this;
vm.confirmDisabled = true;
informationApi.update(this.information).then(response => {
const res = response.data;
if (res.isSuccess) {
vm.isVisible = false;
vm.$message({
message: this.$t("tips.updateSuccess"),
type: "success"
});
vm.$emit("success");
this.params.author = JSON.stringify(data)
// this.params.startTime = moment(this.params.startTime).format('YYYY-MM-DD HH:mm:ss')
// this.params.endTime = moment(this.params.endTime).format('YYYY-MM-DD HH:mm:ss')
this.params.type = 2
const res = await ActivityTweets.update(this.params)
const resData = res.data
const { code } = resData
if (code === 0) {
this.isVisible = false
this.$message({
message: this.$t('tips.updateSuccess'),
type: 'success',
})
this.$emit('success')
}
}).finally(()=> vm.confirmDisabled = false);
},
handleAvatarSuccess(response) {
const { url } = response.data
this.params.coverImg = url
},
handleAvatarSuccessAvatar(response) {
const { url } = response.data
this.params.avatar = url
},
setParams(val = {}) {
this.params = {}
if(val) {
this.params = JSON.parse(JSON.stringify(val))
this.params.name = JSON.parse(this.params.author).name
this.params.avatar = JSON.parse(this.params.author).avatar
}
},
},
}
};
</script>
<style lang="scss" scoped></style>
<style lang="less" scoped>
.group-dialog {
.upload-wrap {
width: 100%;
display: flex;
align-items: flex-end;
.image-wrap {
width: 120px;
height: 120px;
line-height: 120px;
margin-right: 15px;
margin-bottom: 15px;
text-align: center;
border: 1px dashed #d9d9d9;
img {
width: 100%;
height: 100%;
}
}
}
}
</style>

497
src/views/information/index.vue

@ -1,370 +1,227 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-input
:placeholder="$t('table.information.mainTitle')"
class="filter-item search-item"
v-model="queryParams.model.mainTitle"
/>
<div class="group-page">
<div class="toolbar">
<el-button
type="primary"
size="mini"
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item"
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期"
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss"
/>
<el-button @click="search" class="filter-item" plain type="primary">
{{ $t("table.search") }}
</el-button>
<el-button @click="reset" class="filter-item" plain type="warning">
{{ $t("table.reset") }}
@click="getActivityTweetsList"
icon="el-icon-zoom-in"
>
查询
</el-button>
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['information:add']">
{{ $t("table.add") }}
<el-button type="warning" size="mini" @click="reset" icon="el-icon-refresh-right">
重置
</el-button>
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['information:delete', 'information:export',
'information:import']">
<el-button>
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" />
<el-button
type="goon"
size="mini"
@click="addGroup"
icon="el-icon-circle-plus-outline"
>
新增
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="batchDelete" v-has-permission="['information:delete']">
{{ $t("table.delete") }}
</el-dropdown-item>
<el-dropdown-item @click.native="exportExcel" v-has-permission="['information:export']">
{{ $t("table.export") }}
</el-dropdown-item>
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['information:export']">
{{ $t("table.exportPreview") }}
</el-dropdown-item>
<el-dropdown-item @click.native="importExcel" v-has-permission="['information:import']">
{{ $t("table.import") }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick"
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange"
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading">
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/>
<el-table-column :label="$t('table.information.storeId')" :show-overflow-tooltip="true" align="center" prop="storeId"
width="">
<template slot-scope="scope">
<span>{{ scope.row.storeId }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.information.mainTitle')" :show-overflow-tooltip="true" align="center" prop="mainTitle"
width="">
<template slot-scope="scope">
<span>{{ scope.row.mainTitle }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.information.viceTitle')" :show-overflow-tooltip="true" align="center" prop="viceTitle"
width="">
<template slot-scope="scope">
<span>{{ scope.row.viceTitle }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.information.content')" :show-overflow-tooltip="true" align="center" prop="content"
width="">
<template slot-scope="scope">
<span>{{ scope.row.content }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.information.coverImg')" :show-overflow-tooltip="true" align="center" prop="coverImg"
width="">
<template slot-scope="scope">
<span>{{ scope.row.coverImg }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.information.startTime')" :show-overflow-tooltip="true" align="center" prop="startTime"
width="170">
<template slot-scope="scope">
<span>{{ scope.row.startTime }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.information.endTime')" :show-overflow-tooltip="true" align="center" prop="endTime"
width="170">
<template slot-scope="scope">
<span>{{ scope.row.endTime }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.information.state')" :show-overflow-tooltip="true" align="center" prop="state"
width="">
<template slot-scope="scope">
<span>{{ scope.row.state }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.information.isDelete')" :show-overflow-tooltip="true" align="center" prop="isDelete"
width="">
<template slot-scope="scope">
<span>{{ scope.row.isDelete }}</span>
</template>
</el-table-column>
<div class="group-content">
<el-table
id="tables"
:data="tableData.list"
style="width: 100%"
v-loading="loading"
row-key="id"
>
<el-table-column
:label="$t('table.createTime')"
prop="mainTitle"
label="活动标题"
align="center"
prop="createTime"
sortable="custom"
width="170px">
width="200"
></el-table-column>
<el-table-column
prop="viceTitle"
label="活动简介"
align="center"
width="200"
></el-table-column>
<!-- <el-table-column
prop="coverImg"
label="活动封面图"
align="center"
width="200"
>
<template slot-scope="scope">
<span>{{ scope.row.createTime }}</span>
<img
v-if="scope.row.coverImg"
:src="scope.row.coverImg"
class="avatar"
width="80"
height="80"
/>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
prop="createTime"
label="发布时间"
align="center"
width="200"
></el-table-column>
<el-table-column
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px">
<template slot-scope="{ row }">
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')"
style="color: #2db7f5;" v-hasPermission="['information:add']"/>
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')"
style="color: #2db7f5;" v-hasPermission="['information:update']"/>
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')"
style="color: #f50;" v-hasPermission="['information:delete']"/>
<el-link class="no-perm" v-has-no-permission="['information:update', 'information:copy', 'information:delete']">
{{ $t("tips.noPermission") }}
</el-link>
prop="storeName"
label="发布人(平台)"
align="center"
width="200"
></el-table-column>
<!-- <el-table-column
prop="updateTime"
label="最后修改时间"
align="center"
width="200"
></el-table-column> -->
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.prevent="editGroup(scope.row)"
>
编辑
</el-button>
<el-button
type="text"
size="small"
@click.native.prevent="deleteGroup(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current"
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/>
<information-edit :dialog-visible="dialog.isVisible" :type="dialog.type"
@close="editClose" @success="editSuccess" ref="edit"/>
<information-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type"
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" />
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true"
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog>
<el-scrollbar>
<div v-html="preview.context"></div>
</el-scrollbar>
</el-dialog>
</div>
<pagination
v-show="tableData.total > 0"
:limit.sync="formParams.pageSize"
:page.sync="formParams.pageNum"
:total="Number(tableData.total)"
@pagination="fetch"
/>
<grope-edit
ref="edit"
:dialog-visible="dialog.isVisible"
:type="dialog.type"
@close="editClose"
@success="getActivityTweetsList"
/>
</div>
</template>
<script>
import Pagination from "@/components/Pagination";
import elDragDialog from '@/directive/el-drag-dialog'
import InformationEdit from "./Edit";
import informationApi from "@/api/InformationApi.js";
import InformationImport from "@/components/ceres/Import"
import {convertEnum} from '@/utils/utils'
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons'
import ActivityTweets from '@/api/ActivityTweets'
import GropeEdit from './Edit'
import Pagination from '@/components/Pagination'
import db from '@/utils/localstorage'
export default {
name: "InformationManage",
directives: { elDragDialog },
components: { Pagination, InformationEdit, InformationImport},
filters: {
name: 'ActivityTweets',
components: {
GropeEdit,
Pagination,
},
data() {
return {
//
dialog: {
isVisible: false,
type: "add"
loading: true,
formParams: {
"pageNum": 1,
"pageSize": 10,
"searchKey": "",
"type": 2,
state: 1
},
//
preview: {
isVisible: false,
context: ''
},
//
fileImport: {
dialog: {
type: 'add',
isVisible: false,
type: "import",
action: `${process.env.VUE_APP_BASE_API}/store/information/import`
},
tableKey: 0,
queryParams: initQueryParams(),
selection: [],
loading: false,
tableData: {
total: 0
},
//
enums: {
},
//
dicts: {
tableData: [],
}
};
},
computed: {
},
watch: {
created() {
this.getActivityTweetsList()
},
mounted(){
this.fetch();
//
const enumList = [];
const dictList = [];
loadEnums(enumList, this.enums, 'store');
initDicts(dictList, this.dicts);
},
methods: {
editClose() {
this.dialog.isVisible = false;
},
editSuccess() {
this.search();
},
onSelectChange(selection) {
this.selection = selection;
async getActivityTweetsList() {
this.loading = true
const res = await ActivityTweets.page(this.formParams)
const resData = res.data
const { code } = resData
if (code === 0) {
this.tableData = resData.data
this.loading = false
console.log(this.tableData,'this.tableData')
}
},
search() {
this.fetch({
...this.queryParams
});
fetch() {
this.getActivityTweetsList()
},
reset() {
this.queryParams = initQueryParams();
this.$refs.table.clearSort();
this.$refs.table.clearFilter();
this.search();
this.getActivityTweetsList()
},
exportExcelPreview() {
if (this.queryParams.timeRange) {
this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
addGroup() {
this.dialog = {
type: 'add',
isVisible: true,
}
this.queryParams.map.fileName = '导出数据';
informationApi.preview(this.queryParams).then(response => {
const res = response.data;
this.preview.isVisible = true;
this.preview.context = res.data;
});
this.$refs.edit.setParams(null)
},
exportExcel() {
if (this.queryParams.timeRange) {
this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
}
this.queryParams.map.fileName = '导出数据';
informationApi.export(this.queryParams).then(response => {
downloadFile(response);
});
},
importExcel() {
this.fileImport.type = "upload";
this.fileImport.isVisible = true;
this.$refs.import.setModel(false);
},
importSuccess() {
this.search();
},
importClose() {
this.fileImport.isVisible = false;
editClose() {
this.dialog.isVisible = false
},
singleDelete(row) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(row, true);
this.batchDelete();
editGroup(row) {
const {id, mainTitle, viceTitle, coverImg, startTime, endTime, content, state} = row
this.dialog = {
type: 'edit',
isVisible: true,
}
this.$refs.edit.setParams(row)
},
batchDelete() {
if (!this.selection.length) {
async delete(params) {
const res = await ActivityTweets.delete(params)
const resData = res.data
const { code } = resData
if (code === 0) {
this.$message({
message: this.$t("tips.noDataSelected"),
type: "warning"
});
return;
message: this.$t('tips.deleteSuccess'),
type: 'success',
})
this.getActivityTweetsList()
}
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), {
confirmButtonText: this.$t("common.confirm"),
cancelButtonText: this.$t("common.cancel"),
type: "warning"
},
deleteGroup(row) {
const { id } = row
this.$confirm(this.$t('tips.confirmDelete'), this.$t('common.tips'), {
confirmButtonText: this.$t('common.confirm'),
cancelButtonText: this.$t('common.cancel'),
type: 'warning',
})
.then(() => {
const ids = this.selection.map(u => u.id);
this.delete(ids);
this.delete({
id,
})
.catch(() => {
this.clearSelections();
});
},
clearSelections() {
this.$refs.table.clearSelection();
},
delete(ids) {
informationApi.delete({ ids: ids }).then(response => {
const res = response.data;
if (res.isSuccess) {
this.$message({
message: this.$t("tips.deleteSuccess"),
type: "success"
});
this.search();
}
});
},
add() {
this.dialog.type = "add";
this.dialog.isVisible = true;
this.$refs.edit.setInformation({ enums: this.enums, dicts: this.dicts});
},
copy(row) {
this.$refs.edit.setInformation({row, enums: this.enums, dicts: this.dicts});
this.dialog.type = "copy";
this.dialog.isVisible = true;
},
edit(row) {
this.$refs.edit.setInformation({row, enums: this.enums, dicts: this.dicts});
this.dialog.type = "edit";
this.dialog.isVisible = true;
},
fetch(params = {}) {
this.loading = true;
if (this.queryParams.timeRange) {
this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
}
this.queryParams.current = params.current ? params.current : this.queryParams.current;
this.queryParams.size = params.size ? params.size : this.queryParams.size;
informationApi.page(this.queryParams).then(response => {
const res = response.data;
if (res.isSuccess) {
this.tableData = res.data;
}
}).finally(() => this.loading = false);
})
.catch(() => {})
},
sortChange(val) {
this.queryParams.sort = val.prop;
this.queryParams.order = val.order;
if (this.queryParams.sort) {
this.search();
}
},
filterChange (filters) {
for (const key in filters) {
if(key.includes('.')) {
const val = { };
val[key.split('.')[1]] = filters[key][0];
this.queryParams.model[key.split('.')[0]] = val;
} else {
this.queryParams.model[key] = filters[key][0]
}
}
this.search()
},
cellClick (row, column) {
if (column['columnKey'] === "operation") {
return;
</script>
<style lang="less" scoped>
.group-page {
padding: 15px 20px;
.toolbar {
margin-bottom: 20px;
text-align: left;
.el-input{
margin-right: 10px !important;
}
let flag = false;
this.selection.forEach((item)=>{
if(item.id === row.id) {
flag = true;
this.$refs.table.toggleRowSelection(row);
.group-name {
width: 180px;
}
})
if(!flag){
this.$refs.table.toggleRowSelection(row, true);
}
},
}
};
</script>
<style lang="scss" scoped></style>
</style>

2
vue.config.js

@ -15,7 +15,7 @@ module.exports = {
lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false,
devServer: {
// port: 145,
port: 8082,
open: true,
overlay: {
warnings: false,

Loading…
Cancel
Save