ソースを参照

Merge remote-tracking branch 'origin/1.2.2' into 1.2.2

# Conflicts:
#	src/utils/request.js
yangfan 3 ヶ月 前
コミット
4c0340d71c

+ 8 - 0
src/api/onlineDev/visualDev.js

@@ -748,3 +748,11 @@ export function sceneDelete(data) {
     data
   })
 }
+// API自定义事件请求数据
+export function apiExecute(data) {
+  return request({
+    url: `/visual-api/paas/http/execute`,
+    method: 'POST',
+    data
+  })
+}

+ 7 - 7
src/components/ColumnDesign/index.vue

@@ -467,7 +467,7 @@
                 </el-form-item>
                 <el-form-item label="排序类型">
                   <el-select v-model="columnData.sort" placeholder="请选择排序类型">
-                    <el-option label="升序" value="ascs"></el-option>
+                    <el-option label="升序" value="asc"></el-option>
                     <el-option label="降序" value="descs"></el-option>
                   </el-select>
                 </el-form-item>
@@ -1018,7 +1018,6 @@ export default {
       }
     },
     visibleCheck(val) {
-      console.log(this.sceneIndex)
       if (val) {
         const columnList = g.T.toTable(this.columnData.columnList, 'children').map((item) => {
           item.visible = true
@@ -1214,12 +1213,13 @@ export default {
       }
       if (!this.columnData.searchList.length) {
         this.$set(this.columnData, 'searchList', this.searchOptions)
-      } else {
-        this.columnData.searchList = this.searchOptions.map((aItem) => {
-          const correspondingBItem = this.columnData.searchList.find((bItem) => bItem.__vModel__ === aItem.propId)
-          return correspondingBItem ? { ...aItem, ...correspondingBItem } : aItem
-        })
       }
+      // else {
+        // this.columnData.searchList = this.searchOptions.map((aItem) => {
+        //   const correspondingBItem = this.columnData.searchList.find((bItem) => bItem.__vModel__ === aItem.propId)
+        //   return correspondingBItem ? { ...aItem, ...correspondingBItem } : aItem
+        // })
+      // }
       if (!this.columnData.columnList.length) {
         this.$set(this.columnData, 'columnList', this.columnOptions)
       } else {

+ 350 - 104
src/components/Dataset-filter/auth-group-panel.vue

@@ -23,18 +23,34 @@
         <div style="flex: 1"></div>
         <el-button size="mini" plain type="success" icon="el-icon-plus" @click="onEdit(null)">添加权限组</el-button>
       </div>
-      <div class="item" v-for="group of groupList" :key="group.id" @click="onSelect(group)" :class="{ selected: selected == group.id }">
-        <div class="name">
-          <div>{{ group.permName }}</div>
-          <div style="flex: 1"></div>
-          <el-button size="mini" type="primary" plain icon="el-icon-setting" v-show="!isSelect" @click="goSetting(group)"> 权限设置 </el-button>
-          <el-button size="mini" type="primary" plain icon="el-icon-edit" @click="onEdit(group)"></el-button>
-          <el-button size="mini" type="danger" plain icon="el-icon-delete" @click="onDel(group)"></el-button>
-        </div>
-        <div class="selected">
-          <div class="tag" v-for="item of group.dpList" :key="item.id"><i class="el-icon-s-flag" style="color: #67c23a; margin-right: 5px"></i>{{ item.name }}</div>
-          <div class="tag" v-for="item of group.roleList" :key="item.id"><i class="el-icon-user-solid" style="color: #e6a23c; margin-right: 5px"></i>{{ item.name }}</div>
-          <div class="tag" v-for="item of group.userList" :key="item.id"><i class="el-icon-user" style="color: #909399; margin-right: 5px"></i>{{ item.name }}</div>
+      <div class="main">
+        <div class="item" v-for="group of groupList" :key="group.id"  :class="{ selected: selected == group.id }">
+          <div class="name">
+            <div>{{ group.permName }}</div>
+            <div style="flex: 1"></div>
+            <el-button
+              size="mini" type="primary" plain icon="el-icon-setting" v-show="!isSelect&&group.id"
+              @click="goSetting(group)"
+            >
+              权限设置
+            </el-button>
+            <el-button size="mini" type="success" icon="el-icon-thumb" v-show="isSelect" @click="onSelect(group)">
+              选择
+            </el-button>
+            <el-button size="mini" type="primary" plain icon="el-icon-edit" @click="onEdit(group)"></el-button>
+            <el-button
+              v-show="group.id" size="mini" type="danger" plain icon="el-icon-delete" @click="onDel(group)"
+            ></el-button>
+          </div>
+          <div class="selected">
+            <div class="tag" v-for="item of group.dpList" :key="item.id"><i class="el-icon-s-flag" style="color: #67c23a; margin-right: 5px"></i>{{ item.name }}</div>
+            <div class="tag" v-for="item of group.roleList" :key="item.id"><i class="el-icon-user-solid" style="color: #e6a23c; margin-right: 5px"></i>{{ item.name }}</div>
+            <div class="tag" v-for="item of group.userList" :key="item.id"><i class="el-icon-user" style="color: #909399; margin-right: 5px"></i>{{ item.name }}</div>
+            <div class="tag" v-for="item of group.blackUserList" :key="item.id">
+              <i class="el-icon-error" style="color:#909399;margin-right: 5px"></i>
+              <span style="color:#f56c6c;text-decoration: line-through">{{ item.name }}</span>
+            </div>
+          </div>
         </div>
       </div>
       <el-pagination
@@ -87,57 +103,136 @@
         </el-form-item>
         <el-form-item label="已选择项">
           <div class="selected">
-            <div class="tag" v-for="item of form.dpList" :key="item.id"><i class="el-icon-s-flag" style="color: #67c23a; margin-right: 5px"></i>{{ item.name }}</div>
-            <div class="tag" v-for="item of form.roleList" :key="item.id"><i class="el-icon-user-solid" style="color: #e6a23c; margin-right: 5px"></i>{{ item.name }}</div>
-            <div class="tag" v-for="item of form.userList" :key="item.id"><i class="el-icon-user" style="color: #909399; margin-right: 5px"></i>{{ item.name }}</div>
+            <div class="tag" v-for="(item,i) of form.dpList" :key="item.id">
+              <i class="el-icon-s-flag" style="color:#67c23a;margin-right: 5px"></i>
+              {{ item.name }}
+              <i class="el-icon-close" @click="onQuickDel('dpList',item,i)"></i>
+            </div>
+            <div class="tag" v-for="(item,i) of form.roleList" :key="item.id">
+              <i class="el-icon-user-solid" style="color:#e6a23c;margin-right: 5px"></i>
+              {{ item.name }}
+              <i class="el-icon-close" @click="onQuickDel('roleList',item,i)"></i>
+            </div>
+            <div class="tag" v-for="(item,i) of form.userList" :key="item.id">
+              <i class="el-icon-user" style="color:#909399;margin-right: 5px"></i>
+              {{ item.name }}
+              <i class="el-icon-close" @click="onQuickDel('userList',item,i)"></i>
+            </div>
+            <div class="tag" v-for="(item,i) of form.blackUserList" :key="item.id">
+              <i class="el-icon-error" style="color:#909399;margin-right: 5px"></i>
+              <span style="color:#f56c6c;text-decoration: line-through">{{ item.name }}</span>
+              <i class="el-icon-close" @click="onQuickDel('blackUserList',item,i)"></i>
+            </div>
           </div>
         </el-form-item>
       </el-form>
-      <el-tabs type="card" v-model="activeType">
+      <el-tabs type="card" v-model="activeType" @tab-click="onSelectTab">
         <el-tab-pane name="dept">
-          <span slot="label"><i class="el-icon-s-flag" style="color: #67c23a; margin-right: 5px"></i>部门</span>
-          <el-tree
-            ref="dept"
-            :data="deptList"
-            node-key="id"
-            :props="{ label: 'title' }"
-            default-expand-all
-            show-checkbox
-            check-strictly
-            check-on-click-node
-            :expand-on-click-node="false"
-            @check-change="onDeptChange"
-          ></el-tree>
+          <span slot="label"><i class="el-icon-s-flag" style="color:#67c23a;margin-right: 5px"></i>部门</span>
+          <div class="left">
+            <el-tree
+              ref="dept" :data="deptList" node-key="id" :props="{label:'title',}" default-expand-all show-checkbox
+              check-strictly check-on-click-node :expand-on-click-node="false" @check-change="onDeptChange"
+            ></el-tree>
+          </div>
         </el-tab-pane>
         <el-tab-pane name="role">
-          <span slot="label"><i class="el-icon-user-solid" style="color: #e6a23c; margin-right: 5px"></i>角色</span>
-          <el-tree
-            ref="role"
-            :data="roleList"
-            node-key="id"
-            :props="{ label: 'title' }"
-            default-expand-all
-            show-checkbox
-            check-strictly
-            check-on-click-node
-            :expand-on-click-node="false"
-            @check-change="onRoleChange"
-          ></el-tree>
+          <span slot="label"><i class="el-icon-user-solid" style="color:#e6a23c;margin-right: 5px"></i>角色</span>
+          <div class="left">
+            <el-tree
+              ref="role" :data="roleList" node-key="id" :props="{label:'title',}" default-expand-all show-checkbox
+              check-strictly check-on-click-node :expand-on-click-node="false" @check-change="onRoleChange"
+            ></el-tree>
+          </div>
         </el-tab-pane>
         <el-tab-pane name="user">
-          <span slot="label"><i class="el-icon-user" style="color: #909399; margin-right: 5px"></i>用户</span>
-          <el-tree
-            ref="user"
-            :data="userList"
-            node-key="id"
-            :props="{ children: 'list' }"
-            default-expand-all
-            show-checkbox
-            check-strictly
-            check-on-click-node
-            :expand-on-click-node="false"
-            @check-change="onUserChange"
-          ></el-tree>
+          <span slot="label"><i class="el-icon-user" style="color:#909399;margin-right: 5px"></i>用户</span>
+          <div class="left">
+            <el-tree
+              ref="user" :data="deptList" node-key="id" default-expand-all
+              check-on-click-node :expand-on-click-node="false" @node-click="onUserChange"
+            ></el-tree>
+          </div>
+          <div class="right" style="padding: 10px">
+            <el-checkbox
+              v-for="(item,i) of userChecks" :key="i" v-model="item.select" @change="onSelectUser($event,item)">
+              {{ item.label }}
+            </el-checkbox>
+          </div>
+        </el-tab-pane>
+        <el-tab-pane name="black">
+          <span slot="label"><i class="el-icon-error" style="color:#909399;margin-right: 5px"></i>黑名单</span>
+          <div class="left">
+            <el-tree
+              ref="black" :data="deptList" node-key="id" default-expand-all
+              check-on-click-node :expand-on-click-node="false" @node-click="onBlackChange"
+            ></el-tree>
+          </div>
+          <div class="right" style="padding: 10px">
+            <el-checkbox
+              v-for="(item,i) of userChecks" :key="i" v-model="item.select" @change="onSelectBlackUser($event,item)">
+              {{ item.label }}
+            </el-checkbox>
+          </div>
+        </el-tab-pane>
+        <el-tab-pane name="search">
+          <div slot="label" style="display: flex;align-items: center">
+            <el-input size="mini" v-model="searchKey" clearable @input="onSearch"></el-input>
+            <el-button size="mini" type="primary">搜索</el-button>
+          </div>
+          <div class="left">
+            <div class="name" @click="deptFold=!deptFold">
+              <i class="el-icon-s-flag" style="color:#67c23a;margin-right: 5px"></i>部门
+              <i class="el-icon-arrow-right" v-if="deptFold"></i>
+              <i class="el-icon-arrow-down" v-else></i>
+            </div>
+            <div class="items" v-show="!deptFold">
+              <el-checkbox
+                v-for="(item ,i) of deptSearched" :key="i" v-model="item.select"
+                @change="onSelectDeptOrRole($event,item,'dept')"
+              >
+                {{ item.label }}
+              </el-checkbox>
+            </div>
+            <div class="name" @click="roleFold=!roleFold">
+              <i class="el-icon-user-solid" style="color:#e6a23c;margin-right: 5px"></i>角色
+              <i class="el-icon-arrow-right" v-if="roleFold"></i>
+              <i class="el-icon-arrow-down" v-else></i>
+            </div>
+            <div class="items" v-show="!roleFold">
+              <el-checkbox
+                v-for="(item ,i) of roleSearched" :key="i" v-model="item.select"
+                @change="onSelectDeptOrRole($event,item,'role')"
+              >
+                {{ item.label }}
+              </el-checkbox>
+            </div>
+            <div class="name" @click="userFold=!userFold">
+              <i class="el-icon-user" style="color:#909399;margin-right: 5px"></i>用户
+              <i class="el-icon-arrow-right" v-if="userFold"></i>
+              <i class="el-icon-arrow-down" v-else></i>
+            </div>
+            <div class="items" v-show="!userFold">
+              <el-checkbox
+                v-for="(item ,i) of userSearched" :key="i" v-model="item.select"
+                @change="onSelectUser($event,item)">
+                {{ item.label }}
+              </el-checkbox>
+            </div>
+            <div class="name" @click="blackFold=!blackFold">
+              <i class="el-icon-error" style="color:#909399;margin-right: 5px"></i>黑名单
+              <i class="el-icon-arrow-right" v-if="blackFold"></i>
+              <i class="el-icon-arrow-down" v-else></i>
+            </div>
+            <div class="items" v-show="!blackFold">
+              <el-checkbox
+                v-for="(item ,i) of blackSearched" :key="i" v-model="item.select"
+                @change="onSelectBlackUser($event,item)"
+              >
+                {{ item.label }}
+              </el-checkbox>
+            </div>
+          </div>
         </el-tab-pane>
       </el-tabs>
       <div class="btns">
@@ -159,7 +254,7 @@ export default {
       groupList: [],
       deptList: [],
       roleList: [],
-      userList: [],
+      userChecks: [],
       form: {},
       show: false,
       activeType: 'dept',
@@ -169,41 +264,103 @@ export default {
       typeForm: {},
       showTypeEdit: false,
       nowTypeId: 0,
-      page: { size: 10, current: 1, total: 0 }
+      page: {size: 10, current: 1, total: 0},
+      searchKey: '',
+      deptSearched: [],
+      roleSearched: [],
+      userSearched: [],
+      blackSearched: [],
+      deptFold: false,
+      roleFold: false,
+      userFold: false,
+      blackFold: false,
+      roleListPlat: [],
+      deptListPlat: [],
+      userListPlat: [],
     }
   },
   created() {
     this.getType()
     getDeptTree().then((res) => {
-      this.deptList = res.data.data
-      getList(1, 10000).then((userRes) => {
-        let users = userRes.data.data.records
-        users.forEach((item) => (item.deptId = item.deptId.split(',')[0]))
-        let userListPlat = []
-        this.getPlat(JSON.parse(JSON.stringify(res.data.data)), userListPlat)
-        userListPlat.forEach((i) => (i.parent = userListPlat.find((j) => j.id == i.parentId)))
-        this.userList = userListPlat
-          .map((item) => {
-            let id = item.id
-            let label = item.title
-            let parent = item.parent
-            while (parent) {
-              label = parent.title + ' / ' + label
-              parent = parent.parent
-            }
-            let list = users.filter((i) => i.deptId == id).map((i) => ({ id: i.id, label: i.name }))
-            return { id, label, list, disabled: true }
-          })
-          .filter((i) => i.list.length)
-      })
+      getList(1, 10000).then(userRes => {
+        let users = userRes.data.data.records;
+        this.userListPlat = users.map(i => ({id: i.id, label: i.realName}));
+        users.forEach(item => item.depts = item.deptId.split(','));
+        let userListPlat = [];
+        let userList = res.data.data;
+        this.getPlat(userList, userListPlat);
+        userListPlat.forEach(item => {
+          let id = item.id;
+          item.label = item.title;
+          item.list = users.filter(i => i.depts.includes(id)).map(i => ({id: i.id, label: i.realName, select: false}));
+        });
+        this.deptList = userList;
+        this.deptListPlat = userListPlat.map(i => ({id: i.id, label: i.title}));
+      });
     })
     roleTree().then((res) => {
-      this.roleList = res.data.data
+      let data = res.data.data;
+      let roleListPlat = [];
+      this.getPlat(data, roleListPlat);
+      this.roleList = data;
+      this.roleListPlat = roleListPlat.map(i => ({id: i.id, label: i.title}));
     })
   },
   methods: {
+    onQuickDel(type, item, index) {
+      this.form[type].splice(index, 1)
+      if (type == 'dpList') {
+        this.$refs.dept.setCheckedKeys(this.form.dpList.map(i => i.id));
+        this.deptSearched.forEach(i => i.id == item.id && (i.select = false))
+      } else if (type == 'roleList') {
+        this.$refs.role.setCheckedKeys(this.form.roleList.map(i => i.id));
+        this.roleSearched.forEach(i => i.id == item.id && (i.select = false))
+      } else if (type == 'userList') {
+        this.userChecks.forEach(i => i.id == item.id && (i.select = false))
+        this.onSearch()
+      } else if (type == 'blackUserList') {
+        this.userChecks.forEach(i => i.id == item.id && (i.select = false))
+        this.onSearch()
+      }
+    },
+    // 结果中选择部门或角色时
+    onSelectDeptOrRole(status, item, type) {
+      if (type == 'dept') {
+        if (status) {
+          this.form.dpList.push({id: item.id, name: item.label});
+        } else {
+          let index = this.form.dpList.findIndex(i => i.id == item.id);
+          this.form.dpList.splice(index, 1);
+        }
+      } else if (type == 'role') {
+        if (status) {
+          this.form.roleList.push({id: item.id, name: item.label});
+        } else {
+          let index = this.form.roleList.findIndex(i => i.id == item.id);
+          this.form.roleList.splice(index, 1);
+        }
+      }
+    },
+    // 搜索所有类型数据时
+    onSearch() {
+      let key = this.searchKey;
+      let {dpList, roleList, userList, blackUserList} = this.form;
+      let deptSearched = this.deptListPlat.filter(i => i.label.includes(key));
+      deptSearched.forEach(i => i.select = !!dpList.find(j => j.id == i.id));
+      this.deptSearched = deptSearched;
+      let roleSearched = this.roleListPlat.filter(i => i.label.includes(key));
+      roleSearched.forEach(i => i.select = !!roleList.find(j => j.id == i.id));
+      this.roleSearched = roleSearched;
+      let userSearched = this.userListPlat.filter(i => i.label.includes(key));
+      userSearched.forEach(i => i.select = !!userList.find(j => j.id == i.id));
+      this.userSearched = userSearched;
+      let other = JSON.parse(JSON.stringify(this.userListPlat));
+      let blackSearched = other.filter(i => i.label.includes(key));
+      blackSearched.forEach(i => i.select = !!blackUserList.find(j => j.id == i.id));
+      this.blackSearched = blackSearched;
+    },
     goSetting(group) {
-      this.$router.push('/system/authGroupSetting?id=' + group.id)
+      this.$router.push(`/system/authGroupSetting?id=${group.id}&name=${group.permName}`);
     },
     sizeChange(size) {
       this.page.size = size
@@ -272,23 +429,71 @@ export default {
         })
         .catch(() => {})
     },
-    onUserChange() {
-      this.$nextTick(() => {
-        let nodes = this.$refs.user.getCheckedNodes()
-        this.form.userList = nodes.map((i) => ({ id: i.id, name: i.label }))
-      })
+    // 选择面板时
+    onSelectTab({name}) {
+      if (name == 'user') {
+        let node = this.$refs.user.getCurrentNode();
+        if (node) {
+          this.onUserChange(node);
+        } else {
+          this.userChecks = [];
+        }
+      } else if (name == 'black') {
+        let node = this.$refs.black.getCurrentNode();
+        if (node) {
+          this.onBlackChange(node);
+        } else {
+          this.userChecks = [];
+        }
+      } else if (name == 'search') {
+        this.onSearch();
+      }
+    },
+    // 用户选择用户时
+    onSelectUser(status, item) {
+      if (status) {
+        this.form.userList.push({id: item.id, name: item.label});
+      } else {
+        let index = this.form.userList.findIndex(i => i.id == item.id);
+        this.form.userList.splice(index, 1);
+      }
+    },
+    // 黑名单选择用户时
+    onSelectBlackUser(status, item) {
+      if (status) {
+        this.form.blackUserList.push({id: item.id, name: item.label});
+      } else {
+        let index = this.form.blackUserList.findIndex(i => i.id == item.id);
+        this.form.blackUserList.splice(index, 1);
+      }
     },
+    // 选择用户部门时
+    onUserChange({list}) {
+      list.forEach(i => {
+        i.select = !!this.form.userList.find(j => j.id == i.id);
+      });
+      this.userChecks = list;
+    },
+    // 选择黑名单部门时
+    onBlackChange({list}) {
+      list.forEach(i => {
+        i.select = !!this.form.blackUserList.find(j => j.id == i.id);
+      });
+      this.userChecks = list;
+    },
+    // 选择部门时
     onDeptChange() {
       this.$nextTick(() => {
-        let nodes = this.$refs.dept.getCheckedNodes()
-        this.form.dpList = nodes.map((i) => ({ id: i.id, name: i.title }))
-      })
+        let nodes = this.$refs.dept.getCheckedNodes();
+        this.form.dpList = nodes.map(i => ({id: i.id, name: i.title}));
+      });
     },
+    // 选择角色时
     onRoleChange() {
       this.$nextTick(() => {
-        let nodes = this.$refs.role.getCheckedNodes()
-        this.form.roleList = nodes.map((i) => ({ id: i.id, name: i.title }))
-      })
+        let nodes = this.$refs.role.getCheckedNodes();
+        this.form.roleList = nodes.map(i => ({id: i.id, name: i.title}));
+      });
     },
     getData() {
       let { size, current } = this.page
@@ -299,18 +504,22 @@ export default {
       groupPage(data).then((res) => {
         let { records, total } = res.data.data
         this.page.total = total
-        this.groupList = records.map((i) => {
-          let { dpList, roleList, userList } = JSON.parse(i.permJson)
-          return { ...i, dpList, roleList, userList }
-        })
+        this.groupList = records.map(i => {
+          let {dpList, roleList, userList, blackUserList} = JSON.parse(i.permJson);
+          dpList = dpList || [];
+          roleList = roleList || [];
+          userList = userList || [];
+          blackUserList = blackUserList || [];
+          return {...i, dpList, roleList, userList, blackUserList};
+        });
       })
     },
     onSubmit() {
-      let { permName, dpList, roleList, userList, typeId } = this.form
+      let { permName, dpList, roleList, userList, typeId, blackUserList } = this.form
       if (!permName || !typeId) {
         return this.$message({ type: 'warning', message: '请填写完整' })
       }
-      let data = { permName, typeId, permJson: JSON.stringify({ dpList, roleList, userList }) }
+      let data = { permName, typeId, permJson: JSON.stringify({ dpList, roleList, userList,blackUserList }) }
       if (this.form.id) {
         data.id = this.form.id
       }
@@ -332,13 +541,15 @@ export default {
       if (item) {
         this.form = item
       } else {
-        this.form = { permName: '', dpList: [], roleList: [], userList: [], typeId: 0 }
+        this.form = { permName: '', dpList: [], roleList: [], userList: [], blackUserList: [],
+          typeId: this.nowTypeId || '' }
       }
       this.show = true
       this.$nextTick(() => {
         this.$refs.dept.setCheckedKeys(item ? item.dpList.map((i) => i.id) : [])
         this.$refs.role.setCheckedKeys(item ? item.roleList.map((i) => i.id) : [])
         this.$refs.user.setCheckedKeys(item ? item.userList.map((i) => i.id) : [])
+        this.$refs.black.setCheckedKeys(item ? item.blackUserList.map(i => i.id) : []);
       })
     }
   }
@@ -375,13 +586,21 @@ export default {
     }
   }
   .right-wrapper {
-    padding: 10px 10px 0;
     flex: 1;
-    overflow-y: auto;
+    padding: 10px 10px 0;
+    display: flex;
+    flex-direction: column;
+    .my-menu {
+      flex: 0 0 40px;
+    }
+    .main {
+      flex: 1;
+      overflow-y: auto;
+    }
     .item {
       margin: 10px;
-      border: 1px solid #dcdfe6;
-      transition: all 0.2s;
+      border: 1px solid #DCDFE6;
+      transition: all .2s;
       &:hover {
         border: 1px solid #409eff;
       }
@@ -412,19 +631,46 @@ export default {
         }
       }
     }
+    .my-paging {
+      padding: 10px;
+      flex: 0 0 50px;
+    }
   }
 }
 .auth-group-dialog {
   .selected {
     height: 100px;
     overflow-y: auto;
-    border: 1px solid #dcdfe6;
+    border: 1px solid #DCDFE6;
     padding: 5px;
     .tag {
       display: inline-block;
-      margin: 5px;
+      margin: 5px 10px;
       font-size: 14px;
       line-height: 16px;
+      .el-icon-close {
+        vertical-align: top;
+        font-size: 10px;
+        color: red;
+        cursor: pointer;
+      }
+    }
+  }
+  .el-tab-pane {
+    height: 300px;
+    display: flex;
+    .left, .right {
+      flex: 1;
+      overflow-y: auto;
+      .name {
+        line-height: 30px;
+        font-size: 16px;
+        cursor: pointer;
+      }
+      .el-checkbox {
+        margin: 3px 15px;
+        display: flex;
+      }
     }
   }
   .btns {

+ 17 - 7
src/components/Dataset-filter/dataset-filter.vue

@@ -574,15 +574,18 @@ export default {
       this.onSelectItem({ name: this.nowName })
     },
     onSave() {
-      // 提交中
-      const loading = this.$loading({
-        lock: true,
-        text: '提交中...',
-        spinner: 'el-icon-loading',
-        background: 'rgba(0, 0, 0, 0.7)'
-      })
       if (this.showFalgTemp === 'data') {
         let { cubeDataId, dataPermId, cubePermName, filterList, filterRelation, id, excludeColumn } = this.nowFilter
+        if (!dataPermId) {
+          return this.$message({ type: 'warning', message: '请选择权限组' });
+        }
+        // 提交中
+        const loading = this.$loading({
+          lock: true,
+          text: '提交中...',
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.7)'
+        })
         let data = {
           cubeDataId,
           dataPermId,
@@ -602,6 +605,13 @@ export default {
           this.$message({ type: 'warning', message: '请选择权限组' })
           return false
         }
+        // 提交中
+        const loading = this.$loading({
+          lock: true,
+          text: '提交中...',
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.7)'
+        })
         let aaa = []
         let bbb = []
         this.customSystemBtns.forEach((i) => {

+ 9 - 9
src/components/Generator/components/InputTable/index.vue

@@ -402,15 +402,15 @@ export default {
       }
       this.tableFormData[rowIndex].forEach((i, k) => {
         // 查询默认值是否绑定全局变量 并获取 新增时不需要更新  当前change的组件不需要更新
-        if (i.defaultVarType && i.defaultVarType.length && flag && editVmodel !== i.__vModel__) {
-          //表单内全局变量
-          if (i.defaultVarType[0] === 3) {
-            const sessionValue = sessionStorage.getItem(`FORM_${rowIndex + '_' + i.defaultVarType[1]}`)
-            if (sessionValue) this.$set(i, 'value', sessionValue)
-          }
-          //api返回值变量
-          if (i.defaultVarType[0] === 4) {
-            const sessionValue = sessionStorage.getItem(`API_${rowIndex + '_' + i.defaultVarType[1]}`)
+        if (i.defaultVarType && i.defaultVarType.length && editVmodel !== i.__vModel__) {
+          const getSessionValue = (prefix) => {
+            return flag ? sessionStorage.getItem(`${prefix}_${i.defaultVarType[1]}`) ||
+              sessionStorage.getItem(`${prefix}_${rowIndex}_${i.defaultVarType[1]}`) : sessionStorage.getItem(`${prefix}_${i.defaultVarType[1]}`);
+          };
+          //表单内全局变量  //api返回值变量
+          if (i.defaultVarType[0] === 3 || i.defaultVarType[0] === 4) {
+            const prefix = i.defaultVarType[0] === 3 ? 'FORM' : 'API';
+            const sessionValue = getSessionValue(prefix);
             if (sessionValue) this.$set(i, 'value', sessionValue)
           }
         }

+ 1 - 0
src/components/Generator/components/Upload/UploadImg.vue

@@ -47,6 +47,7 @@
       :disabled="disabled"
       list-type="picture-card"
       :limit="limit"
+      :file-list="fileList"
       class="upload-btn"
     >
       <i class="el-icon-plus"></i>

+ 12 - 1
src/components/Generator/index/Home.vue

@@ -377,6 +377,14 @@ export default {
               reject({ msg: `请选择${config.label}的控件字段`, target: 1 })
               break
             }
+            if (config.jnpfKey === 'table') {
+              if (!e.__vModel__) {
+                this.activeData = e
+                this.activeId = e.__config__.formId
+                reject({ msg: `请选择${config.label}的控件字段`, target: 1 })
+                break
+              }
+            }
             if (config.jnpfKey === 'billRule') {
               if (!config.rule) {
                 reject({ msg: '单据组件“选择模板”属性为必填项', target: 1 })
@@ -624,8 +632,11 @@ export default {
       } else if (config.layout === 'rowFormItem') {
         if (config.jnpfKey === 'table') {
           // config.tableName = this.dbLinkId
-          item.__vModel__ = `${config.jnpfKey}Field${this.idGlobal}`
+          // item.__vModel__ = `${config.jnpfKey}Field${this.idGlobal}`
+          item.__vModel__ = ''
           item.__vModelName__ = ''
+          item.__config__.tableName = ''
+          item.relationConf.foreignModel = ''
         }
         config.componentName = `row${this.idGlobal}`
         !Array.isArray(config.children) && (config.children = [])

+ 14 - 3
src/views/basic/dynamicModel/list/Form.vue

@@ -454,10 +454,21 @@ export default {
                 item.__config__.defaultValue = val ? moment(val).valueOf() : null
               }
               if (item.__config__ && item.__config__.jnpfKey === 'checkbox') {
-                try {
-                  let value = val ? JSON.parse(val) : []
+                // 检查值是否已经是JSON字符串形式的数组
+                if (typeof val === 'string' && val.startsWith('["') && val.endsWith(']')) {
+                  try {
+                    let value = val ? JSON.parse(val) : []
+                    item.__config__.defaultValue = value && Array.isArray(value) ? value :  []
+                  } catch (error) {
+                    }
+                } else if (typeof val === 'string') {
+                  // 如果值是字符串,使用逗号分隔符将其分割成数组
+                  let value = val ? val.split(';') : []
                   item.__config__.defaultValue = value && Array.isArray(value) ? value :  []
-                } catch {}
+                } else {
+                  // 如果值既不是JSON字符串也不是普通字符串,或者已经是数组,直接返回
+                  item.__config__.defaultValue = val || [];
+                }
               }
               if (item.__config__ && item.__config__.jnpfKey === 'cascader') {
                 try {

+ 22 - 8
src/views/basic/dynamicModel/list/index.vue

@@ -2553,6 +2553,7 @@ export default {
             }
             if (compoentConfig.tag === 'el-select') {
               if (compoentConfig.dataType === 'dictionary') {
+                if (!compoentConfig.dictionaryType) return;
                 await dictDetail({ id: compoentConfig.dictionaryType }).then((res) => {
                   // this.activeData.__slot__.options = res.data.data.list
                   let content = JSON.parse(res.data.data.content || '[]')
@@ -2750,15 +2751,28 @@ export default {
               }
               if (column.params.jnpfKey === 'checkbox') {
                 if (['static', 'dictionary'].includes(data.params.dataType)) {
-                  try {
-                    // 转成数组
-                    cellValue = JSON.parse(cellValue)
-                    cellValue = cellValue.map((v) => {
+                  // 检查值是否已经是JSON字符串形式的数组
+                  if (typeof cellValue === 'string' && cellValue.startsWith('["') && cellValue.endsWith(']')) {
+                    try {
+                      // 转成数组
+                      cellValue = JSON.parse(cellValue)
+                      cellValue = cellValue.map((v) => {
+                        const find = column.params.compoentConfig.options.find((o) => o.id == v)
+                        return find && find.fullName ? find.fullName : v
+                      })
+                      cellValue = cellValue.toString()
+                    } catch (e) {
+                      return cellValue
+                    }
+                  } else if (typeof cellValue === 'string') {
+                    // 如果值是字符串,使用逗号分隔符将其分割成数组
+                    let value = cellValue ? cellValue.split(';') : []
+                    cellValue = value.map((v) => {
                       const find = column.params.compoentConfig.options.find((o) => o.id == v)
-                      return find && find.fullName ? find.fullName : cellValue
+                      return find && find.fullName ? find.fullName : v
                     })
                     cellValue = cellValue.toString()
-                  } catch (e) {
+                  }else {
                     return cellValue
                   }
                   // const find = column.params.compoentConfig.options.find((v) => v.id == cellValue)
@@ -2845,7 +2859,7 @@ export default {
           }
         }
 
-        if (!columnList.find((i) => i.title === '操作')) {
+        if (!columnList.find((i) => i?.title === '操作')) {
           if (this.columnData.type != 5) {
             columnList.push({
               title: '操作',
@@ -2879,7 +2893,7 @@ export default {
         if (!this.columnData.columnBtnsList.length) {
           columnList = columnList.filter((i) => i.title !== '操作')
         }
-        this.columnList = columnList.filter((i) => i.title)
+        this.columnList = columnList.filter((i) => i?.title)
         this.listLoading = false
         this.getDataList(res.data.data.pageData.records, processData)
         if (this.columnData.type == 5 && res.data.data.pageData.records.length > 0) {

+ 14 - 4
src/views/form/webDesign/CustomEvent.vue

@@ -20,6 +20,8 @@
             <el-radio v-model="eventTypeRadio" :label="0">SQL模式</el-radio>
             <el-radio v-model="eventTypeRadio" :label="1">代码模式</el-radio>
             <el-radio v-model="eventTypeRadio" :label="2">jar包模式</el-radio>
+            <el-radio v-model="eventTypeRadio" :label="3">API模式</el-radio>
+            <el-radio v-model="eventTypeRadio" :label="4">表单赋值模式</el-radio>
           </el-form-item>
         </el-form>
       <span slot="footer" class="dialog-footer">
@@ -29,6 +31,7 @@
     </el-dialog>
     <customEventExpression ref="customEventExpression" :dbLinkId="cubeId" :modelId="modeId" :dbSourceId="sourceId" @onChangeExp="eventChange" />
     <customCodeMode ref="customCodeMode" :dbLinkId="cubeId" :modelId="modeId" :dbSourceId="sourceId" :eventTypeRadio="eventTypeRadio" @onChangeExp="eventChange"  />
+    <customApiEvent ref="customApiEvent" :dbLinkId="cubeId" :modelId="modeId" :dbSourceId="sourceId" @onChangeExp="eventChange"  />
     <div>
       <el-table ref="multipleTable" :data="eventList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" v-if="isCompont"></el-table-column>
@@ -37,7 +40,9 @@
           <template slot-scope="scope">
             <span class="eventType" v-if="scope.row.eventType === 0">SQL模式</span>
             <span class="eventType" v-else-if="scope.row.eventType === 1">代码模式</span>
-            <span class="eventType" v-else>jar包模式</span>
+            <span class="eventType" v-else-if="scope.row.eventType === 2">jar包模式</span>
+            <span class="eventType" v-else-if="scope.row.eventType === 3">API模式</span>
+            <span class="eventType" v-else>表单赋值模式</span>
           </template>
         </el-table-column>
         <el-table-column prop="executeTiming" label="事件执行时机">
@@ -93,10 +98,11 @@
 <script>
 import { addCustomEvent, customEventList, deleteCustomEvent, getEventLog } from '@/api/onlineDev/visualDev'
 import customEventExpression from './customEventExpression.vue'
+import customApiEvent from "./customApiEvent.vue";
 import customCodeMode from './customCodeMode.vue'
 export default {
   props: ['cubeId', 'modelId', 'dbSourceId', 'isCompont', 'multipleSelection', 'activeName', 'isEvent'],
-  components: { customEventExpression,customCodeMode },
+  components: { customEventExpression,customCodeMode,customApiEvent },
   data() {
     return {
       isShow: false,
@@ -176,8 +182,10 @@ export default {
     onEditChange(row) {
       if(row.eventType === 1 || row.eventType === 2){
         this.$refs.customCodeMode.addFuncClick(row)
-      }else {
+      }else if(row.eventType === 0) {
         this.$refs.customEventExpression.addFuncClick(row)
+      }else if(row.eventType === 3) {
+        this.$refs.customApiEvent.addFuncClick(row)
       }
     },
     onEventLogClick(row) {
@@ -219,8 +227,10 @@ export default {
     addFuncClickonSubmit(){
       if(this.eventTypeRadio === 1 || this.eventTypeRadio === 2){
         this.$refs.customCodeMode.addFuncClick()
-      }else {
+      }else if(this.eventTypeRadio === 0) {
         this.$refs.customEventExpression.addFuncClick()
+      }else if(this.eventTypeRadio === 3) {
+        this.$refs.customApiEvent.addFuncClick()
       }
       this.eventTypeVisible = false
     },

+ 352 - 0
src/views/form/webDesign/customApiEvent.vue

@@ -0,0 +1,352 @@
+<template>
+<div>
+  <el-dialog
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    :title="'新增API模式自定义事件'"
+    :visible.sync="showEditComputedField"
+    append-to-body
+    class="dataset-edit-computed-fields"
+    width="700px"
+  >
+    <div>事件名称:<el-input style="width:300px" v-model="eventName" placeholder="请输入事件名称"></el-input></div>
+    <el-tabs v-model="activeName">
+      <el-tab-pane label="请求设置" name="post">
+        <el-form :model="addForm" label-position="left" label-width="100px" ref="addForm" :rules="rules" >
+          <el-form-item label="请求路径" prop="url">
+            <el-input v-model="addForm.url" placeholder="请输入请求路径"></el-input>
+          </el-form-item>
+          <el-form-item label="请求方式" prop="method">
+            <el-radio-group v-model="addForm.method">
+              <el-radio label="GET"></el-radio>
+              <el-radio label="POST"></el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-tabs v-model="formActiveName">
+            <el-tab-pane label="headers" name="headers">
+              <el-button size="mini" type="success" plain icon="el-icon-plus" @click="addForm.headers.push({name:'',value:''})" style="margin-bottom:10px">添加header</el-button>
+              <el-table size="mini" :data="addForm.headers"  border  style="width: 100%">
+                <el-table-column width="50" align="center">
+                  <template slot-scope="scope">
+                    <i class="el-icon-delete" style="font-size:20px" @click="addForm.headers.splice(scope.$index,1)"></i>
+                  </template>
+                </el-table-column>
+                <el-table-column label="参数名称" width="180"  align="center">
+                  <template slot-scope="scope">
+                    <el-input v-model="scope.row.name" placeholder="参数名称"></el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column label="参数值"  align="center">
+                  <template slot-scope="scope">
+                    <el-popover :ref="`jarParamSelector-headers}`" key="headers" placement="bottom-start" trigger="click">
+                      <div style="display: flex">
+                        <div style="margin-right: 10px;max-height: 300px;overflow-y: auto">
+                          <p>引用字段</p>
+                          <template v-for="field of tobeChooseWeidu">
+                            <div :key="field.columnTitle" :title="field.columnName" class="weidu" @click="setJarValueFun(scope.row,`[${field.columnName}]`)">
+                              {{ field.columnTitle + '【' + field.columnName + '】' }}
+                            </div>
+                          </template>
+                          <template v-for="field of tobeChooseZhibiao">
+                            <div :key="field.columnTitle" :title="field.columnName" class="zhibiao" @click="setJarValueFun(scope.row,`[${field.columnName}]`)">
+                              {{ field.columnTitle + '【' + field.columnName + '】' }}
+                            </div>
+                          </template>
+                        </div>
+                        <el-cascader-panel v-model="nowParam" :options="paramList" :props="{ expandTrigger: 'click', emitPath: false, value: 'paramKey' }" @change="setJarValueFun(scope.row,`\${${$event}}`)"></el-cascader-panel>
+                      </div>
+                      <el-button slot="reference" size="mini" type="success" plain>插入变量</el-button>
+                    </el-popover>
+                    <el-input v-model="scope.row.value" placeholder="参数值" style="width:300px;margin-left:10px;"></el-input>
+
+                  </template>
+                </el-table-column>
+              </el-table>
+            </el-tab-pane>
+            <el-tab-pane label="params" name="params">
+              <el-button size="mini" type="success" plain icon="el-icon-plus" @click="addForm.params.push({name:'',value:''})" style="margin-bottom:10px">添加header</el-button>
+              <el-table size="mini" :data="addForm.params"  border  style="width: 100%">
+                <el-table-column width="50" align="center">
+                  <template slot-scope="scope">
+                    <i class="el-icon-delete" style="font-size:20px" @click="addForm.params.splice(scope.$index,1)"></i>
+                  </template>
+                </el-table-column>
+                <el-table-column label="参数名称" width="180"  align="center">
+                  <template slot-scope="scope">
+                    <el-input v-model="scope.row.name" placeholder="参数名称"></el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column label="参数值"  align="center">
+                  <template slot-scope="scope">
+                    <el-popover :ref="`jarParamSelector-params}`" key="params" placement="bottom-start" trigger="click">
+                      <div style="display: flex">
+                        <div style="margin-right: 10px;max-height: 300px;overflow-y: auto">
+                          <p>引用字段</p>
+                          <template v-for="field of tobeChooseWeidu">
+                            <div :key="field.columnTitle" :title="field.columnName" class="weidu" @click="setJarValueFun(scope.row,`[${field.columnName}]`)">
+                              {{ field.columnTitle + '【' + field.columnName + '】' }}
+                            </div>
+                          </template>
+                          <template v-for="field of tobeChooseZhibiao">
+                            <div :key="field.columnTitle" :title="field.columnName" class="zhibiao" @click="setJarValueFun(scope.row,`[${field.columnName}]`)">
+                              {{ field.columnTitle + '【' + field.columnName + '】' }}
+                            </div>
+                          </template>
+                        </div>
+                        <el-cascader-panel v-model="nowParam" :options="paramList" :props="{ expandTrigger: 'click', emitPath: false, value: 'paramKey' }" @change="setJarValueFun(scope.row,`\${${$event}}`)"></el-cascader-panel>
+                      </div>
+                      <el-button slot="reference" size="mini" type="success" plain>插入变量</el-button>
+                    </el-popover>
+                    <el-input v-model="scope.row.value" placeholder="参数值" style="width:300px;margin-left:10px;"></el-input>
+
+                  </template>
+                </el-table-column>
+              </el-table>
+            </el-tab-pane>
+            <el-tab-pane label="body" name="body" v-if="addForm.method === 'POST' ">
+              <el-input type="textarea" :rows="6" placeholder="请输入body内容" v-model="addForm.body">
+              </el-input>
+            </el-tab-pane>
+          </el-tabs>
+        </el-form>
+      </el-tab-pane>
+      <el-tab-pane label="响应设置" name="req">
+        <el-button size="mini" type="success" plain icon="el-icon-plus" @click="addForm.fields.push({name:'',type:'STRING',jsonpath:''})">添加响应字段</el-button>
+        <el-button size="mini"  plain icon="el-icon-refresh-left" @click="getReqData">响应数据结构预览</el-button>
+        <el-button size="mini" type="text" icon="el-icon-paperclip" @click="openJson">jsonpath使用说明</el-button>
+        <el-table size="mini" :data="addForm.fields"  border  style="width: 100%;margin:10px 0;">
+          <el-table-column width="50" align="center">
+            <template slot-scope="scope">
+              <i class="el-icon-delete" style="font-size:20px" @click="addForm.fields.splice(scope.$index,1)"></i>
+            </template>
+          </el-table-column>
+          <el-table-column label="字段" width="180"  align="center">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.name" placeholder="字段名称"></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column label="字段类型" width="180"  align="center">
+            <template slot-scope="scope">
+              <el-select v-model="scope.row.type" placeholder="请选择字段类型">
+                <el-option label="字符串" value="STRING"></el-option>
+                <el-option label="整数" value="INT"></el-option>
+                <el-option label="长整数" value="BIGINT"></el-option>
+                <el-option label="浮点数" value="DOUBLE"></el-option>
+                <el-option label="精确浮点数" value="FLOAT"></el-option>
+                <el-option label="日期" value="DATE"></el-option>
+                <el-option label="时间" value="TIME"></el-option>
+                <el-option label="日期时间" value="TIMESTAMP"></el-option>
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column label="json路径"  align="center">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.jsonpath" placeholder="json路径"></el-input>
+            </template>
+          </el-table-column>
+        </el-table>
+        <p style="margin-bottom:10px;">响应数据预览</p>
+        <JSONEditor v-model="template" class="json-editor" />
+      </el-tab-pane>
+    </el-tabs>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="showEditComputedField = false">取 消</el-button>
+      <el-button type="primary" @click="codeModeSubmit">确 定</el-button>
+    </span>
+  </el-dialog>
+
+</div>
+</template>
+<script>
+import {cubeFieldList} from "@/api/newbi/dataset";
+import {categoryList, paramList} from "@/api/newbi/globalParams";
+import JSONEditor from "@/components/JsonEditor/index.vue";
+import {addCustomEvent,apiExecute} from "@/api/onlineDev/visualDev";
+export default {
+  name: "customApiEvent",
+  components: {JSONEditor},
+  props: ['modelId','dbLinkId','dbSourceId'],
+  data(){
+    return {
+      id:'',
+      eventName:'',
+      executeTiming: 2,
+      datasourceId:'',
+      eventType: 3,
+      eventStatus: 0,
+      activeName: 'post',
+      formActiveName: 'headers',
+      showEditComputedField: false,
+      addForm:{
+        url:'',
+        method:'GET',
+        params:[{name:'',value:''}],
+        headers:[{name:'',value:''}],
+        body:'',
+        fields:[{name:'',type:'STRING',jsonpath:''}],
+      },
+      tobeChooseWeidu: [], // 计算字段编辑框里维度字段
+      tobeChooseZhibiao: [], // 计算字段编辑框里指标字段
+      nowParam:[],
+      paramList: [],
+      template:'',
+      rules: {
+        url: [
+          { required: true, message: '请输入请求路径', trigger: 'blur' },
+        ],
+        method: [
+          { required: true, message: '请选择请求方式', trigger: 'change' }
+        ],
+      }
+    }
+  },
+  created(){
+
+  },
+  methods:{
+    addFuncClick(row){
+      this.showEditComputedField = true
+      this.$nextTick(() => {
+        if (row && row.id) {
+          this.eventName = row.eventName
+          this.executeTiming = row.executeTiming
+          this.eventType = row.eventType
+          this.eventStatus = row.eventStatus
+          this.datasourceId = row.eventDatasourceId
+          this.id = row.id
+          this.addForm = JSON.parse(row.eventSql)
+        } else {
+          this.eventName = ''
+          this.executeTiming = 2
+          this.eventType = 3
+          this.eventStatus = 0
+          this.id = ''
+          this.datasourceId = this.dbSourceId
+          this.addForm = {
+            url:'',
+            method:'GET',
+            params:[{name:'',value:''}],
+            headers:[{name:'',value:''}],
+            body:'',
+            fields:[{name:'',type:'STRING',jsonpath:''}],
+          }
+        }
+      })
+      this.getGlobalData()
+    },
+    // 获取系统变量
+    getGlobalData() {
+      //获取数据集
+      cubeFieldList({cubeDataId: this.dbLinkId}).then((res) => {
+        let tableFieldsWeidu = res.data.data.filter((i) => i.dimensionType === 'WEIDU').sort((a, b) => a.sortNum - b.sortNum)
+        let tableFieldsZhibiao = res.data.data.filter((i) => i.dimensionType === 'ZHIBIAO').sort((a, b) => a.sortNum - b.sortNum)
+        this.tobeChooseWeidu = tableFieldsWeidu.filter((i) => i.columnAttr == 'NORMAL')
+        this.tobeChooseZhibiao = tableFieldsZhibiao.filter((i) => i.columnAttr == 'NORMAL')
+      })
+      categoryList({ size: 10000, current: 1 }).then((res) => {
+        let list = res.data.data.records
+        let parents = list.filter((i) => !i.parentId)
+        let categoryList = []
+        list.forEach((i) => {
+          i.children = []
+          if (i.parentId) {
+            let parent = parents.find((j) => j.id == i.parentId)
+            parent.hasChild = true
+            i.label = parent.typeName + ' / ' + i.typeName
+            categoryList.push(i)
+          } else {
+            i.label = i.typeName
+          }
+        })
+        categoryList = categoryList.concat(parents.filter((i) => !i.hasChild))
+        paramList({ size: 10000, current: 1 }).then((res) => {
+          let params = res.data.data.records
+          params.forEach((i) => {
+            i.label = i.paramName
+            let parent = categoryList.find((j) => j.id == i.typeId)
+            parent.children.push(i)
+          })
+          this.paramList = categoryList
+        })
+      })
+    },
+    setJarValueFun(value,field){
+      value.value = field;
+      document.body.click()
+    },
+    getReqData(){
+      let data = {
+        url:this.addForm.url,
+        method:this.addForm.method,
+        body:this.addForm.body,
+        params:this.addForm.params.reduce((obj, header) => {
+          obj[header.name] = header.value;
+          return obj;
+        }, {}),
+        headers:this.addForm.headers.reduce((obj, header) => {
+          obj[header.name] = header.value;
+          return obj;
+        }, {})
+      }
+      apiExecute(data).then((res)=>{
+        this.template = res.data
+      })
+      // this.template = {
+      //   "url": "http://open.wdgj.com/OpenApiDoc/APITest?apigroup=84",
+      //   "method": "POST",
+      //   "params":[{
+      //     "name":"",
+      //     "value":""
+      //   }],
+      //   "headers": [{
+      //     "name":"",
+      //     "value":""
+      //   }],
+      //   "body": "",
+      //   "fields": [
+      //     {
+      //       "name": "",
+      //       "type": "STRING",
+      //       "jsonpath": "",
+      //
+      //     }
+      //   ]
+      // }
+    },
+    codeModeSubmit(){
+      let params = {
+        id: this.id,
+        eventName: this.eventName,
+        executeTiming: this.executeTiming,
+        eventDatasourceId: this.dbSourceId,
+        eventType: this.eventType,
+        eventStatus: this.eventStatus,
+        eventSql:  JSON.stringify(this.addForm),
+      }
+      addCustomEvent(this.modelId, params).then((res) => {
+        this.$message({
+          message: res.data.msg,
+          type: 'success',
+          duration: 1500,
+          onClose: () => {
+            this.$emit('onChangeExp')
+            this.showEditComputedField = false
+          }
+        })
+      })
+    },
+    openJson(){
+      window.open('https://jsonpath.com/','_blank')
+    }
+  }
+}
+</script>
+
+
+
+<style scoped lang="scss">
+.json-editor {
+  height: 300px;
+  position: relative;
+}
+</style>

+ 2 - 1
src/views/form/webDesign/customCodeMode.vue

@@ -210,7 +210,7 @@ export default {
     }
   },
   created() {
-    this.getGlobalData()
+
   },
   methods: {
     setJarValueFun(value,field){
@@ -293,6 +293,7 @@ export default {
           if (this.addForm.eventType === 1) this.$refs.editor.editor.setValue('')
         }
       })
+      this.getGlobalData()
     },
     beforeUpload(file) {
       const unitNum = 1024 * 1024 * 500

+ 5 - 6
src/views/form/webDesign/customEventExpression.vue

@@ -104,7 +104,7 @@
       <div class="btns">
         <el-button size="mini" @click="showEditComputedField = false"> 取消</el-button>
         <el-button size="mini" type="primary" @click="onEditComputedFieldConfirm"> 确定</el-button>
-        <!--        <el-button size="mini" type="success" @click="parserSqlClick">语法检查</el-button>-->
+        <el-button size="mini" type="success" @click="parserSqlClick">语法检查</el-button>
       </div>
     </el-dialog>
   </div>
@@ -160,11 +160,6 @@ export default {
     }
   },
   created() {
-    this.fillback(this.dbLinkId)
-    this.getInitData()
-    this.datasourceId = this.dbSourceId
-    this.onDataSourceId(this.dbSourceId)
-    this.getGlobalData()
   },
   computed: {
     // 计算字段编辑框里维度字段
@@ -236,7 +231,11 @@ export default {
           this.$refs.editor.editor.setValue('')
         }
       })
+      this.fillback(this.dbLinkId)
       this.getInitData()
+      this.datasourceId = this.dbSourceId
+      this.onDataSourceId(this.dbSourceId)
+      this.getGlobalData()
     },
     // 获取初始化数据,
     getInitData() {