update 数据字典缓存&add momentjs
This commit is contained in:
@@ -64,9 +64,14 @@ import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
import BaseDialog from '@/components/base-dialog/addOrUpdate'
|
||||
import moment from 'moment'
|
||||
|
||||
const UnitDictTypeId = '1557173812109242370'
|
||||
const ProductTypeDictTypeId = ' '
|
||||
|
||||
const tableConfigs = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'updateTime', name: '添加时间' },
|
||||
{ prop: 'updateTime', name: '添加时间', filter: val => val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-' },
|
||||
{ prop: 'name', name: '产品名称' },
|
||||
{ prop: 'code', name: '产品编码' },
|
||||
{ prop: 'specifications', name: '规格' },
|
||||
@@ -146,8 +151,8 @@ const addOrUpdateConfigs = {
|
||||
],
|
||||
operations: [
|
||||
{ name: 'reset', url: true },
|
||||
{ name: 'save', url: 'api/product/add' },
|
||||
{ name: 'update', url: 'api/product/update' }
|
||||
{ name: 'save', url: '/monitoring/product', permission: "" },
|
||||
{ name: 'update', url: '/monitoring/product', permission: "" }
|
||||
]
|
||||
// extraComponents: [
|
||||
// {
|
||||
|
||||
@@ -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(() => {})
|
||||
})
|
||||
|
||||
@@ -77,7 +77,7 @@ export default {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dict/type', this.dataForm)
|
||||
this.$http[!this.dataForm.id ? 'post' : 'put'](this.$http.adornUrl('/sys/dict/type'), this.dataForm)
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
|
||||
@@ -106,9 +106,23 @@ export default {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
Cookies.set('token', res.data.token)
|
||||
|
||||
/** 保存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
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
this.$router.replace({ name: 'home' })
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch(err => {
|
||||
this.$message({
|
||||
message: err.message,
|
||||
type: 'error',
|
||||
|
||||
Reference in New Issue
Block a user