From d57cc4c374fd502fedf3d0b5f7ec51caf91bf29a Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期三, 18 十月 2023 18:42:11 +0800 Subject: [PATCH] 整合代码 --- Source/UBCS-WEB/src/views/wel/Statistic.vue | 301 ++++++++++++++++++++++++++++--------------------- 1 files changed, 170 insertions(+), 131 deletions(-) diff --git a/Source/UBCS-WEB/src/views/wel/Statistic.vue b/Source/UBCS-WEB/src/views/wel/Statistic.vue index 32fb7dd..e94e248 100644 --- a/Source/UBCS-WEB/src/views/wel/Statistic.vue +++ b/Source/UBCS-WEB/src/views/wel/Statistic.vue @@ -1,153 +1,192 @@ <template> - <div> - <el-row :gutter="20"> - <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="4" v-for="item in listMyTask"> - <div class="box" :style="item.style"> - {{item.name}} - <div><avue-count-up class="value" :end="item.count"></avue-count-up></div> - </div> - </el-col> - </el-row> + <div class="App" v-loading="this.loading"> + <div style="display: flex; justify-content: flex-end;margin-bottom: 10px"> + <el-button icon="el-icon-more" 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="0"> + <avue-crud ref="crud" + v-model="Crud.form" + :data="Crud.data" + :option="Crud.option" + @selection-change="selectionChange"> + </avue-crud> + <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 {getList, save} from "@/api/system/statistic"; export default { -name: "Statistic", - data(){ - return { - countByServer:true, - listMyTask:[] - } + name: "Statistic", + data() { + return { + loading:true, + Crud: { + form: '', + data: [], + option: { + calcHeight: 80, + tip: false, + searchShow: false, + addBtn: false, + columnBtn: false, + header: false, + menu: false, + border: true, + index: true, + selection: true, + column: [ + { + label: "涓绘暟鎹悕绉�", + prop: "menuName", + }, + { + label: "寰呭姙鏁版嵁", + prop: "mdmCount", + }, + { + label: "icon鍥炬爣", + prop: "icon", + overHidden: true, + }, + { + label: "璺敱鍦板潃", + prop: "menuRoute", + overHidden: true, + }, + { + label: "code", + prop: "code", + overHidden: true, + }, + ] + } + }, + userId: '', + hexColor: '', + newData: [], + SelectRow: [], + countByServer: true, + dialogTableVisible: false, + // listMyTask:[] + option: { + span: 6, + data: [] + }, + } }, created() { - this.getList(); + this.MasterGetList(); }, - computed(){ + mounted() { + this.FontInfo() + }, + computed() { }, methods: { - getList() { - let data = [{ - "backgroundColor": "#FF5722", - "btmname": "hometask", - "countUrl": "priceIndexController/countNeedConfirmPlan", - "name": "寰呯‘璁よ鍒�", - "nameOid": "", - "oid": "34aebfde-eb11-4555-87eb-0a779be9aad0", - "uiUrl": "USEJS:rpm/wrj/ProductPricePlan", - }, { - "backgroundColor": "#5FB878", - "btmname": "hometask", - "countUrl": "priceIndexController/countPricingPlan", - "name": "浠婃棩宸茬‘璁よ鍒�", - "nameOid": "2C72EA23-8AA5-E5FC-9BC1-DE4AD182EF7B", - "oid": "6256ae79-7765-4c66-afc7-f12fad350065", - "uiUrl": "USEJS:rpm/wrj/ProductPricePlan", - }, - { - "backgroundColor": "#1E9FFF", - "btmname": "hometask", - "countUrl": "priceIndexController/countNeedFeedbackPlan", - "name": "宸茶皥銆佸緟鍙嶉", - "nameOid": "2536978C-CD1B-5B56-6529-A8C3456B5260", - "oid": "3043cdf1-8479-4c2a-9eab-fc35e9f9d5a7", - "uiUrl": "USEJS:rpm/wrj/ProductPricePlan", - }, - { - "backgroundColor": "#FF5722", - "btmname": "hometask", - "countUrl": "priceIndexController/countMyUnCreatePricePlan", - "name": "閲囪喘璋堜环-缁忓姙", - "nameOid": "", - "oid": "529634e7-1854-4f61-b911-a91e3c406757", - "uiUrl": "USEJS:rpm/wrj/PurchaseRequstUndo", - }, - { - "backgroundColor": "#5FB878", - "btmname": "hometask", - "countUrl": "priceIndexController/countPricingPlan", - "name": "浠婃棩宸茬‘璁よ鍒�--缁忓姙浜�", - "nameOid": "", - "oid": "a03a6ab2-f87d-4e45-94cb-9ef4d66fbba2", - "uiUrl": "USEJS:rpm/wrj/PurchaseRequstUndo?showPlan=true", - }, - { - "backgroundColor": "#1E9FFF", - "btmname": "hometask", - "countUrl": "priceIndexController/countNeedFeedbackPlan", - "name": "宸茶皥銆佸緟鍙嶉--缁忓姙浜�", - "nameOid": "", - "oid": "8e56cce6-c955-4624-99d5-6c5b870a8c09", - "uiUrl": "USEJS:rpm/wrj/PurchaseRequstUndo?showPlan=true", - }, - { - "backgroundColor": "", - "btmname": "", - "countUrl": "priceIndexController/countMyWillAuditPlan", - "name": "閲囪喘璋堜环-缁忓姙", - "nameOid": "", - "oid": "f7d5c541-3a3a-4f24-bf76-b1538abb7abd", - "uiUrl": "USEJS:rpm/wrj/PurchaseRequstUndo?showPlan=true", - }, - { - "backgroundColor": "", - "btmname": "hometask", - "countUrl": "priceIndexController/countNeedDispatch", - "name": "閲囪喘璋堜环-鍒嗘淳", - "nameOid": "BAD3108F-6F6B-F287-705C-82D69A5E030A", - "oid": "6093b1cb-bd7b-438b-8a76-05ab486ccf63", - "uiUrl": "USEJS:rpm/wrj/PurchaseRequstUndo?showPlan=true" - } - ] - this.listMyTask = data.map(record => { - record.style=record.style || '' - if(record.backgroundColor!=''){ - record.style = 'background-color:'+record.backgroundColor; - } - record.count=record.count || 0; - if(!this.countByServer){ - //鏄墠绔煡璇� - getList(record.countUrl,{}).then(res=>{ - if(res.data.data.success){ - record.count=res.data.data.obj; - }else{ - record.count=0 - } - }) + 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鍏冪礌 + }); + }); + }, + selectionChange(row) { + // console.log(row) + this.SelectRow = row; + }, + 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.option.data = []; + this.newData=[]; - } - return { - ...record + this.MasterGetList() + this.dialogTableVisible = false; + //瀛椾綋鍜岃竟妗嗛噸鏂板姞杞� + this.loading=true; + this.FontInfo() } }) + }, + MoreHandler() { + this.dialogTableVisible = true; + }, + // 闅忔満鑹� + 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 => { + // console.log(item.icon) + if (item.isDefault === 1) { + this.hexColor = this.randomColor(); + 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: this.hexColor, + uiUrl: item.menuRoute, + id: 'custom-title' + }); + } else if (item.isDefault === 0) { + this.newData.push(item); + this.Crud.data = this.newData; + } + }); + // console.log(this.option.data); + // console.log(this.newData); + }); } } } </script> <style scoped> -.el-col{margin-bottom: 0} -.box{ - text-align: center; - background: rgb(235, 238, 245); - color: #303133; - height: 70px; - margin: 10px 0!important; - padding: 15px 10px; - position: relative; - border-radius: 4px; - box-sizing: border-box; - font-size: 14px; -} -.value{ - font-size: 12px; - opacity: .69; - line-height: 20px; - margin-top: 5px; - display: block; -} + </style> -- Gitblit v1.9.3