Commit 3b882956 by 李伟康

refactor(dailyNewspaper): 移除已注释的废弃代码并优化事件处理

- 删除了 mixins.js 中被注释掉的 saveReport 方法的旧实现
- 简化了 saveReport 方法的错误处理逻辑
- 在 NegotiationDetail 和 StaffDailyReport 组件中更新了事件绑定
- 统一了组件间的事件传递机制以提高代码可维护性
1 parent 6f67615d
......@@ -4,7 +4,7 @@
<Detail :templateData="templateData" />
</template>
<template v-else>
<Edit :templateData="templateData" @submitReport="submitReport" @getSaveBtnStatus="saveBtnStatus = $event"
<Edit :templateData="templateData" @saveReport="saveReport" @getSaveBtnStatus="saveBtnStatus = $event"
:ReportStatus="ReportStatus" @maxLengthError="$emit('maxLengthError',$event)" :currentDate="currentDate" />
</template>
</view>
......
......@@ -4,7 +4,7 @@
<Detail :templateData="templateData" />
</template>
<template v-else>
<Edit :templateData="templateData" @submitReport="submitReport" @getSaveBtnStatus="saveBtnStatus = $event"
<Edit :templateData="templateData" @saveReport="saveReport" @getSaveBtnStatus="saveBtnStatus = $event"
:ReportStatus="ReportStatus" />
</template>
</view>
......
......@@ -82,51 +82,6 @@ export default {
console.log(error)
}
},
// async saveReport(res) {
// try {
// uni.showLoading({ title: '提交中...', mask: true })
// let { reportParams } = this,
// list = utils.deepClone(res)
// let jsonContent = JSON.stringify(list)
// let requestJson = buildAppNormalizedListsFromJsonContent(jsonContent)
// list.map(e => {
// let childrenValue = []
// if (e.children && e.children.length)
// e.children.map((c, cIndex) => {
// let isArray = Array.isArray(c)
// if (isArray) {
// childrenValue.push({
// [e.key]: {}
// })
// c.map(i => {
// let value = i.value
// if (i[i.key])
// childrenValue[cIndex][e.key][i.key] = {
// text: value,
// value: i[i.key]
// }
// else childrenValue[cIndex][e.key][i.key] = value
// })
// }
// })
// e.childrenValue = childrenValue
// if (e.type == 'subform') delete e.children
// })
// reportParams.jsonContent = JSON.stringify(list)
// reportParams.requestJson = JSON.stringify(requestJson)
// console.log('保存草稿', reportParams)
// const data = await uni.$api.dailyTemplateApi.saveDraft(reportParams)
// uni.hideLoading()
// if (data) {
// uni.showToast({ title: '操作成功', icon: 'success', mask: true })
// this.$emit('saveReportStatus', data)
// } else uni.showToast({ title: '操作失败', icon: 'none', mask: true })
// console.log(data)
// } catch (error) {
// uni.hideLoading()
// uni.showToast({ title: error, icon: 'none', mask: true })
// }
// },
async saveReport(res, isPush = false) {
try {
const phoneRegex = /^1[3456789]\d{9}$/
......@@ -207,10 +162,8 @@ export default {
uni.showToast({ title: '操作成功', icon: 'success', mask: true })
this.$emit('saveReportStatus', data)
} else uni.showToast({ title: '操作失败', icon: 'none', mask: true })
// if (!isPush) {
// } else this.$emit('submitReport', reportParams)
} catch (error) {
console.log(error)
uni.hideLoading()
uni.showToast({ title: error, icon: 'none', mask: true })
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!