lb #1
7
src/utils/filters.js
Normal file
7
src/utils/filters.js
Normal file
@ -0,0 +1,7 @@
|
||||
/** filters */
|
||||
|
||||
export const dictFilter = dictTypeId => {
|
||||
return val => {
|
||||
return JSON.parse(localStorage.getItem('dictList'))[dictTypeId].find(item => item.dictValue === val)?.dictLabel || '-'
|
||||
}
|
||||
}
|
@ -66,17 +66,17 @@ import TableTextComponent from '@/components/base-table/components/detailCompone
|
||||
import BaseDialog from '@/components/base-dialog/addOrUpdate'
|
||||
import moment from 'moment'
|
||||
import dictListMixin from '@/mixins/dictlist-module'
|
||||
import { dictFilter } from '@/utils/filters'
|
||||
|
||||
const UnitDictTypeId = '1557173812109242370'
|
||||
const ProductTypeDictTypeId = '1557179530308616193'
|
||||
|
||||
const tableConfigs = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'updateTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') },
|
||||
{ prop: 'name', name: '产品名称' },
|
||||
{ prop: 'name', name: '产品名称'},
|
||||
{ prop: 'code', name: '产品编码' },
|
||||
{ prop: 'specifications', name: '规格' },
|
||||
{ prop: 'unitDictValue', name: '单位' },
|
||||
{ prop: 'unitDictValue', name: '单位', filter: dictFilter(UnitDictTypeId) },
|
||||
// { prop: 'unitDictValue', name: '单位value,对应到数据字典label_value' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['viewAttr', 'delete'] }
|
||||
|
||||
@ -135,8 +135,6 @@ const addOrUpdateConfigs = {
|
||||
type: 'select',
|
||||
options: [
|
||||
// 动态获取
|
||||
{ label: 'ces', value: 1 },
|
||||
{ label: 'sec', value: 2 }
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -145,8 +143,6 @@ const addOrUpdateConfigs = {
|
||||
type: 'select',
|
||||
options: [
|
||||
// 动态获取
|
||||
{ label: 'h', value: 'h' },
|
||||
{ label: 'l', value: 'l' }
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -257,10 +253,10 @@ export default {
|
||||
})
|
||||
},
|
||||
// 表格操作事件管理
|
||||
handleOperations({type, data}) {
|
||||
switch(type) {
|
||||
handleOperations({ type, data }) {
|
||||
switch (type) {
|
||||
case 'viewAttr': // <== 对照 tableConfig
|
||||
return this.addOrUpdateHandle(data)
|
||||
return this.addOrUpdateHandle(data)
|
||||
case 'delete':
|
||||
return this.deleteHandle(data)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user