|
@@ -9,8 +9,8 @@
|
|
|
<byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
|
|
|
<template #ruleVoList>
|
|
|
<div style="width: 100%">
|
|
|
- <div v-if="formData.data.ruleVoList && formData.data.ruleVoList.length > 0">
|
|
|
- <div style="display: flex; margin-bottom: 20px" v-for="(row, index) in formData.data.ruleVoList" :key="index">
|
|
|
+ <div v-if="formData.data.ruleVoList && formData.data.ruleVoList.length > 0" id="sort">
|
|
|
+ <div style="display: flex; margin-bottom: 20px" v-for="(row, index) in formData.data.ruleVoList" :key="index" ref="sort">
|
|
|
<el-form-item :prop="'ruleVoList.' + index + '.ruleType'" :rules="rules.ruleType" label="字符类型" prop="ruleType">
|
|
|
<el-select v-model="row.ruleType" placeholder="请选择字符类型" @change="changeType(row)">
|
|
|
<el-option v-for="item in ruleType" :key="item.value" :label="item.label" :value="item.value" />
|
|
@@ -72,7 +72,7 @@ import { computed, ref } from "vue";
|
|
|
import byTable from "@/components/byTable/index";
|
|
|
import byForm from "@/components/byForm/index";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
-
|
|
|
+import Sortable from 'sortablejs';
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const ruleType = ref([
|
|
|
{
|
|
@@ -174,6 +174,7 @@ const config = computed(() => {
|
|
|
el: "button",
|
|
|
click() {
|
|
|
update(row);
|
|
|
+
|
|
|
},
|
|
|
},
|
|
|
];
|
|
@@ -181,6 +182,7 @@ const config = computed(() => {
|
|
|
},
|
|
|
];
|
|
|
});
|
|
|
+
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
@@ -270,7 +272,22 @@ const update = (row) => {
|
|
|
formData.data = proxy.deepClone(row);
|
|
|
loadingDialog.value = false;
|
|
|
dialogVisible.value = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ sortableInit()
|
|
|
+ }, 500);
|
|
|
};
|
|
|
+const sort = ref()
|
|
|
+const sortableInit = () => {
|
|
|
+ console.log(document.getElementById('sort'))
|
|
|
+ const el = document.getElementById('sort');
|
|
|
+ Sortable.create(el, {
|
|
|
+ ghostClass: "sortableActive",
|
|
|
+ onEnd(evt) {
|
|
|
+ const { newIndex, oldIndex } = evt
|
|
|
+ formData.data.ruleVoList.splice(newIndex, 0, formData.data.ruleVoList.splice(oldIndex, 1)[0])
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
const clickAddRule = () => {
|
|
|
if (formData.data.ruleVoList && formData.data.ruleVoList.length > 0) {
|
|
|
formData.data.ruleVoList.push({
|
|
@@ -322,7 +339,11 @@ const getCodingKey = () => {
|
|
|
return text;
|
|
|
};
|
|
|
</script>
|
|
|
-
|
|
|
+<style>
|
|
|
+ .sortableActive{
|
|
|
+ background: #e0dfdf;
|
|
|
+ }
|
|
|
+</style>
|
|
|
<style lang="scss" scoped>
|
|
|
.tenant {
|
|
|
padding: 20px;
|