This commit is contained in:
2025-02-12 15:45:39 +08:00
parent b7d72640b6
commit d11b02b06b
5 changed files with 3600 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -961,7 +961,7 @@
"
>
<el-button type="primary" @click="saveUserIndex(userIndexForm)" style="float: right">{{ $t('citeList.save') }}</el-button>
<el-button style="float: right; margin-right: 20px">{{ $t('citeList.cancel') }}</el-button>
<el-button style="float: right; margin-right: 20px" @click="aiSorbox=false">{{ $t('citeList.cancel') }}</el-button>
</div>
</el-drawer>

View File

@@ -0,0 +1,192 @@
<template>
<div class="block commonMajor" style="width: 100%;overflow: hidden;">
<el-button type="primary" plain size="mini" @click="handleAdd" style="float:right;margin-bottom: 20px;"><i class="el-icon-plus" ></i>Add Field </el-button>
<div
v-for="(field, index) in fields"
:key="index"
class="cascader-container"
style="margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between"
>
<span style="margin-right: 10px; font-size: 12px; color: #006699; font-weight: bold">Field {{ Number(index+1) }} :</span>
<el-cascader
:ref="`cascader${index}`"
@change="handleChange(index)"
v-model="field.selectedValue"
:placeholder="'Please select Field '"
:options="options"
:props="getProps()"
style="width: calc(100% - 120px)"
></el-cascader>
<!-- Delete button -->
<el-button size="mini" type="danger" style="margin-left: 10px;" @click="handleDelete(index)"><i class="el-icon-delete"></i></el-button>
</div>
<!-- <el-dialog title="Add Field " :visible.sync="coreVisible1" width="780px" :close-on-click-modal="false">
<el-form :model="coreForm1" :rules="rules1" ref="core_Form1" label-width="140px" >
<el-form-item prop="major">
<span slot="label">
<i style="color: #f56c6c; margin-right: 4px">*</i>
Field
</span>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="coreVisible1 = false">Cancel</el-button>
<el-button type="primary" @click="onSubmit_core1(coreForm1)">Save</el-button>
</span>
</el-dialog> -->
<!-- 渲染多个 el-cascader 组件 -->
</div>
</template>
<script>
export default {
props: {
userId: {
type: String,
default: ''
}
},
data() {
return {
rules1:{},
coreVisible1: false,
coreForm1: {
majorList: []
},
fields: [{}], // 用于存储多个领域的选项数据
options: [] // 用于存储级联选择的选项数据
};
},
created() {
this.loadFields(); // 初始化时加载数据
},
methods: {
handleChange(i) {
console.log('.blur at line 45:');
console.log('i at line 40:', i);
this.$nextTick(() => {
this.$refs[`cascader${i}`][0].dropDownVisible = false;
this.coreForm1.majorList = this.fields[i].selectedValue;
this.$emit('load',this.fields.map(item => item.selectedValue[item.selectedValue.length - 1]))
this.$forceUpdate();
});
},
onSubmit_core1(coreForm) {
console.log('coreForm at line 1963:', coreForm);
if(!this.fields[0].selectedValue||this.fields[0].selectedValue.length == 0){
this.$message.error('Please select Field !');
return false;
}
this.$refs.core_Form1.validate((valid) => {
if (valid) {
this.$api
.post('api/User/addUserMajor', {
user_id: this.userId,
major_id: this.coreForm1.majorList[this.coreForm1.majorList.length - 1]
})
.then((res) => {
if (res.code == 0) {
this.$message.success('Personal information modified successfully!');
this.coreVisible1 = false;
// this.tipVisible = false;
this.$emit('load')
} else {
this.$message.error(res.msg);
}
})
.catch((err) => {
this.$message.error(err);
});
} else {
this.$message.error('error submit!!');
return false;
}
});
},
// 动态添加一个新的 Cascader
handleAdd() {
this.$nextTick(() => {
// this.fields=[]
this.fields.push({ selectedValue: [] }); // 添加一个新的字段
// this.coreVisible1 = true;
});
},
// 删除指定的 Cascader
handleDelete(index) {
this.fields.splice(index, 1); // 删除指定索引的字段
},
// 获取 Cascader 配置
getProps() {
return {
value: 'value',
label: 'label',
children: 'children',
checkStrictly: true, // 允许任意选择一级
expandTrigger: 'hover' // 使用 hover 触发展开
};
},
// API 调用,获取子节点数据
getMajor(majorId) {
return this.$api
.post('api/Ucenter/getMajor', { major_id: majorId })
.then((response) => response.data)
.catch((error) => {
console.error('API Error:', error);
return [];
});
},
// 加载多个领域数据
loadFields() {
this.$api.post('api/Major/getMajorList', {}).then((res) => {
const transformData = (data) => {
return data.map((item) => {
const transformedItem = {
...item,
value: item.major_id,
label: `${item.major_title}`
};
// 如果存在 children递归处理
if (item.children && item.children.length > 0) {
transformedItem.children = transformData(item.children);
}
return transformedItem;
});
};
// 执行递归,获取选项数据
const data = transformData(res.data.majors.find((item) => item.major_id == 1).children);
this.options = [...data]; // 将选项数据赋给 options
});
}
}
};
</script>
<style scoped>
/* 你可以根据需要自定义样式 */
.cascader-container {
width: 100%;
/* margin-top: 40px; */
display: flex;
align-items: center;
justify-content: space-between;
}
::v-deep input[aria-hidden='true'] {
display: none !important;
}
</style>

View File

@@ -41,7 +41,7 @@
:key="item.am_id"
id="drop-target"
:class="highlightImg(item.ami_id, item.checks ? item.checks : [])"
:comment-Id="highlightImgCommentId(item.ami_id, item.checks)"
:comment-Id="highlightImgCommentId(item.ami_id, item.checks ? item.checks : [])"
@dragover="handleDragOver"
@dragenter="handleDragEnter"
@dragleave="handleDragLeave"
@@ -1063,12 +1063,16 @@ export default {
}
},
highlightImgCommentId(imgId, annotations) {
const emptyContentIndexes = annotations
const emptyContentIndexes = annotations
.map((annotation, index) => (annotation.content === '' ? annotation.amc_id : -1)) // 找到内容为空的批注项的索引,其他项返回 -1
.filter((index) => index !== -1) // 过滤掉值为 -1 的项
.join(','); // 以逗号连接索引
return emptyContentIndexes;
return emptyContentIndexes;
},
escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');

View File

@@ -75,6 +75,8 @@ import commonTable from '@/components/page/components/table/table.vue'
Vue.component('common-table', commonTable);
import commonMajor from '@/components/page/components/major/index.vue'
Vue.component('common-major', commonMajor);
import commonMajorList from '@/components/page/components/major/list.vue'
Vue.component('common-major-list', commonMajorList);
import commonPayPalButton from '@/components/page/components/pendingPayment/PayPalButton.vue'
Vue.component('common-paypal-button', commonPayPalButton);
import commonTiff from '@/components/page/components/table/tiff.vue'