<style>
.syslog_Content {
  width: 100%;
}
.syslog_ul li {
  width: 100%;
  min-height: 135px;
  margin-bottom: 10px;
}
.syslog_top {
  width: 100%;
  height: 34px;
  line-height: 34px;
  background-color: #dfdfdf;
}
.sys_content {
  width: 100%;
  min-height: 101px;
  padding: 20px;
  font-size: 14px;
  background-color: #fff;
}
.appUpdateLog .ql-editor {
  min-height: 200px;
}
.sysTop_left {
  float: left;
}
.sysTop_banben {
  display: inline-block;
  color: #38425d;
  font-size: 14px;
  font-weight: bold;
  margin: 0 30px;
}
.sysTop_uptime {
  font-size: 14px;
  color: #666666;
}
.sysTop_right {
  float: right;
  margin-right: 30px;
}
.sysliteleBtn {
  color: #fff;
  padding: 0 10px;
  height: 20px;
  background: #e95252;
  border: 1px solid #e95252;
  cursor: pointer;
  border-radius: 15px;
  margin-left: 10px;
}

</style>
<template>
  <div class="flexOne appUpdateLog">
    <table v-loading="loading" class="singeRowTable">
      <tr>
        <th width="150">{{$t('system.query_airName')}}</th>
        <th width="150">Code</th>
        <th>Content</th>
        <th width="100">{{$t('hotel.table_operat')}}</th>
      </tr>
      <tr v-for="(item, index) in dataList" :key="index">
        <td>
          {{ item.Name }}
        </td>
        <td>
          {{ item.Code }}
        </td>
        <td style="text-align:left;padding:0 5px;">
          {{ item.Content }}
        </td>
        <td>
          <input
            type="button"
            class="sysliteleBtn"
            @click="updateLog(item)"
            :value="$t('pub.updateMsg')"
          />
        </td>
      </tr>
    </table>

    <el-dialog
      custom-class="w800"
      :title="dialogTitle"
      :visible.sync="outerVisible"
      center
    >
      <el-form :model="addMsg" label-width="80px">
        <table style="width:100%">
          <tr>
            <td colspan="2">
              <el-form-item :label="$t('objFill.gengxinglr')">
                <el-input
                  v-model="addMsg.Content"
                  class="w595"
                  :placeholder="$t('pub.pleaseImport')"
                />
              </el-form-item>
            </td>
          </tr>
        </table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <button class="normalBtn" @click="SaveAppLog()">
          {{ $t("pub.saveBtn") }}
        </button>
        &nbsp;
        <button
          class="hollowFixedBtn"
          @click="(outerVisible = false), clearMsg()"
        >
          {{ $t("pub.cancelBtn") }}
        </button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      msg: {},
      loading: false,
      dataList: [],
      dialogTitle: "",
      outerVisible: false,
      addMsg: {
        ID: 0,
        Content: ""
      }
    };
  },
  methods: {
    getList() {
      //获取现有线路列表
      this.loading = true;
      this.apipost(
        "admin_get_GetDictValueListService",
        this.msg,
        res => {
          this.loading = false;
          if (res.data.resultCode == 1) {
            this.dataList = res.data.data;
          } else {
            this.Error(res.data.message);
          }
        },
        err => {}
      );
    },
    //修改获取数据
    updateLog(item) {
      this.addMsg.ID = item.ID;
      this.addMsg.Content = item.Content;
      this.dialogTitle = this.$t('objFill.v101.xiuggenxriz');
      this.outerVisible = true;
    },
    clearMsg() {
      this.addMsg.ID = 0;
      this.addMsg.Content = "";
    },
    SaveAppLog() {
      this.apipost(
        "admin_post_SetDictValueListService",
        this.addMsg,
        res => {
          if (res.data.resultCode == 1) {
            this.outerVisible = false;
            this.clearMsg();
            this.Success(res.data.message);
            this.getList();
          } else {
            this.Error(res.data.message);
          }
        },
        err => {}
      );
    }
  },
  mounted() {
    this.getList();
  }
};
</script>


