wxy 4 سال پیش
والد
کامیت
91ce79e902
1فایلهای تغییر یافته به همراه40 افزوده شده و 2 حذف شده
  1. 40 2
      src/views/company/index.vue

+ 40 - 2
src/views/company/index.vue

@@ -126,6 +126,16 @@
           <dataTable :fields="newfields" :data="newdata" :opera="newopera" :total="total" @delete="coltoDelete">
             <dataForm></dataForm>
           </dataTable> -->
+          <el-col :span="24" class="page">
+            <el-pagination
+              @current-change="handleCurrentChange"
+              :current-page="currentPage"
+              layout="total,  prev, pager, next, jumper"
+              :total="total"
+              :page-size="pageSize"
+            >
+            </el-pagination>
+          </el-col>
         </el-col>
       </el-col>
     </el-row>
@@ -156,6 +166,10 @@ export default {
       formData: {
         tableData: [],
       },
+      total: 0,
+      currentPage: 0,
+      pageSize: 7,
+      skip: '',
       // newdata: [],
       // total: 0,
       // newfields: [
@@ -182,6 +196,7 @@ export default {
         if (this.$checkRes(res)) {
           this.$set(this, `form`, res.data);
           this.$set(this.formData, `tableData`, arr.data);
+          this.$set(this, `total`, arr.total);
           // console.log(this.formData.tableData);
         } else {
           this.$message({
@@ -255,12 +270,35 @@ export default {
       row.edit = true;
     },
     //删除
-    deleteData(row, index) {
-      this.formData.tableData.splice(index, 1);
+    // deleteData(row, index) {
+    //   this.formData.tableData.splice(index, 1);
+    // },
+    async todeldeleteDataete(index, row) {
+      if (row.id) {
+        const res = await this.repairdelete(row.id);
+        if (this.$checkRes(res)) {
+          this.$message({
+            message: '删除成功',
+            type: 'success',
+          });
+          this.search();
+        } else {
+          this.$message({
+            message: res.errmsg,
+            type: 'error',
+          });
+        }
+      } else {
+        this.list.splice(index, 1);
+      }
     },
     back() {
       this.$router.push({ path: '/user' });
     },
+    handleCurrentChange(currentPage) {
+      this.$set(this, `skip`, (currentPage - 1) * this.pageSize);
+      this.search();
+    },
   },
   computed: {
     ...mapState(['user']),