浏览代码

添加访谈对象模板

code4eat 3 年之前
父节点
当前提交
4bfd2d64dc

+ 1 - 1
.env.development

@@ -1,5 +1,5 @@
 # base api
-REACT_APP_BASE_API = 'http://121.43.139.179:8802/'
+REACT_APP_BASE_API = 'http://112.124.59.133:8081/'
 
 #112.124.59.133:8081  linux服务器
 #121.43.139.179:8802  公网

+ 1 - 1
.env.production

@@ -1,5 +1,5 @@
 # base api
-REACT_APP_BASE_API = 'http://121.43.139.179:8802/'
+REACT_APP_BASE_API = 'http://118.31.245.65:8081/'
 
 #192.168.51.80
 #http://121.43.139.179:8802 线上环境

+ 43 - 0
src/api/generalSetting.js

@@ -0,0 +1,43 @@
+/*
+ * @Author: your name
+ * @Date: 2021-11-05 09:01:50
+ * @LastEditTime: 2021-11-05 14:56:18
+ * @LastEditors: Please set LastEditors
+ * @Description: In User Settings Edit
+ * @FilePath: /react-antd-admin-template/src/api/generalSetting.js
+ */
+
+
+import request from '@/utils/request'
+
+export function getTemplateLists(data) {
+    return request({
+      url: '/pageTemplate/list',
+      method: 'get',
+      params:{...data}
+    })
+}
+
+export function commitTemplateData(data) {
+    return request({
+      url: '/pageTemplate/addTemplate',
+      method: 'post',
+      data:{...data}
+    })
+}
+
+export function editTemplateData(data) {
+    return request({
+      url: '/pageTemplate/editPageTemplate',
+      method: 'post',
+      data:{...data}
+    })
+}
+
+export function delTemplateData(data) {
+    return request({
+      url: '/pageTemplate/delTemplate',
+      method: 'post',
+      params:{...data}
+    })
+}

+ 13 - 6
src/config/menuConfig.js

@@ -9,12 +9,19 @@ const menuList = [
     icon: "home",
     roles:["admin","editor","guest","group-leader","company-manager"]
   },
-  // {
-  //   title: "情境管理",
-  //   path: "/situationCreate/situationCreate",
-  //   icon: "lock",
-  //   roles:["admin","editor","guest","group-leader","company-manager"]
-  // },
+  {
+    title: "通用设置",
+    path: "/generalSetting",
+    icon: "lock",
+    roles:["admin","editor","guest","group-leader","company-manager"],
+    children: [
+      {
+        title: "分页模板管理",
+        path: "/generalSetting/templateMana",
+        roles:["admin","editor","guest","group-leader","company-manager"]
+      }
+    ],
+  },
   {
     title: "人员管理",
     path: "/personnelManagement",

+ 5 - 1
src/config/routeMap.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-04-23 15:39:41
- * @LastEditTime: 2021-05-14 09:19:51
+ * @LastEditTime: 2021-11-03 15:17:36
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /react-antd-admin-template/src/config/routeMap.js
@@ -9,6 +9,7 @@
 
 import Loadable from 'react-loadable';
 import Loading from '@/components/Loading'
+
 const Dashboard = Loadable({loader: () => import(/*webpackChunkName:'Dashboard'*/'@/views/dashboard'),loading: Loading});
 const SituationCreate = Loadable({loader: () => import(/*webpackChunkName:'Dashboard'*/'@/views/situationCreate/situationCreate'),loading: Loading});
 const PermissionMaintenance = Loadable({loader: () => import(/*webpackChunkName:'Bug'*/'@/views/personnelManagement/permissionMaintenance/permissionMaintenance'),loading: Loading});
@@ -30,6 +31,7 @@ const PointAndCheckGroup = Loadable({loader: () => import(/*webpackChunkName:'Da
 const PointAndGroup = Loadable({loader: () => import(/*webpackChunkName:'Dashboard'*/'@/views/checkPointManage/pointAndGroup/pointAndGroup'),loading: Loading});
 const PointAndCheckItem = Loadable({loader: () => import(/*webpackChunkName:'Dashboard'*/'@/views/checkPointManage/checkPointAndCheckItem/checkPointAndCheckItem'),loading: Loading});
 const PointAndProvisions = Loadable({loader: () => import(/*webpackChunkName:'Dashboard'*/'@/views/checkPointManage/pointAndProvisions/pointAndProvisions'),loading: Loading});
+const TemplateMana = Loadable({loader: () => import('@/views/generalSetting/templateMana'),loading: Loading});
 const Error404 = Loadable({loader: () => import(/*webpackChunkName:'Error404'*/'@/views/error/404'),loading: Loading});
 
 
@@ -76,6 +78,8 @@ export default [
   { path: "/checkGroupManage/checkTypeManage", component: CheckTypeManage, roles: ["admin","editor","guest"] },
   //条文条款管理
   { path: "/provisionsManage/provisions", component: ProvisionsManage, roles: ["admin","editor","guest"] },
+  //分页模板管理
+  { path: "/generalSetting/templateMana", component: TemplateMana, roles: ["admin","editor","guest"] },
   //错误
   { path: "/error/404", component: Error404 },
 

+ 5 - 6
src/views/checkItemManage/checkItem/checkItem.jsx

@@ -184,7 +184,6 @@ class TableForm extends React.Component {
   //图片变化回调
   handleUploadChange = ({ file, fileList }) => {
 
-    console.log({ file, fileList });
     if (file.status == 'removed') {
       this.setState({
         fileList
@@ -219,7 +218,6 @@ class TableForm extends React.Component {
 
     uploadFile(formData)
       .then((res) => {
-        console.log('imgUpload:', res);
         const imgItem = {
           status: 'done',
           url: res.data.data, // url 是展示在页面上的绝对链
@@ -231,7 +229,6 @@ class TableForm extends React.Component {
           ...tempFileList[index],
           ...imgItem
         }
-        console.log({ tempFileList });
         this.setState({
           fileList: tempFileList,
         }); // 更新 imgList
@@ -262,7 +259,7 @@ class TableForm extends React.Component {
     const { getFieldDecorator } = this.props.form;
     const { content, edit } = this.props;
     const { depTypeList, BindStatus, checkPointList, checkTypeList, ifClear, checkResultList, checkResultName, checkResultCount, addCheckItemResultSelect, fileList } = this.state;
-    const { checkItemName, rightAnswerText, relatedRules, checkModelList, score, itemAttr, rightAnswerImage,subtotal,missingItemSelecterMod=0 } = content;
+    const { checkItemName, rightAnswerText, relatedRules, checkModelList, score, itemAttr, rightAnswerImage,subtotal,moreDeduction=0 } = content;
     // const bindGroupDefault = groupManaList.length>0?groupManaList[0].name:'bindGroupDefault';
     // console.log({content,edit});
     const formItemLayout = {
@@ -329,7 +326,7 @@ class TableForm extends React.Component {
         </Form.Item>
         <Form.Item label="缺陷项类型">
           {
-            getFieldDecorator('missingItemSelecterMod', config(missingItemSelecterMod, [{ required:false, message: '请选择缺陷项类型!', }]))(
+            getFieldDecorator('moreDeduction', config(moreDeduction, [{ required:false, message: '请选择缺陷项类型!', }]))(
               <Select >
                 <Option key={0} value={0}>单选</Option>
                 <Option key={1} value={1}>多选</Option>
@@ -642,6 +639,7 @@ const CheckItem = () => {
         "rightAnswerImage": formData.rightAnswerImage, // 正确答案图片url 上传图片接口待定
         "rightAnswerText": formData.rightAnswerText,// 正确答案文字  
         "subtotal":formData.subtotal,
+        'moreDeduction':formData.moreDeduction,
       }
       addCheckItem(param).then(res => {
         if (res && res.data.msg == "success") {
@@ -666,6 +664,7 @@ const CheckItem = () => {
         "rightAnswerImage": formData.rightAnswerImage,// 应知应会图片url
         "rightAnswerText": formData.rightAnswerText, // 应知应会文字
         "subtotal":formData.subtotal, //是否统计小计
+        'moreDeduction':formData.moreDeduction,
       } : {
         "id": item.checkItemId,
         "name": formData.checkItemName, // 名称必填
@@ -673,6 +672,7 @@ const CheckItem = () => {
         "relatedRules": formData.relatedRules, // 相关条文
         "rightAnswerImage": formData.rightAnswerImage,// 应知应会图片url
         "rightAnswerText": formData.rightAnswerText, // 应知应会文字
+        'moreDeduction':formData.moreDeduction,
       }
 
       // console.log({param,item,paramForCheckItemresult})
@@ -731,7 +731,6 @@ const CheckItem = () => {
   }
 
   const handleCancelCallback = () => {
-    console.log('modal_closed');
     resetForm();
     set_ifRenderModal(false);
     // set_ifRenderModal(true);

+ 484 - 0
src/views/generalSetting/templateMana/drawer.jsx

@@ -0,0 +1,484 @@
+
+
+import React, { useState, useEffect, useRef, useImperativeHandle } from 'react';
+import { Drawer, Form, Button, Input, Divider, Table, Popconfirm, Select,Alert } from 'antd';
+
+import {commitTemplateData,editTemplateData} from '@/api/generalSetting.js'
+import './style.less';
+
+const { TextArea } = Input;
+
+const { Option } = Select;
+
+const EditableContext = React.createContext();
+
+const EditableRow = ({ form, index, ...props }) => (
+    <EditableContext.Provider value={form}>
+        <tr {...props} />
+    </EditableContext.Provider>
+);
+
+const EditableFormRow = Form.create()(EditableRow);
+
+class EditableCell extends React.Component {
+
+    constructor(props) {
+        super(props);
+        const { editing } = props;
+        this.state = {
+            editing: editing == 'true',
+        };
+    }
+
+    static getDerivedStateFromProps(props, state) {
+        // console.log({ props, state });
+        const { editing } = props;
+        return {
+            ...state,
+            editing: editing == 'true',
+        }
+    }
+    /**
+     * 
+     * @param {Object} form Form实例
+     * @returns tableCell ReactNode
+     */
+    renderCell = form => {
+        this.form = form;
+        const { children, dataIndex, record, title } = this.props;
+        const { editing } = this.state;
+
+        return editing ? (
+            <Form.Item style={{ margin: 0 }}>
+                {form.getFieldDecorator(dataIndex, {
+                    rules: [
+                        {
+                            required: true,
+                            message: `${title} 是必填.`,
+                        },
+                    ],
+                    initialValue: record[dataIndex],
+                })(
+                    // <Input ref={node => (this.input = node)} onPressEnter={this.save} onBlur={this.save} />
+                    (dataIndex != 'required'&&dataIndex != 'showFiled') ? <Input ref={node => (this.input = node)} /> :
+                        (
+                            <Select
+                                ref={node => (this.selecter = node)}
+                                style={{ width: '100%' }}
+                            >
+                                <Option value={0}>否</Option>
+                                <Option value={1}>是</Option>
+                            </Select>
+                        )
+                )}
+            </Form.Item>
+        ) : (
+            <div
+                className="editable-cell-value-wrap"
+                style={{ paddingRight: 24 }}
+            // onClick={this.toggleEdit}
+            >
+                {children}
+            </div>
+        );
+    };
+
+    render() {
+        const {
+            editable,
+            dataIndex,
+            title,
+            record,
+            index,
+            children,
+            ...restProps
+        } = this.props;
+        return (
+            <td {...restProps}>
+                {editable ? (
+                    <EditableContext.Consumer>{this.renderCell}</EditableContext.Consumer>
+                ) : (
+                    children
+                )}
+            </td>
+        );
+    }
+}
+
+
+const NormalForm = React.forwardRef((props, ref) => {
+
+    const { form,initialFormValue } = props;
+    const formRefs = React.createRef();
+    const {getFieldDecorator} = form;
+    const onSubmitFormhandle = () => {
+        return new Promise((resolve)=>{
+            form.validateFields((err, values) => {
+                if (!err) {
+                    console.log('Received values of form: ', values);
+                    resolve(values);
+                }
+            });
+        });
+    }
+
+    useImperativeHandle(ref,()=>{
+          return {
+              ...formRefs.current,
+              form:form
+          }
+    });
+
+    useEffect(()=>{
+        form.setFieldsValue({name:initialFormValue.name,remark:initialFormValue.remark})
+    },[]);
+
+    return (
+        <Form
+            labelCol={{ span: 3 }}
+            wrapperCol={{ span: 16 }}
+            ref={formRefs}
+            onSubmit={onSubmitFormhandle}
+        >
+            <Form.Item
+                label="模板名称"
+                rules={[{ required: true, message: '请输入模板名称!' }]}
+            >
+                {getFieldDecorator('name', {
+                    rules: [{ required: true, message: '请输入模板名称!' }],
+                })(
+                    <Input
+                        placeholder="请输入模板名称,限制长度20字符"
+                        maxLength={20}
+                    />,
+                )}
+            </Form.Item>
+            <Form.Item
+                label="备注说明"
+                rules={[{ required: false }]}
+            >
+                {getFieldDecorator('remark', {
+                    rules: [{ required: false}],
+                })(
+                    <TextArea rows={4} />
+                )}
+            </Form.Item>
+            <Divider dashed />
+        </Form>
+    )
+})
+
+
+const WrappedForm = Form.create()(NormalForm);
+
+/**
+ * 
+ * @param {Object} props 
+ * @returns 
+ */
+const DrawerForm = (props) => {
+
+    const defaultData = [
+        {
+            key: 1,
+            title: '姓名',
+            filedType: 'Text',
+            required: 1,
+            showFiled:1,
+        },
+        {
+            key: 2,
+            title: '性别',
+            filedType: 'Text',
+            required: 1,
+            showFiled:1,
+        },
+        {
+            key: 3,
+            title: '年龄',
+            filedType: 'Text',
+            required: 1,
+            showFiled:1,
+        }
+    ]
+    const [dataSource, setDataSource] = useState(defaultData);
+    const { visible: asVisible, onVisibleChange, title,initData } = props;
+    const [visible, setVisible] = useState(false);
+    const [ifEdit, setIfEdit] = useState(false);
+    const [columns, setColumns] = useState([]);
+    const [currentEditKey, setCurrentEditKey] = useState(-1);
+    const formRef = useRef(null);
+    const [drawerInitData,setDrawerInitData] = useState(null);
+    const [showAlert,setShowAlert] = useState(false);
+
+    const tableColumns = [
+        {
+            title: '标题',
+            dataIndex: 'title',
+            width: '20%',
+            editable: true,
+        },
+        {
+            title: '类型',
+            dataIndex: 'filedType',
+            editable: false,
+            width: '10%',
+        },
+        {
+            title: '是否必填',
+            dataIndex: 'required',
+            editable: true,
+            width: '20%',
+            render: bool => (bool ? '是' : '否')
+        },
+        {
+            title: '是否展示信息',
+            dataIndex: 'showFiled',
+            editable: true,
+            width: '20%',
+            render: bool => (bool ? '是' : '否')
+        },
+        {
+            title: '操作',
+            width:'20%',
+            dataIndex: 'operation',
+            render: (text, record) => {
+                // console.log(record.key,currentEditKey);
+                if (true) {
+                    if (record.key === currentEditKey) {
+                        return (
+                            <>
+                                <EditableContext.Consumer>
+                                    {
+                                        form => (
+                                            <a
+                                                onClick={() => handleSave(form, record.key)}
+                                            >保存</a>
+                                        )
+                                    }
+                                </EditableContext.Consumer>
+                                <Divider type="vertical" />
+                                <a onClick={() => cancelUpdateTableHandle(record.key)}>取消</a>
+                            </>
+                        )
+                    } else {
+                        return (
+                            <>
+                                <a onClick={() => editRowHandle(record.key)}>编辑</a>
+                                <Divider type="vertical" />
+                                <Popconfirm title="确定删除?" onConfirm={() => delTableRowHandle(record.key)}>
+                                    <a>删除</a>
+                                </Popconfirm>
+                            </>
+                        )
+                    }
+                } else {
+                    return null
+                }
+
+            }
+        },
+    ];
+
+    const showDrawer = () => {
+        setVisible(true);
+        onVisibleChange(true);
+    };
+
+    const onClose = () => {
+        setVisible(false);
+        onVisibleChange(false);
+        setDrawerInitData(null);
+        localStorage.removeItem('localDataSource');
+        setDataSource([...defaultData]);
+    };
+
+    /**
+     * 
+     * @param {Number} key 当前选中的key
+     */
+    const editRowHandle = (key) => {
+        setIfEdit(true);
+        setCurrentEditKey(key);
+    }
+
+    const delTableRowHandle = (key) => {
+        let _data = localStorage.getItem('localDataSource');
+        _data = JSON.parse(_data);
+        const filtedData = _data.filter(t => {
+            return t.key !== key
+        });
+        setDataSource([...filtedData]);
+    }
+
+    const cancelUpdateTableHandle = (key) => {
+        setIfEdit(false);
+        setCurrentEditKey(-1);
+    }
+
+    /**
+     * 
+     * @param {Object} form form实例对象参考antd Form
+     * @param {Number} key 当前选中的key
+     */
+    const handleSave = (form, key) => {
+        form.validateFields((error, row) => {
+            if (error) {
+                return;
+            }
+            const newData = [...dataSource];
+            const index = newData.findIndex(item => key === item.key);
+            if (index > -1) {
+                const item = newData[index];
+                newData.splice(index, 1, {
+                    ...item,
+                    ...row,
+                });
+                setDataSource(newData);
+                setIfEdit(false);
+                setCurrentEditKey(-1);
+            } else {
+                newData.push(row);
+                setDataSource(newData);
+                setIfEdit(false);
+                setCurrentEditKey(-1)
+            }
+        });
+    }
+
+    const renderColumn = () => {
+
+        const columns = tableColumns.map(col => {
+            if (!col.editable) {
+                return col;
+            }
+            return {
+                ...col,
+                onCell: record => ({
+                    record,
+                    editable: col.editable,
+                    dataIndex: col.dataIndex,
+                    title: col.title,
+                    editing: `${record.key === currentEditKey}`,
+                }),
+            };
+        });
+
+        setColumns(columns);
+    }
+
+    const addHandle = () => {
+        const newData = {
+            key: dataSource.length + 1,
+            title: '字段名',
+            filedType: 'Text',
+            required: 0,
+            showFiled:0,
+        };
+        setDataSource([...dataSource, newData]);
+    }
+    
+    /**
+     * 
+     * @param {Object} formData ==> {name,remark}
+     */
+    const postDrawerData = async (formData)=>{
+        if(drawerInitData){
+            //编辑
+            const resp =  await editTemplateData({
+                id:drawerInitData.id,
+                ...formData,
+                contentDTOs:dataSource.map(t=>({title:t.title,required:t.required,filedType:t.filedType,showFiled:t.showFiled}))
+            });
+            if(resp.data.status == 200){
+                onClose();
+            }
+        }else{
+            //新增
+            const resp = await commitTemplateData({
+                ...formData,
+                contentDTOs:dataSource.map(t=>({title:t.title,required:t.required,filedType:t.filedType,showFiled:t.showFiled}))
+            });
+            if(resp.data.status == 200){
+                onClose();
+            }
+        }
+    }
+    
+
+    const onCommitDrawerData = async () => {
+
+        const { props: { onSubmit } } = formRef.current;
+        onSubmit().then((formData)=>{
+            // console.log({formData});
+            if(dataSource.length > 0){
+                postDrawerData(formData);
+            }else{
+                setShowAlert(true);
+            }
+        })
+    }
+
+    useEffect(() => {
+        asVisible && showDrawer();
+        if(initData){
+            //设置编辑时的回显
+            const {dataSource:list} = initData;
+            const _list = list.map((t,index)=>({...t,key:index+1}));
+            setDataSource(_list);
+            setDrawerInitData(initData);
+        }
+    }, [props]);
+
+    useEffect(() => {
+        //delTableRowHandle获取不到datasource,暂存localStorage
+        localStorage.setItem('localDataSource', JSON.stringify(dataSource));
+    }, [dataSource]);
+
+    useEffect(() => {
+        renderColumn();
+    }, [ifEdit, currentEditKey]);
+
+    useEffect(() => {
+        return () => {
+            //卸载时清空
+            localStorage.removeItem('localDataSource');
+            setDataSource([...defaultData]);
+        }
+    }, []);
+
+
+
+
+    return (
+        <Drawer title={title} width={800} placement="right" onClose={onClose} visible={visible} destroyOnClose={true} >
+            <div className='formContainer'>
+                <WrappedForm wrappedComponentRef={formRef} initialFormValue={{...drawerInitData}} />
+                <div className='multiFormWrap' >
+                    <div className='blockTitle'>模板内容</div>
+                    { showAlert && <Alert message="请添加模板内容!" type="error" closable onClose={()=>setShowAlert(false)} />}
+                    <Table
+                        components={{
+                            body: {
+                                row: EditableFormRow,
+                                cell: EditableCell,
+                            },
+                        }}
+                        rowClassName={() => 'editable-row'}
+                        dataSource={dataSource}
+                        columns={columns}
+                        pagination={false}
+                        rowKey='key'
+                        footer={() => <div className='footerTail' onClick={addHandle}>添加</div>}
+                    />
+                </div>
+            </div>
+            <div className='drawerFooter'>
+                <Button className='sureBtn' type='primary' onClick={onCommitDrawerData} >确定</Button>
+                <Button onClick={onClose}>取消</Button>
+            </div>
+        </Drawer>
+    )
+}
+
+export default DrawerForm;

+ 161 - 0
src/views/generalSetting/templateMana/index.jsx

@@ -0,0 +1,161 @@
+
+import React,{ useState,useEffect,useRef } from 'react';
+import { Table,Divider,Input,Button } from 'antd';
+import DrawerForm from './drawer';
+import {getTemplateLists,delTemplateData} from '@/api/generalSetting.js'
+import './style.less';
+
+// const filterForm = React.forwardRef((props,ref)=>{
+//     const handleSubmit
+//     return (
+//         <Form onSubmit={handleSubmit} className="login-form">
+
+//         </Form>
+//     )
+// });
+
+// const TableFilter = Form.create({ name: 'tableFilter' })(filterForm);
+
+const TemplateMana = ()=>{
+      const columns = [
+          {
+            title: 'ID',
+            dataIndex: 'id',
+            key: 'id',
+          },
+          {
+            title: '模板名称',
+            dataIndex: 'name',
+            key: 'name',
+          },
+          {
+            title: '创建时间',
+            dataIndex: 'createTime',
+            key: 'createTime',
+            render:timeNum=>(`${new Date(timeNum).getFullYear()}-${new Date(timeNum).getMonth()+1}-${new Date(timeNum).getDay()>9?new Date(timeNum).getDay():'0'+new Date(timeNum).getDay()}`)
+          },
+          {
+            title: '创建人',
+            dataIndex: 'createUserName',
+            key: 'createUserName',
+          },
+          {
+            title: '备注说明',
+            dataIndex: 'remark',
+            key: 'remark',
+          },
+          {
+            title: '操作',
+            key: 'opreation',
+            render: (text, record) => (
+                  <>
+                    <a onClick={()=>editHandle(record)}>修改</a>
+                    <Divider type='vertical' />
+                    <a onClick={()=>delHandle(record)}>作废</a>
+                  </>
+            ),
+          },
+      ];
+
+      const [drawerVisible,setDrawerVisible] = useState(false);
+      const [dataSource,setDataSource] = useState([]);
+      const [initData,setInitData] = useState(null);
+      const [ifEdit,setIfEdit] = useState(false);
+      const [tableSerachKeywords,setTableSerachKeywords] = useState('');
+      const [pages,setPages] = useState({});
+
+      const addHandle = ()=>{
+        setIfEdit(false);
+        setDrawerVisible(true);
+      }
+      
+      /**
+       * 
+       * @param {Object} record 表格row数据
+       */
+      const editHandle = (record)=>{
+           setIfEdit(true);
+           setInitData({
+            id:record.id,
+            name:record.name,
+            remark:record.remark,
+            dataSource:record.content?JSON.parse(record.content):[]
+           });
+      }
+
+      const delHandle = async (record)=>{
+            const resp = await delTemplateData({id:record.id});
+            if(resp.data.status == 200 ){
+                getTemplates({pageSize:20,page:1});
+            }
+      }
+      /**
+       * 
+       * @param {boolen} bool 
+       */
+      const onDrawerVisibleChangeHandle = (bool)=>{
+        //  console.log('onDrawerVisibleChangeHandle',bool);
+         setDrawerVisible(bool);
+         !bool&&getTemplates({pageSize:10,page:1}); //关闭时拉取数据
+         !bool&&setInitData(null);
+      }
+
+      const getTemplates = async (query)=>{
+            const resp =  await getTemplateLists(query);
+            const {data:{data}} = resp;
+            if(data){
+                setDataSource(data.list);
+                setPages({
+                    total:data.totalCount,
+                    pageSize:data.pageSize,
+                    current:data.currPage
+                });
+            }
+      }
+
+      const filterFormHandle = ()=>{
+
+      }
+
+      useEffect(()=>{
+            if(initData){
+                setDrawerVisible(true);
+            }
+      },[initData]);
+
+      useEffect(()=>{
+       getTemplates({pageSize:20,page:1});
+      },[])
+
+      return (
+           <div className='pageContainer'>
+                {
+                  (
+                    <DrawerForm 
+                        visible={drawerVisible}
+                        initData={ifEdit?initData:null}
+                        onVisibleChange={onDrawerVisibleChangeHandle} 
+                        title={`${ifEdit?'修改':'添加'}模板数据`}
+                    />
+                  )
+                }
+                <div className='filterForm'>
+                     <Input placeholder='请输入模板名称' className='inputArea' value={tableSerachKeywords} onChange={e=>setTableSerachKeywords(e.target.value)} />
+                     <Button type='primary' onClick={()=>getTemplates({keyword:tableSerachKeywords,pageSize:20,page:1})}>查询</Button>
+                     <Button onClick={()=>{setTableSerachKeywords('');getTemplates({pageSize:20,page:1});}}>重置</Button>
+                </div>
+                <Table 
+                  dataSource={dataSource}
+                  columns={columns}
+                  rowKey="id"
+                  pagination={{
+                      ...pages
+                  }}
+                  footer={() => <div className='footerTail' onClick={addHandle}>添加</div>}
+                />
+
+           </div>
+      )
+}
+
+export default TemplateMana;

+ 55 - 0
src/views/generalSetting/templateMana/style.less

@@ -0,0 +1,55 @@
+
+.ant-drawer-body {
+    height:calc(100% - 55px);
+}
+
+.pageContainer {
+    padding: 20px;
+    margin: 20px;
+    background-color: #fff;
+    .footerTail {
+          cursor: pointer;
+          text-align: center;
+          padding-top: 10px;
+          padding-bottom: 10px;
+          border-radius: 5px;
+          border:1px dashed #ddd
+    }
+
+    .filterForm {
+        display: flex;
+        flex-direction: row;
+        margin-bottom:20px;
+        .inputArea {
+            width: 20%;
+            margin-right: 10px;
+        }
+        button {
+            margin-right: 10px;
+        }
+    }
+}
+
+.formContainer {
+    height:calc(100% - 40px);
+    overflow: scroll;
+    .blockTitle {
+        margin-bottom: 20px;
+    }
+    .footerTail {
+        cursor: pointer;
+        text-align: center;
+        padding-top: 10px;
+        padding-bottom: 10px;
+        border-radius: 5px;
+        border:1px dashed #ddd
+    }
+}
+
+.drawerFooter {
+    text-align: right;
+    margin-top: 10px;
+    .sureBtn {
+        margin-right: 10px;
+    }
+}