| | |
| | | <script> |
| | | import {getTreeList} from "@/api/MasterData/master"; |
| | | import {mapMutations, mapState} from "vuex"; |
| | | import {TableData} from "@/api/GetItem"; |
| | | import {TableData,MasterTable} from "@/api/GetItem"; |
| | | |
| | | export default { |
| | | name: "MasterTree", |
| | |
| | | }, |
| | | data(){ |
| | | return{ |
| | | tableHeadFindData:[], |
| | | tableHeadDataFateher:[], |
| | | templateOids:"", |
| | | tableDataArray:[], |
| | | codeClassifyOid:"", |
| | | coderuleoid:"", |
| | |
| | | this.ModifyProperties(this.Treedata, 'text', 'label'); |
| | | this.codeClassifyOid=res.data[0].oid; |
| | | this.coderuleoid=res.data[0].attributes.coderuleoid; |
| | | this.$emit("codeClassifyOid", this.codeClassifyOid ) |
| | | this.$emit("coderuleoid", this.coderuleoid ) |
| | | }).catch(res=>{ |
| | | console.log(res) |
| | |
| | | } |
| | | } |
| | | }, |
| | | //树点击事件 |
| | | nodeClick(data){ |
| | | this.nodeClickList = data; |
| | | console.log(this.currentPage,this.pageSize) |
| | | //表格刷新 |
| | | TableRend(){ |
| | | TableData({ |
| | | templateOid: this.templateOid, |
| | | codeClassifyOid: this.codeClassifyOid, |
| | | page: this.pageSize, |
| | | limit:this.currentPage, |
| | | templateOid: this.templateOids, |
| | | codeClassifyOid: this.nodeClickList.oid, |
| | | page: this.currentPage, |
| | | limit: this.pageSize, |
| | | }).then(res => { |
| | | console.log(res) |
| | | // this.page.total = res.data.total; |
| | | // this.data = res.data.data; |
| | | this.tableDataArray=res.data.data; |
| | | this.$emit('tableDataArray',this.tableDataArray) |
| | | console.log(this.tableDataArray) |
| | | this.$emit('total',res.data.total) |
| | | console.log('table',this.tableDataArray) |
| | | }) |
| | | }, |
| | | //表格头部 |
| | | TableHeadRend() { |
| | | return new Promise((resolve,reject)=>{ |
| | | MasterTable({ |
| | | codeClassifyOid: this.nodeClickList.oid, |
| | | functionId: 5, |
| | | }).then(res => { |
| | | this.tableHeadDataFateher = res.data; |
| | | this.templateOids = res.data.tableDefineVO.oid; |
| | | let List = res.data.tableDefineVO.cols[0]; |
| | | List.forEach(item => { |
| | | let columnItem = { |
| | | label: item.title, |
| | | prop: item.field, |
| | | // type: this.columnType[item.type], |
| | | sortable: item.sort, |
| | | width: item.minWidth |
| | | }; |
| | | this.tableHeadFindData.push(columnItem) |
| | | // console.log(' this.tableHeadFindData', this.tableHeadFindData) |
| | | }) |
| | | this.$emit('tableHeadDataFateher', this.tableHeadDataFateher); |
| | | this.$emit('tableHeadFindData', this.tableHeadFindData); |
| | | resolve(); |
| | | }).catch(err=>{ |
| | | reject(err) |
| | | }) |
| | | }) |
| | | }, |
| | | //树点击事件 |
| | | async nodeClick(data) { |
| | | try { |
| | | this.nodeClickList = data; |
| | | await this.TableHeadRend(); // 先执行 TableHeadRend() |
| | | this.TableRend(); // TableHeadRend() 方法完成后再执行 TableRend() |
| | | this.$emit('nodeClick',this.templateOids) |
| | | this.$emit("codeClassifyOid", this.nodeClickList.oid ) |
| | | // console.log('元数据',this.templateOids) |
| | | // console.log('元数据cod',this.codeClassifyOid) |
| | | // console.log('元数据nodeclick', this.nodeClickList.oid) |
| | | // console.log(this.tableHeadFindData) |
| | | } catch (error) { |
| | | // 处理错误 |
| | | this.$message.error(error) |
| | | } |
| | | } |
| | | } |
| | | } |