From 2d6dd9c84ccf3ab8f0595301433fc238c3661291 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 10 Jul 2021 13:51:05 +0800
Subject: [PATCH] 派遣管理和保安单位管理  内联修改, 根据单位的存在改变状态

---
 src/views/securityUnit/index.vue |  205 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 147 insertions(+), 58 deletions(-)

diff --git a/src/views/securityUnit/index.vue b/src/views/securityUnit/index.vue
index e0f05c9..caa4d7d 100644
--- a/src/views/securityUnit/index.vue
+++ b/src/views/securityUnit/index.vue
@@ -39,7 +39,7 @@
     </avue-crud>
     <div class="lod" v-show="forms != -1">
       <div class="lod-in">
-        <el-col class="trees" v-if="forms == 0">
+        <!-- <el-col class="trees" v-if="forms == 0">
           <div class="box">
             <el-scrollbar>
               <basic-container>
@@ -51,7 +51,7 @@
               </basic-container>
             </el-scrollbar>
           </div>
-        </el-col>
+        </el-col> -->
         <avue-form
           ref="form"
           v-model="obj0"
@@ -64,7 +64,7 @@
           </template>
         </avue-form>
         <avue-form
-          ref="form"
+          ref="form1"
           v-model="obj1"
           :option="option1"
           v-else-if="forms == 1"
@@ -76,7 +76,7 @@
           </template>
         </avue-form>
         <avue-form
-          ref="form"
+          ref="form2"
           v-model="obj2"
           :option="option2"
           v-else-if="forms == 2"
@@ -118,35 +118,58 @@
 
       treeData: [],
       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,
-                };
-              })
-            );
-          });
-        },
+        title: "我是标题",
+        filterText: "搜索关键字自定义",
+        defaultExpandAll: true,
         addBtn: false,
         menu: false,
         size: "small",
+        formOption: {
+          labelWidth: 100,
+          column: [
+            {
+              label: "自定义项",
+              prop: "label",
+            },
+          ],
+        },
         props: {
           labelText: "标题",
           label: "title",
-          value: "value",
+          value: "id",
           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: "保安单位基本信息",
@@ -180,6 +203,9 @@
       data0: {},
       data1: {},
       data2: {},
+      b0: {},
+      b1: {},
+      b2: {},
       noshehuibianma: 0,
       nobumen: 0,
 
@@ -257,8 +283,15 @@
       //   this.$message.success("页码" + val);
     },
     rowSave(form, done, loading) {
-      console.log("save1");
+      // console.log("save1");
       this.forms = 0;
+      var that = this;
+      //先获取部门接口
+      getDeptLazyTree().then((res) => {
+        var d = res.data.data;
+        that.treeData = d;
+        // console.log(d);
+      });
     },
     searchChange(params, done) {
       this.query = params;
@@ -336,12 +369,13 @@
       this.onLoad(this.page, this.query);
     },
     rowClick(row) {
-      console.log(row);
-      row.identificationnumber; //统一社会信用代码
+      // console.log(row);
+      // row.identificationnumber; //统一社会信用代 码
+      window.localStorage.setItem("danweidata", JSON.stringify(row));
       this.$router.push({
         path: "/securityUnitChild",
         // redirect: { name: "foo" },
-        query: { row: row },
+        query: { rowsecurity: "fromSecurity" },
         // params: { row: row.identificationnumber },
       });
     },
@@ -352,61 +386,110 @@
         page.pageSize,
         Object.assign(params, this.query)
       ).then((res) => {
-        // console.log(res);
         const data = res.data.data;
         this.page.total = data.total;
         this.data = data.records;
+        window.localStorage.setItem("danweidataS", JSON.stringify(this.data));
         console.log(this.data);
         this.loading = false;
       });
     },
-    nodeClick(data) {
-      // this.treeDeptId = data.id;
-      // this.page.currentPage = 1;
-      // this.onLoad(this.page);
-      // this.$message.success(JSON.stringify(data));
-      this.obj0["departmentid"] = data.title;
-      this.obj1["departmentid"] = data.title;
-      this.obj2["departmentid"] = data.title;
-      this.nobumen = 1;
-    },
+    // nodeClick(data) {//分局   不在这添加
+    //   // this.treeDeptId = data.id;
+    //   // this.page.currentPage = 1;
+    //   // this.onLoad(this.page);
+    //   // this.$message.success(JSON.stringify(data));
+    //   this.obj0["departmentid"] = data.title;
+    //   this.obj1["departmentid"] = data.title;
+    //   this.obj2["departmentid"] = data.title;
+    //   this.obj0["useid"] = data.id;
+    //   this.obj1["useid"] = data.id;
+    //   this.obj2["useid"] = data.id;
+    //   this.nobumen = 1;
+    // },
     tip0() {
       if (this.panduanmeiyouziduan()) {
         return;
       }
-      var b = {};
+      var d = {};
       for (var k in this.obj0) {
-        if (k != "title") {
-          b[k] = this.obj0[k];
+        for (var i in column0) {
+          if (k == column0[i].prop && k != "title0") {
+            d[k] = this.obj0[k];
+          }
         }
       }
-      this.data0 = b;
+      // console.log(d);
+      for (var k in d) {
+        if (d[k] == "" || d[k] == undefined) {
+          console.log(k);
+          this.$message.warning("请检查表单是否填写完整!");
+          return;
+        }
+      }
+      this.data0 = d;
       this.forms = 1;
     },
     tip1() {
       if (this.panduanmeiyouziduan()) {
         return;
       }
-      var b = {};
+      var d = {};
       for (var k in this.obj1) {
-        if (k != "title") {
-          b[k] = this.obj1[k];
+        for (var i in column1) {
+          if (k == column1[i].prop && k != "title1") {
+            d[k] = this.obj1[k];
+          }
         }
       }
-      this.data1 = b;
+      d["capital"] = d["capital2"];
+      delete d["capital2"];
+      // console.log(d);
+      for (var k in d) {
+        if (d[k] == "" || d[k] == undefined) {
+          console.log(k);
+          this.$message.warning("请检查表单是否填写完整!");
+          return;
+        }
+      }
+      this.data1 = d;
       this.forms = 2;
     },
     tip2() {
       if (this.panduanmeiyouziduan()) {
         return;
       }
-      var b = {};
+      var d = {};
       for (var k in this.obj2) {
-        if (k != "title") {
-          b[k] = this.obj2[k];
+        for (var i in column2) {
+          if (k == column2[i].prop && k != "title2") {
+            d[k] = this.obj2[k];
+          }
         }
       }
-      this.data2 = b;
+      d["cardid"] = d["cardid2"];
+      delete d["cardid2"];
+      d["cell"] = d["cell2"];
+      delete d["cell2"];
+      d["shareholdingratio"] = d["shareholdingratio2"];
+      delete d["shareholdingratio2"];
+      // console.log(d);
+      for (var k in d) {
+        if (d[k] == "" || d[k] == undefined) {
+          console.log(k);
+          this.$message.warning("请检查表单是否填写完整!");
+          return;
+        }
+      }
+      this.data2 = d;
+
+      // this.data0.departmentid = this.data0.useid;
+      // this.data1.departmentid = this.data1.useid;
+      // this.data2.departmentid = this.data2.useid;
+      // delete this.data0.useid;
+      // delete this.data1.useid;
+      // delete this.data2.useid;
+
       adddata(this.data0).then((res) => {
         console.log(res, 0);
       });
@@ -449,20 +532,26 @@
         return true;
       }
       if (this.nobumen == 0) {
-        this.$message.warning("请选则部门");
         return false;
+        this.$message.warning("请选则部门");
       }
       return false;
     },
   },
   watch: {
     haveID() {
-      if (this.haveID > 9000) {
-        //统一社会信用代码判断
-        this.noshehuibianma = 1;
-      } else {
-        this.noshehuibianma = 0;
+      // console.log(this.haveID);
+      if (this.haveID != undefined) {
+        if (this.haveID.length > 5) {
+          //统一社会信用代码判断
+          this.noshehuibianma = 1;
+        } else {
+          this.noshehuibianma = 0;
+        }
       }
+    },
+    havedata() {
+      console.log(this.havedata, "qqqqq");
     },
   },
   mounted() {},
@@ -503,7 +592,7 @@
     width: 15%;
     top: 100px;
     left: 0;
-    display: none;
+    // display: none;
   }
   .lod-in {
     width: 70%;

--
Gitblit v1.9.3