Veronique 1 年間 前
コミット
faf5b5c3c6

+ 10 - 0
src/api/design/index.ts

@@ -107,6 +107,7 @@ export function queryDesignTagType(data) {
     params: data,
   });
 }
+
 export function selectDesignTagType(data) {
   return request({
     url: "/design/selectDesignTagType",
@@ -195,3 +196,12 @@ export function modifyTemplateTags(data, idTemplate) {
     data: data,
   });
 }
+
+//切换标签组
+export function changeTagType(data) {
+  return request({
+    url: "/design/changeTagType",
+    method: "post",
+    data: data,
+  });
+}

+ 5 - 2
src/views/design/designTag/component/chooseTags.vue

@@ -101,7 +101,10 @@ import {
   selectDesignTagType,
 } from "@/api/design";
 
-const tagTypes = ref([{ id: 0, name: "未分组" }]);
+const tagTypes = ref([
+  { id: -1, name: "全部" },
+  { id: 0, name: "未分组" },
+]);
 const currentTags = ref([]);
 
 const props = defineProps<{
@@ -180,7 +183,7 @@ onMounted(() => {
 
 const queryForm = reactive({
   keyWord: "",
-  idType: 0,
+  idType: -1,
 });
 const {
   tableData,

+ 51 - 3
src/views/design/designTag/index.vue

@@ -11,13 +11,24 @@
         <i-ep-search />
         搜索
       </el-button>
+      <el-button type="primary" @click="refreshTableInfo">
+        <i-ep-refresh />
+      </el-button>
       <el-button @click="openDialog()" color="#11a983">
         <i-ep-plus />
         增加标签
       </el-button>
-      <el-button type="primary" @click="refreshTableInfo">
-        <i-ep-refresh />
-      </el-button>
+      <el-dropdown style="margin-left: 10px" split-button type="primary" @command="handleChangeType">
+        调整标签组
+        <template #dropdown>
+          <el-dropdown-menu>
+            <el-dropdown-item v-for="type in tagTypes" :command="type.id"
+              >{{ type.name }}
+            </el-dropdown-item>
+          </el-dropdown-menu>
+        </template>
+      </el-dropdown>
+
     </div>
     <div class="table-con">
       <el-table
@@ -26,7 +37,9 @@
         :data="tableData"
         highlight-current-row
         border
+        @selection-change="handleSelectionChange"
       >
+        <el-table-column type="selection" width="55" />
         <el-table-column label="操作" width="150">
           <template #default="{ row }">
             <el-button link @click="handleDelete(row.id)" type="warning"
@@ -64,10 +77,12 @@
 import ChildDialog from "./compt/childDialog.vue";
 import { useTable } from "@/hooks/useTable";
 import {
+  changeTagType,
   deleteDesignTag,
   deleteDesignTagType,
   queryDesignTags,
   queryDesignTagType,
+  selectDesignTagType,
 } from "@/api/design";
 import { useRoute } from "vue-router";
 import { useTagsViewStore } from "@/store/modules/tagsView";
@@ -78,6 +93,8 @@ const currentRoute = useRoute();
 let tabTitle = "";
 let tempRoute = null;
 const tagsViewStore = useTagsViewStore();
+let selectedTags = [];
+const tagTypes = ref([{ id: 0, name: "未分组" }]);
 
 // 设置标签名称
 function setTagsViewTitle() {
@@ -128,6 +145,35 @@ function dialogChange() {
   getTableData();
 }
 
+function handleSelectionChange(val) {
+  selectedTags = val;
+}
+
+function handleChangeType(command: string | number | object) {
+  if (selectedTags.length <= 0) {
+    ElMessage.error("未选择标签");
+    return;
+  }
+  selectedTags.forEach((x) => {
+    x.idType = command;
+  });
+
+  changeTagType(JSON.stringify(selectedTags)).then((response) => {
+    if (response.httpCode == 200) {
+      ElMessage.success("操作成功");
+      getTableData();
+    }
+  });
+}
+
+function getAllTagTypes() {
+  selectDesignTagType({}).then((response) => {
+    if (response.httpCode == 200) {
+      tagTypes.value = tagTypes.value.concat(response.data);
+    }
+  });
+}
+
 onMounted(() => {
   const { query } = currentRoute;
   if (query.idType) queryForm.idType = query.idType;
@@ -135,6 +181,8 @@ onMounted(() => {
 
   tempRoute = Object.assign({}, currentRoute);
   if (tabTitle != "") setTagsViewTitle();
+
+  getAllTagTypes();
 });
 
 const queryForm = reactive({

+ 1 - 1
src/views/design/designTagType/index.vue

@@ -31,7 +31,7 @@
         highlight-current-row
         border
       >
-        <el-table-column label="操作" width="150">
+        <el-table-column label="操作" width="200">
           <template #default="{ row }">
             <el-button link @click="openDialog(row.id)" type="primary">
               <i-ep-edit />