<template>
    <div>
        <el-row :gutter="20" class="el-row" type="flex">
            <el-col :span="10" class="el-col">
                <div class="text item">
                    <div class="itemTag">
                        <span>领用类型名称:&nbsp;</span>
                    </div>
                    <el-input
                        style="width: 200px"
                        size="small"
                        splaceholder="请输入内容"
                        :disabled="!isAdd"
                        v-model.trim="inputQuery.originName"
                    ></el-input>
                </div>
            </el-col>
            <el-col :span="10" class="el-col">
                <div class="text item">
                    <div class="itemTag">
                        <span>领用类型代码:&nbsp;</span>
                    </div>
                    <el-input
                        style="width: 200px"
                        :disabled="!isAdd"
                        size="small"
                        splaceholder="请输入内容"
                        v-model.trim="inputQuery.originAction"
                    ></el-input>
                </div>
            </el-col>
        </el-row>

        <el-row :gutter="20" class="el-row" type="flex">
            <el-col :span="10" class="el-col">
                <div class="text item">
                    <div class="itemTag">
                        <span>目标单据类型:&nbsp;</span>
                    </div>
                    <el-select v-model="inputQuery.targetBusAction" placeholder="请选择" clearable="true">
                        <el-option
                            v-for="item in busTypes"
                            :key="item.localAction"
                            :label="item.localName"
                            :value="item.localAction">
                            <span style="float: left">{{ item.localName }}</span>
                            <span style="float: right; color: #8492a6; font-size: 13px">{{ item.localAction }}</span>
                        </el-option>
                    </el-select>
                </div>
            </el-col>

            <el-col :span="10" class="el-col">
                <div class="text item">
                    <div class="itemTag">
                        <span>启用状态:&nbsp;</span>
                    </div>
                    <el-select
                        size="small"
                        :disabled="inputQuery.systemDefault"
                        v-model="inputQuery.enable"
                        placeholder="启用状态"
                    >
                        <el-option label="启用" :value="false"></el-option>
                        <el-option label="禁用" :value="true"></el-option>
                    </el-select>
                </div>
            </el-col>

<!--            <el-col :span="10" class="el-col">-->
<!--                <div class="text item">-->
<!--                    <div class="itemTag">-->
<!--                        <span>设置类型:&nbsp;</span>-->
<!--                    </div>-->
<!--                    <el-select-->
<!--                        size="small"-->
<!--                        :disabled="inputQuery.systemDefault"-->
<!--                        v-model="inputQuery.type"-->
<!--                        placeholder="设置类型"-->
<!--                    >-->
<!--                        <el-option label="耗材领用" :value="1"></el-option>-->
<!--                        <el-option label="采购计划" :value="3"></el-option>-->
<!--                    </el-select>-->
<!--                </div>-->
<!--            </el-col>-->
        </el-row>
        <el-row :gutter="20" class="el-row" type="flex">

            <el-col :span="10" class="el-col">
                <div class="text item">
                    <div class="itemTag">
                        <span>备注:&nbsp;</span>
                    </div>
                    <el-input
                        style="width: 200px"
                        size="small"
                        splaceholder="请输入内容"
                        v-model="inputQuery.remark"
                    ></el-input>
                </div>
            </el-col>
        </el-row>
        <el-divider></el-divider>
    </div>
</template>

<script>

import {
    getBasicThirdSys,
} from "../../api/basic/basicThirdSys";

import {
    getLocalBusType, getLocalJoinBusType,
} from "../../api/basic/busLocalType";

export default {
    name: "BusTypeChangeModify",
    props: {
        inputQuery: {
            type: Object,
            required: true,
        },
    },

    data() {
        return {
            filterQuery: {
                enabled: true,
                isBuType: true,
            },
            busTypes: [],
            isAdd: false,
            rules: {
                originName: [
                    {
                        required: true,
                        message: "单据类型名称不能为空",
                        trigger: "blur"
                    }
                ],
                originAction: [
                    {
                        required: true,
                        message: "单据类型代码不能为空",
                        trigger: "blur"
                    }
                ],
                targetBusAction: [
                    {
                        required: true,
                        message: "目标单据类型不能为空",
                        trigger: "blur"
                    }
                ],
                // type: [
                //     {
                //         required: true,
                //         message: "请选择设置类型",
                //         trigger: "blur"
                //     }
                // ],
                enable: [
                    {
                        required: true,
                        message: "请选择启用状态",
                        trigger: "blur"
                    }
                ],
            },
        }
    },
    methods: {

        getBusType() {
            let query = {
                enabled: true,
                corpType: 1,
            };
            getLocalJoinBusType(query)
                .then((response) => {
                    this.busTypes = response.data.list || [];
                })
                .catch(() => {
                });
        }
    },

    created() {

        if (this.inputQuery.originAction == null) {
            this.isAdd = true;
        }
        this.getBusType();
    }
    ,
}
;
</script>

<style scoped>
.itemTag {
    float: left;
    text-align: left;
    margin-top: 10px;
    width: 100px;
}

.text {
    font-size: 13px;
    font-family: "Microsoft YaHei";
}

.el-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.el-col {
    border-radius: 4px;
    flex-wrap: wrap;
}
</style>
