dev01 1 yıl önce
ebeveyn
işleme
e60de0017e

+ 2 - 1
src/app.config.js

@@ -4,7 +4,8 @@ export default {
     'pages/project/index', // 研发项目
     'pages/login/index', // 登录
     'pages/mybusiness/index', // 我的
-    'pages/detail/index', //项目详情
+    'pages/detail/index', //打卡详情
+    'pages/projectDetail/index', //项目详情
     'pages/reclockin/index', // 重新打卡
     // 'pages/projectAdd/index',// 新增项目
   ],

+ 2 - 7
src/pages/detail/index.jsx

@@ -1,14 +1,9 @@
 import React, { Component } from "react";
 import Taro, { getCurrentInstance } from "@tarojs/taro";
-import { View, Text, Image, Button } from "@tarojs/components";
+import { View, Text, Image, } from "@tarojs/components";
 import {
   AtButton,
-  AtCalendar,
-  AtIcon,
   AtTextarea,
-  AtModal,
-  AtModalContent,
-  AtModalAction,
 } from "taro-ui";
 import Skeleton from "taro-skeleton";
 import {
@@ -70,7 +65,7 @@ class Detail extends Component {
             });
           }, 1800);
           Taro.showToast({
-            title: "您没有权限查看此公出详情",
+            title: "您没有权限查看此详情",
             icon: "none",
             duration: 1800,
           });

+ 2 - 1
src/pages/project/index.jsx

@@ -30,7 +30,8 @@ class Project extends Component {
       typeList: [
         { title: '全部', type: 1 },
         { title: '我创建', type: 2 },
-        { title: '我参与', type: 3 }],
+        // { title: '我参与', type: 3 }
+      ],
       current: 0,
 
       list: [],

+ 1 - 1
src/pages/project/index.less

@@ -241,7 +241,7 @@
 
         .userName {
           font-size: 25px;
-          color: #999999;
+          // color: #999999;
           padding-bottom: 15px;
           display: flex;
           flex-flow: row nowrap;

+ 22 - 14
src/pages/project/myList.jsx

@@ -12,7 +12,7 @@ class MyList extends Component {
   }
 
   render() {
-    const { title } = this.props
+    let roles = Taro.getStorageSync('roles');
     return (
       <View className="indexPage">
         <View className="list">
@@ -26,6 +26,11 @@ class MyList extends Component {
             <View
               key={k}
               className="item"
+              onClick={(e) => {
+                Taro.navigateTo({
+                  url: `/pages/projectDetail/index?id=${v.id}`,
+                });
+              }}
             >
               <View className="infor">
                 <View className="title">
@@ -48,20 +53,23 @@ class MyList extends Component {
                     累积工时:{v.duration}
                   </View>
                 </View>
-                <View className="releaseStarts">
-                  <View
-                    className="punchClock"
-                    onClick={(e) => {
-                      e.stopPropagation();
-                      Taro.eventCenter.trigger("GoPunchIn", v);
-                      Taro.switchTab({
-                        url: "/pages/punchClock/index",
-                      });
-                    }}
-                  >
-                    去打卡
+                {
+                  !roles.includes("ceo") &&
+                  <View className="releaseStarts">
+                    <View
+                      className="punchClock"
+                      onClick={(e) => {
+                        e.stopPropagation();
+                        Taro.eventCenter.trigger("GoPunchIn", v);
+                        Taro.switchTab({
+                          url: "/pages/punchClock/index",
+                        });
+                      }}
+                    >
+                      去打卡
+                    </View>
                   </View>
-                </View>
+                }
               </View>
             </View>
           ))}

+ 3 - 0
src/pages/projectDetail/index.config.js

@@ -0,0 +1,3 @@
+export default {
+  navigationBarTitleText: '研发项目详情',
+}

+ 183 - 0
src/pages/projectDetail/index.jsx

@@ -0,0 +1,183 @@
+import React, { Component } from "react";
+import Taro, { getCurrentInstance } from "@tarojs/taro";
+import { View, Text, Image, } from "@tarojs/components";
+import {
+  AtButton,
+  AtTextarea,
+} from "taro-ui";
+import Skeleton from "taro-skeleton";
+import {
+  projectDetails,
+  examineRecord,
+} from "../../utils/servers/servers";
+import { resourceAddress } from "../../utils/config";
+import dayjs from "dayjs";
+import './index.less'
+
+class ProjectDetail extends Component {
+  $instance = getCurrentInstance();
+
+  constructor(props) {
+    super(props);
+    this.state = {
+      opinion: "",
+      attachmentUrl: [],
+      data: {},
+      historicalIsOpened: false,
+    }
+    this.getProjectDetail = this.getProjectDetail.bind(this);
+  }
+
+  componentDidMount() {
+    this.getProjectDetail();
+  }
+
+  componentDidShow() {
+    this.getProjectDetail();
+  }
+
+  // 项目详情
+  getProjectDetail() {
+    console.log("111")
+    projectDetails({
+      id: this.$instance.router.params.id,
+    }).then((v) => {
+      if (v.code === 200) {
+        if (v.data) {
+          let list = [];
+          for (let i of (v.data.annexUrl || '').split(',')) {
+            if (i) {
+              list.push({ 'url': resourceAddress + i })
+            }
+          }
+          this.setState({
+            data: v.data,
+            attachmentUrl: list,
+          })
+        } else {
+          setTimeout(() => {
+            Taro.switchTab({
+              url: "/pages/project/index",
+            });
+          }, 1800);
+          Taro.showToast({
+            title: "您没有权限查看此详情",
+            icon: "none",
+            duration: 1800,
+          });
+        }
+      } else {
+        Taro.showToast({ title: v.msg, icon: "none" });
+      }
+    })
+      .catch((err) => {
+        Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
+        // console.log(err);
+      });
+  }
+
+  // 同意/驳回
+  agree(sta) {
+    if (!this.state.opinion) {
+      Taro.showToast({ title: "请填写审批意见", icon: "none" });
+      return;
+    }
+    examineRecord({
+      id: this.$instance.router.params.id,
+      processStatus: sta,
+      content: this.state.opinion,
+    })
+      .then((v) => {
+        if (v.code === 200) {
+          Taro.showToast({
+            title: "操作成功",
+            icon: "none",
+          });
+          this.getReleasetDails();
+        } else {
+          Taro.showToast({ title: v.msg, icon: "none" });
+        }
+      })
+      .catch((err) => {
+        Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
+        // console.log(err);
+      });
+  }
+
+
+  render() {
+    const { data, attachmentUrl } = this.state
+    return (
+      <View className="indexPage">
+        {Object.keys(data).length === 0 ?
+          <Skeleton
+            title
+            row={3}
+            animateName="elastic"
+            avatarShape="square"
+            loading
+          /> :
+          <View className="list">
+            <View className="item">
+              <View className="infor">
+                <View className="title">
+                  <View className="aname">
+                    {data.name}
+                  </View>
+                </View>
+
+                <View className="userName">
+                  <View className="uNtext">
+                    项目编号:{data.id}
+                  </View>
+                </View>
+                <View className="userName">
+                  <View className="uNtext">
+                    项目名称:{data.name}
+                  </View>
+                </View>
+                <View className="userName">
+                  <View className="uNtext">
+                    项目起止时间:{dayjs(data.startTime).format("YYYY-MM-DD") + " 至 " + dayjs(data.endTime).format("YYYY-MM-DD")}
+                  </View>
+                </View>
+                <View className="userName">
+                  <View className="uNtext">
+                    是否跨年:{["否", "是"][data.crossYear]}
+                  </View>
+                </View>
+                <View className="userName">
+                  <View className="uNtext">
+                    创建年份:{data.createYear}
+                  </View>
+                </View>
+                <View className="userName">
+                  <View className="uNtext">
+                    项目年份:{data.projectYear}
+                  </View>
+                </View>
+                <View className="userName">
+                  <View className="uNtext">
+                    项目负责人:{data.adminName}
+                  </View>
+                </View>
+                <View className="userName">
+                  <View className="uNtext">
+                    研发人员:{data.staffName}
+                  </View>
+                </View>
+                <View className="userName" style={{ marginBottom: 20 }}>
+                  <View className="uNtext">
+                    备注:{data.remark}
+                  </View>
+                </View>
+                <AtButton type='primary'>累计研发工时:{data.duration}</AtButton>
+              </View>
+            </View>
+          </View>}
+      </View>
+    );
+  }
+}
+
+export default ProjectDetail;

+ 28 - 0
src/pages/projectDetail/index.less

@@ -0,0 +1,28 @@
+.at-image-picker__remove-btn {
+  display: none;
+}
+
+.logbt {
+  margin-left: 30px;
+  text-decoration: underline;
+  color: #4e6ef2;
+}
+
+.option {
+  width: 50%;
+  margin: 50px auto;
+}
+
+.statusicon {
+  position: absolute;
+  right: 0;
+  top: 100px;
+  width: 222px;
+  height: 197px;
+}
+
+textarea {
+  background: #D7D7D7;
+  padding: 20px;
+  border-radius: 20px;
+}

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

@@ -96,7 +96,6 @@ class PunchClocks extends Component {
   }
 
   publicReleaseClockIn() {
-
     if (!this.state.dateSel) {
       Taro.showToast({ title: '请选择研发时间!', icon: 'none' });
       return
@@ -152,8 +151,14 @@ class PunchClocks extends Component {
 
   onClose() {
     const { clockId } = this.state
+    this.imagePickerRef && this.imagePickerRef.clear();
     this.setState({
-      isOpened: false
+      dateSel: dayjs().format('YYYY-MM-DD'),
+      duration: "",
+      selectorChecked: {},
+      remark: "",
+      imgs: [],
+      isOpened: false,
     })
     if (!!clockId) {
       Taro.navigateTo({
@@ -272,12 +277,6 @@ class PunchClocks extends Component {
                       />
                     </View>
                   </View>
-                  {/* <ImagePicker
-                      showAddBtn
-                      ref={(ref) => (this.imagePickerRef = ref)}
-                      url="/api/project/upload"
-                      onChange={this.onChange}
-                    /> */}
                   <View className='items'>
                     <View className='ititles'><Text style={{ width: "7px" }}></Text>上传附件:</View>
                     <ImagePicker

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

@@ -175,7 +175,6 @@ class ReClockin extends Component {
                 <View className='ititle'><Text style={{ color: "red", width: "7px" }}>*</Text>研发时间:
                   <Picker mode='date'
                     onChange={e => {
-                      console.log("===", e.detail.value)
                       this.setState({
                         dateSel: e.detail.value
                       })

+ 5 - 0
src/utils/servers/servers.js

@@ -72,6 +72,11 @@ export const recordDetails = (postData = {}) => {
   return HTTPREQUEST.get('/api/project/recordDetails', postData)
 }
 
+// 研发项目详情
+export const projectDetails = (postData = {}) => {
+  return HTTPREQUEST.get('/api/project/details', postData)
+}
+
 // 研发日志审核
 export const examineRecord = (postData = {}) => {
   return HTTPREQUEST.post('/api/project/examineRecord', postData)