|
@@ -857,25 +857,78 @@ var vm = new Vue({
|
|
|
|
|
|
this.analysis.loaded = false
|
|
|
this.analysis.loading = true
|
|
|
- this.showLoading()
|
|
|
-
|
|
|
+ var loading = this.showLoading()
|
|
|
+ /*
|
|
|
+ 1.如该用户当前身份下存在“生成中”的报告 则弹框提示报告生成中等等。。。
|
|
|
+ 2.该用户不存在“生成中”的报告,且该报告需要离线生成
|
|
|
+ 2-1:【消息-服务通知】APP、微信提醒均未开启 则弹框提示去开启
|
|
|
+ 2-2:【消息-服务通知】APP或微信提醒已开启 则弹框提示我知道了
|
|
|
+ */
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/bigmember/marketAnalysis/doAnalysis',
|
|
|
data: query,
|
|
|
success: function (res) {
|
|
|
+ loading.clear()
|
|
|
if (res && res.error_code === 0 && res.data) {
|
|
|
- this.rid = res.data
|
|
|
- this.analysis.loaded = true
|
|
|
- // location.replace('./report_analysis?id=' + res.data)
|
|
|
- this.rid = res.data
|
|
|
- history.replaceState({}, null, '?id=' + this.rid)
|
|
|
- this.getReportResult()
|
|
|
+ // id:报告id
|
|
|
+ // msgOpen:微信或APP提醒是否打开(离线生成时会返回该字段)
|
|
|
+ // status:0-在线生成 走原逻辑 1-离线生成 (判断msgOpen出提示文案) 2-存在正在生成的报告(需要出弹出提示,由用户确认,id为需要取消的报告id,如果用户确认,则传该id调用取消接口后再次调用分析接口)
|
|
|
+ if (res.data.status === 0) {
|
|
|
+ this.rid = res.data.id
|
|
|
+ this.analysis.loaded = true
|
|
|
+ // location.replace('./report_analysis?id=' + res.data)
|
|
|
+ this.rid = res.data.id
|
|
|
+ history.replaceState({}, null, '?id=' + this.rid)
|
|
|
+ this.getReportResult()
|
|
|
+ } else if (res.data.status === 1) {
|
|
|
+ return this.showDialog({
|
|
|
+ allowHtml: true,
|
|
|
+ title: '报告生成中',
|
|
|
+ message: res.data.msgOpen ? '由于您的分析内容较多,报告正在努力生成中,生成成功后将会通过微信、APP给您发送1消息通知,届时您再前往查看此报告。' : '由于您的分析内容较多,报告正在努力生成中。建议您前往开启“<span class="highlight-text">消息-服务通知</span>”提醒,报告生成成功后可通过微信或APP给您发送1消息通知,届时您可前往查看此报告。',
|
|
|
+ className: 'j-confirm-dialog text-justify',
|
|
|
+ showCancelButton: !res.data.msgOpen,
|
|
|
+ confirmButtonText: res.data.msgOpen ? '我知道了' : '去开启',
|
|
|
+ cancelButtonText: res.data.msgOpen ? '' : '暂不开启',
|
|
|
+ beforeClose: (action, done) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ if (!res.data.msgOpen) {
|
|
|
+ // 去开启 进到推送设置页面
|
|
|
+ location.href = '/jy_mobile/push/pushsetting'
|
|
|
+ } else {
|
|
|
+ // 我知道了 回到历史报告页面
|
|
|
+ this.goToAnalysisHistory()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 暂不开启 回到历史报告页面
|
|
|
+ this.goToAnalysisHistory()
|
|
|
+ }
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (res.data.status === 2) {
|
|
|
+ return this.showDialog({
|
|
|
+ title: '报告生成确认',
|
|
|
+ message: '您有1份报告正在“生成中”,请确定是否按照此条件重新生成,注:如确定则原状态为“生成中”的报告将被自动取消。',
|
|
|
+ className: 'j-confirm-dialog text-justify',
|
|
|
+ beforeClose: (action, done) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ this.reportCancel(res.data.id)
|
|
|
+ done()
|
|
|
+ } else {
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
+ loading.clear()
|
|
|
this.$toast(res.error_msg)
|
|
|
}
|
|
|
}.bind(this),
|
|
|
complete: function () {
|
|
|
+ loading.clear()
|
|
|
this.analysis.loading = false
|
|
|
}.bind(this)
|
|
|
})
|
|
@@ -2097,6 +2150,27 @@ var vm = new Vue({
|
|
|
location.href = `./unit_portrayal?entName=${id}`
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ // 报告取消
|
|
|
+ reportCancel: function (id) {
|
|
|
+ var _this = this
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: '/bigmember/marketAnalysis/cancel',
|
|
|
+ data: {
|
|
|
+ rid: id
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ if (res.data) {
|
|
|
+ _this.startAnalysis()
|
|
|
+ } else {
|
|
|
+ _this.showToast(res.error_msg)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ console.error(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
})
|