Browse Source

Merge remote-tracking branch 'origin/demo_' into demo_

hfxc226 2 years ago
parent
commit
8eb4ac238d

+ 10 - 0
src/api/check/checkstandard.js

@@ -143,6 +143,16 @@ export function fetchCheckStandard (parameter) {
   })
 }
 
+export function addBYTask (parameter) {
+  return axios({
+    url: '/check/standards/add/' + parameter.id,
+    method: 'post',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
 /**
  * fetch single func
  * parameter: { }

+ 10 - 2
src/views/check/checkstandard/CheckStandard.vue

@@ -144,7 +144,9 @@
           <template>
             <a @click="handleView(record)">查看</a>
             <a-divider type="vertical"/>
-            <a @click="handleViewCheckJob(record)">保养任务</a>
+            <!--            <a  @click="handleViewCheckJob(record)">保养任务</a>-->
+            <a v-if="record.isGet==1" @click="handleViewCheckJob(record)">保养任务</a>
+            <a v-if="record.isGet==0" @click="addBYTask(record)">生成保养任务</a>
             <a-divider type="vertical"/>
             <a v-if="($auth('check-spot-standards-edit')||$auth('check-polling-standards-edit'))" @click="handleEdit(record)">修改</a>
             <a-divider type="vertical"/>
@@ -177,7 +179,8 @@ import {
   deleteCheckStandards,
   updateCheckStandardNo,
   fetchCheckStandard,
-  exportCheckStandard
+  exportCheckStandard,
+  addBYTask
 } from '@/api/check/checkstandard'
 import DetailStandardCheckJob from '@/views/check/checkjob/modules/DetailStandardCheckJob'
 import { fetchSbTypeTree } from '@/api/sb/type'
@@ -357,6 +360,11 @@ export default {
     this.tableOption()
   },
   methods: {
+    addBYTask (record) {
+      addBYTask({ id: record.id }).then(res => {
+        this.$refs.table.refresh(true)
+      })
+    },
     tableOption () {
       if (!this.optionAlertShow) {
         this.options = {

+ 10 - 13
src/views/workplace/backlog/StoreWorkplaceBacklog.vue

@@ -358,10 +358,8 @@ export default {
   updated () {
     if (this.lineData.length > 0 && this.equipmentData.length > 0) {
       this.$nextTick(function () {
-        console.log(1111)
         this.getPieCharts('container-pie', this.equipmentData)
         this.getLineCharts('container-line', this.lineData)
-        console.log(1111)
       })
     }
   },
@@ -369,14 +367,14 @@ export default {
     getDict () {
       this.typeDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE)
       this.typeDetailDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE)
-      getWorkplaceBacklogTopData(this.role).then(res => {
-        this.topData = res.data
-        console.log(this.topData)
-      })
     },
     getInfo () {
-      getWorkplaceBacklogWeekData(this.role).then(res => {
-        const data = res.data.inStoreDetailVOS.reduce((pre, item) => {
+      Promise.all([
+        getWorkplaceBacklogWeekData(this.role),
+        getWorkplaceBacklogPie(this.role),
+        getWorkplaceBacklogTopData(this.role)
+      ]).then(res => {
+        const data = res[0].data.inStoreDetailVOS.reduce((pre, item) => {
           pre.push({
             week: item.weekDayName,
             value: item.num,
@@ -385,7 +383,7 @@ export default {
           return pre
         }, [])
         data.push(
-          ...res.data.outStoreDetailVOS.reduce((pre, item) => {
+          ...res[0].data.outStoreDetailVOS.reduce((pre, item) => {
             pre.push({
               week: item.weekDayName,
               value: item.num,
@@ -396,9 +394,7 @@ export default {
           }, [])
         )
         this.lineData = data
-      })
-      getWorkplaceBacklogPie(this.role).then(res => {
-        const data = res.data.reduce((pre, item) => {
+        const data2 = res[1].data.reduce((pre, item) => {
           pre.push({
             item: item.name,
             count: item.currentStock,
@@ -406,7 +402,8 @@ export default {
           })
           return pre
         }, [])
-        this.equipmentData = data
+        this.equipmentData = data2
+        this.topData = res[2].data
       })
     },
     getPieCharts (id, data) {