zhaoke 2 years ago
parent
commit
52d2b989c8

+ 23 - 11
src/layout/mixin/publicFunc.js

@@ -2,27 +2,38 @@ import { Query, newData, modifyData, moveData } from "@/api/webApi"
 
 export default {
   methods: {
-    formatQuery (arrs, key) {
-      const flag = Array.isArray(arrs)
+    formatQuery (arrs, key = '') {
       const params = []
-      if (flag) {
-        for (let i = 0; i < arrs.length; i++) {
-          const obj = {
+      if (key) {
+        const flag = Array.isArray(arrs)
+        if (flag) {
+          for (let i = 0; i < arrs.length; i++) {
+            const obj = {
+              "left": "(",
+              "column": `${key}`,
+              "comparator": "=",
+              "value": `${arrs[i][key]}`,
+              "right": ")",
+              "connector": "and"
+            }
+            params.push(obj)
+          }
+        } else {
+          params.push({
             "left": "(",
             "column": `${key}`,
             "comparator": "=",
-            "value": `${arrs[i][key]}`,
+            "value": `${arrs[key]}`,
             "right": ")",
             "connector": "and"
-          }
-          params.push(obj)
+          })
         }
       } else {
         params.push({
           "left": "(",
-          "column": `${key}`,
+          "column": ``,
           "comparator": "=",
-          "value": `${arrs[key]}`,
+          "value": ``,
           "right": ")",
           "connector": "and"
         })
@@ -74,7 +85,8 @@ export default {
           serviceId: id,
           page: this.pageIndex,
           pageSize: pageSize ?? this.pageSize,
-          dataContent: this.formatQuery(dataContent, key)
+          dataContent: this.formatQuery(dataContent, key),
+          event: '0'
         })
         if (code == 0) {
           return returnData

+ 9 - 15
src/views/systemSettings/views/newAuth/components/table.vue

@@ -202,11 +202,11 @@
 
 <script>
 import Dialog from '@/layout/components/Dialog'
-import pb from '@/layout/mixin/getPublicData'
+import pf from '@/layout/mixin/publicFunc'
 import { initColumnSet } from '@/api/newLogin'
 export default {
   name: 'Table',
-  mixins: [pb],
+  mixins: [pf],
   props: {
     icons: {
       type: Array,
@@ -273,7 +273,6 @@ export default {
       handler (obj) {
         if (obj.queryTemplateID) {
           obj.serviceID = obj.queryTemplateID
-          // this.getTable(obj.queryTemplateID)
         }
         if (this.authType == 'add' && obj.auth_id) {
           this.addAuthId = obj.auth_id
@@ -298,7 +297,7 @@ export default {
     },
   },
   async mounted () {
-    const result = await this.getQuery(SERVICE_ID.sysAllMenuId, false, { serviceType: 1 })
+    const result = await this.getQueryList(SERVICE_ID.sysAllMenuId, { serviceType: 1 }, 'serviceType')
     this.authArrs = result
   },
   methods: {
@@ -326,23 +325,18 @@ export default {
     //表格数据提交
     async handleOk () {
       this.tableForm.serviceOutPutId = this.form.auth_id
-      const result = await this.generalDataReception(SERVICE_ID.getTableColumnId, this.tableForm, 2)
+      const code = await this.getChangeList(SERVICE_ID.getTableColumnId, this.tableForm, 2, 'queryTemplateColumnSetID')
+      if (code) {
+        this.$message.success('操作成功')
+      } else {
+        this.$message.error('操作失败')
+      }
       this.tableFlag = false
     },
     //表格取消
     eledite () {
       this.tableFlag = false
     },
-    //获取表格数据
-    async getTable (id) {
-      const result = await this.getQuery(id, true, {}, 10)
-      this.tableData = result
-      // for (let i = 0; i < result.length; i++) {
-      //   const element = result[i];
-      //   element.serviceOutPutId = this.form.auth_id
-      //   await this.generalDataReception(18122, element, 1)
-      // }
-    },
     serviceChange (val) {
       if (val) {
         this.form.queryTemplateID = val