Browse Source

职务职称变更记录问题修改

莫凡 3 years ago
parent
commit
05738ce36b
2 changed files with 61 additions and 4 deletions
  1. 3 0
      src/common/common.less
  2. 58 4
      src/components/DutyRecord/index.js

+ 3 - 0
src/common/common.less

@@ -61,6 +61,9 @@ body {
     }
   }
 }
+.ant-table-body {
+  overflow: auto !important
+}
 .ant-table-pagination-right {
   justify-content: flex-start;
 }

+ 58 - 4
src/components/DutyRecord/index.js

@@ -13,6 +13,8 @@ function DutyRecord() {
 	useEffect(() => {
 		getDutyRecord();
 	}, []);
+	let today = getNowFormatDate()
+	let lastmonthday= getlastmonthday()
 	const [logList, setLogList] = useState([]);
 	const [total, setTotal] = useState(0);
 	const [visible, setVisible] = useState(false);
@@ -20,6 +22,8 @@ function DutyRecord() {
 	const [current, setCurrent] = useState(1);
 	const [selectedRowKeys, setSelectedRowKeys] = useState([]);
 	const [params, setParams] = useState({
+		changeTimeEnd:today+" 23:23:59",
+		changeTimeStart:lastmonthday+" 00:00:00",
 		pages: 1,
 		current: 1,
 		size: 15
@@ -30,10 +34,54 @@ function DutyRecord() {
 		'2': '职称变更'
 	};
 	let data = {
+		changeTimeEnd:today+" 23:23:59",
+		changeTimeStart:lastmonthday+" 00:00:00",
 		pages: 1,
 		current: 1,
 		size: size
 	}
+	
+	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;
+		  }
+	}
+	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;
+	    }
 	//表格数据
 	function getDutyRecord(param) {
 		post(api.getOfficialCapacityPage, param || params).then((res) => {
@@ -88,16 +136,21 @@ function DutyRecord() {
 		if (value.changeTime) {
 			value.changeTimeStart = moment(value.changeTime[0]).format('YYYY-MM-DD 00:00:00')
 			value.changeTimeEnd = moment(value.changeTime[1]).format('YYYY-MM-DD 23:23:59')
+		}else{
+			value.changeTimeStart =lastmonthday+" 00:00:00"
+			value.changeTimeEnd =today+" 23:23:59"
 		}
 		const param = {
 			...data,
 			...value,
 		}
+		setSelectedRowKeys([])
 		setCurrent(1)
 		setParams(param)
 		getDutyRecord(param);
 	};
 	const onReset = () => {
+		setSelectedRowKeys([])
 		setCurrent(1)
 		setParams(data)
 		form.resetFields();
@@ -130,22 +183,22 @@ function DutyRecord() {
 				>
 					<Row gutter={24}>
 						<Col span={5} key={0}>
-							<Form.Item label="医生姓名" name="doctorName">
+							<Form.Item label="医生姓名" name="doctorName" rules={[{ max: 30, message: '不能超过30个字符' }]}>
 								<Input placeholder="请输入" autoComplete='off' allowClear/>
 							</Form.Item>
 						</Col>
 						<Col span={5} key={1}>
-							<Form.Item label="科室" name="deptName">
+							<Form.Item label="科室" name="deptName" rules={[{ max: 30, message: '不能超过30个字符' }]}>
 								<Input placeholder="请输入" autoComplete='off' allowClear/>
 							</Form.Item>
 						</Col>
 						<Col span={5} key={2}>
-							<Form.Item label="工号" name="doctorCode">
+							<Form.Item label="工号" name="doctorCode" rules={[{ max: 30, message: '不能超过30个字符' }]}>
 								<Input placeholder="请输入" autoComplete='off' allowClear/>
 							</Form.Item>
 						</Col>
 						<Col span={5} key={3}>
-							<Form.Item label="职务/职称名称" name="name">
+							<Form.Item label="职务/职称名称" name="name" rules={[{ max: 30, message: '不能超过30个字符' }]}>
 								<Input placeholder="请输入" autoComplete='off' allowClear/>
 							</Form.Item>
 						</Col>
@@ -164,6 +217,7 @@ function DutyRecord() {
 						<Col span={7} key={5}>
 							<Form.Item label="变更时间" name="changeTime">
 								<RangePicker
+									defaultValue={[moment(lastmonthday), moment(today)]}
 									disabledDate={disabledDate}
 									placeholder={['开始时间', '结束时间']}
 								/>