zhaoke 1 year ago
parent
commit
a01607293a

+ 8 - 5
src/components/publicPageForm/index.vue

@@ -26,7 +26,7 @@
               <el-input show-password v-model="tableForm[item.pagecode]"></el-input>
             </template>
             <template v-else-if="fromDataType(item.datatype) == 'UPLOAD'">
-              <upload :id="index" :base-img="tableForm[item.pagecode]" ref="upload" />
+              <upload-item :id="index" :base-img="tableForm[item.pagecode]" ref="upload" />
             </template>
             <template v-else-if="fromDataType(item.datatype) == 'SWITCH'">
               <el-switch v-model="tableForm[item.pagecode]"></el-switch>
@@ -71,11 +71,11 @@
 
 <script>
 import { Query } from "@/api/webApi"
-import Upload from './upload.vue'
+import uploadItem from './upload.vue'
 import JSEncrypt from "jsencrypt"
 export default {
   name: 'PublicPageForm',
-  components: { Upload },
+  components: { uploadItem },
   props: {
     formType: {
       type: String,
@@ -264,6 +264,8 @@ export default {
             }
           })
         })
+      } else {
+        this.tableForm.passparameters = null
       }
       if (datas?.length) {
         datas.map(item => {
@@ -293,7 +295,8 @@ export default {
       const npass = this.tableForm.passparameters
       if (nload?.length) this.addTypeUpload(nload)
       if (ndata?.length) this.addTypePassWord(ndata)
-      if (npass?.length) { this.formatPass(npass) } else this.tableForm.passparameters = null
+      if (npass?.length) { this.formatPass(npass) }
+      // if (npass?.length) { this.formatPass(npass) } else this.tableForm.passparameters = null
       this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
           flag = true
@@ -316,4 +319,4 @@ export default {
     }
   }
 }
-</script>
+</script>

+ 11 - 8
src/views/dataAccessPage/components/accessPageForm.vue

@@ -22,18 +22,18 @@
         <el-col :span="24">
           <el-form-item prop="algorithmtype" label="算法类型">
             <el-select size="small" v-model="tableForm.algorithmtype" @change="changeSelect('algorithmtype',tableForm.algorithmtype)" placeholder="请选择">
-              <el-option v-for="(item,index) in selectType" :key="index" :label="item.name" :value="item.id"></el-option>
+              <el-option v-for="(item,index) in selectType" :key="index" :label="item.name" :value="item.code"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col v-if="tableForm.algorithmtype == 1 || tableForm.algorithmtype == 2 || tableForm.algorithmtype == 3 || tableForm.algorithmtype == 6" :span="24">
+        <el-col v-if="formatData(tableForm.algorithmtype) == 'java' || formatData(tableForm.algorithmtype) == 'db' || formatData(tableForm.algorithmtype) == 'kafka'" :span="24">
           <el-form-item prop="algorithmsourcelibraryid" label="算法模版">
             <el-select size="small" v-model="tableForm.algorithmsourcelibraryid" placeholder="请选择">
               <el-option v-for="(item,index) in selectAlgorithm" :key="index" :label="item.name" :value="item.id"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col v-if=" tableForm.algorithmtype == 2 || tableForm.algorithmtype == 3 || tableForm.algorithmtype == 6" :span="24">
+        <el-col v-if="formatData(tableForm.algorithmtype) == 'java' || formatData(tableForm.algorithmtype) == 'db' || formatData(tableForm.algorithmtype) == 'kafka'" :span="24">
           <el-form-item prop="datasourceid" label="数据源编号">
             <el-select size="small" v-model="tableForm.datasourceid" placeholder="请选择">
               <el-option v-for="(item,index) in selectSource" :key="index" :label="item.datasourcedescribe" :value="item.datasourceid"></el-option>
@@ -162,18 +162,21 @@ export default {
           break;
       }
     },
-    formatData (returnData) {
-      return typeof returnData == 'string' ? JSON.parse(returnData) : returnData
+    formatData (name) {
+      return typeof name == 'string' ? name.toLocaleLowerCase() : name
     },
     //获取表单下拉数据
     changeSelect (name, code) {
       switch (name) {
         case 'algorithmtype':
-          if (code == 1 || code == 2 || code == 3 || code == 6) {
+          const nstr = _.cloneDeep(code).toString().toLocaleLowerCase()
+          const item = this.selectType.filter(item => item.code == code)
+          const id = item[0].id
+          if (nstr == 'java' || nstr == 'db' || nstr == 'kafka') {
             this.tableForm.algorithmname = ''
             this.tableForm.datasourceid = ''
-            this.getSelectData('algorithmname', 20, { superiorid: code })
-            this.getSelectData('datasourceid', 12, { datasourcetype: code })
+            this.getSelectData('algorithmname', 20, { superiorid: id })
+            this.getSelectData('datasourceid', 12, { datasourcetype: id })
           }
           break;
         default:

+ 8 - 1
src/views/tablePage/index.vue

@@ -286,7 +286,14 @@ export default {
       // this.formItem = tableColumnArrs.filter(item => item.isdisplay == 1)
     },
     formatData (returnData) {
-      return typeof returnData == 'string' ? JSON.parse(returnData) : returnData
+      return typeof returnData == 'string' ? this.retParse(returnData) : returnData
+    },
+    retParse (returnData) {
+      try {
+        return JSON.parse(returnData) ? JSON.parse(returnData) : returnData
+      } catch (error) {
+        return returnData
+      }
     },
     //回显下拉数据
     resPassters (obj) {