chenrui il y a 1 an
Parent
commit
65702379e0

+ 2 - 2
src/api/reportData.js

@@ -1281,9 +1281,9 @@ export const outDetailList = (params) => {
   })
 }
 // 轮胎明细报表  导出
-export const tireDetailListExport = (params) => {
+export const tireListExport = (params) => {
   return axios({
-    url: '/report/tireRptDealerProductDay/importDetail',
+    url: '/report/tireRptDealerProductDay/importExcel',
     data: params,
     method: 'post',
     responseType: 'blob',

+ 14 - 3
src/views/reportData/tireSalesReport/detailList.vue

@@ -167,7 +167,7 @@ import BizUser from '@/views/common/bizUser.js'
 import reportModal from '@/views/common/reportModal.vue'
 import outDetailModal from './outDetailModal'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { queryTireCount, tireDetailListExport, tireReportDetailList } from '@/api/reportData'
+import { queryTireCount, tireListExport, tireReportDetailList } from '@/api/reportData'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 export default {
   name: 'TireSalesDealerList',
@@ -197,7 +197,6 @@ export default {
         productWord: '', // 产品编码/原厂编码
         productName: '' // 产品名称
       },
-
       exportLoading: false,
       showExport: false,
       rules: {
@@ -376,13 +375,25 @@ export default {
     },
     //  导出
     handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.exportList()
+        } else {
+          _this.$message.error('请选择日期')
+          return false
+        }
+      })
+    },
+    exportList () {
       const _this = this
       const params = _this.queryParam
       _this.exportLoading = true
       _this.spinning = true
       _this.showExport = true
       _this.$store.state.app.curActionPermission = 'B_tireSalesReportExport'
-      hdExportExcel(tireDetailListExport, params, '轮胎明细报表', function () {
+      params.exportFlag = 1
+      hdExportExcel(tireListExport, params, '轮胎明细报表', function () {
         _this.exportLoading = false
         _this.spinning = false
         _this.$store.state.app.curActionPermission = ''

+ 0 - 12
src/views/reportData/tireSalesReport/index.vue

@@ -13,7 +13,6 @@
     </a-card>
   </div>
 </template>
-
 <script>
 import { commonMixin } from '@/utils/mixin'
 import tireList from './list'
@@ -31,17 +30,6 @@ export default {
     handleChange (val) {
       this.tabVal = val
     }
-  },
-  mounted () {
-    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-
-    }
-  },
-  activated () {
-    // 如果是新页签打开,则重置当前页面
-    if (this.$store.state.app.isNewTab) {
-
-    }
   }
 }
 

+ 38 - 26
src/views/reportData/tireSalesReport/list.vue

@@ -8,11 +8,12 @@
           ref="ruleForm"
           class="form-model-con"
           layout="inline"
+          :rules="rules"
           :model="queryParam">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="日期">
-                <rangeDate ref="rangeDate" :showTime="false" :value="time" @change="dateChange" />
+              <a-form-model-item label="日期" prop="time">
+                <rangeDate ref="rangeDate" :showTime="false" :value="queryParam.time" @change="dateChange" />
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -129,7 +130,6 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import getDate from '@/libs/getDate.js'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import subarea from '@/views/common/subarea.js'
@@ -137,7 +137,7 @@ import AreaList from '@/views/common/areaList.js'
 import BizUser from '@/views/common/bizUser.js'
 import reportModal from '@/views/common/reportModal.vue'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { tireReportList, queryTireCount, excelTireOnlineExport } from '@/api/reportData'
+import { tireReportList, queryTireCount, tireListExport } from '@/api/reportData'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 export default {
   name: 'TireSalesDealerList',
@@ -148,13 +148,10 @@ export default {
       spinning: false,
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0,
-      time: [
-        getDate.getThreeMonthDaysInfo().starttime,
-        getDate.getCurrMonthDaysInfo().endtime
-      ],
       queryParam: { //  查询条件
-        bizBeginDate: getDate.getThreeMonthDaysInfo().starttime.replace(/-/g, ''),
-        bizEndDate: getDate.getCurrMonthDaysInfo().endtime.replace(/-/g, ''),
+        time: [],
+        bizBeginDate: '',
+        bizEndDate: '',
         provinceSn: undefined,
         citySn: undefined,
         districtSn: undefined,
@@ -170,11 +167,16 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false,
       showExport: false,
+      rules: {
+        'time': [{ required: true, message: '请选择日期', trigger: 'change' }]
+      },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        const params = Object.assign(parameter, this.queryParam)
+        const oldParams = Object.assign(parameter, this.queryParam)
+        const params = JSON.parse(JSON.stringify(oldParams))
+        delete params.time
         return tireReportList(params).then(res => {
           let data
           if (res.status == 200 && res.data) {
@@ -270,15 +272,15 @@ export default {
       this.queryParam.citySn = val[1] ? val[1] : undefined
       this.queryParam.districtSn = val[2] ? val[2] : undefined
     },
-    //  下推时间  change
+    //  日期选择  change
     dateChange (date) {
       if (date[0] && date[1]) {
-        this.time = date
+        this.queryParam.time = date
       } else {
-        this.time = []
+        this.queryParam.time = []
       }
-      this.queryParam.bizBeginDate = date[0].replace(/-/g, '') || ''
-      this.queryParam.bizEndDate = date[1].replace(/-/g, '') || ''
+      this.queryParam.bizBeginDate = date[0] ? date[0].replace(/-/g, '') : ''
+      this.queryParam.bizEndDate = date[1] ? date[1].replace(/-/g, '') : ''
     },
     subareaChange (val) {
       this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
@@ -286,13 +288,10 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.time = [
-        getDate.getThreeMonthDaysInfo().starttime,
-        getDate.getCurrMonthDaysInfo().endtime
-      ]
-      this.$refs.rangeDate.resetDate(this.time)
-      this.queryParam.bizBeginDate = getDate.getThreeMonthDaysInfo().starttime.replace(/-/g, '')
-      this.queryParam.bizEndDate = getDate.getCurrMonthDaysInfo().endtime.replace(/-/g, '')
+      this.queryParam.time = []
+      this.$refs.rangeDate.resetDate()
+      this.queryParam.bizBeginDate = ''
+      this.queryParam.bizEndDate = ''
       this.queryParam.provinceSn = undefined
       this.queryParam.citySn = undefined
       this.queryParam.districtSn = undefined
@@ -306,19 +305,33 @@ export default {
       this.$refs.areaList.clearData()
       if (this.advanced) {
         this.$refs.dealerSubareaScopeList.resetForm()
-        this.$refs.subarea.clearData()
       }
+
+      this.$refs.subarea.clearData()
       this.$refs.table.clearTable()
     },
     //  导出
     handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.exportList()
+        } else {
+          _this.$message.error('请选择日期')
+          return false
+        }
+      })
+    },
+    //  导出
+    exportList () {
       const _this = this
       const params = _this.queryParam
       _this.exportLoading = true
       _this.spinning = true
       _this.showExport = true
       _this.$store.state.app.curActionPermission = 'B_tireSalesReportExport'
-      hdExportExcel(excelTireOnlineExport, params, '轮胎统计报表', function () {
+      params.exportFlag = 0
+      hdExportExcel(tireListExport, params, '轮胎统计报表', function () {
         _this.exportLoading = false
         _this.spinning = false
         _this.$store.state.app.curActionPermission = ''
@@ -329,7 +342,6 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
-      this.resetSearchForm()
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight