diff --git a/hb_client/src/components/Gantt/dashGantt.vue b/hb_client/src/components/Gantt/dashGantt.vue index 4d84376..9bb04ed 100644 --- a/hb_client/src/components/Gantt/dashGantt.vue +++ b/hb_client/src/components/Gantt/dashGantt.vue @@ -299,6 +299,18 @@ } } , }, + watch: { + '$route.path': function (newVal) { + if(newVal==='/dashboard'){ + this.$refs.leftMenu.handlerSelect(this.list[0]); + this.$refs.chart.scrollTo({ + top: 0, + left: this.list[0].left - 30, + behavior: "smooth" + }); + } + } + }, data() { return { windowWidth:0, diff --git a/hb_client/src/views/dashboard/index.vue b/hb_client/src/views/dashboard/index.vue index d041f9a..a5cb9e0 100644 --- a/hb_client/src/views/dashboard/index.vue +++ b/hb_client/src/views/dashboard/index.vue @@ -4,7 +4,7 @@
数据统计
-
+
{{contractTotalCurrent}}
+
@@ -149,6 +152,8 @@
- - + + +
@@ -217,7 +228,7 @@
@@ -269,13 +280,13 @@
@@ -286,37 +297,29 @@
    -
  • +
  • - {{item.name}}2021-12-30 + {{item.name}}({{item.unit}})剩余{{item.count}},低于安全库存{{item.count_safe}}
-
    -
  • -
    - 某某批货临近交货日期2021-12-20 -
    -
  • +
    • - {{item}}2021-12-20 + {{item.name}}({{item.number}}){{item.delivery_date}}到交货日期
    -
      -
    • -
      - 某某批货临近过期2021-11-20 -
      -
    • +
      • - {{item}}2021-12-20 + {{item.name}}({{item.number}}){{item.delivery_date}}到期
      @@ -333,16 +336,13 @@ import echarts from 'echarts' import {mapGetters} from 'vuex'; import {getUserList} from "@/api/user"; - import {getPlanGantt} from "@/api/srm"; - import {getProcessYield} from "@/api/srm"; import {getMaterialList} from "@/api/mtm"; - // import {getInventoryList} from "@/api/inm"; import {getProductionplanList} from "@/api/pm"; import {getmaterialbatchList} from "@/api/inm"; import gantt from "@/components/Gantt/dashGantt"; import {getpEquipmentList} from "@/api/equipment"; - import {getContractList, getOrderList} from "@/api/sam"; - + import {getProcessYield ,getPlanGantt} from "@/api/srm"; + import {getContractList , getOrderList} from "@/api/sam"; export default { components: {gantt}, name: 'Dashboard', @@ -358,22 +358,22 @@ currentYear: null, currentMonth: null, currentDay: null, + pageCounts: 5, userPage: 1, userPageSize: 10, userTotal: 0, equipmentPage: 1, equipmentPageSize: 10, equipmentTotal: 0, - remindPage: 1, - remindPageSize: 20, - remindTotal: 0, + warningPage: 1, + warningPageSize: 10, + warningTotal: 0, tableIndex: null, chartIndex: null, tableDate: '2021-12', chartDate: [], proList: [], userList: [], - remindList: [], warningList: [], equipmentList: [], list: [ @@ -427,27 +427,47 @@ ]) }, watch: { - "$route": { - handler(route) { - if (route.name === 'dashboard') { - // that.handlerCheckList(this.list); - } + '$route.path': function (newVal) { + if(newVal==='/dashboard') { + this.getUserList();//用户列表 + this.getEquipmentList();//设备列表 + this.getGanttData();//甘特图数据 + this.getStatisticsData();//统计数据 + this.getNoticeData();//提醒列表 } } }, methods: { + setClass:function(check_date) { + let obj = {}; + if(check_date!=null){ + let dat = new Date(); + let time = dat.getTime(); + let check = new Date(check_date).getTime(); + let timeDiffer = (check-time)/1000/60/60/24; + if (4>timeDiffer&&timeDiffer>0) { + obj = 'warning'; + }else if (timeDiffer<0) { + obj = "danger"; + } + } + return obj; + }, getNoticeData() { this.ScrollUp(); }, ScrollUp() { - this.intNum = setInterval(() => { - this.animate = true; - setTimeout(() => { - this.list.push(this.list[0]); - this.list.shift(); - this.animate = false; - }, 500) - }, 1000); + let that = this; + that.intNum = setInterval(() => { + if(that.warningList.length>3){ + that.animate = true; + setTimeout(() => { + that.warningList.push(that.warningList[0]); + that.warningList.shift(); + that.animate = false; + }, 3000) + } + }, 3000); }, //鼠标移上去停止 Stop() { @@ -526,9 +546,11 @@ }); //获取库存警告 - getMaterialList({tag: 'low_inm'}).then((response) => { + getMaterialList({page: 1, page_size:that.warningPageSize,tag: 'low_inm'}).then((response) => { if (response.data) { + debugger; that.warningList = response.data.results; + that.warningTotal = response.data.count; } }); }, @@ -561,7 +583,7 @@ getUserList() { let that = this; that.listLoadingUser = true; - getUserList({page: that.userPage, page_size: that.userPageSize}).then((response) => { + getUserList({page: that.userPage, page_size: that.userPageSize, fields: 'id,name,dept_name,is_atwork'}).then((response) => { if (response.data) { that.userList = response.data.results; that.userTotal = response.data.count; @@ -575,7 +597,7 @@ let that = this; that.listLoadingUser = true; that.userPage = val; - getUserList({page: val, page_size: that.userPageSize}).then((response) => { + getUserList({page: val, page_size: that.userPageSize, fields: 'id,name,dept_name,is_atwork'}).then((response) => { if (response.data) { that.userList = response.data.results; that.userTotal = response.data.count; @@ -592,8 +614,8 @@ that.userList.push(that.userList[0]); that.userList.shift(); that.animateUser = false; - }, 500) - }, 1000); + }, 3000) + }, 3000); }, //鼠标移上去停止 stopScroll() { @@ -767,9 +789,9 @@ } else if (index === '3') { this.$router.push({name: 'management', params: {page: 1, page_size: 20}}) } else if (index === '4') { - this.$router.push({name: 'product', params: {page: 1, page_size: 20, material__type: 1}}) + this.$router.push({name: 'product'}) } else if (index === '5') { - this.$router.push({name: 'product', params: {page: 1, page_size: 20, material__type: 1}}) + this.$router.push({name: 'unproduct'}) } }, //便捷查询按钮 @@ -857,35 +879,39 @@ }, //提示 activeNameClick(tab) { + debugger; + debugger; let that = this; + that.warningPage = 1; + that.warningList = []; if (tab.label === '库存警告') { - getMaterialList({page: 0, tag: 'low_inm'}).then((response) => { + getMaterialList({page: 1, page_size:that.warningPageSize, tag: 'low_inm'}).then((response) => { if (response.data) { - that.warningList = response.data; - that.remindTotal = response.data.length; + that.warningList = response.data.results; + that.warningTotal = response.data.count; } }); } else if (tab.label === '临近交货') { - getmaterialbatchList({page: 0, tag: 'expired'}).then((response) => { + getOrderList({page: 1, page_size:that.warningPageSize,tag:'near_delivery'}).then((response) => { if (response.data) { - that.warningList = response.data; - that.remindTotal = response.data.length; + that.warningList = response.data.results; + that.warningTotal = response.data.count; } }); } else if (tab.label === '过期提醒') { - getmaterialbatchList({page: 0, tag: 'expired'}).then((response) => { + getmaterialbatchList({page: 1, page_size:that.warningPageSize, tag: 'expired'}).then((response) => { if (response.data) { - that.warningList = response.data; - that.remindTotal = response.data.length; + that.warningList = response.data.results; + that.warningTotal = response.data.count; } }); } }, - handleRemindSizeChange(val) { - this.remindPageSize = val; - this.remindPage = 1; + handleWarningSizeChange(val) { + this.warningPageSize = val; + this.warningPage = 1; }, - handleRemindCurrentChange(val) { + handleWarningCurrentChange(val) { console.log(`当前页: ${val}`); }, getGanttData() { @@ -976,16 +1002,13 @@ }, } -