Selaa lähdekoodia

服务管理修改

zhaoke 1 vuosi sitten
vanhempi
commit
8c39138b8e

+ 223 - 302
src/views/dataAccessPage/components/accessPageNode copy.vue

@@ -1,273 +1,155 @@
+
 <template>
-  <div class="accessPageNode">
-    <div style="height: 100%;" class="accessPageNode-items">
-      <nodeBtn v-for="(item,index) in nodeItems" :nodeIndex="index" :nodeItem="item" :nodeTxt="item.algorithmname" :isLine="item.isLine" :isDel="item.isDel" :key="index" @handleAdd="handleAdd" @handleDel="handleDel" @handleEdit="handleEdit" />
+  <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" class="publicPageTree">
+    <div class="publicPageTree_add">
+      <PublicPageHeader class="publicPageTree_add_title" page-title="服务列表">
+        <el-button size="small" @click="append" type="primary">新增</el-button>
+      </PublicPageHeader>
+    </div>
+    <div class="publicPageTree_search">
+      <el-input size="small" placeholder="输入关键字进行过滤" clearable v-model="filterText"></el-input>
+    </div>
+    <div class="publicPageTree_tree">
+      <el-scrollbar style="height: 100%" :horizontal="false">
+        <el-tree class="filter-tree" :expand-on-click-node="false" :data="data" :props="defaultProps" node-key="serviceid" :default-expanded-keys="defaultKeys" :filter-node-method="filterNode" ref="tree" @node-click="treeNodeClick">
+          <span class="custom-tree-node" slot-scope="{node,data}">
+            <span class="custom-tree-node-label flex-wrap">
+              <el-tooltip class="item" effect="dark" :content="node.label" placement="right">
+                <span class="flower">{{node.label}}</span>
+              </el-tooltip>
+              <span class="custom-tree-node-label-id">({{ data.serviceid }})</span>
+            </span>
+            <span class="custom-tree-node-btn">
+              <el-button size="mini" type="text" @click.stop="() => edit(data)">编辑</el-button>
+              <el-button size="mini" class="del" type="text" @click.stop="() => remove(node, data)">删除</el-button>
+            </span>
+          </span>
+        </el-tree>
+      </el-scrollbar>
+    </div>
+    <div class="publicPageTree_dialog">
+      <PublicPageDialog :dialog-loading="dialogLoading" :dialog-title="tableTitle" dialogSize="630px" :dialog-drawer="flag" @handleClose="submitClickClose('ruleForm')" @handleSubmit="submitClickHandler">
+        <PublicPageForm ref="ruleForm" :label-width="labelWidth" :form-item="formItem" :form-data="tableForm" />
+      </PublicPageDialog>
     </div>
-    <PublicPageDialog class="advancedNode" :dialog-title="dialogTitle" dialogSize="600px" :dialog-drawer="advancedDrawer" @handleClose="advancedClose" @handleSubmit="advancedTable">
-      <div v-if="!tabFlag" class="nodeForm">
-        <el-form :inline="true" :model="formInline" class="nodeForm-inline">
-          <el-form-item label="分类">
-            <el-select size="small" v-model="formInline.algorithmtype" @change="changeSelect('algorithmtype',formInline.algorithmtype)" clearable placeholder="全部分类">
-              <el-option v-for="(item,index) in selectType" :key="index" :label="item.name" :value="item.code"></el-option>
-            </el-select>
-          </el-form-item>
-        </el-form>
-        <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" style="margin-top: 20px">
-          <template v-if="selectAlgorithm.length">
-            <el-radio-group style="width: 100%;" v-model="radio3" size="small">
-              <el-row :gutter="20">
-                <el-col style="margin-bottom: 20px;" v-for="(item,index) in selectAlgorithm" :key="index" :span="8">
-                  <el-radio :label="item.id" border>{{ item.name }}</el-radio>
-                </el-col>
-              </el-row>
-            </el-radio-group>
-          </template>
-          <template v-else>
-            <el-empty description="暂无数据"></el-empty>
-          </template>
-        </div>
-      </div>
-      <div v-else class="nodeItemForm">
-        <el-form ref="ruleForm" :model="tableForm" label-width="100px">
-          <el-row :gutter="20">
-            <el-col :span="24">
-              <el-form-item prop="algorithmname" label="算法名称">
-                <el-input size="small" v-model="tableForm.algorithmname" placeholder="请输入" />
-              </el-form-item>
-            </el-col>
-            <el-col v-if="formatData(formInline.algorithmtype) == 'java' || formatData(formInline.algorithmtype) == 'db' || formatData(formInline.algorithmtype) == 'kafka'" :span="24">
-              <el-form-item prop="datasourceid" label="数据源">
-                <el-select size="small" v-model="tableForm.datasourceid" @change="changeSelectSocure('datasourceid')" placeholder="请选择">
-                  <el-option v-for="(item,index) in selectSource" :key="index" :label="item.datasourcedescribe" :value="item.datasourceid"></el-option>
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col v-if="formatData(formInline.algorithmtype) != 'js'" :span="24">
-              <el-form-item prop="targetsource" label="数据源目标">
-                <el-input size="small" v-model="tableForm.targetsource"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="24">
-              <el-form-item prop="executionorder" label="执行排序">
-                <el-input size="small" v-model="tableForm.executionorder"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="24">
-              <el-form-item prop="algorithmdescription" label="算法说明">
-                <el-input size="small" v-model="tableForm.algorithmdescription"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="24">
-              <el-form-item prop="computingexpression" label="计算表达式">
-                <el-input size="small" type="textarea" v-model="tableForm.computingexpression"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="24">
-              <el-form-item prop="preconditions" label="执行条件">
-                <el-input size="small" type="textarea" v-model="tableForm.preconditions"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="24">
-              <el-form-item prop="preparameterset" label="前置条件参数">
-                <el-input size="small" type="textarea" v-model="tableForm.preparameterset"></el-input>
-              </el-form-item>
-            </el-col>
-          </el-row>
-        </el-form>
-        <el-table :data="tableData" border style="width: 100%">
-          <el-table-column v-for="col in tableCols" :key="col.pagecode" :prop="col.pagecode" :label="col.pagename" :width="col.displaywidth+'px'">
-            <template slot-scope="scope">
-              <el-input size="small" v-model="scope.row[col.pagecode]" placeholder="请输入参数名" />
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
-    </PublicPageDialog>
   </div>
 </template>
 
 <script>
+import PublicPageHeader from '@/components/PublicPageHeader'
 import PublicPageDialog from '@/components/PublicPageDialog'
-import nodeBtn from './accessPageNodeBtn.vue'
+import PublicPageForm from '@/components/publicPageForm'
+import { listToTree } from '@/utils/validate'
+import { mapGetters } from 'vuex'
+import { formatChange } from '@/utils/validate'
 import { Query, newData, modifyData, moveData } from "@/api/webApi"
-import { formatChange, getTableCols } from '@/utils/validate'
+
 export default {
-  name: 'AccessPageNode',
-  components: { nodeBtn, PublicPageDialog },
-  props: {
-    msgContent: {
-      type: Object,
-      default: () => new Object()
-    }
-  },
+  name: 'PublicPageTree',
+  components: { PublicPageDialog, PublicPageForm, PublicPageHeader },
   data () {
     return {
       loading: false,
-      tabFlag: false,
-      nodeItems: [
-        {
-          algorithmname: '开始',
-          isLine: true,
-          isDel: false
-        }
-      ],
-      formInline: {
-        algorithmtype: '',
+      dialogLoading: false,
+      filterText: '',
+      data: [],
+      defaultProps: {
+        children: 'children',
+        label: 'servicename'
       },
-      tableForm: {
-        serviceid: '',
-        preconditions: '',
-        algorithmtype: '',
-        algorithmname: '',
-        algorithmsourcelibraryid: '',
-        executionorder: '',
-        targetsource: '',
-        datasourceid: '',
-        computingexpression: '',
-        algorithmdescription: '',
-        preparameterset: ''
-      },
-      nodeIndex: '',
-      tableCols: [],
-      selectType: [],
-      selectAlgorithm: [],
-      selectSource: [],
-      radio3: '',
-      dialogTitle: '添加步骤',
-      advancedDrawer: false,
-      tableDrawer: false,
-      tableData: [],
-      pageServiceId: 15,
-      pageTableId: 24,
-      type: 'add'
+      pageServiceId: '',
+      tableKey: null,//表格主键
+      defaultKeys: [],
+      formItem: [], //弹框表单渲染数据
+      flag: false, //弹框表单开关
+      tableType: "add", //弹框表单弹框类型
+      tableTitle: "新增", //弹框表单标题
+      tableForm: {}, //弹框表单数据
+      rmFlag: false, //删除弹框开关
+      rmTitle: '', //删除弹框标题
+      tableObj: {}, //删除数据
+      tableOptions: {}, //表单数据下拉
+      labelWidth: '120px', //表单文字距离
+      passparameters: {}
     }
   },
   watch: {
-    radio3: {
-      handler (val) {
-        if (val) {
-          this.tabFlag = true
-          // this.getSelectData('datatable', 20, { superiorid: val })
-        }
-      },
-      deep: true
-    },
-    msgContent: {
-      handler (row) {
-        this.setTableData(row)
-      },
-      deep: true,
-      immediate: true
+    filterText (val) {
+      this.$refs.tree.filter(val);
     },
   },
+  computed: {
+    ...mapGetters(['authArrs']),
+  },
   mounted () {
-    this.tableCols = getTableCols(233)
-    this.getSelectData('algorithmtype', 20, { type: 'category' })
+    //获取页面配置
+    const { auth_id } = this.$route.meta
+    //获取页面权限类型组件  pagetype 1模块  2页面  3按钮 4表格 5树形  6弹窗
+    const pageAuths = this.authArrs
+    if (!pageAuths.length) return
+    //获取当前页面权限类型
+    const pageAuthArrs = pageAuths.filter(item => item['superiorid'] == auth_id)
+    if (!pageAuthArrs.length) return
+    //获取tree权限
+    const pageAuthtrees = pageAuthArrs.filter(item => item.pagetype == 'tree')
+    if (!pageAuthtrees.length) return
+    //获取form权限
+    const pageAuthfroms = pageAuthArrs.filter(item => item.pagetype == 'form')
+    if (!pageAuthfroms.length) return
+
+    const { pageconfigurationid } = pageAuthfroms[0]
+    const { pagename, serviceid, defaultfilter } = pageAuthtrees[0]
+    const tableColumnArrs = pageAuths.filter(item => item['superiorid'] == pageconfigurationid && item['pagetype'] == 'column')
+    this.formItem = tableColumnArrs.filter(item => item.isdisplay != 0)
+    this.pageServiceId = serviceid
+    this.passparameters = defaultfilter
+    this.getColumnData(tableColumnArrs)
+    this.queryTreeData(serviceid, pagename)
   },
   methods: {
-    async getSelectData (pagecode, serviceid, datacontent) {
-      this.loading = true
-      try {
-        datacontent = { filter: datacontent }
-        const { code, returnData } = await Query({ serviceid: serviceid, datacontent, event: '0', page: 1, size: 9999 })
-        if (code && returnData?.length) {
-          this.setFormSelectData(pagecode, returnData)
-        }
-      } catch (error) {
-        this.$message.error(error)
-      }
-      this.loading = false
+    filterNode (value, data) {
+      if (!value) return true;
+      return data.servicename.indexOf(value) !== -1;
     },
-    //设置数据
-    setTableData (row) {
-      if (row && Object.keys(row).length) {
-        const { passparameters } = row
-        const filterItem = this.formatDefault(passparameters, row)
-        if (!Object.keys(filterItem).length) return
-        this.nodeItems = this.nodeItems.splice(0, 1)
-        this.getSelectData('nodedata', 15, filterItem)
-      }
-    },
-    //格式化传递参数数据
-    formatDefault (item, data = {}) {
-      if (typeof item != 'string') return {}
-      const filterItem = {}
-      const parameters = item.replace('{', '').replace('}', '')
-      const parametersSplit = parameters?.split(',')
-      parametersSplit.map(item => {
-        const [key, val] = item?.split(':')
-        filterItem[key] = data[val]
-      })
-      return filterItem
-    },
-    //获取表单下拉数据
-    changeSelect (name, code) {
-      switch (name) {
-        case 'algorithmtype':
-          const nstr = _.cloneDeep(code).toString().toLocaleLowerCase()
-          const item = this.selectType.filter(item => item.code == code)
-          if (!item?.length) return
-          const id = item[0].id
-          this.getSelectData('algorithmname', 20, { superiorid: id })
-          this.getSelectData('datasourceid', 12, { datasourcetype: code })
-          break;
-        default:
-          break;
-      }
+
+    treeNodeClick (data) {
+      this.$emit('treeNodeClick', Object.assign(data, { passparameters: this.passparameters }))
     },
-    setFormSelectData (name, returnData) {
-      switch (name) {
-        case 'serviceid':
-          this.selectService = [...returnData]
-          break;
-        case 'algorithmtype':
-          this.selectType = [...returnData]
-          break;
-        case 'algorithmname':
-          this.selectAlgorithm = [...returnData]
-          break;
-        case 'datasourceid':
-          this.selectSource = [...returnData]
-          break
-        case 'datatable':
-          this.tableData = [...returnData]
-          break
-        case 'nodedata':
-          //executionorder
-          const newItems = _.orderBy([...returnData], ['executionorder'], ['desc'])
-          this.nodeItems = [...this.nodeItems, ...newItems]
-          break
-        default:
-          break;
+
+    append () {
+      if (this.$refs['ruleForm']) {
+        this.$nextTick(() => {
+          this.$refs['ruleForm'].restForm()
+        })
       }
+      this.flag = true
+      this.tableType = "add"
+      this.tableTitle = "新增-服务"
+      this.tableForm = {}
+      // this.formItem = tableColumnArrs.filter(item => item.isdisplay == 1)
     },
-    //步骤新增
-    handleAdd (obj) {
-      this.type = 'add'
-      this.advancedDrawer = obj.flag
-      this.tableData = []
-    },
-    //步骤编辑
-    handleEdit (item) {
-      const data = _.cloneDeep(item)
-      const { algorithmlibraryid } = data
-      if (!algorithmlibraryid) return
-      this.advancedDrawer = true
-      this.tabFlag = true
-      this.tableForm = data
-      this.getSelectData('datatable', 24, { algorithmlibraryid })
+
+    edit (data) {
+      this.flag = true
+      this.tableType = "edit"
+      this.tableTitle = "编辑-服务"
+      this.tableForm = _.cloneDeep(data)
     },
-    //步骤删除
-    handleDel (obj) {
-      this.type = 'del'
-      const item = _.cloneDeep(obj)
-      const { algorithmname } = item
-      this.$confirm(`确认要删除 ${algorithmname} 这条信息吗?`, '提示', {
+
+    remove (node, data) {
+      let name = ''
+      const nrow = _.cloneDeep(data)
+      for (const key in nrow) {
+        if (key.includes('name')) {
+          name = nrow[key]
+        }
+      }
+      this.$confirm(`确认要删除 ${name} 这条信息吗?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        this.generalDataReception(3, this.formatDataNull(item), 'algorithmlibraryid')
+        this.generalDataReception(3, data, this.tableKey)
       }).catch(() => {
         this.$message({
           type: 'info',
@@ -275,50 +157,42 @@ export default {
         });
       });
     },
-    //弹框关闭
-    advancedClose () {
-      this.clearState()
-    },
-    //弹框确定
-    advancedTable () {
-      console.log(this.tableData)
-      return
-      const data = _.cloneDeep(this.tableForm)
-      data.serviceid = this.msgContent.serviceid
-      data.algorithmtype = this.formInline.algorithmtype
-      data.algorithmsourcelibraryid = this.radio3
-      const event = this.type == 'add' ? 1 : this.type == 'edit' ? 2 : 3
-      this.generalDataReception(event, this.formatDataNull(data))
+
+    restData () {
+      this.flag = false
+      this.rmFlag = false
+      this.dialogLoading = false
+      this.tableObj = {}
+      this.tableForm = {}
+      this.queryTreeData(this.pageServiceId)
     },
-    //状态清除
-    clearState () {
-      this.formInline.algorithmtype = ''
-      this.radio3 = ''
-      this.selectAlgorithm = []
-      for (const key in this.tableForm) {
-        if (Object.hasOwnProperty.call(this.tableForm, key)) {
-          this.tableForm[key] = null
-        }
+
+    //获取表头数据
+    getColumnData (columnArrs = []) {
+      const returnData = [...columnArrs]
+      const columncode = returnData.find(
+        (item) => item.isprimarykey == 1
+      );
+      if (columncode && Object.keys(columncode).length) {
+        this.tableKey = columncode['pagecode']
       }
-      this.advancedDrawer = false
-      this.tabFlag = false
-      this.loading = false
-      this.tableDrawer = false
     },
-    formatDataNull (params) {
-      const obj = _.cloneDeep(params)
-      for (const key in obj) {
-        if (Object.hasOwnProperty.call(obj, key)) {
-          const element = obj[key]
-          if (!element) {
-            obj[key] = null
-          }
-        }
-      }
-      return obj
+
+    // 新增/编辑-取消
+    submitClickClose (formName) {
+      this.flag = false
+      this.$refs[formName].restForm()
     },
+
+    // 新增/编辑-确认
+    submitClickHandler () {
+      const flag = this.$refs["ruleForm"].submitClickHandler()
+      if (flag) this.tableType == "add" ? this.generalDataReception(1, this.tableForm) : this.generalDataReception(2, this.tableForm, this.tableKey)
+    },
+
     //表格-增/删/改
     async generalDataReception (event, data, key) {
+      this.dialogLoading = true
       try {
         const params = {
           serviceid: this.pageServiceId,
@@ -332,41 +206,88 @@ export default {
               ? await modifyData(params)
               : await moveData(params);
         if (code == 0) {
-          this.$message.success("操作成功")
-          this.restTable()
-          this.clearState()
+          this.$message.success("操作成功");
+          this.restData()
         } else {
-          this.$message.error("操作失败")
-          this.clearState()
+          this.$message.error("操作失败");
+          this.restData();
         }
       } catch (error) {
-        this.clearState()
-        console.log(error)
+        this.restData()
       }
     },
-    restTable () {
-      this.setTableData(this.msgContent)
-    },
-    formatData (name) {
-      return typeof name == 'string' ? name.toLocaleLowerCase() : name
-    },
+
+    async queryTreeData (serviceid, pagename = '') {
+      this.loading = true;
+      const datacontent = { filter: { 1: 1 } }
+      try {
+        const { code, returnData } = await Query({
+          serviceid,
+          datacontent,
+          event: '0',
+          page: 1,
+          size: 9999,
+        });
+        if (code == 0 && returnData?.length) {
+          // const name = '全部'
+          // const treeMenu = listToTree(returnData, 'superiorid', 'pageconfigurationid')
+          // const treeMenuAll = [{ pagename: name, serviceid: name, superiorid: name, pageconfigurationid: -1, children: treeMenu }]
+          // this.defaultKeys = [-1]
+          // this.data = treeMenuAll
+          this.data = returnData
+        } else {
+          this.$message.error(`获取${pagename}数据失败`);
+        }
+      } catch (error) {
+        this.$message.error(`获取${pagename}数据失败`);
+      }
+      this.loading = false;
+    }
   }
 }
 </script>
 
 <style lang="scss" scoped>
-.accessPageNode {
-  display: flex;
-  width: 100%;
+.publicPageTree {
+  background-color: #fff;
+  padding: 20px;
   height: 100%;
-  justify-content: center;
-  align-items: center;
-  overflow-y: scroll;
-  &-items {
-    text-align: center;
+  width: 100%;
+  &_add {
+    margin-bottom: 20px;
+    line-height: 32px;
+    &_title {
+      font-size: 16px;
+      font-weight: 600;
+    }
   }
-  .advancedNode {
-    text-align: left;
+  ::v-deep &_tree {
+    margin-top: 20px;
+    height: calc(100% - 114px);
+    .el-scrollbar__wrap {
+      overflow-x: hidden;
+    }
+    .is-horizontal {
+      display: none;
+    }
+    .custom-tree-node {
+      display: flex;
+      width: 100%;
+      justify-content: space-between;
+      line-height: 28px;
+      &-label {
+        width: calc(100% - 105px);
+        .flower {
+          max-width: 190px;
+        }
+      }
+      &-btn {
+        width: 65px;
+      }
+      .del {
+        color: #ff0000;
+      }
+    }
   }
 }
-</style>
+</style>

+ 31 - 10
src/views/dataAccessPage/components/accessPageNode.vue

@@ -5,7 +5,8 @@
     </div>
     <PublicPageDialog class="advancedNode" :dialog-title="dialogTitle" dialogSize="600px" :dialog-drawer="advancedDrawer" @handleClose="advancedClose" @handleSubmit="advancedTable">
       <template v-if="!tabFlag">
-        <node-class ref="nodeClass" @changeSelect="changeSelect" @groupChange="groupChange" />
+        <!-- <node-class ref="nodeClass" @changeSelect="changeSelect" @groupChange="groupChange" /> -->
+        <nodeTree ref="nodeTree" @treeNodeClick="treeNodeClick" />
       </template>
       <template v-else>
         <node-form ref="nodeForm" :nodeForm="nodeForm" :algorithmtype="this.selectCode" />
@@ -19,6 +20,7 @@
 import PublicPageDialog from '@/components/PublicPageDialog'
 import nodeBtn from './accessPageNodeBtn.vue'
 import nodeClass from './nodeClass.vue'
+import nodeTree from './nodeTree.vue'
 import nodeForm from './nodeForm.vue'
 import nodeTable from './nodeTable.vue'
 import { Query, newData, modifyData, moveData } from "@/api/webApi"
@@ -26,7 +28,7 @@ import { formatChange, getTableCols } from '@/utils/validate'
 import { getQueryData } from '../utils'
 export default {
   name: 'AccessPageNode',
-  components: { nodeBtn, PublicPageDialog, nodeClass, nodeForm, nodeTable },
+  components: { nodeBtn, PublicPageDialog, nodeClass, nodeForm, nodeTable, nodeTree },
   props: {
     msgContent: {
       type: Object,
@@ -64,7 +66,7 @@ export default {
       },
       deep: true,
       immediate: true
-    },
+    }
   },
   mounted () {
     this.getSelectData('algorithmtype', 20, { type: 'category' })
@@ -140,6 +142,12 @@ export default {
       this.groupId = val
       this.tableId = val
     },
+    treeNodeClick (item) {
+      const { id } = item
+      this.tabFlag = true
+      this.groupId = id
+      this.tableId = id
+    },
     tableChange (arr) {
       // if (this.type == 'add' && arr?.length) {
       //   this.tableColumnData()
@@ -147,9 +155,13 @@ export default {
     },
     //步骤新增
     handleAdd (obj) {
-      this.type = 'add'
-      this.advancedDrawer = true
-      this.nodeForm = {}
+      if (Object.keys(this.msgContent).length) {
+        this.type = 'add'
+        this.advancedDrawer = true
+        this.nodeForm = {}
+      } else {
+        this.$message.error('请选中服务后再操作')
+      }
     },
     //步骤编辑
     handleEdit (item) {
@@ -195,6 +207,7 @@ export default {
         data.algorithmsourcelibraryid = algorithmlibraryid
         this.tableColumnData(event)
       } else if (this.type == 'add') {
+        data.algorithmname = sessionStorage.getItem('nodeTreeTxt') || ''
         data.algorithmtype = this.selectCode
         data.algorithmsourcelibraryid = this.groupId
       }
@@ -202,20 +215,28 @@ export default {
     },
     //新增数据时操作table
     async addDataColTable () {
-      const data = _.cloneDeep(this.$refs['nodeForm'].tableForm)
-      if (!Object.keys(data).length) return
-      const { algorithmname } = data
       const row = this.msgContent
       const { passparameters } = row
+      const narr = _.cloneDeep(this.nodeItems).filter(item => item.algorithmlibraryid)
       const filterItem = this.formatDefault(passparameters, row)
       if (!Object.keys(filterItem).length) return
       const { returnData } = await getQueryData(this.pageServiceId, filterItem)
-      const item = returnData.filter(item => item.algorithmname == algorithmname)
+      const item = this.findArrDeft(narr, returnData, 'algorithmlibraryid')
       if (!item.length) return
       const { algorithmlibraryid } = item[0]
       this.algId = algorithmlibraryid
       this.tableColumnData(1)
     },
+    findArrDeft (arr, all, key) {
+      const res = [...arr, ...all].filter(
+        (item) =>
+          !(
+            arr.some((p) => item[key] == p[key]) &&
+            all.some((c) => item[key] == c[key])
+          )
+      )
+      return res
+    },
     //状态清除
     clearState () {
       this.advancedDrawer = false

+ 9 - 9
src/views/dataAccessPage/components/nodeForm.vue

@@ -2,7 +2,7 @@
   <div class="nodeForm">
     <el-form ref="ruleForm" :model="tableForm" label-width="100px">
       <el-row :gutter="20">
-        <el-col :span="24">
+        <!-- <el-col :span="24">
           <el-form-item prop="algorithmname" label="算法名称">
             <el-input size="small" v-model="tableForm.algorithmname" placeholder="请输入" />
           </el-form-item>
@@ -23,27 +23,27 @@
           <el-form-item prop="executionorder" label="执行排序">
             <el-input size="small" v-model="tableForm.executionorder"></el-input>
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :span="24">
           <el-form-item prop="algorithmdescription" label="算法说明">
             <el-input size="small" v-model="tableForm.algorithmdescription"></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="24">
-          <el-form-item prop="computingexpression" label="计算表达式">
-            <el-input size="small" type="textarea" v-model="tableForm.computingexpression"></el-input>
-          </el-form-item>
-        </el-col>
         <el-col :span="24">
           <el-form-item prop="preconditions" label="执行条件">
             <el-input size="small" type="textarea" v-model="tableForm.preconditions"></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="24">
+        <el-col v-if="formatData(algorithmtype) == 'js'" :span="24">
+          <el-form-item prop="computingexpression" label="计算表达式">
+            <el-input size="small" type="textarea" v-model="tableForm.computingexpression"></el-input>
+          </el-form-item>
+        </el-col>
+        <!-- <el-col :span="24">
           <el-form-item prop="preparameterset" label="前置条件参数">
             <el-input size="small" type="textarea" v-model="tableForm.preparameterset"></el-input>
           </el-form-item>
-        </el-col>
+        </el-col> -->
       </el-row>
     </el-form>
   </div>

+ 0 - 1
src/views/dataAccessPage/components/nodeTable.vue

@@ -76,7 +76,6 @@ export default {
   watch: {
     type: {
       handler (val) {
-        console.log(val)
         if (val == 'edit') {
           this.getTableData('tabledata', 24, { algorithmlibraryid: this.queryId })
         } else {

+ 99 - 0
src/views/dataAccessPage/components/nodeTree.vue

@@ -0,0 +1,99 @@
+<template>
+  <div class="nodeTree">
+    <div class="nodeTree_search">
+      <el-input size="small" placeholder="输入关键字进行过滤" clearable v-model="filterText"></el-input>
+    </div>
+    <div class="nodeTree_tree">
+      <el-scrollbar style="height: 100%" :horizontal="false">
+        <el-tree class="filter-tree" :expand-on-click-node="false" :data="treedata" :props="defaultProps" node-key="id" :default-expanded-keys="defaultKeys" :filter-node-method="filterNode" ref="tree" @node-click="treeNodeClick">
+        </el-tree>
+      </el-scrollbar>
+    </div>
+  </div>
+</template>
+
+<script>
+import { listToTree } from '@/utils/validate'
+import { getQueryData } from '../utils/index'
+export default {
+  name: 'NodeTree',
+  data () {
+    return {
+      filterText: '',
+      treedata: [],
+      treedataCopy: [],
+      nodeParents: [],
+      defaultKeys: [],
+      defaultProps: {
+        children: 'children',
+        label: 'name'
+      },
+    }
+  },
+  watch: {
+    filterText (val) {
+      this.$refs.tree.filter(val);
+    },
+  },
+  mounted () {
+    this.getTreeData()
+  },
+  methods: {
+    filterNode (value, data) {
+      if (!value) return true;
+      return data.name.indexOf(value) !== -1;
+    },
+    treeNodeClick (item) {
+      const { id } = item
+      const ncids = [0, ...this.defaultKeys]
+      this.nodeParents = []
+      if (!ncids.includes(id)) {
+        this.formatUpdata(item)
+        const results = [item, ...this.nodeParents].reverse()
+        let nodeTxt = ''
+        results.map((item, index) => nodeTxt = nodeTxt + (index != 0 ? '-' : '') + item.name)
+        sessionStorage.setItem('nodeTreeTxt', nodeTxt)
+        this.$emit('treeNodeClick', item)
+      } else {
+        this.$message.error('请选择算法模板后再操作')
+      }
+    },
+    formatUpdata (item) {
+      const nitem = { ...item }
+      this.treedataCopy.forEach(citem => {
+        if (nitem.superiorid == citem.id) {
+          this.nodeParents.push(citem)
+          this.formatUpdata(citem)
+        }
+      })
+    },
+    async getTreeData () {
+      const { code, returnData } = await getQueryData(20, { 1: 1 })
+      if (code == 0 && returnData?.length) {
+        const result = listToTree(_.cloneDeep(returnData), 'superiorid', 'id')
+        const resall = [{
+          name: '全部',
+          id: 0,
+          superiorid: -1,
+          children: result
+        }]
+        const check = [...returnData].filter(item => item.code == 'jisuan' || item.code == 'ss' || item.code == 'sc')
+        const checksid = []
+        check.map(({ id }) => checksid.push(id))
+        this.defaultKeys = checksid
+        this.treedataCopy = _.cloneDeep(returnData)
+        this.treedata = resall
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+::v-deep .nodeTree {
+  height: 100vh;
+  &_tree {
+    margin-top: 20px;
+  }
+}
+</style>