|
|
|
@ -41,7 +41,7 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="showFlag" label="是否显示"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-switch active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" |
|
|
|
|
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" |
|
|
|
|
inactive-color="#ff4949"> |
|
|
|
|
</el-switch> |
|
|
|
|
</template> |
|
|
|
@ -52,7 +52,7 @@ |
|
|
|
|
<el-dropdown> |
|
|
|
|
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button> |
|
|
|
|
<el-dropdown-menu slot="dropdown"> |
|
|
|
|
<el-dropdown-item > |
|
|
|
|
<el-dropdown-item> |
|
|
|
|
<span @click="edit(scope.row)">编辑</span> |
|
|
|
|
</el-dropdown-item> |
|
|
|
|
<el-dropdown-item v-if="scope.row.level == 1"> |
|
|
|
@ -76,7 +76,7 @@ |
|
|
|
|
|
|
|
|
|
<!-- 添加 编辑表单--> |
|
|
|
|
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from> |
|
|
|
|
<el-dialog title="添加分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false"> |
|
|
|
|
<el-dialog title="分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false"> |
|
|
|
|
<edit ref="edit" :parentOptions="tableData" /> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
@ -148,31 +148,36 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 添加 |
|
|
|
|
addClass(parent = null) { |
|
|
|
|
this.editDialogConfig.visible = true; |
|
|
|
|
this.$refs.edit.model = "classifySave"; |
|
|
|
|
// this.$nextTick(()=>{ |
|
|
|
|
// this.$refs.edit.parent = parent; |
|
|
|
|
// }); |
|
|
|
|
this.editDialogConfig.visible = true; |
|
|
|
|
if (parent) { |
|
|
|
|
let { categoryName, id } = parent; |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs.edit.updateModel("classifySave"); |
|
|
|
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 }); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 编辑 |
|
|
|
|
edit(row) { |
|
|
|
|
this.editDialogConfig.visible = true; |
|
|
|
|
this.$nextTick(()=>{ |
|
|
|
|
let { level, icon, showFlag, categoryName, sort, parentId,id } = row; |
|
|
|
|
console.log(this.tableData.find(item=>item==parentId),"categoryName") |
|
|
|
|
if (row.level == 1) { |
|
|
|
|
this.$refs.edit.model = "classifyUpdate"; |
|
|
|
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId,id }) |
|
|
|
|
} else { |
|
|
|
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag,parentCategoryName:this.tableData.find(item=>item==parentId).categoryName, categoryName, sort, parentId,id }) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
edit(row) { |
|
|
|
|
this.editDialogConfig.visible = true; |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
let { level, icon, showFlag, categoryName, sort, parentId, id } = row; |
|
|
|
|
this.$refs.edit.updateModel("classifyUpdate"); |
|
|
|
|
if (row.level == 1) { |
|
|
|
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id }) |
|
|
|
|
} else { |
|
|
|
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, |
|
|
|
|
{ |
|
|
|
|
level, |
|
|
|
|
icon, |
|
|
|
|
showFlag, |
|
|
|
|
parentCategoryName: this.tableData.find(item => item.id == parentId).categoryName, |
|
|
|
|
categoryName, |
|
|
|
|
sort, |
|
|
|
|
parentId, id |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 修改状态 |
|
|
|
|
onchangeIsShow(row) { |
|
|
|
|