Commit 16537306 by chenwq

fix(报表): 根据用户角色动态选择产值数据源并优化编辑状态判断

移除调试用的console.log语句
根据用户类型和角色动态选择valueObj或ortherValueObj作为数据源
简化编辑状态判断逻辑,仅当后端允许提交时才开放编辑
1 parent 352f4b6b
...@@ -2,26 +2,34 @@ ...@@ -2,26 +2,34 @@
export const reportFirstAutoObj = { export const reportFirstAutoObj = {
/** 1.1轻改区域日报模版 */ /** 1.1轻改区域日报模版 */
'qinggai-temp-001': { 'qinggai-temp-001': {
/** 精品升级 - 角色 userInfo.userType == 2 && !(userInfo.isSuper|| userInfo.loginRole ==3),取值valueObj
* 精品升级 - 其余角色,取值valueObj
* 权益 - 取值valueObj
* */
list: [{ list: [{
attrName: 'todayRegionalTotalOutput', attrName: 'todayRegionalTotalOutput',
// 今日产值 // 今日产值
valueObj: 'staffTodayTotal' valueObj: 'staffTodayTotal',
ortherValueObj: 'merchantTodayTotal',
}, { }, {
attrName: 'monthRegionalTotalOutput', attrName: 'monthRegionalTotalOutput',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
}] ortherValueObj: 'merchantMonthTotal',
}],
}, },
/** 2.3延保区域日报模版 */ /** 2.3延保区域日报模版 */
'uuid-temp-001': { 'uuid-temp-001': {
list: [{ list: [{
attrName: 'dailyCumulativeAchievement', attrName: 'dailyCumulativeAchievement',
// 今日产值 // 今日产值
valueObj: 'staffTodayTotal' valueObj: 'staffTodayTotal',
ortherValueObj: 'merchantTodayTotal',
}, { }, {
attrName: 'monthlyCumulativeAchievement', attrName: 'monthlyCumulativeAchievement',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.1权益区域日报模版 */ /** 2.1权益区域日报模版 */
...@@ -29,11 +37,13 @@ export const reportFirstAutoObj = { ...@@ -29,11 +37,13 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'dailyCumulativeAchievement', attrName: 'dailyCumulativeAchievement',
// 今日产值 // 今日产值
valueObj: 'staffTodayTotal' valueObj: 'staffTodayTotal',
ortherValueObj: 'merchantTodayTotal',
}, { }, {
attrName: 'monthlyCumulativeAchievement', attrName: 'monthlyCumulativeAchievement',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.1区域经理周报模版 */ /** 2.1区域经理周报模版 */
...@@ -41,7 +51,8 @@ export const reportFirstAutoObj = { ...@@ -41,7 +51,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'monthlyStoreCumulativeAchievement012', attrName: 'monthlyStoreCumulativeAchievement012',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 1.1区域经理周报模版 */ /** 1.1区域经理周报模版 */
...@@ -49,7 +60,8 @@ export const reportFirstAutoObj = { ...@@ -49,7 +60,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'monthlyStoreCumulativeAchievement013', attrName: 'monthlyStoreCumulativeAchievement013',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.3区域经理周报模版 */ /** 2.3区域经理周报模版 */
...@@ -57,7 +69,8 @@ export const reportFirstAutoObj = { ...@@ -57,7 +69,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'monthlyStoreCumulativeAchievement014', attrName: 'monthlyStoreCumulativeAchievement014',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.1运营主管周报模版 */ /** 2.1运营主管周报模版 */
...@@ -65,7 +78,8 @@ export const reportFirstAutoObj = { ...@@ -65,7 +78,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'monthlyOutput015', attrName: 'monthlyOutput015',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 1.1运营主管周报模版 */ /** 1.1运营主管周报模版 */
...@@ -73,7 +87,8 @@ export const reportFirstAutoObj = { ...@@ -73,7 +87,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'monthlyOutput016', attrName: 'monthlyOutput016',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.3运营主管周报模版 */ /** 2.3运营主管周报模版 */
...@@ -81,7 +96,8 @@ export const reportFirstAutoObj = { ...@@ -81,7 +96,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'monthlyOutput017', attrName: 'monthlyOutput017',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 1.1区域经理月报模版 */ /** 1.1区域经理月报模版 */
...@@ -89,7 +105,8 @@ export const reportFirstAutoObj = { ...@@ -89,7 +105,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'actualAchievement018', attrName: 'actualAchievement018',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.1区域经理月报模版 */ /** 2.1区域经理月报模版 */
...@@ -97,7 +114,8 @@ export const reportFirstAutoObj = { ...@@ -97,7 +114,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'actualAchievement019', attrName: 'actualAchievement019',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.3区域经理月报模版 */ /** 2.3区域经理月报模版 */
...@@ -105,7 +123,8 @@ export const reportFirstAutoObj = { ...@@ -105,7 +123,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'actualAchievement020', attrName: 'actualAchievement020',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.1运营主管月报模版 */ /** 2.1运营主管月报模版 */
...@@ -113,7 +132,8 @@ export const reportFirstAutoObj = { ...@@ -113,7 +132,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'monthlyOutput021', attrName: 'monthlyOutput021',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 1.1运营主管月报模版 */ /** 1.1运营主管月报模版 */
...@@ -121,7 +141,8 @@ export const reportFirstAutoObj = { ...@@ -121,7 +141,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'monthlyOutput022', attrName: 'monthlyOutput022',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
}, },
/** 2.3运营主管月报模版 */ /** 2.3运营主管月报模版 */
...@@ -129,7 +150,8 @@ export const reportFirstAutoObj = { ...@@ -129,7 +150,8 @@ export const reportFirstAutoObj = {
list: [{ list: [{
attrName: 'monthlyOutput023', attrName: 'monthlyOutput023',
// 本月产值 // 本月产值
valueObj: 'staffMonthTotal' valueObj: 'staffMonthTotal',
ortherValueObj: 'merchantMonthTotal',
}] }]
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -87,15 +87,12 @@ Page({ ...@@ -87,15 +87,12 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
console.log(options, "-----");
const { titleTxtObj } = this.data; const { titleTxtObj } = this.data;
if (options.refresh) { if (options.refresh) {
const { routeParams } = this.data; const { routeParams } = this.data;
console.log(routeParams, "----");
this.initData(options); this.initData(options);
} }
wx.$router.getData((route) => { wx.$router.getData((route) => {
console.log(route, "route");
const routeParams = route?.params || {}; const routeParams = route?.params || {};
this.setData({ this.setData({
routeParams: routeParams, routeParams: routeParams,
...@@ -125,10 +122,15 @@ Page({ ...@@ -125,10 +122,15 @@ Page({
let { code, data } = result; let { code, data } = result;
if (code == 0) { if (code == 0) {
const needDefaultCodeList = Object.keys(reportFirstAutoObj); const needDefaultCodeList = Object.keys(reportFirstAutoObj);
const valBaseRole =
userInfo.userType == 2 &&
!(userInfo.isSuper || userInfo.loginRole == 3)
? "valueObj"
: "ortherValueObj";
if (needDefaultCodeList.includes(routeParams.code)) { if (needDefaultCodeList.includes(routeParams.code)) {
reportFirstAutoObj[routeParams.code]?.list.forEach((item) => { reportFirstAutoObj[routeParams.code]?.list.forEach((item) => {
tmlpFormData[item.attrName] = tmlpFormData[item.attrName] =
data[item.valueObj].totalOrderMoney + ""; data[item[valBaseRole]].totalOrderMoney + "";
}); });
this.setData( this.setData(
{ {
...@@ -503,11 +505,8 @@ Page({ ...@@ -503,11 +505,8 @@ Page({
updates.hasDailyValue = true; updates.hasDailyValue = true;
// If submitted and can be submitted (editable), allow modify // If submitted and can be submitted (editable), allow modify
// Prioritize beAbleSubmit from API // Prioritize beAbleSubmit from API
if (currentMonthData.beAbleSubmit === true) { // 已提交状态下,仅当后端允许再次提交时才开放编辑
updates.isTodayEdit = true; updates.isTodayEdit = currentMonthData.beAbleSubmit === true;
} else {
updates.isTodayEdit = false;
}
} else { } else {
// Disable if future (disabled) OR if API says not able to submit // Disable if future (disabled) OR if API says not able to submit
let disable = currentMonthData.disabled; let disable = currentMonthData.disabled;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!