From cda558b3fe6f6e6ec6258ddc1126484c477e837d Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期四, 19 十月 2023 15:20:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS-WEB/src/views/wel/Statistic.vue |  285 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 199 insertions(+), 86 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/wel/Statistic.vue b/Source/UBCS-WEB/src/views/wel/Statistic.vue
index 918d584..e3c52bc 100644
--- a/Source/UBCS-WEB/src/views/wel/Statistic.vue
+++ b/Source/UBCS-WEB/src/views/wel/Statistic.vue
@@ -1,110 +1,223 @@
 <template>
-  <div>
-        <avue-data-box :option="option" :animation="true"></avue-data-box>
+  <div v-loading="this.loading" class="App">
+    <div style="display: flex; justify-content: flex-end;margin-bottom: 10px">
+      <el-button plain size="small" type="primary" @click="MoreHandler">鑷畾涔�</el-button>
+    </div>
+    <avue-data-box ref="dataBox" :animation="true" :option="option"></avue-data-box>
+
+    <el-dialog :visible.sync="dialogTableVisible" append-to-body class="avue-dialog avue-dialog--top" title="涓绘暟鎹厤缃�"
+               top='-40px'>
+      <el-table
+        :data="Crud.data"
+        border
+        style="width: 100%"
+        ref="TableBox"
+        @selection-change="selectionChange"
+        @row-click="TableRoute">
+        <el-table-column
+          type="selection"
+          width="55">
+        </el-table-column>
+        <el-table-column
+          align="center"
+          label="涓绘暟鎹悕绉�"
+          prop="menuName"
+        >
+          <template slot-scope="scope">
+            <el-link type="primary" @click="TableRoute(scope.row)">{{ scope.row.menuName }}</el-link>
+          </template>
+        </el-table-column>
+        <el-table-column
+          align="center"
+          label="寰呭姙鏁版嵁"
+          prop="mdmCount"
+        >
+        </el-table-column>
+        <el-table-column
+          align="center"
+          label="icon鍥炬爣"
+          prop="icon">
+          <template slot-scope="scope">
+            <i :class="scope.row.icon" style="font-size: 20px"></i>
+          </template>
+        </el-table-column>
+        <el-table-column
+          :show-overflow-tooltip='true'
+          label="璺敱鍦板潃"
+          prop="menuRoute">
+        </el-table-column>
+        <el-table-column
+          align="center"
+          label="code"
+          prop="code">
+        </el-table-column>
+      </el-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button plain type="primary" @click="SaveHandler">淇濆瓨</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import {validatenull} from "@/util/validate";
-import {getList} from "@/api/system/statistic";
-import {flowRoute} from "@/util/flow";
+import {getList, save} from "@/api/system/statistic";
 
 export default {
-name: "Statistic",
-  data(){
-  return {
-    userId:'',
-    countByServer:true,
-    // listMyTask:[]
-    option: {
-      span:6,
-      data: [
-        {
-          click: this.handleItemAClick,
-          title: '鐗╁搧涓绘暟鎹�',
-          count: 1723,
-          icon: 'iconfont iconicon_doc',
-          color: 'rgb(49, 180, 141)',
-          uiUrl: "/MasterData/items?id=wupin@name=鐗╁搧涓绘暟鎹�",
-          countUrl:'priceIndexController/countNeedConfirmPlan'
-        },
-        {
-          click: this.handleItemBClick,
-          title: '浜哄憳涓绘暟鎹�',
-          count: 1225,
-          icon: 'iconfont iconicon_dispose',
-          color: 'rgb(56, 161, 242)',
-          uiUrl:'/MasterData/items?id=renyuan@@name=浜哄憳涓绘暟鎹�',
-          countUrl:'priceIndexController/countPricingPlan'
-        },
-        {
-          click: this.handleItemCClick,
-          title: 'Part',
-          count: 523,
-          icon: 'el-icon-setting',
-          color: 'rgb(117, 56, 199)',
-          uiUrl:'/MasterData/items?id=10@@name=Part',
-          countUrl:'priceIndexController/countNeedFeedbackPlan'
-        },
-        {
-          click: this.handleItemDClick,
-          title: '渚涘簲鍟嗕富鏁版嵁',
-          count: 0,
-          icon: 'iconfont iconicon_work',
-          color: 'rgb(255, 102, 51)',
-          uiUrl:'/MasterData/items?id=gongyingshang@@name=渚涘簲鍟嗕富鏁版嵁',
-          countUrl:'priceIndexController/countMyUnCreatePricePlan'
-        },
-      ]
-    },
-  }
+  name: "Statistic",
+  data() {
+    return {
+      loading: true,
+      Crud: {
+        form: '',
+        data: [],
+      },
+      userId: '',
+      hexColor: '',
+      newData: [],
+      SelectRow: [],
+      countByServer: true,
+      dialogTableVisible: false,
+      // listMyTask:[]
+      option: {
+        span: 6,
+        data: []
+      },
+    }
   },
   created() {
-    this.userId=sessionStorage.userId
-    getList('/api/ubcs-code/mdmCount/getMdmCounts',{id:this.userId}).then(res=>{
-      console.log(res)
-    })
+    this.MasterGetList();
   },
-  computed(){
+  mounted() {
+    this.FontInfo()
+  },
+  computed() {
 
   },
   methods: {
-    handleItemAClick() {
-      this.$router.push({ path: "/MasterData/items?id=wupin@name=鐗╁搧涓绘暟鎹�"} );
+    FontInfo() {
+      this.$nextTick(() => {
+        const dataFatherBox = this.$refs.dataBox.$el;
+        console.log(dataFatherBox);
+        this.$nextTick(() => {
+          setTimeout(() => {
+            //瀛椾綋
+            const info = dataFatherBox.querySelectorAll('.item-info .info');
+            //杈规
+            const items = dataFatherBox.querySelectorAll('.item');
+            // console.log('info', info);
+            info.forEach((info) => {
+              info.style.fontSize = '16px';
+            });
+            items.forEach((item) => {
+              item.style.border = '1px solid  rgb(200, 200, 200, 1)';
+            });
+            this.loading = false;
+          }, 1000); // 寤惰繜1绉掓煡鎵緄nfo鍏冪礌
+        });
+      });
     },
-    handleItemBClick() {
-      this.$router.push({ path: '/MasterData/items?id=renyuan@@name=浜哄憳涓绘暟鎹�'} );
+    selectionChange(row) {
+      // console.log(row)
+      this.SelectRow = row;
     },
-    handleItemCClick() {
-      this.$router.push({ path: '/MasterData/items?id=10@@name=Part'} );
+    SaveHandler() {
+      if (this.SelectRow.length <= 0) {
+        this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹紒')
+        return
+      }
+      let mdmNameList = [];
+      mdmNameList = this.SelectRow.map(item => {
+        return item.code
+      })
+      console.log(mdmNameList)
+      save(this.userId, mdmNameList).then(res => {
+        console.log(res)
+        if (res.data.code === 200) {
+          this.$message.success('淇濆瓨鎴愬姛锛�')
+          //娓呴櫎宸叉湁鏁扮粍涓璸ush鏁版嵁
+          this.newData = [];
+          this.option.data=[]
+          this.MasterGetList()
+          this.dialogTableVisible = false;
+          //瀛椾綋鍜岃竟妗嗛噸鏂板姞杞�
+          this.loading = true;
+          this.FontInfo()
+        }
+      })
     },
-    handleItemDClick() {
-      this.$router.push({ path: '/MasterData/items?id=gongyingshang@@name=渚涘簲鍟嗕富鏁版嵁'} );
+    MoreHandler() {
+      this.dialogTableVisible = true;
+      let checkedrow=[]
+      this.newData.forEach(item=>{
+        this.option.data.forEach(v=>{
+          if(item.code === v.code){
+            checkedrow.push(item)
+          }
+        })
+      })
+      console.log(checkedrow)
+      this.$nextTick(()=>{
+        checkedrow.forEach(row => {
+          this.$refs.TableBox.toggleRowSelection(row, true) // 鍥炴樉
+        })
+      })
     },
-    // getList() {
-    //   // debugger
-    //   Object.values(this.option.data).map(record => {
-    //     record.count = record.count || 0;
-    //     if (!this.countByServer) {
-    //       // 鏄墠绔煡璇�
-    //       getList(record.countUrl, {}).then(res => {
-    //         // console.log('res',res)
-    //         if (res.data.data.success) {
-    //           record.count = res.data.data.obj;
-    //         } else {
-    //           record.count = 0;
-    //         }
-    //       });
-    //     }
-    //     return {
-    //       ...record
-    //     };
-    //   });
-    // },
+    // 闅忔満鑹�
+    randomColor() {
+      const r = Math.floor(Math.random() * 256); // 鐢熸垚 0 鍒� 255 涔嬮棿鐨勯殢鏈烘暟
+      const g = Math.floor(Math.random() * 256);
+      const b = Math.floor(Math.random() * 256);
+      // 灏� RGB 鍊艰浆鎹负鍗佸叚杩涘埗琛ㄧず褰㈠紡
+      const hexColor = "#" + r.toString(16).padStart(2, '0') + g.toString(16).padStart(2, '0') + b.toString(16).padStart(2, '0');
+      return hexColor;
+    },
+    MasterGetList() {
+      this.userId = localStorage.getItem('userId');
+      getList({userId: this.userId}).then(res => {
+        res.data.data.filter((item, index) => {
+          this.newData.push(item);
+          this.Crud.data = this.newData;
+          if (item.isDefault === 1) {
+            const colors = ['rgb(49, 180, 141)', 'rgb(56, 161, 242)', 'rgb(117, 56, 199)', 'rgb(242, 104, 31)',
+              'rgb(19, 150, 111)','rgb(26, 131, 212)', 'rgb(87, 26, 169)', 'rgb(212, 83, 1)'];
+            const color = colors[index % colors.length];
+            this.option.data.push({
+              click: (item) => {
+                this.$router.push({path: item.uiUrl});
+              },
+              title: item.menuName,
+              count: parseInt(item.mdmCount),
+              icon: item.icon,
+              code: item.code,
+              isDefault: item.isDefault,
+              color: color,
+              uiUrl: item.menuRoute,
+              id: 'custom-title'
+            });
+          }
+        });
+      });
+    },
+    TableRoute(row) {
+      this.$router.push({path: row.menuRoute});
+    },
   }
 }
 </script>
 
 <style scoped>
+* {
+  list-style: none;
+}
 
+.MasterBox {
+  display: flex;
+  width: 100%;
+  padding: 0;
+}
+
+div {
+  margin: 0;
+  padding: 0;
+}
 </style>

--
Gitblit v1.9.3