@@ -136,6 +135,7 @@
this.types = edit_to_migration.filter(item => item.edit_input !== 'textarea' && item.edit_input !==
"richtext" &&
item.edit_input !== "file" && item.edit_input !== "map");
+
},
// 获取自定义表单列表
async getFormList() {
@@ -147,9 +147,12 @@
}],
...this.select
})
- this.formList = res.data
- this.updateObjects(this.selectFormList, this.formList)
-
+ this.formList = res.data
+ // this.updateObjects(this.selectFormList, this.formList)
+ // let _arr = this.removeMatchingItems(this.selectFormList, this.formList)
+ // this.formList.push(..._arr)
+ // this.selectFormList = _arr
+ console.log("_arr",_arr)
console.log("this.selectFormList", this.selectFormList, this.formList)
},
@@ -161,7 +164,7 @@
if (match) {
// 如果找到了匹配项,则更新a中的对象
- Object.assign(match, objB);
+ Object.assign(match, objB);
match.is_open = true
return false; // 不包含在新的数组中
} else {
@@ -173,6 +176,13 @@
b.length = 0; // 清空原始数组
b.push(...updatedB); // 将过滤后的数组元素添加回原始数组
},
+ removeMatchingItems(a, b) {
+ // 创建一个 Set 来存储数组 b 中所有 filed 字段的值
+ const bFiledValues = new Set(b.map(item => item.field));
+
+ // 使用 filter 方法筛选出数组 a 中没有匹配项的对象
+ return a.filter(item => !bFiledValues.has(item.field));
+ },
// 新增 移动
changeHandler(e) {
if (e.added) {
@@ -201,11 +211,17 @@
newIndex,
oldIndex
} = e.moved;
- element.sort = newIndex;
- if (element) {
- this.formList.splice(oldIndex, 1);
- this.formList.splice(newIndex, 0, element);
+ element.sort = newIndex;
+ console.log(element)
+ if(element.id){
+ this.saveSelect(element)
+ }else{
+ this.formList.splice(oldIndex, 1);
+ this.formList.splice(newIndex, 0, element);
}
+ // if (element) {
+
+ // }
}
},
@@ -261,15 +277,15 @@
if (newval) {
this.getFormList()
} else {
- this.course_id = ''
- this.selectFormList.map(item=>{
- item.is_open = false
- if(item.id){
- item.id = ''
- }
- if(item.course_id){
- item.course_id = ''
- }
+ this.course_id = ''
+ this.selectFormList.map(item => {
+ item.is_open = false
+ if (item.id) {
+ item.id = ''
+ }
+ if (item.course_id) {
+ item.course_id = ''
+ }
})
this.$emit("refresh")
}
diff --git a/src/views/course/components/editPane.vue b/src/views/course/components/editPane.vue
index 6b1b91b..252151b 100644
--- a/src/views/course/components/editPane.vue
+++ b/src/views/course/components/editPane.vue
@@ -1,278 +1,250 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 保存
-
- 确定删除字段吗?
-
- 取消
- 确定
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/course/index.vue b/src/views/course/index.vue
index 5a7be05..15c5fbb 100644
--- a/src/views/course/index.vue
+++ b/src/views/course/index.vue
@@ -52,8 +52,7 @@
- {{scope.row.sign_start_date?scope.row.sign_start_date:''}}
- {{scope.row.sign_end_date?"至"+scope.row.sign_end_date:'起'}}
+ {{scope.row.sign_start_date?scope.row.sign_start_date:''}}{{scope.row.sign_end_date?"至"+scope.row.sign_end_date:'起'}}