浏览代码

问题修改

mfmf 3 年之前
父节点
当前提交
dcd1872146
共有 3 个文件被更改,包括 8 次插入40 次删除
  1. 1 1
      src/api/index.js
  2. 1 1
      src/components/DocTemplate/index.js
  3. 6 38
      src/components/DutyRecord/index.js

+ 1 - 1
src/api/index.js

@@ -2,7 +2,7 @@ import api from './request';
 import { getCookie,setCookie } from '@utils/index'
 import { Modal } from 'antd';
 const axios=require('axios');
-// axios.defaults.baseURL = 'http://192.168.2.237:8871';//'http://192.168.2.237:8871/';
+axios.defaults.baseURL = 'http://192.168.2.237:8871';//'http://192.168.2.237:8871/';
 const CancelToken = axios.CancelToken;
 const source = CancelToken.source();
 const post=(url,data)=>{

+ 1 - 1
src/components/DocTemplate/index.js

@@ -47,7 +47,7 @@ function DocTemplate() {
 	  hide();
 	  if (res.data.code === 200) {
 		const data = res.data.data;
-		if(data.type===2){					//模板类型,0:未知,1:html,2:xml
+		if(data.type==="2"){					//模板类型,0:未知,1:html,2:xml
 		  setVisible(flag);
 		  setTmplInfo(data);
 		}else{

+ 6 - 38
src/components/DutyRecord/index.js

@@ -42,45 +42,12 @@ function DutyRecord() {
 	}
 	
 	function getlastmonthday(){
-		var now=new Date();
-		  var year = now.getFullYear();//getYear()+1900=getFullYear()
-		  var month = now.getMonth() +1;//0-11表示1-12月
-		  var day = now.getDate();
-		  if(parseInt(month)<10){
-		      month="0"+month;
-		  }
-		  if(parseInt(day)<10){
-		      day="0"+day;
-		  }
-		  now =year + '-'+ month + '-' + day;
-		  if (parseInt(month) ==1) {//如果是1月份,则取上一年的12月份
-		      return (parseInt(year) - 1) + '-12-' + day;
-		  }
-		  var  preSize= new Date(year, parseInt(month)-1, 0).getDate();//上月总天数
-		  if (preSize < parseInt(day)) {//上月总天数<本月日期,比如3月的30日,在2月中没有30
-		       return year + '-' + month + '-01';
-		  }
-		 
-		  if(parseInt(month) <=10){
-		      return year + '-0' + (parseInt(month)-1) + '-' + day;
-		  }else{
-		      return year + '-' + (parseInt(month)-1) + '-' + day;
-		  }
+		let time = new Date((new Date() - 30 * 24 * 3600 * 1000)).toLocaleDateString()
+		return time
 	}
 	function getNowFormatDate() {
-	      var date = new Date();
-	      var seperator1 = "-";
-	      var year = date.getFullYear();
-	      var month = date.getMonth() + 1;
-	      var strDate = date.getDate();
-	      if (month >= 1 && month <= 9) {
-	        month = "0" + month;
-	      }
-	      if (strDate >= 0 && strDate <= 9) {
-	        strDate = "0" + strDate;
-	      }
-	      var currentdate = year + seperator1 + month + seperator1 + strDate;
-	      return currentdate;
+	      let time = new Date().toLocaleDateString()
+	      return time
 	    }
 	//表格数据
 	function getDutyRecord(param) {
@@ -214,7 +181,6 @@ function DutyRecord() {
 							<Form.Item label="变更类型" name="type">
 								<Select
 									placeholder="请选择"
-									allowClear
 								>
 									<Option value="" key={0}>全部</Option>
 									<Option value="1" key={1}>{typeMap['1']}</Option>
@@ -228,6 +194,8 @@ function DutyRecord() {
 									defaultValue={[moment(lastmonthday), moment(today)]}
 									disabledDate={disabledDate}
 									placeholder={['开始时间', '结束时间']}
+									allowClear={false}
+									inputReadOnly={true}
 								/>
 							</Form.Item>
 						</Col>