<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="24">
            <el-form-item label="规则基础目录">
              <el-input v-model="ruleEngineCommonConfig.packageName" disabled></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="自定义基础目录">
              <el-input v-model="ruleEngineCommonConfig.customName" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="模板基础目录">
              <el-input v-model="ruleEngineCommonConfig.templateName" disabled></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="win源码目录">
              <el-input v-model="ruleEngineCommonConfig.sourceWin" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="win编译目录">
              <el-input v-model="ruleEngineCommonConfig.targetWin" disabled></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="liunx源码目录">
              <el-input v-model="ruleEngineCommonConfig.sourceLiunx" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="liunx编译目录">
              <el-input v-model="ruleEngineCommonConfig.targetLiunx" disabled></el-input>
            </el-form-item>
          </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 scopeList" :label="scope.type" :name="scope.value">
            <encoding v-if="codeCardStatus === scope.value" style="height: 600px" v-model="scope.code" :read-only="true"></encoding>
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </el-col>
  </el-col>
</template>

<script>

import Encoding from "@/components/Encoding/index.vue";

export default {
  name: "EngineConfig",
  components: {Encoding},
  data() {
    return {
      codeCardStatus: "taskContext",
      ruleEngineCommonConfig: {
        packageName: "com.muyu.rule.engine",
        customName: "custom",
        templateName: "template",
        sourceWin: "D:\\config\\engine\\source",
        targetWin: "D:\\config\\engine\\target",
        sourceLiunx: "/home/config/source",
        targetLiunx: "/home/config/target",
      },
      scopeList: [
        { type: "任务", value: "taskContext", "code":
            "package com.muyu.scope;\n" +
            "\n" +
            "/**\n" +
            " * @Author: DongZeLiang\n" +
            " * @date: 2024/4/29\n" +
            " * @Description: 任务上下文\n" +
            " * @Version: 1.0\n" +
            " */\n" +
            "public class TaskContext {\n" +
            "\n" +
            "    public static TaskContext build(){\n" +
            "        return new TaskContext();\n" +
            "    }\n" +
            "}\n"
        },
        { type: "资产集", value: "recordContext", "code":
            "package com.muyu.scope;\n" +
            "\n" +
            "/**\n" +
            " * @Author: DongZeLiang\n" +
            " * @date: 2024/4/29\n" +
            " * @Description: 数据集\n" +
            " * @Version: 1.0\n" +
            " */\n" +
            "public class DataSetContext {\n" +
            "\n" +
            "    private final RecordContext recordContext;\n" +
            "\n" +
            "    public DataSetContext (RecordContext recordContext) {\n" +
            "        this.recordContext = recordContext;\n" +
            "    }\n" +
            "}\n" },
        { type: "资产记录", value: "dataSetContext", "code":
            "package com.muyu.scope;\n" +
            "\n" +
            "/**\n" +
            " * @Author: DongZeLiang\n" +
            " * @date: 2024/4/29\n" +
            " * @Description: 记录/资产模型\n" +
            " * @Version: 1.0\n" +
            " */\n" +
            "public class RecordContext {\n" +
            "\n" +
            "    private final TaskContext taskContext;\n" +
            "\n" +
            "    public RecordContext (TaskContext taskContext) {\n" +
            "        this.taskContext = taskContext;\n" +
            "    }\n" +
            "}\n" },
        { type: "资产模型", value: "dataModelContext", "code":
            "package com.muyu.scope;\n" +
            "\n" +
            "/**\n" +
            " * @Author: DongZeLiang\n" +
            " * @date: 2024/4/29\n" +
            " * @Description: 数据模型\n" +
            " * @Version: 1.0\n" +
            " */\n" +
            "public class DataModelContext {\n" +
            "\n" +
            "    private final DataSetContext dataSetContext;\n" +
            "\n" +
            "    public DataModelContext (DataSetContext dataSetContext) {\n" +
            "        this.dataSetContext = dataSetContext;\n" +
            "    }\n" +
            "}\n" }
      ]
    }
  },
  created() {
  },
  methods: {}
}
</script>

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