<!-- 委员会全部资料上传 -->
<template>
  <div class="autoBox box1" style="position: relative; background: #f5f5f5">
    <div class="center" style="display: flex; background: #fff; height: 50px">
      <el-breadcrumb
        separator="/"
        style="
          float: left;
          margin-left: 15px;
          margin-top: 5px;
          line-height: 40px;
        "
      >
        <el-breadcrumb-item :to="{ path: 'nationalregionalCommittees' }">{{
          $t("common.committeeInformation")
        }}</el-breadcrumb-item>
        <el-breadcrumb-item
          ><span style="font-weight: 700; cursor: pointer; color: #303133">{{
            $t("common.upload")
          }}</span></el-breadcrumb-item
        >
      </el-breadcrumb>
    </div>

    <div
      class="content"
      style="background: #fff; margin-top: 20px; padding: 50px 100px"
    >
      <!--<div class="addEn" style="height: 50px">
        <span class="english">中文</span>
        <span
          @click="addlanguage()"
          style="margin-left: 20px; cursor: pointer; margin-top: 10px"
        >
          +
        </span>
      </div>-->
      <!-- <div class="addLanguage">
        <i
          class="el-icon-orange"
          style="
            font-size: 30px;
            line-height: 50px;
            color: #e6a23c;
            vertical-align: middle;
          "
        ></i>
        <span
          style="
            font-size: 18px;
            line-height: 50px;
            margin-left: 20px;
            vertical-align: middle;
          "
          >{{ $t("common.resourceLanguageVersion") }}</span
        >
        <i
          class="el-icon-plus"
          style="
            font-size: 30px;
            font-weight: 900;
            margin-left: 20px;
            line-height: 50px;
            color: #e6a23c;
            vertical-align: middle;
          "
          @click="addTabDialog(languageTabsValue)"
        ></i>
      </div> -->

      <div class="uploadForm">
        <el-form
          :model="ruleForm"
          ref="ruleForm"
          label-width="300px"
          class="demo-ruleForm"
          label-position="right"
        >
          <el-form-item :label="$t('common.approvalTitle')" prop="title">
            <el-input
              clearable
              style="width: 50%"
              v-model="ruleForm.title"
              :placeholder="$t('common.inputTitle')"
            ></el-input>
            <el-button
              @click="search"
              type="primary"
              style="margin-left: 20px; width: 91px"
              >{{ $t("common.search") }}</el-button
            >
            <div>
              <span>{{ $t("common.titleText") }}</span>
            </div>
          </el-form-item>
          <el-form-item
            prop="committee"
          >
            <span slot="label"><span style="color: red;padding-right: 3px;">*</span>{{$t('common.affiliatedCommittee')}}</span>
            <el-select
              clearable
              style="width: 50%"
              v-model="ruleForm.committee"
              :placeholder="$t('common.NoSelected')"
            >
              <el-option
                v-for="item in nationalCommitteeList"
                :key="item.label"
                :label="$i18n.locale === 'en' ? item.label2 : item.label"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
<!--          <el-form-item :label="$t('common.cover')" prop="region">-->
<!--            &lt;!&ndash; action="/api/nationregioncomittee-service/nrc/nrcMaterialStorehouses/uploadMeanImg" &ndash;&gt;-->
<!--            &lt;!&ndash; action="/api/file/upload/img?module=BaseResearchResultInfoForm&attachmentBusinessType=base_research_result_info_cover" &ndash;&gt;-->
<!--            <el-upload-->
<!--              class="upload-demo"-->
<!--              action="/api/nationregioncomittee-service/nrc/nrcMaterialStorehouses/uploadMeanImg"-->
<!--              :on-remove="handleRemove2"-->
<!--              :before-remove="beforeRemove2"-->
<!--              :before-upload="beforeUpload2"-->
<!--              :on-success="handleAvatarSuccessAnnex2"-->
<!--              multiple-->
<!--              :on-exceed="handleExceed2"-->
<!--              :file-list="fileList2"-->
<!--              :limit="1"-->
<!--            >-->
<!--              <el-button icon="el-icon-upload">{{-->
<!--                $t("common.selectUpload")-->
<!--              }}</el-button>-->
<!--              <span style="margin-left: 20px">{{-->
<!--                $t("common.selectUploadText")-->
<!--              }}</span>-->
<!--            </el-upload>-->
<!--          </el-form-item>-->
<!--          <el-form-item  prop="name">-->
<!--            <span slot="label"><span style="color: red;padding-right: 3px;">*</span>{{$t('common.name')}}</span>-->
<!--            <el-input-->
<!--              clearable-->
<!--              style="width: 50%"-->
<!--              v-model="ruleForm.name"-->
<!--              :placeholder="$t('common.inputName')"-->
<!--            ></el-input>-->
<!--          </el-form-item>-->

<!--          <el-form-item prop="committee">-->
<!--            <span slot="label"><span style="color: red;padding-right: 3px;">*</span>{{$t('common.country')}}</span>-->
<!--            <el-select-->
<!--              filterable-->
<!--              clearable-->
<!--              style="width: 24%"-->
<!--              v-model="ruleForm.national"-->
<!--              :placeholder="$t('common.NoSelected')"-->
<!--            >-->
<!--              <el-option-->
<!--                v-for="item in nationList"-->
<!--                :key="item.id"-->
<!--                :label="$i18n.locale === 'zh' ? item.label : item.countryNameEn"-->
<!--                :value="item.countryIsoCode"-->
<!--              >-->
<!--              </el-option>-->
<!--            </el-select>-->
<!--            <el-select-->
<!--              filterable-->
<!--              clearable-->
<!--              style="width: 24%; margin-left: 2%"-->
<!--              v-model="ruleForm.city"-->
<!--              :placeholder="$t('common.NoSelected')"-->
<!--            >-->
<!--              <el-option-->
<!--                v-for="item in cityList"-->
<!--                :key="item.id"-->
<!--                :label="$i18n.locale === 'zh' ? item.cityName : item.cityNameEn"-->
<!--                :value="item.cityIsoCode"-->
<!--              >-->
<!--              </el-option>-->
<!--&lt;!&ndash;              <el-pagination&ndash;&gt;-->
<!--&lt;!&ndash;                type="index"&ndash;&gt;-->
<!--&lt;!&ndash;                background&ndash;&gt;-->
<!--&lt;!&ndash;                layout="prev, pager, next"&ndash;&gt;-->
<!--&lt;!&ndash;                :page-size="10"&ndash;&gt;-->
<!--&lt;!&ndash;                :total="total - 0"&ndash;&gt;-->
<!--&lt;!&ndash;                @current-change="handleCurrentChange"&ndash;&gt;-->
<!--&lt;!&ndash;              ></el-pagination>&ndash;&gt;-->
<!--            </el-select>-->
<!--          </el-form-item>-->

<!--          <el-form-item :label="$t('common.contacts')" prop="contacts">-->
<!--            <el-input-->
<!--              clearable-->
<!--              style="width: 50%"-->
<!--              v-model="ruleForm.contacts"-->
<!--              :placeholder="$t('common.inputContact')"-->
<!--            ></el-input>-->
<!--          </el-form-item>-->

<!--          <el-form-item :label="$t('common.mail')" prop="mail">-->
<!--            <el-input-->
<!--              clearable-->
<!--              style="width: 50%"-->
<!--              v-model="ruleForm.email"-->
<!--              :placeholder="$t('common.inputEmail')"-->
<!--            ></el-input>-->
<!--          </el-form-item>-->

          <el-form-item prop="desc">
            <span slot="label"><span style="color: red;padding-right: 3px;">*</span>{{$t('common.abstract')}}</span>
            <el-input
              clearable
              :placeholder="$t('common.pleaseInput')"
              style="width: 50%; resize: none"
              maxlength="500"
              show-word-limit
              :autosize="{ minRows: 7, maxRows: 8 }"
              type="textarea"
              v-model="ruleForm.desc"
            ></el-input>
          </el-form-item>

          <el-form-item prop="region">
            <span slot="label"><span style="color: red;padding-right: 3px;">*</span>{{$t('common.cover')}}</span>
            <el-upload
              class="upload-demo"
              action="/api/nationregioncomittee-service/nrc/nrcMaterialStorehouses/uploadMeanImg"
              :on-remove="handleRemove"
              :before-remove="beforeRemove"
              :before-upload="beforeUpload"
              :on-success="handleAvatarSuccessAnnex"
              multiple
              :on-exceed="handleExceed"
              :file-list="fileList"
              :limit="1"
            >
              <el-button icon="el-icon-upload" style="float: left;">{{
                $t("common.selectUpload")
              }}</el-button>
              <span style="margin-left: 20px;display: inline-block;max-width: 72%;text-align: left;line-height: 20px;">{{
                $t("common.selectUploadText")
              }}</span>
            </el-upload>
          </el-form-item>

          <el-form-item prop="region">
            <span slot="label"><span style="color: red;padding-right: 3px;">*</span>{{$t('common.enclosure')}}</span>
            <el-upload
              class="upload-demo"
              action="/api/nationregioncomittee-service/nrc/nrcMaterialStorehouses/uploadEnclosurePDF"
              :on-remove="handleRemove1"
              :before-remove="beforeRemove1"
              :before-upload="beforeUpload1"
              :on-success="handleAvatarSuccessAnnex1"
              multiple
              :on-exceed="handleExceed1"
              :file-list="fileList1"
            >
              <el-button icon="el-icon-upload">{{
                $t("common.selectUpload")
              }}</el-button>
              <span style="margin-left: 20px;">{{
                $t("common.attachmentText")
              }}</span>
            </el-upload>
          </el-form-item>

          <el-form-item>
            <el-button
              style="width: 120px"
              type="primary"
              @click="submitForm('ruleForm')"
              >{{ $t("common.release") }}</el-button
            >
            <el-button
              style="width: 120px; margin-left: 20px"
              @click="resetForm('ruleForm')"
              >{{ $t("common.cancel") }}</el-button
            >
          </el-form-item>
        </el-form>
      </div>

      <!-- 添加英文dialog -->
      <el-dialog
        class="languages"
        title="添加语言"
        :visible.sync="dialogFormVisible2"
      >
        <el-form :model="form1" style="padding-left: 30%">
          <el-form-item label="语言" style="margin-left: 14px">
            <el-select
              multiple
              v-model="form1.language"
              placeholder="请选择"
              style="width: 415px"
            >
              <el-option
                style="width: 515px; margin-left: 10px"
                v-for="item in language"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="翻译" style="margin-left: 14px">
            <el-radio-group v-model="form1.language_flag">
              <el-radio :label="1">是</el-radio>
              <el-radio :label="0">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item style="margin-top: 50px; margin-left: 100px">
            <el-button type="primary" @click="submit_lange">保存</el-button>
            <el-button @click="cancel_lange">关闭</el-button>
          </el-form-item>
        </el-form>
      </el-dialog>
      <!-- 查询标题dialog -->
      <el-dialog
        title="查询标题"
        :title="$i18n.locale === 'zh' ? '请选择' : 'Please Select'"
        :visible.sync="titleDialogVisible"
        width="40%"
        :before-close="dialogBeforeClose"
      >
        <div>
          <el-table
            :highlight-current-row="true"
            :cell-style="{ textAlign: 'center' }"
            :header-cell-style="{ textAlign: 'center' }"
            border
            :data="titleList"
            style="width: 100%"
          >
            <el-table-column prop="title" :label="$i18n.locale === 'zh' ? '标题' : 'Title'" width="width">
            </el-table-column>
            <el-table-column prop="createDate" :label="$i18n.locale === 'zh' ? '创建时间' : 'Create Time'"  width="width">
            </el-table-column>
            <el-table-column :label="$i18n.locale === 'zh' ? '操作' : 'Operation'" width="width">
              <template slot-scope="scope">
                <el-button
                  type="text"
                  size="mini"
                  style="display: block; margin-left: 43%"
                  @click="choose(scope.row)"
                >
                  <span>{{ $i18n.locale == 'en' ? 'Select ' : '选择' }}</span>
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-dialog>
    </div>
  </div>
</template>
<script>
import {
  getNationalCommittee,
  country,
  city,
  uploadCommissionData,
  getThroughTitleTheApplication,
} from "@/api/committee/committeeWorkSpace";
export default {
  name: "UploadCommitteeInformation",
  data() {
    return {
      ruleForm: {
        title: "",
        committee: "",
        national: "",
        city: "",
        name: "",
        contacts: "",
        email: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      },
      selectCity:undefined,
      nationalCommitteeList: [],
      nationalCommitteeListFull: [],
      nationList: [],
      cityList: [],
      cityList1: [{ cityName: "南京", cityNameEn: "NanJing",cityIsoCode:"ALB",id:"3123123123123123" }],

      fileList: [],
      fileList1: [],
      fileList2: [],
      total: "",
      pageNo: "",
      coverAddress: "",
      directoryAddress: "",
      attachmentAddress: "",
      dialogFormVisible2: false,
      filename:[],
      form1: {
        language: "", //总部流转
        language_flag: 0, //办理人
      },
      language: [
        {
          label: "英文",
          value: "1",
        },
      ],
      titleDialogVisible: false,
      titleList: [],
      titleId: "",
      uploadInformation: {
        id: 0,
        abstractInfo: "",
        attachmentPath: "",
        belongCommittee: "",
        city: "",
        contact: "",
        coverPath: "",
        createBy: "",
        createDate: "",
        mail: "",
        menuPath: "",
        name: "",
        nation: "",
        reserveFive: "",
        reserveFour: "",
        reserveOne: "",
        reserveThree: "",
        reserveTwo: "",
        title: "",
        titleFirstWord: "",
        updateBy: "",
        updateDate: "",
        uploadPeople: "",
        uploadTime: "",
      },

      //   rules: {
      //     name: [
      //       { required: true, message: "请输入活动名称", trigger: "blur" },
      //       { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
      //     ],
      //     region: [
      //       { required: true, message: "请选择活动区域", trigger: "change" },
      //     ],
      //     date1: [
      //       {
      //         type: "date",
      //         required: true,
      //         message: "请选择日期",
      //         trigger: "change",
      //       },
      //     ],
      //     date2: [
      //       {
      //         type: "date",
      //         required: true,
      //         message: "请选择时间",
      //         trigger: "change",
      //       },
      //     ],
      //     type: [
      //       {
      //         type: "array",
      //         required: true,
      //         message: "请至少选择一个活动性质",
      //         trigger: "change",
      //       },
      //     ],
      //     resource: [
      //       { required: true, message: "请选择活动资源", trigger: "change" },
      //     ],
      //     desc: [{ required: true, message: "请填写活动形式", trigger: "blur" }],
      //   },
    };
  },
  watch: {
    "$i18n.locale"() {
      this.getNational();
      this.getNationalCommitteeList();
    },
    selectCity(val) {
      this.$refs.pagination.filter(val);
    },
    "ruleForm.national": {
      handler() {
        console.log(1111);
        this.getCity();
        if (this.ruleForm.national === "") {
          this.ruleForm.city = "";
        }
      },
      deep: true,
    },
  },
  mounted() {
    this.initData();
  },
  destroyed() {},
  methods: {
    initData() {
      this.getNationalCommitteeList();
      this.getNational();
    },
    // 上传  获取国家委员会
    getNationalCommitteeList() {
      this.nationalCommitteeList = [];
      getNationalCommittee().then((res) => {
        var data = res.data;
        if (data) {
          this.nationalCommitteeListFull = data;
          if(this.$i18n.locale == "en"){
            for(let i=0;i<this.nationalCommitteeListFull.length;i++){
              if(this.nationalCommitteeListFull[i].label2!="" && this.nationalCommitteeListFull[i].label2!=null && this.nationalCommitteeListFull[i].label2!=undefined){
                this.nationalCommitteeList.push(this.nationalCommitteeListFull[i]);
              }
            }
          }else {
            this.nationalCommitteeList = this.nationalCommitteeListFull;
          }
        }
      });
    },
    // 搜索
    search() {
      this.getTitle();
    },
    // 获取通过申请的标题
    getTitle() {
      let title = this.ruleForm.title;
      if (this.ruleForm.title === "") {
          if(this.$i18n.locale == 'en'){
              this.$message({
                  message: "The title cannot be empty",
                  type: "warning",
              });
          }else {
              this.$message({
                  message: "标题不能为空",
                  type: "warning",
              });
          }
      } else {
        let id = this.titleId;
        getThroughTitleTheApplication(title)
          .then((res) => {
            console.log(res);
            if (res.status == "200") {
              this.titleList = res.data;
              this.titleDialogVisible = true;
            }
          })
          .catch((error) => {
            this.$message({
              message: `${error.msg}`,
              type: "warning",
            });
          });
      }
    },
    // 获取国家
    getNational() {

      country().then((res) => {
        let nationListTemp = res.data.baseCountryInformationDicts;
        let allNames = new Array();
        let allIds = new Array();
        for (let i = 0; i < nationListTemp.length; i++) {
          if(allNames.indexOf(nationListTemp[i].countryName)==-1){
            allNames.push(nationListTemp[i].countryName)
            allIds.push(nationListTemp[i].id)
          }
        }

        for (let i = 0; i < nationListTemp.length; i++) {
          if(allIds.indexOf(nationListTemp[i].id)>0){
            this.nationList.push(nationListTemp[i]);
          }
        }

        // console.log(this.nationList);
      });
    },
    // 获取城市
    getCity() {
      var params = this.ruleForm.national;
      var query = this.pageNo ? this.pageNo : "1";
      city(params).then((res) => {
        this.cityList = res.data.baseCityInformationDicts
          ? res.data.baseCityInformationDicts
          : [];
        // this.total = res.data.page.totalCount;
      });
    },

    choose(data) {
      console.log(data);
      this.fileList = [];
      this.directoryAddress = '';
      this.fileList1 = [];
      this.attachmentAddress = '';
      this.ruleForm.title = data.title;
      this.ruleForm.committee = data.belongCommitteeName;
      this.ruleForm.desc = data.abstractInfo;
      if (data.files) {
        data.files.forEach((item) => {
          if (item.type == "2") {
            let obj = {};
            obj.name = item.fileNameDisplay;
            obj.url = item.filePath;
            obj.type = item.type;
            this.fileList.push(obj);
            this.directoryAddress = item.filePath;
          }
          if (item.type == "5") {
            let obj = {};
            obj.name = item.fileNameDisplay;
            obj.url = item.filePath;
            obj.type = item.type;
            this.fileList1.push(obj);
            this.attachmentAddress = item.filePath;
          }
        });
      }
      this.titleId = data.id;
      this.titleDialogVisible = false;
    },
    handleCurrentChange(val) {
      this.pageNo = val;
      this.getCity();
    },
    dialogBeforeClose() {
      this.titleDialogVisible = false;
    },
    // 上传相关  封面
    handleRemove2(file, fileList) {
      console.log(file, fileList);
      this.filename.forEach((item, index) => {
        if (file.name == item.fileNameDisplay) {
          this.filename.splice(index, 1);
        }
      });
      console.log(this.filename);
    },

    beforeRemove2(file, fileList) {
      if (this.$i18n.locale == "zh") {
        return this.$confirm(`确定移除 ${file.name}？`);
      }else {
        return this.$confirm(`Sure to remove ${file.name}？`);
      }
    },
    beforeUpload2(file) {
      var FileExt = file.name.replace(/.+\./, "");
      // , "doc", "docx", "excel", "xls", "xlsx"
      if (["jpg", "png"].indexOf(FileExt.toLowerCase()) === -1) {
        if (this.$i18n.locale == "zh") {
          this.$message({
            type: "warning",
            message: "请上传jpg,png的文件！",
          });
        } else {
          this.$message({
            type: "warning",
            message: "Please upload JPG, PNG files!",
          });
        }
        this.fileList2.splice(this.fileList2.indexOf(file), 1);
        abort();
        return false;
      }
      this.isLt2k = file.size / 1024 / 1024 < 10 ? "1" : "0";
      if (this.isLt2k === "0") {
        if (this.$i18n.locale.toUpperCase() == "ZH") {
          this.$message({
            message: "上传文件大小不能超过10M!",
            type: "error",
          });
        } else {
          this.$message({
            message: "Upload file size cannot exceed 10m!",
            type: "error",
          });
        }
        this.fileList2.splice(this.fileList2.indexOf(file), 1);
        abort();
        return false;
      }
    },

    handleAvatarSuccessAnnex2(res, file) {
      this.coverAddress = res.data.filePath;
      // console.log(res.data.filePath)
      let obj = {};
      obj.fileNameDisplay = file.name;
      obj.filePath = res.data.filePath;
      obj.type = 2;
      this.filename.push(obj);
      console.log(this.filename);
    },
    handleExceed2(files, fileList) {
      if (this.$i18n.locale == "zh") {
        this.$message.warning(`当前限制选择 1 个文件。`);
      } else {
        this.$message.warning(`The current limit is to select 1 file.`);
      }
    },

    // 上传相关  目录
    handleRemove(file, fileList) {
      console.log(file, fileList);
      this.filename.forEach((item, index) => {
        if (file.name == item.fileNameDisplay) {
          this.filename.splice(index, 1);
        }
      });
      console.log(this.filename);
    },

    beforeRemove(file, fileList) {
      if (this.$i18n.locale == "zh") {
        return this.$confirm(`确定移除 ${file.name}？`);
      }else {
        return this.$confirm(`Sure to remove ${file.name}？`);
      }

    },
    beforeUpload(file) {
      var FileExt = file.name.replace(/.+\./, "");
      // , "doc", "docx", "excel", "xls", "xlsx"
      if (["jpg", "png"].indexOf(FileExt.toLowerCase()) === -1) {
        if (this.$i18n.locale == "zh") {
          this.$message({
            type: "warning",
            message: "请上传jpg,png的文件！",
          });
        } else {
          this.$message({
            type: "warning",
            message: "Please upload JPG, PNG files!",
          });
        }
        this.fileList.splice(this.fileList.indexOf(file), 1);
        abort();
        return false;
      }
      this.isLt2k = file.size / 1024 / 1024 < 10 ? "1" : "0";
      if (this.isLt2k === "0") {
        if (this.$i18n.locale.toUpperCase() == "ZH") {
          this.$message({
            message: "上传文件大小不能超过10M!",
            type: "error",
          });
        } else {
          this.$message({
            message: "Upload file size cannot exceed 10m!",
            type: "error",
          });
        }
        this.fileList.splice(this.fileList.indexOf(file), 1);
        abort();
        return false;
      }
    },

    handleAvatarSuccessAnnex(res, file) {
      if (res.status==500){
        if (this.$i18n.locale.toUpperCase() == 'EN') {
            this.$message.error("Upload Failed");
        }else {
            this.$message.error("上传失败");
        }
        this.fileList.splice(this.fileList.indexOf(file), 1)
        return
      }
      this.directoryAddress = res.data.filePath;
      let obj = {};
      obj.fileNameDisplay = file.name;
      obj.filePath = res.data.filePath;
      obj.type = 2;
      this.filename.push(obj);
      console.log(this.filename);
    },
    handleExceed(files, fileList) {
      if (this.$i18n.locale == "zh") {
        this.$message.warning(`当前限制选择 1 个文件。`);
      } else {
        this.$message.warning(`The current limit is to select 1 file.`);
      }
    },

    // 上传相关 附件
    handleRemove1(file, fileList) {
      console.log(file, fileList);
      this.filename.forEach((item, index) => {
        if (file.name == item.fileNameDisplay) {
          this.filename.splice(index, 1);
        }
      });
      console.log(this.filename);
    },

    beforeRemove1(file, fileList) {
      if(this.$i18n.locale == "en"){
        return this.$confirm(`Sure to remove ${file.name}？`);
      }else {
        return this.$confirm(`确定移除 ${file.name}？`);
      }
    },
    beforeUpload1(file) {
      var FileExt = file.name.replace(/.+\./, "");
      if (['pdf'].indexOf(FileExt.toLowerCase()) === -1) {
        if(this.$i18n.locale == "en"){
          this.$message({
            type: 'warning',
            message: 'Please Upload PDF File！！'
          });
        }else {
          this.$message({
            type: 'warning',
            message: '请上传pdf的文件！！'
          });
        }

        this.fileList1.splice(this.fileList1.indexOf(file), 1)
        abort();
        return false;
      }
      this.isLt2k = file.size / 1024 / 1024 < 50 ? "1" : "0";
      console.log(file.size / 1024 / 1024)
      if (this.isLt2k === "0") {
        if (this.$i18n.locale == "ZH") {
          this.$message({
            message: "上传文件大小不能超过50M!",
            type: "error",
          });
        } else {
          this.$message({
            message: "Upload file size cannot exceed 10m!",
            type: "error",
          });
        }
        this.fileList1.splice(this.fileList1.indexOf(file), 1)
        abort();
        return false;
      }
    },

    handleAvatarSuccessAnnex1(res, file) {
      if (res.status==500){
        if (this.$i18n.locale.toUpperCase() == 'EN') {
            this.$message.error("Upload Failed");
        }else {
            this.$message.error("上传失败");
        }
        this.fileList1.splice(this.fileList1.indexOf(file), 1)
        return
      }
      this.attachmentAddress = res.data.filePath;
      console.log(this.attachmentAddress);
      let obj = {};
      obj.fileNameDisplay = file.name;
      obj.filePath = res.data.filePath;
      obj.type = 2;
      this.filename.push(obj);
      console.log(this.filename);
    },
    handleExceed1(files, fileList) {
      this.$message.warning(
        `当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${
          files.length + fileList.length
        } 个文件`
      );
    },

    submitForm(formName) {
      // this.$refs[formName].validate((valid) => {
      //   if (valid) {
      //     alert("submit!");
      //   } else {
      //     console.log("error submit!!");
      //     return false;
      //   }
      // });
      if(this.ruleForm.committee == "" || this.ruleForm.committee == null || this.ruleForm.committee == undefined){
        if(this.$i18n.locale == "en"){
          this.$message.error('Please Select Committee')
        }else {
          this.$message.error('请选择所属委员会')
        }
        return
      }
      for (let i = 0; i <this.nationalCommitteeList.length; i++) {
        if(this.ruleForm.committee == this.nationalCommitteeList[i].label){
          this.ruleForm.committee = this.nationalCommitteeList[i].id;
          break;
        }
      }
      // if(this.ruleForm.name == "" || this.ruleForm.name == null || this.ruleForm.name == undefined){
      //   if(this.$i18n.locale == "en"){
      //     this.$message.error('Please Enter Name')
      //   }else {
      //     this.$message.error('请输入名称')
      //   }
      //   return
      // }
      // if(this.ruleForm.national == "" || this.ruleForm.national == null || this.ruleForm.national == undefined){
      //   if(this.$i18n.locale == "en"){
      //     this.$message.error('Please Select Country')
      //   }else {
      //     this.$message.error('请选择国家')
      //   }
      //   return
      // }
      if(this.ruleForm.desc == "" || this.ruleForm.desc == null || this.ruleForm.desc == undefined){
        if(this.$i18n.locale == "en"){
          this.$message.error('Please Enter Abstract')
        }else {
          this.$message.error('请输入摘要')
        }
        return
      }
      /*if(this.fileList.length != 0){
        this.$message.error('请选择目录')
        return
      }*/
      if(this.directoryAddress == "" || this.directoryAddress == null || this.directoryAddress == undefined){
        if(this.$i18n.locale == "en"){
          this.$message.error('Please Select cover')
        }else {
          this.$message.error('请选择封面')
        }
        return
      }
      if(this.attachmentAddress == "" || this.attachmentAddress == null || this.attachmentAddress == undefined){
        if(this.$i18n.locale == "en"){
          this.$message.error('Please Select The Attachment.')
        }else {
          this.$message.error('请选择附件')
        }
        return
      }
      this.uploadInformation.title = this.ruleForm.title;
      this.uploadInformation.belongCommittee = this.ruleForm.committee;
      this.uploadInformation.coverPath = this.coverAddress;
      this.uploadInformation.name = this.ruleForm.name;
      this.uploadInformation.nation = this.ruleForm.national;
      this.uploadInformation.city = this.ruleForm.city;
      this.uploadInformation.contact = this.ruleForm.contacts;
      this.uploadInformation.mail = this.ruleForm.email;
      this.uploadInformation.abstractInfo = this.ruleForm.desc;
      this.uploadInformation.menuPath = this.directoryAddress;
      this.uploadInformation.attachmentPath = this.attachmentAddress;
      this.uploadInformation.reserveTwo = "zh";
      console.log(this.uploadInformation);
      let params = this.uploadInformation;
      let id = this.titleId;
      uploadCommissionData(params, id)
        .then((res) => {
          console.log(res);
          let msg = "";
          if(this.$i18n.locale=='en'){
            msg = "Upload Succeeded";
          }else{
            msg = "上传成功";
          }
          if (res.status === "200") {
            this.$message({
              message: msg,
              type: "success",
            });
            this.$router.push({
              name: "nationalregionalCommittees",
              query: {
                key: "information",
              },
            });
          }
        })
        .catch((error) => {
          this.$message({
            message: `${error.msg}`,
            type: "error",
          });
        });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
      this.$router.push({
        name: "nationalregionalCommittees",
        query: {
          key: "information",
        },
      });
    },
    addTabDialog(targetName) {
      // const that = this;
      // that.addLanguageDialog = true;
    },

    addlanguage() {
      this.dialogFormVisible2 = true;
    },
    submit_lange() {
      // if (this.form1.language && this.form1.language_flag) {
      // }
      this.dialogFormVisible2 = false;
    },
    cancel_lange() {
      this.dialogFormVisible2 = false;
    },
  },
};
</script>
<style scoped>
.content .addLanguage {
  width: 100%;
  height: 50px;
  border-bottom: 1px solid #666666;
}

/* 去除文本框右下角斜杠 */
::v-deep .el-textarea__inner {
  resize: none;
}
.box1 {
  margin-top: 10px;
  background: #fff;
  padding: 24px 0;
  position: absolute;
}
.crumbs {
  margin-left: 20px;
}
.screen1 {
  background: linear-gradient(180deg, #3280e2 0%, #144e97 100%);
  border-radius: 20px 20px 20px 20px;
  padding: 8px 12px;
  color: #f0f3f8;
  margin-left: 10px;
}
.screen2 {
  font-size: 14px;
  background: linear-gradient(180deg, #b4d5ff 0%, #4f81bf 100%);
  border-radius: 20px;
  padding: 8px 12px;
  color: #165099;
  margin-left: 10px;
}
</style>