Commit d61df7f5 by 前端

feat:战报配置功能开发

1 parent 0a457ce5
{ {
"name": "scrm-micro-battles", "name": "scrm-micro-activity-center",
"version": "1.0.0", "version": "1.0.0",
"description": "A Vue.js project", "description": "A Vue.js project",
"private": true, "private": true,
......
import { http } from '@/main'
const url1 = '/rop-scrm-entmicro/router'
const url='/rop-scrm-shopmall/router'
//门店号选择服务
const getMerchantList=params=>{
params.method = 'entmicro.api.merchant.listDepartmentTree.select.merchant'
return http({
url:url1,
method: 'post',
data: params,
sign: true
})
}
const getlistDepartmentTree = params => {
params.method = `entmicro.api.department.listDepartmentTree`
return http({
url:url1,
method: 'GET',
data: params,
sign: true
})
}
//战报配置列表
const getActivitylist= params => {
params.method = `scrm.api.shopmall.activity.action.report.page`
return http({
url,
method: 'post',
data: params,
sign: true
})
}
// 批量配置众筹活动战报专员
const insertStaff= params => {
params.method = `scrm.api.shopmall.activity.action.report.staff.insert`
return http({
url,
method: 'post',
data: params,
sign: true,
returnAll: true
})
}
// 根据众筹活动id获取众筹活动战报专员列表(运营版)
const getStaffList= params => {
params.method = `scrm.api.shopmall.activity.action.report.staff.list`
return http({
url,
method: 'post',
data: params,
sign: true
})
}
// const insertZoneApi = params => {
// params.method = `${defaultPath}zoneInfo.insertOrUpdate`
// return http({
// url,
// method: 'POST',
// data: params,
// sign: true,
// returnAll: true
// })
// }
export default { getStaffList,getMerchantList,getlistDepartmentTree,getActivitylist ,insertStaff}
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.'
const getZoneListApi = params => {
params.method = `${defaultPath}zoneInfo.page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
const deleteZoneApi = params => {
params.method = `${defaultPath}zoneInfo.delete`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
const getZoneInfoApi = params => {
params.method = `${defaultPath}zoneInfo.getById`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
const insertZoneApi = params => {
params.method = `${defaultPath}zoneInfo.insertOrUpdate`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getZoneListApi, deleteZoneApi, getZoneInfoApi, insertZoneApi }
...@@ -5,19 +5,115 @@ html { ...@@ -5,19 +5,115 @@ html {
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
background-color: #F4F5FA; background-color: #f4f5fa;
}
.el-form-item__content {
width: 284px;
.el-input__inner {
height: 32px !important;
line-height: 32px !important;
}
}
.flex {
display: flex;
align-items: center;
}
.flex-between{
display: flex;
align-items: center;
justify-content: space-between;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-two-line {
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
word-break: break-all;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.x-center {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.y-center {
position: absolute;
top: 50%;
transform: translateY(-50%);
} }
.marketing .container { .activity .container {
background: #ffffff; background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1); padding: 16px 20px;
padding: 20px;
} }
.marketing .m-b-20 { .activity .m-b-20 {
margin-bottom: 20px; margin-bottom: 20px;
} }
.word {
word-wrap: break-all;
}
.fwt-4 {
font-weight: 400;
}
.font-12 {
font-size: 12px;
}
.font-14 {
font-size: 14px;
}
.color6 {
color: #666666;
}
.color3 {
color: #333333;
}
.color58 {
color: #5850ff;
}
.m-r-4 {
margin-right: 4px;
}
.m-l-4 {
margin-left: 4px;
}
.m-b-10 {
margin-bottom: 10px;
}
.marketing.p-t-20 { .activity.p-t-20 {
padding-top: 20px; padding-top: 20px;
} }
.line-20 {
line-height: 20px;
}
.el-tooltip__popper {
position: absolute;
background: #fff;
min-width: 150px;
border-radius: 4px;
border: 1px solid #ebeef5 !important;
padding: 12px;
z-index: 2000;
color: #606266;
line-height: 1.4;
text-align: justify;
font-size: 14px;
word-break: break-all;
}
const staticRoutes = Object.freeze([{ const staticRoutes = Object.freeze([{
name: 'default', name: 'battle',
path: '/', path: '/',
redirect: { name: 'zoneList' } redirect: { name: 'battle' }
}, },
{ {
name: 'zoneList', name: 'battle',
path: '/zoneList/index', path: '/battle/index',
component: resolve => require([`@/views/zoneList/index.vue`], resolve), component: resolve => require([`@/views/battle/index.vue`], resolve),
meta: {} meta: {}
} }
]) ])
......
export function debounce(func, wait= 200){ export function debounce(func, wait = 200) {
let timeout; let timeout
return function(event){ return function(event) {
clearTimeout(timeout) clearTimeout(timeout)
timeout = setTimeout(()=>{ timeout = setTimeout(() => {
func.call(this, event) func.call(this, event)
},wait) }, wait)
}
} }
}
export function dateFormat (dateTime, format = 'YYYY-MM-DD HH:mm') { export function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') {
const date = new Date(dateTime) const date = new Date(dateTime)
const config = { const config = {
YYYY: date.getFullYear(), YYYY: date.getFullYear(),
MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11) MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
DD: date.getDate(), DD: date.getDate(),
HH: date.getHours(), HH: date.getHours(),
mm: date.getMinutes(), mm: date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes(),
ss: date.getSeconds() ss: date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
} }
for (const key in config) { for (const key in config) {
format = format.replace(key, config[key]) format = format.replace(key, config[key])
} }
return format return format
}
\ No newline at end of file \ No newline at end of file
}
...@@ -140,7 +140,9 @@ export default { ...@@ -140,7 +140,9 @@ export default {
defaultCheckedKeys: [] // 左侧默认选中数据 defaultCheckedKeys: [] // 左侧默认选中数据
} }
}, },
created() {}, created() {
},
mounted() { mounted() {
this.$apis.demo.GETLISTDEVICEFILEUNSTOCK({ k: 2, kdj: 5 }).then(res => {}) this.$apis.demo.GETLISTDEVICEFILEUNSTOCK({ k: 2, kdj: 5 }).then(res => {})
// 测试延迟默认选中 // 测试延迟默认选中
......
<template>
<div>
<div>
<el-form ref="form" :model="company" label-width="154px"></el-form>
</div>
<div class="member-wrapper">
<div class="member-left">
<div class="member-content">
<div class="member-content-head">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
</div>
<div class="table-content">
<el-input size="medium" v-model="filterText" suffix-icon="el-icon-search" clearable placeholder="请输入搜索关键字"></el-input>
<el-tree :data="departmentList" :default-expanded-keys="expandedKeys" show-checkbox ref="tree" node-key="id" :props="defaultProps" @check="handleNodeClick" :filter-node-method="filterNode"></el-tree>
</div>
</div>
</div>
<div class="member-right">
<div class="member-name member-content-head">
<div>已选名称</div>
<div class="blue" @click="clear">清空</div>
</div>
<div class="input-tag-wrapper">
<div class="tag-box">
<el-tag v-for="(label, idx) in userList" :key="idx" type="info" closable :disable-transitions="false" @close="remove(ids)">
{{ label.staffName }}
</el-tag>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
newArr: [],
filterText: '',
userList: [],
isIndeterminate: false,
checkAll: false,
ids: [],
expandedKeys: [],
defaultIds: [],
departmentList: [],
defaultProps: {
children: 'children',
label: 'staffName'
}
}
},
props: {
merchantId: {
type: String,
default: ''
},
selectlist: {
type: Array,
default: () => []
}
},
created() {
this.getDepartmentTree()
},
watch: {
filterText(val) {
this.$refs.tree.filter(val)
},
selectlist(val) {
this.defaultData()
}
},
methods: {
clear() {
this.userList = []
this.$refs.tree.setCheckedKeys([])
this.handleNodeClick()
},
handleCheckAllChange(val) {
console.log(val)
val ? this.$refs.tree.setCheckedKeys(this.ids) : this.$refs.tree.setCheckedKeys([])
this.handleNodeClick()
this.isIndeterminate = false
},
defaultData() {
this.defaultIds = this.selectlist.map(item => item.staffId)
this.$refs.tree.setCheckedKeys(this.defaultIds)
this.handleNodeClick()
},
getMerchantList() {
this.$apis.battle.getMerchantList({}).then(res => {
this.merchantList = res
this.merchantId = this.merchantList[0].merchantId
this.merchantName = this.merchantList[0].merchantName
})
},
async getDepartmentTree() {
let params = { addChildrensFlag: true, queryMerchantId: this.merchantId }
let data = await this.$apis.battle.getlistDepartmentTree(params)
this.ids = []
data[0].entmicroStaffResponses = data[0].children
this.departmentList = this.transformData(data)
this.expandedKeys = [this.departmentList[0].id]
this.$nextTick(() => {
if (this.selectlist.length > 0) {
this.defaultData()
}
})
},
transformData(treeData) {
let children = []
treeData.forEach((item, index) => {
if (item.entmicroStaffResponses && item.entmicroStaffResponses.length > 0) {
children.push({
staffName: item.departmentName,
id: item.id,
children: this.transformData(item.entmicroStaffResponses)
})
} else {
children.push({
staffName: item.staffName,
id: item.staffId,
userId: item.userId,
staffId: item.staffId
})
this.ids.push(item.staffId)
}
})
return children
},
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
search() {},
handleNodeClick() {
this.userList = this.$refs.tree.getCheckedNodes().filter(item => !item.children)
this.isIndeterminate = this.userList.length > 0 && this.userList.length < this.ids.length
this.checkAll = this.userList.length === this.ids.length
},
remove(index) {
this.userList.splice(index, 1)
let ids = this.userList.map(item => item.id)
this.$refs.tree.setCheckedKeys(ids)
this.isIndeterminate = ids.length < this.ids.length
}
}
}
</script>
<style scoped lang="scss">
.member-wrapper {
display: flex;
.member-left {
width: 400px;
.member-content {
border: 1px solid #eee;
.member-content-head {
height: 44px;
line-height: 44px;
padding: 0 16px;
}
.member-form {
padding: 10px 20px;
}
.table-content {
max-height: 456px;
overflow: auto;
border: 1px solid #eee;
.el-input {
margin: 20px 20px 6px 20px;
width: 360px;
height: 36px;
box-sizing: border-box;
}
}
}
.member-checked {
text-align: right;
margin-top: 10px;
}
}
.member-right {
width: 264px;
margin-left: 14px;
.member-name {
font-size: 14px;
color: #333;
line-height: 44px;
height: 44px;
border: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
.blue {
color: #5850ff;
cursor: pointer;
}
}
}
}
.table-content {
max-height: 456px;
overflow: auto;
border: 1px solid #eee;
}
.table-content .el-tree {
margin: 0 20px 20px;
}
.member-right {
width: 300px;
margin-left: 14px;
}
.member-name {
font-size: 14px;
color: #333;
line-height: 60px;
height: 60px;
padding: 0 20px;
border: 1px solid #eee;
}
.tag-box {
margin: 12px 8px;
.el-tag {
margin-right: 4px;
margin-bottom: 4px;
background-color: #fff !important;
font-weight: 400;
font-size: 14px;
color: #666666;
line-height: 20px;
padding: 3px 8px;
height: auto;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<!-- 专区管理 -->
<template>
<div class="marketing p-t-20">
<div class="m-b-20">
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">新建</el-button>
</div>
<div class="container">
<el-form :inline="true">
<el-form-item label="专区名称">
<el-input style="width: 215px;" :size="size" v-model="searchForm.zoneName"></el-input>
</el-form-item>
<el-form-item class="search-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="default" @click="handleReset">查询</el-button>
</el-form-item>
</el-form>
<!-- 表格区域 开始 -->
<GLTable
ref="zoneRef"
:getListApi="getListApi"
:noDataImg="url"
:searchForm="tableSearchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
@setTableFinishFun="setTableFinishFun"
>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleEdit(2, scope.scope)">编辑</el-button>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
export default {
name: 'zoneList',
data() {
return {
size: 'small',
url: url,
searchForm: {
zoneName: '',
createDate: []
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '专区名称',
name: 'zoneName',
type: 'input',
maxlength: 20
},
{
label: '创建日期',
name: 'createDate',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
}
],
// 表格
getListApi: this.$apis.zoneList.getZoneListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '专区名称',
prop: 'zoneName'
},
{
label: '创建日期',
prop: 'createdDate',
width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
mounted() {},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
params.zoneType = '2' //专区类型(1发现频道,2商城专区)
if (this.searchForm.createDate.length) {
params.startTime = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endTime = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createDate
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.createDate
resolve()
})
},
// 1-新增;2-编辑
handleEdit(addOrEdit, row) {
this.$message({
type: 'success',
message: addOrEdit == '1' ? '新增' : '编辑'
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.zoneRef.data.length ? (this.$refs.zoneRef.tableHeightValues = '') : this.$refs.zoneRef.setTableHeightFun()
},
handleSearch() {
this.$refs.zoneRef.refreshTable()
},
handleReset() {
this.searchForm = {
zoneName: ''
}
this.handleSearch()
}
}
}
</script>
<style scoped>
.marketing .search-btns {
float: right;
margin-right: 0;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!