dev01 3 gadi atpakaļ
vecāks
revīzija
7bb0925a25

+ 1 - 0
package.json

@@ -8,6 +8,7 @@
     "typescript": false,
     "css": "less"
   },
+  
   "scripts": {
     "build:weapp": "taro build --type weapp",
     "build:swan": "taro build --type swan",

+ 18 - 7
project.config.json

@@ -1,7 +1,7 @@
 {
     "miniprogramRoot": "dist/",
     "projectname": "kede-tool-weapp",
-    "description": "科德工具小程序",
+    "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
     "appid": "wxff2f5720ed7d7f63",
     "setting": {
         "urlCheck": false,
@@ -9,7 +9,7 @@
         "enhance": true,
         "postcss": false,
         "preloadBackgroundData": false,
-        "minified": false,
+        "minified": true,
         "newFeature": false,
         "coverView": true,
         "nodeModules": false,
@@ -22,9 +22,9 @@
         "uploadWithSourceMap": true,
         "compileHotReLoad": false,
         "lazyloadPlaceholderEnable": false,
-        "useMultiFrameRuntime": true,
-        "useApiHook": true,
-        "useApiHostProcess": true,
+        "useMultiFrameRuntime": false,
+        "useApiHook": false,
+        "useApiHostProcess": false,
         "babelSetting": {
             "ignore": [],
             "disablePlugins": [],
@@ -39,8 +39,19 @@
         "disableUseStrict": false,
         "minifyWXML": true,
         "showES6CompileOption": false,
-        "useCompilerPlugins": false
+        "useCompilerPlugins": false,
+        "useStaticServer": true
     },
     "compileType": "miniprogram",
-    "condition": {}
+    "condition": {},
+    "libVersion": "2.21.0",
+    "srcMiniprogramRoot": "dist/",
+    "packOptions": {
+        "ignore": [],
+        "include": []
+    },
+    "editorSetting": {
+        "tabIndent": "insertSpaces",
+        "tabSize": 4
+    }
 }

+ 229 - 137
src/pages/applyDepart/enterprise.jsx

@@ -1,122 +1,138 @@
-import React, { Component } from 'react';
-import { View } from '@tarojs/components'
-import { getUserByName, getOrderByUid } from '../../utils/servers/servers';
+import React, { Component } from "react";
+import { View } from "@tarojs/components";
+import { getUserByName, getOrderByUid } from "../../utils/servers/servers";
 
-import { AtSearchBar, AtListItem, AtButton } from 'taro-ui'
+import { AtSearchBar, AtListItem, AtButton } from "taro-ui";
 
-import 'taro-ui/dist/style/components/search-bar.scss';
-import 'taro-ui/dist/style/components/button.scss';
-import 'taro-ui/dist/style/components/icon.scss';
-import 'taro-ui/dist/style/components/list.scss';
-import 'taro-ui/dist/style/components/icon.scss';
+import "taro-ui/dist/style/components/search-bar.scss";
+import "taro-ui/dist/style/components/button.scss";
+import "taro-ui/dist/style/components/icon.scss";
+import "taro-ui/dist/style/components/list.scss";
+import "taro-ui/dist/style/components/icon.scss";
 
-import ListBottomStart from '../../components/common/listBottomStart';
+import ListBottomStart from "../../components/common/listBottomStart";
 
-import Taro from '@tarojs/taro';
+import Taro from "@tarojs/taro";
 
 class Enterprise extends Component {
   constructor(props) {
     super(props);
     this.state = {
-      value: '',
+      value: "",
       list: [],
-      listState: 'NO_DATA',
+      listState: "NO_DATA",
       pageNo: 1,
       listVisible: false,
       listValue: {},
       orderNo: [],
-    }
+    };
     this.onChange = this.onChange.bind(this);
     this.getList = this.getList.bind(this);
   }
 
   componentDidMount() {
-    Taro.eventCenter.on('result', () => {
+    Taro.eventCenter.on("result", () => {
       this.setState({
-        value: '',
+        value: "",
         list: [],
-        listState: 'NO_DATA',
-        pageNo: 1
-      })
-    })
-    Taro.eventCenter.on('applyDepartSearchList', () => {
+        listState: "NO_DATA",
+        pageNo: 1,
+      });
+    });
+    Taro.eventCenter.on("applyDepartSearchList", () => {
       this.getList(this.state.value, this.state.pageNo + 1);
-    })
+    });
   }
 
   onChange(value, lv = true) {
     this.setState({
       value,
-    })
+    });
     if (value.length < 2 && !lv) {
-      Taro.showToast({ title: '最少输入两个字符', icon: 'none' })
-      return
+      Taro.showToast({ title: "最少输入两个字符", icon: "none" });
+      return;
+    }
+    if (value.length < 4 && lv) {
+      return;
     }
-    if (value.length < 4 && lv) { return }
     this.getList(value);
   }
   getByUid(val) {
     this.setState({
-      listState: 'LOADING'
-    })
+      listState: "LOADING",
+    });
     getOrderByUid({
-      uid: val.id
+      uid: val.id,
     }).then((msg) => {
       if (msg.error.length === 0) {
         let data = msg.data;
         this.setState({
-          listState: 'NO_MORE_DATA',
-          orderNo: data
-        })
+          listState: "NO_MORE_DATA",
+          orderNo: data,
+        });
       } else {
-        Taro.showToast({ title: msg.error[0].message, icon: 'none' });
+        Taro.showToast({ title: msg.error[0].message, icon: "none" });
         this.setState({
-          listState: msg.error[0].field === '403' ? 'NO_DATA' : 'RELOAD'
-        })
+          listState: msg.error[0].field === "403" ? "NO_DATA" : "RELOAD",
+        });
       }
-    })
+    });
   }
   getList(value = this.state.value, pageNo = 1) {
     this.setState({
-      listState: 'LOADING'
-    })
+      listState: "LOADING",
+    });
     getUserByName({
       name: value,
       pageNo: pageNo,
       pageSize: 10,
-    }).then((msg) => {
-      if (msg.error.length === 0) {
-        if (msg.data.totalCount === 0) {
-          this.setState({
-            listState: 'NO_DATA'
-          })
-        } else if (msg.data.totalCount === this.state.list.length && pageNo !== 1) {
-          Taro.showToast({ title: '没有更多数据了', icon: 'none' });
-          this.setState({
-            listState: 'NO_MORE_DATA'
-          })
-        } else {
-          if (msg.data.totalCount === (pageNo === 1 ? msg.data.list : this.state.list.concat(msg.data.list)).length) {
+    })
+      .then((msg) => {
+        if (msg.error.length === 0) {
+          if (msg.data.totalCount === 0) {
             this.setState({
-              listState: 'NO_MORE_DATA'
-            })
+              listState: "NO_DATA",
+            });
+          } else if (
+            msg.data.totalCount === this.state.list.length &&
+            pageNo !== 1
+          ) {
+            Taro.showToast({ title: "没有更多数据了", icon: "none" });
+            this.setState({
+              listState: "NO_MORE_DATA",
+            });
+          } else {
+            if (
+              msg.data.totalCount ===
+              (pageNo === 1
+                ? msg.data.list
+                : this.state.list.concat(msg.data.list)
+              ).length
+            ) {
+              this.setState({
+                listState: "NO_MORE_DATA",
+              });
+            }
           }
+          this.setState({
+            list:
+              pageNo === 1
+                ? msg.data.list
+                : this.state.list.concat(msg.data.list),
+            pageNo: msg.data.pageNo,
+          });
+        } else {
+          Taro.showToast({ title: msg.error[0].message, icon: "none" });
+          this.setState({
+            listState: msg.error[0].field === "403" ? "NO_DATA" : "RELOAD",
+          });
         }
-        this.setState({
-          list: pageNo === 1 ? msg.data.list : this.state.list.concat(msg.data.list),
-          pageNo: msg.data.pageNo
-        })
-      } else {
-        Taro.showToast({ title: msg.error[0].message, icon: 'none' });
-        this.setState({
-          listState: msg.error[0].field === '403' ? 'NO_DATA' : 'RELOAD'
-        })
-      }
-    }).catch(() => {
-      this.setState({
-        listState: 'RELOAD'
       })
-    })
+      .catch(() => {
+        this.setState({
+          listState: "RELOAD",
+        });
+      });
   }
 
   render() {
@@ -128,92 +144,168 @@ class Enterprise extends Component {
           onChange={this.onChange}
           onActionClick={() => {
             this.setState({
-              listVisible: false
-            })
-            this.onChange(this.state.value, false)
+              listVisible: false,
+            });
+            this.onChange(this.state.value, false);
+          }}
+          onConfirm={() => {
+            this.onChange(this.state.value, false);
           }}
-          onConfirm={() => { this.onChange(this.state.value, false) }}
           onClear={() => {
             this.setState({
-              value: '',
+              value: "",
               list: [],
-              listState: 'NO_DATA',
+              listState: "NO_DATA",
               pageNo: 1,
-              listVisible: false
-            })
+              listVisible: false,
+            });
           }}
         />
         <View>
-          {
-            this.props.type == 0 ? this.state.list.map((v, k) => (
-              <View key={k}>
-                <AtListItem
-                  title={v.name}
-                  arrow='right'
-                  iconInfo={{ size: 25, color: '#000000', value: 'bookmark', }}
-                  onClick={() => {
-                    // this.setState({
-                    //   listVisible: true,
-                    //   listValue: v,
-                    // })
-                    // this.getByUid(v)
-                    Taro.eventCenter.trigger('enterprise', v)
-                  }}
-                />
-              </View>
-            )) :  !this.state.listVisible ? this.state.list.map((v, k) => (
-              <View key={k}>
-                <AtListItem
-                  title={v.name}
-                  arrow='right'
-                  iconInfo={{ size: 25, color: '#000000', value: 'bookmark', }}
-                  onClick={() => {
-                    this.setState({
-                      listVisible: true,
-                      listValue: v,
-                    })
-                    this.getByUid(v)
-                    // Taro.eventCenter.trigger('enterprise', v)
-                  }}
-                />
-              </View>
-            )) :''
-          }
-          {
-             this.state.listVisible && this.props.type ==1  ? (<View><AtListItem
-              title={this.state.listValue.name}
-              arrow='right'
-              iconInfo={{ size: 25, color: '#000000', value: 'bookmark', }}
-
-            />
-              <View>
-                {this.state.orderNo.length > 0 ? <View>{this.state.orderNo.map((v, k) => (
-
-                  <View key={k} style={{ display: 'flex', justifyContent: ' center', marginBottom: '20px' }}>
-                    编号:<View>{v.contractNo}</View><View style={{ width: '60px', height: '24px', backgroundColor: '#5599FF', borderRadius: '15px', textAlign: 'center', lineHeight: '24px', marginLeft: '20px', color: 'white' }} circle onClick={() => {
+          {this.props.type == 0 || this.props.type == 2
+            ? this.state.list.map((v, k) => (
+                <View key={k}>
+                  <AtListItem
+                    title={v.name}
+                    arrow="right"
+                    iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
+                    onClick={() => {
+                      // this.setState({
+                      //   listVisible: true,
+                      //   listValue: v,
+                      // })
+                      // this.getByUid(v)
+                      Taro.eventCenter.trigger("enterprise", v);
+                    }}
+                  />
+                </View>
+              ))
+            : !this.state.listVisible
+            ? this.state.list.map((v, k) => (
+                <View key={k}>
+                  <AtListItem
+                    title={v.name}
+                    arrow="right"
+                    iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
+                    onClick={() => {
                       this.setState({
-                        listVisible: false
-                      })
-                      v.name = this.state.listValue.name
-                      v.id = this.state.listValue.id
-                      Taro.eventCenter.trigger('enterprise', v)
-                    }}>选择</View>
+                        listVisible: true,
+                        listValue: v,
+                      });
+                      this.getByUid(v);
+                      // Taro.eventCenter.trigger('enterprise', v)
+                    }}
+                  />
+                </View>
+              ))
+            : ""}
+          {this.state.listVisible && this.props.type == 1 ? (
+            <View>
+              <AtListItem
+                title={this.state.listValue.name}
+                arrow="right"
+                iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
+              />
+              <View>
+                {this.state.orderNo.length > 0 ? (
+                  <View>
+                    {this.state.orderNo.map((v, k) => (
+                      <View
+                        key={k}
+                        style={{
+                          display: "flex",
+                          justifyContent: " center",
+                          marginBottom: "20px",
+                        }}
+                      >
+                        编号:<View>{v.contractNo}</View>
+                        <View
+                          style={{
+                            width: "60px",
+                            height: "24px",
+                            backgroundColor: "#5599FF",
+                            borderRadius: "15px",
+                            textAlign: "center",
+                            lineHeight: "24px",
+                            marginLeft: "20px",
+                            color: "white",
+                          }}
+                          circle
+                          onClick={() => {
+                            this.setState({
+                              listVisible: false,
+                            });
+                            v.name = this.state.listValue.name;
+                            v.id = this.state.listValue.id;
+                            Taro.eventCenter.trigger("enterprise", v);
+                          }}
+                        >
+                          选择
+                        </View>
+                      </View>
+                    ))}{" "}
+                    <View
+                      style={{ color: "red", width: "260px", margin: "0 auto" }}
+                    >
+                      注:请选择正确的派单编号!公出信息将统计至对应的订单中。
+                    </View>
                   </View>
-
-                ))} <View style={{ color: 'red', width: '260px', margin: '0 auto' }} >
-                    注:请选择正确的派单编号!公出信息将统计至对应的订单中。
-          </View></View> : <View style={{ color: 'red' }}>该企业暂无订单,无法技术公出!请联系营销员查询派单情况</View>}
+                ) : (
+                  <View style={{ color: "red" }}>
+                    该企业暂无订单,无法技术公出!请联系营销员查询派单情况
+                  </View>
+                )}
               </View>
-            </View>) : ''
-          }
+            </View>
+          ) : (
+            ""
+          )}
+          {this.props.type == 0
+            ? this.state.list.map((v, k) => (
+                <View key={k}>
+                  <AtListItem
+                    title={v.name}
+                    arrow="right"
+                    iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
+                    onClick={() => {
+                      // this.setState({
+                      //   listVisible: true,
+                      //   listValue: v,
+                      // })
+                      // this.getByUid(v)
+                      Taro.eventCenter.trigger("enterprise", v);
+                    }}
+                  />
+                </View>
+              ))
+            : !this.state.listVisible
+            ? this.state.list.map((v, k) => (
+                <View key={k}>
+                  <AtListItem
+                    title={v.name}
+                    arrow="right"
+                    iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
+                    onClick={() => {
+                      this.setState({
+                        listVisible: true,
+                        listValue: v,
+                      });
+                      this.getByUid(v);
+                      // Taro.eventCenter.trigger('enterprise', v)
+                    }}
+                  />
+                </View>
+              ))
+            : ""}
           <ListBottomStart
             state={this.state.listState}
             reload={() => {
-              this.onChange(this.state.value)
-            }} />
+              this.onChange(this.state.value);
+            }}
+          />
         </View>
       </>
-    )
+    );
   }
 }
 

+ 137 - 118
src/pages/applyDepart/index.jsx

@@ -1,151 +1,171 @@
-import React, { Component } from 'react'
-import { connect } from 'react-redux'
-import {View} from '@tarojs/components'
-import { AtSteps,AtButton,AtListItem } from 'taro-ui'
+import React, { Component } from "react";
+import { connect } from "react-redux";
+import { View } from "@tarojs/components";
+import { AtSteps, AtButton, AtListItem } from "taro-ui";
 
-import 'taro-ui/dist/style/components/steps.scss';
-import 'taro-ui/dist/style/components/icon.scss';
-import 'taro-ui/dist/style/components/tabs.scss';
+import "taro-ui/dist/style/components/steps.scss";
+import "taro-ui/dist/style/components/icon.scss";
+import "taro-ui/dist/style/components/tabs.scss";
 
-import UserFloatingLayer from '../../components/common/userFloatingLayer';
+import UserFloatingLayer from "../../components/common/userFloatingLayer";
 
-import { add, minus, asyncAdd } from '../../actions/counter';
-import Enterprise from './enterprise';
-import PublicContent from './publicContent';
-import Result from './result';
+import { add, minus, asyncAdd } from "../../actions/counter";
+import Enterprise from "./enterprise";
+import PublicContent from "./publicContent";
+import Result from "./result";
 
-import './index.less'
-import Taro from '@tarojs/taro';
+import "./index.less";
+import Taro from "@tarojs/taro";
 import MessageNoticebar from "../../components/common/messageNoticebar";
 
 const items = [
-  { 'title': '选择公出企业' },
-  { 'title': '填写公出内容'},
-  { 'title': '提交公出审核' }
-]
+  { title: "选择公出企业" },
+  { title: "填写公出内容" },
+  { title: "提交公出审核" },
+];
 
-@connect(({ counter }) => ({
-  counter
-}), (dispatch) => ({
-  add () {
-    dispatch(add())
-  },
-  dec () {
-    dispatch(minus())
-  },
-  asyncAdd () {
-    dispatch(asyncAdd())
-  }
-}))
+@connect(
+  ({ counter }) => ({
+    counter,
+  }),
+  (dispatch) => ({
+    add() {
+      dispatch(add());
+    },
+    dec() {
+      dispatch(minus());
+    },
+    asyncAdd() {
+      dispatch(asyncAdd());
+    },
+  })
+)
 class ApplyDepart extends Component {
   constructor(props) {
     super(props);
-    this.state={
-      current:0,
-      enterpriseInfor:{},
-      selectArrderLocation:{},
-      resultState:0,
-      resultId:'',
-      punchClockInfor:{},
-      colors:'primary',
-      color:'secondary',
-      type:0,
-    }
+    this.state = {
+      current: 0,
+      enterpriseInfor: {},
+      selectArrderLocation: {},
+      resultState: 0,
+      resultId: "",
+      punchClockInfor: {},
+      // colors: "primary",
+      // color: "secondary",
+      // selectColor: 0,
+      type: 0,
+    };
   }
 
-  componentDidShow () {
-    Taro.eventCenter.on('enterprise', (arg) => {
-      arg.type = this.state.type
+  componentDidShow() {
+    Taro.eventCenter.on("enterprise", (arg) => {
+      arg.type = this.state.type;
       // 跳转
       this.setState({
-        current:1,
-        enterpriseInfor:arg
-      })
+        current: 1,
+        enterpriseInfor: arg,
+      });
       console.log(arg);
-    })
-    Taro.eventCenter.on('publicContent', (arg) => {
+    });
+    Taro.eventCenter.on("publicContent", (arg) => {
       this.setState({
-        current:2,
-        resultState:arg.code,
-        resultId:arg.data.id,
-        punchClockInfor:arg.data,
-      })
-    })
-    Taro.eventCenter.on('enterpriseBack', () => {
+        current: 2,
+        resultState: arg.code,
+        resultId: arg.data.id,
+        punchClockInfor: arg.data,
+      });
+    });
+    Taro.eventCenter.on("enterpriseBack", () => {
       this.setState({
-        current:0,
-      })
-    })
-    Taro.eventCenter.on('result', () => {
+        current: 0,
+      });
+    });
+    Taro.eventCenter.on("result", () => {
       this.setState({
-        current:0,
-        enterpriseInfor:{},
-        selectArrderLocation:{},
-        resultState:0,
-        resultId:'',
-        punchClockInfor:{},
-      })
-    })
+        current: 0,
+        enterpriseInfor: {},
+        selectArrderLocation: {},
+        resultState: 0,
+        resultId: "",
+        punchClockInfor: {},
+      });
+    });
     //获取地区选定数据
-    const chooseLocation = requirePlugin('chooseLocation');
+    const chooseLocation = requirePlugin("chooseLocation");
     const location = chooseLocation.getLocation();
-    if(location){
+    if (location) {
       this.setState({
-        selectArrderLocation: location
-      })
+        selectArrderLocation: location,
+      });
     }
   }
 
-  componentDidMount() {
-
-  }
+  componentDidMount() {}
 
-  onReachBottom(){
-    if(this.state.current === 0){
-      Taro.eventCenter.trigger('applyDepartSearchList')
+  onReachBottom() {
+    if (this.state.current === 0) {
+      Taro.eventCenter.trigger("applyDepartSearchList");
     }
   }
 
-  render () {
+  render() {
     return (
-      <View className='applyDepart'>
-        <MessageNoticebar/>
-        <UserFloatingLayer/>
-        <View className='atStepsContent'>
-          <AtSteps
-            items={items}
-            current={this.state.current}
-          />
-          <View style={{display:this.state.current===0 ? 'block' : 'none'}}>
-          <View style={{display:'flex'}}>
-          <View style={{margin:'0 10px'}}>
-          <AtButton   circle size='small' type={this.state.colors} onClick={()=>{
-            this.setState({
-              colors:'primary',
-              color:'secondary',
-              type:0
-            })
-          }}>业务/行政公出</AtButton>
-          </View>
-          <AtButton type={this.state.color} circle size='small' onClick={()=>{
-             this.setState({
-              colors:'secondary',
-              color:'primary',
-              type:1
-            })
-          }}>技术公出</AtButton>
-           <View style={{flex:'1'}}></View>
-          </View>
+      <View className="applyDepart">
+        <MessageNoticebar />
+        <UserFloatingLayer />
+        <View className="atStepsContent">
+          <AtSteps items={items} current={this.state.current} />
+          <View
+            style={{ display: this.state.current === 0 ? "block" : "none" }}
+          >
+            <View style={{ display: "flex", padding: "0 5px" }}>
+              {[
+                { type: 0, title: "业务公出" },
+                { type: 1, title: "技术公出" },
+                { type: 2, title: "行政公出" },
+              ].map((item, index) => (
+                <View style={{ margin: "0 5px" }} key={item.type}>
+                  <AtButton
+                    circle
+                    size="small"
+                    type={
+                      this.state.type == item.type ? "primary" : "secondary"
+                    }
+                    onClick={() => {
+                      this.setState({
+                        type: item.type,
+                      });
+                    }}
+                  >
+                    {item.title}
+                  </AtButton>
+                </View>
+              ))}
+              <View style={{ flex: "1" }}></View>
+            </View>
           </View>
-          <View className='content'>
-            <View style={{display:this.state.current===0 ? 'block' : 'none'}}>
-              <Enterprise type={this.state.type}/>
+          <View className="content">
+            <View
+              style={{ display: this.state.current === 0 ? "block" : "none" }}
+            >
+              <Enterprise type={this.state.type} />
             </View>
-            <View style={{display:this.state.current===1 ? 'block' : 'none'}}>
-              <PublicContent enterpriseInfor={this.state.enterpriseInfor} selectArrderLocation={this.state.selectArrderLocation}/>
+            <View
+              style={{ display: this.state.current === 1 ? "block" : "none" }}
+            >
+              <PublicContent
+                enterpriseInfor={this.state.enterpriseInfor}
+                selectArrderLocation={this.state.selectArrderLocation}
+              />
             </View>
-            <View style={{display:this.state.current===2 ? 'block' : 'none'}}>
-              <Result resultState={this.state.resultState} resultId={this.state.resultId} punchClockInfor={this.state.punchClockInfor}/>
+            <View
+              style={{ display: this.state.current === 2 ? "block" : "none" }}
+            >
+              <Result
+                resultState={this.state.resultState}
+                resultId={this.state.resultId}
+                punchClockInfor={this.state.punchClockInfor}
+              />
             </View>
             {/* <View style={{display:this.state.current===3 ? 'block' : 'none'}}>
             <AtListItem
@@ -160,9 +180,8 @@ class ApplyDepart extends Component {
           </View>
         </View>
       </View>
-    )
+    );
   }
 }
 
-export default ApplyDepart
-
+export default ApplyDepart;

+ 490 - 361
src/pages/applyDepart/publicContent.jsx

@@ -1,47 +1,50 @@
-import React,{Component} from 'react';
-import Taro from '@tarojs/taro';
-import {Text, View} from '@tarojs/components'
-import dayjs from 'dayjs';
-import './index.less';
+import React, { Component } from "react";
+import Taro from "@tarojs/taro";
+import { Text, View } from "@tarojs/components";
+import dayjs from "dayjs";
+import "./index.less";
 
-import ImagePicker from '../../components/common/imagePicker'
+import ImagePicker from "../../components/common/imagePicker";
 
-import {AtButton, AtTextarea, AtIcon, AtCalendar} from 'taro-ui'
-import {addPublicRelease,getWorkingHoursList} from '../../utils/servers/servers';
+import { AtButton, AtTextarea, AtIcon, AtCalendar } from "taro-ui";
+import {
+  addPublicRelease,
+  getWorkingHoursList,
+} from "../../utils/servers/servers";
 
-import {getHours, getNumHourse, getUserWordTimes} from '../../utils/tools';
+import { getHours, getNumHourse, getUserWordTimes } from "../../utils/tools";
 
-import 'taro-ui/dist/style/components/form.scss';
-import 'taro-ui/dist/style/components/button.scss';
-import 'taro-ui/dist/style/components/loading.scss';
-import 'taro-ui/dist/style/components/icon.scss';
-import 'taro-ui/dist/style/components/icon.scss';
-import 'taro-ui/dist/style/components/textarea.scss';
-import 'taro-ui/dist/style/components/calendar.scss';
+import "taro-ui/dist/style/components/form.scss";
+import "taro-ui/dist/style/components/button.scss";
+import "taro-ui/dist/style/components/loading.scss";
+import "taro-ui/dist/style/components/icon.scss";
+import "taro-ui/dist/style/components/icon.scss";
+import "taro-ui/dist/style/components/textarea.scss";
+import "taro-ui/dist/style/components/calendar.scss";
 
-import './publicContent.less';
+import "./publicContent.less";
 import InquiryModal from "../../components/common/inquiryModal";
 
-class PublicContent extends Component{
+class PublicContent extends Component {
   constructor(props) {
     super(props);
-    this.state={
-      rangeStartVal:'',
-      rangeEndVal:'',
-      rangeEndMinuteVal:'',
-      rangeStartMinuteVal:'',
-      reason:'',
-      plan:'',
-      expectedEffect:'',
-      imgs:[],
-      validDates:[],
-      totalDuration:0,
-      loading:false,
-      workTypeList:[],
-      workType:0,
+    this.state = {
+      rangeStartVal: "",
+      rangeEndVal: "",
+      rangeEndMinuteVal: "",
+      rangeStartMinuteVal: "",
+      reason: "",
+      plan: "",
+      expectedEffect: "",
+      imgs: [],
+      validDates: [],
+      totalDuration: 0,
+      loading: false,
+      workTypeList: [],
+      workType: 0,
 
-      isPickerRender:false,
-    }
+      isPickerRender: false,
+    };
     this.onSubmit = this.onSubmit.bind(this);
     this.selectArrder = this.selectArrder.bind(this);
     this.onChange = this.onChange.bind(this);
@@ -52,257 +55,317 @@ class PublicContent extends Component{
   }
 
   componentDidMount() {
-    Taro.eventCenter.on('result', () => {
+    Taro.eventCenter.on("result", () => {
       this.imagePickerRef && this.imagePickerRef.clear();
       this.setState({
-        rangeStartVal:'',
-        rangeEndVal:'',
-        rangeEndMinuteVal:'',
-        rangeStartMinuteVal:'',
-        reason:'',
-        plan:'',
-        expectedEffect:'',
-        imgs:[],
-        validDates:[],
-        totalDuration:0,
-        loading:false,
-      })
-    })
+        rangeStartVal: "",
+        rangeEndVal: "",
+        rangeEndMinuteVal: "",
+        rangeStartMinuteVal: "",
+        reason: "",
+        plan: "",
+        expectedEffect: "",
+        imgs: [],
+        validDates: [],
+        totalDuration: 0,
+        loading: false,
+      });
+    });
     this.getWorkingHoursList();
   }
 
-  getNumHourse(startTime,endTime){
+  getNumHourse(startTime, endTime) {
     this.setState({
-      totalDuration:getNumHourse(startTime,endTime,this.state.validDates.length)
-    })
+      totalDuration: getNumHourse(
+        startTime,
+        endTime,
+        this.state.validDates.length
+      ),
+    });
   }
 
-
-  onSubmit(){
-    if(!this.state.rangeStartMinuteVal){
-      Taro.showToast({title:'请选择公出时间',icon:'none'})
-      return ;
+  onSubmit() {
+    if (!this.state.rangeStartMinuteVal) {
+      Taro.showToast({ title: "请选择公出时间", icon: "none" });
+      return;
     }
-    if(!this.state.rangeEndMinuteVal){
-      Taro.showToast({title:'请选择公出时间',icon:'none'})
-      return ;
+    if (!this.state.rangeEndMinuteVal) {
+      Taro.showToast({ title: "请选择公出时间", icon: "none" });
+      return;
     }
-    if(!(this.props.selectArrderLocation.longitude && this.props.selectArrderLocation.latitude)){
-      Taro.showToast({title:'请选择公出地点',icon:'none'})
-      return ;
+    if (
+      !(
+        this.props.selectArrderLocation.longitude &&
+        this.props.selectArrderLocation.latitude
+      )
+    ) {
+      Taro.showToast({ title: "请选择公出地点", icon: "none" });
+      return;
     }
-    if(!this.state.reason){
-      Taro.showToast({title:'请输入公出目标',icon:'none'})
-      return ;
+    if (!this.state.reason) {
+      Taro.showToast({ title: "请输入公出目标", icon: "none" });
+      return;
     }
-    if(!this.state.plan){
-      Taro.showToast({title:'请输入公出计划',icon:'none'})
-      return ;
+    if (!this.state.plan && this.props.enterpriseInfor.type != 2) {
+      Taro.showToast({ title: "请输入公出计划", icon: "none" });
+      return;
     }
-    if(!this.state.expectedEffect){
-      Taro.showToast({title:'请输入预计效果',icon:'none'})
-      return ;
+    if (!this.state.expectedEffect && this.props.enterpriseInfor.type != 2) {
+      Taro.showToast({ title: "请输入预计效果", icon: "none" });
+      return;
     }
-    if(this.state.totalDuration === 0){
-      Taro.showToast({title:'公出时间不足0小时',icon:'none'})
-      return ;
+    if (this.state.totalDuration === 0) {
+      Taro.showToast({ title: "公出时间不足0小时", icon: "none" });
+      return;
     }
     this.setState({
-      loading:true
-    })
+      loading: true,
+    });
     let datas;
-    if(this.props.enterpriseInfor.type == 0) {
-      datas= {
-        uid:this.props.enterpriseInfor.id,
-        releaseStarts:this.state.rangeStartMinuteVal,
-        releaseEnds:this.state.rangeEndMinuteVal,
-        remarks:this.state.reason,
-        plan:this.state.plan,
-        expectedEffect:this.state.expectedEffect,
+    if (this.props.enterpriseInfor.type == 0) {
+      datas = {
+        uid: this.props.enterpriseInfor.id,
+        releaseStarts: this.state.rangeStartMinuteVal,
+        releaseEnds: this.state.rangeEndMinuteVal,
+        remarks: this.state.reason,
+        plan: this.state.plan,
+        expectedEffect: this.state.expectedEffect,
         userName: this.props.selectArrderLocation.name,
         longitude: this.props.selectArrderLocation.longitude,
         latitude: this.props.selectArrderLocation.latitude,
-        annexUrl: this.state.imgs.length === 0 ? '' : this.state.imgs.join(','),
+        annexUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
         duration: this.state.totalDuration,
-        type:this.props.enterpriseInfor.type,
-        validDate: JSON.stringify(this.state.validDates)
-      }
-    }else {
+        type: this.props.enterpriseInfor.type,
+        validDate: JSON.stringify(this.state.validDates),
+      };
+    } else if (this.props.enterpriseInfor.type == 2) {
       datas = {
-        uid:this.props.enterpriseInfor.id,
-        releaseStarts:this.state.rangeStartMinuteVal,
-        releaseEnds:this.state.rangeEndMinuteVal,
-        remarks:this.state.reason,
-        plan:this.state.plan,
-        expectedEffect:this.state.expectedEffect,
+        uid: this.props.enterpriseInfor.id,
+        releaseStarts: this.state.rangeStartMinuteVal,
+        releaseEnds: this.state.rangeEndMinuteVal,
+        remarks: this.state.reason,
+        // plan: this.state.plan,
+        // expectedEffect: this.state.expectedEffect,
         userName: this.props.selectArrderLocation.name,
         longitude: this.props.selectArrderLocation.longitude,
         latitude: this.props.selectArrderLocation.latitude,
-        annexUrl: this.state.imgs.length === 0 ? '' : this.state.imgs.join(','),
+        annexUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
         duration: this.state.totalDuration,
-        type:this.props.enterpriseInfor.type,
-        orderNo:this.props.enterpriseInfor.orderNo,
-        validDate: JSON.stringify(this.state.validDates)
-      }
+        type: this.props.enterpriseInfor.type,
+        validDate: JSON.stringify(this.state.validDates),
+      };
+    } else {
+      datas = {
+        uid: this.props.enterpriseInfor.id,
+        releaseStarts: this.state.rangeStartMinuteVal,
+        releaseEnds: this.state.rangeEndMinuteVal,
+        remarks: this.state.reason,
+        plan: this.state.plan,
+        expectedEffect: this.state.expectedEffect,
+        userName: this.props.selectArrderLocation.name,
+        longitude: this.props.selectArrderLocation.longitude,
+        latitude: this.props.selectArrderLocation.latitude,
+        annexUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
+        duration: this.state.totalDuration,
+        type: this.props.enterpriseInfor.type,
+        orderNo: this.props.enterpriseInfor.orderNo,
+        validDate: JSON.stringify(this.state.validDates),
+      };
     }
-    addPublicRelease(datas).then(v=>{
-      this.setState({
-        loading:false
-      })
-      if(v.error.length === 0){
-        Taro.eventCenter.trigger('publicContent',v.data)
-      }else{
-        Taro.showToast({
-          title:v.error[0].message,
-          icon:'none'
-        })
-      }
-    }).catch(()=>{
-      this.setState({
-        loading:false
+    addPublicRelease(datas)
+      .then((v) => {
+        this.setState({
+          loading: false,
+        });
+        if (v.error.length === 0) {
+          Taro.eventCenter.trigger("publicContent", v.data);
+        } else {
+          Taro.showToast({
+            title: v.error[0].message,
+            icon: "none",
+          });
+        }
       })
-    });
+      .catch(() => {
+        this.setState({
+          loading: false,
+        });
+      });
   }
 
-  selectArrder(){
-    const key = 'AWBBZ-GRAC2-JFYUO-CLA7I-JAHXK-YFFGT'; //使用在腾讯位置服务申请的key
-    const referer = '科德打卡定位'; //调用插件的app的名称
-    const category = '公司企业,房产小区';
+  selectArrder() {
+    const key = "AWBBZ-GRAC2-JFYUO-CLA7I-JAHXK-YFFGT"; //使用在腾讯位置服务申请的key
+    const referer = "科德打卡定位"; //调用插件的app的名称
+    const category = "公司企业,房产小区";
     Taro.navigateTo({
-      url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&category=' + category
+      url:
+        "plugin://chooseLocation/index?key=" +
+        key +
+        "&referer=" +
+        referer +
+        "&category=" +
+        category,
     });
   }
 
-  onChange(value,type){
+  onChange(value, type) {
     let arr = this.state.imgs.concat([]);
-    if(type === 'add'){
-      arr.push(value)
-    }else if(type === 'remove'){
-      arr.splice(value,1)
+    if (type === "add") {
+      arr.push(value);
+    } else if (type === "remove") {
+      arr.splice(value, 1);
     }
     this.setState({
       imgs: arr,
-    })
+    });
   }
 
-  getWorkingHoursList(){
-    getWorkingHoursList({}).then((v)=>{
-      if(v.error.length === 0){
-        let obj = Taro.getStorageSync('userInfor');
-        let index = v.data.findIndex(value=>value.type === obj.workTimeInfor.type);
-        this.setState({
-          workType:index !== -1 ? index : 0
-        })
-        this.setState({
-          workTypeList:v.data
-        })
-      }else{
-        Taro.showToast({
-          title:v.error[0].message,
-          icon:'none'
-        })
-      }
-    }).catch(err=>{
-      console.log(err)
-    })
+  getWorkingHoursList() {
+    getWorkingHoursList({})
+      .then((v) => {
+        if (v.error.length === 0) {
+          let obj = Taro.getStorageSync("userInfor");
+          let index = v.data.findIndex(
+            (value) => value.type === obj.workTimeInfor.type
+          );
+          this.setState({
+            workType: index !== -1 ? index : 0,
+          });
+          this.setState({
+            workTypeList: v.data,
+          });
+        } else {
+          Taro.showToast({
+            title: v.error[0].message,
+            icon: "none",
+          });
+        }
+      })
+      .catch((err) => {
+        console.log(err);
+      });
   }
 
-  onPickerHide(){
+  onPickerHide() {
     this.setState({
       isPickerRender: false,
     });
   }
 
-  onSetPickerTime(val){
+  onSetPickerTime(val) {
     let data = val.detail;
     this.setState({
       rangeStartMinuteVal: data.selectStartTime,
-      rangeEndMinuteVal: data.selectEndTime
+      rangeEndMinuteVal: data.selectEndTime,
     });
     console.log(this.state.rangeStartMinuteVal);
     let arr = [];
-    if(data.startTime && data.endTime){
+    if (data.startTime && data.endTime) {
       let a = dayjs(data.startTime);
       let b = dayjs(data.endTime);
-      let num = b.diff(a, 'day')+1;
+      let num = b.diff(a, "day") + 1;
       let strAdd = data.startTime;
-      for(let i = 0;i<num;i++){
-        let time = dayjs(strAdd).add(i, 'days').format('YYYY-MM-DD');
-        arr.push({value:time});
+      for (let i = 0; i < num; i++) {
+        let time = dayjs(strAdd).add(i, "days").format("YYYY-MM-DD");
+        arr.push({ value: time });
       }
     }
-    this.setState({
-      rangeEndVal:dayjs(data.endTime).format('YYYY-MM-DD'),
-      rangeStartVal:dayjs(data.startTime).format('YYYY-MM-DD'),
-      validDates:arr,
-    },()=>{
-      let a1 = dayjs(dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss'));
-      let b1 = dayjs(dayjs(data.startTime).format('YYYY-MM-DD  HH:mm:ss'));
-      this.getNumHourse(b1,a1)
-    })
+    this.setState(
+      {
+        rangeEndVal: dayjs(data.endTime).format("YYYY-MM-DD"),
+        rangeStartVal: dayjs(data.startTime).format("YYYY-MM-DD"),
+        validDates: arr,
+      },
+      () => {
+        let a1 = dayjs(dayjs(data.endTime).format("YYYY-MM-DD HH:mm:ss"));
+        let b1 = dayjs(dayjs(data.startTime).format("YYYY-MM-DD  HH:mm:ss"));
+        this.getNumHourse(b1, a1);
+      }
+    );
   }
 
   render() {
     return (
-      <View className='publicContent'>
-        <View className='formItem'>
-          <View className='formName'>公出企业:</View>
-          <View className='formValue'>{this.props.enterpriseInfor.name}</View>
+      <View className="publicContent">
+        <View className="formItem">
+          <View className="formName">公出企业:</View>
+          <View className="formValue">{this.props.enterpriseInfor.name}</View>
         </View>
-        <View className='formItem'>
-          <View className='formName'>公出类型:</View>
-          <View className='formValue'>{this.props.enterpriseInfor.type == 1 ? '技术公出' : '业务/行政公出'}</View>
-        </View> 
-       { this.props.enterpriseInfor.contractNo ? <View className='formItem'>
-          <View className='formName'>合同编号:</View>
-          <View className='formValue'>{this.props.enterpriseInfor.contractNo}</View>
-        </View> : ''}
-        <View className='formItem'>
-          <View className='formName'>作息时间类型:</View>
-          <View className='formValue'>
-            <picker onChange={(e)=>{
-              this.setState({
-                workType: e.detail.value
-              })
-              if(this.state.workTypeList[e.detail.value]){
-                let obj = Taro.getStorageSync('userInfor');
-                obj.workTimeInfor = this.state.workTypeList[e.detail.value];
-                Taro.setStorageSync('userInfor', obj);
+        <View className="formItem">
+          <View className="formName">公出类型:</View>
+          <View className="formValue">
+            {this.props.enterpriseInfor.type == 0
+              ? "业务公出"
+              : this.props.enterpriseInfor.type == 1
+              ? "技术公出"
+              : this.props.enterpriseInfor.type == 2 && "行政公出"}
+          </View>
+        </View>
+        {this.props.enterpriseInfor.contractNo ? (
+          <View className="formItem">
+            <View className="formName">合同编号:</View>
+            <View className="formValue">
+              {this.props.enterpriseInfor.contractNo}
+            </View>
+          </View>
+        ) : (
+          ""
+        )}
+        <View className="formItem">
+          <View className="formName">作息时间类型:</View>
+          <View className="formValue">
+            <picker
+              onChange={(e) => {
                 this.setState({
-                  rangeStartVal:'',
-                  rangeStartMinuteVal: '',
-                  rangeEndMinuteVal:'',
-                  rangeEndVal:'',
-                  validDates:[],
-                  totalDuration:0
-                })
-              }
-            }} value={this.state.workType} rangeKey='name' range={this.state.workTypeList}>
-              <view style={{display:'flex',alignItems:'center'}}>
-                {this.state.workTypeList[this.state.workType] ? this.state.workTypeList[this.state.workType].name : ''}
-                <AtIcon value='chevron-right' size='20' color='#bbbbbb'/>
+                  workType: e.detail.value,
+                });
+                if (this.state.workTypeList[e.detail.value]) {
+                  let obj = Taro.getStorageSync("userInfor");
+                  obj.workTimeInfor = this.state.workTypeList[e.detail.value];
+                  Taro.setStorageSync("userInfor", obj);
+                  this.setState({
+                    rangeStartVal: "",
+                    rangeStartMinuteVal: "",
+                    rangeEndMinuteVal: "",
+                    rangeEndVal: "",
+                    validDates: [],
+                    totalDuration: 0,
+                  });
+                }
+              }}
+              value={this.state.workType}
+              rangeKey="name"
+              range={this.state.workTypeList}
+            >
+              <view style={{ display: "flex", alignItems: "center" }}>
+                {this.state.workTypeList[this.state.workType]
+                  ? this.state.workTypeList[this.state.workType].name
+                  : ""}
+                <AtIcon value="chevron-right" size="20" color="#bbbbbb" />
               </view>
             </picker>
           </View>
         </View>
-        <View className='formItem'>
-          <View className='formName'>公出时间:</View>
-          <View className='formValue'>
-            <View className='time' onClick={()=>{
-              this.setState({
-                isPickerRender:true
-              })
-            }}>
-              {
-                this.state.rangeStartMinuteVal && this.state.rangeEndMinuteVal ? <View className='timeContent'>
-                  <View>
-                    开始时间:{this.state.rangeStartMinuteVal}
-                  </View>
-                  <View>
-                    结束时间:{this.state.rangeEndMinuteVal}
-                  </View>
-                </View>: '请选择公出时间'
-              }
+        <View className="formItem">
+          <View className="formName">公出时间:</View>
+          <View className="formValue">
+            <View
+              className="time"
+              onClick={() => {
+                this.setState({
+                  isPickerRender: true,
+                });
+              }}
+            >
+              {this.state.rangeStartMinuteVal &&
+              this.state.rangeEndMinuteVal ? (
+                <View className="timeContent">
+                  <View>开始时间:{this.state.rangeStartMinuteVal}</View>
+                  <View>结束时间:{this.state.rangeEndMinuteVal}</View>
+                </View>
+              ) : (
+                "请选择公出时间"
+              )}
             </View>
             <timePicker
               config={{
@@ -311,168 +374,234 @@ class PublicContent extends Component{
                 dateLimit: false,
                 // initStartTime: "2019-01-01 12:32:44", //默认开始时间
                 // initEndTime: "2019-12-01 12:32:44",   //默认结束时间
-                limitStartTime: dayjs().subtract(3,'year').format('YYYY-MM-DD HH:mm:ss'),
-                limitEndTime: dayjs().add(3,'year').format('YYYY-MM-DD HH:mm:ss')
+                limitStartTime: dayjs()
+                  .subtract(3, "year")
+                  .format("YYYY-MM-DD HH:mm:ss"),
+                limitEndTime: dayjs()
+                  .add(3, "year")
+                  .format("YYYY-MM-DD HH:mm:ss"),
               }}
               isPartition
               pickerShow={this.state.isPickerRender}
-              onconditionaljudgment={(v)=>{
-                let a = dayjs(dayjs(v.detail.endTime).second(0).format('YYYY-MM-DD HH:mm:ss'));
-                let b = dayjs(dayjs().second(0).format('YYYY-MM-DD HH:mm:ss'))
-                if(a.isBefore(b)){
+              onconditionaljudgment={(v) => {
+                let a = dayjs(
+                  dayjs(v.detail.endTime)
+                    .second(0)
+                    .format("YYYY-MM-DD HH:mm:ss")
+                );
+                let b = dayjs(dayjs().second(0).format("YYYY-MM-DD HH:mm:ss"));
+                if (a.isBefore(b)) {
                   Taro.showToast({
-                    title:'结束时间不能小于当前时间',
-                    icon:'none'
-                  })
+                    title: "结束时间不能小于当前时间",
+                    icon: "none",
+                  });
                   v.detail.setLv(false);
                 }
               }}
-              onhidepicker={()=>{
-                this.onPickerHide()
+              onhidepicker={() => {
+                this.onPickerHide();
+              }}
+              onsetpickertime={(v) => {
+                this.onSetPickerTime(v);
               }}
-              onsetpickertime={(v)=>{
-                this.onSetPickerTime(v)
-              }}/>
+            />
           </View>
         </View>
-        <View className='formItem'>
-          <View className='formName'>总时长:</View>
-          <View className='formValue'>
-            {this.state.totalDuration}小时
-          </View>
+        <View className="formItem">
+          <View className="formName">总时长:</View>
+          <View className="formValue">{this.state.totalDuration}小时</View>
         </View>
-        {this.state.validDates.length !== 0? <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
-          <View className='formName'>
-            <View>去除放假时间:</View>
-            <View className='tips'>绿色方块为公出时间,长按即可去除放假时间</View>
-          </View>
-          <AtCalendar
-            currentDate={this.state.rangeStartVal}
-            minDate={this.state.rangeStartVal}
-            maxDate={this.state.rangeEndVal}
-            isSwiper={false}
-            validDates={this.state.validDates}
-            onDayLongClick={(item)=>{
-              if(!(dayjs(item.value).isSame(this.state.rangeStartVal) || dayjs(item.value).isSame(this.state.rangeEndVal))){
-                if(!(dayjs(item.value).isAfter(this.state.rangeStartVal) && dayjs(item.value).isBefore(this.state.rangeEndVal))){
+        {this.state.validDates.length !== 0 ? (
+          <View
+            className="formItem"
+            style={{ display: "block", paddingTop: "15px" }}
+          >
+            <View className="formName">
+              <View>去除放假时间:</View>
+              <View className="tips">
+                绿色方块为公出时间,长按即可去除放假时间
+              </View>
+            </View>
+            <AtCalendar
+              currentDate={this.state.rangeStartVal}
+              minDate={this.state.rangeStartVal}
+              maxDate={this.state.rangeEndVal}
+              isSwiper={false}
+              validDates={this.state.validDates}
+              onDayLongClick={(item) => {
+                if (
+                  !(
+                    dayjs(item.value).isSame(this.state.rangeStartVal) ||
+                    dayjs(item.value).isSame(this.state.rangeEndVal)
+                  )
+                ) {
+                  if (
+                    !(
+                      dayjs(item.value).isAfter(this.state.rangeStartVal) &&
+                      dayjs(item.value).isBefore(this.state.rangeEndVal)
+                    )
+                  ) {
+                    return;
+                  }
+                } else {
+                  Taro.showToast({
+                    title: "开始结束时间不能取消",
+                    icon: "none",
+                  });
                   return;
                 }
-              }else{
-                Taro.showToast({title:'开始结束时间不能取消',icon:'none'})
-                return
-              }
-              let index = this.state.validDates.findIndex(v=>{
-                let lv = dayjs(v.value).isSame(item.value);
-                return lv
-              })
-              const {start,end} = getUserWordTimes();
-              let totalDuration = getHours(dayjs().format('YYYY-MM-DD')+start,dayjs(dayjs().format('YYYY-MM-DD')+end));   //一天工作时长
-              if(index<0){
-                let arr = item.value.split('-');
-                this.state.validDates.push({value:arr.join('-')})
-                this.setState({
-                  validDates:this.state.validDates,
-                  totalDuration: this.state.totalDuration + totalDuration
-                })
-              }else{
-                this.state.validDates.splice(index,1)
-                this.setState({
-                  validDates:this.state.validDates,
-                  totalDuration: this.state.totalDuration - totalDuration
-                })
-              }
-            }}
-          />
-        </View> : null}
-        <View className='formItem' style={{paddingBottom:0}}>
-          <View className='formName'>公出地点:</View>
-          <View className='formValue' onClick={this.selectArrder}>
-              <Text className='formValueText'>{this.props.selectArrderLocation.name}</Text>
-              <AtIcon value='chevron-right' size='30' color='#bbbbbb'/>
-          </View>
-        </View>
-        <View className='tips'>以地图为中心100米范围为可打卡区域,移动红标只需要拖动地图即可</View>
-        <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
-          {/* 公出目标 */}
-          <View className='formName'><Text style={{color:'red'}}>*公出目标:</Text>
-          <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
-            <AtTextarea
-              height={46}
-              value={this.state.reason}
-              onChange={(v)=>{
-                this.setState({
-                  reason:v
-                })
+                let index = this.state.validDates.findIndex((v) => {
+                  let lv = dayjs(v.value).isSame(item.value);
+                  return lv;
+                });
+                const { start, end } = getUserWordTimes();
+                let totalDuration = getHours(
+                  dayjs().format("YYYY-MM-DD") + start,
+                  dayjs(dayjs().format("YYYY-MM-DD") + end)
+                ); //一天工作时长
+                if (index < 0) {
+                  let arr = item.value.split("-");
+                  this.state.validDates.push({ value: arr.join("-") });
+                  this.setState({
+                    validDates: this.state.validDates,
+                    totalDuration: this.state.totalDuration + totalDuration,
+                  });
+                } else {
+                  this.state.validDates.splice(index, 1);
+                  this.setState({
+                    validDates: this.state.validDates,
+                    totalDuration: this.state.totalDuration - totalDuration,
+                  });
+                }
               }}
-              maxLength={200}
-              placeholder='本次公出目标,谈的思路与步骤?'
             />
           </View>
+        ) : null}
+        <View className="formItem" style={{ paddingBottom: 0 }}>
+          <View className="formName">公出地点:</View>
+          <View className="formValue" onClick={this.selectArrder}>
+            <Text className="formValueText">
+              {this.props.selectArrderLocation.name}
+            </Text>
+            <AtIcon value="chevron-right" size="30" color="#bbbbbb" />
           </View>
-          {/* 公出计划 */}
-          <View className='formName'><Text style={{color:'red'}}>*公出计划:</Text>
-          <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
-            <AtTextarea
-              height={46}
-              value={this.state.plan}
-              onChange={(v)=>{
-                this.setState({
-                  plan:v
-                })
-              }}
-              maxLength={200}
-              placeholder='本次公出准备工作'
-            />
-          </View>
+        </View>
+        <View className="tips">
+          以地图为中心100米范围为可打卡区域,移动红标只需要拖动地图即可
+        </View>
+        <View
+          className="formItem"
+          style={{ display: "block", paddingTop: "15px" }}
+        >
+          {/* 公出目标 */}
+          <View className="formName">
+            <Text style={{ color: "red" }}>*公出目标:</Text>
+            <View
+              className="formValue"
+              style={{ paddingTop: "10px", textAlign: "left" }}
+            >
+              <AtTextarea
+                height={46}
+                value={this.state.reason}
+                onChange={(v) => {
+                  this.setState({
+                    reason: v,
+                  });
+                }}
+                maxLength={200}
+                placeholder="本次公出目标,谈的思路与步骤?"
+              />
+            </View>
           </View>
+          {/* 公出计划 */}
+          {this.props.enterpriseInfor.type != 2 && (
+            <View className="formName">
+              <Text style={{ color: "red" }}>*公出计划:</Text>
+              <View
+                className="formValue"
+                style={{ paddingTop: "10px", textAlign: "left" }}
+              >
+                <AtTextarea
+                  height={46}
+                  value={this.state.plan}
+                  onChange={(v) => {
+                    this.setState({
+                      plan: v,
+                    });
+                  }}
+                  maxLength={200}
+                  placeholder="本次公出准备工作"
+                />
+              </View>
+            </View>
+          )}
           {/* 预计效果 */}
-          <View className='formName'><Text style={{color:'red'}}>*预计效果:</Text>
-          <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
-            <AtTextarea
-              height={46}
-              value={this.state.expectedEffect}
-              onChange={(v)=>{
-                this.setState({
-                  expectedEffect:v
-                })
-              }}
-              maxLength={200}
-              placeholder='预计本次公出效果'
-            />
-          </View>
-          </View>
+          {this.props.enterpriseInfor.type != 2 && (
+            <View className="formName">
+              <Text style={{ color: "red" }}>*预计效果:</Text>
+              <View
+                className="formValue"
+                style={{ paddingTop: "10px", textAlign: "left" }}
+              >
+                <AtTextarea
+                  height={46}
+                  value={this.state.expectedEffect}
+                  onChange={(v) => {
+                    this.setState({
+                      expectedEffect: v,
+                    });
+                  }}
+                  maxLength={200}
+                  placeholder="预计本次公出效果"
+                />
+              </View>
+            </View>
+          )}
         </View>
         {/*  */}
-        <View className='formItem' style={{display:'block'}}>
-          <View className='formName'>附件:</View>
-          <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
+        <View className="formItem" style={{ display: "block" }}>
+          <View className="formName">附件:</View>
+          <View
+            className="formValue"
+            style={{ paddingTop: "10px", textAlign: "left" }}
+          >
             <ImagePicker
               showAddBtn
-              ref={ref => this.imagePickerRef = ref}
-              url='/api/admin/release/upload'
+              ref={(ref) => (this.imagePickerRef = ref)}
+              url="/api/admin/release/upload"
               onChange={this.onChange}
             />
           </View>
         </View>
-        <View className='operation'>
-          <AtButton disabled={this.state.loading} type='secondary' circle onClick={()=>{
-            Taro.eventCenter.trigger('enterpriseBack')
-          }}>
+        <View className="operation">
+          <AtButton
+            disabled={this.state.loading}
+            type="secondary"
+            circle
+            onClick={() => {
+              Taro.eventCenter.trigger("enterpriseBack");
+            }}
+          >
             上一步
           </AtButton>
-          <AtButton type='primary' loading={this.state.loading} circle onClick={()=>{
-            if(this.state.loading){
-              return;
-            }
-            this.setState({
-              isInquiryOpened:true,
-              inquiryTitle:'提醒',
-              inquiryContent:'您确定要提交此申请吗?',
-              inquiryFn:()=>{
-                this.onSubmit();
+          <AtButton
+            type="primary"
+            loading={this.state.loading}
+            circle
+            onClick={() => {
+              if (this.state.loading) {
+                return;
               }
-            })
-          }}>
+              this.setState({
+                isInquiryOpened: true,
+                inquiryTitle: "提醒",
+                inquiryContent: "您确定要提交此申请吗?",
+                inquiryFn: () => {
+                  this.onSubmit();
+                },
+              });
+            }}
+          >
             提交申请
           </AtButton>
         </View>
@@ -480,25 +609,25 @@ class PublicContent extends Component{
           isOpened={this.state.isInquiryOpened}
           title={this.state.inquiryTitle}
           content={this.state.inquiryContent}
-          onClose={()=>{
+          onClose={() => {
             this.setState({
-              isInquiryOpened:false,
-              inquiryTitle:'',
-              inquiryContent:'',
-            })
+              isInquiryOpened: false,
+              inquiryTitle: "",
+              inquiryContent: "",
+            });
           }}
-          onDetermine={()=>{
+          onDetermine={() => {
             this.state.inquiryFn();
             this.setState({
-              isInquiryOpened:false,
-              inquiryTitle:'',
-              inquiryContent:'',
-              inquiryFn:()=>{}
-            })
+              isInquiryOpened: false,
+              inquiryTitle: "",
+              inquiryContent: "",
+              inquiryFn: () => {},
+            });
           }}
         />
       </View>
-    )
+    );
   }
 }