|
@@ -173,29 +173,46 @@ export default {
|
|
|
let edatas = datas || [this.data]
|
|
let edatas = datas || [this.data]
|
|
|
this.loading.submit = true
|
|
this.loading.submit = true
|
|
|
try {
|
|
try {
|
|
|
- await Promise.all(edatas.map(data => {
|
|
|
|
|
- return this.isForm(data.result, item => {
|
|
|
|
|
- this.$dialog.alert({
|
|
|
|
|
- title: '必填项',
|
|
|
|
|
- message: `${item.title}`,
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // await Promise.all(edatas.map(data => {
|
|
|
|
|
+ // return this.isForm(data.result, item => {
|
|
|
|
|
+ // this.$dialog.alert({
|
|
|
|
|
+ // title: '必填项',
|
|
|
|
|
+ // message: `${item.title}`,
|
|
|
|
|
+ // })
|
|
|
|
|
+ // })
|
|
|
|
|
+ // }))
|
|
|
|
|
+
|
|
|
|
|
+ let ruleData = {}
|
|
|
|
|
+ let rule = {}
|
|
|
|
|
+ edatas.forEach(({ result }, rIndex) => result.forEach((item, index) => {
|
|
|
|
|
+ let k = `${rIndex}_${index}_val`
|
|
|
|
|
+ ruleData[k] = item.val
|
|
|
|
|
+ let reg = item.reg ? new RegExp(item.reg) : null
|
|
|
|
|
+ rule[k] = {
|
|
|
|
|
+ validator: (item.required && item.val instanceof Array)
|
|
|
|
|
+ ? (value, rule) => !!value.length
|
|
|
|
|
+ : reg,
|
|
|
|
|
+ required: !!item.required,
|
|
|
|
|
+ message: item.regexp_message || `必填项\n${item.title}`
|
|
|
|
|
+ }
|
|
|
}))
|
|
}))
|
|
|
|
|
+
|
|
|
|
|
+ await this.$blRule(ruleData, rule, message => {
|
|
|
|
|
+ this.$toast(message)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ await this.$dialog.confirm({
|
|
|
|
|
+ title: '模拟提交',
|
|
|
|
|
+ message: '请确认无误提交?',
|
|
|
|
|
+ })
|
|
|
|
|
+ ld = this.$toast.loading({ message: '提交中...', duration: 0 })
|
|
|
|
|
+
|
|
|
if (this.isEdit) {
|
|
if (this.isEdit) {
|
|
|
- await this.$dialog.confirm({
|
|
|
|
|
- title: '模拟提交',
|
|
|
|
|
- message: '请确认无误提交?',
|
|
|
|
|
- })
|
|
|
|
|
- ld = this.$toast.loading({ message: '提交中...', duration: 0 })
|
|
|
|
|
await new Promise(r => setTimeout(r, 2500))
|
|
await new Promise(r => setTimeout(r, 2500))
|
|
|
this.btnOpenSuccess()
|
|
this.btnOpenSuccess()
|
|
|
throw new Error('模拟提交')
|
|
throw new Error('模拟提交')
|
|
|
}
|
|
}
|
|
|
- await this.$dialog.confirm({
|
|
|
|
|
- title: '提示',
|
|
|
|
|
- message: '请确认无误提交?',
|
|
|
|
|
- })
|
|
|
|
|
- ld = this.$toast.loading({ message: '提交中...', duration: 0 })
|
|
|
|
|
|
|
+
|
|
|
let pms = edatas.map(data => this.btnSubmitItem(data.result, data.query))
|
|
let pms = edatas.map(data => this.btnSubmitItem(data.result, data.query))
|
|
|
let arrRes = await Promise.all(pms)
|
|
let arrRes = await Promise.all(pms)
|
|
|
if (pms.length === 1 && this.$route.query.topic_id == 1) {
|
|
if (pms.length === 1 && this.$route.query.topic_id == 1) {
|