Commit 0d1d08b0 by 李伟康

fix(dailyReport): 修复日报模块中的多个问题并优化功能

- 修改环境配置中默认索引值从1调整为2
- 移除所有API调用中的第三个参数false和'ip'配置
- 修正getMonthlyPendingCount方法的API端点名称拼写错误
- 在入口组件中添加页面事件追踪代码
- 修复日期切换逻辑中的条件判断错误
- 重构退出拦截提示框的实现方式
- 添加日期变更前的检查和确认流程
- 优化门店日报编辑页面的数据获取和展示逻辑
- 更新员工选择弹窗的配置映射关系
1 parent 4771a714
...@@ -35,7 +35,7 @@ const getReportList = async (data = {}) => { ...@@ -35,7 +35,7 @@ const getReportList = async (data = {}) => {
method: 'dj.api.smartcarlife.dailyReport.weekly.list', method: 'dj.api.smartcarlife.dailyReport.weekly.list',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}, false, 'ip') })
} }
/** /**
查询日报详情 查询日报详情
...@@ -45,7 +45,7 @@ const getReportDetail = async (data = {}) => { ...@@ -45,7 +45,7 @@ const getReportDetail = async (data = {}) => {
method: 'dj.api.smartcarlife.dailyReport.detail.get', method: 'dj.api.smartcarlife.dailyReport.detail.get',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}, false, 'ip') })
} }
/** /**
是否需要新版本日报填报 是否需要新版本日报填报
...@@ -56,17 +56,17 @@ const isNewVersionNeed = async (data = {}) => { ...@@ -56,17 +56,17 @@ const isNewVersionNeed = async (data = {}) => {
method: 'dj.api.smartcarlife.dailyReport.new.version.isNeed', method: 'dj.api.smartcarlife.dailyReport.new.version.isNeed',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}, false, 'ip') })
} }
/** /**
查询门店日报本月待邀约数 查询门店日报本月待邀约数
*/ */
const getMonthlyPendingCount = async (data = {}) => { const getMonthlyPendingCount = async (data = {}) => {
return http.post({ return http.post({
method: 'dj.api.smartcarlife.dailyReport.monthly.pending.count', method: 'dj.api.smartcarlife.dailyReport.monthly.pending.get',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}, false, 'ip') })
} }
/** /**
查询洽谈明细驻店人员名单 查询洽谈明细驻店人员名单
...@@ -76,7 +76,7 @@ const getDiscussionStaffList = async (data = {}) => { ...@@ -76,7 +76,7 @@ const getDiscussionStaffList = async (data = {}) => {
method: 'dj.api.smartcarlife.dailyReport.discussion.staff.list', method: 'dj.api.smartcarlife.dailyReport.discussion.staff.list',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}, false, 'ip') })
} }
/** /**
日报草稿数据保存 日报草稿数据保存
...@@ -86,7 +86,7 @@ const saveDraft = async (data = {}) => { ...@@ -86,7 +86,7 @@ const saveDraft = async (data = {}) => {
method: 'dj.api.smartcarlife.dailyReport.dynamic.draft.save', method: 'dj.api.smartcarlife.dailyReport.dynamic.draft.save',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}, false, 'ip') })
} }
/** /**
日报数据提交 日报数据提交
...@@ -96,7 +96,7 @@ const submitReport = async (data = {}) => { ...@@ -96,7 +96,7 @@ const submitReport = async (data = {}) => {
method: 'dj.api.smartcarlife.dailyReport.dynamic.save', method: 'dj.api.smartcarlife.dailyReport.dynamic.save',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}, false, 'ip') })
} }
/** /**
* 当前门店驻店人员在选中成交日期交付的延保及权益订单 * 当前门店驻店人员在选中成交日期交付的延保及权益订单
...@@ -106,7 +106,7 @@ const getGoodsOrderList = async (data = {}) => { ...@@ -106,7 +106,7 @@ const getGoodsOrderList = async (data = {}) => {
method: 'dj.api.smartcarlife.goodsOrder.product.outputValue.list', method: 'dj.api.smartcarlife.goodsOrder.product.outputValue.list',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}, false, 'ip') })
} }
module.exports = { module.exports = {
......
...@@ -173,7 +173,7 @@ export default { ...@@ -173,7 +173,7 @@ export default {
label: '门店日报', label: '门店日报',
name: 'storeDailyReport', name: 'storeDailyReport',
page: '/pages/common/dailyNewspaper/index', page: '/pages/common/dailyNewspaper/index',
// sceneType: [0, 1], eventCode: 'store_daily_report_page',
noInterception: true noInterception: true
}, },
{ {
...@@ -181,7 +181,7 @@ export default { ...@@ -181,7 +181,7 @@ export default {
name: 'NegotiationDetail', name: 'NegotiationDetail',
label: '洽谈明细', label: '洽谈明细',
page: '/pages/common/dailyNewspaper/index', page: '/pages/common/dailyNewspaper/index',
// sceneType: [0, 1], eventCode: 'negotiation_detail_page',
noInterception: true noInterception: true
}, },
] ]
...@@ -189,9 +189,10 @@ export default { ...@@ -189,9 +189,10 @@ export default {
let userInfo = uni.$storage.get('userInfo'), let userInfo = uni.$storage.get('userInfo'),
{ sceneType, shopMerchantId } = userInfo, { sceneType, shopMerchantId } = userInfo,
newReport = await this.isNewVersionNeed(shopMerchantId) newReport = await this.isNewVersionNeed(shopMerchantId)
if (!newReport && sceneType != 7) { if (newReport && sceneType != 7) {
entranceList[0].name = 'staffDailyReport' entranceList[0].name = 'staffDailyReport'
entranceList[0].page = '/pages/common/dailyNewspaper/index' entranceList[0].page = '/pages/common/dailyNewspaper/index'
entranceList[0].eventCode = 'staff_daily_report_page'
entranceList.map(e => { entranceList.map(e => {
if (['storeDailyReport', 'NegotiationDetail'].includes(e.name)) e.sceneType = [0, 1] if (['storeDailyReport', 'NegotiationDetail'].includes(e.name)) e.sceneType = [0, 1]
}) })
......
...@@ -795,6 +795,7 @@ export default { ...@@ -795,6 +795,7 @@ export default {
this.checkVersion() this.checkVersion()
}, },
async entranceClick (item) { async entranceClick (item) {
if(item.eventCode) uni.$track.add({ eventCode: item.eventCode })
// 清除评估单的图片视频资源缓存 // 清除评估单的图片视频资源缓存
const { sceneType } = this const { sceneType } = this
if (!item.noInterception) { if (!item.noInterception) {
......
const target = ['ip', 'dev', 'uat', 'prod', 'beta'] const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1 const index = 2
/** /**
* *
0本地 0本地
......
...@@ -109,11 +109,13 @@ import DailyPopup from '../components/DailyPopup/index.vue' ...@@ -109,11 +109,13 @@ import DailyPopup from '../components/DailyPopup/index.vue'
export default { export default {
name: 'StoreDailyReport', name: 'StoreDailyReport',
components: { Table, Nothing, Footer, EditForm, FormItem, DailyPopup }, components: { Table, Nothing, Footer, EditForm, FormItem, DailyPopup },
inject: ['userInfo'],
props: { props: {
templateData: { templateData: {
type: Array, type: Array,
default: () => [] default: () => []
} },
reportDate: String
}, },
data () { data () {
return { return {
...@@ -135,8 +137,10 @@ export default { ...@@ -135,8 +137,10 @@ export default {
} }
}, },
mounted () { mounted () {
this.getMonthlyPendingCount()
}, },
methods: { methods: {
itemShow (i) { itemShow (i) {
if (i.rules) { if (i.rules) {
let { keys, result } = i.rules, let { keys, result } = i.rules,
...@@ -215,14 +219,31 @@ export default { ...@@ -215,14 +219,31 @@ export default {
onPopupConfirm (data) { onPopupConfirm (data) {
console.log(data) console.log(data)
const { popupType, chooseContent, itemIndex } = data const { popupType, chooseContent, itemIndex } = data
if (popupType == 1) { if (popupType == 2) {
console.log(this.list) console.log(this.list)
let { key } = this.list[itemIndex] let { key,completeFun } = this.list[itemIndex]
this.$set(this.list[itemIndex], 'value', chooseContent.map(e => e.staffName).join('/')) this.$set(this.list[itemIndex], 'value', chooseContent.map(e => e.staffName).join('/'))
this.$set(this.list[itemIndex], key, chooseContent.map(e => e.uuid)) this.$set(this.list[itemIndex], key, chooseContent.map(e => e.uuid))
if (completeFun) {
let {key, result} = completeFun,
index = this.list.findIndex(i => i.key == key),
func = eval(`(function(list) { return ${result}; })`)
this.$set(this.list[index], 'value', func(chooseContent))
}
} }
}, },
async getMonthlyPendingCount () {
let { reportDate, userInfo,list } = this,
{ shopMerchantId } = userInfo
const res = await uni.$api.dailyTemplateApi.getMonthlyPendingCount({
merchantId: shopMerchantId,
reportDate
})
let index = list.findIndex(i => i.key == 'F2-24')
this.$set(this.list[index], 'value', res)
}
} }
} }
</script> </script>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
@showNegotiationList="changeComponent(true)" @showNegotiationList="changeComponent(true)"
@saveReport="saveReport" @saveReport="saveReport"
@submitReport="submitReport" @submitReport="submitReport"
:reportDate="currentDate"
/> />
</template> </template>
</view> </view>
......
...@@ -18,7 +18,7 @@ const componentConfig = { ...@@ -18,7 +18,7 @@ const componentConfig = {
searchValue: '', searchValue: '',
noData: false noData: false
}, },
1: { 2: {
name: 'EmployeeList', name: 'EmployeeList',
title: '多选', title: '多选',
multiple: true, multiple: true,
...@@ -30,16 +30,6 @@ const componentConfig = { ...@@ -30,16 +30,6 @@ const componentConfig = {
searchValue: '', searchValue: '',
noData: false noData: false
}, },
2: {
name: 'EmployeeList',
title: '选择人员',
placeholder: '请输入姓名',
idKey: ['userId'],
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
3: { 3: {
name: 'CarModelList', name: 'CarModelList',
title: '选择车型', title: '选择车型',
......
...@@ -32,11 +32,12 @@ ...@@ -32,11 +32,12 @@
:endDate="endDate" :endDate="endDate"
:showMonth="false" :showMonth="false"
@monthSwitch="changeMonth" @monthSwitch="changeMonth"
@change="changeCurrentDate"
backgroundColor="transparent" backgroundColor="transparent"
:selected="selectedDays" :selected="selectedDays"
:date="currentDate" :date="currentDate"
:calendarItemStyle="{width:'84rpx',height:'90rpx'}" :calendarItemStyle="{width:'84rpx',height:'90rpx'}"
openBeforeChange
@beforeChange="changeDate"
/> />
</view> </view>
</view> </view>
...@@ -185,35 +186,25 @@ export default { ...@@ -185,35 +186,25 @@ export default {
onUnload () { onUnload () {
}, },
methods: { methods: {
back () { exitInterception (callBack) {
this.noticeObj = { this.openNotice({
title: '重要提示',
text: '内容尚未保存,是否退出编辑?', text: '内容尚未保存,是否退出编辑?',
type: 'warning', buttons: {
buttons: [ cancelText: '继续编辑',
{ confirmText: '确定退出'
text: '继续编辑',
type: 'default',
callback: _ => {
this.$refs.notice.close()
} }
}, false, _ => {
if (callBack) callBack()
else this.backPage()
})
}, },
{ back () {
text: '确定退出',
type: 'primary',
callback: _ => {
this.backPage()
}
}
]
}
let now = dayjs().format('YYYY-MM-DD') let now = dayjs().format('YYYY-MM-DD')
if (this.currentDate == now) { if (this.currentDate == now) {
if (this.templateType != 2) { if (this.templateType == 2) {
this.$refs.notice.open() if (this.reportStatus != 1) this.exitInterception()
} else { } else {
if (this.reportStatus != 1) this.$refs.notice.open() this.exitInterception()
else this.backPage()
} }
} else this.backPage() } else this.backPage()
}, },
...@@ -302,9 +293,65 @@ export default { ...@@ -302,9 +293,65 @@ export default {
}, },
changeCurrentDate (e) { changeCurrentDate (e) {
this.templateData = [] this.templateData = []
this.currentDate = e.fulldate this.currentDate = e.fullDate
this.getReportDetail() this.getReportDetail()
}, },
async checkReport () {
let { templateType, reportStatus } = this, currentComponent = this.$refs[`ref-${this.componentName}`]
console.log(currentComponent.isToday)
if (currentComponent.isToday) {
if (templateType == 2) {
return reportStatus != 1
} else {
return true
}
} return false
},
async changeDate (e) {
if (e.fullDate == this.currentDate) return
const openNotice = await this.checkReport()
if (!openNotice) {
this.$refs.calendar.manualChangeDate(e)
this.changeCurrentDate(e)
return
}
this.exitInterception(_ => {
this.$refs.calendar.manualChangeDate(e)
this.changeCurrentDate(e)
})
},
openNotice ({
title,
text,
type,
buttons
}, back = true, callBack) {
this.noticeObj = {
title: title || '重要提示',
text: text || '确认提交后将不可再编辑,确认继续?',
type: type || 'warning',
buttons: [
{
text: buttons.cancelText || '取消',
type: 'default',
callback: _ => {
this.$refs.notice.close()
}
},
{
text: buttons.confirmText || '确定提交',
type: 'primary',
callback: _ => {
this.$refs.notice.close()
if (back) uni.navigateBack()
if (callBack && typeof callBack === 'function') callBack()
}
}
]
}
this.$refs.notice.open()
},
async getReportDetail () { async getReportDetail () {
uni.showLoading({ title: '加载中...', mask: true }) uni.showLoading({ title: '加载中...', mask: true })
try { try {
......
...@@ -127,7 +127,7 @@ export default { ...@@ -127,7 +127,7 @@ export default {
reportParams.subformDataList = subformDataList reportParams.subformDataList = subformDataList
console.log(reportParams) console.log(reportParams)
uni.hideLoading() uni.hideLoading()
this.$emit('submitReport', reportParams) // this.$emit('submitReport', reportParams)
} catch (error) { } catch (error) {
uni.hideLoading() uni.hideLoading()
uni.showToast({ title: error, icon: 'none' }) uni.showToast({ title: error, icon: 'none' })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!