vue2-client 1.9.85 → 1.9.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +28 -0
- package/src/base-client/components/common/XForm/XFormItem.vue +2 -2
- package/src/base-client/components/common/XForm/XTreeSelect.vue +3 -3
- package/src/base-client/components/common/XFormTable/demo.vue +1 -1
package/package.json
CHANGED
|
@@ -188,6 +188,12 @@ export default {
|
|
|
188
188
|
return item.type === 'childTable'
|
|
189
189
|
})
|
|
190
190
|
},
|
|
191
|
+
// 过滤出用于form子表数据新增/修改场景的表单项
|
|
192
|
+
childFormData: function () {
|
|
193
|
+
return this.formItems.filter((item) => {
|
|
194
|
+
return item.type === 'rowEdit'
|
|
195
|
+
})
|
|
196
|
+
},
|
|
191
197
|
// 过滤出用于静默新增场景的表单项
|
|
192
198
|
silenceAddJsonData: function () {
|
|
193
199
|
return this.formItems.filter(function (item) {
|
|
@@ -619,6 +625,21 @@ export default {
|
|
|
619
625
|
realForm[childModel] = childData
|
|
620
626
|
}
|
|
621
627
|
}
|
|
628
|
+
// 增加form子表数据
|
|
629
|
+
if (this.childFormData.length > 0) {
|
|
630
|
+
for (const item of this.childFormData) {
|
|
631
|
+
const childModel = item.model
|
|
632
|
+
const childData = this.$refs[item.model].getTableData()
|
|
633
|
+
for (let i = 0; i < childData.length; i++) {
|
|
634
|
+
childData[i] = this.handleFormKeys(childData[i])
|
|
635
|
+
// 外键不需要带表别名,所以此处放到表单处理后赋值
|
|
636
|
+
if (realForm.id) {
|
|
637
|
+
childData[i][item.childTableForeignKeyName] = realForm.id
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
realForm[childModel] = childData
|
|
641
|
+
}
|
|
642
|
+
}
|
|
622
643
|
if (this.$listeners.onSubmit) {
|
|
623
644
|
// 交由父级处理
|
|
624
645
|
this.$emit('onSubmit', {
|
|
@@ -834,6 +855,13 @@ export default {
|
|
|
834
855
|
},
|
|
835
856
|
setForm (obj) {
|
|
836
857
|
this.form = Object.assign(this.form, obj)
|
|
858
|
+
// 给子表赋外键条件
|
|
859
|
+
if (this.childFormData.length > 0) {
|
|
860
|
+
for (const item of this.childFormData) {
|
|
861
|
+
const child = this.$refs[item.model]
|
|
862
|
+
Object.assign(child.fixedQueryForm, this.configContent.primaryKey)
|
|
863
|
+
}
|
|
864
|
+
}
|
|
837
865
|
},
|
|
838
866
|
setFormWithKey (obj) {
|
|
839
867
|
setDataByRealKey(this.form, obj)
|
|
@@ -883,8 +883,8 @@ export default {
|
|
|
883
883
|
// 把内部的crud表单录入放到表单中,以便外部可以调用
|
|
884
884
|
onComponentMounted (h, attr) {
|
|
885
885
|
console.log('crud表单', h)
|
|
886
|
-
if (
|
|
887
|
-
this.registerComponent(attr.
|
|
886
|
+
if (attr.crud) {
|
|
887
|
+
this.registerComponent(attr.model, this.$refs['childXFormTable_' + attr.model])
|
|
888
888
|
}
|
|
889
889
|
},
|
|
890
890
|
childTableFixedQueryForm (item) {
|
|
@@ -181,8 +181,8 @@ export default {
|
|
|
181
181
|
const values = []
|
|
182
182
|
if (extra.allCheckedNodes) {
|
|
183
183
|
for (const item of extra.allCheckedNodes) {
|
|
184
|
-
if (item.node.key) {
|
|
185
|
-
values.push(item.node.key)
|
|
184
|
+
if (item.node.key && item.node?.data?.props?.label !== item.node?.data?.props?.value) {
|
|
185
|
+
values.push(`${item.node.key}`)
|
|
186
186
|
}
|
|
187
187
|
if (item.children && item.children.length) {
|
|
188
188
|
this.getNodeValues(item.children, value, values)
|
|
@@ -198,7 +198,7 @@ export default {
|
|
|
198
198
|
},
|
|
199
199
|
getNodeValues (data, value, values) {
|
|
200
200
|
for (const item of data) {
|
|
201
|
-
values.push(item.node.key)
|
|
201
|
+
values.push(`${item.node.key}`)
|
|
202
202
|
if (item.children && item.children.length) {
|
|
203
203
|
this.getNodeValues(item.children, value, values)
|
|
204
204
|
}
|