liuyg
2021-07-09 192010c64e8c3ff3418f27c906e499ccdad1bbad
src/views/dispatch/index.vue
@@ -1,34 +1,35 @@
<template>
  <div class="dispatch">
    <avue-tabs :option="optionTABS" @change="handleChangeTABS"></avue-tabs>
    <span v-if="typeTABS.prop === 'tab1'">
      <avue-crud
        :option="option"
        :data="data"
        :page.sync="page"
        ref="crudrec"
        @on-load="onLoad"
        :table-loading="loading"
        @row-save="rowSave"
        @search-change="searchChange"
        @search-reset="searchReset"
        @row-update="rowUpdate"
        @row-del="rowDel"
        @selection-change="selectionChange"
        @refresh-change="refreshChange"
      >
        <template slot="menuLeft">
          <el-button
            type="danger"
            size="small"
            plain
            icon="el-icon-delete"
            @click="handleDelete"
            >删 除
          </el-button>
        </template>
      </avue-crud>
    </span>
    <!-- <avue-tabs :option="optionTABS" @change="handleChangeTABS"></avue-tabs>
    <span v-if="typeTABS.prop === 'tab1'"> -->
    <avue-crud
      :option="option"
      :data="data"
      :page.sync="page"
      ref="crudrec"
      @on-load="onLoad"
      :table-loading="loading"
      @row-save="rowSave"
      @search-change="searchChange"
      @search-reset="searchReset"
      @row-update="rowUpdate"
      @row-del="rowDel"
      @selection-change="selectionChange"
      @refresh-change="refreshChange"
      @row-click="rowClick"
    >
      <template slot="menuLeft">
        <el-button
          type="danger"
          size="small"
          plain
          icon="el-icon-delete"
          @click="handleDelete"
          >删 除
        </el-button>
      </template>
    </avue-crud>
    <!-- </span>
    <span v-else-if="typeTABS.prop === 'tab2'">
      <avue-crud
        :option="option1"
@@ -56,7 +57,7 @@
          </el-button>
        </template>
      </avue-crud>
    </span>
    </span> -->
    <!-- <span v-else-if="typeTABS.prop === 'tab3'">选项卡内容3</span> -->
  </div>
</template> 
@@ -116,27 +117,57 @@
        align: "center",
        selection: true,
        column: column,
        // group: [
        //   {
        //     label: "基础信息",
        //     prop: "baseInfo",
        //     icon: "el-icon-user-solid",
        //     column: [
        //       {
        //         label: "所属保安单位",
        //         prop: "tenantId",
        //         type: "tree",
        //         dicUrl: "/api/blade-system/tenant/select",
        //         props: {
        //           label: "tenantName",
        //           value: "tenantId",
        //         },
        //         hide: !website.tenantMode,
        //         addDisplay: website.tenantMode,
        //         editDisplay: website.tenantMode,
        //         viewDisplay: website.tenantMode,
        //         rules: [
        //           {
        //             required: true,
        //             message: "请输入所属保安单位",
        //             trigger: "click",
        //           },
        //         ],
        //         span: 24,
        //       },
        //     ],
        //   },
        // ],
      },
      loading1: true, //派遣记录
      selectionList1: [],
      page1: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      query1: {},
      data1: [],
      option1: {
        card: true,
        searchSize: "mini",
        searchMenuSpan: 6,
        height: 547,
        menuWidth: 160,
        align: "center",
        selection: true,
        column: column1,
      },
      // loading1: true, //派遣记录
      // selectionList1: [],
      // page1: {
      //   pageSize: 10,
      //   currentPage: 1,
      //   total: 0,
      // },
      // query1: {},
      // data1: [],
      // option1: {
      //   card: true,
      //   searchSize: "mini",
      //   searchMenuSpan: 6,
      //   height: 547,
      //   menuWidth: 160,
      //   align: "center",
      //   selection: true,
      //   column: column1,
      // },
    };
  },
  computed: {
@@ -182,10 +213,10 @@
      //   this.$message.success("页码" + val);
    },
    rowSave(form, done, loading) {
      var that = this;
      //   var form = this.data[0];
      //   delete form.id;
      //   for (var k = 0; k < 13; k++) {
      // var that = this;
      // var form = this.data[0];
      // delete form.id;
      // for (var k = 0; k < 13; k++) {
      adddata(form).then(
        (res) => {
          this.onLoad(this.page);
@@ -200,7 +231,7 @@
          loading();
        }
      );
      //   }
      // }
    },
    searchChange(params, done) {
      this.query = params;
@@ -274,6 +305,15 @@
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    rowClick(row) {
      console.log(row);
      this.$router.push({
        path: "/dispatchChild",
        // redirect: { name: "foo" },
        query: { row: row },
        // params: { row: row.identificationnumber },
      });
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getdata(
@@ -292,133 +332,133 @@
    //派遣服务公司登记
    //派遣记录
    sizeChange1(val) {
      this.page1.currentPage = 1;
      this.page1.pageSize = val;
      // this.getData();
      this.onLoad1(this.page1, this.query1);
      //   this.$message.success("行数" + val);
    },
    currentChange1(val) {
      this.page1.currentPage = val;
      // this.getData();
      this.onLoad1(this.page1, this.query1);
      //   this.$message.success("页码" + val);
    },
    rowSave1(form, done, loading) {
      var that = this;
      //   var form = this.data[0];
      //   delete form.id;
      //   for (var k = 0; k < 13; k++) {
      adddata1(form).then(
        (res) => {
          this.onLoad1(this.page1);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
      //   }
    },
    searchChange1(params, done) {
      this.query1 = params;
      this.page1.currentPage = 1;
      this.onLoad1(this.page1, params);
      done();
    },
    searchReset1() {
      this.query = {};
      this.onLoad1(this.page1);
    },
    rowUpdate1(row, index, done, loading) {
      console.log(row);
      update1(row).then(
        () => {
          this.onLoad1(this.page1);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowDel1(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove1(row.id);
        })
        .then(() => {
          this.onLoad1(this.page1);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    selectionChange1(list) {
      this.selectionList1 = list;
      console.log(this.selectionList1.length);
    },
    handleDelete1() {
      console.log(this.selectionList1);
      if (this.selectionList1.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove1(this.ids1);
        })
        .then(() => {
          this.onLoad1(this.page1);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crudrec1.toggleSelection();
        });
    },
    refreshChange1() {
      // console.log(4534)
      this.onLoad1(this.page1, this.query1);
    },
    // sizeChange1(val) {
    //   this.page1.currentPage = 1;
    //   this.page1.pageSize = val;
    //   // this.getData();
    //   this.onLoad1(this.page1, this.query1);
    //   //   this.$message.success("行数" + val);
    // },
    // currentChange1(val) {
    //   this.page1.currentPage = val;
    //   // this.getData();
    //   this.onLoad1(this.page1, this.query1);
    //   //   this.$message.success("页码" + val);
    // },
    // rowSave1(form, done, loading) {
    //   var that = this;
    //   var form = this.data1[0];
    //   delete form.id;
    //   for (var k = 0; k < 13; k++) {
    //     adddata1(form).then(
    //       (res) => {
    //         this.onLoad1(this.page1);
    //         this.$message({
    //           type: "success",
    //           message: "操作成功!",
    //         });
    //         done();
    //       },
    //       (error) => {
    //         window.console.log(error);
    //         loading();
    //       }
    //     );
    //   }
    // },
    // searchChange1(params, done) {
    //   this.query1 = params;
    //   this.page1.currentPage = 1;
    //   this.onLoad1(this.page1, params);
    //   done();
    // },
    // searchReset1() {
    //   this.query = {};
    //   this.onLoad1(this.page1);
    // },
    // rowUpdate1(row, index, done, loading) {
    //   console.log(row);
    //   update1(row).then(
    //     () => {
    //       this.onLoad1(this.page1);
    //       this.$message({
    //         type: "success",
    //         message: "操作成功!",
    //       });
    //       done();
    //     },
    //     (error) => {
    //       window.console.log(error);
    //       loading();
    //     }
    //   );
    // },
    // rowDel1(row) {
    //   this.$confirm("确定将选择数据删除?", {
    //     confirmButtonText: "确定",
    //     cancelButtonText: "取消",
    //     type: "warning",
    //   })
    //     .then(() => {
    //       return remove1(row.id);
    //     })
    //     .then(() => {
    //       this.onLoad1(this.page1);
    //       this.$message({
    //         type: "success",
    //         message: "操作成功!",
    //       });
    //     });
    // },
    // selectionChange1(list) {
    //   this.selectionList1 = list;
    //   console.log(this.selectionList1.length);
    // },
    // handleDelete1() {
    //   console.log(this.selectionList1);
    //   if (this.selectionList1.length === 0) {
    //     this.$message.warning("请选择至少一条数据");
    //     return;
    //   }
    //   this.$confirm("确定将选择数据删除?", {
    //     confirmButtonText: "确定",
    //     cancelButtonText: "取消",
    //     type: "warning",
    //   })
    //     .then(() => {
    //       return remove1(this.ids1);
    //     })
    //     .then(() => {
    //       this.onLoad1(this.page1);
    //       this.$message({
    //         type: "success",
    //         message: "操作成功!",
    //       });
    //       this.$refs.crudrec1.toggleSelection();
    //     });
    // },
    // refreshChange1() {
    //   // console.log(4534)
    //   this.onLoad1(this.page1, this.query1);
    // },
    //
    onLoad1(page, params = {}) {
      this.loading1 = true;
      // console.log(page);
      getdata1(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        // console.log(res);
        const data = res.data.data;
        this.page1.total = data.total;
        this.data1 = data.records;
        console.log(this.data1, 1);
        this.loading1 = false;
      });
    },
    // //
    // onLoad1(page, params = {}) {
    //   this.loading1 = true;
    //   // console.log(page);
    //   getdata1(
    //     page.currentPage,
    //     page.pageSize,
    //     Object.assign(params, this.query)
    //   ).then((res) => {
    //     // console.log(res);
    //     const data = res.data.data;
    //     this.page1.total = data.total;
    //     this.data1 = data.records;
    //     console.log(this.data1, 1);
    //     this.loading1 = false;
    //   });
    // },
    //派遣记录
  },
  mounted() {