Skip to content

Commit

Permalink
加入asyncCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Feb 14, 2019
1 parent a487a20 commit 130dc88
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/components/CrudTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export default {
default: 'add,clear,search',
},
asyncCondition: {
type: String,
default: '',
type: Object,
default: () => ({}),
},
},
data() {
Expand Down Expand Up @@ -121,7 +121,18 @@ export default {
id: '',
};
},
watch: {
asyncCondition: {
deep: true,
handler(val) {
console.log(val)
this.listQuery.searchArr[0].SearchKey = val.searchKey
this.listQuery.searchArr[0].SearchValue = val.searchValue
this.fetchData(this.listQuery);
},
},
},
created() {
this.fetchData(this.listQuery);
this.getObj();
Expand Down
13 changes: 11 additions & 2 deletions src/views/system/dict.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
node-key="id"
highlight-current
:default-expanded-keys="['00000000-0000-0000-0000-000000000001']"
@node-click="treeClick"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
Expand Down Expand Up @@ -38,7 +39,7 @@
</el-tree>
</el-col>
<el-col :span="16">
<crud-table tableName="dict" class="no-boxshadow no-padding-top" toolbarButton="add,clear" handleButton="edit,delete"></crud-table>
<crud-table tableName="dict" :asyncCondition="asyncCondition" class="no-boxshadow no-padding-top" toolbarButton="add,clear" handleButton="edit,delete"></crud-table>

</el-col>

Expand Down Expand Up @@ -108,6 +109,10 @@ export default {
sort: '',
pid: '',
},
asyncCondition: {
searchKey: '',
searchValue: '',
},
dialogStatus: '',
defaultProps: {
children: 'children',
Expand Down Expand Up @@ -157,7 +162,11 @@ export default {
});
},
treeClick(data) {
console.log(data)
this.asyncCondition.searchKey = 'dictid'
this.asyncCondition.searchValue = data.id
},
Edit(id) {
GetDictTypeDetail(id).then((response) => {
this.entity = response.data;
Expand Down

0 comments on commit 130dc88

Please sign in to comment.