From 9057e04efad1b7d61c77a72e5c37a504d0aee935 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 26 九月 2025 09:24:03 +0800
Subject: [PATCH] H5静态化

---
 admin/src/components/system/dict/DictDataManagerWindow.vue |  111 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 81 insertions(+), 30 deletions(-)

diff --git a/admin/src/components/system/dict/DictDataManagerWindow.vue b/admin/src/components/system/dict/DictDataManagerWindow.vue
index f1e0f4a..5fb62d7 100644
--- a/admin/src/components/system/dict/DictDataManagerWindow.vue
+++ b/admin/src/components/system/dict/DictDataManagerWindow.vue
@@ -1,9 +1,9 @@
 <template>
   <GlobalWindow
-      :title="dictName + '鏁版嵁绠$悊'"
-      width="78%"
-      :visible.sync="visible"
-      :with-footer="false"
+    :title="dictName + '鏁版嵁绠$悊'"
+    width="78%"
+    :visible.sync="visible"
+    :with-footer="false"
   >
     <TableLayout :with-breadcrumb="false">
       <!-- 琛ㄦ牸鍜屽垎椤� -->
@@ -11,18 +11,21 @@
         <ul class="toolbar">
           <li><el-button type="primary" @click="$refs.operaDictDataWindow.open('鏂板缓瀛楀吀鏁版嵁', searchForm.dictId)" icon="el-icon-plus">鏂板缓</el-button></li>
           <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete">鍒犻櫎</el-button></li>
+          <li><el-button @click="sort('top')" :loading="isWorking.sort" icon="el-icon-sort-up" v-permissions="['system:menu:sort']">涓婄Щ</el-button></li>
+          <li><el-button @click="sort('bottom')" :loading="isWorking.sort" icon="el-icon-sort-down" v-permissions="['system:menu:sort']">涓嬬Щ</el-button></li>
         </ul>
         <el-table
-            v-loading="isWorking.search"
-            :data="tableData.list"
-            stripe
-            @selection-change="handleSelectionChange"
+          v-loading="isWorking.search"
+          :data="tableData.list"
+          stripe
+          @selection-change="handleSelectionChange"
         >
           <el-table-column type="selection" width="55"></el-table-column>
-          <el-table-column prop="label" label="鏁版嵁鏍囩" min-width="100px"></el-table-column>
+          <el-table-column prop="remark" label="鏁版嵁璇存槑" min-width="130px"></el-table-column>
+          <el-table-column prop="label" label="鏁版嵁鏍囩" min-width="130px"></el-table-column>
           <el-table-column prop="code" label="鏁版嵁鍊�" min-width="100px">
             <template slot-scope="{row}">
-              <div v-if="row.code || row.code.length>500" >
+              <div v-if="row.code && row.code.length>20" :title="row.code">
                 <el-button type="text" @click="showCode(row)" >鐐瑰嚮鏌ョ湅</el-button>
               </div>
               <div v-else>{{row.code}}</div>
@@ -37,29 +40,27 @@
           <el-table-column prop="updateUser" label="鏇存柊浜�" min-width="100px">
             <template slot-scope="{row}">{{row.updateUserInfo == null ? '' : row.updateUserInfo.username}}</template>
           </el-table-column>
-          <el-table-column prop="remark" label="璇存槑" min-width="100px"></el-table-column>
           <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" min-width="100px"></el-table-column>
           <el-table-column prop="updateTime" label="鏇存柊鏃堕棿" min-width="100px"></el-table-column>
           <el-table-column
-              label="鎿嶄綔"
-              min-width="120"
-              fixed="right"
+            label="鎿嶄綔"
+            min-width="120"
+            fixed="right"
           >
             <template slot-scope="{row}">
-              <el-button type="text" @click="$refs.operaDictDataWindow.open('缂栬緫瀛楀吀鏁版嵁', searchForm.dictId, row)" icon="el-icon-edit">缂栬緫</el-button>
+              <el-button type="text" @click="$refs.operaDictDataWindow.open('缂栬緫瀛楀吀鏁版嵁', dictId, row)" icon="el-icon-edit">缂栬緫</el-button>
               <el-button type="text" @click="deleteById(row)" icon="el-icon-delete">鍒犻櫎</el-button>
             </template>
           </el-table-column>
         </el-table>
         <pagination
-            @size-change="handleSizeChange"
-            @current-change="handlePageChange"
-            :pagination="tableData.pagination"
+          @size-change="handleSizeChange"
+          @current-change="handlePageChange"
+          :pagination="tableData.pagination"
         ></pagination>
       </template>
       <!-- 鏂板缓/淇敼 -->
       <OperaDictDataWindow ref="operaDictDataWindow" @success="handlePageChange(tableData.pagination.pageIndex)"/>
-
       <el-dialog
           class="center-title"
           title="瀛楀吀鍊�"
@@ -98,21 +99,78 @@
         // 瀛楀吀ID
         dictId: null
       },
+      // 鏄惁姝e湪澶勭悊涓�
+      isWorking: {
+        sort: false
+      },
       // 瀛楀吀鍚嶇О
       dictName: ''
     }
   },
   methods: {
-    // 鎵撳紑鏁版嵁绠$悊
+    showCode(row){
+      this.agreement=row.code
+      this.visible1=true
+    },
+    /**
+     * 鎵撳紑绐楀彛
+     *
+     * @param dictId 瀛楀吀ID
+     * @param dictName 瀛楀吀鍚嶇О
+     */
     open (dictId, dictName) {
       this.searchForm.dictId = dictId
       this.dictName = dictName
       this.visible = true
       this.search()
     },
-    showCode(row){
-      this.agreement=row.code
-      this.visible1=true
+    /**
+     * 鎺掑簭
+     *
+     * @param direction 鏂瑰悜锛屽彇鍊糩top:涓婄Щ,bottom:涓嬬Щ]
+     */
+    sort (direction) {
+      if (this.isWorking.sort) {
+        return
+      }
+      if (this.tableData.selectedRows.length === 0) {
+        this.$tip.warning('璇烽�夋嫨涓�鏉℃暟鎹�')
+        return
+      }
+      if (this.tableData.selectedRows.length > 1) {
+        this.$tip.warning('鎺掑簭鏃朵粎鍏佽閫夋嫨涓�鏉℃暟鎹�')
+        return
+      }
+      const rowId = this.tableData.selectedRows[0].id
+      const index = this.tableData.list.findIndex(item => item.id === rowId)
+      // 涓婄Щ鏍¢獙
+      if (direction === 'top' && index === 0) {
+        this.$tip.warning('鏁版嵁宸插埌椤堕儴')
+        return
+      }
+      // 涓嬬Щ鏍¢獙
+      if (direction === 'bottom' && index === this.tableData.list.length - 1) {
+        this.$tip.warning('鏁版嵁宸插埌搴曢儴')
+        return
+      }
+      this.isWorking.sort = true
+      this.api.sort({
+        id: this.tableData.selectedRows[0].id,
+        direction
+      })
+        .then(() => {
+          if (direction === 'top') {
+            this.tableData.list.splice(index, 0, this.tableData.list.splice(index - 1, 1)[0])
+          } else {
+            this.tableData.list.splice(index, 0, this.tableData.list.splice(index + 1, 1)[0])
+          }
+        })
+        .catch(e => {
+          this.$tip.apiFailed(e)
+        })
+        .finally(() => {
+          this.isWorking.sort = false
+        })
     }
   },
   created () {
@@ -125,12 +183,6 @@
 </script>
 
 <style scoped lang="scss">
-.agree-list{
-  height: 550px;
-  //max-height: 50%;
-  overflow: auto;
-}
-
 /deep/ .window__body {
   .table-content {
     padding: 0;
@@ -138,6 +190,5 @@
       padding-top: 0;
     }
   }
-
 }
 </style>

--
Gitblit v1.9.3