<template>
  <el-col :span="22" :offset="1">
    <el-card>
      <div slot="header" class="clearfix">
        <span>公共配置</span>
      </div>
      <el-form ref="form" :model="ruleEngineCommonConfig" label-width="120px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="规则基础目录">
              <el-input v-model="ruleEngineCommonConfig.packageName" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">

          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <el-col>
      <el-card>
        <div slot="header" class="clearfix">
          <span>作用域</span>
        </div>
        <el-tabs type="border-card" v-model="codeCardStatus">
          <el-tab-pane v-for="scope in ruleConfigList" :label="scope.ruleScopeName" :name="scope.scopeCode">
            <encoding v-if="codeCardStatus === scope.scopeCode" style="height: 800px" :rule-info="scope.ruleInfo" :read-only="true"></encoding>
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </el-col>
  </el-col>
</template>

<script>

import Encoding from "@/components/Encoding/index.vue";
import {getRuleConfigList} from "@/api/ruleEngine/ruleEngine";

export default {
  name: "EngineConfig",
  components: {Encoding},
  data() {
    return {
      codeCardStatus: "任务",
      ruleEngineCommonConfig: {
        packageName: "com.muyu.rule.engine",
      },
      ruleConfigList: []
    }
  },
  created() {
    this.getRuleConfigList()
  },
  methods: {
    getRuleConfigList(){
      getRuleConfigList().then(
        res => {
          console.log(res.data)
          this.ruleConfigList = res.data
        }
      )
    }
  }
}
</script>

<style>
.el-col {
  margin-top: 20px;
}
</style>
