Commit 7211e8a7 by 杨明

fixed

1 parent dbcb7f8a
......@@ -19,7 +19,7 @@
全部客户
<span class="main-container-head-number font-14">{{ totalCount }}个</span>
</div>
<el-button class="export" size="small" @click="handleExport()">导出</el-button>
<GLButton size="small" @click="handleExport" class="export" fn="导出">导出</GLButton>
</div>
<GLTable ref="groupRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :noDataImg="url" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<span slot="customerName" slot-scope="scope" style="display:flex;align-items:center">
......
......@@ -8,7 +8,7 @@
<div>
<span></span>
</div>
<el-button size="small" @click="handleExport">导出</el-button>
<GLButton size="small" @click="handleExport" class="export" fn="导出">导出</GLButton>
</div>
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="clientGroupManage" :hasNum="true" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :noDataImg="url" :pageConf="pageConf" :searchForm="searchFormTable" :tableParams="tableParams">
<span slot="status" slot-scope="scope">
......
......@@ -290,7 +290,7 @@ export default {
expande: false, //车辆
deviceExpande: false, //设备
guaranteeExpande: false, //保单
panelContent: '说明:标签信息包含跟进员工标记的企业标签和自店标签,以及通过大数据算法生成的系统标签',
panelContent: this.$globalState.session.merchantModel == 1 ? '说明:标签信息包含跟进员工标记的集团标签和自店标签,以及通过大数据算法生成的系统标签' : '说明:标签信息包含跟进员工标记的企业标签和自店标签,以及通过大数据算法生成的系统标签',
url: url,
leftPanelInfo: {},
labelIdList: [], //存放用户被标记标签的id
......@@ -801,12 +801,12 @@ export default {
customerPhone: this.contactPhone,
userIdList
}
this.loading = true
perfectCustomerPhone(param).then(res => {
this.loading = false
if (res) {
this.getPageDetail()
this.getPageDetail(res)
this.$message.success('设置成功')
} else {
this.$message.error('设置失败')
}
})
this.phoneVisible = false
......
......@@ -8,7 +8,7 @@
<div>
<span></span>
</div>
<el-button size="small" @click="handleExport">导出</el-button>
<GLButton size="small" @click="handleExport" fn="导出">导出</GLButton>
</div>
<GLTable @setTableFinishFun="setTableFinishFun" v-if="isReload" ref="clientManage" :hasNum="true" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :searchForm="searchFormTable" :noDataImg="url" :pageConf="pageConf" :tableParams="tableParams">
<span slot="customerName" slot-scope="scope">
......
......@@ -217,7 +217,10 @@ export default {
label: '标签组类型',
prop: 'groupType',
width: 180,
align: 'left'
align: 'left',
formatter: cellValue => {
return cellValue.groupType == '企业标签' && this.$globalState.session.merchantModel == 1 ? '集团标签' : cellValue.groupType
}
},
{
label: '标签',
......
......@@ -7,7 +7,17 @@
<el-tree @check="checkChange" class="tag-tree" ref="tagTree" :data="labelTree" :props="defaultProps" @node-click="nodeClick" show-checkbox node-key="id" :default-expanded-keys="expandId" :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>
<el-tooltip placement="top" v-if="hoverId == data.id && hoverStatus">
<span :class="['tree-node', `node_${data.id}`]" slot="content">
{{ node.label }}
</span>
<span :class="['tree-node', `node_${data.id}`]">
{{ node.label }}
</span>
</el-tooltip>
<span :class="['tree-node', `node_${data.id}`]" v-else @mouseenter="hoverFun(data)">
{{ 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>
......@@ -22,6 +32,8 @@ export default {
name: 'tagGroup',
data() {
return {
hoverId: '',
hoverStatus: false,
expandId: [],
loading: false,
heightBox: 200,
......@@ -43,6 +55,10 @@ export default {
},
methods: {
hoverFun(data) {
this.hoverId = data.id
this.hoverStatus = document.querySelector(`.node_${data.id}`).scrollWidth > 140
},
isShowEditBtn(row) {
const { userType, accountLevel, merchantModel } = this.$globalState.session
//集团模式下,只有集团能可以编辑企业,自店,其他只能编辑自店
......@@ -71,6 +87,7 @@ export default {
document.querySelector('.tag-tree').scrollTop = height
},
resetTree() {
this.filterText = ''
this.$parent.searchForm = {}
this.$refs.tagTree.setCheckedKeys([])
this.$nextTick(() => {
......
......@@ -80,7 +80,7 @@
<div class="clientListNew">客户列表({{ tableTotal }}人)</div>
</div>
<div>
<el-button class="export" size="small" @click="handleExport">导出</el-button>
<GLButton size="small" @click="handleExport" class="export" fn="导出">导出</GLButton>
<el-button
plain
size="small"
......@@ -856,9 +856,10 @@ export default {
},
//添加一行标签
addRow(type) {
const typeLabel = this.$globalState.session.merchantModel == 1 ? '集团标签' : '企业标签'
this.tagNameRules = false
if (type == 1 && this.numberObj.bizLabelCount >= 3000) {
this.$message.error('企业标签数量已达上限')
this.$message.error(`${typeLabel}数量已达上限`)
return
}
if (type == 2 && this.numberObj.rcLabelCount >= 3000) {
......
<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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!