export default {
|
buttonClick(item, that) {
|
that.formName = item.name;
|
const location = item.paramVOS.webUiButtonLocation;
|
const method = item.paramVOS.webUiButtonMethods;
|
const messageOnlyText = that.selectList.length > 1 ? '只能选择一条数据进行编辑!' : '请选择一条数据进行编辑!';
|
const messageAllText = '请至少选择一条数据!'
|
|
const handlers = {
|
add: () => this.handleAdd(that, location),
|
edit: () => this.handleEdit(that, location, messageOnlyText),
|
delete: () => this.handleDelete(that, location, messageAllText),
|
};
|
|
const handler = handlers[method];
|
if (handler) {
|
handler();
|
} else {
|
that.$message.error('请重新配置按钮!');
|
}
|
},
|
|
handleAdd(that, location) {
|
if (location === 'top') {
|
that.visible = true;
|
} else {
|
that.$message.warning('请重新配置按钮至上方区域!');
|
}
|
|
},
|
|
handleEdit(that, location, messageOnlyText) {
|
if (location === 'menu') {
|
that.visible = true;
|
that.$refs.dynamicForm.form = that.scope.row;
|
|
} else if (location === 'top' && that.selectList.length === 1) {
|
that.visible = true;
|
that.$refs.dynamicForm.form = that.selectList[0];
|
} else {
|
that.$message.warning(messageOnlyText);
|
}
|
|
},
|
|
handleDelete(that, location, messageAllText) {
|
if (location === 'top') {
|
if (that.selectList.length <= 0) {
|
that.$message.warning(messageAllText);
|
} else {
|
that.$message.success('删除成功!');
|
}
|
} else if (location === 'menu') {
|
that.$message.success('删除成功!');
|
}
|
|
},
|
menuConfigurationWarning(location) {
|
if (location === 'menu') {
|
this.$message.warning('请重新配置按钮至上方区域');
|
return
|
}
|
},
|
topConfigurationWarning(location) {
|
if (location === ' top') {
|
this.$message.warning('请重新配置按钮至操作区域');
|
return
|
}
|
}
|
}
|