Browse Source

服务新增修改

zhaoke 1 year ago
parent
commit
de747ac0dc

+ 1 - 0
package.json

@@ -27,6 +27,7 @@
     "normalize.css": "7.0.0",
     "nprogress": "0.2.0",
     "path-to-regexp": "2.4.0",
+    "vcrontab": "^0.3.5",
     "vis": "^4.21.0-EOL",
     "vue": "2.6.10",
     "vue-count-to": "^1.0.13",

+ 10 - 0
pnpm-lock.yaml

@@ -47,6 +47,9 @@ dependencies:
   path-to-regexp:
     specifier: 2.4.0
     version: 2.4.0
+  vcrontab:
+    specifier: ^0.3.5
+    version: 0.3.5
   vis:
     specifier: ^4.21.0-EOL
     version: 4.21.0-EOL
@@ -11935,6 +11938,13 @@ packages:
     engines: {node: '>= 0.8'}
     dev: true
 
+  /vcrontab@0.3.5:
+    resolution: {integrity: sha512-RMNrDFhsO68BEtdUwtKgtPAvaQIlXmAJ9MrqFLgWBedhlolLclm3kBwlQx4lpN8DlnascCkVcBiGDr+XXQqTpQ==}
+    dependencies:
+      element-ui: 2.15.12(vue@2.6.10)
+      vue: 2.6.10
+    dev: false
+
   /vendors@1.0.4:
     resolution: {integrity: sha512-/juG65kTL4Cy2su4P8HjtkTxk6VmJDiOPBufWniqQ6wknac6jNiXS9vU+hO3wgusiyqWlzTbVHi0dyJqRONg3w==}
     dev: true

+ 1 - 1
public/config.js

@@ -8,7 +8,7 @@ window.SERVICE_ID = {
   baggageDetailsImg: 127, // 行李-基础信息-行李号-照片
   baggageInfoTable: 119, // 行李-基础信息-列表
 
-  /***-----容器视图------***/
+  /***-----服务管理------***/
   containerHistory: 18026,
   containerBaggage: 18027,
 }

+ 16 - 2
src/components/publicPageForm/index.vue

@@ -27,7 +27,7 @@
               <el-input size="small" @change="inputChangeHandler(item.pagecode)" v-model="tableForm[item.pagecode]"></el-input>
             </template>
             <template v-else-if="fromDataType(item.datatype) == 'TEXTAREA'">
-              <el-input type="textarea" v-model="tableForm[item.pagecode]"></el-input>
+              <el-input type="textarea" @focus="setText(item.pagecode)" v-model="tableForm[item.pagecode]"></el-input>
             </template>
             <template v-else-if="fromDataType(item.datatype) == 'PASSWORD'">
               <el-input show-password v-model="tableForm[item.pagecode]"></el-input>
@@ -76,18 +76,20 @@
         </el-col>
       </el-row>
     </el-form>
+    <vcrontab v-if="vflag" ref="vcrontab" @crontabFill="crontabFill" />
   </div>
 </template>
 
 <script>
 import { Query } from "@/api/webApi"
 import uploadItem from './upload.vue'
+import vcrontab from './vcrontab.vue'
 import JSEncrypt from "jsencrypt"
 import allIcons from '@/utils/icons'
 
 export default {
   name: 'PublicPageForm',
-  components: { uploadItem },
+  components: { uploadItem, vcrontab },
   props: {
     formType: {
       type: String,
@@ -121,6 +123,7 @@ export default {
       formItemArr: [],
       formPassCopy: [],
       loading: false,
+      vflag: false,
       formIcons: allIcons
     }
   },
@@ -303,6 +306,9 @@ export default {
     },
     //获取表单下拉数据
     changeSelect (code) {
+      if (code == 'tasktype' && this.tableForm[code] == 1) {
+        this.vflag = true
+      }
       if (code == 'passparameters') return
       const datas = this.$store.state.auth.authMsg
       if (!datas?.length) return
@@ -422,6 +428,14 @@ export default {
         show = false
       }
       return show
+    },
+    setText (code) {
+      if (this.vflag && code == 'cronexpress') {
+        this.$refs['vcrontab'].showCron = true
+      }
+    },
+    crontabFill (val) {
+      this.$set(this.tableForm, 'cronexpress', val)
     }
   }
 }

+ 33 - 0
src/components/publicPageForm/vcrontab.vue

@@ -0,0 +1,33 @@
+<template>
+  <div class="vcrontab">
+    <el-dialog title="生成 cron" top="50px" append-to-body :visible.sync="showCron">
+      <vcrontab @hide="showCron=false" @fill="crontabFill" :expression="expression"></vcrontab>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import vcrontab from 'vcrontab'
+export default {
+  name: 'Vcrontab',
+  components: { vcrontab },
+  data () {
+    return {
+      input: "",
+      expression: "",
+      showCron: false
+    }
+  },
+  methods: {
+    crontabFill (value) {
+      //确定后回传的值
+      this.$emit('crontabFill', value)
+    },
+    showDialog () {
+      this.expression = this.input//传入的 cron 表达式,可以反解析到 UI 上
+      this.showCron = true
+    }
+  }
+
+}
+</script>

+ 29 - 17
src/views/dataAccessPage/components/accessPageNode.vue

@@ -1,7 +1,7 @@
 <template>
   <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" class="accessPageNode">
     <div style="height: 100%;" class="accessPageNode-items">
-      <node-btn 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" />
+      <node-btn v-for="(item,index) in nodeItems" :nodeIndex="index" :nodeItem="item" :nodeTxt="item.algorithmdescription" :isLine="item.isLine" :isDel="item.isDel" :key="index" @handleAdd="handleAdd" @handleDel="handleDel" @handleEdit="handleEdit" />
     </div>
     <PublicPageDialog class="advancedNode" :dialog-title="dialogTitle" :dialogLoading="tabLoadFlag" dialogSize="600px" :dialog-drawer="advancedDrawer" @handleClose="advancedClose" @handleSubmit="advancedTable">
       <template v-if="!tabFlag">
@@ -44,7 +44,7 @@ export default {
       tabLoadFlag: false,
       nodeItems: [
         {
-          algorithmname: '开始',
+          algorithmdescription: '开始',
           isLine: true,
           isDel: false
         }
@@ -133,9 +133,9 @@ export default {
           break
         case 'nodedata':
           //executionorder
-          const newItems = _.orderBy([...returnData], ['targetsource'], ['asc'])
+          const newItems = _.orderBy([...returnData], ['executionorder'], ['asc'])
           this.nodeItems = [...this.nodeItems, ...newItems, {
-            algorithmname: '结束',
+            algorithmdescription: '结束',
             isLine: false,
             isDel: false
           }]
@@ -177,9 +177,9 @@ export default {
         const index = obj.index
         const len = this.nodeItems.length - 2
         if (len == -1 || len == index) {
-          const { targetsource } = this.nodeItems[index]
-          if (targetsource) {
-            const [a, b] = targetsource.split('')
+          const { executionorder } = this.nodeItems[index]
+          if (executionorder) {
+            const [a, b] = executionorder.split('')
             const lowerIndex = this.lowers.indexOf(a)
             if (lowerIndex > -1) {
               this.nodeIndex = this.lowers[lowerIndex + 1] + 1
@@ -190,16 +190,16 @@ export default {
             this.nodeIndex = this.lowers[index] + 1
           }
         } else {
-          const { targetsource } = this.nodeItems[index]
+          const { executionorder } = this.nodeItems[index]
           const nextItems = _.cloneDeep(this.nodeItems)
-          if (targetsource) {
-            const [a, b] = targetsource.split('')
+          if (executionorder) {
+            const [a, b] = executionorder.split('')
             this.nodeIndex = a + (Number(b) + 1)
             nextItems.map(item => {
-              if (item.targetsource) {
-                const [c, d] = item.targetsource.split('')
+              if (item.executionorder) {
+                const [c, d] = item.executionorder.split('')
                 if (c == a && Number(d) > Number(b)) {
-                  item.targetsource = c + (Number(d) + 1)
+                  item.executionorder = c + (Number(d) + 1)
                   this.lowerItems.push(item)
                 }
               }
@@ -228,8 +228,8 @@ export default {
     handleDel (obj) {
       this.type = 'del'
       const item = _.cloneDeep(obj)
-      const { algorithmname } = item
-      this.$confirm(`确认要删除 ${algorithmname} 这条信息吗?`, '提示', {
+      const { algorithmdescription } = item
+      this.$confirm(`确认要删除 ${algorithmdescription} 这条信息吗?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
@@ -260,9 +260,21 @@ export default {
         data.algorithmname = sessionStorage.getItem('nodeTreeTxt') || ''
         data.algorithmtype = this.selectCode
         data.algorithmsourcelibraryid = this.groupId
-        data.targetsource = this.nodeIndex
+        data.executionorder = this.nodeIndex
       }
-      this.generalDataReception(event, this.formatDataNull(data), 'algorithmlibraryid')
+      this.generalDataReception(event, this.formatDataNull(this.deleteObjKey(data)), 'algorithmlibraryid')
+    },
+    deleteObjKey (obj) {
+      const delKeys = ['algorithmtype', 'algorithmname', 'datasourceid', 'targetsource', 'datasourcename', 'preparameterset']
+      const nKey = _.cloneDeep(obj)
+      for (const key in nKey) {
+        if (Object.hasOwnProperty.call(nKey, key)) {
+          if (delKeys.includes(key)) {
+            delete nKey[key]
+          }
+        }
+      }
+      return nKey
     },
     //新增数据时操作table
     async addDataColTable () {

+ 1 - 2
src/views/dataAccessPage/components/nodeForm.vue

@@ -68,14 +68,13 @@ export default {
       tableForm: {
         serviceid: '',
         preconditions: '',
-        algorithmtype: '',
         algorithmname: '',
         algorithmsourcelibraryid: '',
         executionorder: '',
         targetsource: '',
         datasourceid: '',
         computingexpression: '',
-        algorithmdescription: '',
+        algorithmdescription: sessionStorage.getItem('nodeTreeTxt') || '',
         preparameterset: ''
       },
       selectSource: JSON.parse(sessionStorage.getItem('nodeDatasource')) || []