Commit 9053881b authored by zhengke's avatar zhengke

保存并退出行程

parent b203ccdf
...@@ -233,51 +233,72 @@ const timer = 60 ...@@ -233,51 +233,72 @@ const timer = 60
const Countdown = ref<any>(timer) const Countdown = ref<any>(timer)
const intervalId = ref(null); const intervalId = ref(null);
const showTimer = ref(false); const showTimer = ref(false);
const goType = ref(null)
// 返回到首页 type 1 模版列表页 0 销售在线模版页 // 返回到首页 type 1 模版列表页 0 销售在线模版页
const goBack = (type:any) =>{ const goBack = (type:any) =>{
mainBackVisible.value = false mainBackVisible.value = false
ElMessageBox.confirm( goType.value = type
'退出此页面将清空当前数据,请谨慎操作?', if(model.value==2){
'提示', ElMessageBox.confirm(
{ '退出此页面将清空当前数据,是否保存当前数据,并退出?',
confirmButtonText: '确定', '提示',
cancelButtonText: '取消', {
type: 'warning', confirmButtonText: '保存',
} cancelButtonText: '退出',
).then(() => { type: 'warning',
setNewDatas(type,0) }
mainStore.setToolbarState(ToolbarStates.SLIDE_DESIGN) ).then(() => {
let path ='/'
const t = useSlidesStore().viewportRatio<0?1:2
searchData.value.SalesEditor = null
if(model.value==0) {
path = `/market/op/${ConfigId.value}/${TempType.value}`
router.push({path})
}else if(model.value==2){
if(searchData.value.sellId) { if(searchData.value.sellId) {
clearInterval(intervalId.value); clearInterval(intervalId.value);
intervalId.value = null; intervalId.value = null;
setTemplate(0)
} }
if(type==1) { setTemplate(0,1)
searchData.value.SalesEditor = router.currentRoute.value.params }).catch(() => {
if(searchData.value.sellId)searchData.value.TempId2 = queryObj.value.TempId SaveStroke(type)
marketStore.setMarket(true) })
SalesBackStore.setSalesBack(1)
searchData.value.TempId = 0 }else{
if(searchData.value.sellId) path = `/market/create/${queryObj.value.TemplateType==1?'trip':'ad'}${searchData.value.currentMenu>=0?'/'+searchData.value.currentMenu:''}` ElMessageBox.confirm(
else path = `/market/create` '退出此页面将清空当前数据,请谨慎操作?',
} '提示',
else if(searchData.value.currentMenu>=0) { {
path = `/space/${searchData.value.currentMenu}` confirmButtonText: '确定',
searchData.value.currentMenu = null cancelButtonText: '取消',
}else path = `/space` type: 'warning',
router.push({path}) }
).then(() => {
setNewDatas(type,0)
mainStore.setToolbarState(ToolbarStates.SLIDE_DESIGN)
let path ='/'
const t = useSlidesStore().viewportRatio<0?1:2
searchData.value.SalesEditor = null
if(model.value==0) {
path = `/market/op/${ConfigId.value}/${TempType.value}`
router.push({path})
}else window.history.back()
}).catch(() => {})
} }
else window.history.back()
}).catch(() => {}) }
const SaveStroke = (type:any) => {
let path = ''
if(type==1) {
searchData.value.SalesEditor = router.currentRoute.value.params
if(searchData.value.sellId)searchData.value.TempId2 = queryObj.value.TempId
marketStore.setMarket(true)
SalesBackStore.setSalesBack(1)
searchData.value.TempId = 0
if(searchData.value.sellId) path = `/market/create/${queryObj.value.TemplateType==1?'trip':'ad'}${searchData.value.currentMenu>=0?'/'+searchData.value.currentMenu:''}`
else path = `/market/create`
}
else if(searchData.value.currentMenu>=0) {
path = `/space/${searchData.value.currentMenu}`
searchData.value.currentMenu = null
}else path = `/space`
router.push({path})
} }
// 返回是否清空数据 // 返回是否清空数据
const setNewDatas = (type,i) => { const setNewDatas = (type,i) => {
...@@ -316,25 +337,22 @@ const benginTimer = () => { ...@@ -316,25 +337,22 @@ const benginTimer = () => {
const UpdateItinerary = async () => { const UpdateItinerary = async () => {
if(datas.loading) return if(datas.loading) return
queryObj.value.TempData = JSON.stringify(slides.value) queryObj.value.TempData = JSON.stringify(slides.value)
if(model.value==2&&SalesEditor.value>0&&searchData.value.sellId){ datas.loading = true
datas.loading = true let queryMsg = {
let queryMsg = { Id: searchData.value.sellId,
Id: searchData.value.sellId, Title: queryObj.value.Title,
Title: queryObj.value.Title, TempId: queryObj.value.TempId,
TempId: queryObj.value.TempId, TempData: queryObj.value.TempData,
TempData: queryObj.value.TempData,
}
const result = await ConfigService.SetTripOtherTemp(queryMsg);
if (result.data.resultCode == 1) {
console.log('更新行程数据成功-----')
}
datas.loading = false
} }
const result = await ConfigService.SetTripOtherTemp(queryMsg);
if (result.data.resultCode == 1) {
console.log('更新行程数据成功-----')
}
datas.loading = false
} }
// 销售新增修改行程、广告 // 销售新增修改行程、广告
const SetSellTemplate = async (type:Number,FolderId:Number) => { const SetSellTemplate = async (type:Number,FolderId:Number,sellType:any) => {
if(FolderId>=0) datas.loading = true if(FolderId>=0) datas.loading = true
try { try {
let TempId = 0 let TempId = 0
...@@ -377,7 +395,7 @@ const SetSellTemplate = async (type:Number,FolderId:Number) => { ...@@ -377,7 +395,7 @@ const SetSellTemplate = async (type:Number,FolderId:Number) => {
SalesEditorStore.setSalesEditor(0) SalesEditorStore.setSalesEditor(0)
},100) },100)
if(autoSave.value==1)autoSave.value=2 if(autoSave.value==1)autoSave.value=2
if(type == 0 && Id==0){ if(type == 0 && Id==0 && !sellType){
let FileId = searchData.value.sellId=TemplateRes.data.data.Id let FileId = searchData.value.sellId=TemplateRes.data.data.Id
let FileType = TemplateRes.data.data.FileType?TemplateRes.data.data.FileType:0 let FileType = TemplateRes.data.data.FileType?TemplateRes.data.data.FileType:0
//@TODO:返回字段中缺少CreateBy, //@TODO:返回字段中缺少CreateBy,
...@@ -386,6 +404,8 @@ const SetSellTemplate = async (type:Number,FolderId:Number) => { ...@@ -386,6 +404,8 @@ const SetSellTemplate = async (type:Number,FolderId:Number) => {
path:url path:url
}) })
} }
// 保存并退出当前页
if(sellType) SaveStroke(goType.value)
}else{ }else{
ElMessage({ ElMessage({
showClose: true, showClose: true,
...@@ -535,8 +555,8 @@ const SetTripTemplateConfig = async () => { ...@@ -535,8 +555,8 @@ const SetTripTemplateConfig = async () => {
datas.loading = false datas.loading = false
} }
// 保存 // 保存 type行程另存 sellType行程保存并退出
const setTemplate = async (type) =>{ const setTemplate = async (type:any,sellType:any) =>{
queryObj.value.Title = title.value queryObj.value.Title = title.value
if(SourceLoading.value) setNewDatasList(datas.DataSource) if(SourceLoading.value) setNewDatasList(datas.DataSource)
...@@ -634,6 +654,7 @@ const setTemplate = async (type) =>{ ...@@ -634,6 +654,7 @@ const setTemplate = async (type) =>{
} }
journeyAdsDetails.value = obj journeyAdsDetails.value = obj
isCopyTo.value = true isCopyTo.value = true
if(sellType) await SetSellTemplate(type,0,sellType)
}else{ }else{
datas.loading = true datas.loading = true
await SetSellTemplate(type) await SetSellTemplate(type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment