forked from mt-fe-group/mt-yd-ui
update 数据字典相关逻辑“
This commit is contained in:
@@ -129,25 +129,25 @@ export default {
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.code = data.product.code
|
||||
this.dataForm.name = data.product.name
|
||||
this.dataForm.description = data.product.description
|
||||
this.dataForm.externalCode = data.product.externalCode
|
||||
this.dataForm.specifications = data.product.specifications
|
||||
this.dataForm.unitDictValue = data.product.unitDictValue
|
||||
this.dataForm.area = data.product.area
|
||||
this.dataForm.processTime = data.product.processTime
|
||||
this.dataForm.typeDictValue = data.product.typeDictValue
|
||||
this.dataForm.enabled = data.product.enabled
|
||||
this.dataForm.remark = data.product.remark
|
||||
this.dataForm.valid = data.product.valid
|
||||
this.dataForm.creatorId = data.product.creatorId
|
||||
this.dataForm.creatorName = data.product.creatorName
|
||||
this.dataForm.createTime = data.product.createTime
|
||||
this.dataForm.updaterId = data.product.updaterId
|
||||
this.dataForm.updaterName = data.product.updaterName
|
||||
this.dataForm.updateTime = data.product.updateTime
|
||||
this.dataForm.version = data.product.version
|
||||
this.dataForm.code = data.data.code
|
||||
this.dataForm.name = data.data.name
|
||||
this.dataForm.description = data.data.description
|
||||
this.dataForm.externalCode = data.data.externalCode
|
||||
this.dataForm.specifications = data.data.specifications
|
||||
this.dataForm.unitDictValue = data.data.unitDictValue
|
||||
this.dataForm.area = data.data.area
|
||||
this.dataForm.processTime = data.data.processTime
|
||||
this.dataForm.typeDictValue = data.data.typeDictValue
|
||||
this.dataForm.enabled = data.data.enabled
|
||||
this.dataForm.remark = data.data.remark
|
||||
this.dataForm.valid = data.data.valid
|
||||
this.dataForm.creatorId = data.data.creatorId
|
||||
this.dataForm.creatorName = data.data.creatorName
|
||||
this.dataForm.createTime = data.data.createTime
|
||||
this.dataForm.updaterId = data.data.updaterId
|
||||
this.dataForm.updaterName = data.data.updaterName
|
||||
this.dataForm.updateTime = data.data.updateTime
|
||||
this.dataForm.version = data.data.version
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@@ -65,13 +65,14 @@ import TableOperateComponent from '@/components/base-table/components/operationC
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
import BaseDialog from '@/components/base-dialog/addOrUpdate'
|
||||
import moment from 'moment'
|
||||
import dictListMixin from '@/mixins/dictlist-module'
|
||||
|
||||
const UnitDictTypeId = '1557173812109242370'
|
||||
const ProductTypeDictTypeId = ' '
|
||||
const ProductTypeDictTypeId = '1557179530308616193'
|
||||
|
||||
const tableConfigs = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'updateTime', name: '添加时间', filter: val => val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-' },
|
||||
{ prop: 'updateTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') },
|
||||
{ prop: 'name', name: '产品名称' },
|
||||
{ prop: 'code', name: '产品编码' },
|
||||
{ prop: 'specifications', name: '规格' },
|
||||
@@ -151,8 +152,8 @@ const addOrUpdateConfigs = {
|
||||
],
|
||||
operations: [
|
||||
{ name: 'reset', url: true },
|
||||
{ name: 'save', url: '/monitoring/product', permission: "" },
|
||||
{ name: 'update', url: '/monitoring/product', permission: "" }
|
||||
{ name: 'save', url: '/monitoring/product', permission: '' },
|
||||
{ name: 'update', url: '/monitoring/product', permission: '' }
|
||||
]
|
||||
// extraComponents: [
|
||||
// {
|
||||
@@ -164,9 +165,9 @@ const addOrUpdateConfigs = {
|
||||
}
|
||||
|
||||
export default {
|
||||
mixins: [dictListMixin],
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
@@ -187,6 +188,19 @@ export default {
|
||||
BaseTable,
|
||||
BaseDialog
|
||||
},
|
||||
created() {
|
||||
this.initDictList([UnitDictTypeId, ProductTypeDictTypeId])
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name) {
|
||||
if (item.name === 'typeDictValue') {
|
||||
console.log('dict : ', this.dictList)
|
||||
item.options = this.dictList[ProductTypeDictTypeId]
|
||||
} else if (item.name === 'unitDictValue') {
|
||||
item.options = this.dictList[UnitDictTypeId]
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
@@ -242,6 +256,15 @@ export default {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 表格操作事件管理
|
||||
handleOperations({type, data}) {
|
||||
switch(type) {
|
||||
case 'viewAttr': // <== 对照 tableConfig
|
||||
return this.addOrUpdateHandle(data)
|
||||
case 'delete':
|
||||
return this.deleteHandle(data)
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
|
||||
Reference in New Issue
Block a user