dev01 2 днів тому
батько
коміт
3c12e3e428

+ 1 - 2
src/pages/applyDepart/enterprise.jsx

@@ -361,8 +361,7 @@ class Enterprise extends Component {
         }
 
         <View>
-          {this.props.type == 0 || this.props.type == 2
-            ? this.state.list.map((v, k) => (
+          {[0, 2, 5].indexOf(this.props.type) > -1 ? this.state.list.map((v, k) => (
               <View key={k}>
                 <AtListItem
                   title={v.name}

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

@@ -200,6 +200,7 @@ class ApplyDepart extends Component {
                 { type: 0, title: "业务公出" },
                 { type: 1, title: "技术公出" },
                 { type: 2, title: "行政公出" },
+                { type: 5, title: "非公出协单" },
               ].map((item, index) => (
                 <View style={{ margin: "0 5px" }} key={item.type}>
                   <AtButton

+ 172 - 30
src/pages/applyDepart/publicContent.jsx

@@ -33,6 +33,9 @@ import "taro-ui/dist/style/components/calendar.scss";
 import "./publicContent.less";
 import InquiryModal from "../../components/common/inquiryModal"; //提示弹窗
 import UserQuery from "../../components/common/userquery"; //选择协单人弹窗
+import CheckboxPicker from "../../components/common/CheckboxPicker";
+import { assistTypeList, assistContentList } from "../../utils/tools/config";
+import { Fragment } from "react";
 
 class PublicContent extends Component {
   constructor(props) {
@@ -57,6 +60,17 @@ class PublicContent extends Component {
       popup: false,
       isNewshow: false,
       alone: 1, // 0非协单 1协单一起 2技术单独协单
+
+      assistType: '',
+      assistTypeName: '',
+      assistContent: '',
+      assistContentName: '',
+
+      multiplePickerShow: false,
+      multiplePickerType: '',
+      multiplePickerTitle: '',
+      multiplePickerOptions: [],
+      multiplePickerCheckedList: [],
     };
     this.onSubmit = this.onSubmit.bind(this);
     this.selectArrder = this.selectArrder.bind(this);
@@ -65,6 +79,8 @@ class PublicContent extends Component {
     this.onPickerHide = this.onPickerHide.bind(this);
     this.onSetPickerTime = this.onSetPickerTime.bind(this);
     this.getNumHourse = this.getNumHourse.bind(this);
+    this.handleOpenMultiplePicker = this.handleOpenMultiplePicker.bind(this)
+    this.handleMultipleConfirm = this.handleMultipleConfirm.bind(this)
   }
 
   componentDidMount() {
@@ -149,10 +165,15 @@ class PublicContent extends Component {
       assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
     };
     if (this.props.enterpriseInfor.type == 0 && this.props.uaiIdList.length) {
-        datas.uais = this.props.uaiIdList.join(',');
+      datas.uais = this.props.uaiIdList.join(',');
     } else if (this.props.enterpriseInfor.type == 2) {
-      datas = datas;
       datas = { ...datas, remarks: this.state.reason };
+    } else if (this.props.enterpriseInfor.type == 5) {
+      datas = {
+        ...datas,
+        assistType: this.state.assistType,
+        assistContentType: this.state.assistContent
+      }
     } else {
       datas = {
         ...datas,
@@ -256,10 +277,22 @@ class PublicContent extends Component {
 
   onSetPickerTime(val) {
     let data = val.detail;
-    this.setState({
-      rangeStartMinuteVal: data.selectStartTime,
-      rangeEndMinuteVal: data.selectEndTime,
-    });
+    
+    if(this.props.enterpriseInfor.type == 5) {
+      data.selectStartTime = dayjs(data.selectStartTime).format('YYYY-MM-DD 08:30:00')
+      data.selectEndTime = dayjs(data.selectEndTime).format('YYYY-MM-DD 17:30:00')
+      data.startTime = dayjs(data.startTime).format('YYYY-MM-DD 08:30:00')
+      data.endTime = dayjs(data.endTime).format('YYYY-MM-DD 17:30:00')
+    }
+
+    let rangeStartMinuteVal = data.selectStartTime;
+    let rangeEndMinuteVal = data.selectEndTime;
+
+    if (this.props.enterpriseInfor.type == 5) {
+      rangeStartMinuteVal = dayjs(data.selectStartTime).format('YYYY-MM-DD');
+      rangeEndMinuteVal = dayjs(data.selectEndTime).format('YYYY-MM-DD');
+    }
+    this.setState({ rangeStartMinuteVal, rangeEndMinuteVal });
     let arr = [];
     if (data.startTime && data.endTime) {
       let a = dayjs(data.startTime);
@@ -393,6 +426,86 @@ class PublicContent extends Component {
       });
   }
 
+  // 公出类型名称
+  getBusTripTypeName() {
+    let str  = ''
+    switch (this.props.enterpriseInfor.type) {
+      case 0:
+        str = '业务公出'
+        break;
+      case 1:
+        str = '技术公出'
+        break;
+      case 2:
+        str = '行政公出'
+        break;
+      case 3:
+        str = '技术协单'
+        break;
+      case 5:
+        str = '非公出协单'
+        break;
+      default:
+        break;
+    }
+    return str
+  }
+
+  handleOpenMultiplePicker(type) {
+    let multiplePickerOptions = [];
+    let multiplePickerTitle = '';
+    let multiplePickerCheckedList = [];
+    const { assistType, assistContent } = this.state;
+    switch (type) {
+      case 'assistType':
+        // 协单项目类型
+        multiplePickerOptions = assistTypeList;
+        multiplePickerCheckedList = assistType ? assistType.toString().split(',') : []
+        multiplePickerTitle = '请选择协单项目类型';
+        break;
+      case 'assistContent':
+        // 协单项目内容
+        multiplePickerOptions = assistContentList;
+        multiplePickerCheckedList = assistContent ? assistContent.toString().split(',') : []
+        multiplePickerTitle = '请选择协单项目内容';
+        break;
+      default:
+        break;
+    }
+
+    this.setState({
+      multiplePickerShow: true,
+      multiplePickerType: type,
+      multiplePickerTitle,
+      multiplePickerOptions,
+      multiplePickerCheckedList: multiplePickerCheckedList.map(item => Number(item))
+    }, () => {
+      console.log(assistTypeList, this.state.multiplePickerOptions)
+    })
+  }
+
+  handleMultipleConfirm(selectedIds, selectedLabels) {
+    const { multiplePickerType } = this.state;
+    switch (multiplePickerType) {
+      case "assistType":
+        // 协单项目类型
+        this.setState({
+          assistType: selectedIds.join(','),
+          assistTypeName: selectedLabels.join(',')
+        })
+        break;
+      case "assistContent":
+        // 协单项目内容
+        this.setState({
+          assistContent: selectedIds.join(','),
+          assistContentName: selectedLabels.join(',')
+        })
+        break;
+      default:
+        break;
+    }
+  }
+
   render() {
     const { cList, coorderList, popup } = this.state
     const info = Taro.getStorageSync("userInfor");
@@ -416,13 +529,7 @@ class PublicContent extends Component {
         }
         <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
-                  ? "行政公出" : this.props.enterpriseInfor.type == 3
-                    ? "技术协单" : ""}
-          </View>
+          <View className="formValue">{this.getBusTripTypeName()}</View>
         </View>
         {this.props.enterpriseInfor.contractNo ? (
           <View className="formItem">
@@ -466,7 +573,7 @@ class PublicContent extends Component {
             <timePicker
               config={{
                 endDate: true,
-                column: "minute",
+                column: "day",
                 dateLimit: false,
                 // initStartTime: "2019-01-01 12:32:44", //默认开始时间
                 // initEndTime: "2019-12-01 12:32:44",   //默认结束时间
@@ -480,17 +587,18 @@ class PublicContent extends Component {
               isPartition
               pickerShow={this.state.isPickerRender}
               onconditionaljudgment={(v) => {
-                let startTimeD = dayjs(
-                  dayjs(v.detail.startTime)
-                    .second(0)
-                    .format("YYYY-MM-DD HH:mm:ss")
-                );
-                let endTimeD = dayjs(
-                  dayjs(v.detail.endTime)
-                    .second(0)
-                    .format("YYYY-MM-DD HH:mm:ss")
-                );
-                let currTimeD = dayjs(dayjs().second(0).format("YYYY-MM-DD HH:mm:ss"));
+                const { enterpriseInfor } = this.props
+                let formatTemp = enterpriseInfor.type == 5 ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss"
+                let selTimeStr = dayjs(v.detail.startTime).second(0).format(formatTemp)
+                let selEndTimeStr = dayjs(v.detail.endTime).second(0).format(formatTemp)
+                
+                let startTimeD = dayjs(enterpriseInfor.type == 5 ? `${selTimeStr} 00:00:00` : selTimeStr);
+                let endTimeD = dayjs(enterpriseInfor.type == 5 ? `${selEndTimeStr} 23:59:59` : selEndTimeStr);
+
+                let now = dayjs()
+                let currTime = enterpriseInfor.type == 5 ? now.subtract(1, 'day').set('hour', 23).set('minute', 59).set('second', 59) : dayjs().second(0)
+
+                let currTimeD = dayjs(currTime.format("YYYY-MM-DD HH:mm:ss"));
                 if (!startTimeD.isAfter(currTimeD)) {
                   Taro.showToast({
                     title: "开始时间不能小于当前时间",
@@ -597,7 +705,7 @@ class PublicContent extends Component {
           以地图为中心100米范围为可打卡区域,移动红标只需要拖动地图即可
         </View>
         {
-          this.props.enterpriseInfor.type === 0 &&
+          [1, 5].indexOf(this.props.enterpriseInfor.type) > -1 &&
           <View className="formItems" style={{ alignItems: "center", paddingBottom: 0, marginTop: 10 }}>
             <View className="formNames">技术协单: </View>
             <View className="formValues" style={{ alignItems: "center" }}>
@@ -628,7 +736,7 @@ class PublicContent extends Component {
           </View>
         }
         {
-          this.props.enterpriseInfor.type === 0 &&
+          [1, 5].indexOf(this.props.enterpriseInfor.type) > -1 &&
           <View className="tips">
             请与技术协商后,再发起协单,协单将统计公出成本等
           </View>
@@ -666,12 +774,36 @@ class PublicContent extends Component {
             </View>
           </View>
         }
+
+        { this.props.enterpriseInfor.type == 5 ? (
+          <Fragment>
+            <View className="formItem">
+              <View className="formName">协单类型:</View>
+              <View className="formValue" onClick={() => this.handleOpenMultiplePicker('assistType')}>
+                <Text className="formValueText">
+                  { this.state.assistTypeName }
+                </Text>
+                <AtIcon value="chevron-right" size="30" color="#bbbbbb" />
+              </View>
+            </View>
+            <View className="formItem">
+              <View className="formName">协单内容:</View>
+              <View className="formValue" onClick={() => this.handleOpenMultiplePicker('assistContent')}>
+                <Text className="formValueText">
+                  { this.state.assistContentName }
+                </Text>
+                <AtIcon value="chevron-right" size="30" color="#bbbbbb" />
+              </View>
+            </View>
+          </Fragment>
+        ) : null }
+        
         <View
           className="formItem"
           style={{ display: "block", paddingTop: "10px" }}
         >
           {/* 公出目标 */}
-          {[1, 2].indexOf(this.props.enterpriseInfor.type) > -1 && (
+          {[1, 2, 5].indexOf(this.props.enterpriseInfor.type) > -1 && (
             <View className="formName">
                 <Text><Text style={{ color: "red" }}>*</Text>公出目标:</Text>
                 <View
@@ -699,7 +831,7 @@ class PublicContent extends Component {
           )}
           
           {/* 公出计划 */}
-          {this.props.enterpriseInfor.type == 1 && (
+          {[1, 5].indexOf(this.props.enterpriseInfor.type) > -1 && (
             <View className="formName">
               <Text><Text style={{ color: "red" }}>*</Text>公出计划:</Text>
               <View
@@ -722,7 +854,7 @@ class PublicContent extends Component {
             </View>
           )}
           {/* 预计效果 */}
-          {this.props.enterpriseInfor.type == 1 && (
+          {[1, 5].indexOf(this.props.enterpriseInfor.type) > -1 && (
             <View className="formName">
               <Text><Text style={{ color: "red" }}>*</Text>预计效果:</Text>
               <View
@@ -876,6 +1008,16 @@ class PublicContent extends Component {
             setList={this.setList.bind(this)}
           />
         }
+
+        {/* 多选框 */}
+        <CheckboxPicker
+          isOpened={this.state.multiplePickerShow}
+          title={this.state.multiplePickerTitle}
+          options={this.state.multiplePickerOptions}
+          checkedList={this.state.multiplePickerCheckedList}
+          onClose={() => { this.setState({ multiplePickerShow: false, multiplePickerCheckedList: [] }) }}
+          onConfirm={this.handleMultipleConfirm}
+        ></CheckboxPicker>
       </View >
     );
   }

+ 48 - 1
src/utils/tools/config.js

@@ -13638,4 +13638,51 @@ export const yearList = [{
 }, {
     title: 2031,
     id: 2031
-}];
+}];
+
+// 协单类型
+export const assistTypeList = [{
+  title: '其他',
+  id: '0'
+}, {
+  title: '高企认定',
+  id: '1'
+}, {
+  title: '会员服务',
+  id: '2'
+}, {
+  title: '科技项目',
+  id: '3'
+}, {
+  title: '研动力系统',
+  id: '4'
+}, {
+  title: '知识产权',
+  id: '5'
+}, {
+  title: '军工',
+  id: '6'
+}, {
+  title: '涉密',
+  id: '7'
+}, {
+  title: '技术合同登记',
+  id: '8'
+}, {
+  title: '第三方认证项目',
+  id: '9'
+}]
+
+export const assistContentList = [{
+  title: '其他',
+  id: '0'
+}, {
+  title: '会议',
+  id: '1'
+}, {
+  title: '写方案',
+  id: '2'
+}, {
+  title: '接待',
+  id: '3'
+}]