<template>
  <div class="eibs-tab">
    <c-col :span="12">
      <el-form-item label="通讯情况"> </el-form-item>
    </c-col>

    <c-col :span="22" :offset="1">
      <c-istream-table-docpan :list="stmData.data" :columns="stmData.columns">
        <el-table-column label="CF000537">
          <template slot-scope="scope">
            <c-select
              v-model="model.trnmod.trndoc.doceot[scope.row.index].cortyp"
              style="width: 100%"
              disabled
              placeholder="请选择"
            >
              <el-option
                v-for="item in codes.doceotCortyp"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </c-select>
          </template>
        </el-table-column>
        <el-table-column label="报文格式">
          <template slot-scope="scope">
            <c-select
              v-model="model.trnmod.trndoc.doceot[scope.row.index].docsnf"
              style="width: 100%"
              placeholder="请选择"
            >
              <el-option
                v-for="item in codes.docsnf"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </c-select>
          </template>
        </el-table-column>
        <el-table-column label="语言" width="150%">
          <template slot-scope="scope">
            <c-select
              v-model="model.trnmod.trndoc.doceot[scope.row.index].docuil"
              style="width: 100%"
              placeholder="请选择"
            >
              <el-option
                v-for="item in codes.uiltxt"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </c-select>
          </template>
        </el-table-column>
        <el-table-column label="CF000540">
          <template slot-scope="scope">
            <c-select
              v-model="model.trnmod.trndoc.doceot[scope.row.index].apf"
              disabled
              style="width: 100%"
              placeholder="请选择"
            >
              <el-option
                v-for="item in codes.apftxt"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </c-select>
          </template>
        </el-table-column>
        <el-table-column label="正本" width="65%">
          <template slot-scope="scope">
            <c-input
              v-model="model.trnmod.trndoc.doceot[scope.row.index].apfcpy1"
              :readonly="true"
              style="width: 100%"
              placeholder="请选择"
            >
            </c-input>
          </template>
        </el-table-column>
        <el-table-column label="抄送" width="65%">
          <template slot-scope="scope">
            <c-input
              v-model="model.trnmod.trndoc.doceot[scope.row.index].apfcpy2"
              style="width: 100%"
              placeholder="请选择"
            >
            </c-input>
          </template>
        </el-table-column>
        <el-table-column label="CF001198">
          <template slot-scope="scope">
            <c-select
              v-model="model.trnmod.trndoc.doceot[scope.row.index].staflg"
              style="width: 100%"
              placeholder="请选择"
            >
              <el-option
                v-for="item in codes.swttlx"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </c-select>
          </template>
        </el-table-column>
        <el-table-column label="">
          <template slot-scope="scope">
            <el-button
              size="mini"
              :disabled="
                model.trnmod.trndoc.doceot[scope.row.index].pandsc == 'MT799' &&
                model.didgrp.rec.elcflg == 'Y'
              "
              @click="handleDisplay(scope.row.index, scope.row)"
              >显示</el-button
            >
            <el-button
              size="mini"
              type="danger"
              @click="handleDetail(scope.row.index, scope.row)"
              >详情</el-button
            >
          </template>
        </el-table-column>
      </c-istream-table-docpan>
    </c-col>
  </div>
</template>
<script>
import Api from "~/service/Api";
import CommonProcess from "~/mixin/CommonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Ditopn/Event";

export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [CommonProcess],
  data() {
    return {
      index: 0,
      title: "",
      dialog: {
        rcv: {
          pts: {},
          ptyinftxt: {},
        },
      },
      centerDialogVisible: false,
      stmData: {
        columns: [
          //注释的已改成静态
          "role 收报人",
          "pandsc 描述",
          //"cortyp 类型",
          //"docsnf 报文格式",
          //"docuil 语言",
          //"apf 传送方式"
        ],
        data: [],
      },
    };
  },
  methods: { ...Event,
  saveDialog() {
            this.centerDialogVisible = false;
            console.log(this.model);
            this.model.trnmod.trndoc.doceot.splice(this.index, 1, this.dialog);
            let res =  Api.post(
                "ditopn/executeRule/trnmod.trndoc.doccur.butaddok",
                Utils.getRequestDataFn.call(this)
            );
            if(res.data.respCode=="AAAAAA"){
                //TODO

            }else{
                this.$notify.error({ title: '错误', message: '服务请求失败!' });
            }
        },
  },
  created: function () {},
};
</script>
<style>
</style>