diff --git a/packages/filter/index.vue b/packages/filter/index.vue
index d62c998..793aed8 100644
--- a/packages/filter/index.vue
+++ b/packages/filter/index.vue
@@ -1,5 +1,5 @@
-
+
查询
@@ -20,7 +20,7 @@ export default {
list: Array,
labelWidth: {
type: String,
- default: '80px',
+ default: '110px',
},
size: {
type: String,
@@ -39,6 +39,7 @@ export default {
type: Object,
default: () => ({}),
},
+ params: Object,
},
data() {
return {
diff --git a/packages/form/form-render.vue b/packages/form/form-render.vue
index 907ec78..47149cf 100644
--- a/packages/form/form-render.vue
+++ b/packages/form/form-render.vue
@@ -56,8 +56,8 @@
item.type($createElement, {
model: value,
config: {
- props: { ...item.props, value: itemValue(item) },
- style: item.style || { maxWidth: '100%' },
+ props: { ...propsFormatter(item.props), value: itemValue(item) },
+ style: item.style || { width: '100%' },
on: {
...bindItemEvent(item),
input: v => onInput({ value: v, item }),
@@ -72,8 +72,8 @@
:value="itemValue(item)"
@input="v => onInput({ value: v, item })"
v-on="bindItemEvent(item)"
- v-bind="item.props"
- :style="item.style || { maxWidth: '100%' }"
+ v-bind="propsFormatter(item.props)"
+ :style="item.style || { width: '100%' }"
>
@@ -101,6 +101,7 @@ export default {
groupClass: String,
type: String,
span: Number,
+ params: Object,
},
computed: {
rowComponent() {
@@ -202,10 +203,21 @@ export default {
bindItemVisible(item, type) {
const visible = item[type];
if (typeof visible === 'function') {
- return visible(this.model);
+ return visible(this.model, this.params || {});
}
return item[type] !== false;
},
+ /**
+ * @description 格式化props属性
+ * @param {Object|Function} props 属性或属性对象
+ * @returns {Object} 格式化的属性
+ */
+ propsFormatter(props) {
+ if (typeof props === 'function') {
+ return props(this.model, this.params || {});
+ }
+ return props || {};
+ },
},
};
diff --git a/packages/form/index.vue b/packages/form/index.vue
index 3aefdd2..30ef4a2 100644
--- a/packages/form/index.vue
+++ b/packages/form/index.vue
@@ -1,22 +1,39 @@
-
-
+
+
@@ -68,6 +89,7 @@ export default {
type: Object,
default: () => ({}),
},
+ params: Object,
},
data() {
return {
@@ -136,8 +158,11 @@ export default {
* @description 校验表单
*/
validate() {
- this.$refs.form.validate(valid => {
- this.$emit('validate', valid, this.model);
+ return new Promise(resolve => {
+ this.$refs.form.validate(valid => {
+ this.$emit('validate', valid, this.model);
+ return resolve(valid);
+ });
});
},
/**
diff --git a/packages/scheme/index.vue b/packages/scheme/index.vue
index acd2e79..f861f49 100644
--- a/packages/scheme/index.vue
+++ b/packages/scheme/index.vue
@@ -19,6 +19,7 @@
@search="search"
:loading="loading"
v-bind="filterProps"
+ :params="_slotScope"
>
@@ -70,7 +71,7 @@
-
+
@@ -116,43 +117,47 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -336,8 +341,10 @@ export default {
openDialog: this.openDialog,
closeDialog: this.closeDialog,
openView: this.openView,
+ openEdit: this.openEdit,
handleDelete: this.handleDelete,
size: this.size,
+ dialogType: this.dialogType,
};
},
_alias() {
@@ -461,6 +468,7 @@ export default {
.then(() => {
this.$message.success('保存成功');
this.closeDialog();
+ this.search();
})
.catch(() => {
this.$message.error('保存失败');
@@ -508,6 +516,7 @@ export default {
getAPI(row)
.then(result => {
this.editForm = result;
+ this.$emit('update:formModel', result || {});
})
.finally(() => {
this.dialogLoading = false;
@@ -535,6 +544,7 @@ export default {
viewAPI(row)
.then(result => {
this.editForm = result;
+ this.$emit('update:formModel', result || {});
})
.finally(() => {
this.dialogLoading = false;
@@ -590,17 +600,18 @@ export default {
// 关闭弹出框
closeDialog() {
this.dialogVisible = false;
+ this.dialogRender = false;
+ this.dialogType = 'none';
this.$emit('dialog-change', 'none');
},
// 清空表单
clearEditForm() {
this.editForm = {};
+ this.$emit('update:formModel', {});
},
// 弹出框关闭动画结束
onDialogClosed() {
this.clearEditForm();
- this.dialogRender = false;
- this.dialogType = 'none';
},
// 分页-每页个数
handleSizeChange(val) {
--
libgit2 0.21.0