<template> <div> <el-dialog v-dialogDrag title="备注" :visible.sync="remarkVisible" width="60%" @close="handleCloseMessage" destroy-on-close :modal-append-to-body="false" v-if="remarkVisible"> <el-row style="margin-top:3vh"> <c-col :span="24"> <el-form ref="modelForm" :model="model" :rules="polrules"> <el-form-item label="备注信息:" prop="routxt" style="width: 100%"> <c-input v-model="model.routxt" :rows="4" maxlength="60" show-word-limit type="textarea" placeholder="请输入备注信息"></c-input> </el-form-item> <el-form-item label="历史备注:" prop="historyRemark" style="width: 100%;white-space: pre-line;"> <c-input v-model="model.historyRemark" :rows="10" :disabled="true" type="textarea" ></c-input> </el-form-item> </el-form> </c-col> </el-row> <div align="center" v-if="!isSubmitView"> <span slot="footer"> <el-button type="primary" @click="submit">提 交</el-button> <el-button @click="close" style="padding-left:10px;">退 出</el-button> </span> </div> </el-dialog> </div> </template> <script> import Api from "~/service/Api"; import moment from 'moment'; export default { props: { visible: { type: Boolean, default: false }, model: { type: Object, default: () => {} }, }, data() { return { remarkVisible: false, polrules:{}, onceShowDialog: true }; }, watch: { 'model.trnInfo' () { this.initShowRemarkDialog() } }, mounted() { this.initShowRemarkDialog() }, computed: { isSubmitView () { return this.$route.query.businessType === 'TRN' }, }, methods: { async init() { if(this.model.trnInfo && this.model.trnInfo.oreList){ this.loadHistoryRemark(this.model.trnInfo.oreList); } this.remarkVisible = true; }, initShowRemarkDialog() { this.$nextTick(() => { if (this.$route.path.startsWith("/review") && this.model.trnInfo && this.model.trnInfo.oreList && this.model.trnInfo.oreList.length > 0) { let oreShowList = this.model.trnInfo.oreList.filter((item) => { return "-MAN-".indexOf(item.typ)>0; }); if (this.onceShowDialog && oreShowList && oreShowList.length>0) { this.onceShowDialog = false this.init(); } } }) }, handleCloseMessage() { this.$emit("handleCloseRemark"); }, submit(){ // if(this.model.spt && this.model.spt.inr && this.$route.query.businessType==='SPT'){ // this.addRemarkSptinr(); // }else if(this.model.trnInfo && this.model.trnInfo.trninr && this.$route.query.businessType==='TRN'){ // this.addRemarkTrninr(); // }else{ if(!this.model.routxt){ this.$message.error("请输入备注信息!"); return; } if(!this.model.trnInfo){ this.model.trnInfo={}; } if(!this.model.trnInfo.oreList){ this.model.trnInfo.oreList=[]; } this.model.begdattim= moment(new Date()).format("YYYY-MM-DD HH:mm:ss"); let array1=[]; let array2=this.model.trnInfo.oreList; array1.push({ begdattim:this.model.begdattim, step:"保函经办", typ:"ADD", usr:window.sessionStorage.userName, remark:this.model.routxt, routxt:this.model.routxt }) this.model.trnInfo.oreList=array1.concat(array2); this.$message.success("保存成功!"); this.model.routxt=""; this.close(); // } }, // async getOreListSptinr() { // let params = { // sptinr: this.model.spt.inr // }; // const res = await Api.post("/public/quesel/getAllOreList", params); // if (res.respCode === SUCCESS) { // this.loadHistoryRemark(res.data); // } // }, // async getOreListTrninr() { // let params = { // trninr: this.model.trnInfo.trninr // }; // const res = await Api.post("/public/quesel/getAllOreList", params); // if (res.respCode === SUCCESS) { // this.loadHistoryRemark(res.data); // } // }, // async addRemarkSptinr() { // //增加备注信息 // let params = { // sptinr: this.model.spt.inr, // remark:this.model.routxt // }; // const res = await Api.post("/public/quesel/addOreRemark", params); // if (res.respCode === SUCCESS) { // this.$message.success("保存成功!"); // this.close(); // } else { // this.$message.error(res.respMsg); // } // }, // async addRemarkTrninr() { // //增加备注信息 // let params = { // trninr: this.model.trnInfo.trninr, // remark:this.model.routxt // }; // const res = await Api.post("/public/quesel/addOreRemark", params); // if (res.respCode === SUCCESS) { // this.$message.success("保存成功!"); // this.close(); // } else { // this.$message.error(res.respMsg); // } // }, close() { this.remarkVisible = false; }, loadHistoryRemark(oreArray){ let historyRemark =""; for(let i=0;i<oreArray.length;i++){ if("-SRN-TRN-BRK-SRK-CMB-CMT-".indexOf(oreArray[i].typ)>0 || (oreArray[i].routxt && !oreArray[i].routxt.trim())){ continue; } let routxt=oreArray[i].routxt?oreArray[i].routxt:""; // let status=oreArray[i].taskStatus?oreArray[i].taskStatus:oreArray[i].etyextkey; // if(!status || (status && status.trim()==="")) // status="保函经办"; if(i===0){ historyRemark=oreArray[i].begdattim+"\n"+oreArray[i].usr +":"+ routxt; }else{ historyRemark=historyRemark+"\n"+oreArray[i].begdattim+"\n"+oreArray[i].usr +":"+routxt; } } this.model.historyRemark=historyRemark; this.remarkVisible=true; }, }, }; </script> <style scoped lang="less"> </style>