Fft.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
<template>
	<div class="eibs-tab">
		<c-col c-col :span="17" style="padding-right: 20px">
			<c-col :span="24">
				<c-button @click="getInvImg" :disabled="!model.imgInvmod.imgnum || model.imgInvmod.downLoadFlg" size="small" type="primary">
								<span style="position: relative">获取影像
									<div v-if="!dis && model.imgInvmod.imgnum != '' && !model.imgInvmod.downLoadFlg" style="position:absolute; top:22px; left:-30px; color:red;">
										请点击获取影像
									</div>
								</span>
							</c-button>
							<c-button @click="ruleShow" :disabled="!model.imgInvmod.imgnum" style="margin-left:15px" size="small" type="primary">
								<span style="position: relative">刷新列表
									<div v-if="!dis && ((model.imgInvmod.imgnum != '' && model.imgInvmod.imguseList.length == 0 && model.imgInvmod.downLoadFlg) || (model.imgInvmod.uploadFlg && isUploadR)) " style="position:absolute; top:22px; left:-13px; color:red;">
										请点击刷新列表
									</div>
								</span>
							</c-button>
							<c-button @click="sendInvImg" :disabled="!elcFlg || (!isUpload || model.imgInvmod.uploadFlg)" style="margin-left:15px" size="small" type="primary">
								<span style="position: relative">上传人行
									<div v-if="!dis && elcFlg && isUpload && !model.imgInvmod.uploadFlg" style="position:absolute; top:22px; left:-6px; color:red;">
										请点上传人行
									</div>
								</span>
							</c-button>
			</c-col>
			<!-- <c-col :span="24">
			<el-form-item label="影像业务编号"  prop="imgInvmod.fftref">
            <c-fullbox>
              <c-input v-model="model.imgInvmod.fftref"  placeholder="请输入影像业务编号"></c-input>
              <template slot="footer">
                <c-button size="small" type="primary">获取</c-button>
              </template>
            </c-fullbox>
          </el-form-item>
		</c-col> -->
		</c-col>
		<c-col :span="24" style="margin-top:20px">
			<el-form ref="imgRef" :model="model" label-width="120px" label-position="right" size="small" :validate-on-rule-change="false">
				<el-table max-height="350px" style="text-align: center;" highlight-current-row :data="model.imgInvmod.imguseList" :row-class-name="tableRowClassName" @row-click="handleRowClick" :paginationShow="false" :border="true">
					<!-- <el-table-column label="影像批次号" sortable width="auto" prop="imgnum">	
				</el-table-column> -->

					<el-table-column label="影像种类" sortable min-width="130px" prop="imgflg">
						<template slot-scope="scope">
							{{getLabel(dbCodes.imgflg,scope.row.imgflg)}}
						</template>
					</el-table-column>
					<el-table-column label="有效标识" sortable min-width="110px" prop="valflg">
						<template slot-scope="scope">
							{{getLabel(dbCodes.valflg,scope.row.valflg)}}
						</template>
					</el-table-column>
					<el-table-column label="文件名" sortable min-width="120px" prop="filnam">
					</el-table-column>
					<el-table-column label="影像类型" sortable min-width="110px" prop="imgtyp">
						<template slot-scope="scope">
							<el-form-item :prop="'imgInvmod.imguseList.' + scope.$index + '.imgtyp'" label-width="0" :rules="[{required:elcFlg && !scope.row.imgtyp && scope.row.imgflg != 'JDFP', message: '必输项'}]">
								<c-select v-model="scope.row.imgtyp" :disabled="scope.row.imgflg == 'JDFP' || model.imgInvmod.uploadFlg">
									<el-option v-for="item in imgdbCode(scope.row.imgflg)" :value='item.value' :label='item.label' :key='item.value'></el-option>
								</c-select>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column label="影像描述" sortable min-width="110px" prop="imgdsp">
						<template slot-scope="scope">
							<c-input v-model="scope.row.imgdsp" :disabled="model.imgInvmod.uploadFlg"></c-input>
						</template>
					</el-table-column>
					<el-table-column label="发送人行状态" sortable min-width="140px" prop="sndsta">
						<template slot-scope="scope">
							{{getLabel(dbCodeList,scope.row.sndsta)}}
						</template>
					</el-table-column>
					<el-table-column label="影像ID" sortable min-width="200px" prop="imagid">
					</el-table-column>
					<el-table-column label="影像批次号" sortable min-width="200px" prop="imgnum"></el-table-column>

					<!-- <el-table-column label="显示在电证报文" sortable min-width="160px" prop="isbind">
					<template slot-scope="scope">
						<c-select v-model="scope.row.isbind" dbCode="isbind"></c-select>
					</template>
				</el-table-column> -->
					<!-- <el-table-column label="发送人行报文msg" sortable min-width="180px" prop="msgid">
				</el-table-column> -->
					<!-- <el-table-column label="" prop="det"  min-width="100px" fixed="right">
						<template slot-scope="scope" slot="header">
							<c-button circle  class="el-icon-plus" size="mini" @click="addRow(scope)">
							</c-button>
							<c-button  circle class="el-icon-minus" size="mini" @click="removeRow(scope)">
							</c-button>
						</template>
					</el-table-column> -->
				</el-table>
			</el-form>

		</c-col>
		<c-col :span="24" style="margin-top:20px" v-if="'BPTINV_BFTINV_BDTINV_BDTDCK_BFTDRV_DITAME'.includes(root.trnName.toUpperCase())">
			<span>历史影像信息</span>
		</c-col>
		<c-col :span="24" style="margin-top:20px" v-if="'BPTINV_BFTINV_BDTINV_BDTDCK_BFTDRV_DITAME'.includes(root.trnName.toUpperCase())">
			<el-table max-height="300px" style="text-align: center;" stripe :data="model.imgInvmod.oldImguseList" :paginationShow="false" :border="true">
				<!-- <el-table-column label="影像批次号" sortable min-width="100px" prop="imgnum">	
				</el-table-column> -->
				<el-table-column label="影像种类" sortable min-width="130px" prop="imgflg">
					<template slot-scope="scope">
						{{getLabel(dbCodes.imgflg,scope.row.imgflg)}}
					</template>
				</el-table-column>
				<el-table-column label="有效标识" sortable min-width="110px" prop="valflg">
					<template slot-scope="scope">
						<c-select v-model="scope.row.valflg" dbCode="vldflg"></c-select>
					</template>
				</el-table-column>
				<el-table-column label="文件名" sortable min-width="120px" prop="filnam">
				</el-table-column>
				<el-table-column label="影像类型" sortable min-width="110px" prop="imgtyp">
					<template slot-scope="scope">
						{{getLabel(imgdbCode,scope.row.imgtyp)}}
					</template>
				</el-table-column>
				<el-table-column label="影像描述" sortable min-width="110px" prop="imgdsp">
				</el-table-column>

				<el-table-column label="发送人行状态" sortable min-width="140px" prop="sndsta">
					<template slot-scope="scope">
						{{getLabel(dbCodeList,scope.row.sndsta)}}
					</template>
				</el-table-column>
				<el-table-column label="影像ID" sortable min-width="200px" prop="imagid">
				</el-table-column>
			</el-table>
		</c-col>
	</div>
</template>
<script>
import event from "../event";

export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [event],
  data() {
    return {
      imgCurrentZcinvlstIndex: -1,
      imgtypList1: [
        { label: "合同影像ID", value: "CTID" },
        { label: "贸易背景审查ID", value: "TRID" },
        { label: "开证申请书影像ID", value: "LCID" },
        { label: "其他影像ID", value: "OTID" }
      ],
      imgtypList2: [
        { label: "货物收据ID", value: "GRID" },
        { label: "出库单ID", value: "OSID" },
        { label: "装箱单ID", value: "LBID" },
        { label: "入库单ID", value: "WHID" },
        { label: "运输单ID", value: "THID" },
        { label: "保险单ID", value: "ISID" },
        { label: "其他单据影像ID", value: "OTID" }
      ],
      dbCodes: {
        imgflg: [],
        valflg: [],
        imgtyp: []
      },
      dbCodeList: [
        { label: "未上传", value: "W" },
        { label: "上传成功", value: "Y" },
        { label: "上传失败", value: "N" }
      ]
    };
  },
  mounted() {
    this.getdbCode("imgflg", "imgflg");
    this.getdbCode("vldflg", "valflg");
  },
  methods: {
    addRow(row) {
      let newRow = {
        // imgnum:'',
        imagid: "",
        valflg: "",
        imgflg: this.imgflgList,
        imgtyp: "",
        imgdsp: "",
        filnam: "",
        isbind: "",
        sndsta: "",
        msgid: ""
      };
      let start = 0;
      if (this.model.imgInvmod.imguseList) {
        start = this.model.imgInvmod.imguseList.length;
      }
      this.model.imgInvmod.imguseList.splice(start, 0, newRow);
    },
    removeRow() {
      if (this.imgCurrentZcinvlstIndex === -1) {
        this.$notify.error({
          title: "错误",
          message: "请选择一条数据删除!"
        });
        return;
      }
      this.model.imgInvmod.imguseList.splice(this.imgCurrentZcinvlstIndex, 1);
      this.imgCurrentZcinvlstIndex = -1;
    },
    handleRowClick(row) {
      this.imgCurrentZcinvlstIndex = row.index;
    },
    tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex;
    }
  },
  watch: {
    "model.imgInvmod.imgnum": {
      handler(val, oldval) {
        if (oldval != '' && val != oldval) {
          this.model.imgInvmod.downLoadFlg = false;
          this.model.imgInvmod.uploadFlg = false;
        }
        //影像解绑的时候重新更新列表
        if (val == "") {
          this.model.imgInvmod.imguseList = [];
        } else {
          if (val != oldval && oldval != "") {
            let list = val.split("\n");
            let oldList = oldval.split("\n");
            if (list.length < oldList.length) {
              let lotnum = "";
              oldList.forEach(item => {
                if (!list.includes(item)) {
                  lotnum = item;
                }
              });
              if (this.model.imgInvmod.imguseList.length != 0) {
                let newList = [];
                this.model.imgInvmod.imguseList.forEach(i => {
                  if (i.imgnum == lotnum) {
                    newList.splice(newList.length, 0, i);
                  }
                });
                this.model.imgInvmod.imguseList = newList;
              }
            }
          }
        }
      }
    },
  },
  computed: {
		elcFlg(){
			switch (this.root.trnName.toUpperCase()) {
				case "DITOPN":
				case "DITAME":
				case "DITDCK":
				case "BDTDCK":
				case "BDTINV":
					if (this.model.didgrp.rec.elcflg == "Y") {
						console.log('true')
						return true;
					} else {
						console.log('false')
						return false;
					}
					break;
				case "BFTSND":
				case "BFTDRV":
				case "BFTINV":
					if (this.model.dedgrp.rec.elcflg == "Y") {
						console.log('true')
						return true;
					} else {
						console.log('false')
						return false;
					}
					break;
				default:
					return false;
			}
		},
		
    imgdbCode() {
      return function(val) {
        switch (val) {
          case "FFHT":
            return this.imgtypList1;
            break;
          case "JDDJ":
            return this.imgtypList2;
            break;
          default:
            return [];
        }
      };
		},
		dis(){
			return this.$store.state.Status.mode === "display"
		},
    isUploadR() {
      let list = this.model.imgInvmod.imguseList;
      if (list.length == 0) {
        return false;
      }
      let flg = list.some(item => {
        return item.imagid == null;
      });
      return flg;
		},
		isUpload(){
			let list = this.model.imgInvmod.imguseList
			if(list.length == 0){
				return false
			}else{
				let flg = list.some(item =>{
					return item.sndsta != 'Y'
				})
				if(flg){
					return true
				}else{
					return false
				}
			}
		}
  },
  created() {}
};
</script>
<style>
</style>