hfxc226 3 years ago
parent
commit
cc167147ab

+ 24 - 35
src/views/dashboard/CheckJobReport.vue

@@ -4,19 +4,23 @@
       <div class="salesCard">
         <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
           <div class="extra-wrapper" slot="tabBarExtraContent">
-            <a-month-picker style="margin-left: 8px" v-model="queryParam.startMonth" placeholder="开始月份" @change="onStartChange" />
-            <a-month-picker style="margin-left: 8px" v-model="queryParam.endMonth" placeholder="结束月份" @change="onEndChange" />
+            <a-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultStartMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.startMonth"
+              placeholder="开始月份"
+              @change="onStartChange" />
+            <a-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultEndMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.endMonth"
+              placeholder="结束月份"
+              @change="onEndChange" />
             <a-button style="margin-left: 8px" type="default" @click="getData()">查询</a-button>
             <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrint()">打印</a-button>
             <a-button style="margin-left: 8px" type="primary" @click="doExport()">导出</a-button>
-            <a-select style="margin-left: 8px" @change="changeYear" v-model="queryParam.year" placeholder="请选择">
-              <a-select-option
-                v-for="item in years"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value">{{ item.label }}
-              </a-select-option>
-            </a-select>
             <a-select style="margin-left: 8px" @change="changeLevel" v-model="queryParam.standardLevel" placeholder="请选择">
               <a-select-option
                 v-for="(label,value) in levelMap"
@@ -69,6 +73,7 @@ import { getMonthReport, exportMonthReport } from '@/api/report/check-job'
 import { Chart } from '@antv/g2'
 import PrintInCheckJobReport from '@/views/dashboard/modules/PrintInCheckJobReport'
 import DetailCheckJobReport from '@/views/dashboard/modules/DetailCheckJobReport'
+import moment from 'moment'
 
 export default {
   name: 'Analysis',
@@ -87,8 +92,13 @@ export default {
     return {
       loading: false,
       serverData: [],
+      monthFormat: 'YYYY-MM',
+      defaultStartMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01',
+      defaultEndMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12',
       queryParam: {
         // year: 2021,
+        startMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01-01',
+        endMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12-01',
         standardLevel: 2
       },
       years: [],
@@ -135,35 +145,14 @@ export default {
   },
   created () {
     this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_LEVEL)
-    // this.initSelectYear()
   },
   mounted () {
-    // this.changeYear(this.queryParam.year)
+    this.$nextTick(function () {
+      this.getData()
+    })
   },
   methods: {
-    initSelectYear () {
-      var myDate = new Date()
-      this.queryParam.year = myDate.getFullYear()// 获取当前年
-      this.years = []
-      for (let i = 0; i < 5; i++) {
-        this.years.push({ value: (this.queryParam.year - i), label: (this.queryParam.year - i) + '年' })
-      }
-    },
-    changeYear (value) {
-      this.queryParam.year = value
-      getMonthReport(this.queryParam)
-        .then(res => {
-          this.chartsData = res.data
-
-          // 需要将数据分组:总数,完成数
-          const groupData = []
-          this.chartsData.forEach(function (data) {
-            groupData.push({ name: '总数', month: data.month, num: data.totalNum })
-            groupData.push({ name: '完成数', month: data.month, num: data.totalFinishNum })
-          })
-          this.getCharts('container', groupData)// 调用统计图
-        })
-    },
+    moment,
     changeLevel (value) {
       this.queryParam.standardLevel = value
       this.getData()

+ 25 - 28
src/views/dashboard/RepairReport.vue

@@ -4,19 +4,23 @@
       <div class="salesCard">
         <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
           <div class="extra-wrapper" slot="tabBarExtraContent">
-            <a-month-picker style="margin-left: 8px" v-model="queryParam.startMonth" placeholder="开始月份" @change="onStartChange" />
-            <a-month-picker style="margin-left: 8px" v-model="queryParam.endMonth" placeholder="结束月份" @change="onEndChange" />
+            <a-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultStartMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.startMonth"
+              placeholder="开始月份"
+              @change="onStartChange" />
+            <a-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultEndMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.endMonth"
+              placeholder="结束月份"
+              @change="onEndChange" />
             <a-button style="margin-left: 8px" type="default" @click="getData()">查询</a-button>
             <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrint()">打印</a-button>
             <a-button style="margin-left: 8px" type="primary" @click="doExport()">导出</a-button>
-            <a-select style="margin-left: 8px" @change="changeYear" v-model="queryParam.year" placeholder="请选择">
-              <a-select-option
-                v-for="item in years"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value">{{ item.label }}
-              </a-select-option>
-            </a-select>
           </div>
           <a-tab-pane loading="true" tab="图形统计" key="1">
             <a-row>
@@ -61,6 +65,7 @@ import { getMonthReportBig24, exportMonthReportBig24 } from '@/api/report/applic
 import { Chart } from '@antv/g2'
 import PrintInRepairReport from '@/views/dashboard/modules/PrintInRepairReport'
 import DetailRepairReport from '@/views/dashboard/modules/DetailRepairReport'
+import moment from 'moment'
 
 export default {
   name: 'Analysis',
@@ -86,11 +91,15 @@ export default {
     return {
       loading: false,
       serverData: [],
+      monthFormat: 'YYYY-MM',
+      defaultStartMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01',
+      defaultEndMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12',
       queryParam: {
         // year: 2021,
+        startMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01-01',
+        endMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12-01',
         searchType: this.searchType
       },
-      years: [],
       visible: true,
       chart: null, // 创建一个chart变量
       chartsData: [],
@@ -117,28 +126,16 @@ export default {
     }
   },
   created () {
-    // this.initSelectYear()
   },
   mounted () {
-    // this.changeYear(this.queryParam.year)
+    this.$nextTick(function () {
+      this.getData()
+    })
   },
   methods: {
-    initSelectYear () {
-      var myDate = new Date()
-      this.queryParam.year = myDate.getFullYear()// 获取当前年
-      this.years = []
-      for (let i = 0; i < 5; i++) {
-        this.years.push({ value: (this.queryParam.year - i), label: (this.queryParam.year - i) + '年' })
-      }
-    },
-    changeYear (value) {
-      this.queryParam.year = value
-      this.getData()
-    },
+    moment,
     onStartChange (date, dateString) {
-      this.$nextTick(() => {
-        this.queryParam.startMonth = this.BaseTool.Date.formatter(dateString + '-01', this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
-      })
+      this.queryParam.startMonth = this.BaseTool.Date.formatter(dateString + '-01', this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
     },
     onEndChange (date, dateString) {
       this.queryParam.endMonth = this.BaseTool.Date.formatter(dateString + '-01', this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)

+ 26 - 28
src/views/dashboard/RepairReportFee.vue

@@ -4,17 +4,20 @@
       <div class="salesCard">
         <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
           <div class="extra-wrapper" slot="tabBarExtraContent">
-
-            <!--            <a-select style="margin-left: 8px" @change="changeYear" v-model="queryParam.year" placeholder="请选择">
-              <a-select-option
-                v-for="item in years"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value">{{ item.label }}
-              </a-select-option>
-            </a-select>-->
-            <a-month-picker style="margin-left: 8px" v-model="queryParam.startMonth" placeholder="开始月份" @change="onStartChange" />
-            <a-month-picker style="margin-left: 8px" v-model="queryParam.endMonth" placeholder="结束月份" @change="onEndChange" />
+            <a-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultStartMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.startMonth"
+              placeholder="开始月份"
+              @change="onStartChange" />
+            <a-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultEndMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.endMonth"
+              placeholder="结束月份"
+              @change="onEndChange" />
             <a-button style="margin-left: 8px" type="default" @click="getData()">查询</a-button>
             <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrint()">打印</a-button>
             <a-button style="margin-left: 8px" type="primary" @click="doExport()">导出</a-button>
@@ -62,6 +65,7 @@ import { getMonthReportFee, exportMonthReportFee } from '@/api/report/repair-fee
 import { Chart } from '@antv/g2'
 import PrintInRepairReportFee from '@/views/dashboard/modules/PrintInRepairReportFee'
 import DetailRepairReportFee from '@/views/dashboard/modules/DetailRepairReportFee'
+import moment from 'moment'
 
 export default {
   name: 'RepairReportFee',
@@ -80,9 +84,15 @@ export default {
     return {
       loading: false,
       serverData: [],
+      monthFormat: 'YYYY-MM',
+      defaultStartMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01',
+      defaultEndMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12',
       queryParam: {
+        // year: 2021,
+        startMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01-01',
+        endMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12-01',
+        searchType: this.searchType
       },
-      years: [],
       visible: true,
       chart: null, // 创建一个chart变量
       chartsData: [],
@@ -119,26 +129,14 @@ export default {
     }
   },
   created () {
-    // this.initSelectYear()
   },
   mounted () {
-    // this.changeYear(this.queryParam.year)
+    this.$nextTick(function () {
+      this.getData()
+    })
   },
   methods: {
-    initSelectYear () {
-      const myDate = new Date()
-      // this.queryParam.year = myDate.getFullYear()// 获取当前年
-      this.queryParam.startMonth = myDate.getFullYear() + '-01-01'
-      this.queryParam.endMonth = myDate.getFullYear() + '-12-01'
-      this.years = []
-      for (let i = 0; i < 5; i++) {
-        this.years.push({ value: (this.queryParam.year - i), label: (this.queryParam.year - i) + '年' })
-      }
-    },
-    changeYear (value) {
-      this.queryParam.year = value
-      this.getData()
-    },
+    moment,
     onStartChange (date, dateString) {
       this.$nextTick(() => {
         this.queryParam.startMonth = this.BaseTool.Date.formatter(dateString + '-01', this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)

+ 25 - 28
src/views/dashboard/RepairReportMttr.vue

@@ -4,17 +4,20 @@
       <div class="salesCard">
         <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
           <div class="extra-wrapper" slot="tabBarExtraContent">
-
-            <!--            <a-select style="margin-left: 8px" @change="changeYear" v-model="queryParam.year" placeholder="请选择">
-              <a-select-option
-                v-for="item in years"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value">{{ item.label }}
-              </a-select-option>
-            </a-select>-->
-            <a-month-picker style="margin-left: 8px" v-model="queryParam.startMonth" placeholder="开始月份" @change="onStartChange" />
-            <a-month-picker style="margin-left: 8px" v-model="queryParam.endMonth" placeholder="结束月份" @change="onEndChange" />
+            <a-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultStartMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.startMonth"
+              placeholder="开始月份"
+              @change="onStartChange" />
+            <a-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultEndMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.endMonth"
+              placeholder="结束月份"
+              @change="onEndChange" />
             <a-button style="margin-left: 8px" type="default" @click="getData()">查询</a-button>
             <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrint()">打印</a-button>
             <a-button style="margin-left: 8px" type="primary" @click="doExport()">导出</a-button>
@@ -62,6 +65,7 @@ import { getMonthReportMttr, exportMonthReportMttr } from '@/api/report/applicat
 import { Chart } from '@antv/g2'
 import PrintInRepairReportMttr from '@/views/dashboard/modules/PrintInRepairReportMttr'
 import DetailRepairReport from '@/views/dashboard/modules/DetailRepairReport'
+import moment from 'moment'
 
 export default {
   name: 'Analysis',
@@ -80,9 +84,14 @@ export default {
     return {
       loading: false,
       serverData: [],
+      monthFormat: 'YYYY-MM',
+      defaultStartMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01',
+      defaultEndMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12',
       queryParam: {
+        // year: 2021,
+        startMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01-01',
+        endMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12-01'
       },
-      years: [],
       visible: true,
       chart: null, // 创建一个chart变量
       chartsData: [],
@@ -119,26 +128,14 @@ export default {
     }
   },
   created () {
-    // this.initSelectYear()
   },
   mounted () {
-    // this.changeYear(this.queryParam.year)
+    this.$nextTick(function () {
+      this.getData()
+    })
   },
   methods: {
-    initSelectYear () {
-      const myDate = new Date()
-      // this.queryParam.year = myDate.getFullYear()// 获取当前年
-      this.queryParam.startMonth = myDate.getFullYear() + '-01-01'
-      this.queryParam.endMonth = myDate.getFullYear() + '-12-01'
-      this.years = []
-      for (let i = 0; i < 5; i++) {
-        this.years.push({ value: (this.queryParam.year - i), label: (this.queryParam.year - i) + '年' })
-      }
-    },
-    changeYear (value) {
-      this.queryParam.year = value
-      this.getData()
-    },
+    moment,
     onStartChange (date, dateString) {
       this.$nextTick(() => {
         this.queryParam.startMonth = this.BaseTool.Date.formatter(dateString + '-01', this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)

+ 3 - 0
src/views/dashboard/modules/DetailCheckJobReport.vue

@@ -7,6 +7,9 @@
     @cancel="handleCancel"
   >
     <title-divider title="明细列表" width="90px"></title-divider>
+    <div class="table-operator">
+      <a-button v-if="$auth('check-polling-jobs-add')" type="primary" icon="download" style="margin-bottom: 10px">导出</a-button>
+    </div>
     <a-table
       bordered
       :data-source="data"