wang_xy 1 gadu atpakaļ
vecāks
revīzija
506081edb6
3 mainītis faili ar 24 papildinājumiem un 2 dzēšanām
  1. 2 1
      src/main.js
  2. 1 1
      src/utils/request.js
  3. 21 0
      src/utils/ruoyi.js

+ 2 - 1
src/main.js

@@ -18,7 +18,7 @@ import './assets/icons' // icon
 import './permission' // permission control
 import { getDicts } from "@/api/system/dict/data";
 import { getConfigKey, updateConfigByKey } from "@/api/system/config";
-import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
+import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree,addDateRangeAvue } from "@/utils/ruoyi";
 // 分页组件
 import Pagination from "@/components/Pagination";
 // 自定义表格工具组件
@@ -47,6 +47,7 @@ Vue.prototype.updateConfigByKey = updateConfigByKey
 Vue.prototype.parseTime = parseTime
 Vue.prototype.resetForm = resetForm
 Vue.prototype.addDateRange = addDateRange
+Vue.prototype.addDateRangeAvue = addDateRangeAvue
 Vue.prototype.selectDictLabel = selectDictLabel
 Vue.prototype.selectDictLabels = selectDictLabels
 Vue.prototype.download = download

+ 1 - 1
src/utils/request.js

@@ -19,7 +19,7 @@ const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
   baseURL: process.env.VUE_APP_BASE_API,
   // 超时
-  timeout: 20000
+  timeout: 360000
 })
 
 // request拦截器

+ 21 - 0
src/utils/ruoyi.js

@@ -68,6 +68,27 @@ export function addDateRange(params, dateRange, propName) {
   return search;
 }
 
+// 添加日期范围avue用
+export function addDateRangeAvue(params, key, propName) {
+  let search = params;
+  search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
+  let dateRange = [];
+  if(params.hasOwnProperty(key)){
+    const date = search[key];
+    dateRange.push(date[0])
+    dateRange.push(date[1])
+    delete params[key];
+  }
+  if (typeof (propName) === 'undefined') {
+    search.params['beginTime'] = dateRange[0];
+    search.params['endTime'] = dateRange[1];
+  } else {
+    search.params['begin' + propName] = dateRange[0];
+    search.params['end' + propName] = dateRange[1];
+  }
+  return search;
+}
+
 // 回显数据字典
 export function selectDictLabel(datas, value) {
   if (value === undefined) {