Parcourir la source

fix bug & checkItem Page add param

code4eat il y a 3 ans
Parent
commit
3957363498

Fichier diff supprimé car celui-ci est trop grand
+ 482 - 462
src/views/checkItemManage/checkItem/checkItem.jsx


+ 0 - 10
src/views/checkItemManage/checkItemResultSelector/table.js

@@ -8,16 +8,6 @@
  */
 
 
-
-/*
- * @Author: your name
- * @Date: 2021-04-27 11:19:40
- * @LastEditTime: 2021-04-30 15:45:25
- * @LastEditors: Please set LastEditors
- * @Description: In User Settings Edit
- * @FilePath: /react-antd-admin-template/src/views/groupManage/groupIdentity/table.js
- */
-
 import React from 'react';
 import { Table,Popconfirm, Form,Divider} from 'antd';
 

+ 420 - 417
src/views/checkPointManage/checkItem/checkItem.jsx

@@ -1,9 +1,11 @@
-import React,{ useState,useEffect,useRef } from 'react';
+import React, { useState, useEffect, useRef } from 'react';
 
-import {getCheckItem,getCheckItemTypeList,listAll,delCheckItem,addCheckItem,editCheckItem,
-  bindCheckItemAndCheckPoint,addCheckItemCheckResult,getCheckItemCheckResultSelecterList} from "@/api/checkPointManage.js";
+import {
+  getCheckItem, getCheckItemTypeList, listAll, delCheckItem, addCheckItem, editCheckItem,
+  bindCheckItemAndCheckPoint, addCheckItemCheckResult, getCheckItemCheckResultSelecterList
+} from "@/api/checkPointManage.js";
 // import {getOutpatientList} from "@/api/checkCondition.js";
-import { Button,Form,Input,Select,Tag,Tooltip} from 'antd';
+import { Button, Form, Input, Select, Tag, Tooltip } from 'antd';
 import EditableFormTable from './table';
 import ModalWrap from '@/components/Modal/modal.js';
 // import { TAGSVIEW_EMPTY_TAGLIST } from '../../../store/action-types';
@@ -14,295 +16,296 @@ const { Search } = Input;
 
 
 class TableForm extends React.Component {
-    
-
-    constructor(props){
-         super(props);
-         
-         this.state = {
-          depTypeList:[],
-          checkPointList:[],
-          checkTypeList:[],
-          checkResultList:[],//查核结果配置
-          addCheckItemResultSelect:[],
-          BindStatus:'',
-          BindPointStatus:'',
-          checkResultName:'',//
-          checkResultCount:'',
-         };
-    }
 
-    handleCommit = () => {
-        console.log('开始校验表单');
-        return new Promise((resolve,reject)=>{
-          this.props.form.validateFields((err,values) => {
-            if (!err) {
-              let data = {
-                ...this.props.content,
-                ...values,
-                itemAttr:this.state.checkResultList
-              }
-              resolve(data);
-            }
-        });
-        })
-      
+
+  constructor(props) {
+    super(props);
+
+    this.state = {
+      depTypeList: [],
+      checkPointList: [],
+      checkTypeList: [],
+      checkResultList: [],//查核结果配置
+      addCheckItemResultSelect: [],
+      BindStatus: '',
+      BindPointStatus: '',
+      checkResultName: '',//
+      checkResultCount: '',
     };
+  }
 
-    handleSelectChange=(value)=>{
-      // console.log(value);
-      const {id} = this.props.content;
-      this.setState({
-        BindStatus:'validating'
-      },()=>{
-          this.bindPoint({
-            checkItemId:id,
-            checkPointIds:[value]
-          });
-      })
-    }
-    //当删除查核结果配置
-    onTagClose=(e)=>{
-        // console.log('onTagClose',e);
-        // console.log(this.state.checkResultList);
-        const checkResultListByFilter = this.state.checkResultList.filter(item=>item.attr != e);
-        // console.log({checkResultListByFilter});
+  handleCommit = () => {
+    console.log('开始校验表单');
+    return new Promise((resolve, reject) => {
+      this.props.form.validateFields((err, values) => {
+        if (!err) {
+          let data = {
+            ...this.props.content,
+            ...values,
+            itemAttr: this.state.checkResultList
+          }
+          resolve(data);
+        }
+      });
+    })
+
+  };
+
+  handleSelectChange = (value) => {
+    // console.log(value);
+    const { id } = this.props.content;
+    this.setState({
+      BindStatus: 'validating'
+    }, () => {
+      this.bindPoint({
+        checkItemId: id,
+        checkPointIds: [value]
+      });
+    })
+  }
+  //当删除查核结果配置
+  onTagClose = (e) => {
+    // console.log('onTagClose',e);
+    // console.log(this.state.checkResultList);
+    const checkResultListByFilter = this.state.checkResultList.filter(item => item.attr != e);
+    // console.log({checkResultListByFilter});
+    this.setState({
+      checkResultList: checkResultListByFilter
+    })
+  }
+  //更新查核结果配置
+  updateCheckResultList = () => {
+    const { checkResultList, checkResultName, checkResultCount } = this.state;
+    this.setState({
+      checkResultList: [...checkResultList, { attr: checkResultName, value: checkResultCount }]
+    }, () => this.setState({ checkResultName: '', checkResultCount: '' }))
+  }
+
+  bindPoint = (obj) => {
+    bindCheckItemAndCheckPoint(obj).then(res => {
+      // console.log({res});
+      if (res.data.msg == "success") {
         this.setState({
-          checkResultList:checkResultListByFilter
+          BindStatus: 'success'
         })
-    }
-    //更新查核结果配置
-    updateCheckResultList=()=>{
-      const {checkResultList,checkResultName,checkResultCount} = this.state;
+      }
+    })
+  }
+
+  onAddCheckItemResultSelectChange = (e) => {
+    // console.log({e});
+    this.setState({
+      checkResultName: e
+    })
+  }
+
+  componentWillUnmount() {
+    this.props.form.resetFields();
+  }
+
+  componentDidMount() {
+    listAll().then(res => {
+      // console.log({res});
+      const temp = res.data.data;
       this.setState({
-        checkResultList:[...checkResultList,{attr:checkResultName,value:checkResultCount}]
-      },()=>this.setState({checkResultName:'',checkResultCount:''}))
-    }
+        checkPointList: temp
+      })
+    });
+    //获取添加查核项结果下拉列表
+    getCheckItemCheckResultSelecterList().then(res => {
+      const temp = res.data.data;
+      // console.log({temp});
+      this.setState({
+        addCheckItemResultSelect: temp
+      })
+    });
 
-    bindPoint=(obj)=>{
-      bindCheckItemAndCheckPoint(obj).then(res=>{
-            // console.log({res});
-          if(res.data.msg=="success"){
-               this.setState({
-                BindStatus:'success'
-               })
-          }
-        })
-    }
+    getCheckItemTypeList().then(res => {
+      const temp = res.data.data;
+      this.setState({
+        checkTypeList: temp
+      })
+    });
 
-    onAddCheckItemResultSelectChange=(e)=>{
-        // console.log({e});
-        this.setState({
-          checkResultName:e
-        })
+    const { content, edit } = this.props;
+    const editCheckItemResultList = JSON.parse(content.itemAttrs);
+    // console.log('json',content.itemAttrs);
+    if (edit) {
+      this.setState({
+        checkResultList: editCheckItemResultList
+      })
     }
+  }
 
-    componentWillUnmount(){
-        this.props.form.resetFields();
-    }
 
-    componentDidMount(){
-      listAll().then(res=>{
-        // console.log({res});
-        const temp = res.data.data;
-        this.setState({
-          checkPointList:temp
-        })
-      });
-      //获取添加查核项结果下拉列表
-      getCheckItemCheckResultSelecterList().then(res=>{
-        const temp = res.data.data;
-        // console.log({temp});
-        this.setState({
-          addCheckItemResultSelect:temp
-        })
-      });
-    
-      getCheckItemTypeList().then(res=>{
-        const temp = res.data.data;
-        this.setState({
-          checkTypeList:temp
-        })
-      });
-      
-      const {content,edit} = this.props;
-      const editCheckItemResultList = JSON.parse(content.itemAttrs);
-      // console.log('json',content.itemAttrs);
-      if(edit){
-         this.setState({
-          checkResultList:editCheckItemResultList
-         })
-      }
-    }
 
+  shouldComponentUpdate(nextProps, nextState) {
 
+    return true;
+  }
 
-    shouldComponentUpdate(nextProps,nextState){
-    
-          return true;
+  render() {
+
+    const { getFieldDecorator } = this.props.form;
+    const { content, edit } = this.props;
+    const { depTypeList, BindStatus, checkPointList, checkTypeList, checkResultList, checkResultName, checkResultCount, addCheckItemResultSelect } = this.state;
+    const { checkItemName, rightAnswerText, relatedRules, checkModelList, score, itemAttr } = content;
+    // const bindGroupDefault = groupManaList.length>0?groupManaList[0].name:'bindGroupDefault';
+    console.log({ content, edit });
+    const formItemLayout = {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 6 },
+      },
+      wrapperCol: {
+        xs: { span: 12 },
+        sm: { span: 12 },
+      },
+    };
+    const config = (key, rules) => {
+      console.log({ key });
+      return {
+        initialValue: edit ? key : '',
+        rules: [
+          ...rules
+        ],
+      }
     }
-    
-    render(){
+
+    return (
+      <Form {...formItemLayout}  >
+        <Form.Item label="查核项">
+          {
+            getFieldDecorator('checkItemName', config(checkItemName, [{ required: true, message: '请输入查核项名!', }]))(<Input />)
+          }
+        </Form.Item>
         
-        const { getFieldDecorator } = this.props.form;
-        const {content,edit} = this.props;
-        const {depTypeList,BindStatus,checkPointList,checkTypeList,checkResultList,checkResultName,checkResultCount,addCheckItemResultSelect} = this.state;
-        const {checkItemName,rightAnswerText,relatedRules,checkModelList,score,itemAttr} = content;
-        // const bindGroupDefault = groupManaList.length>0?groupManaList[0].name:'bindGroupDefault';
-        console.log({content,edit});
-        const formItemLayout = {
-            labelCol: {
-              xs: { span: 24 },
-              sm: { span:6 },
-            },
-            wrapperCol: {
-              xs: { span: 12 },
-              sm: { span: 12 },
-            },
-        };
-        const config =(key,rules)=>{
-          console.log({key});
-          return {
-            initialValue:edit?key:'',
-            rules: [
-              ...rules
-            ],
+        <Form.Item label="查核方式">
+          {
+            getFieldDecorator('checkModeList', config(checkModelList, [{ required: true, message: '请选择查核方式!', }]))(
+              <Select
+                placeholder=""
+              >
+                {
+                  checkTypeList.map((v, k) => {
+                    return (
+                      <Option key={k} value={v.itemCode}>{v.itemName}</Option>
+                    )
+                  })
+                }
+              </Select>,
+            )
           }
-        }
+        </Form.Item>
+        <Form.Item label="查核项分数" style={{ display: edit ? 'block' : 'none' }}>
+          {
+            getFieldDecorator('score', config(score, [{ required: true, message: '请输入查核分数!', }]))(<Input />)
+          }
+        </Form.Item>
+        <Form.Item label="查核项查核结果配置" style={{ display: edit ? 'block' : 'none' }}>
+          {
+            getFieldDecorator('itemAttr', config(itemAttr, [{ required: false, message: '请输入配置查核结果!', }]))(
+              <div style={{ borderRadius: '4px', minHeight: '70px' }}>
+                <InputGroup compact>
+                  <Tooltip title="请选择查核结果名">
+                    <Select
+                      showSearch
+                      style={{ width: '50%' }}
+                      placeholder="请选择查核结果名"
+                      optionFilterProp="children"
+                      onChange={this.onAddCheckItemResultSelectChange}
+                    // onFocus={onFocus}
+                    // onBlur={onBlur}
+                    >
+                      {
+                        addCheckItemResultSelect.map((item, index) => {
+                          return (
+                            <Option key={index} value={item}>{item}</Option>
+                          )
+                        })
+                      }
+                    </Select>
+                  </Tooltip>
+                  <Tooltip title="请定义查核结果对应的分值占比,如:50">
+                    <Input style={{ width: '30%' }} onChange={(e) => { this.setState({ checkResultCount: e.target.value }) }} value={checkResultCount} placeholder="如:50" />
+                  </Tooltip>
+                  <Button type="primary" onClick={this.updateCheckResultList}>添加</Button>
+                </InputGroup>
+                <Form.Item >
+                  {
+                    getFieldDecorator('score', config(score, [{ required: true, message: '请输入查核分数!', }]))(
+                      <div>
+                        {
+                          checkResultList.map((item, index) => {
+                            // return(
+                            //        <Tag  closable key={index} onClose={this.onTagClose.bind(this,item.attr)} style={{padding:0,border:'none'}}>
+                            //              <InputGroup compact>
+                            //                 <Tooltip title="请定义查核结果名">
+                            //                       <Input style={{ width: '70%' }} onChange={(e)=>{this.setState({checkResultName:e.target.value})}}  defaultValue={item.attr} placeholder="如:缺失"  />
+                            //                 </Tooltip>
+                            //                 <Tooltip title="请定义查核结果对应的分值占比,如:50">
+                            //                       <Input style={{ width: '30%' }} onChange={(e)=>{this.setState({checkResultCount:e.target.value})}} defaultValue={item.value} placeholder="如:50" />
+                            //                 </Tooltip>
+                            //              </InputGroup>
+                            //        </Tag>
+                            // );
+                            const tagName = item.attr;
+                            return (
+                              <Tag color="#4E78FF" closable key={index} onClose={this.onTagClose.bind(this, tagName)}>
+                                {`${item.attr}|${item.value}%`}
+                              </Tag>
+                            )
+                          })
+                        }
+                      </div>
+                    )
+                  }
+                </Form.Item>
+              </div>
+            )
+          }
+        </Form.Item>
+        <Form.Item label="应知应会文字">
+          {
+            getFieldDecorator('rightAnswerText', config(rightAnswerText, [{ required: false, message: '!', }]))(<Input.TextArea autoSize={{ minRows: 5 }} />)
+          }
+        </Form.Item>
+        <Form.Item label="相关条文">
+          {
+            getFieldDecorator('relatedRules', config(relatedRules, [{ required: false, message: '!', }]))(<Input.TextArea autoSize={{ minRows: 5 }} />)
+          }
+        </Form.Item>
 
-        return (
-            <Form {...formItemLayout}  >
-                   <Form.Item label="查核项">
-                    {
-                        getFieldDecorator('checkItemName',config(checkItemName,[{required: true,message: '请输入查核项名!',}]))(<Input />)
-                    }
-                   </Form.Item>
-                   <Form.Item label="查核方式">
-                    {
-                        getFieldDecorator('checkModeList',config(checkModelList,[{required: true,message: '请选择查核方式!',}]))(
-                          <Select
-                              placeholder=""
-                          >
-                              {
-                                checkTypeList.map((v,k)=>{
-                                    return (
-                                      <Option key={k} value={v.itemCode}>{v.itemName}</Option>
-                                    )
-                                })
-                              }
-                          </Select>,
-                        )
-                    }
-                   </Form.Item>
-                   <Form.Item label="查核项分数" style={{display:edit?'block':'none'}}>
-                    {
-                        getFieldDecorator('score',config(score,[{required: true,message: '请输入查核分数!',}]))(<Input />)
-                    }
-                   </Form.Item>
-                   <Form.Item label="查核项查核结果配置" style={{display:edit?'block':'none'}}>
-                    {
-                        getFieldDecorator('itemAttr',config(itemAttr,[{required: false,message: '请输入配置查核结果!',}]))(
-                          <div style={{borderRadius:'4px',minHeight:'70px'}}>
-                               <InputGroup compact>
-                                  <Tooltip title="请选择查核结果名">
-                                  <Select
-                                    showSearch
-                                    style={{ width:'50%' }}
-                                    placeholder="请选择查核结果名"
-                                    optionFilterProp="children"
-                                    onChange={this.onAddCheckItemResultSelectChange}
-                                    // onFocus={onFocus}
-                                    // onBlur={onBlur}
-                                  >
-                                    {
-                                      addCheckItemResultSelect.map((item,index)=>{
-                                           return (
-                                              <Option key={index} value={item}>{item}</Option>
-                                           )
-                                      })
-                                    }
-                                  </Select>
-                                  </Tooltip>
-                                  <Tooltip title="请定义查核结果对应的分值占比,如:50">
-                                      <Input style={{ width: '30%' }} onChange={(e)=>{this.setState({checkResultCount:e.target.value})}} value={checkResultCount} placeholder="如:50" />
-                                  </Tooltip>
-                                  <Button type="primary" onClick={this.updateCheckResultList}>添加</Button>
-                               </InputGroup>
-                               <Form.Item >
-                               {
-                                 getFieldDecorator('score',config(score,[{required: true,message: '请输入查核分数!',}]))(
-                                      <div>
-                                           {
-                                            checkResultList.map((item,index)=>{
-                                              // return(
-                                              //        <Tag  closable key={index} onClose={this.onTagClose.bind(this,item.attr)} style={{padding:0,border:'none'}}>
-                                              //              <InputGroup compact>
-                                              //                 <Tooltip title="请定义查核结果名">
-                                              //                       <Input style={{ width: '70%' }} onChange={(e)=>{this.setState({checkResultName:e.target.value})}}  defaultValue={item.attr} placeholder="如:缺失"  />
-                                              //                 </Tooltip>
-                                              //                 <Tooltip title="请定义查核结果对应的分值占比,如:50">
-                                              //                       <Input style={{ width: '30%' }} onChange={(e)=>{this.setState({checkResultCount:e.target.value})}} defaultValue={item.value} placeholder="如:50" />
-                                              //                 </Tooltip>
-                                              //              </InputGroup>
-                                              //        </Tag>
-                                              // );
-                                              const tagName = item.attr;
-                                              return (
-                                                <Tag color="#4E78FF"  closable key={index} onClose={this.onTagClose.bind(this,tagName)}>
-                                                    {`${item.attr}|${item.value}%`}
-                                                </Tag>
-                                              )
-                                            })
-                                          }
-                                      </div>
-                                 )
-                               }
-                               </Form.Item>
-                          </div>
-                        )
-                    }
-                   </Form.Item>
-                   <Form.Item label="应知应会文字">
-                    {
-                        getFieldDecorator('rightAnswerText',config(rightAnswerText,[{required: false,message: '!',}]))(<Input.TextArea autoSize={{minRows:5}} />)
-                    }
-                   </Form.Item>
-                   <Form.Item label="相关条文">
-                    {
-                        getFieldDecorator('relatedRules',config(relatedRules,[{required: false,message: '!',}]))(<Input.TextArea autoSize={{minRows:5}} />)
-                    }
-                   </Form.Item>
-                   
-                   <Form.Item label="绑定查核要点"
-                       hasFeedback
-                       style={{display:edit?'block':'none'}}
-                       validateStatus={BindStatus}   //validating,success,warning
-                   >
-                    {
-                        getFieldDecorator('bindPoint',config('',[{required: false,}]))(
-                          <Select
-                             placeholder=""
-                             onChange={this.handleSelectChange}
-                             showSearch
-                            optionFilterProp="children"
-                            filterOption={(input, option) =>
-                              option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
-                            }
-                          >
-                             {
-                                checkPointList.map((v,k)=>{
-                                    return (
-                                      <Option key={k} value={v.id}>{v.name}</Option>
-                                    )
-                                })
-                              }
-                          </Select>,
-                        )
-                    }
-                   </Form.Item>
-          </Form>         
-        )
-    }
+        <Form.Item label="绑定查核要点"
+          hasFeedback
+          style={{ display: edit ? 'block' : 'none' }}
+          validateStatus={BindStatus}   //validating,success,warning
+        >
+          {
+            getFieldDecorator('bindPoint', config('', [{ required: false, }]))(
+              <Select
+                placeholder=""
+                onChange={this.handleSelectChange}
+                showSearch
+                optionFilterProp="children"
+                filterOption={(input, option) =>
+                  option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
+                }
+              >
+                {
+                  checkPointList.map((v, k) => {
+                    return (
+                      <Option key={k} value={v.id}>{v.name}</Option>
+                    )
+                  })
+                }
+              </Select>,
+            )
+          }
+        </Form.Item>
+      </Form>
+    )
+  }
 }
 
 const WrappedTableForm = Form.create({ name: 'register' })(TableForm);
@@ -310,24 +313,24 @@ const WrappedTableForm = Form.create({ name: 'register' })(TableForm);
 
 const CheckItem = () => {
 
-  let [arr,setarr] = useState([]);
-  let [pages,setpages] = useState({});
-  let [ifUpdateList,setifUpdateList]=useState(false);
-  let [ifRender,setifRender] = useState(false);
-  let [ifShowDialog,setifShowDialog] = useState(false);
-  const [item,setitem]=useState({});
-  const [ifEdit,setifEdit]=useState(false);
+  let [arr, setarr] = useState([]);
+  let [pages, setpages] = useState({});
+  let [ifUpdateList, setifUpdateList] = useState(false);
+  let [ifRender, setifRender] = useState(false);
+  let [ifShowDialog, setifShowDialog] = useState(false);
+  const [item, setitem] = useState({});
+  const [ifEdit, setifEdit] = useState(false);
   const modalNode = useRef(null);
   const formNode = useRef(null);
   const thisForm = useRef(null);
-  const [searchKey,setsearchKey] = useState('');
-//   let [editingKey,seteditingKey] = useState('');
+  const [searchKey, setsearchKey] = useState('');
+  //   let [editingKey,seteditingKey] = useState('');
 
   const columns = [
     {
       title: 'id',
       dataIndex: 'checkItemId',
-      width:'10%',
+      width: '10%',
       key: 'checkItemId',
       render: text => <a>{text}</a>,
     },
@@ -336,105 +339,105 @@ const CheckItem = () => {
       dataIndex: 'checkItemName',
       key: 'checkItemName',
       editable: true,
-      width:'15%'
+      width: '15%'
     },
     {
       title: '查核方式',
       dataIndex: 'checkModelList',
       key: 'checkModelList',
       editable: true,
-      width:'10%'
+      width: '10%'
     },
     {
       title: '拥有查核结果',
       key: 'itemAttrs',
-      width:'20%',
+      width: '20%',
       dataIndex: 'itemAttrs',
-      render: tags =>{
+      render: tags => {
         const newTags = JSON.parse(tags);
-        console.log({newTags});
+        console.log({ newTags });
         return (
           <span>
-          {newTags&&newTags.map(tag => {
-            return (
-              <Tag  key={tag.attr}>
+            {newTags && newTags.map(tag => {
+              return (
+                <Tag key={tag.attr}>
                   {tag.attr}
-              </Tag>
-            );
-          })}
+                </Tag>
+              );
+            })}
           </span>
         )
       },
     },
     {
-        title: '应知应会文字',
-        dataIndex: 'rightAnswerText',
-        key: 'rightAnswerText',
-        editable: true,
-        width:'20%'
+      title: '应知应会文字',
+      dataIndex: 'rightAnswerText',
+      key: 'rightAnswerText',
+      editable: true,
+      width: '20%'
     },
-   
+
     {
-        title: '应知应会图片url',
-        dataIndex: 'rightAnswerImage',
-        key: 'rightAnswerImage',
-        editable: false,
-        width:'20%'
+      title: '应知应会图片url',
+      dataIndex: 'rightAnswerImage',
+      key: 'rightAnswerImage',
+      editable: false,
+      width: '20%'
     },
     {
-        title: '相关条文',
-        dataIndex: 'relatedRules',
-        key: 'relatedRules',
-        editable: false,
-        width:'20%'
+      title: '相关条文',
+      dataIndex: 'relatedRules',
+      key: 'relatedRules',
+      editable: false,
+      width: '20%'
     },
   ];
 
 
 
-  const getData = async (pageObj)=>{
+  const getData = async (pageObj) => {
     let data = await getCheckItem(pageObj);
-    
-    const renderData = data.data.data.list.map((item,index)=>{
-          return {
-              ...item,
-              key:item['id'],
-            //   editable: true,
-          }
+
+    const renderData = data.data.data.list.map((item, index) => {
+      return {
+        ...item,
+        key: item['id'],
+        //   editable: true,
+      }
     })
     setarr(renderData);
     setpages({
-        'currPage':data.data.data.currPage,
-        'totalPage':data.data.data.totalPage,
-        'totalCount':data.data.data.totalCount,
+      'currPage': data.data.data.currPage,
+      'totalPage': data.data.data.totalPage,
+      'totalCount': data.data.data.totalCount,
     });
     setifRender(false);
     setifRender(true);
   }
 
-  const callbackFromChild = (data)=>{
-        setitem(data);
-        setifEdit(true);
-        thisForm.current&&thisForm.current.resetFields();
-        modalNode.current.showModal();
+  const callbackFromChild = (data) => {
+    setitem(data);
+    setifEdit(true);
+    thisForm.current && thisForm.current.resetFields();
+    modalNode.current.showModal();
   }
 
-  const deleteCallback = (record)=>{
+  const deleteCallback = (record) => {
     // console.log('删除');
-    delCheckItem([record.id]).then(res=>{
-        if(res.data.msg=="success"){
-                getData();
-        }
+    delCheckItem([record.id]).then(res => {
+      if (res.data.msg == "success") {
+        getData();
+      }
     })
   }
 
-  const handleAdd=()=>{
+  const handleAdd = () => {
 
     setifEdit(false);
     //初始化表单
-    if(arr.length>0){
+    if (arr.length > 0) {
       setitem(arr[0]);
-    }else{
+    } else {
       setitem({
         "checkModeList": "", // 查核方式 必填(暂时写死,需要考虑(下拉框选择))
         "name": "",// 查核项目名称 必填
@@ -443,106 +446,106 @@ const CheckItem = () => {
         "rightAnswerText": "" // 正确答案文字 
       });
     }
-    
+
     modalNode.current.showModal();
   }
 
 
 
-  const commitForm = async ()=>{  //表单提交
-      console.log('提交表单');
-      
-      const formData = await formNode.current.handleCommit();
-      // console.log({formNode,thisForm});
-      modalNode.current.handleCancel();
-      thisForm.current&&thisForm.current.resetFields();
-      formNode.current.state.BindStatus='';
-      formNode.current.state.BindPointStatus='';
+  const commitForm = async () => {  //表单提交
+    console.log('提交表单');
 
-      
+    const formData = await formNode.current.handleCommit();
+    // console.log({formNode,thisForm});
+    modalNode.current.handleCancel();
+    thisForm.current && thisForm.current.resetFields();
+    formNode.current.state.BindStatus = '';
+    formNode.current.state.BindPointStatus = '';
 
-      if(!ifEdit){
-        const param = {
-            "checkModeList":formData.checkModeList, // 查核方式 必填(暂时写死,需要考虑(下拉框选择))
-            "name":formData.name,// 查核项目名称 必填
-            "relatedRules":formData.relatedRules, // 相关条文
-            "rightAnswerImage":'', // 正确答案图片url 上传图片接口待定
-            "rightAnswerText": formData.rightAnswerText,// 正确答案文字  
-            // "score":formData.score,//查核项分数
-        }
-        addCheckItem(param).then(res=>{
-          if(res.data.msg=="success"){
-           getData();
-          }
-        })
+
+
+    if (!ifEdit) {
+      const param = {
+        "checkModeList": formData.checkModeList, // 查核方式 必填(暂时写死,需要考虑(下拉框选择))
+        "name": formData.name,// 查核项目名称 必填
+        "relatedRules": formData.relatedRules, // 相关条文
+        "rightAnswerImage": '', // 正确答案图片url 上传图片接口待定
+        "rightAnswerText": formData.rightAnswerText,// 正确答案文字  
+        // "score":formData.score,//查核项分数
       }
-      if(ifEdit){
-        const paramForCheckItemresult = {
-          "checkItemId":item.checkItemId,   // 查核项id
-          "score":parseInt(formData.score),  // 分数
-          "itemAttr":formData.itemAttr,
+      addCheckItem(param).then(res => {
+        if (res.data.msg == "success") {
+          getData();
         }
-        const param = {
-            "id":item.checkItemId,
-            "checkModeList": formData.checkModeList, // 查核方式
-            "name":formData.checkItemName, // 名称必填
-            "relatedRules":formData.relatedRules, // 相关条文
-            "rightAnswerImage":item.rightAnswerImage,// 应知应会图片url
-            "rightAnswerText":formData.rightAnswerText, // 应知应会文字
+      })
+    }
+    if (ifEdit) {
+      const paramForCheckItemresult = {
+        "checkItemId": item.checkItemId,   // 查核项id
+        "score": parseInt(formData.score),  // 分数
+        "itemAttr": formData.itemAttr,
+      }
+      const param = {
+        "id": item.checkItemId,
+        "checkModeList": formData.checkModeList, // 查核方式
+        "name": formData.checkItemName, // 名称必填
+        "relatedRules": formData.relatedRules, // 相关条文
+        "rightAnswerImage": item.rightAnswerImage,// 应知应会图片url
+        "rightAnswerText": formData.rightAnswerText, // 应知应会文字
+      }
+      // console.log({param,paramForCheckItemresult});
+      //
+
+      addCheckItemCheckResult(paramForCheckItemresult).then(res => {
+        if (res && res.data.msg == "success") {
+          console.log('查核项结果配置成功');
+          editCheckItem(param).then(res => {
+            if (res && res.data.msg == "success") {
+              getData({ page: pages.currPage });
+            }
+          });
+          // getData({page:pages.currPage});
         }
-        // console.log({param,paramForCheckItemresult});
-        //
-
-        addCheckItemCheckResult(paramForCheckItemresult).then(res=>{
-              if(res&&res.data.msg=="success"){
-                console.log('查核项结果配置成功');
-                editCheckItem(param).then(res=>{
-                  if(res&&res.data.msg=="success"){
-                    getData({page:pages.currPage});
-                   }
-                });
-                // getData({page:pages.currPage});
-              }
-        });
+      });
 
-        
-      }
+
+    }
   }
 
-  const paginationCallback = (obj)=>{
-    const {currPage} = obj;
-    getData({page:currPage,pageSize:10,keyword:searchKey});
+  const paginationCallback = (obj) => {
+    const { currPage } = obj;
+    getData({ page: currPage, pageSize: 10, keyword: searchKey });
   }
 
-  const onSearch = (searchKey)=>{
-      //  console.log({searchKey});
-      setsearchKey(searchKey);
-       getData({
-         'keyword':searchKey?searchKey:''
-       });
+  const onSearch = (searchKey) => {
+    //  console.log({searchKey});
+    setsearchKey(searchKey);
+    getData({
+      'keyword': searchKey ? searchKey : ''
+    });
   }
 
-  
-  useEffect(()=>{
+
+  useEffect(() => {
     getData();
-  },[]);
+  }, []);
 
-  return ( 
+  return (
     <div className="app-container">
-          <h1>查核项管理</h1>
-          <ModalWrap width={1000} ref={modalNode} show={ifShowDialog} handleOkCallback={commitForm} >
-                <WrappedTableForm edit={ifEdit} content={item} ref={thisForm} wrappedComponentRef={formNode} />
-          </ModalWrap>
-          <div style={{display:'flex',flexDirection:'row'}}>
-          <Button onClick={handleAdd} type="primary" style={{ marginBottom: 16,marginRight:20 }}>
-             新增查核项
-          </Button>
-          <Search style={{ width: 200 }} allowClear placeholder="请输入查核项"  onSearch={onSearch} enterButton />
-          </div>
-
-          {
-             ifRender&& <EditableFormTable columns={columns} paginationCallback={paginationCallback} pages={pages}  data={arr} deleteCallback={deleteCallback} callbackFromChild={callbackFromChild}  ifUpdateList={ifUpdateList}/>
-          }
+      <h1>查核项管理</h1>
+      <ModalWrap width={1000} ref={modalNode} show={ifShowDialog} handleOkCallback={commitForm} >
+        <WrappedTableForm edit={ifEdit} content={item} ref={thisForm} wrappedComponentRef={formNode} />
+      </ModalWrap>
+      <div style={{ display: 'flex', flexDirection: 'row' }}>
+        <Button onClick={handleAdd} type="primary" style={{ marginBottom: 16, marginRight: 20 }}>
+          新增查核项
+        </Button>
+        <Search style={{ width: 200 }} allowClear placeholder="请输入查核项" onSearch={onSearch} enterButton />
+      </div>
+
+      {
+        ifRender && <EditableFormTable columns={columns} paginationCallback={paginationCallback} pages={pages} data={arr} deleteCallback={deleteCallback} callbackFromChild={callbackFromChild} ifUpdateList={ifUpdateList} />
+      }
     </div>
   );
 }
@@ -550,5 +553,5 @@ const CheckItem = () => {
 
 
 
- 
+
 export default CheckItem;

+ 7 - 1
src/views/checkPointManage/pointAndProvisions/pointAndProvisions.jsx

@@ -25,7 +25,13 @@ const PointAndCheckGroup = () => {
       render: text => <a>{text}</a>,
     },
     {
-      title: '条文条款名',
+      title: '条文四码',
+      dataIndex: 'articleVersion',
+      key: 'articleVersion',
+      width:'10%',
+    },
+    {
+      title: '条文内容',
       dataIndex: 'articleName',
       key: 'articleName',
       editable: true,

+ 2 - 1
src/views/checkPointManage/pointAndProvisions/table.js

@@ -5,7 +5,7 @@
 /*
  * @Author: your name
  * @Date: 2021-04-27 11:19:40
- * @LastEditTime: 2021-04-28 17:03:31
+ * @LastEditTime: 2021-08-18 20:19:36
  * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: /react-antd-admin-template/src/views/groupManage/groupIdentity/table.js
@@ -27,6 +27,7 @@ class EditableTable extends React.Component {
       ...props.columns,
       {
         title: '操作',
+        width:'7%',
         dataIndex: 'operation',
         render: (text, record) => {
           const { editingKey} = this.state;

+ 1 - 1
src/views/login/index.jsx

@@ -155,7 +155,7 @@ const Login = (props) => {
                 htmlType="submit"
                 className="login-form-button"
               >
-                登录 ^_^
+                登录
               </Button>
             </Form.Item>
             {/* <Form.Item>

+ 8 - 8
src/views/provisionsManage/provisions.jsx

@@ -195,19 +195,19 @@ const CheckGroupManage = () => {
       render: text => <a>{text}</a>,
     },
     {
-      title: '条文条款名',
+      title: '条文四码',
+      dataIndex: 'articleVersion',
+      key: 'articleVersion',
+      editable: true,
+      width:'10%',
+    },
+    {
+      title: '条文内容',
       dataIndex: 'articleName',
       key: 'articleName',
       editable: true,
       width:'30%',
     },
-    {
-        title: '条文条款版本',
-        dataIndex: 'articleVersion',
-        key: 'articleVersion',
-        editable: true,
-        width:'10%',
-    },
     {
         title: '制度类型',
         dataIndex: 'ruleType',

BIN
追踪方法学管理工具v0.1.2_179_build0716.zip


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff