权限 添加拖拽功能

This commit is contained in:
bjdgyc 2024-09-09 16:52:32 +08:00
parent 2ba3625885
commit e8a8773005
1 changed files with 22 additions and 3 deletions

View File

@ -191,7 +191,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
title="用户组" title="用户组"
:visible.sync="user_edit_dialog" :visible.sync="user_edit_dialog"
width="750px" width="850px"
@close='closeDialog' @close='closeDialog'
center> center>
@ -410,9 +410,17 @@
</el-col> </el-col>
</el-row> </el-row>
<!-- 添加拖拽功能 -->
<draggable v-model="ruleForm.link_acl" handle=".drag-handle" @end="onEnd">
<el-row v-for="(item,index) in ruleForm.link_acl" <el-row v-for="(item,index) in ruleForm.link_acl"
:key="index" style="margin-bottom: 5px" :gutter="1"> :key="index" style="margin-bottom: 5px" :gutter="1">
<el-col :span="10">
<el-col :span="1" class="drag-handle">
<i class="el-icon-rank"></i>
</el-col>
<el-col :span="9">
<el-input placeholder="请输入CIDR地址" v-model="item.val"> <el-input placeholder="请输入CIDR地址" v-model="item.val">
<el-select v-model="item.action" slot="prepend"> <el-select v-model="item.action" slot="prepend">
<el-option label="允许" value="allow"></el-option> <el-option label="允许" value="allow"></el-option>
@ -438,6 +446,8 @@
@click.prevent="removeDomain(ruleForm.link_acl,index)"></el-button> @click.prevent="removeDomain(ruleForm.link_acl,index)"></el-button>
</el-col> </el-col>
</el-row> </el-row>
</draggable>
</el-form-item> </el-form-item>
</el-tab-pane> </el-tab-pane>
@ -512,10 +522,11 @@
<script> <script>
import axios from "axios"; import axios from "axios";
import draggable from 'vuedraggable'
export default { export default {
name: "List", name: "List",
components: {}, components: {draggable},
mixins: [], mixins: [],
created() { created() {
this.$emit('update:route_path', this.$route.path) this.$emit('update:route_path', this.$route.path)
@ -621,6 +632,9 @@ export default {
} }
}, },
methods: { methods: {
onEnd: function() {
window.console.log("onEnd", this.ruleForm.link_acl);
},
setAuthData(row) { setAuthData(row) {
if (!row) { if (!row) {
this.ruleForm.auth = JSON.parse(JSON.stringify(this.defAuth)); this.ruleForm.auth = JSON.parse(JSON.stringify(this.defAuth));
@ -906,4 +920,9 @@ export default {
flex: 1; flex: 1;
overflow: auto; overflow: auto;
} }
.drag-handle {
cursor: move;
}
</style> </style>