|
@@ -329,16 +329,18 @@
|
|
|
>
|
|
|
<i class="el-icon-refresh"></i> 重新处理
|
|
|
</el-dropdown-item>
|
|
|
- <!-- <el-dropdown-item
|
|
|
- @click.native="firstHandleUpload(scope.$index, scope.row)"
|
|
|
+ <el-dropdown-item
|
|
|
+ @click.native="handleRemoveTag(row)"
|
|
|
+ v-if="row.tags && row.tags.length > 0"
|
|
|
>
|
|
|
- <i class="el-icon-refresh"></i> 批量处理
|
|
|
- </el-dropdown-item> -->
|
|
|
- <!-- <el-dropdown-item
|
|
|
- @click.native="firstHandleDelete(scope.$index, scope.row)"
|
|
|
+ <i class="el-icon-delete"></i> 删除绑定标签
|
|
|
+ </el-dropdown-item>
|
|
|
+ <el-dropdown-item
|
|
|
+ @click.native="handleRemoveProject(row)"
|
|
|
+ v-if="row.projects && row.projects.length > 0"
|
|
|
>
|
|
|
- <i class="el-icon-delete"></i> 删除
|
|
|
- </el-dropdown-item> -->
|
|
|
+ <i class="el-icon-delete"></i> 删除关联项目
|
|
|
+ </el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
|
</el-dropdown>
|
|
@@ -570,6 +572,91 @@
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 删除标签对话框 -->
|
|
|
+ <el-dialog
|
|
|
+ title="删除标签"
|
|
|
+ :visible.sync="removeTagDialogVisible"
|
|
|
+ width="800px"
|
|
|
+ >
|
|
|
+ <el-form :model="removeTagForm" label-width="150px">
|
|
|
+ <el-form-item label="标签分类:">
|
|
|
+ <el-select
|
|
|
+ v-model="removeTagForm.category_id"
|
|
|
+ placeholder="请选择分类"
|
|
|
+ clearable
|
|
|
+ style="width: 350px"
|
|
|
+ @change="handleRemoveTagCategoryChange"
|
|
|
+ >
|
|
|
+ <el-option label="全部分类" value="" />
|
|
|
+ <el-option
|
|
|
+ v-for="item in categoriesList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="标签:">
|
|
|
+ <el-select
|
|
|
+ style="width: 350px"
|
|
|
+ v-model="removeTagForm.tags"
|
|
|
+ multiple
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ reserve-keyword
|
|
|
+ :remote-method="handleRemoveTagSearch"
|
|
|
+ :loading="removeTagsLoading"
|
|
|
+ placeholder="请选择要删除的标签"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="tag in currentRowTags"
|
|
|
+ :key="tag.id"
|
|
|
+ :label="tag.name"
|
|
|
+ :value="tag.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="removeTagDialogVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitRemoveTag">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 删除项目对话框 -->
|
|
|
+ <el-dialog
|
|
|
+ title="删除项目"
|
|
|
+ :visible.sync="removeProjectDialogVisible"
|
|
|
+ width="800px"
|
|
|
+ >
|
|
|
+ <el-form :model="removeProjectForm" label-width="150px">
|
|
|
+ <el-form-item label="项目:">
|
|
|
+ <el-select
|
|
|
+ style="width: 350px"
|
|
|
+ v-model="removeProjectForm.projects"
|
|
|
+ multiple
|
|
|
+ filterable
|
|
|
+ placeholder="请选择要删除的项目"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="project in currentRowProjects"
|
|
|
+ :key="project.id"
|
|
|
+ :label="project.name"
|
|
|
+ :value="project.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="removeProjectDialogVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitRemoveProject">确定</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -677,6 +764,23 @@ export default {
|
|
|
},
|
|
|
/* SOTA详情 总数 */
|
|
|
Stoa_total: 0,
|
|
|
+
|
|
|
+ /* 删除标签相关 */
|
|
|
+ removeTagDialogVisible: false,
|
|
|
+ removeTagForm: {
|
|
|
+ tags: [],
|
|
|
+ category_id: "",
|
|
|
+ },
|
|
|
+ removeTagsLoading: false,
|
|
|
+ currentRowTags: [], // 当前行的标签列表
|
|
|
+ currentRow: null, // 当前选中的行
|
|
|
+
|
|
|
+ /* 删除项目相关 */
|
|
|
+ removeProjectDialogVisible: false,
|
|
|
+ removeProjectForm: {
|
|
|
+ projects: [],
|
|
|
+ },
|
|
|
+ currentRowProjects: [], // 当前行的项目列表
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -1690,6 +1794,136 @@ export default {
|
|
|
return undefined;
|
|
|
},
|
|
|
|
|
|
+ // 处理删除标签按钮点击
|
|
|
+ handleRemoveTag(row) {
|
|
|
+ this.currentRow = row;
|
|
|
+ this.currentRowTags = row.tags || [];
|
|
|
+ this.removeTagDialogVisible = true;
|
|
|
+ this.removeTagForm = {
|
|
|
+ tags: [],
|
|
|
+ category_id: "",
|
|
|
+ };
|
|
|
+ this.fetchCategories();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 处理删除标签分类变更
|
|
|
+ async handleRemoveTagCategoryChange(categoryId) {
|
|
|
+ this.removeTagForm.tags = [];
|
|
|
+ const filteredTags = this.currentRowTags.filter(tag =>
|
|
|
+ categoryId === "" || tag.category_id === categoryId
|
|
|
+ );
|
|
|
+ this.currentRowTags = filteredTags;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 处理删除标签搜索
|
|
|
+ async handleRemoveTagSearch(query) {
|
|
|
+ if (query !== "") {
|
|
|
+ this.removeTagsLoading = true;
|
|
|
+ try {
|
|
|
+ const filteredTags = this.currentRowTags.filter(tag =>
|
|
|
+ tag.name.toLowerCase().includes(query.toLowerCase())
|
|
|
+ );
|
|
|
+ this.currentRowTags = filteredTags;
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error("搜索标签失败");
|
|
|
+ } finally {
|
|
|
+ this.removeTagsLoading = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.currentRowTags = this.currentRow.tags || [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 提交删除标签
|
|
|
+ async submitRemoveTag() {
|
|
|
+ try {
|
|
|
+ if (this.removeTagForm.tags.length === 0) {
|
|
|
+ this.$message.warning("请选择要删除的标签");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const params = {
|
|
|
+ literature_ids: [this.currentRow.id],
|
|
|
+ tag_ids: this.removeTagForm.tags
|
|
|
+ };
|
|
|
+
|
|
|
+ const response = await axios.post(
|
|
|
+ `${process.env.VUE_APP_BASE_API}/literature-tags/remove_tags/`,
|
|
|
+ params,
|
|
|
+ {
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ },
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ if (response.status === 200) {
|
|
|
+ this.$message.success("标签删除成功");
|
|
|
+ this.removeTagDialogVisible = false;
|
|
|
+
|
|
|
+ // 更新当前行的标签列表
|
|
|
+ this.currentRow.tags = this.currentRow.tags.filter(
|
|
|
+ tag => !this.removeTagForm.tags.includes(tag.id)
|
|
|
+ );
|
|
|
+
|
|
|
+ // 刷新列表
|
|
|
+ await this.fetchGpuList();
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error.response?.data?.message || "标签删除失败");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 处理删除项目按钮点击
|
|
|
+ handleRemoveProject(row) {
|
|
|
+ this.currentRow = row;
|
|
|
+ this.currentRowProjects = row.projects || [];
|
|
|
+ this.removeProjectDialogVisible = true;
|
|
|
+ this.removeProjectForm = {
|
|
|
+ projects: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ // 提交删除项目
|
|
|
+ async submitRemoveProject() {
|
|
|
+ try {
|
|
|
+ if (this.removeProjectForm.projects.length === 0) {
|
|
|
+ this.$message.warning("请选择要删除的项目");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const params = {
|
|
|
+ literature_ids: [this.currentRow.id],
|
|
|
+ project_ids: this.removeProjectForm.projects
|
|
|
+ };
|
|
|
+
|
|
|
+ const response = await axios.post(
|
|
|
+ `${process.env.VUE_APP_BASE_API}/literature/batch_unassociate_from_projects`,
|
|
|
+ params,
|
|
|
+ {
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ },
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ if (response.status === 200) {
|
|
|
+ this.$message.success("项目删除成功");
|
|
|
+ this.removeProjectDialogVisible = false;
|
|
|
+
|
|
|
+ // 更新当前行的项目列表
|
|
|
+ this.currentRow.projects = this.currentRow.projects.filter(
|
|
|
+ project => !this.removeProjectForm.projects.includes(project.id)
|
|
|
+ );
|
|
|
+
|
|
|
+ // 刷新列表
|
|
|
+ await this.fetchGpuList();
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error.response?.data?.message || "项目删除失败");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
// 格式化百分比
|
|
|
percentFormat(percentage) {
|
|
|
return `${percentage}%`;
|