Commit b205b945 by 李伟康

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

- 修复了表单验证逻辑,增加对空字符串的检查
- 优化了每日报表组件的模板语法格式
- 修复了月度待办数量获取和显示逻辑
- 调整了数据加载时机避免无效调用
- 修复了对象解构赋值中的语法问题
1 parent 5de76782
<template>
<view class="report-content ">
<template v-if="!isToday">
<Detail :templateData="templateData" />
<Detail :templateData="templateData" />
</template>
<template v-else>
<Edit
......@@ -9,7 +9,6 @@
@submitReport="submitReport"
/>
</template>
</view>
</template>
......
<template>
<view class="report-content ">
<template v-if="!isToday">
<Detail :templateData="templateData"/>
<Detail :templateData="templateData" />
</template>
<template v-else>
<Edit
......@@ -9,7 +9,6 @@
@submitReport="submitReport"
/>
</template>
</view>
</template>
......
......@@ -130,7 +130,7 @@ export default {
this.list = utils.deepClone(val)
setTimeout(() => {
this.loadComplete = true
this.getMonthlyPendingCount()
if (val.length) this.getMonthlyPendingCount()
}, 200)
},
immediate: true,
......@@ -138,7 +138,6 @@ export default {
}
},
mounted () {
},
methods: {
......@@ -222,11 +221,11 @@ export default {
const { popupType, chooseContent, itemIndex } = data
if (popupType == 2) {
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], key, chooseContent.map(e => e.uuid))
if (completeFun) {
let {key, result} = 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))
......@@ -236,14 +235,16 @@ export default {
},
async getMonthlyPendingCount () {
let { reportDate, userInfo,list } = this,
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')
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 {
},
computed: {
},
watch: {
currentDate: {
......
......@@ -158,7 +158,7 @@ export default {
})
e.childrenValue = childrenValue
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 (!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!