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. 6
      src/views/category/orderingRule/module/form.vue

6
src/views/category/form.vue

@ -70,7 +70,11 @@ export default {
[CRUD.HOOK.beforeToAdd]() {
this.form.isType = null
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) {
item.typeState = true
}

27
src/views/category/index.vue

@ -40,7 +40,7 @@
</template>
<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.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>
</crudOperation>
<!--门类树状结构-->
@ -115,7 +115,8 @@ export default {
selectedCategory: {},
deleteData: {},
activeIndex: 0,
sortLoading: false
sortLoading: false,
brotherNodeNum: 0
// sortTableData: []
}
},
@ -136,15 +137,17 @@ export default {
}
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: {
//
// [CRUD.HOOK.beforeRefresh]() {
// if (this.$refs.dictDetail) {
// this.$refs.dictDetail.query.id = ''
// }
// return true
// },
//
findNode(tree, func) {
for (const node of tree) {
@ -199,6 +202,10 @@ export default {
}
//
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()
},
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
},
changeActiveTab(data) {

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

@ -34,8 +34,8 @@
<el-table-column prop="fieldCnName" label="显示字段" align="center" />
<el-table-column label="排序方式" align="center">
<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>
</el-table-column>
</el-table>

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

@ -41,8 +41,6 @@ export default {
},
methods: {
save() {
this.$refs['formData'].validate((valid) => {
if (valid) {
edit(this.formData.fields).then((res) => {
this.$notify({
title: '保存成功',
@ -52,10 +50,6 @@ export default {
this.cuDialogVisible = false
this.$emit('refresh')
})
} else {
return false
}
})
}
}
}

Loading…
Cancel
Save