zhaoke 1 year ago
parent
commit
bf978517b2

+ 1 - 0
public/config.js

@@ -13,3 +13,4 @@ window.SERVICE_ID = {
   containerBaggage: 18027,
 }
 
+window.JS_DOWNLIST = ['args[0].result.returnData', 'args[1].result.returnData', 'args[2].result.returnData', 'args[3].result.returnData', 'args[4].result.returnData']

+ 20 - 74
src/views/dataAccessPage/components/advanceQuery.vue

@@ -10,25 +10,25 @@
                   col.prop === 'comparisonOperator' ||
                   col.inputType[rowIndex] === 'select'
                 ">
-                  <el-select filterable clearable size="small" v-model="row[col.prop]" placeholder="请选择" @change="
+                  <el-select filterable clearable size="small" v-model="row[col.prop]" placeholder="请选择">
+                    <el-option v-for="(option, i) in comparisons" :key="i" :value="option.value" :label="option.label" />
+                  </el-select>
+                </template>
+                <template v-else-if="col.inputType === 'select'">
+                  <el-select size="small" v-model="row[col.prop]" @change="
                     value => {
                       selectChangeHandler(value, rowIndex, colIndex)
                     }
-                  ">
-                    <el-option v-for="(option, i) in col.options[rowIndex]" :key="i" :value="option.value" :label="option.label" />
+                  " :disabled="columnFlag" placeholder="请选择">
+                    <el-option v-for="(option, i) in col.options" :key="i" :value="option.value" :label="option.label" />
                   </el-select>
                 </template>
-                <template v-else-if="col.inputType === 'select'">
-                  <el-input v-model="row[col.prop]" size="small" placeholder="请输入" />
-                </template>
                 <template v-else-if="
                   ['varchar', 'text', 'longtext'].includes(
                     col.inputType[rowIndex]
                   )
                 ">
-                  <el-input v-model="row[col.prop]" size="small" placeholder="请输入" :disabled="
-                    col.prop === 'paramValue' && paramsForm.disabled[rowIndex]
-                  " />
+                  <el-input v-model="row[col.prop]" size="small" placeholder="请输入" />
                 </template>
                 <template v-else-if="col.inputType === 'connector'">
                   <div v-if="row.connector" class="clickable-toggle" @click="toggle(rowIndex)">
@@ -62,8 +62,6 @@
 
 <script>
 import { parseTime } from '@/utils/index'
-import { mapGetters } from 'vuex'
-import { Query } from "@/api/webApi"
 const comparisonOperatorOptions = [
   {
     label: '小于',
@@ -90,6 +88,9 @@ const comparisonOperatorOptions = [
     value: 'like',
   },
 ]
+const comparisonListOptions = window.JS_DOWNLIST || []
+const comparisonLists = []
+if (comparisonListOptions.length) comparisonListOptions.map(item => comparisonLists.push({ label: item, value: item }))
 export default {
   name: 'AdvancedQueryForm',
   props: {
@@ -138,7 +139,7 @@ export default {
           prop: 'paramKey',
           // label: '项',
           inputType: 'select',
-          options: [],
+          options: comparisonLists,
         },
         {
           prop: 'comparisonOperator',
@@ -165,11 +166,10 @@ export default {
         },
       ],
       columnSet: {},
+      columnFlag: false,
+      comparisons: comparisonOperatorOptions
     }
   },
-  computed: {
-    ...mapGetters(['authMsg']),
-  },
   watch: {
     'paramsForm.params': {
       handler (params) {
@@ -235,14 +235,7 @@ export default {
   methods: {
     queryHandler () {
       this.columnSet = {}
-      this.paramsTableCols[0].options = []
-      const colDatas = this.authMsg
-      if (colDatas?.length) {
-        // const columns = colDatas.filter(item => item.isfiltercolumn)
-        const columns = colDatas.filter(item => item.isfiltercolumn)
-        const datas = _.orderBy(columns, ['displaynumber'], ['asc', 'desc'])
-        this.getColumnSet(datas)
-      }
+      this.paramsTableCols[0].options = comparisonLists
       if (!this.paramsForm.params.length) {
         this.addParamsHandler()
       }
@@ -304,65 +297,18 @@ export default {
       this.$emit('getAdvancedQueryData', this.queryContent)
     },
     addParamsHandler () {
+      const len = this.paramsForm.params.length
       this.paramsTableCols[2].inputType.push('text')
       this.paramsForm.params.push({
-        paramKey: '',
+        paramKey: len == 0 ? '' : this.paramsForm.params[0].paramKey,
         comparisonOperator: '',
         paramValue: '',
         connector: '',
       })
     },
-    async selectChangeHandler (value, rowIndex, colIndex) {
+    selectChangeHandler (value, rowIndex, colIndex) {
       if (colIndex === 0) {
-        // const datas = this.tableColMunt.filter(item => item.columnName == value)
-        const { datatype, dropdownlistid, dropdownlistlabel, dropdownlist, defaultparameters } = this.columnSet[value]
-        // const { dataType, options } = datas[0]
-        // 下拉框发生改变清空之前的数据
-        this.paramsForm.params[rowIndex].paramValue = ''
-        if (datatype === 'date') {
-          this.paramsTableCols[1].options[rowIndex] = comparisonOperatorOptions
-            .slice(0, 5)
-            .reverse()
-          this.paramsTableCols[2].inputType[rowIndex] = 'date'
-        } else if (datatype === 'datetime') {
-          this.paramsTableCols[1].options[rowIndex] = comparisonOperatorOptions
-            .slice(0, 5)
-            .reverse()
-          this.paramsTableCols[2].inputType[rowIndex] = 'datetime'
-        } else if (dropdownlist || dropdownlist == 0) {
-          const datacontent = defaultparameters ? { filter: this.formatDefault(defaultparameters) } : { filter: { 1: 1 } }
-          const { code, returnData } = await Query({ serviceid: dropdownlist, datacontent, event: '0', page: 1, size: 9999 })
-          if (code == 0 && returnData?.length) {
-            returnData.map(item => {
-              item.label = item[dropdownlistlabel],
-                item.value = item[dropdownlistid]
-            })
-          }
-          this.paramsTableCols[1].options[rowIndex] =
-            comparisonOperatorOptions.slice(4, 5)
-          this.paramsTableCols[2].inputType[rowIndex] = 'select'
-          this.paramsTableCols[2].options[rowIndex] = returnData || []
-          this.paramsForm.params[rowIndex].paramValue = ''
-        } else if (datatype === 'number') {
-          this.paramsTableCols[1].options[rowIndex] = comparisonOperatorOptions
-            .slice(0, 5)
-            .reverse()
-          this.paramsTableCols[2].inputType[rowIndex] = 'number'
-          this.paramsForm.params[rowIndex].paramValue = ''
-        } else {
-          this.paramsTableCols[1].options[rowIndex] =
-            comparisonOperatorOptions.slice(4)
-          this.paramsTableCols[2].inputType[rowIndex] = 'text'
-        }
-        this.paramsForm.params[rowIndex].comparisonOperator =
-          this.paramsTableCols[1].options[rowIndex][0].value
-      } else if (colIndex === 1) {
-        if (['is Null', 'is not Null'].includes(value)) {
-          this.paramsForm.params[rowIndex].paramValue = ' '
-          this.paramsForm.disabled[rowIndex] = true
-        } else {
-          this.paramsForm.disabled[rowIndex] = false
-        }
+        this.columnFlag = true
       }
     },
     //格式化传递参数数据

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

@@ -26,17 +26,35 @@
         </el-col> -->
         <el-col :span="24">
           <el-form-item prop="algorithmdescription" label="算法说明">
+            <span slot="label">
+              算法说明
+              <el-tooltip content="算法说明" placement="top">
+                <i class="el-icon-question"></i>
+              </el-tooltip>
+            </span>
             <el-input size="small" v-model="tableForm.algorithmdescription"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="24">
           <el-form-item prop="preconditions" label="执行条件">
+            <span slot="label">
+              执行条件
+              <el-tooltip content="执行条件" placement="top">
+                <i class="el-icon-question"></i>
+              </el-tooltip>
+            </span>
             <el-input size="small" type="textarea" @focus="setPreconditions" v-model="tableForm.preconditions"></el-input>
           </el-form-item>
         </el-col>
         <!-- v-if="formatData(algorithmtype) == 'js'" :span="24" -->
         <el-col>
           <el-form-item prop="computingexpression" label="计算表达式">
+            <span slot="label">
+              计算表达式
+              <el-tooltip content="计算表达式" placement="top">
+                <i class="el-icon-question"></i>
+              </el-tooltip>
+            </span>
             <el-input size="small" type="textarea" v-model="tableForm.computingexpression"></el-input>
           </el-form-item>
         </el-col>
@@ -47,7 +65,7 @@
         </el-col> -->
       </el-row>
     </el-form>
-    <nodeType ref="nodeType" />
+    <nodeType ref="nodeType" @getColumnData="getColumnData" />
   </div>
 </template>
 
@@ -99,7 +117,10 @@ export default {
       return typeof name == 'string' ? name.toLocaleLowerCase() : name
     },
     setPreconditions () {
-      // this.$refs['nodeType'].showCron = true
+      this.$refs['nodeType'].showCron = true
+    },
+    getColumnData (str) {
+      this.$set(this.tableForm, 'preconditions', str)
     }
   }
 }

+ 17 - 2
src/views/dataAccessPage/components/nodeType.vue

@@ -27,11 +27,26 @@ export default {
       const ndataRules = [...dataRules]
       if (!ndataRules.length) return
       let str = ''
-      ndataRules.map(({ column, comparator, value }) => {
+      let strdata = ''
+      ndataRules.map(({ column, comparator, value, connector }) => {
+        const isconnector = connector == 'and' ? '&&' : '||'
+        strdata = column
         if (comparator == 'like') {
-          str += column
+          str += `indata.includes(${value}) ${connector ? isconnector : ''} `
+        } else {
+          str += `indata ${comparator} (${value}) ${connector ? isconnector : ''} `
         }
       })
+      const strarr = str.split('||')
+      let strstring = ''
+      strarr.map((item, index) => {
+        const len = strarr.length - 1
+        strstring += `(${item})` + (len == index ? '' : '||')
+      })
+      const strmsg = `let indata = ${strdata} indata = JSON.stringify(indata) indata && ${strstring} ? 0 : 1`
+      this.dataRules = strmsg
+      this.$emit('getColumnData', strmsg)
+      this.showCron = false
     },
     handleSubmit () {
       this.$refs['advanceQuery'].advancedQueryHandler()