zhouwenxuan
2023-07-27 2cb26124675883fa1e2742ae7899c9fc791ed6a2
pages/tabBar/notice/notice.vue
@@ -30,12 +30,12 @@
        </view>
      </view>
      <view class="listHead">
        <view class="switchBtn">
<!--        <view class="switchBtn">
          <u-checkbox-group>
            <u-checkbox v-model="isReadOnly" @change="chooseRead"></u-checkbox>
          </u-checkbox-group>
          <text>只显示未读</text>
        </view>
        </view> -->
        <view class="switchBtn">
          <u-switch v-model="checked" size="20" @change="clickSwitch" style="margin-right: 6px"></u-switch>
          <text>仅紧临</text>
@@ -46,11 +46,11 @@
         <view class="noticeList">
            <view class="listContent" v-if="noticeList.length > 0" >
               <view v-for="(item, index) in noticeList" :key="index" class="itemContent" >
                  <view class="content" v-if="item.isRead" >
                  <view class="content" v-if="item.isResponse" >
                        <text style="color:rgb(17, 204, 33);" @click="toDetail(item)">[已叫应]</text>
                        <text @click="toDetail(item)">[{{item.colorContent}}]</text>
                        <text @click="toDetail(item)">{{item.title}},{{item.content}}</text>
                        <view v-if="item.isRead" style="float: right; width: 80px;margin-top: 3px;">
                        <!-- <view v-if="item.isResponse" style="float: right; width: 80px;margin-top: 3px;"> -->
                           <!-- <u-button @click="toDetail(item)"v-if="item.buttonContent == '已叫应'" size="mini" style="margin-bottom: 10px;background-color:rgb(17, 204, 33);color: white;">
                              {{item.buttonContent}}
                           </u-button>
@@ -60,14 +60,14 @@
                           <u-button @click="toDetail(item)" v-else type="error" size="mini" style="margin-bottom: 10px;">
                              {{item.buttonContent}}
                           </u-button> -->
                        </view>
                        <!-- </view> -->
                  </view>
                  <view class="contentNoRead" v-else>
                        <u-badge :is-dot="true" type="error" style="position: absolute;"></u-badge>
                        <text style="color: red;margin-left:10px;" @click="toDetail(item)">[未叫应]</text>
                        <text @click="toDetail(item)">[{{item.colorContent}}]</text>
                        <text @click="toDetail(item)">{{item.title}},{{item.content}}</text>
                        <view style="float: right; width: 80px;margin-top: 3px;">
                        <!-- <view style="float: right; width: 80px;margin-top: 3px;"> -->
                           <!-- <u-button @click="toDetail(item)" v-if="item.buttonContent == '已叫应'" size="mini" style="margin-bottom: 10px;background-color:rgb(17, 204, 33);color: white;">
                              {{item.buttonContent}}
                           </u-button>
@@ -77,7 +77,7 @@
                           <u-button @click="toDetail(item)" v-else type="error" size="mini" style="margin-bottom: 10px;">
                              {{item.buttonContent}}
                           </u-button> -->
                        </view>
                        <!-- </view> -->
                  </view>
               </view>
            </view>
@@ -93,7 +93,7 @@
</template>
<script>
   import { getNotice, update } from '../../../api/notice';
   import { getNotice, update,confirm } from '../../../api/notice';
   import dia from './dialog.vue';
   import tabBar from '../tabBarIndex.vue'
   export default {
@@ -163,7 +163,8 @@
      methods: {
         getNoticeList() {
            this.noSpeak = 0;
            this.data.searchParams.readStatus = this.isReadOnly ? 0 : null;
            // this.data.searchParams.readStatus = this.isReadOnly ? 0 : null;
            this.data.searchParams.readStatus = null;
            this.data.searchParams.emergType = this.checked ? 1 : null ;
            this.data.searchParams.warningLevel =  this.selectedSaleAnalysis =='all' ? null : this.selectedSaleAnalysis =='red' ? 1 : this.selectedSaleAnalysis =='orange' ? 2: this.selectedSaleAnalysis =='yellow'? 3 : 4;
            getNotice(this.data).then(res => {
@@ -172,10 +173,10 @@
                  this.noticeListCopy = this.noticeList;
                  if (this.noticeList.length > 0) {
                     this.noticeList.forEach((item, index) => {
                        if(item.readStatus == 0){
                        if(item.responseStatus == 1){
                           this.noSpeak++;
                        }
                        this.noticeList[index].isRead = item.readStatus == 1 ? true : false;
                        this.noticeList[index].isResponse = item.responseStatus == 2 ? true : false;
                        this.noticeList[index].colorContent = item.warningLevel == 1 ? '红色预警': item.warningLevel == 2 ? '橙色预警': item.warningLevel == 3 ? '黄色预警':'蓝色预警'; 
                        this.noticeList[index].buttonContent = item.responseStatus == 1 ? '待叫应': item.responseStatus == 2 ? '已叫应' : '超时未叫应';
                     });
@@ -199,15 +200,15 @@
         toDetail(item) {
            console.log("item",item)
            //改为修改叫应状态
            if (item.readStatus === 0) {
               this.updateReadStatus(item);
            if (item.responseStatus === 1) {
               this.updateResponseStatus(item);
            }
            uni.navigateTo({
              url: `/pages/tabBar/notice/detail?data=` + encodeURIComponent(JSON.stringify(item))
            })
         },
         updateReadStatus(item) {
            update({id: item.id}).then(res => {});
         updateResponseStatus(item) {
            confirm({id: item.id}).then(res => {});
         },
         openDialog(item){
            this.$refs.showDialog.id = item.id;
@@ -305,7 +306,7 @@
  .listHead{
    display: flex;
    align-items: center;
    justify-content: space-between;
    justify-content: flex-end;
  }
}