Explorar o código

协作群组编辑:当编辑者是管理人员身份时,应该允许编辑、保存

zweizhao %!s(int64=7) %!d(string=hai) anos
pai
achega
82199699fd
Modificáronse 2 ficheiros con 26 adicións e 4 borrados
  1. 2 2
      components/group/ce.vue
  2. 24 2
      pages/group/index.vue

+ 2 - 2
components/group/ce.vue

@@ -183,8 +183,8 @@ export default {
         id 必填
        */
       let body = {
-        name: this.group,
-        manager_uids: this.manager,
+        name: this.group || ``,
+        manager_uids: this.manager || ``,
         job_ids,
       }
       if(this.isEdit) body.id = this.detailID

+ 24 - 2
pages/group/index.vue

@@ -7,7 +7,9 @@
           <h3>协作群组</h3>
           <p>适用于云端工作团队共享、管理日报和工时统计等</p>
         </section>
-        <nuxt-link to="/group/create"><el-button type="primary">创建</el-button></nuxt-link>
+        <nuxt-link to="/group/create">
+          <el-button type="primary">创建</el-button>
+        </nuxt-link>
       </section>
       <section v-if="list" class="list">
         <nuxt-link :to="`/group/${item.id}`" v-for="(item, index) of list" :key="index">
@@ -38,6 +40,14 @@
           </section>
         </nuxt-link>
       </section>
+      <el-pagination
+        v-if="pageTotal"
+        background
+        layout="prev, pager, next"
+        :total="pageTotal"
+        :page-size="pageSize"
+        @current-change="changePage"
+      ></el-pagination>
     </section>
   </ws-page>
 </template>
@@ -55,6 +65,9 @@ export default {
   data() {
     return {
       list: null,
+      pageSize: 15,
+      pageTotal: 0,
+      currentPage: 1,
     }
   },
   mounted() {
@@ -67,11 +80,16 @@ export default {
   },
   methods: {
     async getList() {
-      let res = await this.$post(`/api/group/list`)
+      let res = await this.$post(`/api/group/list`, { page: this.currentPage, page_size: this.pageSize })
       if(res) {
         console.log(res)
         this.list = res.data.list
+        this.pageTotal = res.data.total
       }
+    },
+    changePage(page) {
+      this.currentPage = page
+      this.getList()
     }
   }
 }
@@ -171,4 +189,8 @@ export default {
 .count {
   color: #999;
 }
+.el-pagination {
+  margin-top: 20px;
+  text-align: center;
+}
 </style>