Administrator
2021-08-11 92d0cf73df170131eba84490d875bc954eb7a708
src/views/dispatch/dispatchChildoperable.vue
@@ -1,8 +1,9 @@
<template>
  <div class="dispatchChildoperable">
    <!-- <avue-tabs :option="optionTABS" @change="handleChangeTABS"></avue-tabs> -->
    <!-- <span v-if="typeTABS.prop === 'tab1'"> -->
    <!-- <avue-crud
  <basic-container>
    <div class="dispatchChildoperable">
      <!-- <avue-tabs :option="optionTABS" @change="handleChangeTABS"></avue-tabs> -->
      <!-- <span v-if="typeTABS.prop === 'tab1'"> -->
      <!-- <avue-crud
        :option="option"
        :data="data"
        :page.sync="page"
@@ -28,28 +29,28 @@
          </el-button>
        </template>
      </avue-crud> -->
    <!-- <avue-form ref="form" v-model="obj0" :option="option0"> -->
    <!-- <template slot-scope="scope" slot="menuForm">
      <!-- <avue-form ref="form" v-model="obj0" :option="option0"> -->
      <!-- <template slot-scope="scope" slot="menuForm">
          <el-button @click="tip">自定义按钮</el-button>
        </template> -->
    <!-- </avue-form>
      <!-- </avue-form>
    </span>
    <span v-else-if="typeTABS.prop === 'tab2'"> -->
    <avue-crud
      :option="option1"
      :data="data1"
      :page.sync="page1"
      ref="crudrec1"
      :table-loading="loading1"
      @row-save="rowSave1"
      @search-change="searchChange1"
      @search-reset="searchReset1"
      @row-update="rowUpdate1"
      @row-del="rowDel1"
      @selection-change="selectionChange1"
      @refresh-change="refreshChange1"
    >
      <!-- <template slot="menuLeft">
      <avue-crud
        :option="option1"
        :data="data1"
        :page.sync="page1"
        ref="crudrec1"
        :table-loading="loading1"
        @row-save="rowSave1"
        @search-change="searchChange1"
        @search-reset="searchReset1"
        @row-update="rowUpdate1"
        @row-del="rowDel1"
        @selection-change="selectionChange1"
        @refresh-change="refreshChange1"
      >
        <!-- <template slot="menuLeft">
          <el-button
            type="danger"
            size="small"
@@ -59,10 +60,11 @@
            >删 除
          </el-button>
        </template> -->
    </avue-crud>
    <!-- </span> -->
    <!-- <span v-else-if="typeTABS.prop === 'tab3'">选项卡内容3</span> -->
  </div>
      </avue-crud>
      <!-- </span> -->
      <!-- <span v-else-if="typeTABS.prop === 'tab3'">选项卡内容3</span> -->
    </div>
  </basic-container>
</template> 
<script>
@@ -77,9 +79,11 @@
  update1,
  remove1,
} from "@/api/dispatch/dispatch";
import { getDept } from "@/api/system/dept";
export default {
  data() {
    let baseUrl = "https://cli.avuejs.com/api/area";
    return {
      // typeTABS: {}, //标签页
      // optionTABS: {
@@ -133,6 +137,8 @@
      //   selection: true,
      //   column: column,
      // },
      deptCategory: "",
      deptId: "",
      loading1: true, //派遣记录
      selectionList1: [],
@@ -150,12 +156,12 @@
        // menu: false,
        searchSize: "mini",
        searchMenuSpan: 8,
        height: 563,
        height: 623,
        cellBtn: false,
        // addBtn: false,
        // menuWidth: 160,
        align: "center",
        // selection: true,
        selection: true,
        column: [
          // 派遣服务公司登记
          // {
@@ -168,21 +174,69 @@
          //     // editDisplay: false,
          //     // addDisplay: false
          // },
          // {
          //   label: "保安公司",
          //   prop: "deptId",
          //   labelWidth: 120,
          //   searchLabelWidth: 120,
          //   searchSpan: 4,
          //   dicUrl:
          //     "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
          //   props: {
          //     label: "title",
          //     value: "id",
          //   },
          //   search: true,
          //   overHidden: true,
          //   type: "select",
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入保安公司",
          //       trigger: "blur",
          //     },
          //   ],
          // },
          {
            label: "派遣单位",
            prop: "dispatcherCompany",
            // addDisplay: false,
            // editDisplay: false,
          },
          // {
          //   label: "派遣单位",
          //   prop: "dispatcherUnitId",
          //   labelWidth: 120,
          //   searchLabelWidth: 120,
          //   dicUrl: "/api/dispatcherUnit/page-tree",
          //   props: {
          //     label: "name",
          //     value: "id",
          //   },
          //   hide: true,
          //   searchSpan: 4,
          //   search: true,
          //   overHidden: true,
          //   type: "tree",
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入保安公司",
          //       trigger: "blur",
          //     },
          //   ],
          // },
          {
            label: "保安公司",
            prop: "deptId",
            labelWidth: 120,
            searchLabelWidth: 120,
            searchSpan: 4,
            dicUrl:
              "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
            search: true,
            type: "select",
            cascaderItem: ["securityName"],
            props: {
              label: "title",
              value: "id",
            },
            search: true,
            overHidden: true,
            type: "select",
            dicUrl: `/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697`,
            rules: [
              {
                required: true,
@@ -192,47 +246,72 @@
            ],
          },
          {
            label: "派遣单位",
            prop: "id",
            labelWidth: 120,
            searchLabelWidth: 120,
            dicUrl: "/api/page-tree",
            label: "保安员",
            prop: "securityName",
            type: "select",
            search: true,
            // cell: true,
            // hide: true,
            props: {
              label: "name",
              label: "realName",
              value: "id",
            },
            searchSpan: 4,
            search: true,
            overHidden: true,
            type: "select",
            dicUrl: `/api/blade-user/page-security-units?deptId={{key}}`,
            rules: [
              {
                required: true,
                message: "请输入保安公司",
                message: "请选择保安",
                trigger: "blur",
              },
            ],
          },
          {
            label: "保安人名称",
            prop: "name",
            search: true,
            searchSpan: 4,
            labelWidth: 120,
            searchLabelWidth: 120,
            // overHidden: true
            rules: [
              {
                required: true,
                message: "请输入保安人名称",
                trigger: "click",
              },
            ],
          },
          // {
          //   width: 120,
          //   label: "保安人名称",
          //   prop: "area",
          //   cell: true,
          //   props: {
          //     label: "name",
          //     value: "code",
          //   },
          //   type: "select",
          //   dicUrl: `${baseUrl}/getArea/{{key}}`,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择地区",
          //       trigger: "blur",
          //     },
          //   ],
          // },
          // {
          //   label: "保安人名称",
          //   prop: "name",
          //   search: true,
          //   searchSpan: 4,
          //   labelWidth: 120,
          //   searchLabelWidth: 120,
          //   // overHidden: true
          //   type: "tree",
          //   dicUrl: "/api/blade-user/page-security",
          //   props: {
          //     label: "realName",
          //     value: "postId",
          //   },
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入保安人名称",
          //       trigger: "click",
          //     },
          //   ],
          // },
          {
            label: "身份证",
            prop: "cardid",
            labelWidth: 120,
            overHidden: true,
            rules: [
              {
                required: true,
@@ -259,8 +338,9 @@
            format: "yyyy-MM-dd hh:mm:ss",
            valueFormat: "yyyy-MM-dd hh:mm:ss",
            labelWidth: 120,
            searchSpan: 4,
            search: true,
            searchSpan: 5,
            // search: true,
            overHidden: true,
            rules: [
              {
                required: true,
@@ -277,6 +357,7 @@
            format: "yyyy-MM-dd hh:mm:ss",
            valueFormat: "yyyy-MM-dd hh:mm:ss",
            labelWidth: 120,
            overHidden: true,
            rules: [
              {
                required: true,
@@ -285,8 +366,30 @@
              },
            ],
            // search: true,
            // searchSpan: 5,
            // searchSpan: 4,
            // overHidden: true
          },
          {
            label: "派遣时间",
            prop: "releaseTimeRange",
            type: "datetime",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            searchValue: [this.getStartTime(), this.getEndTime()],
            searchRange: true,
            searchSpan: 4,
            hide: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            search: true,
            rules: [
              {
                required: true,
                message: "请输入时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "派遣地址",
@@ -602,6 +705,26 @@
      this.onLoad1(this.page1, this.query1);
    },
    getStartTime() {
      if (
        this.$route.query.startTime != undefined &&
        this.$route.query.startTime != null &&
        this.$route.query.startTime != ""
      ) {
        return this.$route.query.startTime;
      }
      return "";
    },
    getEndTime() {
      if (
        this.$route.query.endTime != undefined &&
        this.$route.query.endTime != null &&
        this.$route.query.endTime != ""
      ) {
        return this.$route.query.endTime;
      }
      return "";
    },
    //
    onLoad1(page, params = {}) {
      this.loading1 = true;
@@ -611,17 +734,37 @@
      // params["dispatcherUnitId"] = this.id;
      // console.log(params, "get");
      // console.log(page);
      var values;
      const { releaseTimeRange } = this.query1;
      if (releaseTimeRange) {
        values = {
          ...params,
          beginTime: releaseTimeRange[0],
          overTime: releaseTimeRange[1],
          ...this.query,
        };
        values.releaseTimeRange = null;
      } else {
        values = {
          ...params,
          ...this.query,
        };
      }
      console.log(values);
      getdata1(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
        // Object.assign(params, this.query)
        values
      ).then((res) => {
        // console.log(res);
        const data = res.data.data;
        this.page1.total = data.total;
        this.data1 = data.records;
        console.log(this.data1, 1);
        console.log(this.data1, 1111111111111111111111111);
        this.loading1 = false;
        this.$nextTick(() => this.$refs.crudrec1.dicInit("cascader"));
      });
    },
    //派遣记录
@@ -668,6 +811,27 @@
    //   this.obj0.name = " 未选择派遣单位";
    // }
  },
  // onLoad(page, params = {}) {
  //   this.deptId = JSON.parse(
  //       window.localStorage.getItem("saber-userInfo")
  //     ).content.dept_id;
  //     //获取当前用户部门信息,判断是否为公安,如果是公安,则只能查看公告信息
  //     var that = this;
  //     getDept(this.deptId).then((res) => {
  //       var deptCategory = res.data.data.deptCategory;
  //       deptCategory == 1
  //         ? (that.deptCategory = true)
  //         : (that.deptCategory = false);
  //       if (that.deptCategory) {
  //         params["deptId"] = this.deptId;
  //       }
  //       let values = {
  //         ...params,
  //       };
  //    })
  // }
};
</script>