Quellcode durchsuchen

人日移动端

xujunjie vor 1 Jahr
Ursprung
Commit
d38a21c8b9

+ 6 - 1
manifest.json

@@ -58,7 +58,12 @@
     "h5" : {
         "devServer" : {
             "https" : false,
-            "port" : ""
+            "proxy" : {
+                "/api" : {
+                    "changeOrigin" : true,
+                    "target" : "http://47.96.12.136:8888"
+                }
+            }
         },
         "router" : {
             "base" : ""

+ 16 - 0
pages.json

@@ -28,6 +28,22 @@
         }
       }
     },
+    {
+      "path": "pages/daily/daily",
+      "style": {
+        "enablePullDownRefresh": true,
+        "pullToRefresh": {
+          "color": "#2979ff",
+          "offset": "60px"
+        }
+      }
+    },
+    {
+      "path": "pages/daily/form"
+    },
+    {
+      "path": "pages/daily/projectDaily"
+    },
     {
       "path": "pages/Project/add"
     },

+ 16 - 0
pages/Project/edit.vue

@@ -8,6 +8,7 @@
           </view>
           <view class="edit" v-if="canEdit(0)" @click="onEdit">编辑</view>
           <view class="edit" v-if="canEdit(0)" @click="onDelete">删除</view>
+          <view class="edit" @click="onDaily">项目日志</view>
           <view class="edit" v-if="canEdit(0)" @click="onSubmitAuth">
             提交审核
           </view>
@@ -29,6 +30,10 @@
           <view class="edit" v-if="canAuth()" @click="onHandleAudit(0)">
             审核拒绝
           </view>
+          <view class="edit empty">
+          </view>
+          <view class="edit empty">
+          </view>
         </view>
       </uni-card>
     </view>
@@ -174,6 +179,11 @@ export default {
       this.$emit("canEdit", toRet);
       return toRet;
     },
+    onDaily() {
+      uni.navigateTo({
+        url: `/pages/daily/projectDaily?project_id=${this.project.id}`,
+      });
+    },
     hideHelper() {
       setTimeout(() => {
         uni.hideToast();
@@ -479,6 +489,12 @@ export default {
     text-align: center;
     border-radius: 10rpx;
     box-shadow: 0 2rpx 2rpx #666;
+    &.empty {
+      visibility: hidden;
+      height: 1;
+      margin: 0;
+      opacity: 0;
+    }
   }
 }
 

+ 1 - 1
pages/Project/list.vue

@@ -170,7 +170,7 @@ export default {
         this.depRole = dep.Role;
       }
     },
-    async getProject(params) {
+    async getList(params) {
       let res = {};
       if (this.auth) res = await queryAuth(params);
       else res = await queryProject(params);

+ 181 - 0
pages/daily/daily.vue

@@ -0,0 +1,181 @@
+<template>
+  <view class="page">
+    <view class="content">
+      <view class="head">
+        <span class="title">项目列表</span>
+        <navigator
+          url="/pages/daily/form"
+          class="self"
+          open-type="navigate"
+          hover-class="navigator-hover"
+        >
+          写日志
+        </navigator>
+      </view>
+      <uni-search-bar
+        bgColor="#FFFFFF"
+        :radius="20"
+        placeholder="请输入日志标题"
+        v-model="searchKeyword"
+        @confirm="handelSearchConfirm"
+      />
+      <scroll-view
+        class="list"
+        :scroll-top="scrollTop"
+        scroll-y="true"
+        @scrolltolower="scrollToLower()"
+      >
+        <view class="item" v-for="item in list" :key="item.log_id">
+          <view class="time">07-12 8:50</view>
+          <view class="box">
+            <view class="title">张三的金科环境项目日志</view>
+            <view class="desc">
+              <view class="desc-title">日志概述:</view>
+              <view class="desc-content">
+                项目进展顺利项目进展顺利项目进项目进展顺利项目进展顺利项目进
+              </view>
+            </view>
+          </view>
+        </view>
+        <view class="loadmore">{{ loadMoreText }}</view>
+      </scroll-view>
+    </view>
+  </view>
+</template>
+
+<script>
+import { queryDaily } from "@/services/daily";
+import mixin from "@/utils/listMixin";
+
+export default {
+  mixins: [mixin],
+  data() {
+    return {
+      searchKeyword: "",
+      scrollTop: 0,
+      loadMoreText: '',
+      list: [],
+    };
+  },
+  onShow() {
+    this.pagination.currentPage = 1
+    this.initData()
+  },
+  methods: {
+
+    handelSearchConfirm() {},
+    scrollToLower() {
+      if (this.projectList.length >= this.pagination.total) {
+        this.loadMoreText = "没有更多数据了";
+        return;
+      }
+      this.pagination.currentPage++;
+      this.initData();
+    },
+    async getList(params){
+      let res = await queryDaily(params)
+      this.list = res.data.list
+      return res.data
+    }
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.content {
+  display: flex;
+  justify-content: center;
+  flex-wrap: wrap;
+  padding-top: 150rpx;
+  ::v-deep {
+    .uni-searchbar {
+      width: 100%;
+      .uni-searchbar__box {
+        border: 1px solid #ccc;
+      }
+    }
+  }
+}
+.head {
+  width: calc(100% - 60rpx);
+  padding: 40rpx;
+  position: fixed;
+  background: url("~@/static/app-plus/menu-title-bg.png") no-repeat center;
+  background-size: 100% 100%;
+  background-color: #fff;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  z-index: 1;
+  top: 0;
+  .title {
+    font: 18px bold;
+    color: #fff;
+  }
+  .self {
+    font: 14px;
+    padding-left: 20rpx;
+    color: #fff;
+  }
+}
+.list {
+  width: 90%;
+  height: calc(90vh - 130rpx);
+  ::v-deep {
+    .uni-list--border-top {
+      background-color: transparent;
+    }
+    .uni-list-item__container {
+      padding: 12rpx 30rpx;
+    }
+  }
+}
+.loadmore {
+  padding: 30rpx 0px;
+  font-size: 16px;
+  color: gray;
+  text-align: center;
+}
+.item {
+  margin-top: 20rpx;
+  .time {
+    padding-left: 25rpx;
+    font-size: 24rpx;
+    color: #7a7a7a;
+    line-height: 32rpx;
+    margin-bottom: 10rpx;
+  }
+  .box {
+    padding: 40rpx;
+    border-radius: 5rpx;
+    border: 1px solid #ccc;
+    box-shadow: 0 1rpx 4rpx rgba(255, 255, 255, 0.2);
+    .title {
+      font-size: 28rpx;
+      font-weight: 400;
+      color: #4a90e2;
+      line-height: 40rpx;
+      margin-bottom: 18rpx;
+    }
+    .desc {
+      display: flex;
+      font-size: 28rpx;
+      font-weight: 400;
+      color: #4a4a4a;
+      line-height: 40rpx;
+      .desc-title {
+        flex-shrink: 1;
+      }
+      .desc-content {
+        flex: 1;
+        display: -webkit-box;
+        -webkit-line-clamp: 2; /* 显示的行数 */
+        -webkit-box-orient: vertical;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: normal;
+      }
+    }
+  }
+}
+</style>

+ 224 - 0
pages/daily/form.vue

@@ -0,0 +1,224 @@
+<template>
+  <view class="page">
+    <view class="content">
+      <view class="head">
+        <span class="title">写日志</span>
+      </view>
+
+      <view class="forms">
+        <view class="title2">张三的金科环境项目日志</view>
+        <view class="title-sub">日志详情</view>
+        <uni-forms
+          :modelValue="formData"
+          label-position="left"
+          class="form"
+          ref="form"
+          :rules="rules"
+        >
+          <view class="box" v-for="item in formData" :key="item.key">
+            <view
+              v-show="formData.length > 1"
+              class="btn-remove"
+              @click="removeFormData(item.key)"
+              >-</view
+            >
+            <uni-forms-item
+              required
+              label="项目名称"
+              name="project_name"
+              class="formItem"
+              v-if="!project_id"
+            >
+              <picker
+                @change="selectProjectList"
+                :range="projectList"
+                :range-key="'name'"
+              >
+                <!-- <view class="select" v-if="formData.industry">
+                {{ `${formData.industry.name}(${formData.industry.code})` }}
+              </view> -->
+                <view class="selectPlaceholder">请选择项目</view>
+              </picker>
+            </uni-forms-item>
+            <uni-forms-item
+              required
+              label="日志概述"
+              name="project_name"
+              class="formItem"
+            >
+              <input
+                v-model="formData.project_name"
+                class="input"
+                placeholder="请输入日志概述"
+              />
+            </uni-forms-item>
+            <uni-forms-item
+              required
+              label="日志详情"
+              name="project_name"
+              class="formItem"
+            >
+              <textarea class="textarea" placeholder="请输入日志详情" />
+            </uni-forms-item>
+          </view>
+        </uni-forms>
+        <view class="btn-add" @click="addFormData">+ 新增</view>
+      </view>
+      <view class="button">提 交</view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      scrollTop: 0,
+      projectList: [],
+      project_id: '',
+      formData: [
+        {
+          key: +new Date(),
+          project_name: "",
+        },
+      ],
+      rules: {
+        project_name: {
+          rules: [
+            {
+              required: true,
+              errorMessage: "请选择项目名称",
+            },
+          ],
+        },
+      },
+    };
+  },
+  onLoad(options) {
+    this.project_id = options.project_id;
+  },
+  methods: {
+    selectProjectList(e) {
+      // this.formData.version = e.target.value + 1;
+      // this.formData.code.version = this.formData.version + "";
+      // this.binddata("version", e.target.value);
+    },
+    addFormData() {
+      this.formData.push({
+        key: +new Date(),
+        project_name: "",
+      });
+    },
+    removeFormData(key) {
+      let index = this.formData.findIndex((item) => item.key == key);
+      this.formData.splice(index, 1);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.head {
+  width: calc(100% - 60rpx);
+  padding: 40rpx;
+  position: fixed;
+  background: url("~@/static/app-plus/menu-title-bg.png") no-repeat center;
+  background-size: 100% 100%;
+  background-color: #fff;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  z-index: 1;
+  .title {
+    font: 18px bold;
+    color: #fff;
+  }
+}
+.forms {
+  padding: 40rpx 34rpx;
+  padding-top: 168rpx;
+  .title2 {
+    font-size: 28rpx;
+    font-weight: 400;
+    color: #4a90e2;
+    line-height: 40rpx;
+    padding-bottom: 18rpx;
+    border-bottom: 1px solid #e8e8e8;
+  }
+  .title-sub {
+    font-size: 28rpx;
+    font-weight: 400;
+    color: #4a4a4a;
+    line-height: 40rpx;
+    margin-top: 20rpx;
+    margin-bottom: 20rpx;
+  }
+  .formItem {
+  }
+  .input,
+  .textarea,
+  .selectPlaceholder {
+    font-size: 28rpx;
+    padding-left: 24rpx;
+    border: 1rpx solid #c0c0c0;
+  }
+  .input,
+  .selectPlaceholder {
+    line-height: 72rpx;
+    height: 72rpx;
+  }
+  .textarea {
+    padding-top: 10rpx;
+    width: 400rpx;
+    height: 200rpx;
+  }
+}
+
+.form {
+  margin: 0 20px;
+}
+.button {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  width: 100%;
+  height: 100rpx;
+  background: url("~@/static/btn-bg.png") no-repeat center;
+  background-size: 100% 100%;
+
+  font-size: 38rpx;
+  font-weight: 500;
+  color: #ffffff;
+  line-height: 100rpx;
+  text-align: center;
+}
+.btn-add {
+  width: 140rpx;
+  height: 50rpx;
+  border: 1rpx solid #329bfe;
+  color: #329bfe;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  margin-left: 48rpx;
+}
+.box {
+  position: relative;
+}
+.btn-remove {
+  position: absolute;
+  right: -10px;
+  top: -12px;
+  width: 12px;
+  height: 12px;
+  background: #f54444;
+  border-radius: 50%;
+  line-height: 20rpx;
+  text-align: center;
+  color: #fff;
+  font-weight: bold;
+}
+.forms {
+  padding-bottom: 140rpx;
+}
+</style>

+ 290 - 0
pages/daily/projectDaily.vue

@@ -0,0 +1,290 @@
+<template>
+  <view class="page">
+    <view class="content">
+      <view class="head">
+        <span class="title">项目列表</span>
+        <navigator
+          :url="`/pages/daily/form?project_id=${project_id}`"
+          class="self"
+          open-type="navigate"
+          hover-class="navigator-hover"
+        >
+          写日志
+        </navigator>
+      </view>
+
+      <view class="search">
+        <uni-search-bar
+          bgColor="#FFFFFF"
+          style="padding: 20rpx 30rpx"
+          :radius="20"
+          placeholder="请输入日志标题"
+          v-model="filter.searchKeyword"
+          @confirm="handelSearchConfirm"
+        />
+        <view class="selectRow">
+          <view class="selectCol">
+            <picker
+              style="max-width: 80%"
+              :range="[]"
+              range-key="label"
+              @change="handelChange"
+            >
+              <view class="pickerSlot">
+                <view class="itemText"> 提交人 </view>
+                <!-- v-if="selectedValues[index] === null" -->
+                <image
+                  class="triangle"
+                  src="/static/triangle@2x.png"
+                  mode="widthFix"
+                />
+              </view>
+            </picker>
+            <!-- <uni-icons
+              v-if="selectedValues[index] !== null"
+              type="closeempty"
+              size="14"
+              @click="cleanSelect(index)"
+            ></uni-icons> -->
+          </view>
+          <view class="selectCol">
+            <uniDatetimePicker
+              style="max-width: 80%"
+              type="daterange"
+              hide-second
+              clear-icon
+              @change="handelTimePickerChange"
+            >
+              <view class="pickerSlot">
+                <view class="itemText">
+                  <!-- {{
+                    timerange.length !== 0
+                      ? `${timerange[0]}~${timerange[0]}`
+                      : item.placeholder
+                  }} -->
+                  发布日期
+                </view>
+                <image
+                  class="triangle"
+                  src="/static/triangle@2x.png"
+                  mode="widthFix"
+                />
+              </view>
+            </uniDatetimePicker>
+            <!-- <uni-icons
+              v-if="timerange.length === 2"
+              type="closeempty"
+              size="14"
+              @click="cleanSelect(index)"
+            ></uni-icons> -->
+          </view>
+        </view>
+      </view>
+      <scroll-view
+        class="list"
+        :scroll-top="scrollTop"
+        scroll-y="true"
+        @scrolltolower="scrollToLower()"
+      >
+        <view class="item">
+          <view class="box">
+            <view class="title">张三的金科环境项目日志</view>
+            <view class="desc">
+              <view class="desc-title">日志概述:</view>
+              <view class="desc-content">
+                项目进展顺利项目进展顺利项目进项目进展顺利项目进展顺利项目进
+              </view>
+            </view>
+            <view class="bottom">
+              <view class="time">07-12 8:50</view>
+              <view class="user">提交人:xxx</view>
+            </view>
+          </view>
+        </view>
+      </scroll-view>
+    </view>
+  </view>
+</template>
+
+<script>
+import uniDatetimePicker from "@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue";
+import moment from "moment";
+export default {
+  components: {
+    uniDatetimePicker,
+  },
+  data() {
+    return {
+      scrollTop: 0,
+      filter: { searchKeyword: "" },
+      project_id: "",
+    };
+  },
+  methods: {
+    handelSearchConfirm() {},
+    handelChange() {},
+    scrollToLower() {
+      // if (this.projectList.length >= this.pagination.total) {
+      //   this.loadMoreText = "没有更多数据了";
+      //   return;
+      // }
+      // this.pagination.currentPage++;
+      // this.initData();
+    },
+    handelTimePickerChange(time) {
+      if (time.length !== 2) {
+        return;
+      }
+      this.filter.start = moment(time[0]).format("YYYY-MM-DD 00:00:00");
+
+      this.filter.end = moment(time[1]).format("YYYY-MM-DD 23:59:59");
+    },
+  },
+  onLoad(options) {
+    this.project_id = options.project_id;
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.content {
+  display: flex;
+  justify-content: center;
+  flex-wrap: wrap;
+  padding-top: 150rpx;
+}
+
+.head {
+  width: calc(100% - 60rpx);
+  padding: 40rpx;
+  position: fixed;
+  background: url("~@/static/app-plus/menu-title-bg.png") no-repeat center;
+  background-size: 100% 100%;
+  background-color: #fff;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  z-index: 1;
+  top: 0;
+  .title {
+    font: 18px bold;
+    color: #fff;
+  }
+  .self {
+    font: 14px;
+    padding-left: 20rpx;
+    color: #fff;
+  }
+}
+.list {
+  width: 90%;
+  height: calc(90vh - 200rpx);
+  ::v-deep {
+    .uni-list--border-top {
+      background-color: transparent;
+    }
+    .uni-list-item__container {
+      padding: 12rpx 30rpx;
+    }
+  }
+}
+.loadmore {
+  padding: 30rpx 0px;
+  font-size: 16px;
+  color: gray;
+  text-align: center;
+}
+.item {
+  margin-top: 20rpx;
+
+  .box {
+    padding: 40rpx;
+    border-radius: 5rpx;
+    border: 1px solid #ccc;
+    box-shadow: 0 1rpx 4rpx rgba(255, 255, 255, 0.2);
+    .title {
+      font-size: 28rpx;
+      font-weight: 400;
+      color: #4a90e2;
+      line-height: 40rpx;
+      margin-bottom: 18rpx;
+    }
+    .desc {
+      display: flex;
+      font-size: 28rpx;
+      font-weight: 400;
+      color: #4a4a4a;
+      line-height: 40rpx;
+      .desc-title {
+        flex-shrink: 1;
+      }
+      .desc-content {
+        flex: 1;
+        display: -webkit-box;
+        -webkit-line-clamp: 2; /* 显示的行数 */
+        -webkit-box-orient: vertical;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: normal;
+      }
+    }
+    .bottom {
+      display: flex;
+      justify-content: space-between;
+      margin-top: 40rpx;
+      font-size: 22rpx;
+      font-weight: 400;
+      color: #7a7a7a;
+      line-height: 30rpx;
+    }
+  }
+}
+.search {
+  width: 100%;
+  ::v-deep {
+    .uni-searchbar {
+      width: 100%;
+      .uni-searchbar__box {
+        border: 1px solid #ccc;
+      }
+    }
+  }
+}
+.selectRow {
+  display: flex;
+  height: 40px;
+  flex-direction: row;
+  justify-content: center;
+  align-items: center;
+}
+
+.selectCol {
+  width: 200rpx;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.pickerSlot {
+  width: 100%;
+  height: 36px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.itemText {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  text-align: center;
+}
+
+.triangle {
+  margin: 0;
+  padding: 0;
+  margin-left: 3px;
+  width: 25rpx;
+  margin-left: 5rpx;
+}
+</style>

+ 36 - 21
pages/index/index.vue

@@ -1,25 +1,30 @@
 <template>
-<view class="page">
-  <view class="content">
-    <view class="group">
-      <button class="button" v-if="true" @click="onHandleClick(0)">
-        <uni-icons type="list" size="35" />
-        <view>项目列表</view>
-      </button>
-      <button class="button" v-if="true" @click="onHandleClick(1)">
-        <uni-icons type="checkmarkempty" size="35" />
-        <view>项目审核</view>
-      </button>
-      <button class="button" v-if="true" @click="onHandleClick(2)">
-        <uni-icons type="calendar" size="35" />
-        <view>工时上报</view>
-      </button>
-      <button class="button" v-if="true" @click="onHandleClick(3)">
-        <uni-icons type="auth" size="35" />
-        <view>工时审批</view>
-      </button>
-    </view>
-  </view></view>
+  <view class="page">
+    <view class="content">
+      <view class="group">
+        <button class="button" v-if="true" @click="onHandleClick(0)">
+          <uni-icons type="list" size="35" />
+          <view>项目列表</view>
+        </button>
+        <button class="button" v-if="true" @click="onHandleClick(1)">
+          <uni-icons type="checkmarkempty" size="35" />
+          <view>项目审核</view>
+        </button>
+        <button class="button" v-if="true" @click="onHandleClick(2)">
+          <uni-icons type="calendar" size="35" />
+          <view>工时上报</view>
+        </button>
+        <button class="button" v-if="true" @click="onHandleClick(3)">
+          <uni-icons type="auth" size="35" />
+          <view>工时审批</view>
+        </button>
+        <button class="button" v-if="true" @click="onHandleClick(4)">
+          <uni-icons type="calendar" size="35" />
+          <view>项目日志</view>
+        </button>
+        <view class="button empty"></view>
+      </view> </view
+  ></view>
 </template>
 
 <script>
@@ -67,6 +72,11 @@ export default {
             url: "../WorkingHours/audit",
           });
           break;
+        case 4:
+          uni.navigateTo({
+            url: "../daily/daily",
+          });
+          break;
       }
     },
     async getCurrentUser() {
@@ -83,6 +93,7 @@ export default {
   display: flex;
   justify-content: center;
 }
+
 .group {
   width: 90%;
   padding: 5%;
@@ -97,5 +108,9 @@ export default {
   margin: 5%;
   height: 280rpx;
   font-size: 32rpx;
+  &.empty {
+    visibility: hidden;
+    height: 0px;
+  }
 }
 </style>

+ 1 - 1
pages/login/login.vue

@@ -130,11 +130,11 @@ export default {
       const res = await queryDep({
         userName: this.username,
       });
-      this.depId = null;
       this.depList = res.data.map((item) => ({
         label: item.Name,
         value: item.ID,
       }));
+      this.depId = this.depList[0].value + "";
     },
   },
 };

+ 11 - 0
services/daily.js

@@ -0,0 +1,11 @@
+import request from "./request";
+
+export async function queryDaily() {
+  return await request("v2/approval/log-own/list", "GET");
+}
+export async function queryProjectList() {
+  return await request("v2/workload/project", "GET");
+}
+export async function createDaily(data) {
+  return await request("v2/approval/log", "POST", data);
+}

+ 2 - 1
services/request.js

@@ -55,7 +55,8 @@ function request(url, option, data = {}, noLoading) {
   if (typeof option == "object" && option.host) {
     fullUrl = option.host + url;
   } else {
-    fullUrl = host + "/api/" + url;
+    // fullUrl = host + "/api/" + url;
+    fullUrl = "/api/" + url;
   }
   var option = {
     url: fullUrl,

BIN
static/btn-bg.png


BIN
static/triangle@2x.png


+ 1 - 1
utils/listMixin.js

@@ -12,7 +12,7 @@ export default {
   methods: {
     initData() {
       var pagination = this.pagination;
-      return this.getProject({
+      return this.getList({
         ...this.projectFilter,
         pageSize: pagination.pageSize,
         currentPage: pagination.currentPage,