浏览代码

新增多企业公出、切换打卡地址

dev01 1 年之前
父节点
当前提交
ebbd94265f

+ 5 - 1
src/app.config.js

@@ -46,7 +46,11 @@ export default {
     navigationBarTextStyle: 'black',
     navigationBarTextStyle: 'black',
   },
   },
   requiredBackgroundModes: ['location'],
   requiredBackgroundModes: ['location'],
-  requiredPrivateInfos: ["getLocation"],
+  requiredPrivateInfos: [
+    "getLocation",
+    "onLocationChange",
+    "startLocationUpdate",
+  ],
   plugins: {
   plugins: {
     chooseLocation: {
     chooseLocation: {
       version: "1.0.8",
       version: "1.0.8",

+ 2 - 2
src/app.jsx

@@ -57,7 +57,7 @@ class App extends Component {
       header: {
       header: {
         'token': token,
         'token': token,
       },
       },
-      url: "wss://bm.jishutao.com/webSocketServer",
+      url: 'wss://bm.jishutao.com/webSocketServer',
       // url: 'wss://172.16.0.255:8080/webSocketServer'
       // url: 'wss://172.16.0.255:8080/webSocketServer'
       // url: 'wss://uat.jishutao.com/webSocketServer'
       // url: 'wss://uat.jishutao.com/webSocketServer'
     })
     })
@@ -69,7 +69,7 @@ class App extends Component {
 
 
     //接收数据
     //接收数据
     Taro.onSocketMessage(function (data) {
     Taro.onSocketMessage(function (data) {
-      console.log(data, '接收数据')
+      console.log('接收数据', data)
       Taro.eventCenter.trigger('GoPuncsshIn', data)
       Taro.eventCenter.trigger('GoPuncsshIn', data)
     })
     })
 
 

+ 103 - 6
src/pages/applyDepart/enterprise.jsx

@@ -23,6 +23,7 @@ class Enterprise extends Component {
       listValue: {},
       listValue: {},
       orderNo: [],
       orderNo: [],
       newList: [],
       newList: [],
+      jsList: [],
     };
     };
     this.onChange = this.onChange.bind(this);
     this.onChange = this.onChange.bind(this);
     this.getList = this.getList.bind(this);
     this.getList = this.getList.bind(this);
@@ -163,6 +164,7 @@ class Enterprise extends Component {
             });
             });
           }}
           }}
         />
         />
+        {/* 业务行政公出 */}
         {
         {
           this.state.newList.length > 0 && this.props.type != 1 &&
           this.state.newList.length > 0 && this.props.type != 1 &&
           <View className="slist">
           <View className="slist">
@@ -202,6 +204,67 @@ class Enterprise extends Component {
             <View className="cltips">增加企业:搜索增加更多企业,删除企业:点击“X”删除公出列表</View>
             <View className="cltips">增加企业:搜索增加更多企业,删除企业:点击“X”删除公出列表</View>
           </View>
           </View>
         }
         }
+        {/* 技术公出 */}
+        {
+          this.state.jsList.length > 0 && this.props.type == 1 &&
+          <View className="slist">
+            <View style={{ fontSize: "30rpx" }}>本次公出列表</View>
+            {
+              this.state.jsList.map((item, index) =>
+                <View className="slitems" key={index}>
+                  <Text>{index + 1}、{item.name}{!!item.contractNo && `(${item.contractNo})`}</Text>
+                  <AtIcon value='close' size='18'
+                    onClick={() => {
+                      let list = this.state.jsList
+                      for (var i = 0; i < list.length; i++) {
+                        if (list[i].id == item.id) {
+                          list.splice(i, 1)
+                          this.setState({
+                            jsList: list
+                          })
+                        }
+                      }
+                    }}
+                  />
+                </View>
+              )
+            }
+            <View className="slbt">
+              <AtButton size="small" type='primary'
+                onClick={() => {
+                  let contractNo = ""
+                  let orderNo = ""
+                  let select = 0
+                  for (var i = 0; i < this.state.jsList.length; i++) {
+                    if (!!this.state.jsList[i].contractNo) {
+                      contractNo = this.state.jsList[i].contractNo
+                      orderNo = this.state.jsList[i].orderNo
+                      select = 1
+                    }
+                  }
+                  if (select == 0) {
+                    Taro.showToast({
+                      title: "必须选择一个派单编号",
+                      icon: 'none'
+                    })
+                    return
+                  }
+
+                  Taro.eventCenter.trigger("enterprise",
+                    {
+                      id: this.state.jsList.map(obj => { return obj.id; }).join(","),
+                      name: this.state.jsList.map(obj => { return obj.name; }).join(","),
+                      contractNo,
+                      orderNo,
+                    }
+                  );
+                }}
+              >确定公出列表</AtButton>
+            </View>
+            <View className="cltips">增加企业:搜索增加更多企业,删除企业:点击“X”删除公出列表</View>
+          </View>
+        }
+
         <View>
         <View>
           {this.props.type == 0 || this.props.type == 2
           {this.props.type == 0 || this.props.type == 2
             ? this.state.list.map((v, k) => (
             ? this.state.list.map((v, k) => (
@@ -238,11 +301,39 @@ class Enterprise extends Component {
                     arrow="right"
                     arrow="right"
                     iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
                     iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
                     onClick={() => {
                     onClick={() => {
-                      this.setState({
-                        listVisible: true,
-                        listValue: v,
-                      });
-                      this.getByUid(v);
+                      let select = 0
+                      if (this.state.jsList.length == 0) {
+                        select = 0
+                      }
+                      for (var i = 0; i < this.state.jsList.length; i++) {
+                        if (!!this.state.jsList[i].contractNo) {
+                          select = 1
+                        }
+                      }
+
+                      if (select == 0) {
+                        this.setState({
+                          listVisible: true,
+                          listValue: v,
+                        });
+                        this.getByUid(v);
+                      } else {
+                        let list = this.state.jsList
+                        for (var i = 0; i < list.length; i++) {
+                          if (list[i].id == v.id) {
+                            Taro.showToast({
+                              title: "该企业已在公出列表中",
+                              icon: 'none'
+                            })
+                            return
+                          }
+                        }
+                        list.push(v)
+                        this.setState({
+                          jsList: list
+                        })
+                      }
+
                     }}
                     }}
                   />
                   />
                 </View>
                 </View>
@@ -286,7 +377,13 @@ class Enterprise extends Component {
                             });
                             });
                             v.name = this.state.listValue.name;
                             v.name = this.state.listValue.name;
                             v.id = this.state.listValue.id;
                             v.id = this.state.listValue.id;
-                            Taro.eventCenter.trigger("enterprise", v);
+
+                            let list = this.state.jsList
+                            list.push(v)
+                            this.setState({
+                              jsList: list
+                            })
+                            // Taro.eventCenter.trigger("enterprise", v);
                           }}
                           }}
                         >
                         >
                           选择
                           选择

+ 2 - 0
src/pages/applyDepart/publicContent.jsx

@@ -16,6 +16,7 @@ import {
   getHours,
   getHours,
   getNumHourse,
   getNumHourse,
   getUserWordTimes,
   getUserWordTimes,
+  getNameList,
 } from "../../utils/tools";
 } from "../../utils/tools";
 
 
 import "taro-ui/dist/style/components/form.scss";
 import "taro-ui/dist/style/components/form.scss";
@@ -158,6 +159,7 @@ class PublicContent extends Component {
       validDate: JSON.stringify(this.state.validDates),
       validDate: JSON.stringify(this.state.validDates),
       assist: this.state.coorderList.length === 0 ? 0 : 1,
       assist: this.state.coorderList.length === 0 ? 0 : 1,
       assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
       assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
+      assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
     };
     };
     if (this.props.enterpriseInfor.type == 0) {
     if (this.props.enterpriseInfor.type == 0) {
       datas = {
       datas = {

+ 6 - 0
src/pages/applyDepart/publicContent.less

@@ -33,6 +33,12 @@
       align-items: center;
       align-items: center;
       justify-content: flex-end;
       justify-content: flex-end;
 
 
+      .button{
+        font-size: 22px;
+        padding: 0 10px;
+        
+      }
+
       .time {
       .time {
         flex: 1;
         flex: 1;
         font-size: 30px;
         font-size: 30px;

+ 85 - 15
src/pages/egressDetails/enterprise.jsx

@@ -198,6 +198,36 @@ class Enterprise extends Component {
             <View className="cltips">删除企业:点击“X”删除公出列表</View>
             <View className="cltips">删除企业:点击“X”删除公出列表</View>
           </View>
           </View>
         }
         }
+
+        {
+          this.props.jsList.length > 0 && this.props.type == 1 &&
+          <View className="slist">
+            <View style={{ fontSize: "30rpx" }}>本次公出列表</View>
+            {
+              this.props.jsList.map((item, index) =>
+                <View className="slitems" key={index}>
+                  <Text>{index + 1}、{item.name}{!!item.contractNo && `(${item.contractNo})`}</Text>
+                  <AtIcon value='close' size='18'
+                    onClick={() => {
+                      let list = this.props.jsList
+                      for (var i = 0; i < list.length; i++) {
+                        if (list[i].id == item.id) {
+                          list.splice(i, 1)
+                          this.setState({
+                            jsList: list
+                          })
+                        }
+                      }
+                    }}
+                  />
+                </View>
+              )
+            }
+            <View className="cltips">增加企业:搜索增加更多企业</View>
+            <View className="cltips">删除企业:点击“X”删除公出列表</View>
+          </View>
+        }
+
         <View>
         <View>
           {this.props.type == 0 || this.props.type == 2 ? (
           {this.props.type == 0 || this.props.type == 2 ? (
             <View>
             <View>
@@ -269,12 +299,45 @@ class Enterprise extends Component {
                   }}
                   }}
                   key={k}
                   key={k}
                   onClick={() => {
                   onClick={() => {
-                    this.setState({
-                      // selectId:v.id
-                      listValue: v,
-                      listVisible: true,
-                    });
-                    this.getByUid(v);
+
+                    let select = 0
+                      if (this.props.jsList.length == 0) {
+                        select = 0
+                      }
+                      for (var i = 0; i < this.props.jsList.length; i++) {
+                        if (!!this.props.jsList[i].contractNo) {
+                          select = 1
+                        }
+                      }
+                      if (select == 0) {
+                        this.setState({
+                          listVisible: true,
+                          listValue: v,
+                        });
+                        this.getByUid(v);
+                      } else {
+                        let list = this.props.jsList
+                        for (var i = 0; i < list.length; i++) {
+                          if (list[i].id == v.id) {
+                            Taro.showToast({
+                              title: "该企业已在公出列表中",
+                              icon: 'none'
+                            })
+                            return
+                          }
+                        }
+                        list.push(v)
+                        this.setState({
+                          jsList: list
+                        })
+                      }
+
+                    // this.setState({
+                    //   // selectId:v.id
+                    //   listValue: v,
+                    //   listVisible: true,
+                    // });
+                    // this.getByUid(v);
                     // this.props.onVisible()
                     // this.props.onVisible()
                     // this.props.onChange({uid:v.id,nickname:v.name});
                     // this.props.onChange({uid:v.id,nickname:v.name});
                   }}
                   }}
@@ -341,15 +404,22 @@ class Enterprise extends Component {
                             });
                             });
                             v.id = this.state.listValue.id;
                             v.id = this.state.listValue.id;
                             v.name = this.state.listValue.name;
                             v.name = this.state.listValue.name;
-                            this.props.onChange(
-                              {
-                                uids: v.id,
-                                userNames: v.name,
-                                orderNo: v.orderNo,
-                                contractNo: v.contractNo,
-                              },
-                              1
-                            );
+
+                            let list = this.props.jsList
+                            list.push(v)
+                            this.setState({
+                              jsList: list
+                            })
+
+                            // this.props.onChange(
+                            //   {
+                            //     uids: v.id,
+                            //     userNames: v.name,
+                            //     orderNo: v.orderNo,
+                            //     contractNo: v.contractNo,
+                            //   },
+                            //   1
+                            // );
                             // Taro.eventCenter.trigger('enterprise', v)
                             // Taro.eventCenter.trigger('enterprise', v)
                           }}
                           }}
                         >
                         >

+ 1 - 0
src/pages/egressDetails/index.jsx

@@ -724,6 +724,7 @@ class EgressDetails extends Component {
                         this.setState({
                         this.setState({
                           isModifyOpened: true,
                           isModifyOpened: true,
                           isVerify: true,
                           isVerify: true,
+                          foc: false,
                         });
                         });
                       },
                       },
                     });
                     });

+ 23 - 16
src/pages/egressDetails/modify.jsx

@@ -27,7 +27,9 @@ class Modify extends Component {
       // color: "secondary",
       // color: "secondary",
       type: 0,
       type: 0,
       visibles: true,
       visibles: true,
-      newList: getNewList(props.dtails.uids, props.dtails.userNames),
+      // newList: getNewList(props.dtails.uids, props.dtails.userNames),
+      newList: [],
+      jsList: [],
     };
     };
     this.submit = this.submit.bind(this);
     this.submit = this.submit.bind(this);
     this.onChange = this.onChange.bind(this);
     this.onChange = this.onChange.bind(this);
@@ -41,13 +43,13 @@ class Modify extends Component {
   }
   }
 
 
   submit() {
   submit() {
-    if (this.state.type == 1) {
-      Taro.showToast({ title: "技术公出请直接点击公出企业", icon: "none" });
-      return;
-    } else if (this.state.length == 0) {
-      Taro.showToast({ title: "请先选择公出的企业", icon: "none" });
-      return;
-    }
+    // if (this.state.type == 1) {
+    //   Taro.showToast({ title: "技术公出请直接点击公出企业", icon: "none" });
+    //   return;
+    // } else if (this.state.length == 0) {
+    //   Taro.showToast({ title: "请先选择公出的企业", icon: "none" });
+    //   return;
+    // }
     // if (Object.keys(this.state.data).length === 0) {
     // if (Object.keys(this.state.data).length === 0) {
     //   Taro.showToast({ title: "请先选择公出的企业", icon: "none" });
     //   Taro.showToast({ title: "请先选择公出的企业", icon: "none" });
     //   return;
     //   return;
@@ -55,17 +57,21 @@ class Modify extends Component {
     //   Taro.showToast({ title: "技术公出请直接点击公出企业", icon: "none" });
     //   Taro.showToast({ title: "技术公出请直接点击公出企业", icon: "none" });
     //   return;
     //   return;
     // }
     // }
+    let obj = {}
     if (this.state.type != 1) {
     if (this.state.type != 1) {
-      let obj = { uids: this.getValue(this.state.newList, "id"), userNames: this.getValue(this.state.newList, "name") }
-      this.setState({
-        dtails: {
-          ...this.state.dtails,
-          ...obj,
-        },
-        data: obj,
-      })
+      obj = { uids: this.getValue(this.state.newList, "id"), userNames: this.getValue(this.state.newList, "name"), type: this.state.type }
+    } else {
+      obj = { uids: this.getValue(this.state.jsList, "id"), userNames: this.getValue(this.state.jsList, "name"), type: this.state.type }
     }
     }
     this.setState({
     this.setState({
+      dtails: {
+        ...this.state.dtails,
+        ...obj,
+      },
+      data: obj,
+    })
+
+    this.setState({
       modifyType: 2,
       modifyType: 2,
     });
     });
   }
   }
@@ -164,6 +170,7 @@ class Modify extends Component {
               isVerify={this.props.isVerify} //判断是否在审核中修改
               isVerify={this.props.isVerify} //判断是否在审核中修改
               onChange={this.onChange}
               onChange={this.onChange}
               newList={this.state.newList}
               newList={this.state.newList}
+              jsList={this.state.jsList}
               onListChange={this.onListChange}
               onListChange={this.onListChange}
             />
             />
           ) : (
           ) : (

+ 5 - 1
src/pages/egressDetails/publicContent.jsx

@@ -14,7 +14,7 @@ import {
   addPublicRelease,
   addPublicRelease,
 } from "../../utils/servers/servers";
 } from "../../utils/servers/servers";
 
 
-import { getHours, getNumHourse, getUserWordTimes } from "../../utils/tools";
+import { getHours, getNumHourse, getUserWordTimes, getNameList } from "../../utils/tools";
 
 
 import "taro-ui/dist/style/components/form.scss";
 import "taro-ui/dist/style/components/form.scss";
 import "taro-ui/dist/style/components/button.scss";
 import "taro-ui/dist/style/components/button.scss";
@@ -228,6 +228,7 @@ class PublicContent extends Component {
         status: 1,
         status: 1,
         assist: this.state.coorderList.length === 0 ? 0 : 1,
         assist: this.state.coorderList.length === 0 ? 0 : 1,
         assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
         assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
+        assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
       };
       };
     } else if (this.props.dtails.type == 2) {
     } else if (this.props.dtails.type == 2) {
       datas = {
       datas = {
@@ -249,6 +250,7 @@ class PublicContent extends Component {
         status: 1,
         status: 1,
         assist: this.state.coorderList.length === 0 ? 0 : 1,
         assist: this.state.coorderList.length === 0 ? 0 : 1,
         assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
         assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
+        assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
       };
       };
     } else {
     } else {
       datas = {
       datas = {
@@ -270,6 +272,7 @@ class PublicContent extends Component {
         status: 1,
         status: 1,
         assist: this.state.coorderList.length === 0 ? 0 : 1,
         assist: this.state.coorderList.length === 0 ? 0 : 1,
         assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
         assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
+        assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
       };
       };
     }
     }
     if (isVerify) {
     if (isVerify) {
@@ -363,6 +366,7 @@ class PublicContent extends Component {
       validDate: JSON.stringify(this.state.validDates),
       validDate: JSON.stringify(this.state.validDates),
       assist: this.state.coorderList.length === 0 ? 0 : 1,
       assist: this.state.coorderList.length === 0 ? 0 : 1,
       assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
       assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
+      assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
     };
     };
     if (this.props.dtails.type == 0) {
     if (this.props.dtails.type == 0) {
       datas = {
       datas = {

+ 4 - 0
src/pages/punchClock/index.less

@@ -331,4 +331,8 @@
       }
       }
     }
     }
   }
   }
+}
+
+.at-radio__title{
+  font-size: 26px;
 }
 }

+ 8 - 7
src/pages/punchClock/punchClocks.jsx

@@ -194,8 +194,6 @@ class PunchClocks extends Component {
             this.setState({
             this.setState({
               dtails: v.data,
               dtails: v.data,
               data,
               data,
-              // addressLatitude: parseFloat(arg.latitude),
-              // addressLongitude: parseFloat(arg.longitude),
               addressLatitude: parseFloat(data.latitude),
               addressLatitude: parseFloat(data.latitude),
               addressLongitude: parseFloat(data.longitude),
               addressLongitude: parseFloat(data.longitude),
             }, () => {
             }, () => {
@@ -522,11 +520,14 @@ class PunchClocks extends Component {
                 <View className="enterprise">
                 <View className="enterprise">
                   <View className='entit'>公出企业</View>
                   <View className='entit'>公出企业</View>
                   <View className='userlist'>
                   <View className='userlist'>
-                    <Text className='username'>{data.userName}</Text>
+                    <Text className='username'>
+                      {data.userName}
+                      {(data.clockIn === 1 || data.clockIn === 2) && <Text style={{ color: "#72cb78" }}>(已打卡)</Text>}
+                    </Text>
                     {
                     {
                       this.state.dtails.prdList?.length > 1 &&
                       this.state.dtails.prdList?.length > 1 &&
-                      <View className='switch'>
-                        <View className='stxt' onClick={() => { this.setState({ isTips: true }) }}>切换企业</View>
+                      <View className='switch' onClick={() => { this.setState({ isTips: true }) }}>
+                        <View className='stxt'>切换企业</View>
                         <Image src={switchIocn} className='sicon' />
                         <Image src={switchIocn} className='sicon' />
                       </View>
                       </View>
                     }
                     }
@@ -577,7 +578,7 @@ class PunchClocks extends Component {
                         isAbnormalOpen: true
                         isAbnormalOpen: true
                       })
                       })
                     }}
                     }}
-                  >{(data.clockIn === 1 || data.clockIn === 2) ? "新打卡" : "异常打卡"}</View>
+                  >{(data.clockIn === 1 || data.clockIn === 2) ? "新打卡" : "异常打卡"}</View>
                 }
                 }
 
 
                 <View className='punchClockContent'
                 <View className='punchClockContent'
@@ -623,7 +624,7 @@ class PunchClocks extends Component {
                   <View className='punchClockTitle'>
                   <View className='punchClockTitle'>
                     {
                     {
                       (data.clockIn === 1 || data.clockIn === 2) ?
                       (data.clockIn === 1 || data.clockIn === 2) ?
-                        '新打卡' : '公出打卡'
+                        '新打卡' : '公出打卡'
                     }
                     }
                   </View>
                   </View>
                   <View className='punchClockTime'>{this.state.nowTime}</View>
                   <View className='punchClockTime'>{this.state.nowTime}</View>

+ 1 - 1
src/utils/config.js

@@ -1,5 +1,5 @@
 // 本地
 // 本地
-export const resourceAddress = 'http://172.16.0.255:3000/upload;'
+// export const resourceAddress = 'http://172.16.0.255:3000/upload;'
 // 生产
 // 生产
 // export const resourceAddress = 'https://s.jishutao.com/upload';
 // export const resourceAddress = 'https://s.jishutao.com/upload';
 // 测试
 // 测试

+ 2 - 2
src/utils/servers/baseUrl.js

@@ -7,9 +7,9 @@ const getBaseUrl = (url) => {
     BASE_URL = 'https://bm.jishutao.com'
     BASE_URL = 'https://bm.jishutao.com'
   } else {
   } else {
     // 生产环境
     // 生产环境
-    BASE_URL = 'http://172.16.0.255:8080'
+    // BASE_URL = 'http://172.16.0.255:8080'
     // BASE_URL = 'https://uat.jishutao.com'
     // BASE_URL = 'https://uat.jishutao.com'
-    // BASE_URL = 'https://bm.jishutao.com'
+    BASE_URL = 'https://bm.jishutao.com'
   }
   }
   return BASE_URL
   return BASE_URL
 }
 }

+ 12 - 1
src/utils/tools/index.js

@@ -166,7 +166,7 @@ export const getNewList = (uids, unames) => {
 export const getNewOptions = (arr) => {
 export const getNewOptions = (arr) => {
   let list = []
   let list = []
   for (var i = 0; i < arr.length; i++) {
   for (var i = 0; i < arr.length; i++) {
-    list.push({ label: arr[i].userName, value: arr[i].uid })
+    list.push({ label: arr[i].userName, value: arr[i].uid, desc: arr[i].clockIn == 1 ? "(已打卡)" : "(未打卡)" })
   }
   }
   return list
   return list
 }
 }
@@ -193,3 +193,14 @@ export const unique = (arr, key) => {
   }
   }
   return arr;
   return arr;
 }
 }
+
+// 
+export const getNameList = (aidList, arr) => {
+  let list = []
+  for (var i = 0; i < aidList.length; i++) {
+    if (aidList[i] == arr[i].id) {
+      list.push(arr[i].name)
+    }
+  }
+  return list
+}