Browse Source

1. 更新element-ui 2.2.1 用于解决tree半选中状态项不能传给后台接口问题。
2. 修改本地开发找不到baseUrl问题。

daxiong.yang 7 years ago
parent
commit
5be5a0010c
3 changed files with 15 additions and 16 deletions
  1. 1 7
      index.html
  2. 7 7
      package.json
  3. 7 2
      src/views/role/add-or-update.vue

+ 1 - 7
index.html

@ -18,13 +18,7 @@
18 18
    </script>
19 19
  <% }else { %>
20 20
    <!-- 开发环境 -->
21
    <script>
22
      (function () {
23
        var s = document.createElement('script');
24
        s.src = './static/config/index.js?v=' + new Date().getTime();
25
        document.getElementsByTagName('head')[0].appendChild(s);
26
      })();
27
    </script>
21
    <script src="./static/config/index.js?v=<%=new Date().getTime()%>"></script>
28 22
  <% } %>
29 23
</head>
30 24
<body>

+ 7 - 7
package.json

@ -17,12 +17,12 @@
17 17
    "axios": "0.17.1",
18 18
    "babel-plugin-component": "0.10.1",
19 19
    "babel-polyfill": "6.26.0",
20
    "element-ui": "2.1.0",
21
    "gulp": "^3.9.1",
22
    "gulp-concat": "^2.6.1",
23
    "gulp-load-plugins": "^1.5.0",
24
    "gulp-replace": "^0.6.1",
25
    "gulp-shell": "^0.6.5",
20
    "element-ui": "2.2.1",
21
    "gulp": "3.9.1",
22
    "gulp-concat": "2.6.1",
23
    "gulp-load-plugins": "1.5.0",
24
    "gulp-replace": "0.6.1",
25
    "gulp-shell": "0.6.5",
26 26
    "vue": "2.5.2",
27 27
    "vue-cookie": "1.1.4",
28 28
    "vue-router": "3.0.1",
@ -52,7 +52,7 @@
52 52
    "eslint-plugin-html": "3.0.0",
53 53
    "eslint-plugin-import": "2.7.0",
54 54
    "eslint-plugin-node": "5.2.0",
55
    "eslint-plugin-promise": "3.4.0",
55
    "eslint-plugin-promise": "3.5.0",
56 56
    "eslint-plugin-standard": "3.0.1",
57 57
    "eventsource-polyfill": "0.9.6",
58 58
    "extract-text-webpack-plugin": "3.0.0",

+ 7 - 2
src/views/role/add-or-update.vue

@ -49,7 +49,8 @@
49 49
          roleName: [
50 50
            { required: true, message: '角色名称不能为空', trigger: 'blur' }
51 51
          ]
52
        }
52
        },
53
        tempKey: -666666 // 临时key, 用于解决tree半选中状态项不能传给后台接口问题. # 待优化
53 54
      }
54 55
    },
55 56
    methods: {
@ -69,6 +70,10 @@
69 70
              if (data && data.code === 0) {
70 71
                this.dataForm.roleName = data.role.roleName
71 72
                this.dataForm.remark = data.role.remark
73
                var idx = data.role.menuIdList.indexOf(this.tempKey)
74
                if (idx !== -1) {
75
                  data.role.menuIdList.splice(idx, data.role.menuIdList.length - idx)
76
                }
72 77
                this.$refs.menuListTree.setCheckedKeys(data.role.menuIdList)
73 78
              }
74 79
            })
@ -83,7 +88,7 @@
83 88
              'roleId': this.dataForm.id || undefined,
84 89
              'roleName': this.dataForm.roleName,
85 90
              'remark': this.dataForm.remark,
86
              'menuIdList': this.$refs.menuListTree.getCheckedKeys()
91
              'menuIdList': [].concat(this.$refs.menuListTree.getCheckedKeys(), [this.tempKey], this.$refs.menuListTree.getHalfCheckedKeys())
87 92
            }
88 93
            var tick = !this.dataForm.id ? API.role.add(params) : API.role.update(params)
89 94
            tick.then(({data}) => {