优化已办流程界面
parent
8299173d46
commit
e045626b5c
|
@ -189,6 +189,21 @@
|
|||
return !isBlank(obj)
|
||||
}
|
||||
|
||||
function checkStatus(response) {
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
return response
|
||||
}
|
||||
else {
|
||||
const error = new Error(response.statusText);
|
||||
error.response = response
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
function parseJSON(response) {
|
||||
return response.json()
|
||||
}
|
||||
|
||||
const data = () => {
|
||||
return {
|
||||
auditForm: {
|
||||
|
@ -228,22 +243,23 @@
|
|||
|
||||
fetch("${base}/process/" + row.id, {
|
||||
method: 'DELETE', // or 'PUT'
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
this.queryTable()
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
})
|
||||
}).then(checkStatus).then(response => {
|
||||
this.queryTable()
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
})
|
||||
}).catch(({ response }) => {
|
||||
if (response) {
|
||||
parseJSON(response)
|
||||
.then(json => {
|
||||
this.$message.error(json.message || "删除失败")
|
||||
})
|
||||
}
|
||||
else {
|
||||
return Promise.reject(response)
|
||||
this.$message.error("删除失败")
|
||||
}
|
||||
}).catch(res => {
|
||||
res.json().then(json => {
|
||||
this.$message.error(json.message || "删除失败");
|
||||
})
|
||||
}).finally(() => loading.close())
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
|
@ -267,20 +283,23 @@
|
|||
|
||||
fetch("${base}/process/revoke/" + row.id, {
|
||||
method: 'POST', // or 'PUT'
|
||||
}).then(response => {
|
||||
if (response.ok) {
|
||||
this.queryTable()
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '撤销成功',
|
||||
type: 'success'
|
||||
})
|
||||
}).then(checkStatus).then(response => {
|
||||
this.queryTable()
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '撤销成功',
|
||||
type: 'success'
|
||||
})
|
||||
}).catch(({ response }) => {
|
||||
if (response) {
|
||||
parseJSON(response)
|
||||
.then(json => {
|
||||
this.$message.error(json.message || "撤销失败")
|
||||
})
|
||||
}
|
||||
else {
|
||||
return Promise.reject(response)
|
||||
this.$message.error("撤销失败")
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error("撤销失败");
|
||||
}).finally(() => loading.close())
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
|
@ -297,22 +316,25 @@
|
|||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
fetch("${base}/process/audits/" + row.id).then(response => {
|
||||
if (response.ok) {
|
||||
// 展示弹窗
|
||||
response.json().then(json => {
|
||||
fetch("${base}/process/audits/" + row.id)
|
||||
.then(checkStatus)
|
||||
.then(parseJSON)
|
||||
.then(json => {
|
||||
// 展示弹窗
|
||||
this.auditDetailVisible = true
|
||||
this.auditDetails = json
|
||||
})
|
||||
}
|
||||
else {
|
||||
return Promise.reject(response)
|
||||
}
|
||||
}).catch(res => {
|
||||
res.json().then(json => {
|
||||
this.$message.error(json.message || "数据获取失败");
|
||||
})
|
||||
}).finally(() => loading.close())
|
||||
.catch(({ response }) => {
|
||||
if (response) {
|
||||
parseJSON(response)
|
||||
.then(json => {
|
||||
this.$message.error(json.message || "数据获取失败")
|
||||
})
|
||||
}
|
||||
else {
|
||||
this.$message.error("数据获取失败")
|
||||
}
|
||||
}).finally(() => loading.close())
|
||||
|
||||
},
|
||||
|
||||
|
@ -334,7 +356,7 @@
|
|||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(form),
|
||||
}).then(response => {
|
||||
}).then(checkStatus).then(response => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '审核成功',
|
||||
|
@ -342,8 +364,16 @@
|
|||
})
|
||||
// 关闭对话框
|
||||
this.auditFormVisible = false
|
||||
}).catch(err => {
|
||||
this.$message.error("审核失败");
|
||||
}).catch(({ response }) => {
|
||||
if (response) {
|
||||
parseJSON(response)
|
||||
.then(json => {
|
||||
this.$message.error(json.message || "审核失败")
|
||||
})
|
||||
}
|
||||
else {
|
||||
this.$message.error("审核失败")
|
||||
}
|
||||
}).finally(() => loading.close())
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue