ReviewWrapper.vue 11.5 KB
Newer Older
fukai committed
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
<template>
  <div class="m-review"  :class="{ 'm-review-no-error': notShowError }">
    <div class="m-review-main">
      <div  class="m-review-content" style="width: 50%;position: relative;">
        <!-- <businessContainer ref="business"></businessContainer> -->
				<div class="main-content-wrap">
					<slot></slot>
				</div>
				<div  v-if="isShowReviewText" class="m-review-action">
					<el-button
						v-if="isShowHandlerBtnGroup"
						type="primary"
						size="small"
						@click="handleClickPass"
						:loading="$store.state.Status.loading.pass"
						>复核</el-button
					>
					<el-button
						v-if="isShowHandlerBtnGroup"
						size="small"
						@click="handleClickRefuse"
						:loading="$store.state.Status.loading.refuse"
						>退回</el-button
					>
					<el-button size="small" @click="goBack">退出</el-button>
				</div>
      </div>
      <div class="m-review-control" v-if="isShowReviewText" >
        <div class="remark-display" @click="isHided = !isHided">
          <i class="el-icon-d-arrow-right" v-show="!isHided"></i>
          <i class="el-icon-d-arrow-left" v-show="isHided"></i>
        </div>
        <div v-show="!isHided" style="height: 100%; flex: 1; width: 200px; margin-right: 10px">
          <el-tabs v-model="activeName" class="m-review-tab">
            <el-tab-pane label="复核意见" v-if="isShowHandlerBtnGroup" name="remark">
              <div class="m-review-control-detail">
                <el-input
                  v-model="remark"
                  type="textarea"
                  :maxlength="150"
									:rows="20"
                  show-word-limit
                  :autosize="false"									
                ></el-input>
              </div>
            </el-tab-pane>
            <el-tab-pane  name="history">
              <template #label>
                 <span>历史复核意见 </span>
                 <i class="iconfont el-icon-edit-outline" @click="editRemark" v-if="isShowEditRemark"></i>
              </template>
              <c-content class="m-review-control-detail" style="height: 100%">
                <el-timeline>
                  <el-timeline-item
                    v-for="(item, index) in historyRemark"
                    :key="index"
                    :color="index===historyRemark.length-1?'#0bbd87' : ''"
                    :timestamp="item.begdattim"
                    placement="top"
                  >
                    <div>
                       <span>{{ item.usr }}:{{ item.usrname }}</span><br/>
                      <span>{{ item.taskStatus }}: {{ item.remark || "无" }}</span>
                    </div>
                    <!-- <p>复核意见</p> -->
                  </el-timeline-item>
                </el-timeline>
              </c-content>
            </el-tab-pane>
          </el-tabs>
        </div>
      </div>
    </div>

    <el-dialog :visible.sync="isRemarkVisible" title="复核意见" v-dialogDrag width="50%">
			<!-- <div style="height: 30%;"> -->
         <el-form ref="historyForm"  :model="historyModel" :rules="remarkRule" label-width="100px" style="overflow-y: auto;overflow-x: hidden;">
				<el-row>
					<c-col :span="24">
						<el-form-item label="复核意见" prop="oldRemark" style="width: 100%">
							<el-input :rows="4" maxlength="150" show-word-limit placeholder="请输入复核意见" type="textarea" v-model="historyModel.oldRemark"></el-input>
						</el-form-item>
					</c-col>
				</el-row>
				<el-row>
					<div align="center">
						<el-button @click="submit" size="small" type="primary">确定</el-button>
						<el-button @click="closeDialog" size="small">取消</el-button>
					</div>
				</el-row>
         </el-form>
			<!-- </div> -->
		</el-dialog>
  </div>
</template>

<script>
import Api from "~/service/Api"
import operationFunc from "~/mixin/operationFunc";
export default {
	name: "ReviewWrapper",
	mixins: [operationFunc],
  data () {
    return {
      activeName: "history",
      historyRemark: [],
      notShowError: false,
      isHided: false,
      isRemarkVisible:false,
      remark: '',
      historyModel:{
        oldRemark:"",
        oldOreId:[]
      },
      remarkRule: {
          // oldRemark: [{ required: true, message: "必填", trigger: "blur" }],
      },
    };
  },
  computed: {
		isShowHandlerBtnGroup () {
			return this.$route.query.type !== 'view'
    },
    isShowReviewText () {
			return this.$route.query.type !== 'sptview'
    },
    isShowEditRemark () {
      let departmentNumber =JSON.parse(window.sessionStorage.currentOrg).departmentNumber ;
      let isExsitOwnRemark=false;
      if(this.historyRemark && this.historyRemark.length>0){
        let userName=window.sessionStorage.userName;
        for(let i=0;i<this.historyRemark.length;i++){
          if(userName===this.historyRemark[i].usr){
            isExsitOwnRemark=true;
            break;
          }
        }
      }
      if(departmentNumber==="1000" && this.$route.query.type !== 'view' && isExsitOwnRemark){
        return true;
      }
      return false;
    },
	},
  mounted () {
    this.init();
  },
  methods: {
    closeDialog(){
      this.isRemarkVisible=false;
      this.queryHistoryRemark();
    },
    async submit(){
        let params={
          oreIdList:this.historyModel.oldOreId,
          remark:this.historyModel.oldRemark
        }
        let res = await Api.post("/public/ordsel/updateOre", params);
        if (res.respCode == SUCCESS) {
            this.$notify({title: '成功', message: '修改复核意见成功!',type: 'success'});
            this.closeDialog();
        }
    },
    editRemark(){
       if(this.historyRemark && this.historyRemark.length>0){
          let userName=window.sessionStorage.userName;
          let remarkInfo="";
          for(let i=0;i<this.historyRemark.length;i++){
            if(userName===this.historyRemark[i].usr){
              if(remarkInfo && remarkInfo!==this.historyRemark[i].remark){
                 remarkInfo=remarkInfo+"\n"+this.historyRemark[i].remark;
              }else{
                 remarkInfo=this.historyRemark[i].remark;
              }
              this.historyModel.oldOreId.push(this.historyRemark[i].id);
            }
          }
          this.historyModel.oldRemark=remarkInfo;
       }else{
          this.historyModel={};
       }
       this.isRemarkVisible=true;
    },
    async init() {
      this.reset();
      this.setDisplayMode();
      this.queryHistoryRemark();
      this.remark = "";
      console.log("进入复核界面");
    },
    setDisplayMode() {
      this.$store.commit("setMode", "display");
		},
		async queryHistoryRemark () {
      if(this.$route.query.businessType!=='TRN')
        return;
			let params = {
				trninr: this.$route.query.businessInr
			}
			let res = await Api.post("/public/quesel/getAllOreList", params);
			if (res.respCode == SUCCESS) {
				this.historyRemark = res.data.filter((item) => {
          return "-COR-SIG-BEL-SOR-SPT-CMR-CIG-CEL-RIG-REL-FIN-COM-RTR-".indexOf(item.typ)>0;
        });
      }
		},
    async handleClickPass() {
       this.$confirm("你是否确定需要授权此笔交易?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then((res) => {
          if (this.$store.state.Status.loading.pass) {
            return;
          }
          this.$store.commit('setLoadingPass', true)
          let params = {
            selinr: [this.$route.query.businessInr],
            transName:"trnrel",
            remark: this.remark
          };
          this.handlePass(params)
      });
    },
    async handleClickRefuse() {
       this.$confirm("确定退回该交易?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then((res) => {
          if (this.$store.state.Status.loading.refuse) {
            return;
          }
          this.$store.commit('setLoadingRefuse', true)
          //复核意见改成非必填
          // if (this.remark.trim() == "") {
          //   this.$message.error("请填写复核意见");
          //   return;
          // }
          // 单独处理,不选择打回节点
          let params = {
            trninr: this.$route.query.businessInr,
            transName:"trnrel",
            remark: this.remark,
          };
          this.handleRefuse(params);
      });
    },
    goBack() {
      //回到待办列表
      this.$confirm("确认退出?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then((res) => {
				this.$store.commit('delTagsArry', this.$route.path)
				this.$router.back()
			})
    },
    reset() {
      this.$store.commit("setHighlightChanges", []);
      this.$store.commit("setHighlights", []);
      this.$store.commit("setMode", "normal");
      this.remark = "";
    },
  },
  beforeDestroy () {
    // 如果跳转还是 review 页面则不执行 reset 方法,因为destroy调用在下次 create 之后
    if (this.$route.path.indexOf("review") == -1) {
      console.log("review destroy ...");
      this.reset();
    }
  },
};
</script>
<style scoped lang="less">
.m-review .eContainer-func {
  display: none;
}
.m-review {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
  /* display: flex; */
  /* flex-direction: column; */
}
.m-review-main {
  display: flex;
  display: -webkit-flex;
  flex-direction: row;
  justify-content: space-around;
	height: 100%;
}
.m-review .business_container {
  position: static;
}
.m-review-content {
  height: 100%;
  flex: auto;
	.main-content-wrap {
		height: calc(100% - 50px);
	}
}
.m-review-control {
  display: flex;
  box-sizing: border-box;
  border-left: 1px solid #efefef;
  height: 100%;
  flex: initial;
}
.m-review-control .remark-display {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 5px;
  cursor: pointer;
  width: 25px;
}
.m-review-control .m-review-control-detail{
	height: 100%;
	padding: 5px 0;
}
.m-review-control-detail .el-textarea {
  height: 100%;
}
.m-review-control-detail .el-textarea textarea{
  height: 100%;
  resize: none;
}
.m-review-control .remark-display:hover {
  background-color: #dfe4e9de;
}
.m-review-control .el-tabs {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.m-review-control {
	::v-deep .el-tabs {
		.el-tabs__content {
			height: calc(100% - 40px);
			.el-tab-pane {
				height: 100%;
				overflow: auto;
			}
		}
	}
}
.m-review-control-detail ul {
  padding: 0;
}
.m-review-control-detail .el-timeline-item {
  padding-right: 20px;
}
.m-review-action {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 54px;
  background: #fff;
  z-index: 10;
	padding: 8px 20px;
	box-shadow: 0 0 11px 0 rgba(0,0,0,.1);
	display: flex;
	align-items: center;
	justify-content: center;
}
.m-review-action button,
.m-review-action .el-button + .el-button {
  margin: 0px 25px 0px 0px;
  padding: 0px 25px !important;
}
.m-review-control-warning {
  font-size: 14px;
}
.m-review .highlight-change-formitem {
  border: 1px solid #e6a23c;
}
.m-review .highlight-formitem {
  border: 1px solid red;
}

.m-review .el-form-item {
  box-sizing: border-box;
}
.m-review.m-review-no-error .el-form-item__error {
  display: none;
}
::v-deep .el-textarea__inner {
	height: 100%;
}
.m-review-content {
	.eContainer {
		/deep/ .el-form {
			height: calc(100% - 20px)!important;
		}
		// /deep/ .m-Btn-eContainer {
		// 	display: none!important;
		// }
	}
}
.iconfont{
   font-size:25px !important;
}

.m-review-tab ::v-deep .el-tabs__item{
  padding-left: 5px !important;
}
</style>