Commit 68ecc4af by zhangxw

自测跑流程修改

1 parent 9a6ca7b4
......@@ -12,10 +12,18 @@ module.exports = {
getDashboardData(data) {
return api.post('dj.api.supervisor.dashboard.data', data, [], '/rop-dj-supervisor-mini/router')
},
// 获取业绩AI分析结果
getDashboardAIResult(data) {
return api.post('dj.api.supervisor.dashboard.data.ai', data, [], '/rop-dj-supervisor-mini/router')
},
// 获取行为维度排行数据
getDashboardBehavior(data) {
return api.post('dj.api.supervisor.dashboard.behavior', data, [], '/rop-dj-supervisor-mini/router')
},
// 获取行为AI分析结果
getBehaviorAIResult(data) {
return api.post('dj.api.supervisor.dashboard.behavior.ai', data, [], '/rop-dj-supervisor-mini/router')
},
// 获取培训维度排行数据
getTrainingStaffList(data) {
return api.post('dj.api.supervisor.mini.team.all.employee.training.info', data, [], '/rop-dj-supervisor-mini/router')
......
......@@ -6,7 +6,15 @@ Component({
* 组件的属性列表
*/
properties: {
AIContent: String
AIContent: {
type: String,
observer: function(val) {
this.setData({
unfoldFlag: false
})
}
},
loading: Boolean
},
/**
......
{
"component": true,
"usingComponents": {}
"usingComponents": {
"van-loading": "@vant/weapp/loading/index"
}
}
\ No newline at end of file
......@@ -7,13 +7,20 @@
</view>
<view class="right" wx:if="{{AIContent}}" bindtap="changeUnfold">{{unfoldFlag ? '收起' : '展开'}}<image class="icon {{unfoldFlag ? 'up' : ''}}" src="{{IMG_URL}}gray-arrow-down.png" mode=""/></view>
</view>
<block wx:if="{{AIContent}}">
<view class="content {{!unfoldFlag ? 'unfold' : ''}}">{{AIContent}}</view>
</block>
<block wx:else>
<view class="empty-data">
<image src="{{IMG_URL}}empty-data.png" mode=""/>
暂无数据
<block wx:if="{{loading}}">
<view style="width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;">
<van-loading type="spinner" color="#2C66F7" />
</view>
</block>
<block wx:else>
<block wx:if="{{AIContent}}">
<view class="content {{!unfoldFlag ? 'unfold' : ''}}">{{AIContent}}</view>
</block>
<block wx:else>
<view class="empty-data">
<image src="{{IMG_URL}}empty-data.png" mode=""/>
暂无数据
</view>
</block>
</block>
</view>
\ No newline at end of file
......@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd";
* 4预发布
* 5cdptest
*/
let index = 1;
let index = 2;
const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion;
......
......@@ -255,7 +255,7 @@ Page({
storeManagerName: orderObj.storeManagerName,
storeManagerPhone: orderObj.storeManagerPhone,
taskContext: orderObj.taskContext,
courseList: orderObj.courseList?.map(val => {return {bcCourseId: val.courseId}}),
courseList: orderObj.courseList?.map(val => {return {bcCourseId: val.courseId, bcCourseName: val.title}}),
imageList: orderObj.imageList
}
wx.$util.showLoading()
......
......@@ -11,6 +11,9 @@ Component({
selectedMerchantObj: {
type: Object
},
merchantList: {
type: Array
},
initTimeDimension: {
type: Number,
value: -1
......@@ -162,16 +165,26 @@ Component({
this.triggerEvent('changeMerchant')
},
handleChangeMerchant(e) {
let merchantId = 123
let { merchantList, selectedMerchantObj } = this.data
this.setData({
showSelectPopup: true,
selectOptions: [{merchantId: 123, merchantName: '明明4s店1'}],
selectValue: [merchantId]
selectOptions: merchantList,
selectValue: selectedMerchantObj.merchantId ? [selectedMerchantObj.merchantId] : []
})
},
handlePopupConfirm(e) {
let { values, items } = e.detail
console.log(values)
let { items } = e.detail
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
selectedMerchantObj: {
merchantId: items[0].merchantId,
merchantName: items[0]?.merchantName,
employeeId: items[0].employeeId
}
}, () => {
this.getData()
})
this.hideSelectPopup()
},
hideSelectPopup() {
......
......@@ -250,6 +250,9 @@ Component({
selectedMerchantObj: {
type: Object
},
merchantList: {
type: Array
},
initTimeDimension: {
type: Number,
value: -1
......@@ -476,6 +479,8 @@ Component({
merchantName: items[0]?.merchantName,
employeeId: items[0].employeeId
}
}, () => {
this.refreshViewModel()
})
this.hideSelectPopup()
},
......
......@@ -147,6 +147,7 @@ Page({
},
getPersonAIData(options) {
this.setData({AILoading: true})
api.getAIAnslyseData({
type: 4,
timeDimension: options.timeDimension,
......@@ -154,12 +155,15 @@ Page({
startDate: options.startDate,
endDate: options.endDate
}).then(res => {
this.setData({AILoading: false})
let { code, data, message } = res
if (code == 0) {
this.setData({AIContent: data?.aiGenerateResult || ''})
} else {
wx.$util.showToast(message)
}
}).catch(() => {
this.setData({AILoading: false})
})
},
......
......@@ -11,7 +11,7 @@
<view class="bg"></view>
<scroll-view class="container" scroll-y style="margin-top: {{navBarHeight}}px;height: calc(100vh - {{navBarHeight}}px);">
<view style="width: 100%;height: 8rpx;"></view>
<AI-analyse AIContent="{{AIContent}}" />
<AI-analyse AIContent="{{AIContent}}" loading="{{AILoading}}" />
<view class="content">
<view class="top-box">
<view class="name">
......@@ -37,7 +37,7 @@
<view class="tab-content">
<basic-info wx:if="{{tabIndex === 0}}" baseInfo="{{baseInfo}}" />
<personal-performance wx:if="{{tabIndex === 1}}" detailInfo="{{detailInfo}}" merchantList="{{merchantList}}" selectedMerchantObj="{{selectedMerchantObj}}" bindpopupvisible="onDatePopupVisible" binddatesave="onDateSave" initTimeDimension="{{personalPerformanceDate.timeDimension}}" initStartDate="{{personalPerformanceDate.startDate}}" initEndDate="{{personalPerformanceDate.endDate}}" />
<behavior-analysis wx:if="{{tabIndex === 2}}" detailInfo="{{detailInfo}}" selectedMerchantObj="{{selectedMerchantObj}}" bindpopupvisible="onDatePopupVisible" binddatesave="onDateSave" initTimeDimension="{{behaviorAnalysisDate.timeDimension}}" initStartDate="{{behaviorAnalysisDate.startDate}}" initEndDate="{{behaviorAnalysisDate.endDate}}" />
<behavior-analysis wx:if="{{tabIndex === 2}}" detailInfo="{{detailInfo}}" merchantList="{{merchantList}}" selectedMerchantObj="{{selectedMerchantObj}}" bindpopupvisible="onDatePopupVisible" binddatesave="onDateSave" initTimeDimension="{{behaviorAnalysisDate.timeDimension}}" initStartDate="{{behaviorAnalysisDate.startDate}}" initEndDate="{{behaviorAnalysisDate.endDate}}" />
<training-experience id="training" wx:if="{{tabIndex === 3}}" detailInfo="{{detailInfo}}" bindpopupvisible="onDatePopupVisible" binddatesave="onDateSave" initTimeDimension="{{trainingExperienceDate.timeDimension}}" initStartDate="{{trainingExperienceDate.startDate}}" initEndDate="{{trainingExperienceDate.endDate}}" />
<view style="width: 100%;height: 200rpx;"></view>
</view>
......
......@@ -101,10 +101,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.getAIAnalyse()
this.getEmployeeRank()
if (this.data.tabIndex == 2) { // 获取培训AI分析结果
this.getAIAnalyse()
}
},
formatThousands (v) {
......@@ -137,6 +135,7 @@ Page({
const sortComp = this.selectComponent('#employee-ranking')
if (sortComp) sortComp.initLoad()
setTimeout(() => {
this.getAIAnalyse()
this.getEmployeeRank()
})
})
......@@ -152,6 +151,7 @@ Page({
this.setData({
sceneTabIndex: index
}, () => {
this.getAIAnalyse()
this.getEmployeeRank()
})
},
......@@ -172,37 +172,51 @@ Page({
endStr: e.detail.endDay?.replace(/\//g, '-'),
timeDimension: e.detail.timeDimension
})
if (this.data.tabIndex == 2) { // 获取培训AI分析结果
this.getAIAnalyse()
}
this.getAIAnalyse()
this.getEmployeeRank()
},
getAIAnalyse() {
let { startStr, endStr, timeDimension, tabIndex } = this.data
api.getAIAnslyseData({
let { startStr, endStr, timeDimension, tabIndex, sceneTabIndex } = this.data
const apievents = ['getDashboardAIResult', 'getBehaviorAIResult', 'getAIAnslyseData']
let params = tabIndex == 2 ? {
type: tabIndex + 1,
timeDimension: timeDimension,
startDate: startStr,
endDate: endStr
}).then(res => {
} : {
bizs: sceneTabIndex > 0 ? sceneMaps[sceneTabIndex] : undefined,
dateType: timeDimension,
startDate: startStr,
endDate: endStr
}
this.setData({AILoading: true})
api[apievents[tabIndex]](params).then(res => {
this.setData({AILoading: false})
let { code, data, message } = res
if (code == 0) {
this.setData({
AIContent: data?.aiGenerateResult ? `${JSON.parse(data?.aiGenerateResult).current_analysis}${JSON.parse(data?.aiGenerateResult).suggestions}` : '',
})
if (tabIndex == 2) {
this.setData({
AIContent: data?.aiGenerateResult ? `${JSON.parse(data?.aiGenerateResult).current_analysis}${JSON.parse(data?.aiGenerateResult).suggestions}` : '',
})
} else {
this.setData({
AIContent: data?.aiAnalysisSuggestion ? `${JSON.parse(data?.aiAnalysisSuggestion).current_analysis}${JSON.parse(data?.aiAnalysisSuggestion).suggestions}` : '',
})
}
} else {
wx.$util.showToast(message)
}
}).catch(() => {
this.setData({AILoading: false})
})
},
getEmployeeRank() {
getEmployeeRank(noAI) {
let { tabIndex, sceneTabIndex, startStr, endStr, sortField, sortOrder, timeDimension } = this.data
this.setData({
AIContent: '',
employeeList: []
})
const event = ['getDashboardData', 'getDashboardBehavior', 'getTrainingStaffList']
let params = tabIndex == 2 ? {
businessType: sceneTabIndex > 0 ? sceneMaps[sceneTabIndex] : undefined,
startDate: startStr,
......@@ -230,14 +244,12 @@ Page({
switch(tabIndex) {
case 0:
this.setData({
AIContent: `${JSON.parse(data?.aiAnalysisSuggestion).current_analysis}${JSON.parse(data?.aiAnalysisSuggestion).suggestions}`,
staticData: data?.metrics,
employeeList: data?.employeeList || []
})
break
case 1:
this.setData({
AIContent: `${JSON.parse(data?.aiAnalysisSuggestion).current_analysis}${JSON.parse(data?.aiAnalysisSuggestion).suggestions}`,
staticData: data?.metrics,
employeeList: data?.employeeList || []
})
......@@ -253,8 +265,6 @@ Page({
} else {
wx.$util.showToast(message)
}
}).catch(() => {
wx.$util.hideLoading()
})
},
// 跳转员工个人看板
......
......@@ -29,7 +29,7 @@
<view class="value">{{staticData[item.key]}}</view>
</view>
</view>
<AI-analyse AIContent="{{AIContent}}" />
<AI-analyse AIContent="{{AIContent}}" loading="{{AILoading}}" />
<employee-ranking
id="employee-ranking"
title-icon="{{IMG_URL}}staff-rank.png"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!