Ver código fonte

添加数据项

FinalYu 2 anos atrás
pai
commit
b0033010e2

+ 105 - 5
chuanyi_client2/src/components/HeaderMain/index.vue

@@ -109,6 +109,70 @@
           <el-button @click="handleCancel">取消</el-button>
       </span>
     </el-dialog>
+
+    <!-- 数据项弹出层 -->
+    <el-dialog
+        :title="dataItemDialogTitle"
+        width="80%"
+        top="10vh"
+        center
+        :before-close="itemDialogClose"
+        :visible.sync="dataItemDialogVisible"
+        :close-on-click-modal="false"
+        :append-to-body="true">
+      <el-form label-width='100px'>
+        <el-form-item label='数据源:'>
+          <el-select v-model="groupBasicForm.dataSourceId" disabled>
+            <el-option
+                v-for="dict in dataSourceList"
+                :key="dict.id"
+                :label="dict.dataSourceName"
+                :value="dict.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div style="display: flex; height: 60vh; overflow: auto;">
+        <!-- 数据项 -->
+        <div class="cy-transform-data">
+          <el-divider content-position="left">数据项</el-divider>
+          <div class="cy-line">
+            <el-tree :data="itemDataList"
+                     :indent="0"
+                     node-key="id"
+                     :highlight-current="true"
+                     :default-expand-all="true"></el-tree>
+          </div>
+        </div>
+        <!-- 操作按钮 -->
+        <div class="cy-transform-btn">
+          <el-row>
+            <el-button size="mini">添加&nbsp;&gt;&gt;</el-button>
+          </el-row>
+          <el-row>
+            <el-button size="mini">&lt;&lt;&nbsp;移除</el-button>
+          </el-row>
+          <el-row>
+            <el-button size="mini">全部移除</el-button>
+          </el-row>
+        </div>
+        <!-- 已选择数据项 -->
+        <div class="cy-transform-data">
+          <el-divider content-position="left">已选择数据项</el-divider>
+          <div class="cy-line">
+            <el-tree :data="chooseItemDataList"
+                     :indent="0"
+                     node-key="id"
+                     :highlight-current="true"
+                     :default-expand-all="true"></el-tree>
+          </div>
+        </div>
+      </div>
+      <span slot='footer'>
+          <el-button type="primary">确定</el-button>
+          <el-button @click="itemDialogClose">取消</el-button>
+      </span>
+    </el-dialog>
   </el-tabs>
 </template>
 
@@ -122,6 +186,8 @@ export default {
     return {
       groupDialogTitle: '添加组',
       groupDialogVisible: false,
+      dataItemDialogTitle: '选择数据项',
+      dataItemDialogVisible: false,
       labelPosition: 'top',
       // 组配置右键布局显示状态
       visibleGroupMenu: false,
@@ -138,6 +204,10 @@ export default {
       readModeList: [],
       // 数据源
       dataSourceList: [],
+      // 数据项
+      itemDataList: [],
+      // 已选择的数据项
+      chooseItemDataList: [],
       groupBasicForm: {
         groupName: '',
         groupDescribe: '',
@@ -236,11 +306,12 @@ export default {
         })
         return
       }
-      getDataSourceItemTree(id).then(res => {
-        console.log(res)
-      }).catch((e) => {
-        console.error(e)
-      })
+      this.dataItemDialogVisible = true
+      // getDataSourceItemTree(id).then(res => {
+      //   console.log(res)
+      // }).catch((e) => {
+      //   console.error(e)
+      // })
     },
     /** 参数检查 */
     checkParams() {
@@ -289,6 +360,16 @@ export default {
       this.$refs['groupBasicForm'].resetFields()
       this.$refs['groupRateForm'].resetFields()
       done()
+    },
+    /** 选择数据项弹出层关闭事件 */
+    itemDialogClose(done) {
+      this.itemDataList = []
+      this.chooseItemDataList = []
+      if (typeof(done) === 'function') {
+        done()
+      } else {
+        this.dataItemDialogVisible = false
+      }
     }
   }
 }
@@ -405,4 +486,23 @@ export default {
 .el-form--label-top .el-form-item__label {
   padding: 0;
 }
+
+.cy-transform-btn {
+  width: 100px;
+  margin: 20px;
+  display: flex;
+  flex-direction: column;
+  flex-wrap: nowrap;
+  align-content: center;
+  justify-content: center;
+  align-items: center;
+
+  .el-row {
+    margin: 5px 0;
+  }
+}
+
+.cy-transform-data {
+  width: calc(100% - 60px);
+}
 </style>

+ 4 - 12
chuanyi_client2/src/utils/request.js

@@ -79,26 +79,18 @@ service.interceptors.response.use(res => {
         if (code === 401) {
             if (!isRelogin.show) {
                 isRelogin.show = true;
-                MessageBox.confirm('登录状态已过期,请重新登录', '系统提示', {
-                        confirmButtonText: '确定',
-                        type: 'warning'
-                    }
-                ).then(() => {
+                MessageBox.alert('登录状态已过期,请重新登录', '系统提示', {
+                    confirmButtonText: '确定'
+                }).then(r => {
                     isRelogin.show = false;
                     logout().then(res => {
                         removeAll()
                         location.href = '/index';
                     });
-                }).catch(() => {
-                    isRelogin.show = false;
-                });
+                })
             }
             return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
         } else if (code === 500) {
-            // Message({
-            //     message: msg,
-            //     type: 'error'
-            // })
             return Promise.reject(new Error(msg))
         } else if (code !== 200) {
             Notification.error({