Commit ce54ed22 authored by renjintao's avatar renjintao

datagrid

parent a10adea4
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
</Form> </Form>
</slot> </slot>
</div> </div>
<div class="searchBack"> <div class="searchBack">
<slot name="searchBack"></slot> <slot name="searchBack"></slot>
</div> </div>
...@@ -298,62 +299,63 @@ export default { ...@@ -298,62 +299,63 @@ export default {
this.columnsCur = curColumns; this.columnsCur = curColumns;
} }
} }
}
});
}
this.search.pageIndex = 1;
this.search.conditions = where;
this.load();
},
pageChange(page) {
this.search.page = page;
this.search.pageIndex = page;
this.load();
},
pageSizeChange(size) {
this.search.pageSize = size;
this.search.pageIndex = 1;
this.load();
},
columnChange(item, i) {
item.hide = !item.hide;
this.$set(this.columnsCur, item, i);
this.saveUserconfig();
}, },
selectionChange(items) { loadUserConfig() {
this.$emit("on-selection-change", items); var query = {
this.selectItems = items; conditions: [{
this.footerToolbar = items.length > 0; fieldName: "creatorUserId",
fieldValue: this.userId,
conditionalType: "Equal",
}, },
onSelect(rows, row) { {
this.$emit("on-change", rows, row); fieldName: "component",
fieldValue: "Grid",
conditionalType: "Equal",
}, },
allChange(items) { {
this.$emit("all-change", items); fieldName: "page",
fieldValue: window.location.pathname,
conditionalType: "Equal",
}, },
intY() { ],
if (this.$refs.table != undefined) { pageSize: 1,
this.firstY = this.$refs.table.$el.getBoundingClientRect().top; };
this.$api.post(`${window.systemUrl}/config/list`, query).then((r) => {
if (r.success) {
if (r.result.length == 1) {
this.userConfig = r.result[0];
this.columnInit();
} }
if (!this.configLoad) {
this.easySearch();
}
this.configLoad = true;
}
});
}, },
selectAll(status) { saveUserconfig() {
this.$refs.table.selectAll(status); let url = `${window.systemUrl}/config/update`;
}, var content = [];
//批量取消 this.columnsCur.map((u) => {
cancelBatch() { content.push({
this.footerToolbar = false; key: u.key,
this.$refs.table.selectAll(false); hide: u.hide,
}, });
}, });
computed: { if (!this.userConfig) {
columnsNow() { url = `${window.systemUrl}/config/create`;
var cols = this.columnsCur.filter((u) => { var data = {
if (u.code) { page: window.location.pathname,
u.render = (h, params) => { component: "Grid",
let values = u.key; key: this.$u.guid(),
let type = "text"; content: JSON.stringify(content),
if (u.category) { };
type = u.category; this.$api.post(url, data).then((r) => {
this.loadUserConfig();
});
} else {
this.userConfig.content = JSON.stringify(content);
this.$api.post(url, this.userConfig);
} }
}, },
//展开 //展开
...@@ -442,7 +444,10 @@ computed: { ...@@ -442,7 +444,10 @@ computed: {
this.footerToolbar = items.length > 0; this.footerToolbar = items.length > 0;
}, },
onSelect(rows, row) { onSelect(rows, row) {
this.$emit("on-selection-change", rows, row); this.$emit("on-change", rows, row);
},
allChange(items) {
this.$emit("all-change", items);
}, },
intY() { intY() {
if (this.$refs.table != undefined) { if (this.$refs.table != undefined) {
...@@ -533,7 +538,7 @@ computed: { ...@@ -533,7 +538,7 @@ computed: {
this.columnsCur = this.$u.clone(this.columns); this.columnsCur = this.$u.clone(this.columns);
}, },
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
......
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