cert-complete.vue 22.6 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 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
<template>
	<div>
		<div class="container resource close-left-menu contaNEW">
    <div class="pop-banner clearfix"> 
        <div class="operate-btns">
            <a href="javascript:void(0)" @click="refreshPage();" class="fbtn fb-refresh">刷新</a>
            <a href="javascript:void(0)" @click="modifyInfo"  class="fbtn fb-modify" v-if="canEdit">修改</a>
            <a href="javascript:void(0)" style="color:#DCDCDC"  class="fbtn fb-modify" v-else >修改</a>
            <a href="javascript:void(0)" v:disabled="false" v-if="'/supplier/registerLic:modifyStateE' | myqx !canE" href="javascript:void(0)"  style="color:#DCDCDC" class="fbtn fb-dump">作废</a>
            <a href="javascript:void(0)" v-if="'/supplier/registerLic:modifyStateE' | myqx canE" @click="modifyState" class="fbtn fb-dump">作废</a>
            <a v:disabled="false" v-if="'/supplier/registerLic:saveOrUpdateYLRegistLicPO' | myqx !canSave" href="javascript:void(0)"  style="color:#DCDCDC" id="saveBtn" class="fbtn fb-save">保存</a>
            <a v-if="'/supplier/registerLic:saveOrUpdateYLRegistLicPO' | myqx canSave" @click="saveYLRegistLic();" href="javascript:void(0)" class="fbtn fb-save">保存</a>
            <a v-if="countTrs==0"  style="color:#DCDCDC" href="javascript:void(0)" class="fbtn fb-book">业务资料</a>
            <a href="javascript:void(0)" v-if="countTrs>0" v-link="{path:'/certComplete2/'+$route.params.guid}"  class="fbtn fb-book">业务资料</a>
        </div>
        <h3 class="current-module">维护医疗器械注册证</h3>
    </div>
    <div class="cert-form clearfix bd-none">
        <div class="cert-edit">
            <div class="fheader no-bottom">
                <h4 class="fh-notes">
                    注册证基本信息
                    <imagebox v-bind:imgarr="imgArry">
                      <span class="pic-max blue-search" id="bigImgs"></span>
                    </imagebox>
                </h4>
            </div>
            <div class="cf-group form-label">
                <label for="cf2" class="label multi-line t-left w150">注册证产品名称</label>
                <div class="control" style="margin-left:0px;">
                    <input type="text" id="cf2" class="text-color-blue inp7"
                    style="width:100%;" v-model="registeLic.registkeyname" class="text-color-blue" readonly="readonly">
                </div>
            </div>
     <!--        <div class="cf-group">
                <label for="cf2" class="label multi-line">注册证<br>产品名称</label>
                <div class="control">
                    <input type="text" id="cf2" readonly="readonly" v-model="registeLic.registkeyname" class="text-color-blue">
                </div>
            </div> -->
            <div class="cf-group form-label">
                <label for="cf1" class="label">注册证号</label>
                <div class="control" style="margin-left:0px;">
                    <input type="text"  id="cf1" v-model="registeLic.registkey" v-if="cs1" class="inp4" style="width:100%;">
                    <input type="text"  id="cf1" v-model="registeLic.registkey" v-if="!cs1" readonly="readonly" class="inp4" style="width:100%;">
                </div>
            </div>
 <!--            <div class="cf-group">
                <label for="cf1" class="label ">注册证号</label>
                <div class="control">
                    <input type="text"  id="cf1" v-model="registeLic.registkey" v-if="cs1">
                    <input type="text"  id="cf1" v-model="registeLic.registkey" v-if="!cs1" readonly="readonly">
                </div>
            </div> -->
            <div class="cf-group form-label">
                   <label for="cf3" class="label">生产厂商</label>
                  <div class="control" style="margin-left:0px;">
                      <input type="text" id="cf3" v-model="registeLic.producer" v-if="cs1" class="inp4" style="width:100%;">
                      <input type="text" id="cf3" v-model="registeLic.producer" v-if="!cs1" readonly="readonly" class="inp4" style="width:100%;">
                  </div>
              </div>
   <!--          <div class="cf-group">
                <label for="cf3" class="label">生产厂商</label>
                <div class="control">
                    <input type="text" id="cf3" v-model="registeLic.producer" v-if="cs1">
                    <input type="text" id="cf3" v-model="registeLic.producer" v-if="!cs1" readonly="readonly">
                </div>
            </div> -->
            <div class="cf-group">
                <label for="cf3" class="label">生产来源</label>
                <div class="control ">
                    <div class="radio-control">
                       <radio :list="importedFlag" :checked.sync="registeLic.importedflag" v-if="cs1"></radio>
                       <radio :list="importedFlag" :checked.sync="registeLic.importedflag" v-if="!cs1" disabled="disabled"></radio>
                    </div>
                </div>
            </div>
            <div class="cf-group form-label">
                <!-- <label for="cf3" class="label">有效期</label> -->
                <div class="control clearfix" style="height:34px;overflow: inherit;margin-left:0px;">
                    <div style="width:42%;float:left;">
                        <datepicker :target.sync="registeLic.begindate | getYMD" :readonly="readonlyFlag" v-if="cs1"  styleobj="width:100% !important;border-radius:8px  !important;"></datepicker>
                        <datepicker :target.sync="registeLic.begindate | getYMD" :readonly="readonlyFlag" v-if="!cs1" readonly="readonly" :disabled="true"></datepicker>
                    </div>
                    <span class="join-icon"></span>
                    <div style="width:42%;float:right;">
                        <datepicker :target.sync="registeLic.enddate | getYMD" :readonly="readonlyFlag" v-if="cs1" styleobj="width:100% !important;border-radius:8px !important;"></datepicker>
                         <datepicker :target.sync="registeLic.enddate | getYMD" :readonly="readonlyFlag" v-if="!cs1" readonly="readonly" :disabled="true"></datepicker>
                    </div>
                </div>
            </div>

            <div class="s_img_box1">
                <div class="cert-list">
                    <div class="s_img_list" v-for="up in uploads">
                        <div>
                            <img :src="up.path" />
                        </div>
                        <div class="license-btn" v-if="$index!=curModifyIndex && cs1">
                            <span class="fbtn modify-btn" title="修改" 
                            style="width:auto;padding:5px 8px;" @click="modifyPic($index)"><i>|</i></span>
                            <span class="fbtn magnify-btn" title="放大"
                            style="width:auto;padding:5px 7px;padding-left:8px;" @click="showBigImgs(up.pic)"></span>
                        </div>
                    </div>
                </div>
                 <uploads 
                  v-bind:class="['cert-list']"
                  v-if="cs2"
                  v-bind:sdguid="'-1'" 
                  v-on:file-change="fileChange" 
                  v-bind:multiple="false" 
                  v-bind:readonly="readonly">
                  <div class="cert-item"><span>选择照片</span></div>
                </uploads>
                <div class="cert-tips">照片大小&lt;1M,与原件大小比例为1:1</div>
               <!--  <div class="fr">
                  <button class="btn button-green"  @click="addNextRegistkey(registLics[0])">添加下一张注册证</button>
                </div> -->
            </div>

     <!--        <div class="cert-list">
                <div v-for="up in uploads" class="cert-item has-image" :style="{backgroundImage:'url('+up.path+')'}">
                    <uploads 
                        v-bind:class="['cert-list']"
                        v-if="$index==curModifyIndex"
                        v-bind:sdguid="''+$index" 
                        v-on:file-change="fileChange" 
                        v-bind:multiple="false" 
                        v-bind:readonly="readonly">
                        <div class="cert-item"><span>选择照片</span></div>
                    </uploads>
                    <div class="cert-item" style="background:none;"  v-if="$index!=curModifyIndex && cs1">
                      <span @click="modifyPic($index)">修改照片</span>
                    </div>
                    <div class="big-imgs" @click="showBigImgs(up.pic)" style="top:92px;left:0px;z-index: 99;">
                    </div>
                </div>

                <uploads 
                  v-bind:class="['cert-list']"
                  v-if="cs2"
                  v-bind:sdguid="'-1'" 
                  v-on:file-change="fileChange" 
                  v-bind:multiple="false" 
                  v-bind:readonly="readonly">
                  <div class="cert-item"><span>选择照片</span></div>
                </uploads>
            </div>
            <div class="cert-tips">照片大小&lt;1M,与原件大小比例为1:1</div> -->
        </div>


        <div class="pro-list w600 pl30">
            <div class="fheader no-bottom " style="padding-top:0px;" v-if="isPro">
                  <h4 class="shop-icon">关联产品信息</h4>
              </div>
            <div v-if="isPro" class="ctable pro-table">
                <div class="ct-head">
                    <span class="ct-col w130">产品名称</span>
                    <span class="ct-col w230">规格</span>
                    <span class="ct-col w110">生产厂商</span>
                    <span class="ct-col w60">生产来源</span>
                </div>
                <div class="ct-wrap" v-for="pd in productList" id="sortable">
                    <div class="ct-row hover">
                        <div class="row-line bgc-white before-none border1">
                            <span class="ct-col w130 break-it">
                                <span class="break inner">
                                    <span class="text-color-blue">{{pd.productname}}</span>
                                    <br>{{pd.registkey}}
                                </span>
                            </span>
                            <span class="ct-col w230 ">
                                <span class="break inner">{{pd.productspec}}</span>
                            </span>
                            <span class="ct-col w110 ">
                                <span class="break inner">{{pd.producer}}</span>
                            </span>
                            <span class="ct-col w60">
                                <span class="break inner">{{pd.importedflag | IMPORTEDFLAG}}</span>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="ct-wrap" v-if="productList.length==0">
                    <div class="ct-row hover ">
                        <div class="row-line bgc-white before-none bd-color-gray2">
                            <span class="ct-col  break-it " style="text-align: center;width:100%;">
                                <span class="break inner">暂无相关的产品信息!</span>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
             <div class="fheader" v-if="isPro">
                  <h4 class="shop-icon">关联商品信息</h4>
              </div>
            <div class="ctable pro-table">
                <div class="ct-head">
                    <span class="ct-col w100">商品编号</span>
                    <span class="ct-col w160">商品名称</span>
                    <span class="ct-col w70">规格</span>
                    <span class="ct-col w160">生产厂商</span>
                    <span class="ct-col w60">生产来源</span>
                </div>
                <div class="ct-wrap" v-if="goods.length==0">
                    <div class="ct-row hover ">
                        <div class="row-line bgc-white before-none bd-color-gray2">
                            <span class="ct-col  break-it " style="text-align: center;width:100%;">
                                <span class="break inner">暂无相关的商品信息!</span>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="ct-wrap" v-for="gd in goods" id="sortable">
                    <div class="ct-row hover ">
                        <div class="row-line bgc-white before-none bd-color-gray2">
                            <span class="ct-col w100 break-it ">
                                <span class="break inner">{{gd.goodscode}}</span>
                            </span>
                            <span class="ct-col w160 ">
                                <span class="break inner">{{gd.goodsname}}</span>
                            </span>
                            <span class="ct-col w70 ">
                                <span class="break inner">{{gd.goodsspec}}</span>
                            </span>
                            <span class="ct-col w160 ">
                                <span class="break inner">{{gd.producer}}</span>
                            </span>
                            <span class="ct-col w60">
                                <span class="break inner">{{gd.importedflag | IMPORTEDFLAG}}</span>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
	</div>
</template>
<script>
  
  module.exports = {
    data: function () {
      return {
            countTrs:0,
            countTr:1,
            canEdit: false,
            trVO:{
                guid:'',
                variationtype:'V04',
            },
            cs1:false,
            cs2:false,
            importedFlag: [{
                value: '2',
                label: '进口'
            }, {
                value: '1',
                label: '国产' 
            }],
            isPro: true,
            registeLic:{},
            search:{
                guids:'',
            },
            goods:[],
            searchGoods:{
                search_EQ_productguid:'',
            },
            productList:[],
            production:{},
            checkProduct:{},
            uploads:[],
            canSave:true,
            canE:true,
            //主数据商品
            mfmsdgoods:{},

            registkeyname:'',
            curModifyIndex:-1,
            imgArry:[],
            editMsg:'',
        };
    },
    methods: {
      nav: function(ispro) {
          this.isPro = ispro;
      },
      refreshPage:function(){
         this.getRegisteLic();
      },
      getRegisteLic: function () {
        var self = this;
        self.uploads=[];
        self.productList=[];
        self.goods=[];
        self.countTrs=0;
        self.countTr= 1;
        if (this.$route.params.guid != '0') {
          Ajax.get('/supplierProductLic/YLRegistLic/' + this.$route.params.guid)
            .then(function (response) {
                self.$set('registeLic', response.data.data);
                //是否有变更单
                self.existTr();
                //展示图片
                if(self.registeLic.pictcontent!=null && self.registeLic.pictcontent!=''){
                    var lics=JSON.parse(self.registeLic.pictcontent), imgReg = /\.(jpg|jpeg|png|gif|bmp)$/i; //判断字符串是否为图片路径;
                    if(lics.length>0){
                        for(var i=0;i<lics.length;i++){
                            var objPic=lics[i];
                            var path=imgReg.test(objPic.thumbnail.path) ? objPic.thumbnail.path : objPic.thumbnail.path+objPic.thumbnail.name;
                            var json='{"path":"'+path+'"}';
                            var obj=JSON.parse(json);
                            obj.pic=objPic;
                            self.uploads.push(obj);
                        }
                    }
                    if(self.uploads.length>=4){
                        self.cs2=false;
                    }
                }
                self.production.guid=self.registeLic.productguid;
                self.mfmsdgoods.productguid=self.registeLic.productguid;
                if(self.production.guid!=null){
                   self.listProductByRegistname();
                   self.listGoodsByProduct();
                }
            });
            this.canSave=false;
            this.canE=false;
            this.cs1=false;
            this.cs2=false;
         }
      },
      listProductByRegistname:function(){
         var self = this;
         self.production.productname=self.registkeyname;
         Ajax.post('/supplierProductLic/productList',self.production)
          .then(function (response) {
            var data = response.data.data;
            self.$set('productList', data);
         });
      },
      listGoodsByProduct:function(){
        var self = this;

        Ajax.get('/supplierProductLic/listGoodsByProduct',self.mfmsdgoods)
          .then(function (response) {
            var data = response.data.data;
             self.$set('goods', data);
        });
      },
      saveYLRegistLic: function () {
        var self = this;
        if(self.registeLic.begindate == null || self.registeLic.begindate == ''){
              layer.msg('请输入开始日期!');
              return
        }
        if(self.registeLic.enddate == null || self.registeLic.enddate == ''){
              layer.msg('请输入开始日期!');
              return
        } 
        if(self.uploads.length>0){
          var pics=[];
          for(var j=0;j<self.uploads.length;j++){
              pics.push(self.uploads[j].pic);
          }
          self.registeLic.pictcontent=JSON.stringify(pics);
        }else{
            layer.msg('请上传注册证!');
            return
        }
        Ajax.post('/supplierProductLic/YLRegistLic/save', self.registeLic)
          .then(function (response) {
             if(response.data.errorCode==0){
                self.MessageBox({title:'提示',message:'保存成功!',type:'alert'
                },function(action){
                     self.$route.router.go('/cert/certCompleteList');
                }); 
             }else{
                 layer.msg('保存失败!');
             }
          });
      }, 
      modifyState: function () {
        var self = this;
        var registObj={};
        registObj.guid=self.registeLic.guid;
        registObj.state='E';
        self.MessageBox({
            title: '提示',
            message: '作废此注册证后,相对应的经销授权书和产品说明书也将作废!',
            type: 'success',
            showCancelButton: true
          },function(action) {
            if(action=='confirm'){
              Ajax.get('/supplierProductLic/modifyState',registObj)
                .then(function (response) {
                   if(response.data.errorCode==0){
                      self.MessageBox({title:'提示',message:'操作成功!',type:'alert'
                      },function(action){
                           self.$route.router.go('/cert/certCompleteList');
                      }); 
                   }else{
                       layer.msg('操作失败!');
                   }
              });
            } 
          }); 
      },
      modifyPic:function(index){
          this.curModifyIndex=index;
      },
      fileChange:function(data){
        var self=this, imgReg = /\.(jpg|jpeg|png|gif|bmp)$/i; //判断字符串是否为图片路径;
        var backObj = JSON.parse(data);
        var index=backObj.sdguid;
        for(var i=0;i<backObj.data.length;i++){
          var path=imgReg.test(backObj.data[0].thumbnail.path) ? backObj.data[0].thumbnail.path : backObj.data[0].thumbnail.path+backObj.data[0].thumbnail.name;
          var json='{"path":"'+path+'"}';
          var obj=JSON.parse(json);
          obj.pic=backObj.data[i];
          if(self.curModifyIndex==index && self.curModifyIndex>=0){
            self.$set('uploads['+index+']', obj);
            self.curModifyIndex=-1;
          }else{
            self.uploads.push(obj);
          }
        }
        if(self.uploads.length>=4){
            self.cs2=false;
        }
      },
      modifyInfo:function(){
          var self = this;
          if(self.countTr>0){
              layer.msg(self.editMsg);
            return;
          }
          this.canSave = true;
          this.canE = true;
          this.cs1 = true;
          if(self.uploads.length<4){
            this.cs2 = true;
          } 
      },
      existTr:function(){
        var self=this;
        self.trVO.guid=self.registeLic.guid;
        Ajax.post('/businessData/isExistExc',self.trVO)
        .then(function(response){
            if(response.data.data==0){
                Ajax.post('/businessData/existTrvariation',{
                    guid:self.registeLic.supplierguid,
                    variationtype: self.trVO.variationtype,
                    sdguid:self.trVO.guid
                })
                    .then(function(response){
                        if(!response.data.data || response.data.data == 'R'){
                            self.countTr=0;
                            self.canEdit = true;
                        }else {
                            self.countTr=1;
                            self.countTrs=0;
                            self.canEdit = true;
                            self.editMsg='该注册证正在审核中,审核通过后请前往业务资料中修改。'
                        }
                    });
            }else {
                self.countTr=0;
                self.countTrs=1;
                self.canEdit = false;
                self.editMsg='该注册证已有变更单,您可以进入【业务资料】修改并且提交审核!'
            }

        });
      },
      showBigImgs:function(pic){
         var jsonStr='[', imgReg = /\.(jpg|jpeg|png|gif|bmp)$/i; //判断字符串是否为图片路径;
         if(pic!=null){
            var path=imgReg.test(pic.original.path) ? pic.original.path : pic.original.path+pic.original.name;
            jsonStr+='"'+path+'"';
         }
         jsonStr+=']';
         this.$set('imgArry',JSON.parse(jsonStr));
         $("#bigImgs").click();
      },
    },
    route: {
      activate: function () {
        this.getRegisteLic();
        this.goods=[];

      }
    },
    // ready:function(){

    //     $("#sortable").mCustomScrollbar({
    //     scrollbarPosition:"outside",
    //     scrollInertia:450,
    //     theme:"light-2"
    //     });
    // }
  };

</script>

<style scoped lang="sass">
.s_img_list div:nth-child(1) img {
    width: 100%;
    height: 100%;
}
</style>