tangzy
2021-09-03 8e68b3cefdf22c2eb37e02e2bafa06013bab5053
src/page/login/codelogin.vue
@@ -51,7 +51,7 @@
        <i slot="prefix" class="icon-shouji"/>
      </el-input>
    </el-form-item>
    <avue-input-tree style="width:580px !important" :defaultExpandAll="loginForm.defaultFlag" v-model="loginForm.deptid" placeholder="请选择部门"
    <avue-input-tree style="width:580px !important" :defaultExpandAll="false" v-model="loginForm.deptid" placeholder="请选择部门"
                     type="tree"
                     :dic="dic"></avue-input-tree>
    <el-form-item class="z-login-submit-prv">
@@ -110,7 +110,6 @@
      dicr: [],
      msgKey: false,
      loginForm: {
        defaultFlag: false,
        cardid: "",
        username: "",
        sname: "",
@@ -136,13 +135,12 @@
  created() {
    this.msgText = this.config.MSGINIT;
    this.msgTime = this.config.MSGTIME;
    defaultFlag
  },
  mounted() {
    var that = this;
    ss().then(res => {
      console.log(that.ergodicData(res.data.data), 898989)
      that.dic = that.ergodicData(res.data.data)
      console.log(that.processingData(res.data.data), 898989)
      that.dic = that.processingData(res.data.data)
    });
  },
  computed: {
@@ -157,65 +155,26 @@
  },
  props: [],
  methods: {
    ergodicData(val) {
      var arr = []
      val.forEach((item, index) => {
    processingData(val) {
        arr.push({label: item.title, value: item.value, id: item.id, parent_id: item.parent_id})
        for (var i = 0; i < val.length; i++) {
          val[i].label = val[i].title
        if (item.hasChildren == true) {
          if (val[i].hasChildren == true) {
          var arrOne = []
            if (val[i].children && val[i].children.length > 0) {
          if (item.children && item.children.length > 0) {
              this.processingData(val[i].children)
            item.children.forEach((childItem, childIndex) => {
              arrOne.push({
                label: childItem.title,
                value: childItem.value,
                id: childItem.id,
                parent_id: childItem.parent_id
              })
              if (childItem.hasChildren == true) {
                var arrTwo = []
                if (childItem.children && childItem.children.length > 0) {
                  childItem.children.forEach((findItem, findIndex) => {
                    arrTwo.push({
                      label: findItem.title,
                      value: findItem.value,
                      id: findItem.id,
                      parent_id: findItem.parent_id
                    })
                  })
                }
                arrOne[childIndex].children = arrTwo
              }
            })
            }
          }
          arr[index].children = arrOne
        }
      })
      return arr;
        return val
    },
    clearValidate(formName) {
@@ -237,7 +196,6 @@
        this.loginForm.password = ""
        this.loginForm.password2 = ""
        this.loginForm.deptid = ""
        this.loginForm.defaultFlag = false
        this.$notify({
          title: '注册成功,待审核',
          type: 'warning'
@@ -255,7 +213,6 @@
      this.loginForm.password = ""
      this.loginForm.password2 = ""
      this.loginForm.deptid = ""
      this.loginForm.defaultFlag = false
      var zs = document.querySelector('.z');
      zs.style.display = 'none';
      this.clearValidate('loginForm')