|
@@ -10,7 +10,7 @@
|
|
<template #ruleVoList>
|
|
<template #ruleVoList>
|
|
<div style="width: 100%">
|
|
<div style="width: 100%">
|
|
<div v-if="formData.data.ruleVoList && formData.data.ruleVoList.length > 0" id="sort">
|
|
<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">
|
|
|
|
|
|
+ <div style="display: flex; margin-bottom: 20px" v-for="(row, index) in formData.data.ruleVoList" :key="row.timeKey" ref="sort">
|
|
<el-form-item :prop="'ruleVoList.' + index + '.ruleType'" :rules="rules.ruleType" label="字符类型" prop="ruleType">
|
|
<el-form-item :prop="'ruleVoList.' + index + '.ruleType'" :rules="rules.ruleType" label="字符类型" prop="ruleType">
|
|
<el-select v-model="row.ruleType" placeholder="请选择字符类型" @change="changeType(row)">
|
|
<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" />
|
|
<el-option v-for="item in ruleType" :key="item.value" :label="item.label" :value="item.value" />
|
|
@@ -270,6 +270,14 @@ const submitForm = () => {
|
|
};
|
|
};
|
|
const update = (row) => {
|
|
const update = (row) => {
|
|
formData.data = proxy.deepClone(row);
|
|
formData.data = proxy.deepClone(row);
|
|
|
|
+ formData.data.ruleVoList = formData.data.ruleVoList.map(item => {
|
|
|
|
+ //timeKey
|
|
|
|
+ return {
|
|
|
|
+ ...item,
|
|
|
|
+ timeKey: new Date().getTime() + item.value + Math.random()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ console.log(formData.data.ruleVoList)
|
|
loadingDialog.value = false;
|
|
loadingDialog.value = false;
|
|
dialogVisible.value = true;
|
|
dialogVisible.value = true;
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -284,6 +292,7 @@ const sortableInit = () => {
|
|
ghostClass: "sortableActive",
|
|
ghostClass: "sortableActive",
|
|
onEnd(evt) {
|
|
onEnd(evt) {
|
|
const { newIndex, oldIndex } = evt
|
|
const { newIndex, oldIndex } = evt
|
|
|
|
+ console.log(newIndex, oldIndex)
|
|
formData.data.ruleVoList.splice(newIndex, 0, formData.data.ruleVoList.splice(oldIndex, 1)[0])
|
|
formData.data.ruleVoList.splice(newIndex, 0, formData.data.ruleVoList.splice(oldIndex, 1)[0])
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -293,12 +302,14 @@ const clickAddRule = () => {
|
|
formData.data.ruleVoList.push({
|
|
formData.data.ruleVoList.push({
|
|
ruleType: "",
|
|
ruleType: "",
|
|
value: "",
|
|
value: "",
|
|
|
|
+ timeKey:new Date().getTime(),
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
formData.data.ruleVoList = [
|
|
formData.data.ruleVoList = [
|
|
{
|
|
{
|
|
ruleType: "",
|
|
ruleType: "",
|
|
value: "",
|
|
value: "",
|
|
|
|
+ timeKey:new Date().getTime(),
|
|
},
|
|
},
|
|
];
|
|
];
|
|
}
|
|
}
|