gemercheung vor 2 Jahren
Ursprung
Commit
4c69757902

+ 28 - 5
src/views/room/edit-room/index.vue

@@ -2,7 +2,7 @@
   <a-config-provider :locale="getAntdLocale">
     <a-modal
       :visible="visible"
-      :title="!room ? t('room.createRoom') : t('room.editRoom')"
+      :title="isRoomEnd ? t('room.myEndRoom') : !room ? t('room.createRoom') : t('room.editRoom')"
       :after-close="onCancel"
       width="912px"
       :style="{
@@ -16,6 +16,7 @@
           {{ t('base.cancel') }}
         </a-button>
         <a-button
+           v-if="!isRoomEnd"
           class="action-bottom"
           type="primary"
           size="middle"
@@ -178,6 +179,7 @@
 
             <span
               class="user-label"
+              :class="{disabled:isRoomEnd}"
               style="margin-left: 5px"
               v-for="lab in current.userObjList"
             >
@@ -299,7 +301,7 @@ export default defineComponent({
     })
     const { getAntdLocale } = useLocale()
     const roomStore = useRoomStore()
-    const isRoomEnd = computed(() => roomStore.roomStatus === 2)
+    const isRoomEnd = computed(() => props.room?.roomStatus === 2)
     const { getLocale } = useLocale()
     const { t } = useI18n()
     const returnLocale = computed(() => {
@@ -333,6 +335,21 @@ export default defineComponent({
       if (!current.scenes.length) {
         return message.error(t('room.form.addLeastScene'))
       }
+      let breakTime = false
+      if (current.useTimeList) {
+        current.useTimeList.forEach(i => {
+          const diff = i.diff(dayjs(), 'minutes')
+          console.log('diff')
+          if (diff < 0) {
+            breakTime = true
+          }
+        })
+      }
+      if (breakTime) {
+        message.error('所选时间不能少于当前系统时间!')
+        return
+      }
+
       if (
         current.visitPassword?.length &&
         current.visitPassword.length > 0 &&
@@ -417,11 +434,11 @@ export default defineComponent({
       const select = range.map((i, index) => {
         if (i) {
           const diff = i.diff(dayjs(), 'minutes')
-         
+
           if (diff < 0) {
             // @ts-ignore
-            current.useTimeList[index] = dayjs();
-            console.log('diff', diff,index)
+            current.useTimeList[index] = dayjs()
+            console.log('diff', diff, index)
           }
         }
       })
@@ -519,7 +536,13 @@ export default defineComponent({
   background: #eee;
   padding: 5px 5px;
   font-size: 13px;
+  &.disabled{
+    pointer-events: none;
+  cursor: not-allowed;
+  opacity: 0.5;
+  }
 }
+
 </style>
 
 <style lang="scss">

+ 2 - 2
src/views/statistic/tab/tab1.vue

@@ -322,7 +322,7 @@ const initRoomVisitChart = () => {
       yAxis: [
         {
           type: 'value',
-          min: ch1Min,
+          min: 0,
           max: ch1Max,
           splitNumber: 4,
           axisTick: {
@@ -419,7 +419,7 @@ const initRoomMsgChart = () => {
       yAxis: [
         {
           type: 'value',
-          min: ch1Min,
+          min: 0,
           max: ch1Max,
           splitNumber: 4,
           axisTick: {

+ 16 - 8
src/views/statistic/tab/tab3.vue

@@ -50,9 +50,11 @@
       <div class="container">
         <a-table
           align="center"
+          :sortDirections="['descend', 'ascend']"
           :columns="columns"
           :data-source="msgList"
           :pagination="pagination"
+          :onChange="handleTableChange"
           bordered
         >
           <template #bodyCell="{ column, text }">
@@ -105,7 +107,7 @@ const formState: UnwrapRef<FormState> = reactive({
 const columns: TableColumnProps[] = [
   {
     title: t('room.form.nickname'),
-    dataIndex: 'nickName',
+    dataIndex: 'nickName'
   },
   {
     title: t('room.form.phoneNumber'),
@@ -125,12 +127,12 @@ const columns: TableColumnProps[] = [
   },
   {
     title: t('statistic.firstEnter'),
-    dataIndex: 'firstInRoomTime',
-    
+    dataIndex: 'firstInRoomTime'
   },
   {
     title: t('statistic.departure'),
     dataIndex: 'lastOutRoomTime',
+    sorter: true
   },
   {
     title: t('statistic.amount'),
@@ -140,7 +142,7 @@ const columns: TableColumnProps[] = [
   {
     title: t('statistic.message'),
     dataIndex: 'texts',
-    ellipsis:true,
+    ellipsis: true
   }
 ]
 
@@ -170,8 +172,8 @@ const fetchList = () => {
       // startTime: formState.userTime?.length ? formState.userTime[0] : '',
       // endTime: formState.userTime?.length ? formState.userTime[1] : '',
       timeList: formState.userTime
-      ? formState.userTime.map(item => item.toString())
-      : [],
+        ? formState.userTime.map(item => item.toString())
+        : [],
       roomTitle: formState.roomTitle?.length ? formState.roomTitle : ''
     })
   } catch (error) {
@@ -186,8 +188,8 @@ const exportList = () => {
       // startTime: formState.userTime?.length ? formState.userTime[0] : '',
       // endTime: formState.userTime?.length ? formState.userTime[1] : '',
       timeList: formState.userTime
-      ? formState.userTime.map(item => item.toString())
-      : [],
+        ? formState.userTime.map(item => item.toString())
+        : [],
       roomTitle: formState.roomTitle?.length ? formState.roomTitle : ''
     })
   } catch (error) {
@@ -219,6 +221,12 @@ const handleFinish = async () => {
   }
 }
 const handleFinishFailed = () => {}
+
+const handleTableChange = (pagination: any, filters: any, sorter: any) => {
+  console.log('pagination', pagination)
+  console.log('filters', filters)
+  console.log('sorter', sorter)
+}
 </script>
 <style lang="less">
 .container {