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

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

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