Commit 73e66523 authored by 王纵's avatar 王纵

自定义数组参数改成数组类型

parent cdb88618
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-01 09:55:12
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-20 09:55:39
* @LastEditTime: 2024-08-21 17:05:26
* @Version: 1.0.0
* @Description: 动态渲染-Select
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -160,6 +160,7 @@ export default {
getOptions() {
getSelectOptions({lovCode: this.fieldConfig.lookupCode, ...this.cascadesParams}).then(res => {
this.options = res.map(item => ({...item, _selected: false}));
this.formatValue();
});
},
formatValue() {
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-31 15:09:30
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-20 22:57:16
* @LastEditTime: 2024-08-21 17:03:58
* @Version: 1.0.0
* @Description: 页面按钮渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -22,6 +22,7 @@
v-for="btn in hideBtns"
round
:key="btn.name"
:type="btn.name === 'save' ? 'info' : ''"
:icon="buttonIcon[btn.name]"
class="layout-button"
@click="handlClick(btn)"
......@@ -37,6 +38,7 @@
v-for="btn in defaultBtns"
round
:key="btn.name"
:type="btn.name === 'save' ? 'info' : ''"
:icon="buttonIcon[btn.name]"
class="layout-button"
@click="handlClick(btn)"
......@@ -64,8 +66,8 @@ export default {
default: () => ({})
},
layoutButtonsFun: { // 自定义按钮方法
type: Object,
default: () => ({})
type: Array,
default: () => []
},
headerButtons: { // 页面按钮渲染
type: Array,
......@@ -89,19 +91,31 @@ export default {
remove: 'delete',
query: 'search'
},
allFuns: {
save: this.saveFunction,
query: this.query,
reset: this.reset,
remove: this.remove,
}
allFuns: [
{
name: 'save',
clickFunction: this.saveFunction,
},
// {
// name: 'query',
// clickFunction: this.query,
// },
// {
// name: 'reset',
// clickFunction: this.reset,
// }, {
// name: 'remove',
// clickFunction: this.remove,
// },
]
}
},
mounted() {
this.configInfo = this.dynamicInfo().config;
this.readOnly = this.dynamicInfo().queryParams.readOnly;
this.allFuns = {...this.allFuns, ...this.layoutButtonsFun}; // 综合按钮方法
this.layoutButtons = (this.configInfo.layoutButtons || []).concat(this.headerButtons).filter(o => this.allFuns[o.name]);
const funcs = [...this.allFuns, ...this.layoutButtonsFun]; // 综合按钮方法
this.allFuns = [...new Map(funcs.map(item => [item.name, item])).values()];
this.layoutButtons = (this.configInfo.layoutButtons || []).concat(this.headerButtons).filter(o => this.allFuns.some(e => e.name === o.name));
this.init();
},
methods: {
......@@ -114,23 +128,23 @@ export default {
}
},
getClickFunction(name) { // 获取对应的点击事件
const currentButtons = this.customizedButtons.filter(value => value.name === name);
return currentButtons.length > 0 ? currentButtons[0].clickFunction : this.dataSetFunction[name];
const currentButtons = this.allFuns.filter(value => value.name === name);
return currentButtons.length > 0 ? currentButtons[0].clickFunction : () => {};
},
handlClick(btn) {
this.moreVisible = false;
const func = this.allFuns[btn.name];
const func = this.getClickFunction[btn.name];
func();
},
query(){
// query(){
},
reset(){
// },
// reset(){
},
remove() {
// },
// remove() {
},
// },
async saveFunction() {
const saveDataSet = this.dynamicInfo().dataSetObject;
const dataSets = {...saveDataSet};
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-20 22:55:00
* @LastEditTime: 2024-08-21 16:52:03
* @Version: 1.0.0
* @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -77,8 +77,8 @@ export default {
default: () => []
},
layoutButtons: { // 布局按钮方法
type: Object,
default: () => ({})
type: Array,
default: () => []
},
componentButtons: { // 组件按钮方法
type: Array,
......
......@@ -2,13 +2,13 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-16 09:39:36
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-21 15:54:30
* @LastEditTime: 2024-08-21 17:03:39
* @Version: 1.0.0
* @Description: 商机维护详情
* @Copyright: Copyright (c) 2021, Hand-RongJing
-->
<template>
<div>
<div style="height: 100vh">
<Dynamic
layoutCode="CN001F1"
:showTitle="false"
......@@ -78,10 +78,10 @@ export default {
},
},
],
layoutButtons: {
submit: this.submit,
save: this.save,
},
layoutButtons: [
{name: 'submit', clickFunction: this.submit},
{name: 'save', clickFunction: this.save},
],
show: false,
attachmentRecord: {}
}
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-08-16 09:39:36
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-21 16:02:16
* @LastEditTime: 2024-08-21 16:52:42
* @Version: 1.0.0
* @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -44,9 +44,9 @@ export default {
},
},
],
layoutButtons: {
create: this.create,
},
layoutButtons: [
{name: 'create', clickFunction: this.create}
]
}
},
created() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment