<template>
    <div class="gitAlgorithmsPanel">
        <el-row>
            <el-col :span="16" :offset="4">
                <el-form
                    ref="form"
                    :model="form"
                    :rules="rules"
                    label-width="160px"
                >
                    <el-form-item label="算法名称:" prop="algorithmName">
                        <el-input
                            placeholder="请输入"
                            maxlength="60"
                            v-autoTrim="{ obj: form, key: 'algorithmName' }"
                            v-model="form.algorithmName"
                        >
                        </el-input>
                    </el-form-item>
                    <el-form-item label="算法描述:" prop="description">
                        <el-input
                            placeholder="请输入"
                            maxlength="200"
                            v-autoTrim="{ obj: form, key: 'description' }"
                            v-model="form.description"
                        >
                        </el-input>
                    </el-form-item>

                    <el-form-item label="地址:" prop="gitUrl">
                        <el-input
                            placeholder="请输入"
                            maxlength="100"
                            v-autoTrim="{ obj: form, key: 'gitUrl' }"
                            v-model="form.gitUrl"
                        >
                        </el-input>
                    </el-form-item>
                    <el-form-item label="用户名:" prop="add1">
                        <el-input
                            placeholder="请输入"
                            maxlength="30"
                            v-autoTrim="{ obj: form, key: 'add1' }"
                            v-model="form.add1"
                        >
                        </el-input>
                    </el-form-item>
                    <el-form-item label="密码:" prop="add2">
                        <el-input
                            placeholder="请输入"
                            maxlength="30"
                            type="password"
                            v-autoTrim="{ obj: form, key: 'add2' }"
                            v-model="form.add2"
                        >
                        </el-input>
                    </el-form-item>
                    <div class="testLinkPanel">
                        <el-button type="primary">测试链接</el-button>
                    </div>
                </el-form>

                <div class="btns">
                    <el-button type="primary">保存</el-button>
                    <el-button type="primary">取消</el-button>
                </div>
            </el-col>
        </el-row>
    </div>
</template>

<script>
//import  from '';

export default {
    name: "gitAlgorithms", // 仓库算法详情
    components: {},
    data() {
        return {
            form: {
                id: "",
                algorithmName: "", // 算法名称
                description: "", // 算法描述
                gitUrl: "", // 地址
                gitToken: "", // 算法名称
                sf: "", // 算法名称
                uploadMode: "2", // 方式
            },
            type: "1",
            rules: {
                algorithmName: [{ required: true, message: "请输入", trigger: "blur" }],
                description: [{ required: true, message: "请输入", trigger: "blur" }],
                gitUrl: [{ required: true, message: "请输入", trigger: "blur" }],
                name: [{ required: true, message: "请输入", trigger: "blur" }],
                name: [{ required: true, message: "请输入", trigger: "blur" }],
            },
        };
    },

    methods: {
        /* typeChange(val) {
            if (val === "1") {
                this.rules = {
                    name: [
                        { required: true, message: "请输入", trigger: "blur" },
                    ],
                    sf: [
                        {
                            required: true,
                            message: "请选择",
                            trigger: "change",
                        },
                    ],
                    type: [
                        {
                            required: true,
                            message: "请选择",
                            trigger: "change",
                        },
                    ],
                };
            } else {
                this.rules = {
                    name: [
                        { required: true, message: "请输入", trigger: "blur" },
                    ],
                    type: [
                        {
                            required: true,
                            message: "请选择",
                            trigger: "change",
                        },
                    ],
                    add: [
                        { required: true, message: "请输入", trigger: "blur" },
                    ],
                    add1: [
                        { required: true, message: "请输入", trigger: "blur" },
                    ],
                    add2: [
                        { required: true, message: "请输入", trigger: "blur" },
                    ],
                };
            }
            this.$nextTick(() => {
                this.$refs["form"].clearValidate();
            });
            this.type = val;
        }, */
    },

    // mounted: {},
};
</script>

<style lang='less' scoped>
.gitAlgorithmsPanel {
    padding: 45px 30px 0;

    .el-form {

        /deep/ .el-input,
        .el-select {
            width: 100%;
        }
    }

    .testLinkPanel {
        margin-left: 160px;
    }

    .btns {
        padding-top: 90px;
        text-align: center;
    }
}
</style>