Commit e467ff3e by xuyl

Merge branch 'v2.1.0' of http://192.168.3.233:8090/saas/scrm-micro-custom into xuyl_dev_2.1.0

2 parents 6a2c8b3a 265230d0
......@@ -57,5 +57,16 @@ export default {
padding: 20px 0;
line-height: 36px;
}
#app {
background: #f4f5fa;
padding: 0px 20px 20px 20px;
position: absolute;
box-sizing: border-box;
width: 100%;
top: 0px;
left: 0px;
overflow-y: auto;
height: 100%;
}
</style>
>
......@@ -121,3 +121,14 @@ export function clientManageExportApi(params) {
sign: true
})
}
//根据userId完善客户手机号
export function perfectCustomerPhone(params) {
params.method = `entmicro.api.customer.perfectCustomerPhone`
return http3({
url: 'http://192.168.3.193:8395/rop-scrm-entmicro/router',
method: 'GET',
data: params,
sign: true
})
}
......@@ -18,7 +18,7 @@ export const fetchConfig = function(isEnv = true) {
return Promise.resolve(cfg)
}
return new Http({ request: { timeout: 3000 } }).get('https://oss-config.test.glsx.com.cn/mock/616d3b131072f92988f05a01/custom/config2')
return new Http({ request: { timeout: 3000 } }).get('https://oss-config.dev.glsx.com.cn/mock/616d3b131072f92988f05a01/custom/config2')
//开发环境mock
// return new Http({ request: { timeout: 3000 } }).get('http://192.168.3.171:7300/mock/616d3b131072f92988f05a01/custom/config2')
}
......
......@@ -15,7 +15,7 @@ import '@/assets/css/public.scss'
// import 'glsx-components/dist/glsx-components.css'
import './styles/index.scss'
import { start } from '@/setup'
import glsxTable from 'glsx-table';
import glsxTable from 'glsx-table'
import { message } from './plugins/element.js'
import filters from '@/utils/filters'
import * as echarts from 'echarts'
......@@ -27,7 +27,7 @@ Vue.use(VueAnimateNumber)
Vue.config.productionTip = false
Vue.prototype.$apis = apis
Vue.use(glsxTable);
Vue.use(glsxTable)
Vue.prototype.$message = message
Vue.prototype.size = 'small'
// Vue.prototype.btn_size = 'mini'
......@@ -39,7 +39,6 @@ Vue.prototype.$echarts = echarts
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
start()
export { bootstrap, mount, unmount } from '@/setup'
export const http = params => Vue.prototype.$http(params)
export const http2 = params => Vue.prototype.$http2(params)
......
import { getCustomersList, exportLabelList } from '@/api/modules/tagsManage'
import { getStaffList } from '@/api/modules/clientManage'
export default {
data() {
return {
tagHeight: 0,
tagHeightStatus: false,
tagCheckItem: [],
allListParams: [],
crowdForm: {
crowdName: '',
crowdDesc: ''
}
}
},
mounted() {
this.getStaffList()
this.getCustomersListData()
},
watch: {
tagCheckItem: {
handler() {
if (this.tagCheckItem.length == 0) {
this.tagHeight = 0
}
this.allListParams = []
const tagNode = this.$common.utils.deepClone(this.tagCheckItem)
tagNode.forEach(group_item => {
group_item.children.forEach(label_item => {
if (label_item) {
this.allListParams.push({
groupId: group_item.id,
groupName: group_item.name,
groupType: group_item.labelType,
labelId: label_item.id,
labelName: label_item.name
})
}
})
})
this.getCustomersListData()
},
deep: true
},
tagHeight: {
handler(val) {
if (val == 0) {
setTimeout(() => {
this.tagHeightStatus = false
}, 300)
} else {
this.tagHeightStatus = true
}
},
deep: true
}
},
methods: {
//获取跟进员工
getStaffList() {
getStaffList({}).then(res => {
if (res.length == 0) {
return ''
}
const id = this.tagsPartFormList.findIndex(item => {
return item.name == 'followStaff'
})
const staff = res.map(item => {
return {
label: item.staffName,
value: item.staffName
}
})
staff.unshift({ label: '全部', value: '' })
this.$nextTick(() => {
this.tagsPartFormList[id].optionList = staff
})
console.log(this.tagsPartFormList[id])
})
},
goDetail(scope) {
this.$router.push('/clientManage/clientDetail?id=' + scope.oneId)
},
//删除标签组
removeItem(index) {
this.tagCheckItem.splice(index, 1)
this.$refs.tagTree.getTreeNode(this.tagCheckItem)
},
treeScroll(id) {
const h = document.querySelector('.node_' + id).offsetTop
this.$refs.tagTree.handleScroll(h)
},
//获取选中的标签并排序
getCheckItem(item) {
const tree_id = []
const labelTree = this.$refs.tagTree.labelTree
labelTree.forEach(tree_node => {
tree_node.children.forEach(t_node => {
tree_id.push(t_node.id)
})
})
this.tagCheckItem = []
let group_all = item.getCheckedNodes().filter(item => item.labelType)
let group_Label = item.getCheckedNodes().filter(item => !item.children)
let label_id = []
group_Label.forEach(item => {
label_id.push(item.id)
})
let group_half = item.getHalfCheckedNodes().filter(item => item.labelType)
let group = [...group_half, ...group_all].sort((a, b) => {
return tree_id.indexOf(a.id) - tree_id.indexOf(b.id)
})
this.tagCheckItem = this.$common.utils.deepClone(group)
group.forEach((tag, idx) => {
tag.children.forEach((item, index) => {
if (!label_id.includes(item.id)) {
this.tagCheckItem[idx].children[index] = null
}
})
})
},
//导出
handleExport() {
const params = {
...JSON.parse(JSON.stringify({ tagLists: this.allListParams }))
}
exportLabelList(params).then(res => {
this.$Utils.exportFn(res)
})
},
//客户列表
getCustomersListData() {
if (this.searchForm.createTime) {
this.searchForm.beginTime = new Date(this.searchForm.createTime[0]).toLocaleDateString().replace(/-/g, '/')
this.searchForm.endTime = new Date(this.searchForm.createTime[1]).toLocaleDateString().replace(/-/g, '/')
}
delete this.searchForm.createTime
const tagLists = this.$common.utils.deepClone(this.allListParams)
this.userLoading = true
const params = {
...JSON.parse(JSON.stringify({ tagLists })),
...JSON.parse(JSON.stringify(this.searchForm)),
pageSize: this.$refs.viewCustomers.page.pageSize,
pageNum: this.$refs.viewCustomers.page.pageNum
}
getCustomersList(params)
.then(res => {
this.userLoading = false
this.tableData = res.data
this.tableTotal = res.count
if (this.tableTotal == 0) {
this.$refs.viewCustomers.setTableHeightFun()
}
})
.catch(err => {
this.userLoading = false
})
},
//创建人群
groupConfirmDialog() {
console.log(this.allListParams)
if (this.tagCheckItem.length == 0) {
this.$message.error('必须选择一个标签')
return
}
if (!this.crowdForm.crowdName) {
this.$message.error('请输入人群名称')
return
}
const tagCombine = this.allListParams.reduce((prev, cur) => {
const index = prev.findIndex(group => cur.groupId == group.groupId)
if (index == -1) {
return prev.concat({ groupId: cur.groupId, labelIdList: [cur.labelId] })
} else {
prev[index].labelIdList.push(cur.labelId)
return prev
}
}, [])
const params = {
'req.merchantId': this.merchantId,
'req.crowdType': 2, //类型 1-推荐 2-自定义
'req.crowdName': this.crowdForm.crowdName,
'req.crowdDesc': this.crowdForm.crowdDesc,
'req.tagCombine': JSON.stringify(tagCombine)
}
this.$apis.crowdManage
.addCrowd(params)
.then(res => {
if (res) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.groupVisible = false
} else {
this.$message({
type: 'error',
message: '操作失败'
})
}
})
.catch(err => {
this.$message({
type: 'error',
message: err.message
})
})
}
}
}
......@@ -2,59 +2,51 @@ import Vue from 'vue'
import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import ElementUI from 'element-ui'
import { GLButton, GLTable, GLFooter } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { GLButton, GLTable } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router'
import render from './render'
import GLCombiForm from '@/components/GlCombiForm'
import GlSearch from '@/components/GlSearch'
import GlSearchItem from '@/components/GlSearchItem'
Vue.use(GlSearch)
Vue.use(GlSearchItem)
Vue.use(GLCombiForm)
Vue.use(ElementUI)
Vue.use(GLTable)
Vue.use(GLFooter)
import GLCombiForm from '@/components/GlCombiForm'
Vue.use(GLCombiForm)
import 'glsx-components/dist/glsx-components.css'
let routes = []
let router = null
let instance = null
// http:调的是新版标签的接口,http2:调的是客户相关接口;http3:企微授权那边的接口 目前导出接口都测试的:http3
// http:调的是新版标签的接口,http2:调的是客户相关接口;http3:企微授权那边的接口 目前导出接口都测试的:http3
export async function bootstrap({ name, id, history, common, messenger, globalState, routerBase }) {
const { response, request, request2, request3, request4, sign, secret, sign_common, request_common } = await fetchConfig(globalState.configSwitch) //globalState.configSwitch
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http2 = new common.Http({ response, request: request2, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http3 = new common.Http({ response, request: request3, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$http4 = new common.Http({ response, request: request4, sign, secret, alert: message.error, headers: { token: 'scrm-base-e2d4f962-4ca3-4044-83e7-01ba314d8e3d-rop' } })
// Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: "mini-14eda653-4284-4165-bb85-325bb82a516d-rop" } })
Vue.prototype.$http_common = new common.Http({ response, signWay: "md5", request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
//Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes(routesData)
// { name, id, }
subscribe({ messenger })
Vue.use(GLButton, { routes, routerBase })
const { response, request, request2, request3, request4, sign, secret, sign_common, request_common } = await fetchConfig(globalState.configSwitch) //globalState.configSwitch
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http2 = new common.Http({ response, request: request2, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http3 = new common.Http({ response, request: request3, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$http4 = new common.Http({ response, request: request4, sign, secret, alert: message.error, headers: { token: 'scrm-base-e2d4f962-4ca3-4044-83e7-01ba314d8e3d-rop' } })
// Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: "mini-14eda653-4284-4165-bb85-325bb82a516d-rop" } })
Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
//Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes(routesData)
// { name, id, }
subscribe({ messenger })
Vue.use(GLButton, { routes, routerBase })
}
export async function mount(props) {
const insts = render(props.routerBase, routes)
router = insts.router
instance = insts.vm
const insts = render(props.routerBase, routes)
router = insts.router
instance = insts.vm
}
export async function unmount() {
instance.$destroy()
instance.$el.innerHTML = ''
instance = null
router = null
instance.$destroy()
instance.$el.innerHTML = ''
instance = null
router = null
}
function subscribe({ messenger }) {
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
\ No newline at end of file
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
@import './variables.scss';
@import './common.scss';
@import './resetelement.scss';
@import "./variables.scss";
@import "./common.scss";
@import "./resetelement.scss";
body,
html {
width: 100%;
......@@ -34,10 +34,10 @@ button {
// 子系统不设外边距
.scrm-sub-client-container {
padding: 0 20px 20px 40px;
// padding: 0 20px 20px 40px;
box-sizing: border-box;
}
.el-table .cell {
// line-height: 20px!important;
}
\ No newline at end of file
}
//过滤器
/* eslint-disable */
const overThousandFilter = (val) => {
if(typeof(val)!='number'){
return false;
}
if (val < 1000) return val;
let a = val + "";
let b = a.split("");
b.splice(-3, 0, ",");
return b.join("");
};
//来源 value值转为对应label(来源)
const toLabel=(value)=> {
if (value!==0 && !value) {
return
}
let sourceList=JSON.parse(window.localStorage.getItem('sourceList'));
let curElement =sourceList.find(item => {
return item.value === value
})
return curElement.label
}
import Vue from 'vue'
const overThousandFilter = val => {
if (typeof val != 'number') {
return false
}
if (val < 1000) return val
let a = val + ''
let b = a.split('')
b.splice(-3, 0, ',')
return b.join('')
}
//来源 value值转为对应label(来源)
const toLabel = value => {
if (value !== 0 && !value) {
return
}
let sourceList = JSON.parse(window.localStorage.getItem('sourceList'))
let curElement = sourceList.find(item => {
return item.value === value
})
return curElement.label
}
const tagType = value => {
let type = ''
if (JSON.parse(sessionStorage.getItem('SCRM_BASE_SESSION')).merchantModel == 1) {
type = '集团'
} else {
type = '企业'
}
return type
}
export default {
overThousandFilter,
toLabel
};
overThousandFilter,
toLabel,
tagType
}
export function debounce(fn, delay, triggerNow) {
var t = null;
console.log('ceshi')
var debounced = function(){
var _self = this,
args = arguments;
if(t){
clearTimeout(t);
}
if(triggerNow){
var exec = !t;
t = setTimeout(function(){
t = null;
}, delay);
var t = null
console.log('ceshi')
var debounced = function() {
var _self = this,
args = arguments
if (t) {
clearTimeout(t)
}
if (triggerNow) {
var exec = !t
if(exec){
// 初次进来
fn.apply(_self, args);
}
}else{
t = setTimeout(function(){
fn.apply(_self, args);
}, delay);
t = setTimeout(function() {
t = null
}, delay)
if (exec) {
// 初次进来
fn.apply(_self, args)
}
} else {
t = setTimeout(function() {
fn.apply(_self, args)
}, delay)
}
}
debounced.remove = function(){
clearTimeout(t);
t = null;
debounced.remove = function() {
clearTimeout(t)
t = null
}
return debounced;
}
return debounced
}
//格式化日期
export const formatDate = (date, fmt) => {
  if (!date) {
    date = new Date();
  }
  let o = {
    "M+": date.getMonth() + 1, //月份
    "d+": date.getDate(), //日
    "h+": date.getHours(), //小时
    "m+": date.getMinutes(), //分
    "s+": date.getSeconds(), //秒
    "q+": Math.floor((date.getMonth() + 3) / 3), //季度
    S: date.getMilliseconds(), //毫秒  1-3 位  只能一位占位符
    "U+": date.getMilliseconds() //毫秒   可以1-3位占位符
  };
  fmt = fmt || "yyyy-MM-dd hh:mm";
  if (/(y+)/.test(fmt))
    fmt = fmt.replace(
      RegExp.$1,
      (date.getFullYear() + "").substr(4 - RegExp.$1.length)
    );
  for (let k in o)
    if (new RegExp("(" + k + ")").test(fmt))
      fmt = fmt.replace(
        RegExp.$1,
        RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)
      );
  return fmt;
};
export const formatDate = (date, fmt) => {
if (!date) {
date = new Date()
}
let o = {
'M+': date.getMonth() + 1, //月份
'd+': date.getDate(), //日
'h+': date.getHours(), //小时
'm+': date.getMinutes(), //分
's+': date.getSeconds(), //秒
'q+': Math.floor((date.getMonth() + 3) / 3), //季度
S: date.getMilliseconds(), //毫秒  1-3 位  只能一位占位符
'U+': date.getMilliseconds() //毫秒   可以1-3位占位符
}
fmt = fmt || 'yyyy-MM-dd hh:mm'
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
for (let k in o) if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
return fmt
}
//正则表示式是干什么的? 字符串匹配利器(难,规则多)
export function formatDate2(date, fmt) {
//1.获取年份
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
}
//2.获取
//M+ ->正则表达式一个规则
......@@ -79,16 +69,16 @@ export function formatDate2(date, fmt) {
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds()
};
}
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
let str = o[k] + ''
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : padLeftZero(str))
}
}
return fmt;
};
return fmt
}
//填补左边的零(一般返回字符串最后两位)
function padLeftZero (str) {
return ('00' + str).substr(str.length);
};
function padLeftZero(str) {
return ('00' + str).substr(str.length)
}
import { Message } from 'element-ui'
let util = {}
util.cloneText = function (message) {
let input = document.createElement('input')
input.value = message
document.body.appendChild(input)
input.select()
input.setSelectionRange(0, input.value.length), document.execCommand('Copy')
document.body.removeChild(input)
Message.success('复制成功')
util.cloneText = function(message) {
let input = document.createElement('input')
input.value = message
document.body.appendChild(input)
input.select()
input.setSelectionRange(0, input.value.length), document.execCommand('Copy')
document.body.removeChild(input)
Message.success('复制成功')
}
util.getBeforeDate = function (sign = '-') {
let day = new Date();
let month = day.getMonth() + 1;
let date = day.getDate();
if (month < 10) month = '0' + month;
if (date < 10) date = '0' + date;
var s = day.getFullYear() + sign + month + sign + date;
return s;
util.getBeforeDate = function(sign = '-') {
let day = new Date()
let month = day.getMonth() + 1
let date = day.getDate()
if (month < 10) month = '0' + month
if (date < 10) date = '0' + date
var s = day.getFullYear() + sign + month + sign + date
return s
}
util.getBeforeMonth = function (days) {
let month = new Date().getMonth() + 1;
let year = new Date().getFullYear();
let arr = new Array();
for (let i = 0; i < days; i++) {
if (month <= 0) {
year = year - 1;
month = month + 12;
}
if (month < 10) month = '0' + month;
arr[i] = year + '年' + month + '月'
month--
util.getBeforeMonth = function(days) {
let month = new Date().getMonth() + 1
let year = new Date().getFullYear()
let arr = new Array()
for (let i = 0; i < days; i++) {
if (month <= 0) {
year = year - 1
month = month + 12
}
return arr;
if (month < 10) month = '0' + month
arr[i] = year + '年' + month + '月'
month--
}
return arr
}
/**
* 格式化时间
* @param {Array} time
*/
util.formatTime = function (time) {
return {
startTime: time ? time[0] + ' ' + '00:00:00' : '',
endTime: time ? time[1] + ' ' + '23:59:59' : ''
}
util.formatTime = function(time) {
return {
startTime: time ? time[0] + ' ' + '00:00:00' : '',
endTime: time ? time[1] + ' ' + '23:59:59' : ''
}
}
util.tringToDate = function (dateStr, separator) {
if (!separator) {
separator = "-";
}
var dateArr = dateStr.split(separator);
var year = parseInt(dateArr[0]);
var month;
//处理月份为04这样的情况
if (dateArr[1].indexOf("0") == 0) {
month = parseInt(dateArr[1].substring(1));
} else {
month = parseInt(dateArr[1]);
}
var day = parseInt(dateArr[2]);
var date = new Date(year, month - 1, day);
return date;
util.tringToDate = function(dateStr, separator) {
if (!separator) {
separator = '-'
}
var dateArr = dateStr.split(separator)
var year = parseInt(dateArr[0])
var month
//处理月份为04这样的情况
if (dateArr[1].indexOf('0') == 0) {
month = parseInt(dateArr[1].substring(1))
} else {
month = parseInt(dateArr[1])
}
var day = parseInt(dateArr[2])
var date = new Date(year, month - 1, day)
return date
}
util.getDay = function (num, str = '-') {
var today = new Date();
var nowTime = today.getTime();
var ms = 24 * 3600 * 1000 * num;
today.setTime(parseInt(nowTime + ms));
var oYear = today.getFullYear();
var oMoth = (today.getMonth() + 1).toString();
if (oMoth.length <= 1) oMoth = '0' + oMoth;
var oDay = today.getDate().toString();
if (oDay.length <= 1) oDay = '0' + oDay;
return oYear + str + oMoth + str + oDay;
util.getDay = function(num, str = '-') {
var today = new Date()
var nowTime = today.getTime()
var ms = 24 * 3600 * 1000 * num
today.setTime(parseInt(nowTime + ms))
var oYear = today.getFullYear()
var oMoth = (today.getMonth() + 1).toString()
if (oMoth.length <= 1) oMoth = '0' + oMoth
var oDay = today.getDate().toString()
if (oDay.length <= 1) oDay = '0' + oDay
return oYear + str + oMoth + str + oDay
}
util.openUrl = function (url) {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
link.rel = 'opener'
link.click()
util.openUrl = function(url) {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
link.rel = 'opener'
link.click()
}
util.debounce = function(fn, timer) {
var t = null
return function() {
if (t) {
clearTimeout(t)
}
t = setTimeout(() => {
fn.apply(this, arguments)
}, timer)
}
}
util.downloadIamge = function (imgsrc, name = new Date().getTime()) {
//下载图片地址和图片名
var image = new Image();
// 解决跨域 Canvas 污染问题
image.setAttribute("crossOrigin", "anonymous");
image.onload = function () {
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
var context = canvas.getContext("2d");
context.drawImage(image, 0, 0, image.width, image.height);
var url = canvas.toDataURL("image/png"); //得到图片的base64编码数据
util.downloadIamge = function(imgsrc, name = new Date().getTime()) {
//下载图片地址和图片名
var image = new Image()
// 解决跨域 Canvas 污染问题
image.setAttribute('crossOrigin', 'anonymous')
image.onload = function() {
var canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
var context = canvas.getContext('2d')
context.drawImage(image, 0, 0, image.width, image.height)
var url = canvas.toDataURL('image/png') //得到图片的base64编码数据
var a = document.createElement("a"); // 生成一个a元素
var event = new MouseEvent("click"); // 创建一个单击事件
a.download = name || "photo"; // 设置图片名称
a.href = url; // 将生成的URL设置为a.href属性
a.dispatchEvent(event); // 触发a的单击事件
};
image.src = imgsrc;
var a = document.createElement('a') // 生成一个a元素
var event = new MouseEvent('click') // 创建一个单击事件
a.download = name || 'photo' // 设置图片名称
a.href = url // 将生成的URL设置为a.href属性
a.dispatchEvent(event) // 触发a的单击事件
}
image.src = imgsrc
}
export default util
\ No newline at end of file
export default util
......@@ -13,6 +13,7 @@
<div class="back color-58 font-14" @click="goBack">返回人群管理</div>
</div>
<div class="main-container">
<GLCombiForm ref="formSearch" :formObj="tableSearchForm" :formData="tagsPartFormList" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="main-container-head flex-between">
<div class="main-container-head-title color-3 font-20">
全部客户
......@@ -56,6 +57,9 @@
</span>
</div>
</div>
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="goDetail(scope.scope)" class="blue-text">详情</el-button>
</div>
</GLTable>
</div>
</div>
......@@ -63,6 +67,7 @@
<script>
import { getCustomerList, getcrowdManageList, customerClusterListExport } from '@/api/modules/clientDataOverview'
import { getStaffList } from '@/api/modules/clientManage'
import url from '@/assets/empty.png'
export default {
name: 'group',
......@@ -70,7 +75,58 @@ export default {
return {
getListApi: this.$route.params.crowdType ? getcrowdManageList : getCustomerList,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableSearchForm: {},
tableSearchForm: {
customerPhone: '',
nickName: '',
customerName: '',
followStaff: '',
audi: '',
carNumber: '',
isJoin: ''
},
tagsPartFormList: [
{
type: 'select',
name: 'followStaff',
optionId: 'value',
optionLabel: 'label',
optionList: [],
label: '跟进员工'
},
{
type: 'input',
name: 'customerPhone',
label: '联系电话'
},
{
type: 'input',
name: 'nickName',
label: '企微名称'
},
{
type: 'input',
name: 'customerName',
label: '客户名称'
},
{
type: 'select',
name: 'isJoin',
label: '是否加企微',
optionId: 'value',
optionLabel: 'label',
placeholder: '请选择',
optionList: [
{
value: '1',
label: '是'
},
{
value: '0',
label: '否'
}
]
}
],
crowdForm: {},
id: this.$route.params.id ? this.$route.params.id : '',
crowdType: this.$route.params.crowdType ? this.$route.params.crowdType : '',
......@@ -102,7 +158,7 @@ export default {
minWidth: 120
},
{
label: '车架号(后6位)',
label: '车架号',
prop: 'carVin',
minWidth: 140
},
......@@ -123,9 +179,21 @@ export default {
width: 130
},
{
label: '购车时间',
prop: 'addTime',
width: 110
},
{
label: '添加时间',
prop: 'addTime',
width: 150
width: 110
},
{
label: '操作',
prop: 'optionBtns',
width: '100px',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
......@@ -137,7 +205,42 @@ export default {
let { id } = this
this.init(id)
},
mounted() {
this.getStaffList()
},
methods: {
//获取跟进员工
getStaffList() {
getStaffList({}).then(res => {
if (res.length == 0) {
return ''
}
const id = this.tagsPartFormList.findIndex(item => {
return item.name == 'followStaff'
})
const staff = res.map(item => {
return {
label: item.staffName,
value: item.staffName
}
})
staff.unshift({ label: '全部', value: '' })
this.$nextTick(() => {
this.tagsPartFormList[id].optionList = staff
})
console.log(this.tagsPartFormList[id])
})
},
handleSearch() {
this.$refs.groupRef.refreshTable()
},
handleReset() {
this.tableSearchForm = {
crowdId: this.id
}
this.$refs.groupRef.refreshTable()
},
init(id) {
this.tableSearchForm = {
crowdId: id
......@@ -148,6 +251,9 @@ export default {
}
// this.getTotalCount()
},
goDetail(scope) {
this.$router.push('/clientManage/clientDetail?id=' + scope.oneId)
},
getCrowdDetails() {
let params = {
'req.crowdId': this.id
......
......@@ -52,10 +52,10 @@
</div>
</div>
<template v-if="currentIndex == 0">
<client ref="childComp" :url="url" @goDetail="goDetail" ></client>
<client ref="childComp" :url="url" @goDetail="goDetail"></client>
</template>
<template v-if="currentIndex == 1">
<follow-employee ref="childComp" :url="url" ></follow-employee>
<follow-employee ref="childComp" :url="url"></follow-employee>
</template>
<template v-if="currentIndex == 2">
<leave-group-client ref="childComp" :url="url" @goDetail="goDetail"></leave-group-client>
......@@ -147,16 +147,16 @@ export default {
this.currentIndex = index
},
async getTableDetail(id = this.$route.query.id) {
const res = await getTableDetail({ id: id,pageNum:1,pageSize:10 })
const res = await getTableDetail({ id: id, pageNum: 1, pageSize: 10 })
console.log('获取客户群数据', res)
if (!res) {
return false
}
this.leftPanelList = res
this.$set(this.titles[0], 'personNum', res.allCount)
this.$set(this.titles[1], 'personNum', res.staffCount)
this.$set(this.titles[2], 'personNum', res.quitCount)
this.$set(this.titles[3], 'personNum', res.potentialCount)
this.$set(this.titles[0], 'personNum', res.allCount)
this.$set(this.titles[1], 'personNum', res.staffCount)
this.$set(this.titles[2], 'personNum', res.quitCount)
this.$set(this.titles[3], 'personNum', res.potentialCount)
},
goBack() {
......@@ -235,7 +235,7 @@ export default {
.leftWrap {
width: 240px;
// height: 877px;
min-height: 270px; //calc(100vh - 92px);
min-height: 370px; //calc(100vh - 92px);
background-color: #fff;
box-sizing: border-box;
.avator {
......@@ -344,7 +344,7 @@ export default {
}
}
}
/deep/ .el-dialog__header {
/deep/ .el-dialog__header {
border: 0;
}
/deep/ .el-dialog__body {
......
......@@ -376,7 +376,6 @@ export default {
font-weight: 600;
font-size: 16px;
}
}
/deep/ .el-button {
color: #5850ff;
......
<template>
<div class="scrm-sub-client-container">
<div class="container">
<div class="container" v-loading="loading">
<div class="leftWrap">
<div class="avatorStyle">
<div class="avator">
......@@ -46,7 +46,17 @@
</div>
<p>
<span>联系电话:</span>
<span class="ellipsis-1">{{ leftPanelInfo.customerPhone }}</span>
<span class="ellipsis-1" v-if="leftPanelInfo.customerPhone">{{ leftPanelInfo.customerPhone }}</span>
<span
class="phone-fill"
v-else
@click="
phoneVisible = true
contactPhone = ''
"
>
待完善
</span>
</p>
<p>
<span>证件号码:</span>
......@@ -225,11 +235,17 @@
<el-button type="primary" @click="goBack">返回</el-button>
</div>
</div>
<basic-dialog class="phone-fill-box" title="添加联系电话" :isVisible="phoneVisible" @confirmDialog="phoneConfirmDialog" @closeDialog="phoneVisible = false">
<div class="dialog-form">
<label>联系电话:</label>
<el-input v-model.trim="contactPhone" size="small" placeholder="请输入11位的手机号" maxlength="11"></el-input>
</div>
</basic-dialog>
<basic-dialog class="tags" :title="tagsDialogTitle" :width="'712px'" :isDestroyClose="true" :btnLoading="sloading" :isShowThirdBtn="true" :isShowCloseBtn="true" @btnEvent="goNewTag" :isVisible="tagsVisible" @confirmDialog="handleConfirm" @closeDialog="handleClose">
<slot>
<p class="hint-text color-6">
<span class="color-3">说明:</span>
仅支持企业标签
仅支持{{ '企业' | tagType }}标签
<span v-if="merchantModel == 1">和自店标签</span>
进行人工维护和设置
</p>
......@@ -263,7 +279,7 @@
</template>
<script>
import { getAllTagTree, getSingleClientTag, addSingleClientTag, getTableDetail } from '@/api/modules/clientManage'
import { getAllTagTree, getSingleClientTag, addSingleClientTag, getTableDetail, perfectCustomerPhone } from '@/api/modules/clientManage'
import tipPanel from '@/components/tipPanel/index.vue'
import url from '@/assets/clientDetail/noDataBox.png'
export default {
......@@ -273,10 +289,12 @@ export default {
},
data() {
return {
contactPhone: '',
isShowBaseInfo: true,
isShowTooltip: false,
remark: '',
sloading: false,
loading: false,
expande: false, //车辆
deviceExpande: false, //设备
guaranteeExpande: false, //保单
......@@ -536,7 +554,7 @@ export default {
label: '标签组类型',
prop: 'labelGroupInfo',
formatter: cellValue => {
return cellValue.labelGroupInfo.labelGroupType
return cellValue.labelGroupInfo.labelGroupType == '企业标签' && this.$globalState.session.merchantModel == 1 ? '集团标签' : cellValue.labelGroupInfo.labelGroupType
},
width: '160'
},
......@@ -551,7 +569,7 @@ export default {
//弹窗数据
tagsDialogTitle: '设置标签',
tagsVisible: false,
phoneVisible: false,
companyTagsList: [],
ownShopTagsList: [],
......@@ -682,8 +700,9 @@ export default {
})
},
async getPageDetail(id = this.$route.query.id) {
this.loading = true
const res = await getTableDetail({ oneId: id })
this.loading = false
if (!res) {
return false
}
......@@ -714,7 +733,7 @@ export default {
this.$router.push({ path: '/tagsManage/index' })
},
goBack() {
this.$router.push({ path: '/clientManage/index' })
this.$router.go(-1)
},
//点击添加按钮
......@@ -757,7 +776,7 @@ export default {
})
})
if (labels.labelType == '企业标签') {
allTagsList[0].labelType = '企业标签'
allTagsList[0].labelType = this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签'
allTagsList[0].children.push(labels)
} else if (labels.labelType == '自店标签') {
allTagsList[1].labelType = '自店标签'
......@@ -776,6 +795,29 @@ export default {
})
this.handleClose()
},
phoneConfirmDialog() {
if (!this.contactPhone) {
this.$message.error('请输入联系号码')
return
}
if (!/^1[3456789]\d{9}$/.test(this.contactPhone)) {
this.$message.error('联系电话不符合要求')
return
}
let param = {
pageSize: 1,
pageNum: 1,
customerPhone: this.contactPhone,
userId: this.nickNameList[0].userId
}
perfectCustomerPhone(param).then(res => {
if (res) {
this.getPageDetail()
this.$message.success('设置成功')
}
})
this.phoneVisible = false
},
handleConfirm() {
this.sloading = true
let labelIdAddList = [] // 新增的标签
......@@ -877,6 +919,22 @@ export default {
.pure-yello-text {
color: #fb8f28;
}
.phone-fill {
font-size: 14px;
font-weight: 400;
color: #5850ff !important;
line-height: 20px;
text-decoration: underline;
cursor: pointer;
}
.dialog-form {
display: flex;
align-items: center;
padding: 30px;
label {
width: 100px;
}
}
.newStyle {
display: flex;
font-size: 14px;
......
......@@ -656,7 +656,7 @@ export default {
}
},
destroyed() {
window.removeEventListener('scroll', this.initHeight)
window.removeEventListener('scroll', this.initHeight, true)
}
}
</script>
......@@ -895,7 +895,7 @@ export default {
width: 100%;
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
z-index:999;
z-index: 999;
.el-button:nth-child(2) {
margin-left: 20px;
}
......
......@@ -127,6 +127,9 @@ export default {
label: '标签组类型',
prop: 'groupType',
width: 180,
formatter: cellValue => {
return cellValue.groupType == '企业标签' && this.$globalState.session.merchantModel == 1 ? '集团标签' : cellValue.groupType
},
align: 'left'
},
{
......
<template>
<div class="content-wrap" v-loading="loading">
<div class="tree-input">
<el-input placeholder="请输入标签组或标签关键字" v-model="filterText" size="small"><i slot="suffix" class="el-input__icon el-icon-search"></i></el-input>
<span @click="resetTree">重置</span>
</div>
<el-tree @check="checkChange" class="tag-tree" ref="tagTree" :data="labelTree" :props="defaultProps" @node-click="nodeClick" show-checkbox node-key="id" default-expand-all :expand-on-click-node="false" :filter-node-method="filterNode">
<div class="custom-tree-node" slot-scope="{ node, data }">
<span :class="['tree-node', `node_${data.id}`]">{{ node.label }}</span>
<span v-if="data.labelType && data.labelType != '系统标签' && isShowEditBtn(data.labelDTO)" @click.stop="editTree(data)">
<i class="el-icon-edit-outline"></i>
</span>
</div>
</el-tree>
</div>
</template>
<script>
import { getTableList } from '@/api/modules/tagsManage'
export default {
name: 'tagGroup',
data() {
return {
loading: false,
heightBox: 200,
dialogVisible: false,
filterText: '',
selectNum: 0,
searchStatus: false,
labelTree: [],
defaultProps: {
children: 'children',
label: 'name'
}
}
},
watch: {
filterText(val) {
this.$refs.tagTree.filter(val)
}
},
methods: {
isShowEditBtn(row) {
const { userType, accountLevel, merchantModel } = this.$globalState.session
//集团模式下,只有集团能可以编辑企业,自店,其他只能编辑自店
//单店模式下,仅门店和员工可以编辑
if (row.labelType == '自店标签' && !(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))) {
return false
}
if (merchantModel == 1) {
if (accountLevel == 1 && userType == 1) {
return true
}
if (accountLevel !== 1) {
//如果是企业标签不显示
if (row.labelType == '企业标签' || row.labelType == '集团标签') {
return false
}
return true
}
}
return true //门店版都显示编辑按钮
},
nodeClick(data) {
!data.sort && document.querySelector(`.node_${data.id}`).parentElement.previousElementSibling.click()
},
handleScroll(height) {
document.querySelector('.tag-tree').scrollTop = height
},
resetTree() {
this.$refs.tagTree.setCheckedKeys([])
this.$nextTick(() => {
this.$emit('getCheckItem', this.$refs.tagTree)
})
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
//勾选
checkChange() {
this.$emit('getCheckItem', this.$refs.tagTree)
},
getTreeNode(item) {
let tree_id = []
item.forEach(group_item => {
group_item.children.forEach(label_item => {
label_item && tree_id.push(label_item.id)
})
})
this.$refs.tagTree.setCheckedKeys(tree_id)
},
editTree(data) {
this.$emit('editTag', 'edit', data.labelDTO)
},
updateTreeNode() {
this.getTreeNode(this.$parent.tagCheckItem)
this.$emit('getCheckItem', this.$refs.tagTree)
},
// 获取标签树
getTableList(status) {
this.labelTree = []
let params = {
labelTreeReq: {
pageNum: 1,
pageSize: 1000,
shopId: this.$globalState.session.merchantId,
labelGroupName: this.filterText,
edition: this.$globalState.session.merchantModel
}
}
this.loading = true
getTableList(params).then(res => {
const labelTreeRets = res.labelTreeRets.map(item => {
return {
id: item.labelGroup.id,
name: item.labelGroup.name,
children: item.labelList,
labelType: item.labelType == '企业标签' && this.$globalState.session.merchantModel == 1 ? '集团标签' : item.labelType,
labelDTO: item
}
})
const labelType = this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签'
labelTreeRets.forEach(item => {
const index = this.labelTree.findIndex(ret => ret.name == item.labelType)
if (index == -1) {
this.labelTree.push({
id: item.labelType == '系统标签' ? 1 : item.labelType == labelType ? 2 : 3,
name: item.labelType,
children: [item],
sort: item.labelType == '系统标签' ? 1 : item.labelType == labelType ? 2 : 3
})
} else {
this.labelTree[index].children.push(item)
}
})
this.labelTree = this.labelTree.sort((a, b) => a.sort - b.sort)
this.$nextTick(() => {
status && this.updateTreeNode()
})
this.loading = false
})
}
},
mounted() {
this.getTableList()
}
}
</script>
<style lang="scss" scoped>
.content-wrap {
padding: 16px 10px 16px 16px;
box-sizing: border-box;
height: 100%;
.tree-input {
display: flex;
align-items: center;
span {
display: inline-block;
color: #5850ff;
font-size: 14px;
width: 40px;
margin-left: 6px;
cursor: pointer;
}
}
.tag-tree {
margin-top: 20px;
height: calc(100% - 80px);
overflow-y: auto;
/deep/ {
.el-tree-node {
.el-tree-node__content {
height: 30px;
> .el-checkbox {
display: none;
}
}
}
.el-tree-node__children {
.el-tree-node__content {
.el-checkbox {
display: block;
}
}
}
.custom-tree-node {
font-size: 14px;
color: #333;
}
.tree-node {
width: 140px;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.el-tree-node__expand-icon {
font-size: 15px;
margin-top: -2px;
color: #000000;
}
.el-tree-node__expand-icon.is-leaf {
color: transparent;
}
.el-checkbox__inner {
margin-right: 10px;
}
.el-icon-edit-outline {
color: #5850ff;
font-size: 15px;
cursor: pointer;
}
}
}
}
</style>
......@@ -8,13 +8,14 @@
<span>
共有{{ numberObj.groupCount || 0 }}个标签组
<!-- v-if="!(merchantModel == 1 && accountLevel == 4)" -->
<template>,{{ numberObj.bizLabelCount || 0 }}个企业标签</template>
<template>,{{ numberObj.bizLabelCount || 0 }}个{{ '企业' | tagType }}标签</template>
<template v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">,{{ numberObj.rcLabelCount || 0 }}个自店标签</template>
<template>,{{ numberObj.traLabelCount || 0 }}个系统标签</template>
</span>
<span class="iconPanelWrap" v-if="!isFirstShow">
<el-popover placement="top" width="666" trigger="hover">
<!-- v-if="!(merchantModel == 1 && accountLevel == 4)" -->
<div>企业标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;</div>
<div>{{ '企业' | tagType }}标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;</div>
<div v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">自店标签为企业商户自有标签,员工可在企微APP端客户跟进等模块查看和打标签,最多3000个;</div>
<div>系统标签为通过大数据算法规则生成的标签</div>
<img src="@/assets/tagsManage/question.png" slot="reference" alt="" />
......@@ -22,58 +23,142 @@
</span>
</span>
<div class="initPanel" v-if="isFirstShow">
<template>企业标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;</template>
<template>{{ '企业' | tagType }}标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;</template>
<template v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">自店标签为企业商户自有标签,员工可在企微APP端客户跟进等模块查看和打标签,最多3000个;</template>
系统标签为通过大数据算法规则生成的标签
<img src="@/assets/tagsManage/Shape.png" alt="" />
<i class="el-icon-close" @click="closeInitPanel"></i>
</div>
<div class="pageContent">
<!-- <search-form class="searchTop border-shadow" :formModel="searchForm" :formList="tagsPartFormList" @setTableHeightEvent="setTableHeightEvent" labelWidth="54px">
<span class="inline-b" slot="form-slot">
<el-button @click="resetTable" plain>重置</el-button>
<el-button type="primary" @click="searchTable">查询</el-button>
</span>
</search-form> -->
<GLCombiForm :formObj="searchForm" :formData="tagsPartFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
<!-- noDataText="你当前还没有添加的标签" -->
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="tagsManage" :hasNum="false" :getListApi="getListApi" :searchForm="searchForm" :pageConf="pageConf" :noDataImg="url" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }">
<span slot="labelGroup" slot-scope="scope">
<span>{{ scope.scope.labelGroup.name }}</span>
</span>
<span slot="labelList" slot-scope="scope">
<!-- :class="[expande ? 'expande' : 'close']" -->
<div id="allTagsWrap" class="allTagsWrap">
<span v-for="(item, index) in showTagArray(scope.scope.labelList)" :key="index" class="ellipsis-1 tag-box-wrap">
<el-tooltip class="item" :content="item.name" placement="top">
<span>{{ item.name }}</span>
</el-tooltip>
</span>
<el-popover v-if="scope.scope.labelList.length > 9" class="ellipsis-1 tag-box-wrap" placement="top" width="800" trigger="hover" content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
<span slot="reference">...({{ scope.scope.labelList.length }})</span>
<div class="entmicro-hover" style="height: 214px; overflow-y: auto">
<el-tag type="info" class="ellipsis-1" style="margin-right: 10px; margin-bottom: 10px; max-width: 200px" v-for="(i, sindex) in scope.scope.labelList" :key="sindex" :disable-transitions="false">
<el-tooltip class="item" :content="i.name" placement="top">
<span>{{ i.name }}</span>
</el-tooltip>
</el-tag>
</div>
</el-popover>
<div class="client-main-box">
<div class="client-tag" :style="{ height: heightBox + 'px' }">
<tag-group @getCheckItem="getCheckItem" ref="tagTree" @editTag="btnClick"></tag-group>
</div>
<div class="client-tabel">
<div class="client-title-panel">
<div class="client-tabel-title">
<div class="client-tabel-label">
已选标签
<span @click="dialogRuleVisible = true">人群规则说明</span>
</div>
<div class="client-expand" v-if="!tagHeight && tagCheckItem.length">
<el-button type="text" size="small" @click="tagHeight = 180">
<span>展开</span>
<i class="expand el-icon-arrow-down"></i>
</el-button>
</div>
</div>
<div class="select-tag-panel" :style="{ 'max-height': tagHeight + 'px', 'margin-top': tagHeight ? '10px' : '0px' }">
<el-tag effect="plain" slot="reference" type="info" class="select-tagGroup" v-for="(item, idx) in tagCheckItem" :key="idx" closable :disable-transitions="false" @click="treeScroll(item.id)" @close="removeItem(idx)">
<label>{{ item.name }}:</label>
<template v-for="(tag, index) in item.children">
<div class="select-tagLabel" :key="index" v-if="tag && index < 3">{{ tag.name }}</div>
</template>
<el-popover placement="top" trigger="hover" class="select-popover-tag">
<div class="select-popover-box">
<template v-for="(tag, index) in item.children">
<div class="select-tagLabel" :key="index" v-if="tag">{{ tag.name }}</div>
</template>
</div>
<div class="select-tagLabel" slot="reference" v-if="item.children.length > 3">+ {{ item.children.length - 3 }}</div>
</el-popover>
</el-tag>
</div>
<div class="client-expand" v-if="tagHeightStatus">
<el-button type="text" size="small" @click="tagHeight = 0">
<span>收起</span>
<i class="expand el-icon-arrow-up"></i>
</el-button>
</div>
</div>
<div class="pageContent">
<GLCombiForm ref="formSearch" :formObj="searchForm" :formData="tagsPartFormList" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="clientNumExp">
<div class="clientNum">
<!-- {{ labelGroupName }} -->
<!-- <div class="clientListNew">标签组客户列表</div>
<div class="clientNumText">{{ tableTotal }}个</div> -->
<div class="clientListNew">客户列表({{ tableTotal }}人)</div>
</div>
<div>
<el-button class="export" size="small" type="primary" @click="handleExport">导出</el-button>
<el-button
plain
size="small"
:disabled="tagCheckItem.length == 0"
@click="
groupVisible = true
crowdForm = {
crowdName: '',
crowdDesc: ''
}
"
>
保存为人群
</el-button>
</div>
</div>
</span>
<template slot="xxx" slot-scope="scope">
<!-- //这版关掉自店标签 1.0.1允许集团的门店打字店标签,也可以编辑-->
<!-- v-if="scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)" -->
<span @click="btnClick('edit', scope.scope)" v-if="scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)" class="blue-text">编辑标签组</span>
<GLButton class="blue-text leftDistance" type="text" fn="查看客户" v-if="userType !== 2" @click="toViewCustomer(scope.scope)">查看客户</GLButton>
</template>
</GLTable>
<!-- noDataText="你当前还没有添加的标签" -->
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="viewCustomers" :layout="layout" :hasNum="true" :tableData="tableData" :tableTotal="tableTotal" :noDataImg="url" :pageConf="pageConf" @refreshTable="getCustomersListData" :tableParams="tableParams">
<!-- 企微名称 -->
<div slot="nickNameList" slot-scope="scope" class="expandImg">
<div v-for="(list, idx) in scope.scope.nickNameList" :key="idx">
<div v-if="idx == 0">
<span>{{ list.nickName }}</span>
<span class="smallFontSize" :class="[list.type == 1 ? 'pure-green-text' : '', list.type == 2 ? 'pure-yello-text' : '']">@{{ list.corpName }}</span>
</div>
<span v-if="idx == 1">
<el-popover placement="right-start" trigger="hover">
<div v-for="(i, index) in scope.scope.nickNameList" style="padding-bottom:3px !important" :key="index">
<span>{{ i.nickName }}</span>
<span style="height: 20px; font-size: 12px; letter-spacing: 0; line-height: 20px; font-weight: 400;margin-left:2px" :class="[i.type == 1 ? 'pure-green-text' : '', i.type == 2 ? 'pure-yello-text' : '']">@{{ i.corpName }}</span>
</div>
<img class="imgEll" src="@/assets/tagsManage/ellipsis.png" alt="" slot="reference" />
</el-popover>
</span>
</div>
</div>
<span slot="status" slot-scope="scope">
<span class="statusText" :class="scope.scope.status ? CLIENTSTATUS[scope.scope.status].split(',')[1] : ''">{{ scope.scope.status ? CLIENTSTATUS[scope.scope.status].split(',')[0] : '--' }}</span>
</span>
<span slot="isJoin" slot-scope="scope">
<span>{{ scope.scope.isJoin ? '是' : '否' }}</span>
</span>
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="goDetail(scope.scope)" class="blue-text">详情</el-button>
</div>
</GLTable>
</div>
</div>
</div>
<el-dialog title="人群规则说明" class="crowd-dialog" width="720px" :before-close="handleRuleClose" :visible.sync="dialogRuleVisible" :show-close="isShowCloseBtn">
<div class="crowd-dialog-wrap color-3">
<div class="condition font-14">
<b>说明:</b>
<br />
<span>
标签组内已选标签取
<b>并集(或)</b>
,即满足一个条件即可、标签组之间取
<b>交集(且)</b>
,即同时满足标签组条件。
</span>
</div>
<div class="flex-between">
<div class="static-image">
<img src="@/assets/crowdManage/sum.png" alt="" />
</div>
<div class="static-image">
<img src="@/assets/crowdManage/intersection.png" alt="" />
</div>
</div>
</div>
</el-dialog>
<basic-dialog class="role" :title="tagDialogTitle" width="712px" :isVisible="tagVisible" @confirmDialog="handleConfirm" @closeDialog="handleClose">
<slot>
<div class="form-title">
<span>说明:</span>
此处添加的标签均为人工标签,即后续标签更新由员工更新打标签
</div>
<rule-form :ruleForm="tagForm" :rules="tagRules" :ruleData="tagDialogData" :labelWidth="'120px'" labelPosition="right" ref="tagForm">
<div slot="tagsGroup-type">
<el-select v-model="tagForm.initTagsGroup" placeholder="请选择" :disabled="tagDialogTitle != '添加标签组'" @change="handleSelect">
......@@ -81,7 +166,7 @@
</el-select>
<!-- id="tagTipMsgRef" -->
<span class="tagTipMsg" v-if="tagDialogTitle == '添加标签组' && !tagForm.initTagsGroup">
<template v-if="!(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))">企业标签</template>
<template v-if="!(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))">{{ '企业' | tagType }}标签</template>
<template v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">
<template v-if="!(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))">和</template>
自店标签分别
......@@ -89,7 +174,7 @@
最多3000个
</span>
<span class="tagTipMsg" v-if="tagDialogTitle == '添加标签组' && tagForm.initTagsGroup == 1">
企业标签已创建
{{ '企业' | tagType }}标签已创建
<span class="pure-blue-text">{{ numberObj.bizLabelCount }}</span>
个
</span>
......@@ -98,15 +183,17 @@
<span class="pure-blue-text">{{ numberObj.rcLabelCount }}</span>
个
</span>
<span class="tagTipMsg" v-if="tagDialogTitle == '编辑标签组'">
{{ tagForm.initTagsGroup == 1 ? '企业标签' : '自店标签' }}最多3000个,已创建
{{ tagForm.initTagsGroup == 1 ? (this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签') : '自店标签' }}最多3000个,已创建
<span class="pure-blue-text">{{ tagForm.initTagsGroup == 1 ? numberObj.bizLabelCount : numberObj.rcLabelCount }}</span>
个
</span>
<!-- 企业标签最多3000个,已创建3个 -->
<!-- 自店标签最多3000个,已创建3个 -->
</div>
<div slot="modeType">
<el-input v-model.trim="tagForm.mode" disabled style="width:190px"></el-input>
</div>
<div slot="tagsInput-type">
<div class="tagsWrap" v-if="tagDialogTitle == '编辑标签组'">
<span class="tag" :class="{ inputWrapShow: item.inputVisible }" v-for="item in editTagList" :key="item.id">
......@@ -118,7 +205,6 @@
<img class="editIcon" src="@/assets/tagsManage/edit.png" @click="showInput(item.id)" alt="" v-show="!item.inputVisible" />
</span>
</div>
<div class="row-tag" v-for="(item, index) in tagForm.tagsList" :key="index">
<!-- :onkeyup="(item.name = item.name.replace(/\s+/g, ''))" maxlength="30" show-word-limit @input="checkInputContent"-->
<el-input v-model.trim="item.name" placeholder="添加标签名称(至少添加一个标签)" @keyup.native="item.name = checkInputContent(item.name)"></el-input>
......@@ -143,17 +229,46 @@
</rule-form>
</slot>
</basic-dialog>
<basic-dialog class="group-box" title="保存为人群" :isVisible="groupVisible" @confirmDialog="groupConfirmDialog" @closeDialog="groupVisible = false">
<div class="dialog-form">
<div class="dialog-form-item">
<label>
<span style="color: #ff0000">*</span>
人群名称:
</label>
<el-input v-model.trim="crowdForm.crowdName" size="small" placeholder="请输入人群名称:" maxlength="30"></el-input>
</div>
<div class="form-tips">
最多30个字符
<span>{{ crowdForm.crowdName.length }}/30</span>
</div>
</div>
<div class="dialog-form">
<div class="dialog-form-item">
<label>人群描述:</label>
<el-input v-model.trim="crowdForm.crowdDesc" size="small" placeholder="请输入人群描述" maxlength="100"></el-input>
</div>
<div class="form-tips">
最多100个字符
<span>{{ crowdForm.crowdDesc.length }}/100</span>
</div>
</div>
</basic-dialog>
<div class="loading-containner" v-if="userLoading">
<div class="loading-box">客户列表加载中</div>
</div>
</div>
</template>
<script>
import { getTableList, getTableTagNum, newAddTag, updateTag, queryLabelListByGroupId } from '@/api/modules/tagsManage'
import { getTableTagNum, newAddTag, updateTag } from '@/api/modules/tagsManage'
import { getLoginCount } from '@/api/modules/loginCount'
import tagGroup from './components/tagGroup.vue'
import url from '@/assets/clientDataOverview/nodata.png'
// import { debounce } from '@/utils/index'
import tag from '@/mixins/tag'
import util from '@/utils/util'
export default {
mixins: [tag],
name: 'tagsManage',
data() {
//这里就是整个checkName啦,就是方法一的使用
var checkName = (rule, value, callback) => {
......@@ -177,7 +292,6 @@ export default {
}
var checkTagsInput = (rule, value, callBack) => {
console.log('value值为:', value, typeof value, value.length)
if (value && value.length == 0) {
return callBack(new Error('请添加标签'))
} else {
......@@ -185,6 +299,10 @@ export default {
}
}
return {
userLoading: false,
dialogRuleVisible: false,
expand: false,
heightBox: 0,
isReload: true,
isAllowCloseDialog: false,
isHasSameTag: false,
......@@ -192,67 +310,135 @@ export default {
numberObj: {},
url: url,
isFirstShow: false,
searchForm: {},
searchForm: {
customerPhone: '',
nickName: '',
customerName: '',
followStaff: '',
audi: '',
carNumber: '',
isJoin: ''
},
tagsPartFormList: [
{
type: 'select',
name: 'labelTreeReq.labelTypesStr',
label: '标签组',
optionLabel: 'label',
name: 'followStaff',
optionId: 'value',
placeholder: '请选择标签组类型',
optionList: this.$Constants.LABEL_OPTION
optionLabel: 'label',
optionList: [],
label: '跟进员工'
},
{
type: 'input',
name: 'customerPhone',
label: '联系电话'
},
{
type: 'input',
name: 'nickName',
label: '企微名称'
},
{
type: 'input',
inputType: 'text',
name: 'labelTreeReq.labelGroupName',
label: '搜索',
placeholder: '请输入标签组或标签名称',
clearable: true
name: 'customerName',
label: '客户名称'
},
{
type: 'select',
name: 'isJoin',
label: '是否加企微',
optionId: 'value',
optionLabel: 'label',
placeholder: '请选择',
optionList: [
{
value: '1',
label: '是'
},
{
value: '0',
label: '否'
}
]
}
],
pageConf: { pageSize: 'labelTreeReq.pageSize', pageNum: 'labelTreeReq.pageNum', totalCount: 'labelGroupCount' },
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableTotal: 0,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'labelTreeRets',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data',
tableColumns: [
{
label: '标签组',
prop: 'labelGroup',
addHtml: 'labelGroup',
width: 230
label: '客户姓名',
prop: 'customerName',
minWidth: 150
},
{
label: '企微名称',
prop: 'nickNameList',
addHtml: 'nickNameList',
minWidth: 200
},
{
label: '联系电话',
prop: 'customerPhone',
minWidth: 110
},
{
label: '车牌号',
prop: 'carNumber',
width: 90
},
{
label: '车架号',
prop: 'carVin',
minWidth: '110'
},
{
label: '车系',
prop: 'audi'
// width: 160
},
{
label: '跟进员工',
prop: 'followStaff',
minWidth: 120
},
{
label: '标签组类型',
prop: 'labelType',
width: 180
label: '是否加企微',
prop: 'isJoin',
addHtml: 'isJoin',
minWidth: 90
},
{
label: '标签',
prop: 'labelList',
addHtml: 'labelList',
minWidth:200
label: '购车时间',
prop: 'addTime',
minWidth: 140
},
{
label: '添加时间',
prop: 'addTime',
minWidth: 140
},
{
label: '操作',
prop: 'xxx',
fixed: 'right',
addHtml: 'xxx',
width: 180
prop: 'optionBtns',
width: '80px',
addHtml: 'optionBtns',
fixed: 'right'
}
]
// tableOption: {
// width: 120
// }
},
getListApi: getTableList,
tableData: [],
// 弹窗数据
tagDialogTitle: '添加标签组',
tagVisible: false,
groupVisible: false,
tagForm: {
tagsName: '',
initTagsGroup: 1,
mode: '人工',
tagsList: []
},
tagDialogData: [
......@@ -272,7 +458,12 @@ export default {
type: 'customize',
slotName: 'tagsGroup-type'
},
{
label: '更新方式',
prop: 'initTagsGroup',
type: 'customize',
slotName: 'modeType'
},
{
label: '标签',
prop: 'tagsList',
......@@ -293,11 +484,11 @@ export default {
// tagsList: [{ required: true }]
},
tagsGroupList: [
{ id: 1, name: '企业标签' },
{ id: 1, name: this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签' },
{ id: 2, name: '自店标签' }
],
modeList: [{ id: 1, name: '人工' }],
//编辑便签输入的值
editTagList: [],
tagGroupId: 0, //标签组id,编辑提交接口要用
//控制展开收起按钮
......@@ -309,7 +500,14 @@ export default {
userType: 0 //1是商户,2是员工
}
},
computed: {},
components: {
tagGroup
},
computed: {
classIcon() {
return !this.expand ? 'el-icon-arrow-down' : 'el-icon-arrow-up'
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
......@@ -328,7 +526,6 @@ export default {
// this.tagsPartFormList[0].options.splice(0, 1)
}
}
if (this.merchantModel == 1) {
if (this.accountLevel == 1) {
//集团下的工厂只能创建企微标签,自店标签不要了
......@@ -350,6 +547,8 @@ export default {
this.getTableTagNumFun()
},
mounted() {
let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 150
//没数据的时候要算高度
// setTimeout(() => {
// if (!this.$refs.tagsManage.data.length) {
......@@ -380,11 +579,12 @@ export default {
// return list
return list.slice(0, 9)
},
checkInputContent(e) {
checkInputContent: function(e) {
console.log(e)
//确保每个输入框的内容不和已存在的编辑标签相同
let isHasSameTag = this.editTagList.some(ele => ele.name == e)
if (isHasSameTag) {
this.$message.error('不允许输入已存在的标签')
// this.$message.error('不允许输入已存在的标签')
return e
}
return this.$Utils.cutMaxCharStr(e)
......@@ -401,7 +601,7 @@ export default {
}
if (this.accountLevel !== 1) {
//如果是企业标签不显示
if (row.labelType == '企业标签') {
if (row.labelType == '企业标签' || row.labelType == '集团标签') {
return false
}
return true
......@@ -409,7 +609,6 @@ export default {
}
return true //门店版都显示编辑按钮
},
expandeClick() {
// console.log('expandeClick')
this.expande = !this.expande
......@@ -420,10 +619,6 @@ export default {
setTableHeightEvent() {
this.$refs.tagsManage.setTableHeightFun()
},
setTableFinishFun(content) {
console.log('表格完成', this.$refs.tagsManage.data)
this.$refs.tagsManage.data.length ? (this.$refs.tagsManage.tableHeightValues = '') : this.$refs.tagsManage.setTableHeightFun()
},
getLoginCountFun() {
//loginType:3是查客户数据概览浏览次数
getLoginCount({ loginType: 3 }).then(res => {
......@@ -439,21 +634,15 @@ export default {
this.numberObj = res
})
},
//搜索表格
searchTable() {
this.$refs.tagsManage.refreshTable()
handleSearch() {
this.getCustomersListData()
},
//重置表格
resetTable() {
// this.isReload = false
this.searchForm = { 'labelTreeReq.shopId': this.merchantId, 'labelTreeReq.edition': this.merchantModel }
this.$refs.tagsManage.refreshTable()
// this.$nextTick(() => {
// this.isReload = true
// })
handleReset() {
this.getCustomersListData()
this.searchForm = {}
},
btnClick(pType, rowData) {
console.log(pType, rowData, 'btnClick')
switch (pType) {
......@@ -464,16 +653,13 @@ export default {
if (this.merchantModel == 1 && (this.accountLevel == 2 || this.accountLevel == 3 || this.accountLevel == 4)) {
this.tagForm.initTagsGroup = 2
}
this.$set(this.tagDialogData[0], 'disabled', false)
this.handleClose()
break
case 'edit':
this.tagDialogTitle = '编辑标签组'
this.$set(this.tagDialogData[0], 'disabled', true)
this.editEvent(rowData)
break
}
},
......@@ -496,14 +682,11 @@ export default {
this.editTagList = rowData.labelList.map(item => {
return { ...item, inputVisible: false }
})
this.tagGroupId = rowData.labelGroup.id //标签组id
this.tagForm.tagsName = rowData.labelGroup.name //标签组名
this.tagForm.initTagsGroup = rowData.labelType == '企业标签' ? 1 : rowData.labelType == '自店标签' ? 2 : '' //标签组类型
this.tagForm.initTagsGroup = rowData.labelType == '企业标签' || rowData.labelType == '集团标签' ? 1 : rowData.labelType == '自店标签' ? 2 : '' //标签组类型
},
handleConfirm() {
console.log(this.$refs.tagForm.$children, 'kkk')
this.$refs.tagForm.$children[0].validate(valid => {
if (!valid) {
if (this.tagForm.tagsList.length <= 0 && this.tagDialogTitle == '添加标签组') {
......@@ -525,7 +708,6 @@ export default {
this.$message.error('不能提交空标签')
return
}
//如果存在添加标签的输入框的内容的标签相同则不提交
let isSameTagFlag = false
var tempArr = this.tagForm.tagsList.map(item => item.name)
......@@ -534,7 +716,6 @@ export default {
this.$message.error('不能提交相同的标签,请修改')
return
}
this.newAddTagFun()
//this.handleClose() //这里不管
} else {
......@@ -544,7 +725,6 @@ export default {
this.$message.error('不能提交空的编辑标签')
return
}
if (this.tagForm.tagsList.length > 0) {
//过滤掉没有输入值得标签输入框
this.tagForm.tagsList = this.tagForm.tagsList.filter(item => item.name != '')
......@@ -568,6 +748,9 @@ export default {
}
})
},
handleRuleClose() {
this.dialogRuleVisible = false
},
handleClose() {
this.tagNameRules = false
if (!this.tagVisible && this.$refs.tagForm) {
......@@ -581,9 +764,7 @@ export default {
// console.log(this.tagForm, '内')
}
// console.log(this.tagForm, '外')
this.tagForm.tagsList = [] //取消时清空新增标签
this.tagVisible = !this.tagVisible
},
newAddTagFun() {
......@@ -592,13 +773,11 @@ export default {
params['labelDTO.dataFrom'] = 'cs'
params['labelDTO.shopId'] = this.merchantId
params['labelDTO.edition'] = this.merchantModel
// params.staffId = '员工A'
params['labelDTO.labelGroup.name'] = this.tagForm.tagsName
params['labelDTO.labelType'] = this.tagForm.initTagsGroup == 1 ? '企业标签' : '自店标签'
params['labelDTO.labelType'] = this.tagForm.initTagsGroup == 1 ? (this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签') : '自店标签'
params['labelDTO.labelList'] = this.tagForm.tagsList
params['labelDTO.isAddLabelGroupEnter'] = this.tagDialogTitle == '添加标签组' ? true : false
console.log(params)
newAddTag(params).then(res => {
if (!res) {
......@@ -625,7 +804,7 @@ export default {
}
this.handleClose()
}
this.resetTable() //刷新下表格
this.$refs.tagTree.getTableList(true) //刷新下表格
this.getTableTagNumFun()
})
},
......@@ -633,10 +812,9 @@ export default {
let param = {}
param['labelDTO.dataFrom'] = 'cs'
param['labelDTO.edition'] = this.merchantModel
param['labelDTO.labelGroup.id'] = this.tagGroupId
param['labelDTO.labelGroup.name'] = this.tagForm.tagsName
param['labelDTO.labelType'] = this.tagForm.initTagsGroup == 1 ? '企业标签' : '自店标签'
param['labelDTO.labelType'] = this.tagForm.initTagsGroup == 1 ? (this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签') : '自店标签'
param['labelDTO.shopId'] = this.merchantId
let editTagList = this.editTagList.map(item => {
return {
......@@ -644,20 +822,16 @@ export default {
name: item.name
}
})
param['labelDTO.labelList'] = editTagList
updateTag(param).then(res => {
if (!res) {
return
}
this.$message.success('修改成功')
// this.tagForm.tagsName = ''
// this.tagForm.initTagsGroup = ''
// this.tagForm.tagsList = []
this.resetTable() //刷新下表格
this.$refs.tagTree.getTableList(true) //刷新下表格
})
},
//删除一行标签
......@@ -667,7 +841,6 @@ export default {
//添加一行标签
addRow(type) {
this.tagNameRules = false
if (type == 1 && this.numberObj.bizLabelCount >= 3000) {
this.$message.error('企业标签数量已达上限')
return
......@@ -690,7 +863,6 @@ export default {
this.$refs.saveTagInput[0].focus()
})
},
handleInputConfirm(inputValue, id) {
this.editTagList.forEach(i => {
if (i.id == id) {
......@@ -714,13 +886,105 @@ export default {
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
.loading-containner {
top: 0px;
left: 0px;
position: fixed;
width: 100%;
background: rgba(255, 255, 255, 0.1);
z-index: 5000;
height: 100%;
.loading-box {
position: absolute;
top: 50%;
left: 50%;
margin-top: -28px;
margin-left: -88px;
width: 176px;
font-size: 14px;
color: #ffffff;
line-height: 54px;
text-align: center;
height: 54px;
background: #666666;
border-radius: 2px;
&::after {
content: '';
position: absolute;
top: 0%;
bottom: 0;
animation: dot 3s infinite steps(3, start);
color: #ffffff;
}
}
}
@keyframes dot {
33.33% {
content: '.';
}
66.67% {
content: '. .';
}
100% {
content: '. . .';
}
}
.leftDistance {
margin-left: 10px;
}
.form-title {
padding-left: 30px;
margin-bottom: 15px;
font-size: 12px;
font-weight: 400;
color: #333333;
line-height: 21px;
}
.expandImg {
display: flex;
justify-content: center;
.smallFontSize {
margin-left: 2px;
height: 20px;
font-size: 12px;
letter-spacing: 0;
line-height: 20px;
font-weight: 400;
}
.imgEll {
margin-left: 6.5px;
cursor: pointer;
// margin-bottom:3px;
}
}
.pure-green-text {
color: #61cc43;
}
.pure-yello-text {
color: #fb8f28;
}
.crowd-dialog-wrap {
.condition {
margin-bottom: 16px;
line-height: 21px;
b {
color: #666666;
}
span {
white-space: nowrap;
}
}
.static-image {
width: 335px;
height: 325px;
img {
width: 100%;
}
}
}
.scrm-sub-client-container {
/deep/.search-form .el-form-item__content {
width: auto;
......@@ -729,14 +993,12 @@ export default {
// /deep/.el-table tbody tr:hover > td {
// background-color: #f4f3ff;
// }
.pageTitle {
position: relative;
// margin-top: 30px;
margin-bottom: 20px;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
......@@ -822,6 +1084,81 @@ export default {
cursor: pointer;
}
}
.client-main-box {
display: flex;
.client-tag {
width: 260px;
margin-right: 20px;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
margin-top: 20px;
background-color: #fff;
}
.client-tabel {
flex: 1;
overflow: hidden;
.client-expand {
text-align: center;
}
.client-title-panel {
padding: 16px;
margin-top: 20px;
background-color: #fff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
}
&-title {
font-size: 16px;
font-weight: 600;
color: #333333;
line-height: 22px;
display: flex;
justify-content: space-between;
span {
font-size: 14px;
font-weight: 400;
color: #5850ff;
line-height: 20px;
cursor: pointer;
}
}
.select-tag-panel {
display: flex;
flex-wrap: wrap;
font-size: 14px;
transition: all 0.3s linear;
overflow-y: auto;
.select-tagGroup {
display: inline-block;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 4px 8px;
line-height: 24px;
margin-right: 8px;
margin-bottom: 8px;
height: 36px;
box-sizing: border-box;
/deep/ {
.el-icon-close {
right: 0px;
}
}
label {
color: #333333;
font-weight: 600;
}
}
.select-tagLabel {
display: inline-block;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 0px 8px;
line-height: 20px;
margin-right: 4px;
}
}
}
}
.pageContent {
padding: 6px 20px 30px;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
......@@ -830,11 +1167,41 @@ export default {
.el-button + .el-button {
margin-left: 10px;
}
.clientNumExp {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 14px;
padding-bottom: 20px;
letter-spacing: 1px;
.clientNum {
// display: flex;
// align-items: center;
.clientListNew {
display: flex;
align-items: center;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 600;
color: #333333;
font-size: 20px;
}
.clientNumText {
margin-left: 6px;
height: 20px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #5850ff;
line-height: 20px;
padding-top: 2px;
}
}
.export {
}
}
.allTagsWrap {
position: relative;
// display: -webkit-box;
// overflow: hidden;
// -webkit-line-clamp: 2;
// -webkit-box-orient: vertical;
......@@ -848,7 +1215,6 @@ export default {
// }
.tag-box-wrap {
display: inline-block;
margin-right: 10px;
margin-top: 5px;
margin-bottom: 5px;
......@@ -891,7 +1257,6 @@ export default {
}
}
}
.close {
overflow: hidden;
height: 65px;
......@@ -902,7 +1267,6 @@ export default {
.el-input__inner {
width: 423px;
}
::v-deep .container {
position: relative;
.tagTipMsg {
......@@ -916,7 +1280,6 @@ export default {
color: #999999;
}
}
::v-deep .el-select > .el-input--small {
width: 190px;
}
......@@ -974,7 +1337,6 @@ export default {
// z-index: 9999;
}
}
.el-input {
max-width: 200px;
}
......@@ -985,7 +1347,6 @@ export default {
border: 0;
}
}
.row-tag {
display: flex;
&:not(:first-child) {
......@@ -1016,4 +1377,41 @@ export default {
}
}
}
.dialog-form {
padding: 0px 20px;
margin: 20px;
&-item {
display: flex;
align-items: center;
label {
width: 100px;
text-align: right;
}
}
.form-tips {
margin-top: 6px;
padding-left: 80px;
font-size: 12px;
font-weight: 400;
color: #999999;
line-height: 17px;
display: flex;
justify-content: space-between;
}
}
</style>
<style lang="scss">
.select-popover-box {
max-width: 600px;
.select-tagLabel {
display: inline-block;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 0px 8px;
line-height: 20px;
margin-right: 4px;
margin-bottom: 5px;
}
}
</style>
\ No newline at end of file
<template>
<div class="scrm-sub-client-container">
<!-- <p class="pageTitle">标签管理</p> -->
<button class="addTagsBtn" @click="btnClick('create')">添加标签组</button>
<!-- <button class="addTagsBtn" @click="btnClick('edit')">修改标签组</button> -->
<span class="toptips">
<!-- v-if="!((merchantModel==2 && accountLevel==4) || (merchantModel==1 && accountLevel==1))" -->
<span>
共有{{ numberObj.groupCount || 0 }}个标签组
<!-- v-if="!(merchantModel == 1 && accountLevel == 4)" -->
<template>,{{ numberObj.bizLabelCount || 0 }}个企业标签</template>
<template v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">,{{ numberObj.rcLabelCount || 0 }}个自店标签</template>
</span>
<span class="iconPanelWrap" v-if="!isFirstShow">
<el-popover placement="top" width="666" trigger="hover">
<!-- v-if="!(merchantModel == 1 && accountLevel == 4)" -->
<div>企业标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;</div>
<div v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">自店标签为企业商户自有标签,员工可在企微APP端客户跟进等模块查看和打标签,最多3000个;</div>
<div>系统标签为通过大数据算法规则生成的标签</div>
<img src="@/assets/tagsManage/question.png" slot="reference" alt="" />
</el-popover>
</span>
</span>
<div class="initPanel" v-if="isFirstShow">
<template>企业标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;</template>
<template v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">自店标签为企业商户自有标签,员工可在企微APP端客户跟进等模块查看和打标签,最多3000个;</template>
系统标签为通过大数据算法规则生成的标签
<img src="@/assets/tagsManage/Shape.png" alt="" />
<i class="el-icon-close" @click="closeInitPanel"></i>
</div>
<div class="pageContent">
<!-- @setTableHeightEvent="setTableHeightEvent" -->
<search-form class="searchTop border-shadow" :formModel="searchForm" :formList="tagsPartFormList" @setTableHeightEvent="setTableHeightEvent" labelWidth="54px">
<span class="inline-b" slot="form-slot">
<el-button @click="resetTable" plain>重置</el-button>
<!-- :id="tableParams.btnId" -->
<el-button type="primary" @click="searchTable">查询</el-button>
</span>
</search-form>
<!-- noDataText="你当前还没有添加的标签" -->
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="tagsManage" :hasNum="false" :getListApi="getListApi" :searchForm="searchForm" :pageConf="pageConf" :noDataImg="url" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }">
<span slot="labelGroup" slot-scope="scope">
<span>{{ scope.scope.labelGroup.name }}</span>
</span>
<span slot="labelList" slot-scope="scope">
<!-- :class="[expande ? 'expande' : 'close']" -->
<div id="allTagsWrap" class="allTagsWrap">
<span v-for="(item, index) in showTagArray(scope.scope.labelList)" :key="index" class="ellipsis-1 tag-box-wrap">
<el-tooltip class="item" :content="item.name" placement="top">
<span>{{ item.name }}</span>
</el-tooltip>
</span>
<el-popover v-if="scope.scope.labelList.length > 9" class="ellipsis-1 tag-box-wrap" placement="top" width="800" trigger="hover" content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
<span slot="reference">...({{ scope.scope.labelList.length }})</span>
<div class="entmicro-hover" style="height: 214px; overflow-y: auto">
<el-tag type="info" class="ellipsis-1" style="margin-right: 10px; margin-bottom: 10px; max-width: 200px" v-for="(i, sindex) in scope.scope.labelList" :key="sindex" :disable-transitions="false">
<el-tooltip class="item" :content="i.name" placement="top">
<span>{{ i.name }}</span>
</el-tooltip>
</el-tag>
</div>
</el-popover>
</div>
</span>
<template slot="xxx" slot-scope="scope">
<!-- //这版关掉自店标签 1.0.1允许集团的门店打字店标签,也可以编辑-->
<!-- v-if="scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)" -->
<span @click="btnClick('edit', scope.scope)" v-if="scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)" class="blue-text">编辑标签组</span>
<GLButton class="blue-text leftDistance" type="text" fn="查看客户" v-if="userType !== 2" @click="toViewCustomer(scope.scope)">查看客户</GLButton>
</template>
</GLTable>
</div>
<basic-dialog class="role" :title="tagDialogTitle" width="712px" :isVisible="tagVisible" @confirmDialog="handleConfirm" @closeDialog="handleClose">
<slot>
<rule-form :ruleForm="tagForm" :rules="tagRules" :ruleData="tagDialogData" :labelWidth="'120px'" labelPosition="right" ref="tagForm">
<div slot="tagsGroup-type">
<el-select v-model="tagForm.initTagsGroup" placeholder="请选择" :disabled="tagDialogTitle != '添加标签组'" @change="handleSelect">
<el-option v-for="item in tagsGroupList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<!-- id="tagTipMsgRef" -->
<span class="tagTipMsg" v-if="tagDialogTitle == '添加标签组' && !tagForm.initTagsGroup">
<template v-if="!(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))">企业标签</template>
<template v-if="!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))">
<template v-if="!(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))">和</template>
自店标签分别
</template>
最多3000个
</span>
<span class="tagTipMsg" v-if="tagDialogTitle == '添加标签组' && tagForm.initTagsGroup == 1">
企业标签已创建
<span class="pure-blue-text">{{ numberObj.bizLabelCount }}</span>
个
</span>
<span class="tagTipMsg" v-if="tagDialogTitle == '添加标签组' && tagForm.initTagsGroup == 2">
自店标签已创建
<span class="pure-blue-text">{{ numberObj.rcLabelCount }}</span>
个
</span>
<span class="tagTipMsg" v-if="tagDialogTitle == '编辑标签组'">
{{ tagForm.initTagsGroup == 1 ? '企业标签' : '自店标签' }}最多3000个,已创建
<span class="pure-blue-text">{{ tagForm.initTagsGroup == 1 ? numberObj.bizLabelCount : numberObj.rcLabelCount }}</span>
个
</span>
<!-- 企业标签最多3000个,已创建3个 -->
<!-- 自店标签最多3000个,已创建3个 -->
</div>
<div slot="tagsInput-type">
<div class="tagsWrap" v-if="tagDialogTitle == '编辑标签组'">
<span class="tag" :class="{ inputWrapShow: item.inputVisible }" v-for="item in editTagList" :key="item.id">
<!-- maxlength="30" show-word-limit -->
<el-input class="input-new-tag" v-if="item.inputVisible" v-model.trim="item.name" ref="saveTagInput" size="small" @blur="item.name = handleInputConfirm(item.name, item.id)" @keyup.enter.native="item.name = handleInputConfirm(item.name, item.id)"></el-input>
<el-tooltip class="item" :content="item.name" placement="top">
<span class="ellipsis-1" v-if="!item.inputVisible">{{ item.name }}</span>
</el-tooltip>
<img class="editIcon" src="@/assets/tagsManage/edit.png" @click="showInput(item.id)" alt="" v-show="!item.inputVisible" />
</span>
</div>
<div class="row-tag" v-for="(item, index) in tagForm.tagsList" :key="index">
<!-- :onkeyup="(item.name = item.name.replace(/\s+/g, ''))" maxlength="30" show-word-limit @input="checkInputContent"-->
<el-input v-model.trim="item.name" placeholder="添加标签名称(至少添加一个标签)" @keyup.native="item.name = checkInputContent(item.name)"></el-input>
<span class="el-icon-circle-close" @click="deleteRow(index)"></span>
</div>
<!-- 需要后台告诉已经创建多少个标签了 -->
<div class="addtagIcon" v-if="tagForm.initTagsGroup == 1" :style="{ color: numberObj.bizLabelCount >= 3000 ? '#EEE' : '' }" @click="addRow(tagForm.initTagsGroup)">
<i class="el-icon-circle-plus-outline"></i>
<span class="addTagText">新增标签</span>
</div>
<div class="addtagIcon" v-if="tagForm.initTagsGroup == 2" :style="{ color: numberObj.rcLabelCount >= 3000 ? '#EEE' : '' }" @click="addRow(tagForm.initTagsGroup)">
<i class="el-icon-circle-plus-outline"></i>
<span class="addTagText">新增标签</span>
</div>
<div class="addtagIcon" v-if="tagForm.initTagsGroup == ''" @click="addRow(tagForm.initTagsGroup)">
<i class="el-icon-circle-plus-outline"></i>
<span class="addTagText">新增标签</span>
</div>
<!-- v-if="tagNameRules" -->
<div class="el-form-item__error" v-if="tagNameRules">请至少添加一个标签</div>
</div>
</rule-form>
</slot>
</basic-dialog>
</div>
</template>
<script>
import { getTableList, getTableTagNum, newAddTag, updateTag, exportLabelList } from '@/api/modules/tagsManage'
import { getLoginCount } from '@/api/modules/loginCount'
import url from '@/assets/clientDataOverview/nodata.png'
// import { debounce } from '@/utils/index'
export default {
name: 'tagsManage',
data() {
//这里就是整个checkName啦,就是方法一的使用
var checkName = (rule, value, callback) => {
var len = 0
for (var i = 0; i < value.length; i++) {
var c = value.charCodeAt(i)
//单字节加1
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
len++
} else {
len += 2
}
}
if (len > 30) {
//重点重点,下面就是填写提示的文字 (len < 4 && len> 0) ||
// callback(new Error('名称长度为4-30个字符,一个中文字等于2个字符。'));
callback(new Error('字数已达上限'))
} else {
callback()
}
}
var checkTagsInput = (rule, value, callBack) => {
console.log('value值为:', value, typeof value, value.length)
if (value && value.length == 0) {
return callBack(new Error('请添加标签'))
} else {
return callBack()
}
}
return {
isReload: true,
isAllowCloseDialog: false,
isHasSameTag: false,
tagNameRules: false,
numberObj: {},
url: url,
isFirstShow: false,
searchForm: {},
tagsPartFormList: [
{
type: 'select',
prop: 'labelTreeReq.labelTypesStr',
label: '标签组',
placeholder: '请选择标签组类型',
options: this.$Constants.LABEL_OPTION
},
{
type: 'input',
inputType: 'text',
prop: 'labelTreeReq.labelGroupName',
label: '搜索',
placeholder: '请输入标签组或标签名称',
clearable: true
}
],
pageConf: { pageSize: 'labelTreeReq.pageSize', pageNum: 'labelTreeReq.pageNum', totalCount: 'labelGroupCount' },
tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'labelTreeRets',
tableColumns: [
{
label: '标签组',
prop: 'labelGroup',
addHtml: 'labelGroup',
width: 230
},
{
label: '标签组类型',
prop: 'labelType',
width: 180
},
{
label: '标签',
prop: 'labelList',
addHtml: 'labelList',
align: 'center'
},
{
label: '操作',
prop: 'xxx',
fixed: 'right',
addHtml: 'xxx',
width: 180
}
]
// tableOption: {
// width: 120
// }
},
getListApi: getTableList,
// 弹窗数据
tagDialogTitle: '添加标签组',
tagVisible: false,
tagForm: {
tagsName: '',
initTagsGroup: 1,
tagsList: []
},
tagDialogData: [
{
label: '标签组名称',
prop: 'tagsName',
type: 'input',
placeholder: '最多30个字符,1个汉字为2个字符',
// maxlength: 30,
// showWordLimit: true,
disabled: false,
clickFunc: this.watchInput
},
{
label: '标签组类型',
prop: 'initTagsGroup',
type: 'customize',
slotName: 'tagsGroup-type'
},
{
label: '标签',
prop: 'tagsList',
type: 'customize',
slotName: 'tagsInput-type',
class: 'is-required' //添加红色标志
}
],
tagRules: {
tagsName: [
{ required: true, message: '请输入名称', trigger: 'blur' }
// {
// validator: checkName,
// trigger: 'change'
// }
],
initTagsGroup: [{ required: true, message: '请选择标签组类型', trigger: 'change' }]
// tagsList: [{ required: true }]
},
tagsGroupList: [
{ id: 1, name: '企业标签' },
{ id: 2, name: '自店标签' }
],
//编辑便签输入的值
editTagList: [],
tagGroupId: 0, //标签组id,编辑提交接口要用
//控制展开收起按钮
expande: true,
needShowExpande: false,
merchantId: 10001001, //子系统默认这个门店id
merchantModel: 1, //集团:1,门店:2
accountLevel: 0, //1,2,3,4工厂,省代,市代,门店
userType: 0 //1是商户,2是员工
}
},
computed: {},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId
this.merchantModel = this.$globalState.session.merchantModel
this.accountLevel = this.$globalState.session.accountLevel
this.userType = this.$globalState.session.userType
console.log(this.$globalState.session, '555')
// if (this.merchantModel == 1) {
// if (!(this.accountLevel == 1 && this.userType == 1)) this.tagsGroupList.splice(0, 1) //只能创建自店标签
// }
//1.0.1集团下的省代、市代,门店只能创建自店标签
if (this.merchantModel == 1) {
if (this.accountLevel == 2 || this.accountLevel == 3 || this.accountLevel == 4) {
this.tagsGroupList.splice(0, 1) //只能创建自店标签
// this.tagsPartFormList[0].options.splice(0, 1)
}
}
if (this.merchantModel == 1) {
if (this.accountLevel == 1) {
//集团下的工厂只能创建企微标签,自店标签不要了
this.tagsGroupList.splice(1, 1)
this.tagsPartFormList[0].options.splice(1, 1)
}
}
// 集团授权模式下的门店账号,拥有标签管理模块权限,修改为:去掉门店的“标签管理”模块权限
// 单店授权模式下的门店账号,创建标签组时,可创建企业标签和自店标签,修改为:创建标签组时,仅能选择企业标签,去掉自店标签选项;
if (this.merchantModel == 2) {
if (this.accountLevel == 4) {
this.tagsGroupList.splice(1, 1)
this.tagsPartFormList[0].options.splice(1, 1)
}
}
}
this.searchForm = { 'labelTreeReq.shopId': this.merchantId, 'labelTreeReq.edition': this.merchantModel }
this.getLoginCountFun()
this.getTableTagNumFun()
},
mounted() {
//没数据的时候要算高度
// setTimeout(() => {
// if (!this.$refs.tagsManage.data.length) {
// this.$refs.tagsManage.setTableHeightFun()
// }
// }, 200)
},
methods: {
// toViewCustomer(info) {
// this.$router.push('/tagsManage/viewCustomers')
// },
toViewCustomer(info) {
console.log(info)
const id = info.labelGroup.id
const type = info.labelType
this.$router.push({
// path:`/tagsManage/viewCustomers/530`
path: `/tagsManage/viewCustomers/${id}/${type}`
})
},
watchInput() {
console.log('点击标签组名称输入框')
},
showTagArray(list) {
if (list.length == 0) {
return []
}
// return list
return list.slice(0, 9)
},
checkInputContent(e) {
//确保每个输入框的内容不和已存在的编辑标签相同
let isHasSameTag = this.editTagList.some(ele => ele.name == e)
if (isHasSameTag) {
this.$message.error('不允许输入已存在的标签')
return e
}
return this.$Utils.cutMaxCharStr(e)
},
isShowEditBtn(row) {
//集团模式下,只有集团能可以编辑企业,自店,其他只能编辑自店
//单店模式下,仅门店和员工可以编辑
if (row.labelType == '自店标签' && !(this.merchantModel == 1 && (this.accountLevel == 2 || this.accountLevel == 3 || this.accountLevel == 4))) {
return false
}
if (this.merchantModel == 1) {
if (this.accountLevel == 1 && this.userType == 1) {
return true
}
if (this.accountLevel !== 1) {
//如果是企业标签不显示
if (row.labelType == '企业标签') {
return false
}
return true
}
}
return true //门店版都显示编辑按钮
},
expandeClick() {
// console.log('expandeClick')
this.expande = !this.expande
},
closeInitPanel() {
this.isFirstShow = false
},
setTableHeightEvent() {
this.$refs.tagsManage.setTableHeightFun()
},
setTableFinishFun(content) {
console.log('表格完成', this.$refs.tagsManage.data)
this.$refs.tagsManage.data.length ? (this.$refs.tagsManage.tableHeightValues = '') : this.$refs.tagsManage.setTableHeightFun()
},
getLoginCountFun() {
//loginType:3是查客户数据概览浏览次数
getLoginCount({ loginType: 3 }).then(res => {
//获取是否第一次点击该页面
this.isFirstShow = res
})
},
getTableTagNumFun() {
getTableTagNum({ 'labelStatReq.shopId': this.merchantId, 'labelStatReq.edition': this.merchantModel }).then(res => {
if (!res) {
return false
}
this.numberObj = res
})
},
//搜索表格
searchTable() {
this.$refs.tagsManage.refreshTable()
},
//重置表格
resetTable() {
// this.isReload = false
this.searchForm = { 'labelTreeReq.shopId': this.merchantId, 'labelTreeReq.edition': this.merchantModel }
this.$refs.tagsManage.refreshTable()
// this.$nextTick(() => {
// this.isReload = true
// })
},
btnClick(pType, rowData) {
console.log(pType, rowData, 'btnClick')
switch (pType) {
case 'create':
this.tagDialogTitle = '添加标签组'
this.tagForm.tagsForm = ''
this.tagForm.initTagsGroup = 1 //默认改成,企业标签
if (this.merchantModel == 1 && (this.accountLevel == 2 || this.accountLevel == 3 || this.accountLevel == 4)) {
this.tagForm.initTagsGroup = 2
}
this.$set(this.tagDialogData[0], 'disabled', false)
this.handleClose()
break
case 'edit':
this.tagDialogTitle = '编辑标签组'
this.$set(this.tagDialogData[0], 'disabled', true)
this.editEvent(rowData)
break
}
},
isHasSome(array) {
var temp = [] //一个新的临时数组
for (var i = 0; i < array.length; i++) {
if (temp.indexOf(array[i]) !== -1) {
return true
}
if (temp.indexOf(array[i]) == -1) {
temp.push(array[i])
}
}
return false
},
//编辑触发事件
editEvent(rowData) {
this.handleClose()
this.tagsForm = JSON.parse(JSON.stringify(rowData))
this.editTagList = rowData.labelList.map(item => {
return { ...item, inputVisible: false }
})
this.tagGroupId = rowData.labelGroup.id //标签组id
this.tagForm.tagsName = rowData.labelGroup.name //标签组名
this.tagForm.initTagsGroup = rowData.labelType == '企业标签' ? 1 : rowData.labelType == '自店标签' ? 2 : '' //标签组类型
},
handleConfirm() {
console.log(this.$refs.tagForm.$children, 'kkk')
this.$refs.tagForm.$children[0].validate(valid => {
if (!valid) {
if (this.tagForm.tagsList.length <= 0 && this.tagDialogTitle == '添加标签组') {
this.tagNameRules = true
this.$message.error('至少要添加一个标签')
// return
}
return
}
if (this.tagForm.tagsList.length <= 0 && this.tagDialogTitle == '添加标签组') {
this.tagNameRules = true
this.$message.error('至少要添加一个标签')
return
}
if (this.tagDialogTitle == '添加标签组') {
//过滤掉没有输入值得标签输入框
this.tagForm.tagsList = this.tagForm.tagsList.filter(item => item.name != '')
if (this.tagForm.tagsList.length <= 0) {
this.$message.error('不能提交空标签')
return
}
//如果存在添加标签的输入框的内容的标签相同则不提交
let isSameTagFlag = false
var tempArr = this.tagForm.tagsList.map(item => item.name)
isSameTagFlag = this.isHasSome(tempArr)
if (isSameTagFlag) {
this.$message.error('不能提交相同的标签,请修改')
return
}
this.newAddTagFun()
//this.handleClose() //这里不管
} else {
//修改标签(允许同时增加标签)
let isHasEmpty = this.editTagList.some(ele => ele.name == '')
if (isHasEmpty) {
this.$message.error('不能提交空的编辑标签')
return
}
if (this.tagForm.tagsList.length > 0) {
//过滤掉没有输入值得标签输入框
this.tagForm.tagsList = this.tagForm.tagsList.filter(item => item.name != '')
//如果存在添加标签的输入框的内容和可编辑的标签相同则不提交
let ishasSameTagFlag = false
this.editTagList.forEach(item => {
for (let i = 0; i < this.tagForm.tagsList.length; i++) {
if (this.tagForm.tagsList[i].name == item.name) {
ishasSameTagFlag = true
}
}
})
if (ishasSameTagFlag) {
this.$message.error('不能提交已存在的标签,请修改')
return
}
}
this.updateTagFun()
this.newAddTagFun()
// this.handleClose()
}
})
},
handleClose() {
this.tagNameRules = false
if (!this.tagVisible && this.$refs.tagForm) {
this.$refs.tagForm.$children[0].resetFields()
this.tagForm.initTagsGroup = 1
if (this.merchantModel == 1 && (this.accountLevel == 2 || this.accountLevel == 3 || this.accountLevel == 4)) {
this.tagForm.initTagsGroup = 2
}
this.tagForm.tagsName = ''
// console.log(this.tagForm.initTagsGroup, '7777')
// console.log(this.tagForm, '内')
}
// console.log(this.tagForm, '外')
this.tagForm.tagsList = [] //取消时清空新增标签
this.tagVisible = !this.tagVisible
},
//导出
handleExport() {
const params = {
...JSON.parse(JSON.stringify(this.exportParams))
}
exportLabelList(params).then(res => {
this.$Utils.exportFn(res)
})
},
newAddTagFun() {
//满足条件进行提交
let params = {}
params['labelDTO.dataFrom'] = 'cs'
params['labelDTO.shopId'] = this.merchantId
params['labelDTO.edition'] = this.merchantModel
// params.staffId = '员工A'
params['labelDTO.labelGroup.name'] = this.tagForm.tagsName
params['labelDTO.labelType'] = this.tagForm.initTagsGroup == 1 ? '企业标签' : '自店标签'
params['labelDTO.labelList'] = this.tagForm.tagsList
params['labelDTO.isAddLabelGroupEnter'] = this.tagDialogTitle == '添加标签组' ? true : false
console.log(params)
newAddTag(params).then(res => {
if (!res) {
return
}
if (res.data.code == 0) {
if (this.tagForm.tagsList.length > 0) {
this.$message.success('添加成功')
}
if (this.tagDialogTitle == '编辑标签组') {
this.tagForm.tagsName = ''
this.tagForm.initTagsGroup = ''
this.tagForm.tagsList = []
}
this.handleClose()
} else if (res.data.code == 1) {
this.$message.error(`${res.data.message}`)
} else if (res.data.code == 2) {
//编辑弹框, 空标签调接口返回信息
if (this.tagDialogTitle == '编辑标签组') {
this.tagForm.tagsName = ''
this.tagForm.initTagsGroup = ''
this.tagForm.tagsList = []
}
this.handleClose()
}
this.resetTable() //刷新下表格
this.getTableTagNumFun()
})
},
updateTagFun() {
let param = {}
param['labelDTO.dataFrom'] = 'cs'
param['labelDTO.edition'] = this.merchantModel
param['labelDTO.labelGroup.id'] = this.tagGroupId
param['labelDTO.labelGroup.name'] = this.tagForm.tagsName
param['labelDTO.labelType'] = this.tagForm.initTagsGroup == 1 ? '企业标签' : '自店标签'
param['labelDTO.shopId'] = this.merchantId
let editTagList = this.editTagList.map(item => {
return {
id: item.id,
name: item.name
}
})
param['labelDTO.labelList'] = editTagList
updateTag(param).then(res => {
if (!res) {
return
}
this.$message.success('修改成功')
// this.tagForm.tagsName = ''
// this.tagForm.initTagsGroup = ''
// this.tagForm.tagsList = []
this.resetTable() //刷新下表格
})
},
//删除一行标签
deleteRow(index) {
this.tagForm.tagsList.splice(index, 1)
},
//添加一行标签
addRow(type) {
this.tagNameRules = false
if (type == 1 && this.numberObj.bizLabelCount >= 3000) {
this.$message.error('企业标签数量已达上限')
return
}
if (type == 2 && this.numberObj.rcLabelCount >= 3000) {
this.$message.error('自店标签数量已达上限')
return
}
this.tagForm.tagsList.push({ name: '' })
},
showInput(id) {
// this.inputVisible = true
this.editTagList.forEach(item => {
if (item.id == id) {
item.inputVisible = true
}
})
//聚焦到输入框
this.$nextTick(_ => {
this.$refs.saveTagInput[0].focus()
})
},
handleInputConfirm(inputValue, id) {
this.editTagList.forEach(i => {
if (i.id == id) {
i.inputVisible = false
}
})
return this.$Utils.cutMaxCharStr(inputValue)
},
handleSelect(value) {
console.log('值内容', value)
}
//注意问问他们后台怎么处理转义字符
//限制输入特殊字符
// keyUp(e) {
// e.target.value = e.target.value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/g, '')
// },
// // 只能输入汉字、英文、数字
// keydown(e) {
// e.target.value = e.target.value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g, '')
// }
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
.leftDistance {
margin-left: 10px;
}
.scrm-sub-client-container {
/deep/.search-form .el-form-item__content {
width: auto;
}
// // el-form-item__label
// /deep/.el-table tbody tr:hover > td {
// background-color: #f4f3ff;
// }
.pageTitle {
position: relative;
// margin-top: 30px;
margin-bottom: 20px;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.addTagsBtn {
height: 32px;
background: $btnBlue;
border-radius: 4px;
padding: 0 20px;
color: #fff;
font-size: 14px;
&:hover {
background-color: $lightBtnBlue;
}
}
.toptips {
display: inline-block;
position: relative;
margin-left: 10px;
height: 20px;
min-width: 440px;
font-size: 14px;
font-weight: 400;
color: #666666;
line-height: 20px;
.tipsPanel {
position: absolute;
display: inline-block;
padding: 6px 10px 10px;
box-sizing: border-box;
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 22px;
display: none;
z-index: 100;
background: #fff;
width: 560px;
height: 82px;
right: -280px;
top: -84px;
}
.iconPanelWrap {
img {
display: inline-block;
margin-left: 20px;
vertical-align: middle;
}
&:hover {
.tipsPanel {
display: block !important;
}
}
}
}
.initPanel {
position: relative;
margin-top: 20px;
width: 708px;
min-height: 80px;
box-sizing: border-box;
background: #e6e9ff;
border: 1px solid $btnBlue;
border-radius: 4px;
padding: 10px 42px;
height: 60px;
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.65);
line-height: 20px;
img {
position: absolute;
left: 16px;
top: 13px;
}
i {
position: absolute;
top: 14px;
right: 18px;
width: 9px;
height: 9px;
cursor: pointer;
}
}
.pageContent {
padding: 6px 20px 30px;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
margin-top: 20px;
background-color: #fff;
.el-button + .el-button {
margin-left: 10px;
}
.allTagsWrap {
position: relative;
// display: -webkit-box;
// overflow: hidden;
// -webkit-line-clamp: 2;
// -webkit-box-orient: vertical;
// padding-bottom: -2px;
// box-sizing: border-box;
// &:hover {
// -webkit-line-clamp: 9999;
// // .tag-box-wrap {
// // margin-bottom: 10px;
// // }
// }
.tag-box-wrap {
display: inline-block;
margin-right: 10px;
margin-top: 5px;
margin-bottom: 5px;
padding: 0 10px;
box-sizing: border-box;
min-width: 76px;
max-width: 200px;
height: 26px;
line-height: 26px;
border-radius: 4px;
border: 1px solid #e8e8ea;
background: #fafbfe;
text-align: center;
font-size: 14px;
font-weight: 400;
color: #666666;
max-width: 245px;
cursor: pointer;
// &:first-child{
// margin-bottom: 4px;
// }
}
.expande-button-wrap {
position: absolute;
right: 0;
bottom: 0;
.expande-button {
color: $btnBlue;
cursor: pointer;
i {
height: 8px;
}
span {
height: 20px;
font-size: 14px;
font-weight: 400;
color: $btnBlue;
line-height: 20px;
}
}
}
}
.close {
overflow: hidden;
height: 65px;
}
}
.role {
::v-deep .el-input--small,
.el-input__inner {
width: 423px;
}
::v-deep .container {
position: relative;
.tagTipMsg {
position: absolute;
display: inline-block;
width: 240px;
left: 200px;
top: 0;
font-size: 12px;
font-weight: 400;
color: #999999;
}
}
::v-deep .el-select > .el-input--small {
width: 190px;
}
::v-deep .el-form-item--small:nth-child(2) {
display: inline-block;
width: 310px;
position: relative;
}
.tagsWrap {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
padding-top: 3px;
img {
display: none;
}
::v-deep .tag {
text-align: center;
display: inline-block;
padding: 0 10px;
min-width: 68px;
max-width: 200px;
margin-right: 10px;
margin-bottom: 10px;
height: 26px;
line-height: 26px;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
position: relative;
box-sizing: border-box;
/deep/.input-new-tag {
// position: relative;
width: 100%;
}
.el-input--small .el-input__inner {
height: 26px;
line-height: 26px;
font-size: 14px;
}
.ellipsis-1 {
display: inline-block;
width: 100%;
font-weight: 400;
color: #666666;
font-size: 14px;
}
&:hover {
.editIcon {
display: inline-block;
cursor: pointer;
position: absolute;
top: -8px;
right: -8px;
// z-index: 9999;
}
}
.el-input {
max-width: 200px;
}
}
.inputWrapShow {
//显示输入框时,不显示外面框的左右边距
padding: 0 0;
border: 0;
}
}
.row-tag {
display: flex;
&:not(:first-child) {
margin-top: 5px;
}
align-items: center;
.el-icon-circle-close {
margin-left: 15px;
font-size: 18px;
color: #999999;
cursor: pointer;
}
}
.addtagIcon {
width: 75px;
height: 40px;
display: flex;
justify-content: space-between;
align-items: center;
color: $btnBlue;
cursor: pointer;
i {
font-size: 20px;
}
.addTagText {
font-size: 12px;
}
}
}
}
</style>
......@@ -8,99 +8,92 @@ const baseUrl = '/'
const resolve = dir => path.join(__dirname, dir)
const CDN_DOMAIN = 'https://img02.glsx.com.cn/'
const cdn = {
css: [
`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`
],
js: [
`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`,
`${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`,
`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`,
`${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`,
// `${CDN_DOMAIN}ajax/libs/axios/0.21.0/axios.min.js`,
`${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`
]
css: [`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`],
js: [
`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`,
`${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`,
`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`,
`${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`,
// `${CDN_DOMAIN}ajax/libs/axios/0.21.0/axios.min.js`,
`${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`
]
}
module.exports = {
outputDir: `../dist/${packageName}`,
publicPath,//node_env ? baseUrl : '/'
assetsDir: 'static',
configureWebpack: {
resolve: {
alias: {
'@': resolve('src'),
assets: resolve('src/assets'),
views: resolve('src/views'),
components: resolve('src/components'),
// 'jquery': 'jquery'
}
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery', // 创建 '$'、'jQuery'、'window.jQuery' 三个变量指向依赖jquery
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
],
output: {
library: `${packageName}-[name]`,
libraryTarget: 'umd', // 把微应用打包成 umd 库格式
jsonpFunction: `webpackJsonp_${packageName}`
},
externals: {
'vue': 'Vue',
'element-ui': 'ELEMENT',
'vue-router': 'VueRouter',
'vuex': 'Vuex',
'axios': 'axios',
'echarts': 'echarts'
}
outputDir: `../dist/${packageName}`,
publicPath, //node_env ? baseUrl : '/'
assetsDir: 'static',
configureWebpack: {
resolve: {
alias: {
'@': resolve('src'),
assets: resolve('src/assets'),
views: resolve('src/views'),
components: resolve('src/components')
// 'jquery': 'jquery'
}
},
devServer: {
hot: true,
disableHostCheck: true,
host: process.env.VUE_APP_HOST,
port: process.env.VUE_APP_PORT,
headers: {
'Access-Control-Allow-Origin': '*' // 主应用获取子应用时跨域响应头
},
// proxy: {    
// '/api': {        
// target: 'http://rop-merchant.test.glsx.com.cn',
//         
// changeOrigin: true,
//         
// pathRewrite: {            
// '^/api': '/'        
// }    
// },
// },
plugins: [
new webpack.ProvidePlugin({
$: 'jquery', // 创建 '$'、'jQuery'、'window.jQuery' 三个变量指向依赖jquery
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
],
output: {
library: `${packageName}-[name]`,
libraryTarget: 'umd', // 把微应用打包成 umd 库格式
jsonpFunction: `webpackJsonp_${packageName}`
},
chainWebpack: config => {
config.plugin('html')
.tap(args => {
// args[0].minify.removeComments = false;
args[0].cdn = cdn
return args
})
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
config.module
.rule('fonts')
.test(/.(ttf|otf|eot|woff|woff2)$/)
.use('url-loader')
.loader('url-loader')
.tap(options => {
options = {
// limit: 10000,
name: '/static/fonts/[name].[ext]'
}
return options
})
.end()
externals: {
vue: 'Vue',
'element-ui': 'ELEMENT',
'vue-router': 'VueRouter',
vuex: 'Vuex',
axios: 'axios',
echarts: 'echarts'
}
},
devServer: {
hot: true,
disableHostCheck: true,
host: process.env.VUE_APP_HOST,
port: process.env.VUE_APP_PORT,
headers: {
'Access-Control-Allow-Origin': '*' // 主应用获取子应用时跨域响应头
}
}
\ No newline at end of file
// proxy: {
// '/api': {
// target: 'http://rop-merchant.test.glsx.com.cn',
//
// changeOrigin: true,
//
// pathRewrite: {
// '^/api': '/'
// }
// },
// },
},
chainWebpack: config => {
config.plugin('html').tap(args => {
// args[0].minify.removeComments = false;
args[0].cdn = cdn
return args
})
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
config.module
.rule('fonts')
.test(/.(ttf|otf|eot|woff|woff2)$/)
.use('url-loader')
.loader('url-loader')
.tap(options => {
options = {
// limit: 10000,
name: '/static/fonts/[name].[ext]'
}
return options
})
.end()
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!