Przeglądaj źródła

推荐管理兼容

DESKTOP-SVI9JE1\muzen 1 rok temu
rodzic
commit
f37f7ba81b

+ 3 - 0
src/views/operation/recommend/detail.vue

@@ -88,6 +88,9 @@
     <!-- 弹窗 -->
     <el-dialog :visible.sync="dialogVisible" title="添加内容" width="1000px">
       <el-form inline size="mini">
+        <el-form-item label="音频ID:">
+          <el-input v-model="dialogForm.id" placeholder="请输入音频ID" />
+        </el-form-item>
         <el-form-item label="音频类型:">
           <el-select v-model="dialogForm.audioType" placeholder="请选择类型" :disabled="disabled">
             <el-option v-for="item in audioOptions" :key="item.value" :label="item.label" :value="Number(item.value)" />

+ 11 - 6
src/views/operation/recommend/index.vue

@@ -5,7 +5,8 @@
       :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
       <el-table-column width="80px">
         <template slot-scope="scope">
-          <el-link v-if="scope.row.hidden" :underline="false" class="el-icon-arrow-right" @click="getList(scope.row)" />
+          <el-link v-if="scope.row.hidden" :underline="false" class="el-icon-arrow-right"
+            @click="getList(scope.row, scope.$index)" />
         </template>
       </el-table-column>
       <el-table-column label="导航名称" align="center" prop="name" show-overflow-tooltip>
@@ -165,7 +166,9 @@ export default {
       }, {
         value: 3,
         label: '已失效'
-      }]
+      }],
+      // 当前数据缓存
+      index: null
     }
   },
   mounted() {
@@ -197,8 +200,8 @@ export default {
     },
 
     // 首次获取二级列表
-    getList(row) {
-      let e = this.tableData[row.tabIndex - 1]
+    getList(row, index) {
+      let e = this.tableData[index]
       list(row.id).then(res => {
         if (res.code === 0) {
           if (res.data.length > 0) {
@@ -222,7 +225,7 @@ export default {
             if (res.code === 0) {
               this.$message.success('提交成功')
               this.cancel()
-              this.getTabList()
+              this.getList(this.tableData[this.index], this.index)
             }
           })
         } else {
@@ -240,6 +243,7 @@ export default {
 
     // 弹窗
     getDialog(title, row) {
+      this.index = this.tableData.findIndex(i => i.id == row.id)
       this.title = title
       this.dialogVisible = true
       this.dialogForm.categoryId = row.id
@@ -272,10 +276,11 @@ export default {
       this.$confirm(`是否删除?`, '提醒', {
         type: 'warning'
       }).then(() => {
+        let index = this.tableData.findIndex(i => i.id == row.categoryId)
         remove(row.lv, row.id).then(res => {
           if (res.code === 0) {
             this.$message.success('删除成功!')
-            this.getTabList()
+            this.getList(this.tableData[index], index)
           }
         })
       }).catch(() => { })