Commit a41172a9 by 胡悦

优化

1 parent 7ec7a65e
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
>新增</el-button> >新增</el-button>
</div> </div>
<el-table <el-table
ref="table" ref="menuTable"
:data="menuTableData" :data="menuTableData"
style="width: 100%" style="width: 100%"
row-key="id" row-key="id"
...@@ -259,7 +259,6 @@ export default { ...@@ -259,7 +259,6 @@ export default {
methods: { methods: {
search() { search() {
let params = Object.assign({}, this.searchForm, this.page) let params = Object.assign({}, this.searchForm, this.page)
console.log(params)
this.getList(params) this.getList(params)
}, },
// 重置搜索条件 // 重置搜索条件
...@@ -277,7 +276,6 @@ export default { ...@@ -277,7 +276,6 @@ export default {
}, },
// 确定,新增、编辑 // 确定,新增、编辑
handleConfirm() { handleConfirm() {
console.log(this.menuForm)
this.$refs.menuForm.$children[0].validate((valid) => { this.$refs.menuForm.$children[0].validate((valid) => {
if (valid) { if (valid) {
let params = JSON.parse(JSON.stringify(this.menuForm)) let params = JSON.parse(JSON.stringify(this.menuForm))
...@@ -296,7 +294,7 @@ export default { ...@@ -296,7 +294,7 @@ export default {
this.handleClose() this.handleClose()
if (params.parentId) { if (params.parentId) {
getMenuChildren({ parentId: params.parentId }).then(res => { getMenuChildren({ parentId: params.parentId }).then(res => {
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, params.parentId, res.data) this.$set(this.$refs.menuTable.store.states.lazyTreeNodeMap, params.parentId, res.data)
}) })
} else { } else {
this.search() this.search()
...@@ -319,7 +317,6 @@ export default { ...@@ -319,7 +317,6 @@ export default {
}, },
// 按钮事件 // 按钮事件
btnClick(pType, scope) { btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) { switch (pType) {
case 'create': case 'create':
this.isOpen = true this.isOpen = true
...@@ -347,7 +344,6 @@ export default { ...@@ -347,7 +344,6 @@ export default {
}, },
// 编辑触发事件 // 编辑触发事件
editEvent(row) { editEvent(row) {
console.log(row)
if (row.parentId == 0) { if (row.parentId == 0) {
this.menuData[0].children = this.$Constants.MENU_TYPE this.menuData[0].children = this.$Constants.MENU_TYPE
this.menuData[1].hidden = true this.menuData[1].hidden = true
...@@ -380,10 +376,9 @@ export default { ...@@ -380,10 +376,9 @@ export default {
}) })
if (row.parentId == 0) { if (row.parentId == 0) {
this.getList() this.getList()
} else {
getMenuChildren({ parentId: row.parentId }).then(res => { getMenuChildren({ parentId: row.parentId }).then(res => {
const nodes = res.data const nodes = res.data
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, row.parentId, nodes) this.$set(this.$refs.menuTable.store.states.lazyTreeNodeMap, 13, nodes)
}) })
} }
} else { } else {
...@@ -396,7 +391,6 @@ export default { ...@@ -396,7 +391,6 @@ export default {
this.$Common.confirmDialog(tipData) this.$Common.confirmDialog(tipData)
}, },
load(tree, treeNode, resolve) { load(tree, treeNode, resolve) {
console.log(tree, treeNode, resolve)
getMenuChildren({ parentId: tree.menuNo }).then(res => { getMenuChildren({ parentId: tree.menuNo }).then(res => {
resolve(res.data) resolve(res.data)
}) })
...@@ -413,13 +407,11 @@ export default { ...@@ -413,13 +407,11 @@ export default {
this.filterVisible = !this.filterVisible this.filterVisible = !this.filterVisible
}, },
filterConfirm() { filterConfirm() {
console.log(this.$refs.tree.getCurrentNode())
this.menuForm.parentId = this.$refs.tree.getCurrentNode().id this.menuForm.parentId = this.$refs.tree.getCurrentNode().id
this.menuForm.parentName = this.$refs.tree.getCurrentNode().label this.menuForm.parentName = this.$refs.tree.getCurrentNode().label
this.closeFilter() this.closeFilter()
}, },
filterNode(value, data) { filterNode(value, data) {
console.log(value, data)
if (!value) return true if (!value) return true
return data.label.indexOf(value) !== -1 return data.label.indexOf(value) !== -1
}, },
...@@ -452,7 +444,6 @@ export default { ...@@ -452,7 +444,6 @@ export default {
this.search() this.search()
}, },
radioChange(event, prop) { radioChange(event, prop) {
console.log(event, prop)
if (event != 1) { if (event != 1) {
this.menuData.map(item => { this.menuData.map(item => {
if (item.prop == 'parentName') { if (item.prop == 'parentName') {
......
...@@ -224,7 +224,6 @@ export default { ...@@ -224,7 +224,6 @@ export default {
}, },
// 确定,新增组织、编辑组织 // 确定,新增组织、编辑组织
handleConfirm() { handleConfirm() {
console.log(this.orginizaForm)
this.$refs.orginizaForm.$children[0].validate((valid) => { this.$refs.orginizaForm.$children[0].validate((valid) => {
if (valid) { if (valid) {
let params = { let params = {
...@@ -266,15 +265,9 @@ export default { ...@@ -266,15 +265,9 @@ export default {
this.$refs.orginizaForm.$children[0].resetFields() this.$refs.orginizaForm.$children[0].resetFields()
} }
this.orginizaVisible = !this.orginizaVisible this.orginizaVisible = !this.orginizaVisible
// if (!this.orginizaVisible) {
// this.orginizaForm = {}
// this.orginizaForm = _.cloneDeep(this.form)
// console.log(this.orginizaForm)
// }
}, },
// 按钮事件 // 按钮事件
btnClick(pType, scope) { btnClick(pType, scope) {
console.log(pType, scope, this.orginizaForm)
switch (pType) { switch (pType) {
case 'root': case 'root':
this.isRoot = true this.isRoot = true
...@@ -283,14 +276,15 @@ export default { ...@@ -283,14 +276,15 @@ export default {
this.handleClose() this.handleClose()
break break
case 'create': case 'create':
console.log('??????')
this.isRoot = false this.isRoot = false
this.orginizaData[0].hidden = false this.orginizaData[0].hidden = false
// this.$set(this.orginizaForm, 'superiorName', scope.departmentName) const obj = {
this.orginizaForm['superiorName'] = _.cloneDeep(scope.departmentName) superiorId: scope.id,
this.orginizaForm['superiorId'] = _.cloneDeep(scope.id) superiorName: scope.departmentName,
this.orginizaDialogTitle = '新增组织' + this.orginizaForm.superiorName enableStatus: true
console.log(this.orginizaForm) }
this.orginizaForm = obj
this.orginizaDialogTitle = '新增组织'
this.handleClose() this.handleClose()
break break
case 'edit': case 'edit':
...@@ -304,8 +298,6 @@ export default { ...@@ -304,8 +298,6 @@ export default {
}, },
// 编辑触发事件 // 编辑触发事件
editEvent(row) { editEvent(row) {
console.log(row)
// this.orginizaForm = JSON.parse(JSON.stringify(this.form))
organizaInfo({ id: row.id }).then(res => { organizaInfo({ id: row.id }).then(res => {
this.orginizaForm = _.cloneDeep(res.data) this.orginizaForm = _.cloneDeep(res.data)
this.orginizaForm.enableStatus = row.enableStatus == 1 ? true : false this.orginizaForm.enableStatus = row.enableStatus == 1 ? true : false
...@@ -315,7 +307,6 @@ export default { ...@@ -315,7 +307,6 @@ export default {
} else { } else {
this.isRoot = false this.isRoot = false
} }
console.log(this.orginizaForm)
this.handleClose() this.handleClose()
}) })
}, },
...@@ -353,7 +344,6 @@ export default { ...@@ -353,7 +344,6 @@ export default {
}, },
// 树形table懒加载 // 树形table懒加载
load(tree, treeNode, resolve) { load(tree, treeNode, resolve) {
console.log(tree, treeNode, resolve)
getChildren({ rootId: tree.id }).then(res => { getChildren({ rootId: tree.id }).then(res => {
let nodes = res.data let nodes = res.data
resolve(nodes) resolve(nodes)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!