Commit a16c3377 authored by 王纵's avatar 王纵

添加表格表单实例

parent b1d07201
......@@ -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 12:11:27
* @LastEditTime: 2024-08-20 22:53:12
* @Version: 1.0.0
* @Description: 表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -188,7 +188,7 @@ export default {
default: () => []
}
},
inject: ['dynamicInfo', 'addFormRef', 'setDataSetData', 'dataLoadHandle'],
inject: ['dynamicInfo', 'addRef', 'setDataSetData', 'dataLoadHandle'],
data () {
return {
fieldComponents: ['TextField',"TextArea", "NumberField", "EmailField","CentField"],
......@@ -228,7 +228,7 @@ export default {
}
if (this.formType === 'normal') {
this.addFormRef(this, this.tabInfo.tabCode); //正常表单保存表单组件实例,供页面整体保存时使用
this.addRef(this, this.tabInfo.tabCode); //正常表单保存表单组件实例,供页面整体保存时使用
if (this.tabInfo.readUrl) {
// console.log('D-form-activated', this.tabInfo.readUrl, JSON.stringify(this.queryParams))
const res = await getFormData(this.tabInfo.readUrl, this.queryParams)
......
......@@ -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:52:04
* @LastEditTime: 2024-08-20 22:56:42
* @Version: 1.0.0
* @Description: 表格渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -129,7 +129,7 @@ export default {
default: () => [],
}
},
inject: ['dynamicInfo', 'dataLoadHandle'],
inject: ['dynamicInfo', 'dataLoadHandle', 'addRef'],
data () {
return {
dateType: {
......@@ -174,6 +174,7 @@ export default {
methods: {
init() {
this.$nextTick(() => {
this.addRef(this, this.tabInfo.tabCode); // 添加组件实例
this.dynamicConfigInfo = this.dynamicInfo();
if (this.tabInfo.queryTabCode) {
EventBus.$on('tableQuery', this.listenHandle);
......
......@@ -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-19 11:09:17
* @LastEditTime: 2024-08-20 22:57:16
* @Version: 1.0.0
* @Description: 页面按钮渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -135,10 +135,10 @@ export default {
const saveDataSet = this.dynamicInfo().dataSetObject;
const dataSets = {...saveDataSet};
for (let key in dataSets) {
if (dataSets.hasOwnProperty(key)) { // 确保key是对象自身的属性
const {formRef} = dataSets[key];
if(formRef) {
const values = await formRef.validate();
if (dataSets.hasOwnProperty(key) && dataSets[key].type==='Form') { // 确保key是对象自身的属性
const {instanceRef} = dataSets[key];
if(instanceRef) {
const values = await instanceRef.validate();
dataSets[key].submitValues = values;
}
}
......
......@@ -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-19 14:27:15
* @LastEditTime: 2024-08-20 22:55:00
* @Version: 1.0.0
* @Description:
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -110,7 +110,7 @@ export default {
},
provide() {
return {
addFormRef: this.addFormRef,
addRef: this.addRef,
setDataSetData: this.setDataSetData,
dataLoadHandle: this.dataLoadHandle,
dynamicInfo: this.getDynamicInfo
......@@ -180,8 +180,8 @@ export default {
}
return obj;
},
addFormRef(ref, tabCode) { // 添加表单实例
this.dataSetObject[tabCode].formRef = ref;
addRef(ref, tabCode) { // 添加表单实例
this.dataSetObject[tabCode].instanceRef = ref;
},
setDataSetData(tabCode, data) {
this.dataSetObject[tabCode].data = data;
......
......@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-30 14:39:47
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-08-20 09:57:50
* @LastEditTime: 2024-08-20 22:55:32
* @Version: 1.0.0
* @Description: 工具类
* @Copyright: Copyright (c) 2021, Hand-RongJing
......@@ -96,7 +96,7 @@ const dateFormat = (type, time) => { // 时间格式化 2019-09-08
// 根据tabcode获取对应的表单值
const getFormValuesByTabCode = async (dataSets, tabCode) => {
const formRef = dataSets[tabCode].formRef;
const formRef = dataSets[tabCode].instanceRef;
if (formRef) {
const values = await formRef.validate();
return values;
......@@ -109,8 +109,8 @@ const getFormValuesByTabCode = async (dataSets, tabCode) => {
// 根据tabcode获取对应的组件ref
const getRefByTabCode = (dataSets, tabCode) => {
const formRef = dataSets[tabCode].formRef;
return formRef;
const instanceRef = dataSets[tabCode].instanceRef;
return instanceRef;
}
const getOrganizationId = () => {
......
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