Browse Source

门类管理 排序修改

master
z_yu 3 years ago
parent
commit
49ceae85c0
  1. 6
      src/views/category/form.vue
  2. 27
      src/views/category/index.vue
  3. 4
      src/views/category/orderingRule/index.vue
  4. 22
      src/views/category/orderingRule/module/form.vue

6
src/views/category/form.vue

@ -70,7 +70,11 @@ export default {
[CRUD.HOOK.beforeToAdd]() { [CRUD.HOOK.beforeToAdd]() {
this.form.isType = null this.form.isType = null
this.selectOptions.forEach(item => { this.selectOptions.forEach(item => {
if (this.selectedCategory.isType === 2) {
if (this.selectedCategory.isType === 1) {
if (item.value === 4) {
item.typeState = true
}
} else if (this.selectedCategory.isType === 2) {
if (item.value !== 3) { if (item.value !== 3) {
item.typeState = true item.typeState = true
} }

27
src/views/category/index.vue

@ -40,7 +40,7 @@
</template> </template>
<template v-slot:right> <template v-slot:right>
<el-button v-permission="permission.del" icon="el-icon-delete" size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)">删除</el-button> <el-button v-permission="permission.del" icon="el-icon-delete" size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)">删除</el-button>
<el-button v-permission="permission.sort" icon="el-icon-sort" size="mini" :loading="sortLoading" :disabled="!crud.selections[0]||!crud.selections[0].children || crud.selections[0].children.length <= 1" @click="toSort(crud.selections)">排序</el-button>
<el-button v-permission="permission.sort" icon="el-icon-sort" size="mini" :loading="sortLoading" :disabled="brotherNodeNum.length <= 1" @click="toSort(crud.selections)">排序</el-button>
</template> </template>
</crudOperation> </crudOperation>
<!--门类树状结构--> <!--门类树状结构-->
@ -115,7 +115,8 @@ export default {
selectedCategory: {}, selectedCategory: {},
deleteData: {}, deleteData: {},
activeIndex: 0, activeIndex: 0,
sortLoading: false
sortLoading: false,
brotherNodeNum: 0
// sortTableData: [] // sortTableData: []
} }
}, },
@ -136,15 +137,17 @@ export default {
} }
return 'baseInfo' return 'baseInfo'
} }
// ,
// brotherNodeNum: function() {
// const selectedNode = this.$refs.tree.getCurrentNode()
// if (selectedNode && selectedNode.pid && this.$refs.tree.getNode(selectedNode.pid)) {
// return this.$refs.tree.getNode(selectedNode.pid).childNodes.length
// } else {
// return 0
// }
// }
}, },
methods: { methods: {
//
// [CRUD.HOOK.beforeRefresh]() {
// if (this.$refs.dictDetail) {
// this.$refs.dictDetail.query.id = ''
// }
// return true
// },
// //
findNode(tree, func) { findNode(tree, func) {
for (const node of tree) { for (const node of tree) {
@ -199,6 +202,10 @@ export default {
} }
// //
localStorage.setItem('currentCategoryKey', JSON.stringify(val)) localStorage.setItem('currentCategoryKey', JSON.stringify(val))
this.brotherNodeNum = val.pid
if (this.$refs.tree.getNode(val.pid) && this.$refs.tree.getNode(val.pid).childNodes) {
this.brotherNodeNum = this.$refs.tree.getNode(val.pid).childNodes.length
}
} }
}, },
// - / // - /
@ -230,7 +237,7 @@ export default {
done() done()
}, },
toSort(data) { toSort(data) {
this.$refs.sort.sortTableData = data[0].children
this.$refs.sort.sortTableData = this.$refs.tree.getNode(data[0].pid).data.children
this.$refs.sort.sortVisible = true this.$refs.sort.sortVisible = true
}, },
changeActiveTab(data) { changeActiveTab(data) {

4
src/views/category/orderingRule/index.vue

@ -34,8 +34,8 @@
<el-table-column prop="fieldCnName" label="显示字段" align="center" /> <el-table-column prop="fieldCnName" label="显示字段" align="center" />
<el-table-column label="排序方式" align="center"> <el-table-column label="排序方式" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.isOrderType === 'asc'">升序</span>
<span v-if="scope.row.isOrderType === 'desc'">降序</span>
<span v-if="scope.row.displayOrderBy === 'asc'">升序</span>
<span v-if="scope.row.displayOrderBy === 'desc'">降序</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

22
src/views/category/orderingRule/module/form.vue

@ -41,20 +41,14 @@ export default {
}, },
methods: { methods: {
save() { save() {
this.$refs['formData'].validate((valid) => {
if (valid) {
edit(this.formData.fields).then((res) => {
this.$notify({
title: '保存成功',
type: 'success',
duration: 2500
})
this.cuDialogVisible = false
this.$emit('refresh')
})
} else {
return false
}
edit(this.formData.fields).then((res) => {
this.$notify({
title: '保存成功',
type: 'success',
duration: 2500
})
this.cuDialogVisible = false
this.$emit('refresh')
}) })
} }
} }

Loading…
Cancel
Save