浏览代码

首页租户列表过多无法滑动问题修复

wangtao 2 天之前
父节点
当前提交
43cbc2c3d0

+ 35 - 4
src/pages/business/common/projectMange/list/index.vue

@@ -99,8 +99,11 @@
                 proxy.$common.mapping("label", "value", base.visibleRange, project_displayType)
               }}</span>
             </view>
-            <view class="content-area-row_wrap-view" style="display: block">
-              成员:<span >{{ proxy.$common.mapping("nickName", "userId", base.projectMember, userDate) }} </span>
+            <view class="content-area-row_wrap-view" style="display: block;position: relative;">
+              成员:<span :class='{ "omit": base.omit &&base.omit[0] }'>
+                      {{ base.projectMemberName }} 
+                    </span> 
+                    <uni-icons :type="base.omit[0] ? 'down' : 'up'" size="20" style="color:rgba(102, 102, 102,1)" class="omitIcon" @click="omitIconClick(base)" v-if="base.omit[0] || base.omit[1]>30"></uni-icons>
             </view>
           </view>
         </view>
@@ -276,7 +279,6 @@ function handleAction(value, event, index, ind) {
 function selectAction(e) {
   state.projectType = e.value[0].value;
   state.projectTypeName = e.value[0].label;
-  console.log(state.projectType, state.projectTypeName,e)
   state.actionShow = false;
 }
 
@@ -286,8 +288,8 @@ function selectAction(e) {
 function init() {
   dUserList().then((res) => {
     state.userDate = res.data;
+    selectListApi();
   });
-  selectListApi();
 }
 
 /**
@@ -301,6 +303,13 @@ function handleModal(type, content) {
   state.modal.content = content;
 }
 
+function omitIconClick(val){
+  for(let i=0;i<state.dataList.length;i++){
+    if(val.id == state.dataList[i].id){
+      state.dataList[i].omit[0] =!state.dataList[i].omit[0]
+    }
+  }
+}
 /** 确定按钮点击事件 */
 function handleSubmit(type, item) {
   if (type === "insert") {
@@ -366,6 +375,14 @@ function selectListApi() {
     })
     .then((requset) => {
       state.dataList = requset.data.records;
+      for(let i =0;i<state.dataList.length;i++){
+        state.dataList[i].projectMemberName = ""
+        state.dataList[i].omit = [false]
+        if(state.dataList[i].projectMember){
+          state.dataList[i].projectMemberName = proxy.$common.mapping("nickName", "userId", state.dataList[i].projectMember, state.userDate)
+          state.dataList[i].omit = [state.dataList[i].projectMemberName.length>30,state.dataList[i].projectMemberName.length]
+        }
+      }
       state.total = requset.data.total;
       state.loading = false;
     })
@@ -551,4 +568,18 @@ onLoad((options) => {});
   line-height: 20px !important;
   border-radius: 10px;
 }
+.omit{
+  width:85%;
+  display: inline-block;
+  vertical-align: middle;
+  overflow: hidden; 
+  white-space: nowrap; 
+  text-overflow: ellipsis;
+}
+.omitIcon{
+  position: absolute;
+  right:0;
+  bottom:0;
+  color:rgba(102, 102, 102,1)
+}
 </style>

+ 40 - 24
src/pages/business/common/projectMange/write/components/template1.vue

@@ -148,7 +148,7 @@
 
   <u-datetime-picker :show="timeShow" v-model="timeValue" mode="datetime" :closeOnClickOverlay="true" @cancel="timeShow = false" @confirm="timeConfirm"></u-datetime-picker>
 
-  <u-modal :show="modalShow" title="" :confirmText="'确定'" :cancelText="'取消'" :zoom="false" :showCancelButton="true" @confirm="modalConfirm" @cancel="modalShow = false">
+  <u-modal :show="modalShow" title="" :confirmText="'确定'" :cancelText="'取消'" :zoom="false" :showCancelButton="true" @confirm="modalConfirm" @cancel="modalShow = false" :picker-options="pickerOptions">
     <view class="slot-content" style="max-height: 45vh; overflow: scroll !important;">
       <view v-if="projectsList.length > 0" >
         <scroll-view scroll-y style="height: 100%; max-height: 300px;">
@@ -188,7 +188,7 @@
       </u-checkbox-group> -->
       </view>
 
-      <view v-else>请联系项目管理人员给您分配项目后重试!</view>
+      <view v-else>暂未添加项目,请点击确定前往“项目列表”,成为项目成员。</view>
     </view>
   </u-modal>
 </template>
@@ -207,6 +207,7 @@ import { systemStores } from "@/store/modules/index";
 /*----------------------------------公共方法引入-----------------------------------*/
 import { storageSystem } from "@/utils/storage"; // 公共方法引用
 import config from "@/config";
+import dayjs from "dayjs";
 /*----------------------------------公共变量-----------------------------------*/
 const { proxy } = getCurrentInstance();
 const systemStore = systemStores();
@@ -217,7 +218,6 @@ const props = defineProps({
   },
 });
 /*----------------------------------变量声明-----------------------------------*/
-
 const modal = reactive({
   timeShow: false,
   timeValue: Number(new Date()),
@@ -247,6 +247,9 @@ const reportFile1 = ref([]); //附件
 const { timeShow, timeValue, modalShow } = toRefs(modal);
 const { form, projectsCheck, projectsList, userList, userDate, saveTime } = toRefs(state);
 
+
+
+const disabledDate = (time) => time > Date.now();
 /**
  * @初始化
  */
@@ -258,8 +261,16 @@ function init() {
 
 /** 时间选择器确定按钮点击事件 */
 function timeConfirm(e) {
-  state.form.timingTime = proxy.$time.getFormatterDate(e.value);
-  modal.timeShow = false;
+  const currentTime = dayjs().unix() * 1000; //当前时间戳
+  const tomorrowZeroPoint = dayjs(dayjs().add(1, 'day').format('YYYY-MM-DD') + " 00:00:00").valueOf(); //第二日零点时间戳
+  if(e.value < tomorrowZeroPoint && e.value > currentTime){
+    state.form.timingTime = proxy.$time.getFormatterDate(e.value);
+    modal.timeShow = false;
+  }else if(e.value > tomorrowZeroPoint){
+    proxy.$modal.msg("请选择当天时间!");
+  }else if(e.value < currentTime){
+    proxy.$modal.msg("选择时间要大约当前时间!");
+  }
 }
 
 /** 开关按钮change事件 */
@@ -310,28 +321,33 @@ function realTimeSaving() {
 
 /** 弹窗确定 */
 function modalConfirm() {
-  var newWorkContents = JSON.parse(JSON.stringify(state.form.workContents));
-  state.form.workContents = [];
-
-  state.projectsCheck.forEach((e) => {
-    state.form.workContents.push({
-      projectId: e,
-      projectName: proxy.$common.mapping("projectName", "id", e, state.projectsList),
-      workTime: "",
-      workContent: "",
+  if(projectsList.value.length){
+    var newWorkContents = JSON.parse(JSON.stringify(state.form.workContents));
+    state.form.workContents = [];
+  
+    state.projectsCheck.forEach((e) => {
+      state.form.workContents.push({
+        projectId: e,
+        projectName: proxy.$common.mapping("projectName", "id", e, state.projectsList),
+        workTime: "",
+        workContent: "",
+      });
     });
-  });
-
-  newWorkContents.forEach((e) => {
-    state.form.workContents.forEach((f) => {
-      if (e.projectId == f.projectId) {
-        f.workTime = e.workTime;
-        f.workContent = e.workContent;
-      }
+  
+    newWorkContents.forEach((e) => {
+      state.form.workContents.forEach((f) => {
+        if (e.projectId == f.projectId) {
+          f.workTime = e.workTime;
+          f.workContent = e.workContent;
+        }
+      });
     });
-  });
+    modal.modalShow = false;
+  }else{
+    modal.modalShow = false;
+    proxy.$tab.redirectTo("/pages/business/common/projectMange/list/index"); 
+  }
 
-  modal.modalShow = false;
   // realTimeSaving();
 }
 

+ 13 - 13
src/pages/index.vue

@@ -94,17 +94,19 @@
       </view>
     </template>
   </oa-scroll>
-  <uni-drawer ref="showLeft" mode="left" style="height: calc(100vh - 44px); width: 90%; margin-top: 44px">
-    <view class="unit">
-      <view class="unit-title">切换企业</view>
-      <view :class="item.id == useStore.tenantId ? 'active' : ''" class="list" v-for="(item, index) in tenantIdList" :key="index" @click="changeTenantId(item.id)">
-        <image class="list-image" src="@/static/images/index/unit-active.png" v-if="item.id == useStore.tenantId"></image>
-        <image class="list-image" src="@/static/images/index/unit.png" v-if="item.id != useStore.tenantId"></image>
-        <text class="list-name">{{ item.tenantName }}</text>
-        <image class="list-right" src="@/static/images/index/right.png" v-if="item.id == useStore.tenantId"></image>
-        <!-- <text class="list-state">默认企业</text> -->
+  <uni-drawer ref="showLeft" mode="left" style="height: calc(100vh - 40px); width: 90vw; margin-top: 44px;" :disableScroll="false">
+    <scroll-view style="height: calc(100% - 4px);width:100vw;background:#0d2e59;" scroll-y="true">
+      <view class="unit">
+        <view class="unit-title">切换企业</view>
+            <view :class="item.id == useStore.tenantId ? 'active' : ''" class="list" v-for="(item, index) in tenantIdList" :key="index" @click="changeTenantId(item.id)">
+              <image class="list-image" src="@/static/images/index/unit-active.png" v-if="item.id == useStore.tenantId"></image>
+              <image class="list-image" src="@/static/images/index/unit.png" v-if="item.id != useStore.tenantId"></image>
+              <text class="list-name">{{ item.tenantName }}</text>
+              <image class="list-right" src="@/static/images/index/right.png" v-if="item.id == useStore.tenantId"></image>
+              <!-- <text class="list-state">默认企业</text> -->
+        </view>
       </view>
-    </view>
+    </scroll-view>
   </uni-drawer>
   <oa-tabbar :tabbarValue="0" :tabbarList="proxy.$constData.homeTabbar"></oa-tabbar>
 </template>
@@ -171,6 +173,7 @@ function getTenantList(id) {
   getTenantByUser(id).then((res) => {
     tenantIdList.value = res.data;
     if (storage.get("account")?.userName && storage.get("account")?.passWord) {
+      tenantIdList.value = res.data
       accountState.value = true;
     }
   });
@@ -552,9 +555,6 @@ onShow(() => {
   width: 100vw !important;
   height: 100%;
   background: #0d2e59;
-  position: fixed;
-  top: 0px;
-  left: 0%;
   &-title {
     margin: 15px 0 10px 10px;
     color: #fff;