diff --git a/src/views/bjd/dj_list.vue b/src/views/bjd/dj_list.vue index 377297a..cc4971f 100644 --- a/src/views/bjd/dj_list.vue +++ b/src/views/bjd/dj_list.vue @@ -393,42 +393,31 @@ export default { }) return false } else { - for (let i = 0; i < this.multipleSelection.length; i++) { - this.$prompt( - '请输入作废原因', - '共' + - this.multipleSelection.length + - '条报检项目将作废,是否继续?', - { - confirmButtonText: '确定', - cancelButtonText: '取消', - inputPattern: /\S/, - inputErrorMessage: '作废原因不能为空' - } - ) - .then(({ value }) => { - for (let i = 0; i < this.multipleSelection.length; i++) { - this.ids.push(this.multipleSelection[i].id) + this.$prompt('请输入作废原因', '共' + this.multipleSelection.length + '条报检项目将作废,是否继续?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + inputPattern: /\S/, + inputErrorMessage: '作废原因不能为空' + }).then(({ value }) => { + for (let i = 0; i < this.multipleSelection.length; i++) { + this.apibjd({ + url: '/bjd/updBjdToZf', + method: 'get', + params: { reason: value, bjdId: this.multipleSelection[i].id }, + paramsSerializer: function(params) { + return qs.stringify(params, { indices: false }) } - this.apibjd({ - url: '/bjd/updBjdToZf', - method: 'get', - params: { reason: value, bjdId: this.ids }, - paramsSerializer: function(params) { - return qs.stringify(params, { indices: false }) - } - }).then((data) => { - this.$notify.success('操作成功!') - this.getList() - }) - }) - .catch(() => { - this.$message({ - type: 'info', - message: '已取消作废' - }) + }).then((data) => { + this.$notify.success('操作成功!') + this.getList() }) - } + } + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消作废' + }) + }) } }, // 删除报检单---只有未审核的报检单才能删除 diff --git a/src/views/bjd/dt_list.vue b/src/views/bjd/dt_list.vue index 561fca9..a0e32c6 100644 --- a/src/views/bjd/dt_list.vue +++ b/src/views/bjd/dt_list.vue @@ -245,44 +245,31 @@ export default { }) return false } else { - for (let i = 0; i < this.multipleSelection.length; i++) { - this.$prompt( - '请输入作废原因', - '共' + - this.multipleSelection.length + - '条报检项目将作废,是否继续?', - { - confirmButtonText: '确定', - cancelButtonText: '取消', - inputPattern: /\S/, - inputErrorMessage: '作废原因不能为空' - } - ) - .then(({ value }) => { - for (let i = 0; i < this.multipleSelection.length; i++) { - this.ids.push(this.multipleSelection[i].id) + this.$prompt('请输入作废原因', '共' + this.multipleSelection.length + '条报检项目将作废,是否继续?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + inputPattern: /\S/, + inputErrorMessage: '作废原因不能为空' + }).then(({ value }) => { + for (let i = 0; i < this.multipleSelection.length; i++) { + this.apibjd({ + url: '/bjd/updBjdToZf', + method: 'get', + params: { reason: value, bjdId: this.multipleSelection[i].id }, + paramsSerializer: function(params) { + return qs.stringify(params, { indices: false }) } - this.apibjd({ - url: '/bjd/updBjdToZf', - method: 'get', - params: { reason: value, bjdId: this.multipleSelection.map(rw => { - return rw.id - }) }, - paramsSerializer: function(params) { - return qs.stringify(params, { indices: false }) - } - }).then((data) => { - this.$notify.success('操作成功!') - this.getList() - }) - }) - .catch(() => { - this.$message({ - type: 'info', - message: '已取消作废' - }) + }).then((data) => { + this.$notify.success('操作成功!') + this.getList() }) - } + } + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消作废' + }) + }) } }, diff --git a/src/views/bjd/jj_list.vue b/src/views/bjd/jj_list.vue index 090df23..39ca84d 100644 --- a/src/views/bjd/jj_list.vue +++ b/src/views/bjd/jj_list.vue @@ -304,28 +304,17 @@ export default { return false } else { for (let i = 0; i < this.multipleSelection.length; i++) { - this.$prompt( - '请输入作废原因', - '共' + - this.multipleSelection.length + - '条报检项目将作废,是否继续?', - { - confirmButtonText: '确定', - cancelButtonText: '取消', - inputPattern: /\S/, - inputErrorMessage: '作废原因不能为空' - } - ) - .then(({ value }) => { - for (let i = 0; i < this.multipleSelection.length; i++) { - this.ids.push(this.multipleSelection[i].id) - } + this.$prompt('请输入作废原因', '共' + this.multipleSelection.length + '条报检项目将作废,是否继续?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + inputPattern: /\S/, + inputErrorMessage: '作废原因不能为空' + }).then(({ value }) => { + for (let i = 0; i < this.multipleSelection.length; i++) { this.apibjd({ url: '/bjd/updBjdToZf', method: 'get', - params: { reason: value, bjdId: this.multipleSelection.map(rw => { - return rw.id - }) }, + params: { reason: value, bjdId: this.multipleSelection[i].id }, paramsSerializer: function(params) { return qs.stringify(params, { indices: false }) } @@ -333,13 +322,13 @@ export default { this.$notify.success('操作成功!') this.getList() }) + } + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消作废' }) - .catch(() => { - this.$message({ - type: 'info', - message: '已取消作废' - }) - }) + }) } } },