update 数据字典缓存&add momentjs

This commit is contained in:
2022-08-10 09:43:17 +08:00
parent cfec6ff3f5
commit 559cffc5f0
7 changed files with 54 additions and 13 deletions

View File

@@ -78,7 +78,7 @@ export default {
if (!valid) {
return false
}
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dict/data', this.dataForm)
this.$http[!this.dataForm.id ? 'post' : 'put'](this.$http.adornUrl('/sys/dict/data'), this.dataForm)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
@@ -92,6 +92,20 @@ export default {
this.$emit('refreshDataList')
}
})
/** 刷新dictlist */
this.$http.get(this.$http.adornUrl('/sys/dict/data/getAll')).then(({ data: res }) => {
if (res && res.code === 0) {
localStorage.setItem('dictList', JSON.stringify(res.data))
} else {
this.$message({
message: '数据字典拉取失败,请检查!',
type: 'error',
duration: 2000
})
}
})
})
.catch(() => {})
})