shuishen
2021-11-12 8e2a42e4a2da78f9cda9fa3e7732a0ef72f0c906
src/views/securityUnit/localCompany.vue
@@ -15,9 +15,25 @@
        @row-del="rowDel"
        @selection-change="selectionChange"
        @refresh-change="refreshChange"
        @row-click="rowClick"
      >
        <!-- @row-click="rowClick" -->
        <template slot-scope="{ row }" slot="znum">
          <el-tag
            class="rowClickSelf"
            @click="rowClickSelf(row)"
            title="点击查看保安人员情况"
            >{{ row.znum }}</el-tag
          >
        </template>
        <template slot-scope="{ type, size, row }" slot="menu">
          <el-button
            icon="el-icon-s-custom"
            :size="size"
            :type="type"
            @click.stop="rowClick(row)"
            >查看
          </el-button>
          <el-button
            :size="size"
            :type="type"
@@ -53,58 +69,22 @@
          </el-button>
        </template>
      </avue-crud>
      <div class="lod" v-show="forms != -1">
        <div class="lod-in">
          <!-- <el-col class="trees" v-if="forms == 0">
          <div class="box">
            <el-scrollbar>
              <basic-container>
                <avue-tree
                  :option="treeOption"
                  :data="treeData"
                  @node-click="nodeClick"
                />
              </basic-container>
            </el-scrollbar>
          </div>
        </el-col> -->
          <avue-form
            ref="form"
            v-model="obj0"
            :option="option0"
            v-if="forms == 0"
          >
            <template slot="menuForm">
              <el-button type="primary" @click="tip0">下一页</el-button>
              <el-button type="info" @click="tipover">取消</el-button>
            </template>
          </avue-form>
          <avue-form
            ref="form1"
            v-model="obj1"
            :option="option1"
            v-else-if="forms == 1"
          >
            <template slot="menuForm">
              <el-button type="primary" @click="tip1up1">上一页</el-button>
              <el-button type="primary" @click="tip1">下一页</el-button>
              <el-button type="info" @click="tipover">取消</el-button>
            </template>
          </avue-form>
          <avue-form
            ref="form2"
            v-model="obj2"
            :option="option2"
            v-else-if="forms == 2"
          >
            <template slot="menuForm">
              <el-button type="primary" @click="tip2up2">上一页</el-button>
              <el-button type="primary" @click="tip2">提交</el-button>
              <el-button type="info" @click="tipover">取消</el-button>
            </template>
          </avue-form>
        </div>
      </div>
      <el-dialog
        :visible.sync="forms"
        width="80%"
        top="5vh"
        :modal-append-to-body="false"
        class="addCompany"
      >
        <avue-form
          ref="form"
          v-model="obj0"
          :option="option0"
          v-if="forms"
          @submit="handleSubmit"
        >
        </avue-form>
      </el-dialog>
    </div>
    <el-dialog
      title="保安单位导入"
@@ -204,43 +184,13 @@
          children: "children",
        },
      },
      // treeOption: {
      //   nodeKey: "id",
      //   // lazy: true,
      //   // treeLoad: function (node, resolve) {
      //   //   // const parentId = node.level === 0 ? 0 : node.data.id;
      //   //   getDeptLazyTree().then((res) => {
      //   //     resolve(
      //   //       res.data.data.map((item) => {
      //   //         console.log({
      //   //           ...item,
      //   //           leaf: !item.hasChildren,
      //   //         });
      //   //         return {
      //   //           ...item,
      //   //           leaf: !item.hasChildren,
      //   //         };
      //   //       })
      //   //     );
      //   //   });
      //   // },
      //   addBtn: false,
      //   menu: false,
      //   size: "small",
      //   props: {
      //     labelText: "标题",
      //     label: "title",
      //     value: "value",
      //     children: "children",
      //   },
      // },
      obj0: {
        title0: "保安单位基本信息",
      },
      option0: {
        emptyBtn: false,
        submitBtn: false,
        submitBtn: true,
        gutter: 30,
        column: column0,
      },
@@ -263,7 +213,7 @@
        column: column2,
      },
      forms: -1,
      forms: false,
      data0: {},
      data1: {},
      data2: {},
@@ -283,12 +233,17 @@
        searchSize: "mini",
        searchMenuSpan: 6,
        height: 583,
        menuWidth: 220,
        menuWidth: 275,
        border: true,
        align: "center",
        selection: true,
        column: column,
      },
    };
  },
  created() {
    this.option0.column[4].value = 2;
    this.option0.column[4].disabled = true;
  },
  computed: {
    ...mapGetters(["userInfo"]),
@@ -301,23 +256,23 @@
    },
    ids1() {
      let ids1 = [];
      this.selectionList1.forEach((ele) => {
        ids1.push(ele.id);
      this.selectionList.forEach((ele) => {
        ids1.push(ele.departmentid);
      });
      return ids1.join(",");
    },
    ids2() {
      let ids2 = [];
      this.selectionList2.forEach((ele) => {
        ids2.push(ele.id);
      });
      return ids2.join(",");
    },
    haveID() {
      return this.obj0.creditcode;
    },
  },
  methods: {
    rowClickSelf(val) {
      // console.log(val.departmentid);
      this.$router.push({
        path: "/securityGuardOnce/index",
        query: { departmentid: val.departmentid },
      });
    },
    handleImport1() {
      this.excelBox1 = true;
    },
@@ -364,7 +319,7 @@
    },
    rowSave(form, done, loading) {
      // console.log("save1");
      this.forms = 0;
      this.forms = true;
      var that = this;
      //先获取部门接口
      getDeptLazyTree().then((res) => {
@@ -403,11 +358,14 @@
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
      this.$confirm(
        "该操作将会把保安员数据一并删除,不可恢复!确定将选择公司删除?",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(() => {
          console.log(row);
          return remove(row.creditcode, row.departmentid);
@@ -434,8 +392,10 @@
        type: "warning",
      })
        .then(() => {
          console.log(this.ids);
          // return remove(this.ids);
          // console.log(this.ids);
          return remove(this.ids, this.ids1).then((res) => {
            this.refreshChange();
          });
        })
        .then(() => {
          this.onLoad(this.page);
@@ -444,7 +404,8 @@
            message: "操作成功!",
          });
          this.$refs.crudrec.toggleSelection();
        });
        })
        .catch((res) => {});
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
@@ -503,10 +464,33 @@
    //   this.obj2["useid"] = data.id;
    //   this.nobumen = 1;
    // },
    handleSubmit(form, done) {
      form["createUserId"] = this.userInfo.Id;
      // console.log(form);
      // done();
      // return;
      adddata(form).then((res) => {
        if (res.data.success) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.refreshChange();
          done();
          this.forms = false;
        } else {
          this.$message({
            message: "提交失败",
            type: "warning",
          });
          done();
        }
      });
    },
    tip0() {
      if (this.panduanmeiyouziduan()) {
        return;
      }
      // if (this.panduanmeiyouziduan()) {
      //   return;
      // }
      var d = {};
      for (var k in this.obj0) {
        for (var i in column0) {
@@ -517,15 +501,19 @@
      }
      console.log(d);
      for (var k in d) {
        if (d[k] == "" || d[k] == undefined) {
          console.log(k);
        if (d[k].prop == "capital") {
          continue;
        }
        let iisit0 = d[k] == "" || d[k] == undefined;
        if (iisit0) {
          console.log(d[k]);
          this.$message.warning("请检查表单是否填写完整!");
          return;
        }
      }
      console.log(d, 0);
      this.data0 = d;
      this.forms = 1;
      // this.data0 = d;
      // this.forms = 1;
    },
    tip1() {
      if (this.panduanmeiyouziduan()) {
@@ -643,7 +631,7 @@
    haveID() {
      // console.log(this.haveID);
      if (this.haveID != undefined) {
        if (this.haveID.length > 5) {
        if (this.haveID.length > 0) {
          //统一社会信用代码判断
          this.noshehuibianma = 1;
        } else {
@@ -683,7 +671,7 @@
  height: 100%;
  background-color: rgba($color: #000000, $alpha: 0.5);
  padding: 100px 0 0 0;
  z-index: 500 !important;
  z-index: 1500 !important;
  display: flex;
  // align-items: center;
  justify-content: center;
@@ -710,4 +698,9 @@
.el-collapse {
  border-top: 1px solid transparent !important;
}
.rowClickSelf {
  &:hover {
    cursor: pointer;
  }
}
</style>