Commit b205b945 by 李伟康

fix(dailyNewspaper): 解决表单验证和数据显示问题

- 修复了表单验证逻辑,增加对空字符串的检查
- 优化了每日报表组件的模板语法格式
- 修复了月度待办数量获取和显示逻辑
- 调整了数据加载时机避免无效调用
- 修复了对象解构赋值中的语法问题
1 parent 5de76782
<template> <template>
<view class="report-content "> <view class="report-content ">
<template v-if="!isToday"> <template v-if="!isToday">
<Detail :templateData="templateData" /> <Detail :templateData="templateData" />
</template> </template>
<template v-else> <template v-else>
<Edit <Edit
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
@submitReport="submitReport" @submitReport="submitReport"
/> />
</template> </template>
</view> </view>
</template> </template>
......
<template> <template>
<view class="report-content "> <view class="report-content ">
<template v-if="!isToday"> <template v-if="!isToday">
<Detail :templateData="templateData"/> <Detail :templateData="templateData" />
</template> </template>
<template v-else> <template v-else>
<Edit <Edit
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
@submitReport="submitReport" @submitReport="submitReport"
/> />
</template> </template>
</view> </view>
</template> </template>
......
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
this.list = utils.deepClone(val) this.list = utils.deepClone(val)
setTimeout(() => { setTimeout(() => {
this.loadComplete = true this.loadComplete = true
this.getMonthlyPendingCount() if (val.length) this.getMonthlyPendingCount()
}, 200) }, 200)
}, },
immediate: true, immediate: true,
...@@ -138,7 +138,6 @@ export default { ...@@ -138,7 +138,6 @@ export default {
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
...@@ -222,11 +221,11 @@ export default { ...@@ -222,11 +221,11 @@ export default {
const { popupType, chooseContent, itemIndex } = data const { popupType, chooseContent, itemIndex } = data
if (popupType == 2) { if (popupType == 2) {
console.log(this.list) console.log(this.list)
let { key,completeFun } = 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) { if (completeFun) {
let {key, result} = completeFun, let { key, result } = completeFun,
index = this.list.findIndex(i => i.key == key), index = this.list.findIndex(i => i.key == key),
func = eval(`(function(list) { return ${result}; })`) func = eval(`(function(list) { return ${result}; })`)
this.$set(this.list[index], 'value', func(chooseContent)) this.$set(this.list[index], 'value', func(chooseContent))
...@@ -236,14 +235,16 @@ export default { ...@@ -236,14 +235,16 @@ export default {
}, },
async getMonthlyPendingCount () { async getMonthlyPendingCount () {
let { reportDate, userInfo,list } = this, let { reportDate, userInfo, list } = this,
{ shopMerchantId } = userInfo { shopMerchantId } = userInfo
const res = await uni.$api.dailyTemplateApi.getMonthlyPendingCount({ const res = await uni.$api.dailyTemplateApi.getMonthlyPendingCount({
merchantId: shopMerchantId, merchantId: shopMerchantId,
reportDate reportDate
}) })
let index = list.findIndex(i => i.key == 'F2-24') let index = list.findIndex(i => i.key == 'F2-24')
if(this.list[index].value == null || this.list[index].value == '' || this.list[index].value == undefined) this.$set(this.list[index], 'value', res) if (this.list[index].value == null || this.list[index].value == '' || this.list[index].value == undefined) {
if (res) this.$set(this.list[index], 'value', res.pendingCount)
}
} }
} }
} }
......
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
}, },
computed: { computed: {
}, },
watch: { watch: {
currentDate: { currentDate: {
......
...@@ -158,7 +158,7 @@ export default { ...@@ -158,7 +158,7 @@ export default {
}) })
e.childrenValue = childrenValue e.childrenValue = childrenValue
if (e.show && e.required) { if (e.show && e.required) {
if ((e.value == null || e.value == undefined)) throw `${e.label}不能为空` if ((e.value == null || e.value == undefined || e.value === '')) throw `${e.label}不能为空`
if (e.type == 'phoneInput') {// 验证手机号 if (e.type == 'phoneInput') {// 验证手机号
if (!phoneRegex.test(e.value)) throw `${e.label}格式不正确` if (!phoneRegex.test(e.value)) throw `${e.label}格式不正确`
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!