Commit 9053881b authored by zhengke's avatar zhengke

保存并退出行程

parent b203ccdf
......@@ -233,51 +233,72 @@ const timer = 60
const Countdown = ref<any>(timer)
const intervalId = ref(null);
const showTimer = ref(false);
const goType = ref(null)
// 返回到首页 type 1 模版列表页 0 销售在线模版页
const goBack = (type:any) =>{
mainBackVisible.value = false
ElMessageBox.confirm(
'退出此页面将清空当前数据,请谨慎操作?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).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 if(model.value==2){
goType.value = type
if(model.value==2){
ElMessageBox.confirm(
'退出此页面将清空当前数据,是否保存当前数据,并退出?',
'提示',
{
confirmButtonText: '保存',
cancelButtonText: '退出',
type: 'warning',
}
).then(() => {
if(searchData.value.sellId) {
clearInterval(intervalId.value);
intervalId.value = null;
setTemplate(0)
}
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})
setTemplate(0,1)
}).catch(() => {
SaveStroke(type)
})
}else{
ElMessageBox.confirm(
'退出此页面将清空当前数据,请谨慎操作?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).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) => {
......@@ -316,25 +337,22 @@ const benginTimer = () => {
const UpdateItinerary = async () => {
if(datas.loading) return
queryObj.value.TempData = JSON.stringify(slides.value)
if(model.value==2&&SalesEditor.value>0&&searchData.value.sellId){
datas.loading = true
let queryMsg = {
Id: searchData.value.sellId,
Title: queryObj.value.Title,
TempId: queryObj.value.TempId,
TempData: queryObj.value.TempData,
}
const result = await ConfigService.SetTripOtherTemp(queryMsg);
if (result.data.resultCode == 1) {
console.log('更新行程数据成功-----')
}
datas.loading = false
datas.loading = true
let queryMsg = {
Id: searchData.value.sellId,
Title: queryObj.value.Title,
TempId: queryObj.value.TempId,
TempData: queryObj.value.TempData,
}
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
try {
let TempId = 0
......@@ -377,7 +395,7 @@ const SetSellTemplate = async (type:Number,FolderId:Number) => {
SalesEditorStore.setSalesEditor(0)
},100)
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 FileType = TemplateRes.data.data.FileType?TemplateRes.data.data.FileType:0
//@TODO:返回字段中缺少CreateBy,
......@@ -386,6 +404,8 @@ const SetSellTemplate = async (type:Number,FolderId:Number) => {
path:url
})
}
// 保存并退出当前页
if(sellType) SaveStroke(goType.value)
}else{
ElMessage({
showClose: true,
......@@ -535,8 +555,8 @@ const SetTripTemplateConfig = async () => {
datas.loading = false
}
// 保存
const setTemplate = async (type) =>{
// 保存 type行程另存 sellType行程保存并退出
const setTemplate = async (type:any,sellType:any) =>{
queryObj.value.Title = title.value
if(SourceLoading.value) setNewDatasList(datas.DataSource)
......@@ -634,6 +654,7 @@ const setTemplate = async (type) =>{
}
journeyAdsDetails.value = obj
isCopyTo.value = true
if(sellType) await SetSellTemplate(type,0,sellType)
}else{
datas.loading = true
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