Explorar o código

文书、职务接口对接

zhouna %!s(int64=3) %!d(string=hai) anos
pai
achega
b959447523
Modificáronse 2 ficheiros con 32 adicións e 19 borrados
  1. 26 14
      src/components/DocTemplate/index.js
  2. 6 5
      src/components/DutyRecord/index.js

+ 26 - 14
src/components/DocTemplate/index.js

@@ -1,5 +1,5 @@
 import React, { useState, useEffect } from 'react';
-import { Form, Input, Button, Table, Modal, Row, Col } from 'antd';
+import { Form, Input, Button, Table, Modal, Row, Col,message } from 'antd';
 import '@common/common.less';
 import apiObj from '@api/index';
 import "moment/locale/zh-cn"
@@ -37,11 +37,24 @@ function DocTemplate() {
 	})
   }
   //模板详情
-  function getTmplInfo(id) {
+  function getTmplInfo(flag,id) {
+    if(!flag){
+	  setVisible(flag);
+	  return;
+	}
+	const hide = message.loading('加载中...',0);
 	post(api.getRecordTemplateManage, {id}).then((res) => {
+	  hide();
 	  if (res.data.code === 200) {
 		const data = res.data.data;
-		setTmplInfo(data);
+		if(data.contentType==="html"){
+		  const myWindow=window.open('','','width=800,height=600');
+		  myWindow.document.write(data.content);
+		  myWindow.focus();
+		}else{
+		  setVisible(flag);
+		  setTmplInfo(data);
+		}
 	  }
 	})
   }
@@ -61,12 +74,11 @@ function DocTemplate() {
 	getDocTemplate()
   }
   //查看模板
-  function showModal(flag,id){
-	setVisible(flag);
+  /*function showModal(flag,id){
 	if(flag){
 	  getTmplInfo(id);
 	}
-  }
+  }*/
   const onFinish = (value) => {
 	const param = {
 	  ...data,
@@ -89,8 +101,7 @@ function DocTemplate() {
 	{ title: '医院父类模板名称', dataIndex: 'parentName', key: 'parentName' },
 	{
 	  title: '操作', dataIndex: 'operation', key: 'operation', render: (text, record) =>{
-		console.log(22,text,record)
-		return <a className="showDetail" onClick={()=>showModal(true,record.id)}>查看</a>
+		return <a className="showDetail" onClick={()=>getTmplInfo(true,record.id)}>查看</a>
 	  }
 	},
   ]
@@ -162,16 +173,17 @@ function DocTemplate() {
 		<Modal
 			destroyOnClose={true}
 			title="查看文书模板"
-			footer={[<Button key={1} type="primary" onClick={()=>showModal(false)}>
+			footer={[<Button key={1} type="primary" onClick={()=>setVisible(false)}>
 			  关闭
 			</Button>]}
-			width={510}
+			width="80%"
 			visible={visible}
-			onCancel={()=>showModal(false)}
+			onCancel={()=>setVisible(false)}
 			/*confirmLoading={confirmLoading}*/
 		>
 		  <div>
-			<table width='480' height="80">
+			{tmplInfo.content}
+			{/*<table width='480' height="80">
 			  <tbody>
 				<tr>
 				  <td>医院模板ID:{tmplInfo.code}</td>
@@ -185,10 +197,10 @@ function DocTemplate() {
 				  <td colSpan={2}>模板内容:<span style={{'wordBreak': 'break-all',
 					'display': 'inline-block',
 					'width': '405px',
-					'verticalAlign': 'text-top'}}>{tmplInfo.content}</span></td>
+					'verticalAlign': 'text-top'}} dangerouslySetInnerHTML={{__html:tmplInfo.content}}></span></td>
 				</tr>
 			  </tbody>
-			</table>
+			</table>*/}
 		  </div>
 		</Modal>
 	  </div >

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

@@ -47,11 +47,12 @@ function DutyRecord() {
   function delRecord(){
 	post(api.delOfficialCapacityPage, {id:selectedRowKeys}).then((res) => {
 	  if (res.data.code === 200) {
-		const data = res.data.data;
-		setLogList(data.records);
-		setTotal(data.total)
+	    //刷新列表
+		getDutyRecord()
+	  }else{
+		message.warning(res.data.msg||'操作失败,请重试~');
 	  }
-	})
+	});
 	showDelModal(false);
   }
   //删除弹窗确认
@@ -191,7 +192,7 @@ function DutyRecord() {
 			  rowSelection={rowSelection}
 			  scroll={{ y: 'calc(100vh - 360px)' }}
 			  dataSource={logList}
-			  rowKey={(record,i) => i}
+			  rowKey={record => record.id}
 			  pagination={{
 				pageSize: size,
 				size: 'small',