Commit 96b10ed5 by chenwq Committed by 杨北旺

sop编辑

1 parent d720e0ee
...@@ -55,6 +55,19 @@ const parseEventCountApi = params => { ...@@ -55,6 +55,19 @@ const parseEventCountApi = params => {
}) })
} }
// 事件进行中,修改sop事件列表
const insertOrUpdateSopEventApi = params => {
params.method = 'scrm.api.sop.sopEvent.insertOrUpdate'
return http({
url: 'rop-scrm-sop/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 新增或者事件未开始,新增/修改sop
const insertOrUpdateSopApi = params => { const insertOrUpdateSopApi = params => {
params.method = 'scrm.api.sop.sopInfo.insertOrUpdate' params.method = 'scrm.api.sop.sopInfo.insertOrUpdate'
return http({ return http({
...@@ -76,4 +89,4 @@ const getSopInfoDetailApi = params => { ...@@ -76,4 +89,4 @@ const getSopInfoDetailApi = params => {
}) })
} }
export default { getCustomerByTagListApi, getSopInfoListApi, getSopCustomerStatisticsListApi, getSopStaffTaskListApi, parseEventCountApi, insertOrUpdateSopApi, getSopInfoDetailApi } export default { getCustomerByTagListApi, getSopInfoListApi, getSopCustomerStatisticsListApi, getSopStaffTaskListApi, parseEventCountApi, insertOrUpdateSopEventApi, insertOrUpdateSopApi, getSopInfoDetailApi }
...@@ -5,13 +5,15 @@ ...@@ -5,13 +5,15 @@
<div class="container m-b-20"> <div class="container m-b-20">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="320px" :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" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="customerInfoList"> <div slot="customerInfoList" slot-scope="scope">
<el-button class="default-blue-btn" :size="size" @click="handleSelectCustomer">选择客户</el-button> <div v-if="!scope.scope.isDisabled">
<el-button :size="size" @click="handleResetCustomer">重置客户</el-button> <el-button class="default-blue-btn" :size="size" @click="handleSelectCustomer">选择客户</el-button>
<el-button :size="size" @click="handleResetCustomer">重置客户</el-button>
</div>
<div v-show="editForm.customerInfoList.length != 0" class="customer-box m-t-10"> <div v-show="editForm.customerInfoList.length != 0" class="customer-box m-t-10">
<div class="customer-title">{{ condLimitObj.hasQw ? '已加' : '没加' }}企微/{{ condLimitObj.hasPhone ? '有' : '没有' }}手机号:{{ editForm.customerInfoList.length }}人</div> <div class="customer-title">{{ condLimitObj.hasQw ? '已加' : '没加' }}企微/{{ condLimitObj.hasPhone ? '有' : '没有' }}手机号:{{ editForm.customerInfoList.length }}人</div>
<div :key="key" class="el-input-tag input-tag-wrapper"> <div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag v-for="(item, idx) in editForm.customerInfoList" :key="idx" :size="size" type="info" closable :disable-transitions="false" @close="handleDeleteCustomer(idx)"> <el-tag v-for="(item, idx) in editForm.customerInfoList" :key="idx" :size="size" type="info" :closable="!scope.scope.isDisabled" :disable-transitions="false" @close="handleDeleteCustomer(idx)">
<i class="el-icon-user-solid"></i> <i class="el-icon-user-solid"></i>
{{ item.customerName }} {{ item.customerName }}
</el-tag> </el-tag>
...@@ -80,6 +82,7 @@ export default { ...@@ -80,6 +82,7 @@ export default {
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
editStatus: false, editStatus: false,
editDisabled: false,
labelWidth: '144px', labelWidth: '144px',
condLimitObj: { condLimitObj: {
// 1-有;0-无 // 1-有;0-无
...@@ -108,7 +111,8 @@ export default { ...@@ -108,7 +111,8 @@ export default {
label: 'sop名称', label: 'sop名称',
name: 'sopName', name: 'sopName',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20,
isDisabled: false
}, },
{ {
label: '营销时间', label: '营销时间',
...@@ -118,7 +122,8 @@ export default { ...@@ -118,7 +122,8 @@ export default {
{ {
label: '营销对象', label: '营销对象',
name: 'customerInfoList', name: 'customerInfoList',
addHtml: 'customerInfoList' addHtml: 'customerInfoList',
isDisabled: false
} }
], ],
baseData: { baseData: {
...@@ -170,10 +175,19 @@ export default { ...@@ -170,10 +175,19 @@ export default {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
console.log(this.routeInfo) console.log(this.routeInfo)
this.routeInfo.addOrEdit != 'add' ? this.getInfo() : '' if (this.routeInfo.addOrEdit == 'edit') {
this.getInfo()
}
}, },
methods: { methods: {
judgeDisable() {
var list = ['sopName', 'customerInfoList']
list.forEach(item => {
var idx = this.editFormData.findIndex(k => k.name == item)
this.editFormData[idx].isDisabled = this.editDisabled
})
},
getInfo() { getInfo() {
this.$apis.sop.getSopInfoDetailApi({ sopId: this.routeInfo.id }).then(res => { this.$apis.sop.getSopInfoDetailApi({ sopId: this.routeInfo.id }).then(res => {
// this.editForm.sopName = res.sopName // this.editForm.sopName = res.sopName
...@@ -184,6 +198,8 @@ export default { ...@@ -184,6 +198,8 @@ export default {
item.id = item.customerId item.id = item.customerId
}) })
this.editForm.customerInfoList.length && this.recoveryCondLimit() this.editForm.customerInfoList.length && this.recoveryCondLimit()
this.editDisabled = new Date(this.editForm.startDate) < new Date()
this.editDisabled && this.judgeDisable()
this.$nextTick(() => { this.$nextTick(() => {
this.editStatus = false this.editStatus = false
}) })
...@@ -268,29 +284,31 @@ export default { ...@@ -268,29 +284,31 @@ export default {
params.id = this.routeInfo.id params.id = this.routeInfo.id
params.eventList = [] params.eventList = []
this.editForm.eventList.forEach((item, index) => { this.editForm.eventList.forEach((item, index) => {
params.eventList.push({ if (new Date(item.eventStartDate) > new Date()) {
eventContent: item.eventContent, params.eventList.push({
eventCount: item.eventCount, eventContent: item.eventContent,
eventStartDate: item.eventStartDate, eventCount: item.eventCount,
eventTime: item.eventTime, eventStartDate: item.eventStartDate,
pushChannelType: item.pushChannelType, eventTime: item.eventTime,
repeatFlag: item.repeatFlag, pushChannelType: item.pushChannelType,
repeatMode: item.repeatMode, repeatFlag: item.repeatFlag,
sopName: item.sopName, repeatMode: item.repeatMode,
sopId: this.routeInfo.id sopName: item.sopName,
}) sopId: this.routeInfo.id
if (item.id) { })
params.eventList[index].id = item.id if (item.id) {
} params.eventList[index].id = item.id
if (item.repeatFlag == 'Y') { }
params.eventList[index].repeatTime = item.repeatTime if (item.repeatFlag == 'Y') {
params.eventList[index].eventEndDate = item.eventEndDate params.eventList[index].repeatTime = item.repeatTime
} params.eventList[index].eventEndDate = item.eventEndDate
if (item.object) { }
params.eventList[index].objectId = item.object.objectId if (item.object) {
params.eventList[index].additionalType = item.object.additionalType params.eventList[index].objectId = item.object.objectId
params.eventList[index].objectType = item.object.objectType params.eventList[index].additionalType = item.object.additionalType
delete params.eventList[index].object params.eventList[index].objectType = item.object.objectType
delete params.eventList[index].object
}
} }
}) })
} else { } else {
...@@ -306,15 +324,30 @@ export default { ...@@ -306,15 +324,30 @@ export default {
}) })
} }
console.log(params) console.log(params)
this.$apis.sop.insertOrUpdateSopApi(params).then(res => { // var apiName = this.editDisabled ? 'insertOrUpdateSopEventApi' : 'insertOrUpdateSopApi'
this.$message({ if (this.editDisabled) {
message: res.code == '0' ? '操作成功' : '操作失败', // 事件进行时
type: res.code == '0' ? 'success' : 'error' this.$apis.sop.insertOrUpdateSopEventApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.cancelJump()
}
}) })
if (res.code == '0') { } else {
this.cancelJump() // 新增/事件未开始,调这里
} this.$apis.sop.insertOrUpdateSopApi(params).then(res => {
}) this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.cancelJump()
}
})
}
} }
}) })
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!