瀏覽代碼

feat: 企业情报添加分组列表

Signed-off-by: tangshizhe <48740614+tangshizhe@users.noreply.github.com>
tangshizhe 6 月之前
父節點
當前提交
3a7fd50b48

+ 38 - 1
src/jfw/modules/app/src/web/staticres/jyapp/big-member/css/ent_follow.css

@@ -5,6 +5,10 @@
     color: #171826;
 }
 
+.ent-grouping {
+  margin-bottom: .2rem;
+}
+
 .dot-red {
     width: .16rem;
     height: .16rem;
@@ -139,4 +143,37 @@
     margin-right: .08rem;
     width: .24rem;
     height: .24rem;
-}
+}
+
+.ent-grouping .grouping-list {
+  display: flex;
+  flex-wrap: wrap;
+}
+
+.ent-grouping .grouping-list .grouping-item {
+  margin: 0 .16rem .16rem 0;
+  padding: 0 .24rem;
+  border: 0.5px solid rgba(192, 196, 204, 1);
+  border-radius: .3rem;
+  line-height: .52rem;
+}
+
+.ent-grouping .grouping-list .grouping-item.active {
+  background: #2ABED1;
+  border-color: #2ABED1;
+  color: #fff;
+}
+
+.ent-grouping .grouping-footer {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  margin-top: .04rem;
+  font-size: .28rem;
+  line-height: .4rem;
+  color: #2ABED1;
+}
+
+.ent-grouping .grouping-footer .grouping-item-name {
+  margin-right: .08rem;
+}

+ 24 - 1
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/ent_follow.js

@@ -20,13 +20,17 @@ var vNode = {
             scrollTop: 0
         },
         entFollowList: [],
-        loading: ''
+        loading: '',
+        activeNames: [],
+        groupingList: []
     },
     created: function () {
         var recover = this.recover()
         if (!recover) {
             this.getPowerInfo()
         }
+        // 获取分组列表
+        this.getGroupList()
     },
     mounted: function () {
         $(this.$refs.jList).scrollTop(this.listInfo.scrollTop)
@@ -69,6 +73,24 @@ var vNode = {
                 }
             })
         },
+        // 获取分组列表
+        getGroupList: function () {
+            var _this = this
+            $.ajax({
+                type: 'GET',
+                url: '/bigmember/follow/ent/groupList',
+                data: {
+                  type: 'get'
+                },
+                success: function (res) {
+                    if (res.error_code == 0) {
+                      _this.groupingList = res.data
+                    } else {
+                      _this.$toast(res.error_msg)
+                    }
+                }
+              })
+        },
         getEntFollowList: function () {
             var _this = this
             $.ajax({
@@ -138,6 +160,7 @@ var vNode = {
             this.listInfo.loading = true
             // 请求数据
             this.getEntFollowList()
+            
         },
         connectEnt: function (phone) {
             try {

+ 18 - 0
src/jfw/modules/app/src/web/templates/big-member/page_ent_follow.html

@@ -34,6 +34,24 @@
         <div class="j-container" v-else key="list">
             <div class="j-main" ref="jList">
                 <div>
+                    <van-collapse class="ent-grouping" v-model="activeNames">
+                      <van-collapse-item title="企业分组" name="1">
+                        <div class="grouping-list">
+                            <div class="grouping-item" :class="{'active': !item.state}" v-for="(item, index) in 10" :key="index">
+                              <span class="grouping-item-name">全部</span>
+                              <span class="grouping-item-count">10</span>
+                            </div>
+                            <div class="grouping-item" v-for="(item, index) in groupingList" :key="index">
+                                <span class="grouping-item-name">${ item.s_name }</span>
+                                <span class="grouping-item-count">${ item.i_entnum }</span>
+                            </div>
+                        </div>
+                        <div class="grouping-footer" @click="leavePage('groupManage')">
+                          <span class="grouping-item-name">分组管理</span>
+                          <van-icon color="#2ABED1" name="arrow" />
+                        </div>
+                      </van-collapse-item>
+                    </van-collapse>
                     <van-pull-refresh v-model="listInfo.refreshing" @refresh="onRefresh">
                         <van-list
                             v-model="listInfo.loading"

+ 18 - 3
src/web/staticres/common-module/mobile-portrayal-footer/css/mobile-portrayal-grouping.css

@@ -29,14 +29,23 @@
   padding: .2rem 0;
   border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
 }
+.mobile-portrayal-grouping .grouping-list .van-checkbox .van-checkbox__label {
+  width: 5.94rem;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
 
 .mobile-portrayal-grouping .add-grouping-dialog .van-dialog__content {
   padding: 0;
   margin: .32rem 0 .44rem 0;
 }
-.mobile-portrayal-grouping .add-grouping-dialog .van-cell .van-cell__value {
-  display: flex;
-  justify-content: space-between;
+.mobile-portrayal-grouping .add-grouping-dialog .van-cell {
+  padding: 0;
+}
+.mobile-portrayal-grouping .add-grouping-dialog .van-cell .van-field__body {
+  padding-bottom: .22rem;
+  border-bottom: 0.5px solid rgba(0, 0, 0, 0.05);
 }
 .mobile-portrayal-grouping .add-grouping-dialog .van-field__control::placeholder {
   color: #9B9CA3;
@@ -48,4 +57,10 @@
 }
 .mobile-portrayal-grouping .add-grouping-dialog .van-field__word-limit .van-field__word-num {
   color: #2ABED1;
+}
+.mobile-portrayal-grouping .add-grouping-dialog .van-field__error-message {
+  margin-top: .16rem;
+  font-size: .28rem;
+  color: #FB483D;
+  line-height: .4rem;
 }

+ 29 - 5
src/web/staticres/common-module/mobile-portrayal-footer/js/mobile-portrayal-grouping.js

@@ -11,7 +11,7 @@ var mobilePortrayalGrouping = `
         <span class="add-grouping-text">新增分组</span>
       </div>
       <div class="grouping-list">
-        <van-checkbox-group v-model="groupingResult">
+        <van-checkbox-group v-model="groupingResult" @change="handleGroupChange">
           <van-checkbox checked-color="#2ABED1" name="0">默认分组 a</van-checkbox>
           <van-checkbox checked-color="#2ABED1" :name="index" v-for="(item, index) in 15">复选框 {{item}}</van-checkbox>
         </van-checkbox-group>
@@ -24,11 +24,12 @@ var mobilePortrayalGrouping = `
       @confirm="addGrouping"
       show-cancel-button>
       <van-field 
-        v-model="groupingName" 
+        v-model="groupingName"
         show-word-limit 
         maxlength="15"
-        error-message="分组名称已存在"
+        :error-message="errorMessageText"
         placeholder="请输入分组名称"
+        @input="setGroupingName"
       ></van-field>
     </van-dialog>
   </div>
@@ -52,9 +53,11 @@ var mobilePortrayalGroupingScript = {
   },
   data () {
     return {
-      groupingResult: [],
+      groupingResult: ['0'],
       groupingName: '',
-      showAddGroupingDialog: false
+      showAddGroupingDialog: false,
+      errorMessageText: '',
+      isUpdating: false // 标志位,避免死循环
     }
   },
   methods: {
@@ -64,6 +67,27 @@ var mobilePortrayalGroupingScript = {
     addGrouping () {
       // 添加分组确定事件
       this.showAddGroupingDialog = false
+    },
+    setGroupingName (val) {
+      this.groupingName = val.trim().replace(/\s+/g, '')
+    },
+    handleGroupChange (checked) {
+      if (this.isUpdating) {
+        // 如果正在更新,直接返回,避免递归调用
+        return;
+      }
+      this.isUpdating = true; // 设置标志位
+
+      if (checked.indexOf('0') > 0) {
+        // 如果选择了默认分组,清空其他分组的选择
+        this.groupingResult = ['0'];
+      } else {
+        // 如果选择了其他分组,移除默认分组的选择
+        this.groupingResult = this.groupingResult.filter(item => item !== '0');
+      }
+      this.$nextTick(() => {
+        this.isUpdating = false; // 更新完成后重置标志位
+      });
     }
   }
 }