Commit a16c3377 authored by 王纵's avatar 王纵

添加表格表单实例

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