Преглед изворни кода

修复公出汇总选择部门未生效bug

dev01 пре 2 година
родитељ
комит
c7c03eb83d

+ 24 - 11
js/component/common/cascaders/index.jsx

@@ -1,17 +1,28 @@
 import React, { Component } from "react";
-import { Button, message, Modal, Spin, Table, Checkbox, Collapse, } from "antd";
+import { Button, message, Checkbox, Collapse, } from "antd";
 import $ from "jquery/src/ajax";
 import "./index.less";
 
-//选择部门组件  2022-07-12
+/**
+ * 部门多选组件  2022-07-12
+ * <Cascaders
+ *   ref={node => this.Cascaders = node}
+ *   placeholder="请选择公出部门"
+ *   id="id"
+ *   name="name"
+ *   children="list"
+ *   height={28}
+ *   onSel={(e) => {}}
+ * />
+ */
 class Cascaders extends Component {
   constructor(props) {
     super(props);
     this.state = {
-      visible: false,//弹窗开关
-      authTree: [],//列表显示数据
-      checkedList: [],//选中数据
-      isFous: true,
+      visible: false, // 弹窗开关
+      authTree: [], // 列表显示数据
+      checkedList: [], // 选中数据
+      isFous: true, // 是否在组件外
     };
     this.itemHandle = this.itemHandle.bind(this);
     this.onSelect = this.onSelect.bind(this);
@@ -41,7 +52,6 @@ class Cascaders extends Component {
       url: globalConfig.context + "/api/admin/organization/getAllDep",
       data: {},
       success: function (data) {
-        let theArr = [];
         if (data.error && data.error.length === 0) {
           localStorage.setItem("departmentData", JSON.stringify(data.data));
           this.setState({
@@ -99,6 +109,7 @@ class Cascaders extends Component {
     this.setState({
       checkedList: list,
       visible: false,
+      isFous: true,
     })
     onSel(list)
   }
@@ -106,6 +117,7 @@ class Cascaders extends Component {
   onCancel() {
     this.setState({
       visible: false,
+      isFous: true,
     })
   }
   // 代码二级联动
@@ -142,14 +154,14 @@ class Cascaders extends Component {
       authTree,
     });
   }
-  // 清空  现用于重置
+  // 清空  现用于父级重置
   empty() {
     this.setState({
       visible: false,
+      isFous: true,
       checkedList: []
     })
   }
-
   // checked组件样式
   inde(item) {
     const { children } = this.props
@@ -192,7 +204,7 @@ class Cascaders extends Component {
         key={item1[id]}
         header={(
           <div className="item">
-            {/* 一级复选框(向下操控二级三级) */}
+            {/* 一级复选框(向下操控二级) */}
             <Checkbox
               indeterminate={this.inde(item1)}
               name={item1[id]}
@@ -207,7 +219,7 @@ class Cascaders extends Component {
           </div>
         )}
       >
-        {/* 二级复选框(向下操控三级,向上联动一级) */}
+        {/* 二级复选框(向上联动一级) */}
         {!!item1[children] && item1[children].map((item2) => (
           <div key={item2[id]} className="item">
             <Checkbox
@@ -238,6 +250,7 @@ class Cascaders extends Component {
           style={{
             height: height,
             width: width,
+            borderColor: visible && "#80b9ff",
             color: checkedList.length > 0
               ? "rgba(0, 0, 0, 0.65)"
               : "rgba(191, 191, 191, 1)"

+ 5 - 0
js/component/common/cascaders/index.less

@@ -22,6 +22,11 @@
 
 }
 
+.cinput:hover {
+  border-color: #80b9ff;
+  
+}
+
 
 .cpop {
   -webkit-tap-highlight-color: rgba(0, 0, 0, 0);

+ 22 - 6
js/component/manageCenter/customer/publicSummary/index.jsx

@@ -20,6 +20,7 @@ import $ from "jquery/src/ajax";
 import "./index.less";
 import moment from "moment";
 import ImgList from "../../../common/imgList";
+import Cascaders from "../../../common/cascaders";
 
 const { TabPane } = Tabs;
 const { RangePicker } = DatePicker;
@@ -322,7 +323,7 @@ class PublicSummary extends Component {
       releaseDate: [],
       status: undefined,
       clockIn: undefined,
-      depId: undefined,
+      deps: undefined,
       theTypes: undefined,
       theTypes1: undefined,
       theCustomerTypes: undefined,
@@ -421,7 +422,7 @@ class PublicSummary extends Component {
         uid: this.state.theCustomerTypes,
         status: this.state.status,
         clockIn: this.state.clockIn,
-        depId: this.state.depId || undefined,
+        deps: this.state.deps || undefined,
         publicType: this.state.type,
       },
       success: function (data) {
@@ -467,7 +468,7 @@ class PublicSummary extends Component {
         theCustomerTypes: undefined,
         status: undefined,
         clockIn: undefined,
-        depId: undefined,
+        deps: undefined,
         auto: "",
         auto1: "",
         customer: "",
@@ -476,6 +477,7 @@ class PublicSummary extends Component {
         type: undefined,
       },
       () => {
+        this.Cascaders.empty();
         this.loadData();
       }
     );
@@ -658,7 +660,8 @@ class PublicSummary extends Component {
       uid: this.state.theCustomerTypes,
       status: this.state.status,
       clockIn: this.state.clockIn,
-      depId: this.state.depId,
+      // depId: this.state.depId,
+      deps: this.state.deps,
       publicType: this.state.type,
     };
     for (let i of Object.keys(data)) {
@@ -862,7 +865,20 @@ class PublicSummary extends Component {
                     <Input />
                   </AutoComplete>
                 </span>
-                <span style={{ marginRight: "10px" }}>
+                <Cascaders
+                  ref={node => this.Cascaders = node}
+                  placeholder="请选择公出部门"
+                  id="id"
+                  name="name"
+                  children="list"
+                  height={28}
+                  onSel={(e) => {
+                    this.setState({
+                      deps: JSON.stringify(e),
+                    });
+                  }}
+                />
+                {/* <span style={{ marginRight: "10px" }}>
                   <Select
                     placeholder="请选择公出部门"
                     style={{ width: 200 }}
@@ -874,7 +890,7 @@ class PublicSummary extends Component {
                   >
                     {this.state.contactsOption}
                   </Select>
-                </span>
+                </span> */}
                 <span style={{ marginRight: "10px" }}>
                   <span style={{ marginRight: "5px", marginBottom: "10px" }}>
                     公出时间 :