Browse Source

修复索引bug,添加模板类型字段

DESKTOP-2S67K1S\31396 2 years ago
parent
commit
99bcdc8448
1 changed files with 28 additions and 9 deletions
  1. 28 9
      src/views/operation/recommend/index.vue

+ 28 - 9
src/views/operation/recommend/index.vue

@@ -8,7 +8,7 @@
       <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, scope.$index)" />
+            @click="getList(scope.row)" />
         </template>
       </el-table-column>
       <el-table-column label="排序" align="center">
@@ -23,6 +23,7 @@
         </template>
       </el-table-column>
       <el-table-column label="模板名称" align="center" prop="moduleName" show-overflow-tooltip />
+      <el-table-column label="模板类型" align="center" prop="moduleTypeId" show-overflow-tooltip :formatter="typeFormatter" />
       <el-table-column label="模板数量" align="center" prop="moduleNum" />
       <el-table-column label="创建时间" align="center" prop="createTime" show-overflow-tooltip />
       <el-table-column label="生效时间" align="center" show-overflow-tooltip width="380px">
@@ -83,14 +84,14 @@
       <el-form inline size="mini">
         <el-form-item label="创建时间:">
           <el-date-picker v-model="dialogForm_list.rsDates" type="datetimerange" start-placeholder="开始日期"
-            end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" />
+            end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" />
         </el-form-item>
         <el-form-item label="模块名称:">
           <el-input v-model="dialogForm_list.moduleName" placeholder="请输入模块名称" />
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" icon="el-icon-search">搜索</el-button>
-          <el-button icon="el-icon-refresh">重置</el-button>
+          <el-button type="primary" icon="el-icon-search" @click="getSearch">搜索</el-button>
+          <el-button icon="el-icon-refresh" @click="getRefresh">重置</el-button>
         </el-form-item>
       </el-form>
       <el-table :data="dialogTableData" v-loading="loading">
@@ -193,8 +194,8 @@ export default {
     },
 
     // 首次获取二级列表
-    getList(row, index) {
-      let e = this.tableData[index]
+    getList(row) {
+      let e = this.tableData[row.tabIndex - 1]
       list(row.id).then(res => {
         if (res.code === 0) {
           if (res.data.length > 0) {
@@ -296,6 +297,22 @@ export default {
       })
     },
 
+    // 搜索
+    getSearch() {
+      this.dialogForm_list.pageNum = 1
+      this.getHistoryList()
+    },
+
+    // 重置
+    getRefresh() {
+      this.dialogForm_list = {
+        pageNum: 1,
+        pageSize: 10,
+        categoryId: this.dialogForm_list.categoryId
+      }
+      this.getHistoryList()
+    },
+
     // 有效时间
     getChange(row) {
       timeChange({
@@ -314,10 +331,12 @@ export default {
       return this.selectDictLabel(this.currentOptions, row.status)
     },
 
+    typeFormatter(row) {
+      return row.moduleTypeId ? this.typeOptions.find(i => i.typeId === row.moduleTypeId).typeName : ''
+    },
+
     // 权限判断
     checkPermi
   }
 }
-</script>
-
-<style lang="scss" scoped></style>
+</script>