basic-message-form.vue 16.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
<template>
	 <div class="container resource basic-message contaNEW">
      <div class="pop-banner clearfix">
        <!-- <div class="operate-btns">
    </div> -->
        <h3 class="current-module">消息平台</h3>
      </div>
      <!-- start-->
      <div class="fr">
        <form class="search-bar mb-20  mt-15" active="###">
          <input type="text" placeholder="输入关键词" v-model="search1.search_LIKE_SupplierName">
          <div class="search-btn">
            <input type="button" @click="getSupplyRelation">
          </div>
        </form>
        <div class="basic-message-root">
     <!--      <div class="min-search">
            <input class="min-search-txt" type="text" v-model="search1.search_LIKE_SupplierName">
            <button class="min-search-btn" @click="getSupplyRelation"></button>
          </div> -->
          <div class="bmr-result">
            <div class="bmr-result-top clearfix">
              <em>共选择
                <i>{{checkSupplier.length}}</i> 家供应商</em>
              <div class="checkbox-control fr">
                <input type="checkbox" name="cb" id="cb1" v-model="selAllCheck">
                <label class="checkbox" for="cb1">全选</label>
              </div>
            </div>
            <div class="root-node bmr-result-list bd-none" style="max-height: 600px;">
              <template v-for="(indexI,supplyRelation) in supplyRelationList">
                <div class="list-node checkbox-control checkbox-bold"  @click="activeIClick(indexI)">
                  <span class="node-btn" v-if="activeI[indexI]"></span>
                  <span class="node-btn1" v-else></span>
                 <!--  <input type="checkbox" name="cb" value="{{supplyRelation.distrbGUID}}" id="{{supplyRelation.distrbGUID}}"
                  v-model="checkDisList[index]"> -->
                  <label class="label" for="{{supplyRelation.distrbGUID}}">
                    <span>{{ supplyRelation.distrbName }}</span>
                  </label>
                </div>
                <div class="list-show checkbox-control" v-show="activeI[indexI]" style='margin-left:43px;width:80%;'> <!-- v-model="checkSupplier[indexI][indexJ]"> -->
                  <template v-for="(indexJ,supplierName) in supplyRelation.supplierNameList">
                    <input type="checkbox" name="cb" value="{{ supplyRelation.supplierGUIDList[indexJ] }}"
                        id="{{supplyRelation.supplierNameList[indexJ]}}" v-model="checkSupplier">
                    <label class="checkbox" for="{{supplyRelation.supplierNameList[indexJ]}}">{{ supplierName }}</label>
                  </template>
                </div>
              </template>
            </div>
          </div>
        </div>
       </div>
      <div class="basic-message-form">
        <div class="basic-message-tit has-button clearfix" style="height: 65px;">
          <button class="btn button-green mt-15" v-if="'/hospital/message:sendMsg' | myqx this.$route.params.id!=0" disabled="disabled">发 送</button>
          <button class="btn button-green mt-15" @click="sendMsg" v-else>发 送</button>
        </div>
        <div class="pd-form clearfix">
          <div class="form-group form-label">
            <label for="cn1" class="label">标题</label>
            <div class="control form-required">
              <input type="text" id="cn1" maxlength="10" v-rule v-model="msg.messagetitle" v-bind:readonly="readonly" class="inp2">
              <div class="form-tips-info">提示:标题字数不能超过10个汉字</div>
            </div>
          </div>
          <div class="form-group form-label">
            <label class="label" for='cn2'>消息内容</label>
            <div class="control form-required">
              <textarea id="cn10" rows="2" maxlength="20" v-rule v-model="msg.messagecontent" v-bind:readonly="readonly" class="inp4"></textarea>
              <div class="form-tips-info">提示:内容字数不能超过20个汉字</div>
            </div>
          </div>
        </div>
        <div class="basic-message-tit clearfix">
          <h3>消息发送方式</h3>
        </div>
        <div class="pd-form clearfix">
          <div class="group-row">
            <div class="form-group w220">
              <label for="cn1" class="label w110">接收站内通知</label>
              <div class="radio-control">
                <input type="radio" id="radio01" name="radioio" value="Y" v-model="msg.isinstation" v-bind:disabled="disabled">
                <label class="radio" for="radio01"></label>
                <input type="radio" name="radioio" value="N" v-model="msg.isinstation" id="radio02" v-bind:disabled="disabled">
                <label class="radio" for="radio02"></label>
              </div>
            </div>
            <div class="form-group fl ml-30 w220">
              <label class="label">接收邮件通知</label>
              <div class="radio-control">
                <input type="radio" id="radio03" name="radioio1" value="Y" v-model="msg.isemail" v-bind:disabled="disabled">
                <label class="radio" for="radio03"></label>
                <input type="radio" name="radioio1" value="N" v-model="msg.isemail" id="radio04" v-bind:disabled="disabled">
                <label class="radio" for="radio04"></label>
              </div>
            </div>
          </div>
          <div class="group-row">
            <div class="form-group w220">
              <label for="cn2" class="label w110">接收短信通知</label>
              <div class="radio-control">
                <input type="radio" id="radio05" name="radioio2" value="Y" v-model="msg.issms" v-bind:disabled="disabled">
                <label class="radio" for="radio05"></label>
                <input type="radio" name="radioio2" value="N" v-model="msg.issms" id="radio06" v-bind:disabled="disabled">
                <label class="radio" for="radio06"></label>
              </div>
            </div>
            <div class="form-group fl ml-30 w220">
              <label class="label">接收APP通知</label>
              <div class="radio-control">
                <input type="radio" id="radio07" name="radioio3" value="Y" v-model="msg.isapp" v-bind:disabled="disabled">
                <label class="radio" for="radio07"></label>
                <input type="radio" name="radioio3" value="N" v-model="msg.isapp" id="radio08" v-bind:disabled="disabled">
                <label class="radio" for="radio08"></label>
              </div>
            </div>
          </div>
          <div class="group-row">
            <div class="form-group w220">
              <label for="cn3" class="label w110">接收微信通知</label>
              <div class="radio-control">
                <input type="radio" id="radio09" name="radioio4" value="Y" v-model="msg.iswebchat" v-bind:disabled="disabled">
                <label class="radio" for="radio09"></label>
                <input type="radio" name="radioio4" value="N" v-model="msg.iswebchat" id="radio010" v-bind:disabled="disabled">
                <label class="radio" for="radio010"></label>
              </div>
            </div>
          </div>
        </div>
        <div class="info-send-type" v-if="msg.guid!=null">
          <span class="fl">发送人:{{msg.sender}}</span>
          <span>发送时间:{{msg.sendtime}}</span>
          <span class="fr">发送状态:已发</span>
        </div>
        <div class="basic-message-tit clearfix">
          <h3>消息接收对象</h3>
          <span class=" fr text-color-red" href="javascript:;"> 消息发送异常查看</span>
        </div>
        <div class="epi-form">
          <div class="group-row">
            <div class="form-group form-label">
              <label for="cn3" class="label fl">供应商</label>
              <div class="control ml-0 w300">
                <input type="text" id="cn3" maxlength="20" v-rule v-model="search2.search_LIKE_chinesename" @blur="getReceivedMsg(true)" class="inp3">
              </div>
            </div>
            <div class="form-group form-label w260">
              <label for="cn4" class="label fl" style="width:4em;">人员</label>
              <div class="control w260 ml-0">
                <input type="text" id="cn4" maxlength="8" v-rule v-model="search2.search_LIKE_receiver" @blur="getReceivedMsg(true)" class="inp2">
              </div>
            </div>
          </div>
        </div>
        <table class="itable itable-thead-13px">
          <thead>
            <tr>
              <th class="w50">序号</th>
              <th class="w70">接收者</th>
              <th class="w80">站内到达</th>
              <th class="w80">短信到达</th>
              <th class="w80">微信到达</th>
              <th class="w80">APP到达</th>
              <th class="w80">邮件到达</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="m in msgReceivedList">
              <td>{{$index+1}}</td>
              <td>{{m.receiver}}<br/>{{m.chinesename}}</td>
              <td>{{m.instationreceived | instationreceived}}
                <br/>{{m.instationreceivedtime}}
              </td>
              <td> {{m.smsreceived | smsreceived}}
                <br/>{{m.smsreceivedtime}}
              </td>
              <td>{{m.webchatreceived | webchatreceived}}
                <br/>{{m.webchatreceivedtime}}
              </td>
              <td>{{m.appreceived | appreceived}}
                <br/>{{m.appreceivedtime}}
              </td>
              <td>{{m.emailreceived | emailreceived}}
                <br/>{{m.emailreceivedtime}}
              </td>
            </tr>
          </tbody>
        </table>
        <div class="pagination m-20-0">
          <em class="page">明细条目数【{{ search2.total }}】</em>
          <pagination
           @page-change="getData"
           :class="['m-20-0']"
           :page-no.sync="search2.page"
           :total-pages.sync="search2.totalPages"></pagination>
          <em>共{{search2.totalPages}}页</em>
        </div>
      </div>
      <!-- end-->
    </div>
</template>
<script>
module.exports={
  data: function(){
    return {
      msgList: [],
      checkIdList:[],
      msg:{},
      search: {
        pageSize: 50,
        page: 1,
        totalPages: 0,
        total:0
      },
      iCount: [],                   //外层记录内层数量
      activeI :[],                  //外层显示
      supplyRelationList :[],
      medguid:'',
      checkDisList:[],
      checkSupplier:[],
      selAllCheck:false,
      search1:{
        search_EQ_medguid:'',
        search_LIKE_SupplierName:''
      },
      checkedSupplier:0,
      search2:{
        pageSize: 5,
        page: 1,
        totalPages: 0,
        total:0,
        search_EQ_guid:'',
        search_LIKE_chinesename:'',
        search_LIKE_receiver:''
      },
      msgReceivedList:[],
      msgVO:{
        trmessagenotification:{},
        chinesename:'',
        supplierguids:[],
        // id:''
      },

      // 11-16 王永刚判断bug 修改
      readonly:false,
      disabled:false,
    };
  },
  methods: {
    getData: function(){
      var self = this;
      if(this.$route.params.id != 0 ){
        Ajax.get('/message/msgDetail/'+this.$route.params.id)
        .then(function (response){
          var data = response.data.data;
          self.$set('msg',data);
          self.getReceivedMsg();
          self.$set('readonly',true);
          self.$set('disabled',true);
        });
      } else {
          self.$set('msg',{});
          self.loadPage();
          self.$set('readonly',false);
          self.$set('disabled',false);
      }
    },
    loadPage:function(){
      this.$set('msg.isinstation','Y');
      this.$set('msg.isemail','Y');
      this.$set('msg.issms','Y');
      this.$set('msg.isapp','Y');
      this.$set('msg.iswebchat','Y');
    },
    //外层显示控制
    activeIClick: function(indexI){
      this.$set('activeI['+indexI+']',!this.activeI[indexI]);
    },
    // 通过医院GUID查询供应关系
    getSupplyRelation: function(){
        var self = this;
        self.supplyRelationList=[];
        // alert(this.$store.state.user.curUser.medguid);
        this.search1.search_EQ_medguid = this.$store.state.user.curUser.medguid;
        Ajax.get('/message/listSupplyRelation',this.search1)
          .then(function (response){
          var data = response.data;
          if(data.errorCode == 0){
             var supplyRelationListTemp = {};
             // supplyRelationListTemp.distrbGUID=[];
            for(var i=0;i<data.data.length;i++){
              // supplyRelationListTemp.distrbGUID = data.data[i].DistrbGUID;
              supplyRelationListTemp.distrbName = data.data[i].DistrbName==null?"直供":data.data[i].DistrbName;
              // supplyRelationListTemp.distrbGUID = data.data[i].DistrbName==null?"直供":data.data[i].DistrbName;
              supplyRelationListTemp.supplierNameList = data.data[i].SupplierName.split(",");
              supplyRelationListTemp.supplierGUIDList = data.data[i].SupplierGUID.split(",");
              // supplyRelationListTemp.distrbGUID.push(false);
              self.checkDisList.push(false);
              self.activeI.push(true);

              self.supplyRelationList.push(supplyRelationListTemp);
            }
          }else{
            // alert(data.message);
          }
        })
    },
    //发送消息
    sendMsg:function(){

        var self=this;
        if(self.msg.messagetitle==""||self.msg.messagetitle==null){
          layer.msg('标题不能为空!');
          return;
        };
        if(self.msg.messagecontent==""||self.msg.messagecontent==null){
          layer.msg('消息内容不能为空!');
          return;
        };
        if(this.checkSupplier.length==0){
          layer.msg('请选择您要发送的供应商!');
          return;
        }
        self.receiveMessage();
        this.msg.dept = self.$store.state.user.curUser.hdeptguid;
        this.msg.sender=self.$store.state.user.curUser.realname;
        this.msgVO.trmessagenotification=this.msg;
        Ajax.post('/message/sendMsg',this.msgVO)
        .then(function (response){
             var data=response.data;
             if(data.errorCode==0){
                layer.msg('发送成功!');
                self.$route.router.go('/basicMessage');
            }else{
                layer.msg('发送失败!');
            }
        });
    },
    //接收短信
    receiveMessage:function(){
      var self=this;
      self.msgVO.supplierguids=[];
      for(var a=0;a<self.checkSupplier.length;a++){
        self.msgVO.supplierguids.push(self.checkSupplier[a]);
      }
      // var guids="";
      // var ids="";
      // for(var i=0;i<this.checkSupplier.length;i++){
      //   if(i==(this.checkSupplier.length-1)){
      //     guids+=this.checkSupplier[i];
      //   }else{
      //     guids+=this.checkSupplier[i]+"@@";
      //   }
      // }
      // ids = this.msg.isinstation+"@@"+this.msg.isemail+"@@"+this.msg.issms+"@@"+this.msg.isapp+"@@"+this.msg.iswebchat;
      // this.msgVO.supplierguids=guids;
      // this.msgVO.id=ids;
    },
      //接收消息对象
    getReceivedMsg:function(isfresh){
      var self = this;
      if (isfresh) {
         self.search.page = 1;
      }
      self.search2.search_EQ_guid = this.msg.guid;
      Ajax.get('/message/msgReceivedInfo',self.search2)
         .then(function (response){
          var data = response.data.data;
          self.$set('msgReceivedList',data.list);
          self.search2.totalPages = data.totalPages;
          self.search2.total = data.total;
        });
    },
  },
  route:{
    activate : function(){
      this.getData();
      this.getSupplyRelation();
      this.getReceivedMsg();
    }
  },
  watch:{
        'selAllCheck':function(){
        var self=this;
        var supplierGUIDList=self.supplyRelationList[0].supplierGUIDList;

        if(self.selAllCheck){
          for(var a=0;a<supplierGUIDList.length;a++){
            self.checkSupplier.push(supplierGUIDList[a]);
            self.checkDisList.push(true);
          }
        }else{
          self.checkSupplier=[];
          self.checkDisList=[];
        }

      }
      /*'selAll': function(val){
           if(val && this.supplyRelationList.length>0){
              this.checkDisList = [];
              this.checkSupplier = [];
              this.checkedSupplier = 0;
              for(var i=0;i<this.supplyRelationList.length;i++){
                this.checkDisList.push(this.supplyRelationList[i].distrbGUID);
                var list = [];
                for (var j = 0; j < this.supplyRelationList[i].supplierNameList.length; j++) {
                  list.push(this.supplyRelationList[i].supplierNameList[j]);
                  this.checkedSupplier++;
                }
                this.checkSupplier.push(list);
              }

            }else{
               this.checkDisList=[];
               this.checkSupplier = [];
               this.checkedSupplier = 0;
            }
        }*/
  }
};
</script>