update 项目管理

This commit is contained in:
2021-04-29 16:09:30 +08:00
parent 654bb19130
commit 5f7dae2380
3 changed files with 115 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
<template>
<yo-tree-layout :load-data="loadTreeData" @select="onSelect" default-expanded-keys ref="tree-layout">
<container></container>
</yo-tree-layout>
</template>
<script>
import YoTreeLayout from '@/components/yoTreeLayout';
export default {
components: {
YoTreeLayout,
},
data() {
return {
query: {},
columns: [
{
title: '项目名称',
width: '400px',
dataIndex: 'name',
sorter: true,
},
],
};
},
created() {},
methods: {
/**
* 树形选择界面必要的方法
* 传给yo-table-layout以示意数据接口
*/
loadTreeData() {
return this.$api.getAreaTree().then((res) => {
return res.data;
});
},
onSelect([id]) {
this.query = {
pid: id,
};
this.onQuery();
},
/**
* 必要的方法
* 传给yo-table以示意数据接口及其参数和返回的数据结构
*/
loadData(params) {
return this.$api
.getHouseProjectPage({
...params,
...this.query,
})
.then((res) => {
return res.data;
});
},
/**
* 有查询功能时的必要方法
* 加载数据时初始化分页信息
*/
onQuery() {
this.$refs.table.onReloadData(true);
},
onReset() {
Object.keys(this.query).forEach((p) => {
if (p !== 'pid') {
this.query[p] = undefined;
}
});
this.onQuery();
},
/**
* 必要方法
* 重新列表数据
*/
onReloadData() {
this.$refs.table.onReloadData();
this.$refs['tree-layout'].onReloadData();
},
/**
* 有编辑新增功能的必要方法
* 从列表页调用窗口的打开方法
*/
// onOpen(formName, record) {
// this.$refs[formName].onOpen(record, this.query['pid']);
// },
// onDelete(record) {
// this.$api.sysOrgDelete(record).then(({ success }) => {
// if (success) {
// this.$message.success('删除成功');
// this.onReloadData();
// if (this.query['pid'] == record.id) {
// delete this.query.pid;
// }
// }
// });
// },
},
};
</script>