whj 1 рік тому
батько
коміт
84db5c694e

+ 64 - 0
src/api/preparation/preparation.js

@@ -111,6 +111,70 @@ export function getPreparationReportGroupByStatus (parameter) {
     }
   })
 }
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+  * @returns {*}
+ */
+export function exportAllPreparationReport (parameter) {
+  return axios({
+    url: '/preparation/preparations/getAllPreparationReport/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+  * @returns {*}
+ */
+export function exportPreparationReportGroupByStatus (parameter) {
+  return axios({
+    url: '/preparation/preparations/getPreparationReportGroupByStatus/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+  * @returns {*}
+ */
+export function exportPreparationReportGroupByStatusDetail (parameter) {
+  return axios({
+    url: '/preparation/preparations/getPreparationReportGroupByStatus/detail/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+  * @returns {*}
+ */
+export function exportPreparationDetailReport (parameter) {
+  return axios({
+    url: '/preparation/preparations/getPreparationDetailReport/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}
 /**
  * delete batch func
  * parameter: { }

+ 51 - 6
src/views/preparation/report/PreparationReport.vue

@@ -17,8 +17,8 @@
             placeholder="结束时间"
           />
           <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-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>
         </div>
         <a-tab-pane loading="true" tab="图形统计" key="1">
           <a-row>
@@ -41,7 +41,9 @@
                   :scroll="{x: 1000, y: BaseTool.Constant.scrollY }"
                   rowKey="month">
                   <span slot="action" slot-scope="record">
-
+                    <a @click="handleView(record)">查看明细</a>
+                    <a-divider type="vertical" />
+                    <a @click="doExportDetail(record)">导出</a>
                   </span>
                 </a-table>
               </div>
@@ -50,13 +52,17 @@
         </a-tab-pane>
       </a-tabs>
     </div>
+    <Detail ref="detail" />
   </a-card>
 </template>
 
 <script>
-import { getPreparationReportGroupByStatus, getAllPreparationReport } from '@/api/preparation/preparation'
-
+import { getPreparationReportGroupByStatus, getAllPreparationReport, exportAllPreparationReport, exportPreparationDetailReport } from '@/api/preparation/preparation'
+import Detail from './modules/Detail.vue'
 export default {
+  components: {
+    Detail
+  },
   data () {
     return {
       loading: false,
@@ -79,6 +85,13 @@ export default {
           title: '个数',
           width: 120,
           dataIndex: 'num'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
         }
       ],
       columns2: [
@@ -187,8 +200,40 @@ export default {
         this.chartsData1 = res[0].data
         this.chartsData2 = res[1].data
       })
+    },
+    handleView (record) {
+      console.log(record)
+      this.$refs.detail.base(record)
+    },
+    doExport () {
+      if (this.queryParam.startMonth) {
+        this.queryParam.startMonth = this.BaseTool.Date.formatter(this.queryParam.startMonth, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      }
+      if (this.queryParam.endMonth) {
+        this.queryParam.endMonth = this.BaseTool.Date.formatter(this.queryParam.endMonth, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      }
+      const parameter = {
+        ...this.queryParam
+      }
+      exportAllPreparationReport(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    },
+    doExportDetail (record) {
+      if (this.queryParam.startMonth) {
+        this.queryParam.startMonth = this.BaseTool.Date.formatter(this.queryParam.startMonth, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      }
+      if (this.queryParam.endMonth) {
+        this.queryParam.endMonth = this.BaseTool.Date.formatter(this.queryParam.endMonth, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      }
+      const parameter = {
+        ...this.queryParam,
+        yearMonth: record.year + '-' + record.month
+      }
+      exportPreparationDetailReport(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
     }
-
   }
 }
 </script>

+ 58 - 5
src/views/preparation/report/PreparationReportPie.vue

@@ -17,8 +17,8 @@
             placeholder="结束时间"
           />
           <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-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>
         </div>
         <a-tab-pane loading="true" tab="图形统计" key="1">
           <a-row>
@@ -41,7 +41,9 @@
                   :scroll="{x: 1000, y: BaseTool.Constant.scrollY }"
                   rowKey="month">
                   <span slot="action" slot-scope="record">
-
+                    <a @click="handleView(record)">查看明细</a>
+                    <a-divider type="vertical" />
+                    <a @click="doExportDetail(record)">导出</a>
                   </span>
                 </a-table>
               </div>
@@ -50,13 +52,19 @@
         </a-tab-pane>
       </a-tabs>
     </div>
+    <Detail ref="detail" />
+
   </a-card>
 </template>
 
 <script>
-import { getPreparationReportGroupByStatus, getAllPreparationReport } from '@/api/preparation/preparation'
+import { getPreparationReportGroupByStatus, getAllPreparationReport, exportPreparationReportGroupByStatus, exportPreparationReportGroupByStatusDetail } from '@/api/preparation/preparation'
+import Detail from './modules/Detail.vue'
 
 export default {
+  components: {
+    Detail
+  },
   data () {
     return {
       loading: false,
@@ -91,6 +99,13 @@ export default {
           title: '个数',
           width: 120,
           dataIndex: 'num'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
         }
       ]
     }
@@ -160,6 +175,11 @@ export default {
             itemStyle: {
               borderRadius: 8
             },
+            label: {
+              formatter: '{b}: {c}',
+              fontSize: 16
+
+            },
             data: this.chartsData2.map(item => {
               return {
                 value: item.num,
@@ -187,8 +207,41 @@ export default {
         this.chartsData1 = res[0].data
         this.chartsData2 = res[1].data
       })
-    }
+    },
+    handleView (record) {
+      console.log(record)
+      this.$refs.detail.base(record)
+    },
+    doExport () {
+      if (this.queryParam.startMonth) {
+        this.queryParam.startMonth = this.BaseTool.Date.formatter(this.queryParam.startMonth, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      }
+      if (this.queryParam.endMonth) {
+        this.queryParam.endMonth = this.BaseTool.Date.formatter(this.queryParam.endMonth, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      }
+      const parameter = {
+        ...this.queryParam
+      }
+      exportPreparationReportGroupByStatus(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    },
+    doExportDetail (record) {
+      if (this.queryParam.startMonth) {
+        this.queryParam.startMonth = this.BaseTool.Date.formatter(this.queryParam.startMonth, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      }
+      if (this.queryParam.endMonth) {
+        this.queryParam.endMonth = this.BaseTool.Date.formatter(this.queryParam.endMonth, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+      }
+      const parameter = {
+        ...this.queryParam,
+        status: record.status
 
+      }
+      exportPreparationReportGroupByStatusDetail(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    }
   }
 }
 </script>

+ 101 - 0
src/views/preparation/report/modules/Detail.vue

@@ -0,0 +1,101 @@
+<template>
+  <a-modal
+    :width="1000"
+    :visible="visible"
+    title="详情"
+    :confirmLoading="confirmLoading"
+    :footer="null"
+    @cancel="handleCancel" >
+    <a-table
+      bordered
+      :data-source="list"
+      :columns="columns"
+      tableLayout="auto"
+      rowKey="id">
+      <span slot="status" slot-scope="text">
+        <badge :text="BaseTool.Object.getField(statusMap,text)" :status="DictCache.COLOR.REPAIR_FORM_STATUS[text]"/>
+      </span>
+    </a-table>
+  </a-modal>
+</template>
+
+<script>
+export default {
+  data () {
+    return {
+      visible: false,
+      confirmLoading: false,
+      list: [],
+      statusMap: {},
+      preparationMap: {},
+      columns: [
+        {
+          title: '申请人',
+          checked: true,
+          width: '150',
+          dataIndex: 'userName'
+        },
+        {
+          title: '公司',
+          checked: true,
+          width: '200',
+          dataIndex: 'parentPositionId',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.preparationMap, text)
+          }
+        },
+        {
+          title: '申请部门',
+          checked: true,
+          width: '150',
+          dataIndex: 'deptName'
+        },
+        {
+          title: '建筑物',
+          checked: true,
+          width: '150',
+          dataIndex: 'positionName'
+        },
+        {
+          title: '报修时间',
+          checked: true,
+          width: '150',
+          dataIndex: 'applyTime'
+        },
+        {
+          title: '要求完成日期',
+          checked: true,
+          width: '150',
+          dataIndex: 'limitHours'
+        },
+        {
+          title: '报修状态',
+          checked: true,
+          dataIndex: 'status',
+          width: 150,
+          scopedSlots: { customRender: 'status' }
+        }
+      ]
+    }
+  },
+  created () {
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_PREPARATION_STATUS)
+    this.preparationMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PREPARATION_PARENT)
+  },
+  methods: {
+    base (record) {
+      console.log(record.detailList)
+      this.visible = true
+      this.list = record.detailList
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+    }
+  }
+}
+</script>
+
+<style>
+
+</style>