update 基本完成报表“

This commit is contained in:
2022-08-22 11:26:57 +08:00
parent a30e2e1ae2
commit 0b4433dd80
3 changed files with 47 additions and 7 deletions

View File

@@ -24,6 +24,8 @@ export default {
},
colors: {
delete: '#FF5454',
preview: '#f09843',
design: '#99089f'
// add more...
},
text: {
@@ -31,22 +33,35 @@ export default {
edit: '编辑',
detail: '详情',
delete: '删除',
viewAttr: '查看属性'
viewAttr: '查看属性',
preview: '预览',
design: '设计'
// add more...
}
}
},
methods: {
// 发射事件
emit(eventType) {
this.$emit('emit-data', { type: eventType, data: this.injectData.head?.emitFullData ? this.injectData : this.injectData.id })
emit(opt) {
let emitFull = false
let eventType = 'default'
let customField
if (typeof opt === 'object') {
eventType = opt.name
customField = opt.emitField || 'id'
emitFull = opt.emitFull || false
} else {
eventType = opt
}
this.$emit('emit-data', { type: eventType, data: emitFull ? this.injectData : customField ? this.injectData[customField] : this.injectData.id })
}
},
render: function (h) {
let btns = []
for (const optionStr of this.injectData.head?.options) {
const optObj = typeof optionStr === 'object'
// btns.push(h('el-button', { props: { type: this.btnTypes[optionStr] } }, optionStr))
btns.push(h('el-button', { props: { type: 'text' }, style: { color: this.colors[optionStr] || '#409EFF' }, on: { click: this.emit.bind(null, optionStr) } }, this.text[optionStr]))
btns.push(h('el-button', { props: { type: 'text' }, style: { color: optObj ? this.colors[optionStr.name] : this.colors[optionStr] || '#409EFF' }, on: { click: this.emit.bind(null, optionStr) } }, typeof optionStr === 'object' ? this.text[optionStr.name] : this.text[optionStr]))
}
return h('span', null, btns)
}