Переглянути джерело

营期主页面布局调整

caoliqin 1 місяць тому
батько
коміт
030afd407b
1 змінених файлів з 260 додано та 168 видалено
  1. 260 168
      src/views/course/userCoursePeriod/index.vue

+ 260 - 168
src/views/course/userCoursePeriod/index.vue

@@ -1,139 +1,187 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="营期名称" prop="periodName">
-        <el-input
-          v-model="queryParams.periodName"
-          placeholder="请输入营期名称"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
+    <el-container>
+      <!-- 左侧区域 -->
+      <el-aside width="360px" class="left-aside">
+        <!-- 左侧筛选条件 -->
+        <el-form :model="leftQueryParams" ref="leftQueryForm" :inline="true" v-show="showSearch" label-width="84px">
+          <el-form-item label="训练营名称" prop="trainingCampName">
+            <el-input
+              v-model="leftQueryParams.trainingCampName"
+              placeholder="请输入训练营名称"
+              clearable
+              size="small"
+              @keyup.enter.native="handleLeftQuery"
+            />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleLeftQuery">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetLeftQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <!-- 左侧列表 -->
+        <el-table v-loading="leftLoading" :data="leftList" @selection-change="handleLeftSelectionChange">
+          <el-table-column type="selection" width="55" align="center" />
+          <el-table-column label="训练营名称" align="center" prop="trainingCampName" />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-view"
+                @click="handleView(scope.row)"
+              >查看</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="leftTotal>0"
+          :total="leftTotal"
+          :page.sync="leftQueryParams.pageNum"
+          :limit.sync="leftQueryParams.pageSize"
+          @pagination="getLeftList"
         />
-      </el-form-item>
-      <el-form-item label="公司" prop="companyIdList">
-        <el-select v-model="queryParams.companyIdList" placeholder="请选择公司" clearable size="small" multiple>
-          <el-option
-            v-for="item in companyOptions"
-            :key="item.companyId"
-            :label="item.companyName"
-            :value="item.companyId"
-          />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="开营日期开始" prop="periodStartingTime" label-width="120px">
-        <el-date-picker clearable size="small" style="width: 200px"
-          v-model="queryParams.periodStartingTime"
-          type="date"
-          value-format="yyyy-MM-dd"
-          placeholder="请选择开营日期开始时间">
-        </el-date-picker>
-      </el-form-item>
-      <el-form-item label="开营日期结束" prop="periodEndTime" label-width="120px">
-        <el-date-picker clearable size="small" style="width: 300px"
-          v-model="queryParams.periodEndTime"
-          type="date"
-          value-format="yyyy-MM-dd"
-          placeholder="请选择开营日期结束时间">
-        </el-date-picker>
-      </el-form-item>
-      <el-form-item>
-        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-      </el-form-item>
-    </el-form>
+      </el-aside>
 
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
-          type="primary"
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['course:period:add']"
-        >新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['course:period:edit']"
-        >修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['course:period:remove']"
-        >删除</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['course:period:export']"
-        >导出</el-button>
-      </el-col>
-	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
+      <!-- 右侧区域 -->
+      <el-main>
+        <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+          <el-form-item label="营期名称" prop="periodName">
+            <el-input
+              v-model="queryParams.periodName"
+              placeholder="请输入营期名称"
+              clearable
+              size="small"
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item label="公司" prop="companyIdList">
+            <el-select v-model="queryParams.companyIdList" placeholder="请选择公司" clearable size="small" multiple>
+              <el-option
+                v-for="item in companyOptions"
+                :key="item.companyId"
+                :label="item.companyName"
+                :value="item.companyId"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="开营日期开始" prop="periodStartingTime" label-width="120px">
+            <el-date-picker clearable size="small" style="width: 200px"
+              v-model="queryParams.periodStartingTime"
+              type="date"
+              value-format="yyyy-MM-dd"
+              placeholder="请选择开营日期开始时间">
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="开营日期结束" prop="periodEndTime" label-width="120px">
+            <el-date-picker clearable size="small" style="width: 300px"
+              v-model="queryParams.periodEndTime"
+              type="date"
+              value-format="yyyy-MM-dd"
+              placeholder="请选择开营日期结束时间">
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
 
-    <el-table v-loading="loading" :data="periodList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="所属训练营" align="center" prop="trainingCampName" />
-      <el-table-column label="营期名称" align="center" prop="periodName" />
-<!--      <el-table-column label="公司id" align="center" prop="companyId" />-->
-      <el-table-column label="公司名称" align="center" prop="companyName" />
-      <el-table-column label="开营开始时间" align="center" prop="periodStartingTime" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.periodStartingTime, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="开营结束时间" align="center" prop="periodEndTime" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.periodEndTime, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="创建时间" align="center" prop="periodEndTime" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['course:period:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['course:period:remove']"
-          >删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button
+              type="primary"
+              icon="el-icon-plus"
+              size="mini"
+              @click="handleAdd"
+              v-hasPermi="['course:period:add']"
+            >新增</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button
+              type="success"
+              icon="el-icon-edit"
+              size="mini"
+              :disabled="single"
+              @click="handleUpdate"
+              v-hasPermi="['course:period:edit']"
+            >修改</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button
+              type="danger"
+              icon="el-icon-delete"
+              size="mini"
+              :disabled="multiple"
+              @click="handleDelete"
+              v-hasPermi="['course:period:remove']"
+            >删除</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button
+              type="warning"
+              icon="el-icon-download"
+              size="mini"
+              @click="handleExport"
+              v-hasPermi="['course:period:export']"
+            >导出</el-button>
+          </el-col>
+          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
 
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+        <el-table v-loading="loading" :data="periodList" @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="55" align="center" />
+          <el-table-column label="所属训练营" align="center" prop="trainingCampName" />
+          <el-table-column label="营期名称" align="center" prop="periodName" />
+          <el-table-column label="公司名称" align="center" prop="companyName" />
+          <el-table-column label="开营开始时间" align="center" prop="periodStartingTime" width="180">
+            <template slot-scope="scope">
+              <span>{{ parseTime(scope.row.periodStartingTime, '{y}-{m}-{d}') }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="开营结束时间" align="center" prop="periodEndTime" width="180">
+            <template slot-scope="scope">
+              <span>{{ parseTime(scope.row.periodEndTime, '{y}-{m}-{d}') }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="创建时间" align="center" prop="createTime" width="180">
+            <template slot-scope="scope">
+              <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-edit"
+                @click="handleUpdate(scope.row)"
+                v-hasPermi="['course:period:edit']"
+              >修改</el-button>
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-delete"
+                @click="handleDelete(scope.row)"
+                v-hasPermi="['course:period:remove']"
+              >删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
 
-     添加或修改会员营期对话框
+        <pagination
+          v-show="total>0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </el-main>
+    </el-container>
+
+    <!-- 添加或修改会员营期对话框-->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="营期名称" prop="periodName">
@@ -206,6 +254,8 @@ export default {
     return {
       // 遮罩层
       loading: true,
+      // 左侧遮罩层
+      leftLoading: true,
       // 选中数组
       ids: [],
       // 非单个禁用
@@ -216,10 +266,12 @@ export default {
       showSearch: true,
       // 总条数
       total: 0,
+      // 左侧总条数
+      leftTotal: 0,
       // 会员营期表格数据
       periodList: [],
-      // 公司选项
-      companyOptions: [],
+      // 左侧列表数据
+      leftList: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -229,23 +281,28 @@ export default {
         pageNum: 1,
         pageSize: 10,
         periodName: null,
-        // courseId: null,
-        // videoId: null,
-        // trainingCampId: null,
-        // periodType: null,
         periodStartingTime: null,
         periodEndTime: null,
         companyIdList: []
       },
+      // 左侧查询参数
+      leftQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        trainingCampName: null
+      },
       // 表单参数
       form: {},
       // 表单校验
       rules: {
-      }
+      },
+      // 公司选项
+      companyOptions: []
     };
   },
   created() {
     this.getList();
+    this.getLeftList();
     this.getCompanyList();
   },
   methods: {
@@ -259,56 +316,47 @@ export default {
         this.loading = false;
       });
     },
-    /** 获取公司下拉列表*/
-    getCompanyList() {
-      this.loading = true;
-      getCompanyList().then(response => {
-        this.companyOptions = response.data;
-        this.loading = false;
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        periodId: null,
-        periodName: null,
-        companyId: null,
-        courseId: null,
-        videoId: null,
-        trainingCampId: null,
-        createTime: null,
-        updateTime: null,
-        courseStyle: null,
-        liveRoomStyle: null,
-        redPacketGrantMethod: null,
-        periodType: null,
-        periodStartingTime: null,
-        periodEndTime: null
-      };
-      this.resetForm("form");
+    /** 查询左侧列表 */
+    getLeftList() {
+      this.leftLoading = true;
+      // TODO: 调用左侧列表接口
+      this.leftLoading = false;
     },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
       this.getList();
     },
+    /** 左侧搜索按钮操作 */
+    handleLeftQuery() {
+      this.leftQueryParams.pageNum = 1;
+      this.getLeftList();
+    },
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
       this.queryParams.companyIdList = [];
       this.handleQuery();
     },
+    /** 左侧重置按钮操作 */
+    resetLeftQuery() {
+      this.resetForm("leftQueryForm");
+      this.handleLeftQuery();
+    },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.periodId)
       this.single = selection.length!==1
       this.multiple = !selection.length
     },
+    // 左侧多选框选中数据
+    handleLeftSelectionChange(selection) {
+      // TODO: 处理左侧选中数据
+    },
+    /** 查看按钮操作 */
+    handleView(row) {
+      // TODO: 处理查看操作
+    },
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
@@ -375,7 +423,51 @@ export default {
         }).then(response => {
           this.download(response.msg);
         }).catch(function() {});
+    },
+    /** 获取公司下拉列表*/
+    getCompanyList() {
+      this.loading = true;
+      getCompanyList().then(response => {
+        this.companyOptions = response.data;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        periodId: null,
+        periodName: null,
+        companyId: null,
+        courseId: null,
+        videoId: null,
+        trainingCampId: null,
+        createTime: null,
+        updateTime: null,
+        courseStyle: null,
+        liveRoomStyle: null,
+        redPacketGrantMethod: null,
+        periodType: null,
+        periodStartingTime: null,
+        periodEndTime: null
+      };
+      this.resetForm("form");
     }
   }
 };
 </script>
+
+<style scoped>
+.left-aside {
+  background-color: #fff;
+  border-right: 1px solid #e6e6e6;
+  padding: 10px;
+}
+.el-main {
+  padding: 10px;
+}
+</style>