shuishen
2021-11-12 8e2a42e4a2da78f9cda9fa3e7732a0ef72f0c906
src/views/dispatch/dispatch.vue
@@ -95,7 +95,7 @@
      <!-- <span v-else-if="typeTABS.prop === 'tab3'">选项卡内容3</span> -->
    </div>
  </basic-container>
</template>
</template>
<script>
import {
@@ -109,9 +109,18 @@
  remove1,
} from "@/api/dispatch/dispatch";
import { mapGetters } from "vuex";
import { mapState } from "vuex";
export default {
  data() {
    var phones = (rule, value, callback) => {
      window.yanzhengphons =
        /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/;
      if (!yanzhengphons.test(value)) {
        callback(new Error("请输入正确电话"));
      } else {
        callback();
      }
    };
    return {
      typeTABS: {}, //标签页
      deptId: "",
@@ -218,15 +227,21 @@
            searchSpan: 4,
            width: 210,
            // span: 12,
            labelWidth: 118,
            labelWidth: 138,
            rules: [
              {
                required: true,
                message: "请输入名称",
                trigger: "click",
              },
            ],
          },
          {
            label: "保安公司",
            prop: "deptId",
            type: "tree",
            overHidden: true,
            dicUrl:
              "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
            dicUrl: "",
            props: {
              label: "title",
              value: "id",
@@ -243,7 +258,7 @@
                trigger: "click",
              },
            ],
            labelWidth: 118,
            labelWidth: 138,
            width: 230,
            searchLabelWidth: 80,
            search: true,
@@ -261,7 +276,7 @@
            searchSpan: 4,
            overHidden: true,
            // span: 12,
            labelWidth: 118,
            labelWidth: 138,
          },
          {
            label: "合同生效时间",
@@ -294,9 +309,10 @@
            search: true,
            searchSpan: 4,
            overHidden: true,
            labelWidth: 118,
            labelWidth: 138,
            parent:false,
            type: "tree",
            dicUrl: "/api/jurisdiction/lazy-tree?parentId=1123598813738675201",
            dicUrl: "/api/jurisdiction/lazy-tree",
            props: {
              label: "title",
              value: "id",
@@ -320,9 +336,9 @@
            editDisplay: false,
            viewDisplay: false,
            overHidden: true,
            labelWidth: 118,
            labelWidth: 138,
            type: "tree",
            dicUrl: "/api/jurisdiction/lazy-tree?parentId=1123598813738675201",
            dicUrl: "/api/jurisdiction/lazy-tree",
            props: {
              label: "title",
              value: "id",
@@ -340,44 +356,123 @@
          // {
          //   label: " 派遣人数",
          //   prop: "num",
          //   labelWidth: 118,
          //   labelWidth: 138,
          // },
          // {
          //   label: "合同生效时间",
          //   prop: "releaseTimeRange",
          //   type: "date",
          //   format: "yyyy-MM-dd",
          //   valueFormat: "yyyy-MM-dd",
          //   searchValue: [this.getStartTime(), this.getEndTime()],
          //   // searchRange: true,
          //   searchSpan: 5,
          //   searchLabelWidth: 110,
          //   hide: true,
          //   value: [this.getStartTime(), this.getEndTime()],
          //   // addDisplay: false,
          //   // editDisplay: false,
          //   // viewDisplay: false,
          //   range: true,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入时间",
          //       trigger: "blur",
          //     },
          //   ],
          // },
          {
            label: "合同开始时间",
            prop: "startTime",
            labelWidth: 118,
            labelWidth: 138,
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            // search: true,
            rules: [
              {
                required: true,
                message: "请选择开始时间",
                trigger: "click",
              },
            ],
            // searchSpan: 4,
            // overHidden: true
          },
          {
            label: "合同结束时间",
            prop: "endTime",
            labelWidth: 118,
            labelWidth: 138,
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            // search: true,
            rules: [
              {
                required: true,
                message: "请选择结束时间",
                trigger: "click",
              },
            ],
            // searchSpan: 4,
            // overHidden: true
          },
          {
            label: " 负责人",
            prop: "linkman",
            labelWidth: 118,
            labelWidth: 138,
            rules: [
              {
                required: true,
                message: "请输入负责人",
                trigger: "click",
              },
            ],
          },
          {
            label: "负责人联系方式",
            prop: "phone",
            labelWidth: 118,
            labelWidth: 138,
            width: 110,
            rules: [
              {
                required: true,
                message: "请输入联系方式",
                trigger: "click",
              },
              {
                validator: phones,
                trigger: ["change", "blur"],
              },
            ],
          },
        ],
      },
      useifid: 266,
    };
  },
  created() {
    var that = this;
    if (this.userInfo.role_name == "保安公司管理员") {
      const deptColumn = this.findObject(this.option.column, "deptId");
      deptColumn.search = false;
      deptColumn.addDisplay = false;
      deptColumn.editDisplay = false;
      deptColumn.viewDisplay = false;
      deptColumn.hide = true;
      this.useifid = this.userInfo.dept_id;
    }
    //公安局进入
    if (this.userInfo.role_name == "公安管理员") {
      that.option.column[1].dicUrl =
        "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697&jurisdiction=" +
        that.userInfo.jurisdiction;
    } else {
      that.option.column[1].dicUrl =
        "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
    }
  },
  computed: {
    ...mapGetters(["userInfo"]),
@@ -395,6 +490,9 @@
      });
      return ids1.join(",");
    },
    ...mapState({
      userInfo: (state) => state.user.userInfo,
    }),
  },
  methods: {
    handleChangeTABS(column) {
@@ -423,13 +521,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++) {
      form["deptId"] = this.userInfo.dept_id;
      // form["tenantName"] = form.this.userInfo.user_name;
      // form["deptId"] = this.userInfo.dept_id;
      if (this.useifid != 266) {
        form["deptId"] = this.useifid;
      }
      adddata(form).then(
        (res) => {
          this.onLoad(this.page);
@@ -457,7 +552,9 @@
      this.onLoad(this.page);
    },
    rowUpdate(row, index, done, loading) {
      console.log(row);
      if (this.useifid != 266) {
        row["deptId"] = this.useifid;
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
@@ -519,7 +616,6 @@
      this.onLoad(this.page, this.query);
    },
    rowClick(row) {
      // console.log(row);
      window.localStorage.setItem("paqiandata", JSON.stringify(row));
      this.$router.push({
        path: "/dispatchChild",
@@ -569,16 +665,18 @@
          ...this.query,
        };
      }
      console.log(values);
      if (this.useifid != 266) {
        values["deptId"] = this.useifid;
      }
      if (this.userInfo.role_name == "公安管理员") {
        values["jurisdiction"] = that.userInfo.jurisdiction;
      }
      getdata(
        page.currentPage,
        page.pageSize,
        // Object.assign(params, this.query)
        values
      ).then((res) => {
        // console.log(res);
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
@@ -603,138 +701,6 @@
      this.refreshChange();
      done();
    },
    //派遣服务公司登记
    //派遣记录
    // 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;
    //   });
    // },
    //派遣记录
  },
  mounted() {
    this.typeTABS = this.optionTABS.column[0];
@@ -760,4 +726,4 @@
.el-collapse-item {
  padding-top: 15px !important;
}
</style>
</style>