Browse Source

表格列表修改

Zn 1 year ago
parent
commit
4333dc5521

+ 1 - 2
ruoyi-ui/src/api/tablelist/commonTable.js

@@ -172,9 +172,8 @@ export function getStatistic(id) {
 // 删除动态格统计
 export function delStatistic(data) {
   return request({
-    url: '/system/statistic/',
+    url: '/system/statistic/' + data,
     method: 'delete',
-    data: data,
     baseURL: process.env.VUE_APP_BASE_API3
   })
 }

+ 4 - 1
ruoyi-ui/src/views/dragform/tableList.vue

@@ -224,6 +224,7 @@
 </template>
 <script>
 import { listTable, removeTableList } from "@/api/dragform/tableList";
+import { delStatistic } from "@/api/tablelist/commonTable"
 import { delMenu } from "@/api/system/menu";
 import { mapGetters } from "vuex";
 import DictData from "@/components/DictData";
@@ -424,7 +425,9 @@ export default {
         )
         .then(async function () {
           let res = await delMenu(row.menuId);
-          if (res.code == 200) {
+          if (res.code == 200) { 
+            console.log(row.tableKey);
+            await delStatistic(row.tableKey) 
             await removeTableList(data);
           } else {
             return Promise.reject();

+ 20 - 23
ruoyi-ui/src/views/tableMange/index.vue

@@ -948,7 +948,7 @@ export default {
             relationFieldList: [],
           };
         });
-        console.log(this.tableFieldList);
+        // console.log(this.tableFieldList);
       });
     },
     // 关联表变化回调
@@ -1585,9 +1585,9 @@ export default {
               data.menuId = result.data;
               res = await addDragTable(data);
             }
-            this.staticSqlKey = uuidv4()
-            this.dragTableStatisticList.forEach(item => {
-              console.log(item)
+            this.dragTableStatisticList?.forEach(item => {
+              this.staticSqlKey = uuidv4()
+              // console.log(item)
               let key = item.statisticType + '(' + item.statisticField + ')'+ ' as result'
               this.tableSqlList.push({
                 tableSql: this.getStaticSQL(key), 
@@ -1700,37 +1700,33 @@ export default {
     },
     // 添加数据字段对话框
     async addDataDialog() {
+      this.staictitle = '添加统计数据字段'
       this.isShowAddData = true;
       this.dataType = await this.getDicts("table_statistic_type");
       this.dataType = this.dataType.data;
       // console.log(this.dataType)
     },
-    // 添加数据字段对话框
-    async addDataDialog() {
-      this.isShowAddData = true;
-      this.dataType = await this.getDicts("table_statistic_type");
-      this.dataType = this.dataType.data;
+    async updataDialog() {
+      
       // console.log(this.dataType)
     },
     // 修改数据字段
     upadtaData(){
-      console.log(this.dataCountFormData);
-      // this.dragTableStatisticList = this.dragTableStatisticList.map(value => value.xid == this.dataCountFormData.xid || value.id == this.dataCountFormData.id ? this.dataCountFormData : value)
       this.dragTableStatisticList.forEach((item, index) => {
-        console.log(this.dataCountFormData);
-        if(item?.id == this.dataCountFormData?.id){
+        // console.log(this.dataCountFormData);
+        if(item.id !== undefined && item.id == this.dataCountFormData.id){
           this.dragTableStatisticList[index] = this.dataCountFormData
-        }else if(item?.xid == this.dataCountFormData?.xid){
+        }else if(item.xid == this.dataCountFormData.xid){
           this.dragTableStatisticList[index] = this.dataCountFormData
         }
       })
       this.isShowAddData = false
-      console.log(this.dragTableStatisticList)
+      // console.log(this.dragTableStatisticList)
       this.dataCountFormData = {}
     },
     // 添加数据字段
     addData(){
-      console.log(this.dataCountFormData);
+      // console.log(this.dataCountFormData);
       this.dataCountFormData.xid = Date.now()
       this.dataCountFormData.tableKey = this.tableKey
       this.dragTableStatisticList.push(this.dataCountFormData)
@@ -1754,20 +1750,21 @@ export default {
       })
     },
     // 修改统计信息
-    handleUpdateStat(row){
-      console.log(row);
-      this.staictitle = '修改统计数据字段'
+    async handleUpdateStat(row){
+      // console.log(row);
       this.dataCountFormData = row
       this.dataCountFormData.xid = Date.now()
-      this.addDataDialog()
+      this.staictitle = '修改统计数据字段'
+      this.dataType = await this.getDicts("table_statistic_type");
+      this.dataType = this.dataType.data;
       this.isShowAddData = true
-      console.log(this.dataCountFormData)
-      console.log(this.dragTableStatisticList);
+      // console.log(this.dataCountFormData)
+      // console.log(this.dragTableStatisticList);
     },
     // 删除统计信息
     handleDeleteStat(row){
       this.dragTableStatisticList.forEach((item, index) => {
-        console.log(item);
+        // console.log(item);
         if(item.id == row.id){
           this.dragTableStatisticList.splice(index, 1);
         }

+ 3 - 1
ruoyi-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -52,6 +52,7 @@
     </el-dialog>
     <Queryfrom
       :form-vals="templateInfo.where"
+      :statisticList="statisticList"
       :showCount="showCount"
       @getList="getList"
       ref="mychild"
@@ -300,7 +301,7 @@ export default {
       // 回显表格数据,
       defaultValue: {},
       // 统计card
-      tableKey: '',
+      statisticList: [],
     };
   },
 
@@ -418,6 +419,7 @@ export default {
           // 查询统计信息
           getStatisticList({queryMap: {tableKey: this.templateInfo.template.tableKey}}).then(res => {
             console.log('getStatisticList', res);
+            this.statisticList = res.data
           })
         });
     },

+ 11 - 64
ruoyi-ui/src/views/tablelist/commonTable/queryfrom.vue

@@ -5,30 +5,30 @@
         shadow="hover"
         :body-style="{ padding: '20px' }"
         class="card"
-        v-for="(item, index) in cardcountArr"
+        v-for="(item, index) in statisticList"
         :key="index"
       >
         <el-tooltip
           class="item"
           effect="dark"
-          :content="item.title"
+          :content="item.statisticTitle ? item.statisticTitle : item.statisticDescription"
           placement="top-start"
         >
-          <div class="title">{{ item.title }}</div>
+          <div class="title">{{ item.statisticTitle ? item.statisticTitle : item.statisticDescription }}</div>
         </el-tooltip>
 
-        <el-tooltip
+        <!-- <el-tooltip
           class="item"
           effect="dark"
           :content="item.description"
           placement="top-start"
         >
           <div class="description">{{ item.description }}</div>
-        </el-tooltip>
+        </el-tooltip> -->
 
         <div class="type">
-          <div>{{ item.type }}</div>
-          <div class="count">{{ item.count }}</div>
+          <!-- <div>{{ item.type }}</div> -->
+          <div class="count">{{ item.result }}</div>
         </div>
       </el-card>
     </div>
@@ -175,6 +175,9 @@ export default {
     },
     showCount : {
       type: Boolean,
+    },
+    statisticList:{
+      type: Array,
     }
   },
   data() {
@@ -209,63 +212,7 @@ export default {
       // 单选/按钮
       radios: [],
       // card
-      cardcountArr: [
-        {
-          title: "标题1454654564548978784654456454545456489748787",
-          description:
-            "描述11111154544564456486474787475465454564545454545454545",
-          type: "数量1",
-          count: 10,
-        },
-        {
-          title: "标题2",
-          description: "描述256+56++46545646",
-          type: "已完成",
-          count: 20,
-        },
-        {
-          title: "标题2",
-          description: "描述256+56++46545646",
-          type: "已完成",
-          count: 20,
-        },
-        {
-          title: "标题2",
-          description: "描述256+56++46545646",
-          type: "已完成",
-          count: 20,
-        },
-        {
-          title: "标题2",
-          description: "描述256+56++46545646",
-          type: "已完成",
-          count: 20,
-        },
-        {
-          title: "标题2",
-          description: "描述256+56++46545646",
-          type: "已完成",
-          count: 20,
-        },
-        {
-          title: "标题2",
-          description: "描述256+56++46545646",
-          type: "已完成",
-          count: 20,
-        },
-        {
-          title: "标题2",
-          description: "描述256+56++46545646",
-          type: "已完成",
-          count: 20,
-        },
-        {
-          title: "标题2",
-          description: "描述256+56++46545646",
-          type: "已完成",
-          count: 20,
-        },
-      ],
+     
     };
   },
   watch: {