Commit 0bbd31fb by 前端

3.3.1代码

1 parent d2baf242
......@@ -66,6 +66,7 @@ export default {
jumpEvent(obj) {
this.$set(this.eventObj, 'addOrEdit', obj.addOrEdit)
delete obj.info.eventStartDate
this.$set(this.eventObj, 'info', obj.info)
this.parentCustomerObj = obj.parentCustomerObj
this.eventIndex = obj.eventIndex
......
......@@ -4,21 +4,29 @@
<div class="sop-base-info">
<div class="container m-b-20">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth"
:isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData"
:formRules="editRule">
<div slot="startDate">
<el-input class="w432" :placeholder="!editForm.eventList.length ? '设置营销事件后自动补充' : editForm.startDate + (editForm.endDate ? ' - ' + editForm.endDate : '')" disabled></el-input>
<el-input class="w432"
:placeholder="!editForm.eventList.length ? '设置营销事件后自动补充' : editForm.startDate + (editForm.endDate ? ' - ' + editForm.endDate : '')"
disabled></el-input>
</div>
<div slot="customerInfoList" slot-scope="scope">
<div v-if="!scope.scope.isDisabled">
<!-- <el-button class="default-blue-btn" :size="size" @click="handleSelectCustomer">选择客户</el-button>
<el-button v-show="editForm.customerInfoList.length" :size="size" @click="handleResetCustomer">重置客户</el-button> -->
<el-radio-group v-model="editForm[scope.scope.name]" @change="handleCustTypeChange">
<el-radio v-for="(item, index) in scope.scope.customerRadioList" :key="index" :label="item.confId">{{ item.confName }}</el-radio>
<el-radio v-for="(item, index) in scope.scope.customerRadioList" :key="index" :label="item.confId">
{{ item.confName }}
</el-radio>
</el-radio-group>
</div>
<div v-for="(item, pIdx) in customerDataList" :key="pIdx">
<div v-show="item.confId == editForm[scope.scope.name]">
<el-button v-show="item.list.length == 0" class="default-blue-btn el-icon-plus" :size="size" @click="handleSelectCustomer(pIdx)">去选择</el-button>
<el-button v-show="item.list.length == 0" class="default-blue-btn el-icon-plus" :size="size"
@click="handleSelectCustomer(pIdx)">去选择
</el-button>
<!-- <div v-show="editForm.customerInfoList.length != 0" class="customer-box m-t-10"> -->
<div v-show="item.list.length != 0">
<div class="customer-box m-t-10">
......@@ -26,13 +34,17 @@
<div :key="key" class="el-input-tag input-tag-wrapper">
<template v-if="item.confName == '标签'">
<div v-for="(subItem, subIdx) in item.list" :key="subIdx">
<el-tag v-for="(k, n) in subItem.labelList" :key="n" class="customer-tag" :size="size" type="info" :closable="!scope.scope.isDisabled" :disable-transitions="false" @close="handleDeleteCustomer(n, subIdx, item.confName)">
<el-tag v-for="(k, n) in subItem.labelList" :key="n" class="customer-tag" :size="size"
type="info" :closable="!scope.scope.isDisabled" :disable-transitions="false"
@close="handleDeleteCustomer(n, subIdx, item.confName)">
<span>{{ subItem.labelGroup.name }}:{{ k.name }}</span>
</el-tag>
</div>
</template>
<template v-else>
<el-tag v-for="(subItem, subIdx) in item.list" :key="subIdx" class="customer-tag" :size="size" type="info" :closable="!scope.scope.isDisabled" :disable-transitions="false" @close="handleDeleteCustomer(subIdx)">
<el-tag v-for="(subItem, subIdx) in item.list" :key="subIdx" class="customer-tag" :size="size"
type="info" :closable="!scope.scope.isDisabled" :disable-transitions="false"
@close="handleDeleteCustomer(subIdx)">
<!-- <i class="el-icon-user-solid"></i> -->
<span>{{ subItem[item.listConf.confName] || subItem[item.listConf.otherConfName] }}</span>
</el-tag>
......@@ -50,14 +62,17 @@
<div class="container edit-container">
<div class="edit-title flex" style="align-items: center">
<p>营销事件设置</p>
<el-tooltip :disabled="!(!editForm.customerInfoList.length || !editForm.sopName)" effect="dark" content="请先完善sop名称和营销对象" placement="top">
<el-tooltip :disabled="!(!editForm.customerInfoList.length || !editForm.sopName)" effect="dark"
content="请先完善sop名称和营销对象" placement="top">
<div>
<el-button class="m-r-20" :disabled="!editForm.customerInfoList.length || !editForm.sopName" :size="size" type="primary" @click="handleEventEdit('add')">添加事件</el-button>
<el-button class="m-r-20" :disabled="!editForm.customerInfoList.length || !editForm.sopName" :size="size"
type="primary" @click="handleEventEdit('add')">添加事件
</el-button>
</div>
</el-tooltip>
</div>
<div v-show="!editForm.eventList.length" class="event-empty">
<img class="empty-img" :src="url" />
<img class="empty-img" :src="url"/>
<p class="empty-txt">暂无营销事件</p>
</div>
<div v-show="editForm.eventList.length" class="event-box">
......@@ -66,27 +81,39 @@
<p class="m-r-10">{{ item.eventStartDate }}</p>
<p class="m-r-20">{{ item.eventTime }}</p>
<p class="m-r-20" v-show="item.repeatFlag == 'Y' && item.repeatMode == 1">每天重复循环至</p>
<p class="m-r-20" v-show="item.repeatFlag == 'Y' && item.repeatMode == 2">每周{{ item.repeatTime }}重复循环至</p>
<p class="m-r-20" v-show="item.repeatFlag == 'Y' && item.repeatMode == 3">每月{{ item.repeatTime }}重复循环至</p>
<p class="m-r-20" v-show="item.repeatFlag == 'Y' && item.repeatMode == 2">每周{{
item.repeatTime
}}重复循环至</p>
<p class="m-r-20" v-show="item.repeatFlag == 'Y' && item.repeatMode == 3">每月{{
item.repeatTime
}}重复循环至</p>
<p class="m-r-20" v-show="item.repeatFlag == 'Y'">{{ item.eventEndDate }}</p>
<p class="m-r-20 txt-blue">{{ baseData.channelTypeList.find(k => k.confId == item.pushChannelType).confName }}</p>
<p class="m-r-20 txt-blue">
{{ baseData.channelTypeList.find(k => k.confId == item.pushChannelType).confName }}</p>
</div>
<div class="event-content">{{ item.eventContent }}</div>
<div class="event-link" v-if="item.object">
<img class="m-r-10" v-if="item.object.additionalType && item.object.additionalType != 4" :src="require(`@/assets/sop/icon-${imgIcon[item.object.additionalType]}.png`)" alt />
<img class="m-r-10" v-if="item.object.additionalType && item.object.additionalType != 4"
:src="require(`@/assets/sop/icon-${imgIcon[item.object.additionalType]}.png`)" alt/>
<div v-if="item.object.additionalType == 4">
<div v-if="item.object.showVideoContent.length">
<video class="model-item-img" :src="item.object.showVideoContent[0].attContent" controls="controls" />
<video class="model-item-img" :src="item.object.showVideoContent[0].attContent" controls="controls"/>
</div>
<div v-if="!item.object.showVideoContent.length && item.object.showImgContent.length">
<img class="model-item-img" :src="item.object.showImgContent[0].attContent" />
<img class="model-item-img" :src="item.object.showImgContent[0].attContent"/>
</div>
</div>
<span v-else>{{ item.object.objectName }}</span>
</div>
<div v-if="new Date(item.eventStartDate) > new Date()" class="event-btns">
<el-button class="default" :size="size" @click="handleEventDelete(index)">删除</el-button>
<el-button class="default-blue-btn" :size="size" @click="handleEventEdit('edit', item, index)">编辑</el-button>
<div v-if="new Date(item.eventStartDate) > new Date() || routeInfo.addOrEdit =='copy'" class="event-btns">
<el-button class="default newBtnSty" :size="size" @click="handleEventDelete(index)">删除</el-button>
<el-tooltip :disabled="!(!editForm.customerInfoList.length || !editForm.sopName)" effect="dark"
content="请先完善sop名称和营销对象" placement="top">
<div>
<el-button class="default-blue-btn" :disabled="!editForm.customerInfoList.length || !editForm.sopName" :size="size" @click="handleEventEdit('edit', item, index)">编辑
</el-button>
</div>
</el-tooltip>
</div>
</div>
</div>
......@@ -97,9 +124,15 @@
<el-button @click="handleCancel" size="medium">取消</el-button>
<el-button type="primary" @click="handleConfirm" size="medium" :loading="loading">提交</el-button>
</GLFooter>
<select-Crowd v-if="isCrowdCustVisible" :dialogVisible="isCrowdCustVisible" :selectedCrowdList="JSON.parse(JSON.stringify(customerDataList[0].list))" @handleCrowdCustClose="handleCrowdCustClose" @handleCrowdCustConfirm="handleDialogConfirm"></select-Crowd>
<select-Crowd v-if="isCrowdCustVisible" :dialogVisible="isCrowdCustVisible"
:selectedCrowdList="JSON.parse(JSON.stringify(customerDataList[0].list))"
@handleCrowdCustClose="handleCrowdCustClose"
@handleCrowdCustConfirm="handleDialogConfirm"></select-Crowd>
<select-tag ref="selectTagForm" @tagSelected="handleDialogConfirm" :dialogVisible="isTagVisible"></select-tag>
<select-customer v-if="isAppointCustVisible" :dialogVisible="isAppointCustVisible" :parentSelectedCustomerList="customerDataList[2].list" @handleAppointCustClose="handleAppointCustClose" @handleAppointCustConfirm="handleDialogConfirm"></select-customer>
<select-customer v-if="isAppointCustVisible" :dialogVisible="isAppointCustVisible"
:parentSelectedCustomerList="customerDataList[2].list"
@handleAppointCustClose="handleAppointCustClose"
@handleAppointCustConfirm="handleDialogConfirm"></select-customer>
</div>
</template>
......@@ -107,6 +140,7 @@
import url from '@/assets/empty.png'
import selectCustomer from './components/selectCustomer'
import selectCrowd from './components/selectCrowd'
export default {
name: 'baseInfo',
data() {
......@@ -188,10 +222,10 @@ export default {
eventList: []
},
editRule: {
sopName: [{ required: true, message: '请输入SOP名称', trigger: 'change' }],
customerOptUpdate: [{ required: true, message: '请选择更新人群', trigger: 'change' }],
customerOptType: [{ required: true, message: '请选择有效对象', trigger: 'change' }],
customerInfoList: [{ required: true, message: '请选择营销对象', trigger: 'change' }]
sopName: [{required: true, message: '请输入SOP名称', trigger: 'change'}],
customerOptUpdate: [{required: true, message: '请选择更新人群', trigger: 'change'}],
customerOptType: [{required: true, message: '请选择有效对象', trigger: 'change'}],
customerInfoList: [{required: true, message: '请选择营销对象', trigger: 'change'}]
},
isEdit: true,
editFormData: [
......@@ -297,7 +331,8 @@ export default {
mounted() {
this.setMinHeight('.sop-base-info')
if (this.routeInfo.addOrEdit == 'edit') {
// this.routeInfo.addOrEdit == 'edit'
if (['edit', 'copy'].includes(this.routeInfo.addOrEdit)) {
this.getInfo()
} else if (this.routeInfo.info) {
this.setCustomer()
......@@ -407,43 +442,75 @@ export default {
},
getInfo() {
this.$apis.sop.getSopInfoDetailApi({ sopId: this.routeInfo.id }).then(res => {
this.editForm = res
this.currentCustomerIdx = this.customerDataList.findIndex(item => item.confId == this.editForm.customerOptType)
this.recoverCustomerList()
this.editForm.customerOptUpdate = this.editForm.customerOptUpdate + ''
// this.editForm.customerInfoList = this.editForm.customerInfoList || []
// this.editForm.customerInfoList.forEach(item => {
// item.id = item.customerId
// })
// this.editForm.customerInfoList.length && this.recoveryCondLimit()
this.editForm.eventList.forEach(item => {
if (item.object) {
item.object.objectId = item.objectId
item.object.objectType = item.objectType
// item.object.objectName = item.object.packageName
item.object.objectName = item.objectName
item.object.additionalType = item.additionalType
}
if (item.additionalType == 4) {
// attType (1文本,2图片,3视频,4链接,5小程序,6附件,7活动)
// attContent 附件内容
// 文字
let txtObj = item.object.attachmentList.find(k => k.attType == 1)
item.object.showTxtContent = txtObj ? txtObj.attContent : ''
// 图片
let imgList = item.object.attachmentList.filter(k => k.attType == 2)
item.object.showImgContent = imgList || []
// 视频
let videoList = item.object.attachmentList.filter(k => k.attType == 3)
item.object.showVideoContent = videoList || []
}
})
this.editDisabled = new Date(this.editForm.startDate) < new Date()
this.editDisabled && this.judgeDisable()
this.$nextTick(() => {
this.editStatus = false
})
this.$apis.sop.getSopInfoDetailApi({sopId: this.routeInfo.id}).then(res => {
if (this.routeInfo.addOrEdit == 'copy') {
this.copyForm = res
this.copyForm.eventList.forEach(item => {
item.eventStartDate = ''
item.eventTime = ''
if (item.object) {
item.object.objectId = item.objectId
item.object.objectType = item.objectType
item.object.objectName = item.objectName
item.object.additionalType = item.additionalType
}
if (item.additionalType == 4) {
// attType (1文本,2图片,3视频,4链接,5小程序,6附件,7活动)
// attContent 附件内容
// 文字
let txtObj = item.object.attachmentList.find(k => k.attType == 1)
item.object.showTxtContent = txtObj ? txtObj.attContent : ''
// 图片
let imgList = item.object.attachmentList.filter(k => k.attType == 2)
item.object.showImgContent = imgList || []
// 视频
let videoList = item.object.attachmentList.filter(k => k.attType == 3)
item.object.showVideoContent = videoList || []
}
})
console.log(this.copyForm.eventList)
this.editForm.eventList = this.copyForm.eventList
this.$nextTick(() => {
this.editStatus = false
})
} else {
this.editForm = res
this.currentCustomerIdx = this.customerDataList.findIndex(item => item.confId == this.editForm.customerOptType)
this.recoverCustomerList()
this.editForm.customerOptUpdate = this.editForm.customerOptUpdate + ''
// this.editForm.customerInfoList = this.editForm.customerInfoList || []
// this.editForm.customerInfoList.forEach(item => {
// item.id = item.customerId
// })
// this.editForm.customerInfoList.length && this.recoveryCondLimit()
this.editForm.eventList.forEach(item => {
if (item.object) {
item.object.objectId = item.objectId
item.object.objectType = item.objectType
// item.object.objectName = item.object.packageName
item.object.objectName = item.objectName
item.object.additionalType = item.additionalType
}
if (item.additionalType == 4) {
// attType (1文本,2图片,3视频,4链接,5小程序,6附件,7活动)
// attContent 附件内容
// 文字
let txtObj = item.object.attachmentList.find(k => k.attType == 1)
item.object.showTxtContent = txtObj ? txtObj.attContent : ''
// 图片
let imgList = item.object.attachmentList.filter(k => k.attType == 2)
item.object.showImgContent = imgList || []
// 视频
let videoList = item.object.attachmentList.filter(k => k.attType == 3)
item.object.showVideoContent = videoList || []
}
})
this.editDisabled = new Date(this.editForm.startDate) < new Date()
this.editDisabled && this.judgeDisable()
this.$nextTick(() => {
this.editStatus = false
})
}
})
},
......@@ -466,18 +533,18 @@ export default {
tagLists: []
}
this.customerDataList[this.currentCustomerIdx].list &&
this.customerDataList[this.currentCustomerIdx].list.forEach(item => {
item.labelList.length &&
item.labelList.forEach(subItem => {
params.tagLists.push({
groupId: item.labelGroup.id,
groupName: item.labelGroup.name,
groupType: item.labelType,
labelId: subItem.id,
labelName: subItem.name
})
})
this.customerDataList[this.currentCustomerIdx].list.forEach(item => {
item.labelList.length &&
item.labelList.forEach(subItem => {
params.tagLists.push({
groupId: item.labelGroup.id,
groupName: item.labelGroup.name,
groupType: item.labelType,
labelId: subItem.id,
labelName: subItem.name
})
})
})
this.$apis.sop.getCustomerByTagListApi(params).then(res => {
this.customerDataList[this.currentCustomerIdx].customerCount = res.count
})
......@@ -648,7 +715,13 @@ export default {
item.isJoin == 1 && this.parentCustomerObj.parentPredictObj.qiwei++
})
}
this.$emit('handleTabChange', { activeName: 'editEvent', addOrEdit: addOrEdit, eventIndex: addOrEdit == 'add' ? '-1' : idx, parentCustomerObj: this.parentCustomerObj, info: { ...row, sopName: this.editForm.sopName } })
this.$emit('handleTabChange', {
activeName: 'editEvent',
addOrEdit: addOrEdit,
eventIndex: addOrEdit == 'add' ? '-1' : idx,
parentCustomerObj: this.parentCustomerObj,
info: {...row, sopName: this.editForm.sopName}
})
},
reqCrowdAttrs() {
......@@ -760,6 +833,7 @@ export default {
}
})
} else {
console.log('1111111')
params.eventList = []
this.editForm.eventList.forEach((item, index) => {
params.eventList.push(JSON.parse(JSON.stringify(item)))
......@@ -784,7 +858,7 @@ export default {
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
this.$tracker.track(Object.assign({},{pageName:'营销SOP',name:'编辑sop事件',params}))
this.$tracker.track(Object.assign({}, {pageName: '营销SOP', name: '编辑sop事件', params}))
if (res.code == '0') {
this.cancelJump()
}
......@@ -797,7 +871,7 @@ export default {
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
this.$tracker.track(Object.assign({},{pageName:'营销SOP',name:'创建sop事件',params}))
this.$tracker.track(Object.assign({}, {pageName: '营销SOP', name: '创建sop事件', params}))
if (res.code == '0') {
this.cancelJump()
}
......@@ -819,10 +893,11 @@ export default {
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.cancelJump()
})
.catch(() => { })
.then(() => {
this.cancelJump()
})
.catch(() => {
})
} else {
this.cancelJump()
}
......@@ -838,6 +913,7 @@ export default {
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
.customer-title {
box-sizing: border-box;
height: 39px;
......@@ -845,6 +921,7 @@ export default {
padding: 0 10px;
// border-bottom: 1px solid #dcdfe6;
}
.input-tag-wrapper {
max-height: 227px;
overflow: auto;
......@@ -860,13 +937,16 @@ export default {
display: flex;
align-items: center;
font-size: 14px;
.el-tag.el-tag--info .el-tag__close {
color: #909399 !important;
background: transparent !important;
}
.customer-tag {
margin: 4px;
}
i {
color: #75acff;
margin-right: 3px;
......@@ -874,50 +954,65 @@ export default {
}
}
}
.event-empty {
height: 234px;
text-align: center;
.empty-img {
margin: 80px 0 12px;
}
.empty-txt {
color: #000000;
font-size: 14px;
opacity: 0.65;
}
}
.event-box {
padding: 32px 20px;
.event-item {
position: relative;
padding: 16px;
background: #f7f7f7;
border: 1px solid rgba(220, 223, 230, 1);
margin-bottom: 20px;
.event-title {
height: 32px;
line-height: 32px;
margin-bottom: 12px;
}
.model-item-img {
width: 90px;
height: 78px;
margin-right: 5px;
}
.event-link {
margin-top: 12px;
display: flex;
align-items: center;
}
.event-content {
line-height: 24px;
}
.event-btns {
position: absolute;
top: 16px;
right: 16px;
display: flex;
.newBtnSty{
margin-right: 8px;
}
}
}
.event-item:last-child {
margin-bottom: 0;
}
......
......@@ -57,6 +57,13 @@ export default {
type: 'input',
isClear: true,
maxlength: 11
},
{
label: '企微名称',
name: 'customerPhone',
type: 'input',
isClear: true,
maxlength: 50
}
],
// 表格
......
......@@ -3,11 +3,16 @@
<div class="edit-event marketing edit-box">
<!-- 营销时间 -->
<div class="container m-b-20">
<p class="edit-title">营销时间</p>
<glsx-combi-form class="edit-form-container m-r-20" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="sopNameFormData" :formRules="editRule"></glsx-combi-form>
<p class="edit-title">营销时间</p> <glsx-combi-form class="edit-form-container m-r-20" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="sopNameFormData" :formRules="editRule"></glsx-combi-form>
<glsx-combi-form ref="editFormRefDate" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="320px" :formRef="editChildRef" :formObj="editForm" :formData="editFormDataDate" :formRules="editRule">
<div slot="eventStartDate" slot-scope="scope">
<el-date-picker class="m-r-20" v-model="editForm[scope.scope.name]" :placeholder="scope.scope.placeholder" :value-format="scope.scope.valueFormat" :clearable="scope.scope.isClear" :picker-options="scope.scope.customPickerOptions" @change="scope.scope.change"></el-date-picker>
<el-date-picker class="m-r-20"
v-model="editForm[scope.scope.name]"
:placeholder="scope.scope.placeholder"
:value-format="scope.scope.valueFormat"
:clearable="scope.scope.isClear"
:picker-options="scope.scope.customPickerOptions"
@change="scope.scope.change"></el-date-picker>
</div>
<div slot="eventTime" slot-scope="scope">
<el-time-picker v-model="editForm[scope.scope.name]" value-format="HH:mm" format="HH:mm" :placeholder="scope.scope.placeholder"></el-time-picker>
......@@ -538,7 +543,7 @@ export default {
},
getInfo() {
this.editForm.eventStartDate = moment(this.editForm.eventStartDate).format('YYYY-MM-DD')
this.editForm.eventStartDate = this.editForm.eventStartDate ? moment(this.editForm.eventStartDate).format('YYYY-MM-DD') : ''
this.editForm.eventEndDate = this.editForm.eventEndDate ? moment(this.editForm.eventEndDate).format('YYYY-MM-DD') : ''
this.previewList = this.editForm.object ? [{ attContent: JSON.parse(JSON.stringify(this.editForm.object)), additionalType: this.editForm.object.additionalType }] : []
this.recoveryRepeat()
......@@ -686,7 +691,8 @@ export default {
},
handleConfirm() {
var countParams = {
console.log(this.editForm.eventStartDate)
let countParams = {
eventStartDate: this.editForm.eventStartDate,
eventEndDate: this.editForm.eventEndDate,
eventTime: this.editForm.eventTime,
......@@ -694,6 +700,7 @@ export default {
repeatMode: this.editForm.repeatMode,
repeatTime: this.editForm.repeatTime
}
console.log(countParams)
if (this.submit) {
return true
}
......@@ -849,4 +856,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -81,6 +81,29 @@ export default {
},
{
type: 'el-button',
name: '查看',
attrs: {
type: 'text'
},
condition: row => {
return row.sopStatus == 3
},
listeners: {
click: this.handleEnd
}
},
{
type: 'el-button',
name: '复制',
attrs: {
type: 'text'
},
listeners: {
click: row => this.handleEdit('copy', row)
}
},
{
type: 'el-button',
name: '编辑',
attrs: {
type: 'text'
......@@ -115,7 +138,7 @@ export default {
{
label: 'SOP名称',
prop: 'sopName',
width: 260,
width: 240,
line: 1
},
{
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!