<template>
    <lj-win-common :title="title" :show-back="true" :header-height="headerHeight" :show-footer="false"
        :show-header="true" :show-body="true" :show-footer-shadow="false" @fix-body="fixbody" simplefooter
        >
        <div slot="body" class="main-body flx-col h-full flx-1 overflow-hidden">
            <van-tabs ref="vantabsRef" v-model="activeName" color="#2196f3" scrollspy sticky :offset-top="headerHeight"
                @rendered="autoRenderedTabs">
                <van-tab title="基础信息" name="base">
                    <rp-summary-item title="基础信息" simple></rp-summary-item>
                    <lj-base-form :data="mainObject" :group="basicGroup" :editable="true" :columns="columns"
                        @cell-click="handleFormGroupCellClick" @cell-clear="handleFormGroupCellClear"
                        @change="handleFormGroupChange"></lj-base-form>
                </van-tab>
                <van-tab title="床网明细" name="mx">
                    <rp-summary-item title="多区袋装明细" simple
                        v-if="bednetMxData.length && Number(mainObject.bednettypeid) == 11 && Number(bednetMxData[0].if_part)">
                        <lj-grid :table-data="bednetMxSpringData" :columns="gridColumns_spring" editing
                            @cell-click="handleGridCellClick" />
                    </rp-summary-item>
                    <rp-summary-item title="床网多网明细" simple>
                        <lj-grid :table-data="bednetMxData" :columns="gridColumns_mx" editing
                            @cell-click="handleGridCellClick" @content-cell-change="handleGridChange"
                            @content-cell-clear="handleGridClear" />
                    </rp-summary-item>
                </van-tab>
            </van-tabs>
        </div>
        <div class="detail-control" slot="footer">
            <van-button class="btn" round block @click="gotoCancel">
                取消
            </van-button>
            <van-button class="btn" round block type="info" @click="gotoSave">
                保存
            </van-button>
        </div>

    </lj-win-common>
</template>

<script>
import ljWinCommon from 'components/lj-win-common'
// import mtrldefItem from './bednet-quote-mx-item';
import LjGrid from "components/lj-grid";
import LjTagDouble from "components/lj-tag-double";
import LjBaseForm from 'components/lj-base-form';
import LjStatistic from 'components/lj-statistic.vue';
import RpSummaryItem from 'components/report-widget/rp-summary-item';
// import $lj from '../../../../../components/lj-public';
import LjCheckbox from 'components/lj-checkbox.vue';
import { Icon } from 'vant';

const ifsaleout_default = {
    commission: 1.05,
    other_rate: 1.05,
    taxrate: 1.07,
    moneyrate: 6.7
};

/**
 * @description 床网明细表-属性默认值
 */
const dw_bednet_define_add_mx = {
    pid: 1,
    bednetmxid: 0,
    bednetid: 0,
    spring_qty_width: 0,
    spring_qty_length: 0,
    bednet_height: 0,
    wire_mtrlid: 0,
    springid: 0,
    springname: 0,
    if_part: 0,
    if_15strip: 0,
    if_pocket_around: 0,
    pocket_around_springid: 0,
    pocket_around_springname: 0,
    pocket_around_row: 0,
    pocket_around_wire_price: 0,
    pocket_around_spring_cost: 0,
    pocket_around_fabrics_cost: 0,
    if_hard_around: 0,
    hard_around_springid: 0,
    hard_around_springname: 0,
    hard_around_row: 0,
    hard_around_wire_price: 0,
    hard_around_mtrl_cost: 0,
    hard_around_hr_cost: 0,
    fabrics1_mtrlid: 0,
    fabrics1_price: 0,
    fabrics1_mtrl_cost: 0,
    fabrics2_mtrlid: 0,
    fabrics2_price: 0,
    fabrics2_mtrl_cost: 0,
    if_side_iron: 0,
    side_iron_qty: 0,
    side_iron_mtrl_cost: 0,
    side_iron_hr_cost: 0,
    pocket_around_spring_cost_replace_formula: "",
    pocket_around_fabrics_cost_replace_formula: "",
    hard_around_mtrl_cost_replace_formula: "",
    hard_around_hr_cost_replace_formula: "",
    fabrics1_mtrl_cost_replace_formula: "",
    fabrics2_mtrl_cost_replace_formula: "",
    side_iron_mtrl_cost_replace_formula: "",
    side_iron_hr_cost_replace_formula: "",
    cnail_mtrl_cost_replace_formula: "",
    cnail_mtrl_cost: 0,
    cnail_hr_cost_replace_formula: "",
    cnail_hr_cost: 0,
    glue_mtrl_cost_replace_formula: "",
    glue_mtrl_cost: 0,
    spring_mtrl_cost: 0,
    spring_hr_cost: 0,
    spring_mtrl_cost_replace_formula: "",
    spring_hr_cost_replace_formula: "",
    spring_weight_replace_formula: ""
};

const dw_bednet_mx_spring = {
    bednetmx_partid: 0,
    bednetmxid: 0,
    springid: 0,
    springname: "",
    spring_qty_width: 0,
    spring_qty_length: 0,
    fabrics1_mtrl_cost: 0
};


export default {
    components: {
        LjGrid,
        ljWinCommon,
        LjTagDouble,
        LjBaseForm,
        LjStatistic,
        RpSummaryItem,
        LjCheckbox,
        "van-icon": Icon,
    },
    props: {},
    created() {
        var pageParm = $lj.getPageParam();
        this.mainObject = pageParm.mainObject;
        this.title = pageParm.winType == 1 || (pageParm.winType == 3 && pageParm.mainObject.bednetid) ? '床网报价-修改' : '床网报价-新建'

        this.winType = pageParm.winType;

        // 复制报价
        if (this.winType == 2) {
            this.title = "床网报价-复制";
            this.mainObject.copy_id = pageParm.mainObject.bednetid;
        }

        console.log(' this.mainObject.bednetid :>>>>>>>>>>>>>>>>>>>>>', JSON.stringify(this.mainObject.bednetid));
        this.refresh()
        // this.setGridColumns(this.mainObject);
    },
    mounted() {
        let user = $lj.getStorage("user");
        this.username = user.username;

        // window.addEventListener("scroll", () => this.autoScrollBody());
    },
    // unmounted() {
    //     window.removeEventListener("scroll");
    // },
    data() {
        return {
            title: "",
            editEnabled: false,
            winType: 0, // 0:新建，1：修改，2：复制， 3：床垫新建床网/床垫修改床网
            mainObject: {},
            bednetMxData: [],
            bednetMxSpringData: [],
            gridColumns_spring: [],
            gridColumns_mx: [],
            gridColumns: [
                // {label: "序", property: "printid", width: screen.width / 10 - 10},
                // {label: "成本对象", property: "order_mtrlname", width: screen.width / 5 - 10},
                // {label: "名称+规格", properties: ["mtrlname", "mtrlmode"], width: screen.width / 5 + 40},
                // {label: "单位", property: "unit", width: screen.width / 10},
                // {label: "待发料数", property: "planqty", width: screen.width / 5 - 10, type: "number"},
                // {label: "实发数", property: "qty", width: screen.width / 5 - 10, type: "number"},
                // {label: "配置", property: "status", width: screen.width / 5 - 10},
                // {label: "参考库存", property: "mtrlware_noallocqty", width: screen.width / 5},
                // {label: "编码", property: "mtrlcode", width: screen.width / 5},
                // {label: "总应发", property: "p_rqqty", width: screen.width / 5, type: "number"},
                // {label: "总已发", property: "factsclluqty", width: screen.width / 5, type: "number"},
                // {label: "工艺说明", property: "gydscrp", width: screen.width / 5}
            ],
            username: "",
            activeName: "base",
            headerHeight: 80,// header高度
            headerBg: "transparent",
            headerTextColor: "#fff",
            // headerOverHeight: 32,// header超出滚动高度
            deptEnum: [],
            bednettypeEnum: [],
            duoQvStrEnum: [],
            columns: [], // 表格列布局信息
            basicGroup: [], // 基础信息分组
            showAction: false, // 是否显示操作按钮
            billActions: [
                { name: '查看详细报价' },
                { name: '复制报价' },
                { name: '删除', color: '#ee0a24' },
            ], // 单据操作按钮
            statisticData: [
                {
                    label: "【弹簧材料总成本】",
                    value: 0,
                    subtitle: "【弹簧总材料成本】",
                    power: () => {
                        return userInfo.usermode === 0;
                    }
                },
                {
                    label: "【弹簧总人工成本】",
                    value: 0,
                    power: () => {
                        return userInfo.usermode === 0;
                    }
                },
                {
                    label: "【总材料成本】",
                    value: 0,
                    power: () => {
                        return userInfo.usermode === 0;
                    }
                },
                {
                    label: "【不含税出厂价】",
                    value: 0,
                    power: () => {
                        return userInfo.usermode === 0;
                    }
                },
                {
                    label: "【总人力成本】",
                    value: 0,
                    power: () => {
                        return userInfo.usermode === 0;
                    }
                },
                {
                    label: "【部门不含税价】",
                    value: 0,
                    power: () => {
                        return userInfo.usermode === 0;
                    }
                },
                {
                    label: "【总费用成本】",
                    value: 0,
                    power: () => {
                        return userInfo.usermode === 0;
                    }
                },
                {
                    label: "【部门含税价】",
                    subtitle: "【部门售价】",
                    value: 0
                },
                {
                    label: "【总成本】",
                    value: 0,
                    power: () => {
                        return userInfo.usermode === 0;
                    }
                },
                {
                    label: "【外币价】",
                    value: 0
                },
                {
                    label: "【总重量】",
                    value: 0
                }
            ],
            columnsExtraAttr: [
                {
                    field: "deptid",
                    title: "部门",
                    basicinfo: {
                        el: "select",
                        editable: true,
                        // rules: [{ required: true, message: "请先选择部门", trigger: "change" }],
                        props: {
                            filterable: true,
                        },
                    }
                },
                {
                    title: "床网编码",
                    field: "bednetcode",
                    table: "u_bednet_define",
                    basicinfo: {
                        editable: false,
                        editvisible: () => true,
                    }
                },
                {
                    title: "床网名称",
                    field: "bednetname",
                    basicinfo: {
                        el: "input",
                        editable: true
                    }
                },
                {
                    title: "床网类别",
                    field: "bednettypeid",
                    basicinfo: {
                        el: "select",
                        editable: true,
                        // rules: [{ required: true, message: "请先选择床网类别", trigger: "change" }],
                        props: {
                            clearable: false,
                            filterable: true,
                            //   onChange: val => wf_b_bednet_type_ch(val)
                        }
                    }
                },
                {
                    title: "床垫宽/CM",
                    field: "mattress_width",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "床垫长/CM",
                    field: "mattress_length",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "床垫高/CM",
                    field: "mattress_height",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "双簧？",
                    field: "if_doublespring",
                    basicinfo: {
                        editable: true,
                        // labelHidden: true,
                        render: function (h, scope, self) {
                            console.log('if_doublespring scope :>>>>>>>>>>>>>>>>>>>>>', JSON.stringify(scope));
                            let _render = [
                                h(LjCheckbox, {
                                    props: {
                                        value: scope.data.if_doublespring,
                                        label: "双簧",
                                    },
                                    on: {
                                        input: function (val) {
                                            self.$emit("input", "if_doublespring", val);
                                        }
                                    }
                                }),
                                h(LjCheckbox, {
                                    props: {
                                        value: scope.data.if_rsorwa,
                                        label: "胶条 包角",
                                    },
                                    on: {
                                        input: function (val) {
                                            self.$emit("input", "if_rsorwa", val);
                                        }
                                    }
                                }),
                                h(LjCheckbox, {
                                    props: {
                                        value: scope.data.if_sponge_drilling,
                                        label: "海绵打孔",
                                    },
                                    on: {
                                        input: function (val) {
                                            self.$emit("input", "if_sponge_drilling", val);
                                        }
                                    }
                                }),
                                h(LjCheckbox, {
                                    props: {
                                        value: scope.data.iffork,
                                        label: "弹叉",
                                    },
                                    on: {
                                        input: function (val) {
                                            self.$emit("input", "iffork", val);
                                        }
                                    }
                                }),
                                h(LjCheckbox, {
                                    props: {
                                        value: scope.data.if_jb,
                                        label: "卷包",
                                    },
                                    on: {
                                        input: function (val) {
                                            self.$emit("input", "if_jb", val);
                                        }
                                    }
                                })
                            ];
                            return h("div", {
                                class: "lj-layout-grid-3"
                            }, _render)
                        }
                    }
                },
                {
                    title: "蛇线线径MM",
                    field: "snake_wire_diameter",
                    basicinfo: {
                        el: "input",
                        // rules: [{ validator: numCheck, trigger: "blur" }],
                        editable: true,
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.bednettypeid) > 11) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
                {
                    title: "海绵包边物料",
                    field: "mtrl_sponge_name",
                    basicinfo: {
                        el: "mtrldef-selection",
                        editable: true,
                        clearable: true,
                    }
                },
                {
                    title: "海绵厚度CM",
                    field: "sponge_thickness",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "海绵高CM",
                    field: "sponge_height",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "填充海绵物料",
                    field: "mtrl_sponge_tc_name",
                    basicinfo: {
                        el: "mtrldef-selection",
                        editable: true,
                        clearable: true,
                    }
                },
                {
                    title: "填充海绵厚度CM",
                    field: "sponge_tc_thickness",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "填充海绵高CM",
                    field: "sponge_tc_height",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "封边物料",
                    field: "mtrl_edge_name",
                    basicinfo: {
                        el: "mtrldef-selection",
                        editable: true,
                        clearable: true,
                    }
                },
                {
                    title: "封边高",
                    field: "edge_height",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "上垫层材料",
                    field: "mtrl_felt_name",
                    basicinfo: {
                        el: "mtrldef-selection",
                        editable: true,
                        clearable: true,
                    }
                },
                {
                    field: "felt_qty",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "下垫层材料",
                    field: "mtrl_felt_x_name",
                    basicinfo: {
                        el: "mtrldef-selection",
                        editable: true,
                        clearable: true,
                    }
                },
                {
                    field: "felt_x_qty",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        // rules: [{ validator: numCheck, trigger: "blur" }]
                    }
                },
                {
                    title: "弹叉数量",
                    field: "fork_qty",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.iffork)) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
                {
                    title: "做法",
                    field: "felt_dscrp",
                    basicinfo: {
                        el: "input",
                        editable: true,
                        props: { type: "textarea", rows: 2 }
                    }
                },
                {
                    title: "床网独立销售",
                    field: "ifsaleout",
                    basicinfo: {
                        el: "checkbox",
                        editable: true,
                        props: {
                            trueValue: "1",
                            falseValue: "0"
                        }
                    }
                },
                {
                    field: "duo_qv_str",
                    basicinfo: {
                        el: "select",
                        editable: true,
                        clearable: true,
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.bednettypeid) == 11) {
                                return true;
                            }
                            return false;
                        },
                    }
                },
                {
                    title: "包装",
                    field: "packtype",
                    enum: [
                        {
                            label: "压包",
                            value: "压包"
                        },
                        {
                            label: "卷包",
                            value: "卷包"
                        },
                        {
                            label: "不压不卷",
                            value: "不压不卷"
                        },
                        {
                            label: "裸包装",
                            value: "裸包装"
                        }
                    ],
                    basicinfo: {
                        el: "select",
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        },
                        render: function (h, scope, self) {
                            console.log('packtype packtype scope :>>>>>>>>>>>>>>>>>>>>>', JSON.stringify(scope));

                            let packmtrlEnum = [
                                {
                                    label: "编辑袋",
                                    value: "编辑袋"
                                },
                                {
                                    label: "牛皮纸",
                                    value: "牛皮纸"
                                },
                                {
                                    label: "胶袋",
                                    value: "胶袋"
                                },
                                {
                                    label: "牛皮纸袋",
                                    value: "牛皮纸袋"
                                }
                            ];


                            let _render = [
                                h("div", {
                                    class: ["flx"],
                                    on: {
                                        click: function (val) {
                                            self.$emit("toSelect", scope.column);
                                        }
                                    }
                                }, [
                                    h("div", {
                                        class: ["flx-1"]
                                    }, scope.data[scope.column.field] == "" ? [h('div', { style: { color: '#E5E5EA' } }, scope.column.title)] : scope.data[scope.column.field]),
                                    h("div", {
                                        style: {
                                            marginLeft: "8px"
                                        }
                                    }, [
                                        h("van-icon", {
                                            props: {
                                                name: "arrow",
                                                color: "#8B8B8B"
                                            }
                                        }
                                        )
                                    ])
                                ]),
                                h("div", {
                                    class: ["flx"],
                                    on: {
                                        click: function (val) {
                                            self.$emit("toSelect", { field: "packmtrl", enum: packmtrlEnum, title: "包装材料" });
                                        }
                                    }
                                }, [
                                    h("div", {
                                        class: ["flx-1"]
                                    }, scope.data.packmtrl == "" ? [h('span', { style: { color: '#E5E5EA' } }, "包装材料")] : scope.data.packmtrl),
                                    h("div", {
                                        style: {
                                            marginLeft: "8px"
                                        }
                                    }, [
                                        h("van-icon", {
                                            props: {
                                                name: "arrow",
                                                color: "#8B8B8B"
                                            }
                                        }
                                        )
                                    ])
                                ]),
                            ];
                            return h("div", {
                                class: "lj-layout-grid-2"
                            }, _render)
                        }
                    }
                },
                {
                    title: "包装数量",
                    field: "packqty",
                    basicinfo: {
                        el: "input",
                        props: {
                            type: "number",
                        },
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        },
                    }
                },
                {
                    title: "运输方式",
                    field: "transport_type",
                    enum: [
                        {
                            label: "装车送货(装柜)",
                            value: "装车送货(装柜)"
                        },
                        {
                            label: "装车送货(送货运站)",
                            value: "装车送货(送货运站)"
                        }
                    ],
                    basicinfo: {
                        el: "select",
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
                {
                    title: "佣金点数",
                    field: "commission",
                    basicinfo: {
                        el: "input",
                        props: {
                            placeholder: ifsaleout_default.commission + ""
                        },
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
                {
                    title: "额外点数",
                    field: "other_rate",
                    basicinfo: {
                        el: "input",
                        props: {
                            placeholder: ifsaleout_default.other_rate + ""
                        },
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
                {
                    title: "FOB",
                    field: "fob",
                    basicinfo: {
                        el: "input",
                        // props: {
                        //     slots: {
                        //         suffix: () => {
                        //             return <>元</>;
                        //         },
                        //         append: () => {
                        //             return <>元</>;
                        //         }
                        //     }
                        // },
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
                {
                    title: "税率",
                    field: "taxrate",
                    basicinfo: {
                        el: "input",
                        props: {
                            placeholder: ifsaleout_default.taxrate + ""
                        },
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
                {
                    title: "额外费用",
                    field: "extras_cost",
                    basicinfo: {
                        el: "input",
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
                {
                    title: "汇率",
                    field: "moneyrate",
                    basicinfo: {
                        el: "input",
                        props: {
                            type: "number",
                            placeholder: ifsaleout_default.moneyrate + ""
                        },
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
                {
                    title: "额外费用备注",
                    field: "extras_cost_dscrp",
                    basicinfo: {
                        el: "input",
                        props: { type: "textarea", rows: 2 },
                        editvisible: (scope) => {
                            if (Number(scope.searchParam.ifsaleout)) {
                                return true;
                            }
                            return false;
                        }
                    }
                },
            ],
            columnsExtraAttr_mx: [
                {
                    field: "pid",
                    width: screen.width / 10 - 10
                },
                {
                    field: "springname",
                    sloteditable: true,
                    clearable: true,
                },
                {
                    field: "spring_qty_length",
                    editable: true,
                    type: "number",

                },
                {
                    field: "spring_qty_width",
                    editable: true,
                    type: "number",
                },
                {
                    field: "bednet_height",
                    editable: true,
                    type: "number",
                },
                {
                    field: "if_side_iron",
                    editable: true,
                    type: "checkbox",
                },
                {
                    field: "side_iron_qty",
                    editable: true,
                    type: "number",
                    cellEditingCall: (row, column, rowIndex) => {
                        return Number(row["if_side_iron"]) == 1;
                    },
                },
                {
                    field: "if_hard_around",
                    editable: true,
                    type: "checkbox",
                },
                {
                    field: "hard_around_row",
                    editable: true,
                    type: "number",
                    cellEditingCall: (row, column, rowIndex) => {
                        return Number(row["if_hard_around"]) == 1;
                    },
                },
                {
                    field: "hard_around_springname",
                    sloteditable: true,
                    clearable: true,
                    cellEditingCall: (row, column, rowIndex) => {
                        return Number(row["if_hard_around"]) == 1;
                    },
                },
                {
                    field: "if_15strip",
                    editable: true,
                    type: "checkbox",
                },
                {
                    field: "fabrics2_mtrlid",
                    clearable: true,
                    sloteditable: true
                },
                {
                    field: "fabrics1_mtrlid",
                    clearable: true,
                    sloteditable: true
                },
                {
                    field: "if_part",
                    editable: true,
                    type: "checkbox",
                    cellEditingCall: (row, column, rowIndex) => {
                        return Number(row["if_hard_around"]) == 1;
                    },
                },
            ]
        }
    },
    methods: {
        refresh(cb) {
            let _bednetid = this.mainObject.bednetid
            let isNew = false; // 是否新增

            if (!_bednetid) {
                isNew = true;
                _bednetid = 0;
            }

            let params = {
                arg_bednetid: _bednetid
            }
            $lj.postCommonLJRequest("web_bednet_define", params, "u_bednet_define", (res) => {
                if (res && res.datatable && res.datatable.length > 0) {
                    this.mainObject = res.datatable[0];

                    console.log("refresh >>>>", JSON.stringify(this.mainObject));
                }
                this.getType(res);

                cb && cb();

                if (isNew) this.initLayouColumns();

                this.reload_dw2(this.mainObject, (data) => {
                    this.bednetMxData = data;
                }, (data) => {
                    this.bednetMxSpringData = data;
                });
            })

        },
        getType(data) {
            console.log("getType >>>>", Object.keys(data.tableinfo).includes("tableprop")
                && Object.keys(data.tableinfo.tableprop).includes("basicinfo")
                && data.tableinfo.tableprop.basicinfo.basicGroup, JSON.stringify(data));
            if (
                Object.keys(data.tableinfo).includes("tableprop")
                && Object.keys(data.tableinfo.tableprop).includes("basicinfo")
                && data.tableinfo.tableprop.basicinfo.basicGroup) {
                this.basicGroup = data.tableinfo.tableprop.basicinfo.basicGroup
            }

            this.columns = $lj.setExtraColumns(data.tableinfo.columns, this.columnsExtraAttr);

            let _deptidItem = data.tableinfo.columns.find(item => item.field == 'deptid');
            if (_deptidItem && _deptidItem.enum) {
                this.deptEnum = _deptidItem.enum;
            }

            let _bednettypeItem = data.tableinfo.columns.find(item => item.field == 'bednettypeid');
            if (_bednettypeItem && _bednettypeItem.enum) {
                this.bednettypeEnum = _bednettypeItem.enum;
            }

            let _duoqvstrItem = data.tableinfo.columns.find(item => item.field == 'duo_qv_str');
            if (_duoqvstrItem && _duoqvstrItem.enum) {
                this.duoQvStrEnum = _duoqvstrItem.enum;
            }

            if (this.mainObject.flag == 1) {
                // 已审核后操作按钮列表
                this.billActions = [
                    { name: '撤销审核' },
                    { name: '查看详细报价' },
                    { name: '复制报价' },
                    { name: '删除', color: '#ee0a24' },
                    // { name: '查看历史报价' }
                ]
            }
        },
        /**窗口高度 */
        fixbody(obj) {
            this.headerHeight = obj.marginTop;
        },
        autoRenderedTabs() {
            this.$refs.vantabsRef.resize();
        },
        /**
         * @description: 初始化主表信息
         */
        initLayouColumns() {
            console.log('initLayouColumns  this.columns :>>>>>>>>>>>>>>>>>>>>>', JSON.stringify(this.columns));
            this.columns.forEach((column, index) => {
                // console.log(' column.field :>>>>>>>>>>>>>>>>>>>>>', JSON.stringify(column.field), typeof column.basicinfo.editvisible);
                // !Object.keys(column).includes("basicinfo") && (column.basicinfo = {});
                let _field = column.basicinfo && column.basicinfo.key ? column.basicinfo.key : column.field;
                if (column.basicinfo && column.basicinfo.defaultValue !== undefined && column.basicinfo.defaultValue !== null) {
                    this.mainObject[_field] = column.basicinfo.defaultValue;
                } else {
                    // 为新增单据的时候赋值
                    let defVal = "";
                    if (column.datatype && ["number", "integer"].includes(column.datatype)) {
                        defVal = 0;
                    }
                    this.mainObject[_field] = defVal;
                }
                // column.rules = column.basicinfo.rules ? column.basicinfo.rules : undefined;
            });

            // this.mainObject.iffork = 0;
            console.log("props.this.mainObject :>> ", this.mainObject);
        },
        // autoScrollBody() {  
        //     this.$nextTick(() => {
        //         let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        //         // let { scrollTop, isFixed } = data;
        //         if (this.$refs.vantabsRef) {
        //             // let offsetTop = this.$refs.vantabsRef.offsetTop.toString();
        //             let offsetTop = this.headerOverHeight;
        //             console.log("offsetTop init isFixed", offsetTop, scrollTop);
        //             offsetTop = Number(offsetTop.toString().replace("px", ""));
        //             if (scrollTop > offsetTop ) {
        //                 this.headerBg = '#fff';
        //                 this.headerTextColor = '#000';
        //             } else {
        //                 let _per = Math.round(scrollTop / offsetTop * 100) / 100;
        //                 if (_per > 1) {
        //                     _per = 1;
        //                 }
        //                 this.headerBg = `rgba(255,255,255,${_per})`;
        //                 this.headerTextColor = `rgba(255,255,255,1)`;
        //             }
        //         }
        //         console.log("autoScrollTabs inset???", this.headerBg);
        //     });
        // },
        // autoScrollTabs(data) {
        //     this.$nextTick(() => {
        //         let { scrollTop, isFixed } = data;
        //         if (this.$refs.vantabsRef) {
        //             let offsetTop = this.$refs.vantabsRef.offsetTop.toString();
        //             // console.log("offsetTop init isFixed", offsetTop, isFixed, scrollTop);
        //             offsetTop = Number(offsetTop.replace("px", ""));

        //             if (scrollTop > 0) {
        //                 this.headerTextColor = '#000'
        //             } else {
        //                 this.headerTextColor = `rgba(255,255,255,1)`;
        //             }

        //             if (isFixed && scrollTop > 0) {
        //                 this.headerBg = '#fff';
        //             } else {
        //                 let _per = Math.round(scrollTop / offsetTop * 100) / 100;
        //                 if (_per > 1) {
        //                     _per = 1;
        //                 }
        //                 this.headerBg = `rgba(255,255,255,${_per})`;
        //             }
        //         }
        //         // console.log("autoScrollTabs inset???", this.headerBg);
        //     });
        // },
        wf_hide_dw2(bednetData, columns) {
            let hFields = [];

            console.log('bednetData.typename != "袋装网" :>> ', bednetData.typename, bednetData.typename != "袋装网");

            // if (bednetData.typename != "袋装网") {
            if (Number(bednetData.bednettypeid) != 11) {
                hFields.push("if_part");
                // 圆网和拉丝网 没有 入袋无纺布和底面无纺布
                hFields.push("fabrics1_mtrlid");
                hFields.push("fabrics2_mtrlid");
            }

            //四周加硬
            if (Number(bednetData.if_hard_around) == 0) {
                hFields.push("if_hard_around");
                hFields.push("hard_around_wire_price");
                hFields.push("hard_around_mtrl_cost");
                hFields.push("hard_around_hr_cost");
                hFields.push("hard_around_springid");
                hFields.push("hard_around_row");
            }

            //四周口袋
            if (Number(bednetData.if_pocket_around) == 0) {
                hFields.push("pocket_around_springname");
                hFields.push("pocket_around_springid");
                hFields.push("pocket_around_row");
                hFields.push("pocket_around_wire_price");
                hFields.push("pocket_around_spring_cost");
                hFields.push("pocket_around_fabrics_cost");
                hFields.push("if_pocket_around");
            }

            // 边铁？
            if (Number(bednetData.if_side_iron) == 0) {
                hFields.push("if_side_iron");
                hFields.push("side_iron_qty");
                hFields.push("side_iron_mtrl_cost");
                hFields.push("side_iron_hr_cost");
            }

            let _columns = columns.map(t => {
                if (hFields.includes(t.field)) {
                    return {
                        ...t,
                        limited: true
                    };
                }
                return t;
            });

            return _columns.filter(t => !t.limited);
        },
        wf_b_bednet_type_ch(val) {

            console.log("wf_b_bednet_type_ch state.LjDetailRef._mainData val:>> ", val);
            // const { _mainData, enumMap, baseformRef } = state.LjDetailRef;

            // let mainData = state.orderStatus == "new" ? initParam : _mainData;

            let params = {
                arg_bednettypeid: Number(val)
            }
            $lj.postCommonLJRequest("_Mapper_bednet_type_define", params, "u_bednet_define", (res) => {
                if (res && res.datatable && res.datatable.length > 0) {
                    let rBednetType = res.datatable[0];

                    this.mainObject.bednettypeid = rBednetType.bednettypeid;
                    this.mainObject.snake_wire_diameter = rBednetType.snake_wire_diameter;
                    this.mainObject.snake_wire_mtrl_formula = rBednetType.snake_wire_mtrl_formula;

                    this.mainObject.pocket_around_spring_formula = rBednetType.pocket_around_spring_formula;
                    this.mainObject.pocket_around_fabrics_formula = rBednetType.pocket_around_fabrics_formula;

                    this.mainObject.hard_around_mtrl_formula = rBednetType.hard_around_mtrl_formula;
                    this.mainObject.hard_around_hr_formula = rBednetType.hard_around_hr_formula;
                    this.mainObject.glue_mtrl_formula = rBednetType.glue_mtrl_formula;

                    this.mainObject.if_side_iron = rBednetType.if_side_iron;
                    this.mainObject.side_iron_mtrl_formula = rBednetType.side_iron_mtrl_formula;
                    this.mainObject.side_iron_hr_formula = rBednetType.side_iron_hr_formula;

                    this.mainObject.cnail_mtrl_formula = rBednetType.cnail_mtrl_formula;
                    this.mainObject.cnail_hr_formula = rBednetType.cnail_hr_formula;

                    this.mainObject.if_sponge_drilling = rBednetType.if_sponge_drilling;
                    this.mainObject.sponge_mtrl_formula = rBednetType.sponge_mtrl_formula;
                    this.mainObject.sponge_hr_formula = rBednetType.sponge_hr_formula;

                    this.mainObject.edge_mtrl_formula = rBednetType.edge_mtrl_formula;
                    this.mainObject.edge_hr_formula = rBednetType.edge_hr_formula;

                    this.mainObject.fork_mtrl_formula = rBednetType.fork_mtrl_formula;
                    this.mainObject.fork_hr_formula = rBednetType.fork_hr_formula;

                    this.mainObject.if_rsorwa = rBednetType.if_rsorwa;
                    this.mainObject.rsorwa_mtrl_formula = rBednetType.rsorwa_mtrl_formula;
                    this.mainObject.rsorwa_hr_formula = rBednetType.rsorwa_hr_formula;
                    this.mainObject.sponge_drilling_hr_formula = rBednetType.sponge_drilling_hr_formula;

                    this.mainObject.spring_mtrl_formula = rBednetType.spring_mtrl_formula;
                    this.mainObject.spring_hr_formula = rBednetType.spring_hr_formula;
                    this.mainObject.fabrics1_mtrl_formula = rBednetType.fabrics1_mtrl_formula;
                    this.mainObject.fabrics2_mtrl_formula = rBednetType.fabrics2_mtrl_formula;

                    this.mainObject.felt_mtrl_formula = rBednetType.felt_mtrl_formula;
                    this.mainObject.felt_hr_formula = rBednetType.felt_hr_formula;

                    this.mainObject.packet_mtrl_formula = rBednetType.packet_mtrl_formula;
                    this.mainObject.packet_hr_formula = rBednetType.packet_hr_formula;

                    this.mainObject.sponge_mtrl_tc_formula = rBednetType.sponge_mtrl_tc_formula;

                    this.mainObject.spring_weight_formula = rBednetType.spring_weight_formula;
                    this.mainObject.side_iron_weight_formula = rBednetType.side_iron_weight_formula;
                    this.mainObject.hard_around_weight_formula = rBednetType.hard_around_weight_formula;
                    this.mainObject.fabrics1_weight_formula = rBednetType.fabrics1_weight_formula;
                    this.mainObject.fabrics2_weight_formula = rBednetType.fabrics2_weight_formula;
                    this.mainObject.felt_weight_formula = rBednetType.felt_weight_formula;
                    this.mainObject.cnail_weight_formula = rBednetType.cnail_weight_formula;
                    this.mainObject.sponge_weight_formula = rBednetType.sponge_weight_formula;
                    this.mainObject.sponge_weight_tc_formula = rBednetType.sponge_weight_tc_formula;
                    this.mainObject.edge_weight_formula = rBednetType.edge_weight_formula;
                    this.mainObject.fork_weight_formula = rBednetType.fork_weight_formula;


                    let _default = dw_bednet_define_add_mx;
                    // 袋网
                    if (Number(rBednetType.bednettypeid) == 11) {
                        _default.fabrics2_mtrlid = 8760;
                        _default.fabrics1_mtrlid = 8759;
                    }

                    this.reload_dw2(rBednetType, () => {
                        this.bednetMxData = [_default];
                    });

                }
            })

        },
        reload_dw2(bednetData, cb, cbSpring) {

            let _bednetid = bednetData.bednetid
            let isNew = false; // 是否新增

            if (!_bednetid) {
                isNew = true;
                _bednetid = -1;
            }

            this.bednetMxData = [];
            this.bednetMxSpringData = [];
            let params = {
                arg_bednetid: _bednetid
            }
            $lj.postCommonLJRequest("web_bednet_mx_add", params, "u_bednetmx", (res) => {
                if (res) {
                    this.bednetMxData = res.datatable;
                    let columns = $lj.setExtraColumns(res.tableinfo.columns, this.columnsExtraAttr_mx);
                    columns = this.wf_hide_dw2(bednetData, columns);
                    this.gridColumns_mx = $lj.getCommonColumns(columns);

                    cb && cb(res.datatable);
                }
            })

            $lj.postCommonLJRequest("web_bednet_mx_spring", params, "u_bednetmx_spring", (res) => {
                if (res) {
                    this.bednetMxSpringData = res.datatable;
                    let _columns = $lj.setExtraColumns(res.tableinfo.columns, this.columnsExtraAttr_mx);
                    this.gridColumns_spring = $lj.getCommonColumns(_columns);

                    cbSpring && cbSpring(res.datatable);
                }
            })
            // let res = await getDataMxAdd(state.initParamsMx);
            // console.log("getDataMxAdd res :>> ", res);
            // let result = dataCallback(res);

            // columnsMx.value = wf_hide_dw2(bednetData, result.tableinfo.columns).map(item => {
            // let _default = columnsMx_default.value.find(t => t.field == item.field);
            // if (_default) {
            //     item = defaultsDeep(item, _default);
            // }
            // return item;
            // });
            // console.log("reset columnsMx.value :>> ", columnsMx.value, result);
            // // cb && cb(result);

            // let res2 = await getDataMxSpring(state.initParamsMx);
            // let result2 = dataCallback(res2);
            // // columnsMxSpring.value = result.tableinfo.columns;
            // columnsMxSpring.value = result2.tableinfo.columns.map(item => {
            // let _default = columnsMxSpring_default.value.find(t => t.field == item.field);
            // if (_default) {
            //     item = defaultsDeep(item, _default);
            // }
            // return item;
            // });

            // console.log("reload_dw2 columnsMxSpring.value :>> ", columnsMxSpring.value, result);
        },
        delBill() {
            $lj.postLJRequest("DeleteL1Outware", {
                token: $lj.getStorage("token"),
                scid: this.mainObject.scid,
                outwareid: this.mainObject.outwareid
            }, function (rsp) {
                if (rsp) {
                    $lj.toast("删除成功", 2000);
                    $lj.sendEvent("outware_scll_plan_refresh");
                    $lj.closeWin();
                }
            })
        },
        saveBill(saveType) {
            if (!$lj.checkPower(5227)) {
                alert("没有[发料单修改]的权限");
                return;
            }
            if (saveType === 1 && !$lj.checkPower(5228)) {
                alert("没有[发料单审核]的权限");
                return;
            }
            if (!this.mxList.length) {
                this.$toast("发料明细为空，请稍后重试");
                return;
            }
            $lj.postLJRequest("OutwareQtyEdit", {
                token: $lj.getStorage("token"),
                outware: this.mainObject,
                outwaremxList: this.mxList,
                saveType: saveType
            }, function (rsp) {
                if (rsp) {
                    $lj.toast("更新成功", 2000);
                    $lj.sendEvent("outware_scll_plan_refresh");
                    $lj.closeWin();
                }
            })
        },
        // setGridColumns(data) {
        //     let result = [];
        //     this.uselocationState = $lj.ifUselocation(data);
        //     if (!this.uselocationState) {
        //         result = [
        //             { label: "序", property: "printid", width: screen.width / 10 - 10 },
        //             { label: "成本对象", property: "order_mtrlname", width: screen.width / 5 - 10 },
        //             { label: "名称+规格", properties: ["mtrlname", "mtrlmode"], width: screen.width / 5 + 40 },
        //             { label: "单位", property: "unit", width: screen.width / 10 },
        //             { label: "待发料数", property: "planqty", width: screen.width / 5 - 10, type: "number" },
        //             { label: "实发数", property: "qty", width: screen.width / 5 - 10, type: "number" },
        //             { label: "配置", property: "status", width: screen.width / 5 - 10 },
        //             { label: "参考库存", property: "mtrlware_noallocqty", width: screen.width / 5 },
        //             { label: "编码", property: "mtrlcode", width: screen.width / 5 },
        //             { label: "总应发", property: "p_rqqty", width: screen.width / 5, type: "number" },
        //             { label: "总已发", property: "factsclluqty", width: screen.width / 5, type: "number" },
        //             { label: "工艺说明", property: "gydscrp", width: screen.width / 5 },
        //             { label: "主计划销售\r\n订单相关号", property: "taskrelcode", width: screen.width / 4 }
        //         ];
        //     } else {
        //         result = [
        //             { label: "序", property: "printid", width: screen.width / 10 - 10 },
        //             { label: "成本对象", property: "order_mtrlname", width: screen.width / 5 - 10 },
        //             { label: "名称+规格", properties: ["mtrlname", "mtrlmode"], width: screen.width / 5 + 30 },
        //             { label: "单位", property: "unit", width: screen.width / 10 },
        //             { label: "待发料数", property: "planqty", width: screen.width / 5 - 10, type: "number" },
        //             { label: "实发数", property: "qty", width: screen.width / 5 - 10, type: "number" },
        //             { label: "仓位", property: "location" },
        //             { label: "配置", property: "status", width: screen.width / 5 - 10 },
        //             { label: "参考库存", property: "mtrlware_noallocqty", width: screen.width / 5 },
        //             { label: "编码", property: "mtrlcode", width: screen.width / 5 },
        //             { label: "总应发", property: "p_rqqty", width: screen.width / 5, type: "number" },
        //             { label: "总已发", property: "factsclluqty", width: screen.width / 5, type: "number" },
        //             { label: "工艺说明", property: "gydscrp", width: screen.width / 5 },
        //             { label: "主计划销售\r\n订单相关号", property: "taskrelcode", width: screen.width / 4 }
        //         ];
        //     }
        //     this.gridColumns = result;
        // },
        gotoCancel() {
            $lj.confirm('提示', '是否放弃保存？', function () {
                $lj.closeWin()
            });
        },
        gotoCheckmx() {
        },
        /**
         * 弹窗：选择物料
         * @param params 参数
         * @param cb 回调赋值
         */
        fnSelMtrldef(params, cb) {
            $lj.removeEventListener("mtrldef-selection");
            $lj.addEventListener("mtrldef-selection", function (ret) {
                console.log('？？？？反馈回调~~~~~ ret:>>！！！！！！！！！！ ', JSON.stringify(ret.value));
                if (ret.value) {
                    cb && cb(ret.value);
                }
            });

            let _pricelistid = this.getPriceid();
            // 仓位单选
            $lj.openWin("mtrldef-selection", {
                winMode: "single-select",
                queryParams: {
                    arg_pricelistid: _pricelistid,
                    ...params,
                }
            });
        },
        /**
         * 弹窗：选择弹簧
         * @param params 参数
         * @param cb 回调赋值
         */
        fnSelSpring(params, cb) {
            $lj.removeEventListener("spring_select");
            $lj.addEventListener("spring_select", function (ret) {
                console.log('？？？？反馈回调~~~~~ ret:>>！！！！！！！！！！ ', JSON.stringify(ret.value));
                if (ret.value) {
                    cb && cb(ret.value);
                }
            });
            // 仓位单选
            $lj.openWin("spring", {
                winMode: "single-select",
                queryParams: {
                    ...params,
                }
            });
        },
        getPriceid() {
            let _pricelistid = 0;
            console.log("deptEnum :>> ", this.deptEnum);
            if (this.deptEnum) {
                let depItem = this.deptEnum.find((item) => item.value == this.mainObject.deptid);
                console.log("depItem :>> ", depItem);
                if (depItem) {
                    _pricelistid = Number(depItem.pricelistid);
                }
            }
            return _pricelistid;
        },
        /**
         * @description 设置多区弹簧宽度
         */
        setMxSpringWidth(row) {
            console.log("setMxSpringWidth val :>> ", row);

            this.bednetMxSpringData.forEach((item, index) => {
                item.spring_qty_width = row.spring_qty_width;
            });
        },
        /**
         * @description 设置床网高度，自动计算宽度，长度
         */
        async setMxSpringQtyWidthAndLength(row) {
            if (Number(row.springid) > 0) {
                let _pricelistid = this.getPriceid();
                let _bednet = this.mainObject;
                // bednet.if_doublenet = Number(bednet.if_doublenet);
                // bednet.if_doublespring = Number(bednet.if_doublespring);
                // bednet.if_side_iron = Number(bednet.if_side_iron);
                // bednet.if_rsorwa = Number(bednet.if_rsorwa);
                // bednet.if_sponge_drilling = Number(bednet.if_sponge_drilling);
                // bednet.iffork = Number(bednet.iffork);
                // bednet.ifsaleout = Number(bednet.ifsaleout);
                // bednet.if_jb = Number(bednet.if_jb);
                // bednet.flag = Number(bednet.flag);
                _bednet.pricelistid = _pricelistid;

                let _bednetMxData = this.bednetMxData.map((item) => {
                    item.if_part = Number(item.if_part);
                    return item
                })

                $lj.postLJRequest("GetComputeSpring", {
                    token: $lj.getStorage("token"),
                    bednet: _bednet,
                    bednetMx: _bednetMxData,
                    spring: this.bednetMxSpringData
                }, function (res) {
                    if (!res.message) {
                        row.spring_qty_width = res.bednetMx[0].spring_qty_width;
                        row.spring_qty_length = res.bednetMx[0].spring_qty_length;

                        console.log(' row.spring_qty_width :>>>>>>>>>>>>>>>>>>>>>', JSON.stringify(row.spring_qty_width));
                        console.log(' row.spring_qty_length :>>>>>>>>>>>>>>>>>>>>>', JSON.stringify(row.spring_qty_length));
                    }
                })
            }
        },
        /**
         * ljGrid组件：单元格清除事件捕抓
         * @param param0 
         */
        handleGridClear({ column, row, index }) {
            console.log("handleGridCellClick==>column", JSON.stringify(column));
            console.log("handleGridCellClick==>row", JSON.stringify(row));
            console.log("handleGridCellClick==>index", index);
            if (!column) {
                return;
            }
            if (column.property == "fabrics2_mtrlid") {
                row.fabrics2_mtrlid = 0;
                row.fabrics2_price = 0;
            } else if (column.property == "fabrics1_mtrlid") {
                row.fabrics1_mtrlid = 0;
                row.fabrics1_price = 0;
            } else if (column.property == "springname") {
                row.springid = 0;
                row.springname = "";
            } else if (column.property == "hard_around_springname") {
                data.hard_around_springid = 0;
                data.hard_around_springname = "";
            }
        },
        /**
         * ljGrid组件：单元格点击事件捕抓
         * @param param0 
         */
        handleGridCellClick({ column, row, index }) {
            let self = this;
            console.log("handleGridCellClick==>column", JSON.stringify(column));
            console.log("handleGridCellClick==>row", JSON.stringify(row));
            console.log("handleGridCellClick==>index", index);
            if (!column) {
                return;
            }
            // if (column.editable) {
            //     return;
            // }
            if (column.property == "springname") {
                this.fnSelSpring({
                    arg_height: row.bednet_height,
                }, (item) => {
                    row.springid = item.springid;
                    row.springname = item.name;

                    self.setMxSpringQtyWidthAndLength(row)
                })
            } else if (column.property == "hard_around_springname") {
                // 四周加硬弹簧
                this.fnSelSpring({
                    arg_springtypeid: "11", // 默认选择国内分类
                }, (item) => {
                    row.hard_around_springid = item.springid;
                    row.hard_around_springname = item.name;
                })

            } else if (column.property == "if_hard_around") {
                // 是否四周加硬
                if (Number(row.if_hard_around) == 0) {
                    row.hard_around_springid = 0;
                    row.hard_around_springname = "";
                    row.hard_around_row = 0;
                }
            } else if (column.property == "if_side_iron") {
                // 是否边铁
                if (Number(row.if_side_iron) == 0) {
                    row.side_iron_qty = 0;
                }
            } else if (column.property == "fabrics2_mtrlid") {
                this.fnSelMtrldef({
                    arg_mtrltype: 2,
                }, (item) => {
                    row.fabrics2_mtrlid = item.mtrlid;
                    row.fabrics2_mtrlname = item.mtrlname;
                    row.fabrics2_price = item.pricelistprice;
                })
            } else if (column.property == "fabrics1_mtrlid") {
                this.fnSelMtrldef({
                    arg_mtrltype: 2,
                }, (item) => {
                    row.fabrics1_mtrlid = item.mtrlid;
                    row.fabrics1_mtrlname = item.mtrlname;
                    row.fabrics1_price = item.pricelistprice;
                })
            }
        },
        /**
         * ljGrid组件：单元格编辑事件捕抓
         * @param param0 
         */
        handleGridChange({ row, column, rowIndex }) {
            console.log("handleGridChange ==>column", JSON.stringify(column));
            console.log("handleGridChange ==>row", JSON.stringify(row));
            if (!column) {
                return;
            }
            if (column.field == "bednet_height") {
                this.setMxSpringQtyWidthAndLength(row);
            } else if (column.field == "spring_qty_width") {
                this.setMxSpringWidth(row);
            } else if (column.field == "spring_qty_length") {
                this.setMxSpringLength();
            }

        },
        /**
         * 基础信息模块：点击事件
         * @param param {column, row}
         */
        handleFormGroupCellClick({ column, row }) {
            console.log("handleFormGroupCellClick==>column", JSON.stringify(column));
            console.log("handleFormGroupCellClick==>row", JSON.stringify(row));
            if (!column) {
                return;
            }
            if (column.field == "mtrl_sponge_name") {
                this.fnSelMtrldef({
                    arg_mtrltype: 1,
                }, (item) => {
                    row.sponge_mtrlid = item.mtrlid;
                    row.sponge_price = item.pricelistprice;
                    row.mtrl_sponge_name = item.mtrlname;
                })
            } else if (column.field == "mtrl_sponge_tc_name") {
                this.fnSelMtrldef({
                    arg_mtrltype: 1,
                }, (item) => {
                    row.sponge_tc_mtrlid = item.mtrlid;
                    row.mtrl_sponge_tc_name = item.mtrlname;
                })
            } else if (column.field == "mtrl_felt_name") {
                // 上垫层材料
                this.fnSelMtrldef({
                    arg_mtrltype: 7,
                }, (item) => {
                    row.felt_mtrlid = item.mtrlid;
                    row.felt_price = item.pricelistprice;
                    row.mtrl_felt_name = item.mtrlname;
                    row.felt_qty = 1;
                })
            } else if (column.field == "mtrl_edge_name") {
                // 封边物料
                this.fnSelMtrldef({
                    arg_mtrltype: 7,
                }, (item) => {
                    row.edge_mtrlid = item.mtrlid;
                    row.edge_price = item.pricelistprice;
                    row.mtrl_edge_name = item.mtrlname;
                })
            } else if (column.field == "mtrl_felt_name") {
                // 上垫层材料
                this.fnSelMtrldef({
                    arg_mtrltype: 7,
                }, (item) => {
                    row.felt_mtrlid = item.mtrlid;
                    row.felt_price = item.pricelistprice;
                    row.mtrl_felt_name = item.mtrlname;
                    row.felt_qty = 1;
                })
            } else if (column.field == "mtrl_felt_x_name") {
                // 下垫层材料
                this.fnSelMtrldef({
                    arg_mtrltype: 7,
                }, (item) => {
                    row.felt_x_mtrlid = item.mtrlid;
                    row.mtrl_felt_x_name = item.mtrlname;
                    row.felt_x_qty = 1;
                })
            }
        },
        /**
         * 基础信息模块：清除事件
         * @param param {column, row}
         */
        handleFormGroupCellClear({ column, row }) {
            if (!column) {
                return;
            }
            if (column.field == "duo_qv_str") {
                this.handelChangeDuoqv(row.duo_qv_str, column.enum)
            } else if (column.field == "mtrl_edge_name") {
                row.edge_mtrlid = 0;
                row.edge_price = 0;
                row.mtrl_edge_name = "";
                row.edge_height = 0;
            } else if (column.field == "mtrl_felt_name") {
                row.felt_mtrlid = 0;
                row.felt_price = 0;
                row.mtrl_felt_name = "";
                row.felt_qty = 0;
                row.felt_dscrp = "";
            } else if (column.field == "mtrl_felt_x_name") {
                row.felt_x_mtrlid = 0;
                row.mtrl_felt_x_name = "";
                row.felt_x_qty = 0;
            }
        },
        /**
         * 基础信息模块：输入框/select/switch等组件值改变事件
         * @param param {column, row}
         */
        handleFormGroupChange({ column, row }) {
            if (!column) {
                return;
            }
            if (column.field == "bednettypeid") {
                this.wf_b_bednet_type_ch(row.bednettypeid)
            } else if (column.field == "duo_qv_str") {
                this.handelChangeDuoqv(row.duo_qv_str, column.enum)
            }
        },
        /**
         * @description 获取多区数据，数组化
         * @param item
         * @returns
         */
        getDuoquVal(item) {
            let arr = [];
            for (const key in item) {
                if (key.indexOf("area_") > -1) {
                    arr.push(Number(item[key]));
                }
            }
            // 忽略数组中尾部出现的多个0
            let i = arr.length - 1;
            while (arr[i] === 0) {
                i--;
            }
            arr = arr.slice(0, i + 1);

            return arr;
        },
        /**
         * @description 设置多区弹簧长度
         */
        setMxSpringLength() {
            // const { _mainData, enumMap } = state.LjDetailRef;

            // let duoEnum = enumMap.get("duo_qv_str");

            let item = this.duoQvStrEnum.find(t => t.value == this.mainObject.duo_qv_str);
            console.log("setMxSpringLength item :>> ", item);

            let arr = this.getDuoquVal(item);

            let totality = arr.reduce((a, b) => a + b, 0);

            let sum = Number(this.bednetMxData[0].spring_qty_length);
            console.log("arr, totality  :>> ", arr, totality, sum);

            let lengthValSum = 0;

            this.bednetMxSpringData.forEach((item, index) => {
                item.pid = index + 1;
                let lengthVal = 0;
                if (arr.length >= index + 1) {
                    console.log("index, arr.length  :>> ", index, arr.length);
                    if (index <= arr.length - 1) {
                        console.log("index == arr.length - 1 :>> ", index, arr.length - 1);
                        if (index == arr.length - 1) {
                            lengthVal = sum - lengthValSum;
                            console.log("lengthVal end:>> ", lengthVal, lengthValSum, sum);
                        } else {
                            lengthVal = $lj.numberFormat((arr[index] / totality) * sum, 0);
                            lengthValSum += Number(lengthVal);
                        }
                    } else {
                        lengthVal = 0;
                    }
                    console.log("lengthVal :>> ", lengthVal);
                }
                item.spring_qty_length = lengthVal;
            });

            // state.vxeTableMxSpringRef.element.updateFooter();
        },
        /**
         * @description 多区select，控制多区明细条数
         * @param val
         */
        handelChangeDuoqv(val, enumArr) {
            console.log("duo_qv_str val :>> ", val);
            let item = enumArr.find((item) => item.value == val);
            let arr = this.getDuoquVal(item);

            let num = arr.length;
            this.bednetMxData[0].if_part = Boolean(num > 1);

            if (num > 1) {
                this.bednetMxData[0].springid = 0;
                this.bednetMxData[0].springname = "";
                // nextTick(() => {
                // setTimeout(async () => {
                // console.log(
                //     "state.vxeTableMxSpringRef, state.vxeTableMxSpringRef.getTableData() :>> ",
                //     state.vxeTableMxSpringRef
                //     // state.vxeTableMxSpringRef.getTableData()
                // );
                // const $table = state.vxeTableMxSpringRef.element;
                // if ($table) {
                //     const { fullData: springData } = $table.getTableData();
                //     console.log("handleAreaChange fullData :>> ", springData, num > 0 && springData.length < num);

                if (this.bednetMxSpringData.length < num) {
                    let arr = [];
                    // let sum = Number(fullData[0].spring_qty_length);
                    // let lengthValSum = 0;
                    for (let i = 0; i < num - this.bednetMxSpringData.length; i++) {
                        // let lengthVal = 0;
                        // if (i < num - springData.length - 1) {
                        //   if (sum > 0) {
                        //     lengthVal = (areaArr[i] / total) * sum;
                        //     lengthValSum += lengthVal;
                        //   }
                        // } else {
                        //   lengthVal = sum - lengthValSum;
                        // }
                        // console.log("lengthVal :>> ", lengthVal);

                        let _data = {
                            ...dw_bednet_mx_spring,
                            spring_qty_width: Number(this.bednetMxData[0].spring_qty_width),
                            spring_qty_length: 0
                        };
                        arr.push(_data);
                    }
                    this.bednetMxSpringData = this.bednetMxSpringData.concat(arr).map((item, index) => {
                        item.pid = index + 1;
                        return item
                    })
                        ;
                    // console.log("$table :>> ", $table, arr);
                    // await $table.insertAt(arr, -1);
                } else if (this.bednetMxSpringData.length > num) {
                    // let arrs = springData.filter((item, index) => index + 1 > num);
                    // await $table.remove(arrs);
                    this.bednetMxSpringData = this.bednetMxSpringData.filter((item, index) => index + 1 <= num);
                }

                this.setMxSpringLength();
                // }
                // }, 200);
                // });
            } else {
                // 1
            }
        },
        /**
         * @description 清除运算结果
         */
        wf_clear() {
            this.mainObject.spring_mtrl_cost = 0;
            this.mainObject.spring_hr_cost = 0;
            this.mainObject.total_mtrl_cost = 0;
            this.mainObject.total_hr_cost = 0;
            this.mainObject.total_fees_cost = 0;
            this.mainObject.total_cost = 0;
            this.mainObject.nottax_factory_cost = 0;
            this.mainObject.nottax_dept_cost = 0;
            this.mainObject.dept_cost = 0;
            this.mainObject.foreign_cost = 0;
            this.mainObject.taxes = 0;
            this.mainObject.snake_wire_mtrl_cost = 0;
            this.mainObject.pocket_around_spring_cost = 0;
            this.mainObject.pocket_around_fabrics_cost = 0;
            this.mainObject.hard_around_mtrl_cost = 0;
            this.mainObject.hard_around_hr_cost = 0;
            this.mainObject.glue_price = 0;
            this.mainObject.felt_price = 0;
            this.mainObject.felt_mtrl_cost = 0;
            this.mainObject.felt_hr_cost = 0;
            this.mainObject.glue_mtrl_cost = 0;
            this.mainObject.fabrics1_mtrl_cost = 0;
            this.mainObject.fabrics2_mtrl_cost = 0;
            this.mainObject.side_iron_mtrl_cost = 0;
            this.mainObject.side_iron_hr_cost = 0;
            this.mainObject.side_iron_price = 0;
            this.mainObject.side_iron_lossrate = 0;
            this.mainObject.cnail_price = 0;
            this.mainObject.cnail_mtrl_cost = 0;
            this.mainObject.cnail_hr_cost = 0;
            this.mainObject.sponge_mtrl_cost = 0;
            this.mainObject.sponge_hr_cost = 0;
            this.mainObject.edge_mtrl_cost = 0;
            this.mainObject.edge_hr_cost = 0;
            this.mainObject.fork_mtrl_cost = 0;
            this.mainObject.fork_hr_cost = 0;
            this.mainObject.rsorwa_mtrl_cost = 0;
            this.mainObject.rsorwa_hr_cost = 0;
            this.mainObject.sponge_drilling_hr_cost = 0;
            this.mainObject.sponge_price = 0;
            this.mainObject.edge_price = 0;
            this.mainObject.fork_price = 0;
            this.mainObject.rsorwa_price = 0;
            this.mainObject.felt_mtrl_x_cost = 0;
            this.mainObject.packet_mtrl_cost = 0;
            this.mainObject.packet_hr_cost = 0;
            this.mainObject.sum_weight = 0;
            this.mainObject.spring_weight_qty = 0;
            this.mainObject.side_iron_weight_qty = 0;
            this.mainObject.hard_around_weight_qty = 0;
            this.mainObject.fabrics1_weight_qty = 0;
            this.mainObject.fabrics2_weight_qty = 0;
            this.mainObject.felt_weight_qty = 0;
            this.mainObject.cnail_weight_qty = 0;
            this.mainObject.sponge_weight_qty = 0;
            this.mainObject.sponge_weight_tc_qty = 0;
            this.mainObject.fork_weight_qty = 0;
            this.mainObject.edge_weight_qty = 0;
        },
        wf_set_if_doublespring() {

            let deptItem = this.deptEnum.find((item) => Number(item.value) == this.mainObject.deptid);
            let typeItem = this.bednettypeEnum.find((item) => Number(item.value) == this.mainObject.bednettypeid);

            console.log("typeItem :>> ", typeItem, deptItem);
            if (
                typeItem &&
                deptItem &&
                typeItem.label.indexOf("圆网") > -1 &&
                deptItem.label.indexOf("外贸") === -1 &&
                deptItem.label.indexOf("国外") === -1
            ) {
                this.mainObject.if_doublespring = 1;
            }
        },
        wf_check_rule() {
            if (!this.bednetMxSpringData.length) {
                return true;
            }
            let mxlist = this.bednetMxData;
            let springlist = this.bednetMxSpringData;

            for (let mx of mxlist) {
                //1.如果没有四周加硬   左边 弹簧个数排列宽   等于   右边每行  弹簧个数排列宽      ， 左边 弹簧个数排列长  等于  右边每行合计  弹簧个数排列长
                if (Number(mx.if_hard_around) === 0) {
                    // 左边 弹簧个数排列宽   等于   右边每行  弹簧个数排列宽
                    let sum_length = 0;
                    for (let spring of springlist) {
                        sum_length += parseFloat(spring.spring_qty_length);

                        if (Number(mx.spring_qty_width) != Number(spring.spring_qty_width)) {
                            throw new Error(`多区袋装明细列表,第${spring.pid}行,弹簧个数排列宽填写错误！`);
                        }
                    }

                    if (parseFloat(mx.spring_qty_length) != sum_length) {
                        throw new Error(
                            `床网明细列表 弹簧个数排列长${parseFloat(
                                mx.spring_qty_length
                            )}不等于 多区袋装明细列表 弹簧个数排列长合计${sum_length}！`
                        );
                    }
                } else if (Number(mx.if_hard_around) === 1) {
                    // 左边 弹簧个数排列宽   小于   右边每行  弹簧个数排列宽
                    let sum_length = 0;
                    for (let spring of springlist) {
                        sum_length += parseFloat(spring.spring_qty_length);

                        if (Number(mx.spring_qty_width) < Number(spring.spring_qty_width)) {
                            throw new Error(`多区袋装明细列表,第${spring.pid}行,弹簧个数排列宽填写错误！`);
                        }
                    }

                    //左边 弹簧个数排列长  小于  右边每行合计  弹簧个数排列长
                    if (parseFloat(mx.spring_qty_length) < sum_length) {
                        throw new Error(
                            `床网明细列表 弹簧个数排列长${parseFloat(
                                mx.spring_qty_length
                            )}小于 多区袋装明细列表 弹簧个数排列长合计${sum_length}！`
                        );
                    }
                }
            }

            return true;
        },
        async wf_check_required() {
            // const { _mainData, enumMap } = state.LjDetailRef;
            // let { fullData: mxlist } = state.vxeTableMxRef.element.getTableData();
            let mxlist = this.bednetMxData

            //检查有没有填写床网高
            for (let mx of mxlist) {
                if (mx.bednet_height + 0 == 0) {
                    throw new Error("请填写床网高");
                } else {
                    this.mainObject.mattress_height = parseFloat(mx.bednet_height);
                }
            }

            // 检查有没有 填写 填充海绵高
            if (this.mainObject.sponge_tc_mtrlid + 0 > 0) {
                if (this.mainObject.sponge_tc_thickness + 0 == 0) {
                    throw new Error("请填写填充海绵厚度!");
                }

                if (this.mainObject.sponge_tc_height + 0 == 0) {
                    throw new Error("请填写填充海绵厚度!");
                }

                if ((this.mainObject.sponge_tc_thickness + 0 > 0 || this.mainObject.sponge_tc_height + 0 > 0) && this.mainObject.sponge_tc_mtrlid + 0 == 0) {
                    throw new Error("请选择填充海绵物料!");
                }
            }

            // 如果 没有填写 海绵高和封边高  自动等于 床网高
            if (this.mainObject.sponge_mtrlid > 0 && this.mainObject.sponge_height + 0 <= 0) this.mainObject.sponge_height = this.mainObject.mattress_height;
            if (this.mainObject.edge_mtrlid > 0 && this.mainObject.edge_height + 0 <= 0) this.mainObject.edge_height = this.mainObject.mattress_height;

            this.mainObject.commission = this.mainObject.commission && Number(this.mainObject.commission) !== 0 ? this.mainObject.commission : 1;
            this.mainObject.taxrate = this.mainObject.taxrate && Number(this.mainObject.taxrate) !== 0 ? this.mainObject.taxrate : 1;
            this.mainObject.other_rate = this.mainObject.other_rate && Number(this.mainObject.other_rate) !== 0 ? this.mainObject.other_rate : 1;
            this.mainObject.moneyrate = this.mainObject.moneyrate && Number(this.mainObject.moneyrate) !== 0 ? this.mainObject.moneyrate : 1;

            if (Number(this.mainObject.commission) < 1) {
                throw new Error("佣金点数不能小于1!");
            }

            if (Number(this.mainObject.taxrate) < 1) {
                throw new Error("税率不能小于1!");
            }

            if (Number(this.mainObject.other_rate) < 1) {
                throw new Error("额外点数不能小于1!");
            }

            if (this.mainObject.packtype && this.mainObject.packtype.length > 0) {
                this.mainObject.packtype = this.mainObject.packtype.trim();

                if (this.mainObject.packtype != "不压不卷" && this.mainObject.packqty + 0 == 0) {
                    throw new Error("请填写包装数量!");
                }

                if (this.mainObject.packtype != "不压不卷" && this.mainObject.packtype != "裸包装" && this.mainObject.transport_type + "" == "") {
                    throw new Error("请选择运输方式!");
                }

                if (this.mainObject.packtype == "卷包" && this.mainObject.packmtrl + "" == "") {
                    throw new Error("请选择包装材料!");
                }
            }

            await this.wf_factory_profitrate();

            if (this.mainObject.dept_profitrate + 0 == 0) {
                throw new Error("部门利润率不能为0!");
            }

            if (this.mainObject.bednettypeid + 0 == 0) {
                throw new Error("请选择床网类别!");
            }

            if (this.mainObject.sponge_mtrlid + 0 > 0 && this.mainObject.sponge_thickness + 0 == 0) {
                throw new Error("请填写海绵厚度!");
            }

            if (this.mainObject.sponge_mtrlid + 0 == 0 && this.mainObject.sponge_thickness + 0 > 0) {
                throw new Error("请选择海绵物料!");
            }

            let typeItem = this.bednettypeEnum.find((item) => Number(item.value) == this.mainObject.bednettypeid);

            for (let mx of mxlist) {
                if (mx.bednet_height + 0 == 0) {
                    throw new Error(`第${mx.pid}行,请填写床网高!`);
                }
                if (mx.spring_qty_width + 0 == 0) {
                    throw new Error(`第${mx.pid}行,请填写弹簧排列个数-宽!`);
                }
                if (mx.spring_qty_length + 0 == 0) {
                    throw new Error(`第${mx.pid}行,请填写弹簧排列个数-长!`);
                }

                if (typeItem.label.indexOf("袋装网") > -1 && mx.fabrics1_mtrlid + 0 == 0) {
                    throw new Error(`第${mx.pid}行,请选择入袋无纺布!`);
                }

                if (mx.if_side_iron > 0 && mx.side_iron_qty + 0 == 0) {
                    throw new Error(`第${mx.pid}行,请填写边铁条数!`);
                }
            }

            return true;
        },
        /**
         * @description 获取部门利润率
         */
        async wf_factory_profitrate() {

            let depItem = this.deptEnum.find((item) => item.value == this.mainObject.deptid);
            console.log("depItem :>> ", depItem);
            if (depItem) {
                this.mainObject.dept_profitrate = parseFloat(depItem.profitrate);
            }

            let params = {
                arg_deptid: this.mainObject.deptid,
                arg_bednettypeid_mattresstypeid: this.mainObject.mattresstypeid,
                kind: 0
            }
            $lj.postCommonLJRequest("web_factory_profitratelist", params, "", (res) => {
                if (res && res.datatable && res.datatable.length > 0) {
                    this.mainObject.profitrate = parseFloat(res.datatable[0].profitrate);
                }
            })
        },
        async wf_cmp_cb() {

            this.wf_clear();

            this.wf_set_if_doublespring();

            if (!this.wf_check_rule()) return false;

            if (!(await this.wf_check_required())) return false;

            return true;
        },
        async gotoSave() {
            let self = this
            try {

                // const $table = vxeTableMxRef.value.element;
                // console.log("vxeTableMxRef $table :>> ", $table);
                // if ($table) {
                //     const errMap = await $table.validate(true);
                //     console.log("vxeTableMxRef errMap :>> ", errMap);
                //     if (errMap) {
                //         // VxeUI.modal.message({ status: 'error', content: '校验不通过！' })
                //         return false;
                //     }
                // }

                // const $tableSpring = vxeTableMxSpringRef.value?.element;
                // console.log("vxeTableMxRef $tableSpring :>> ", $tableSpring);
                // if ($tableSpring) {
                //     const errMap = await $tableSpring.validate(true);
                //     console.log("vxeTableMxRef errMap :>> ", errMap);
                //     if (errMap) {
                //         // VxeUI.modal.message({ status: 'error', content: '校验不通过！' })
                //         return false;
                //     }
                // }

                if (!(await this.wf_cmp_cb())) return;

                let bednet = this.mainObject;

                let bednetMx = this.bednetMxData;
                bednetMx[0].if_side_iron = Number(bednetMx[0].if_side_iron);
                bednetMx[0].if_part = Number(bednetMx[0].if_part);
                bednetMx[0].if_15strip = Number(bednetMx[0].if_15strip);
                bednetMx[0].if_pocket_around = Number(bednetMx[0].if_pocket_around);
                bednetMx[0].if_hard_around = Number(bednetMx[0].if_hard_around);

                let spring = this.bednetMxSpringData.length ? this.bednetMxSpringData : [];

                // if (orderStatus.value == "copy") {
                //     bednet.copy_id = bednet.bednetid;
                // }

                let _param_mf = {
                    token: $lj.getStorage("token"),
                    bednet,
                    bednetMx,
                    spring
                };
                try {
                    console.log("综合 _param_mf :>> ", JSON.stringify(_param_mf));

                    $lj.postLJRequest("SaveBedNet", _param_mf, function (res) {
                        if (res) {
                            self.$toast.success('保存成功');
                            if (self.winType == 3) {
                                $lj.sendEvent("mattress_edit_bednet", self.mainObject);
                            } else if (self.winType == 1) {
                                if (res.bednet.bednetid) {
                                    $lj.sendEvent("bednet_quote_mx_refresh");
                                }
                            } else {
                                // 新建或复制，打开明细页面
                                $lj.openWin("bedbet-quote-mx", {
                                    mainObject: res.bednet,
                                });
                            }
                            $lj.closeWin();
                            setTimeout(() => {
                                if (res.message) {
                                    // ElNotification({
                                    //     title: "计算失败",
                                    //     message: res.message,
                                    //     type: "warning"
                                    // });
                                    alert(res.message);
                                    self.$toast.fail("计算失败");
                                }
                            }, 100);
                        }
                    })
                    // await SaveBedNet(_param_mf)
                    //     .then(res => {
                    //         this.$toast.success('保存成功');
                    //         if (typeof props.bednetid != "undefined") {
                    //             // emit("aftersave", res);
                    //         } else {
                    //             if (res.bednet.bednetid) {
                    //                 tabRemove(route.fullPath);
                    //                 router.replace(`/bednetQuote/detail?id=${res.bednet.bednetid}`);
                    //             } else {
                    //                 router.replace("/bednetQuote");
                    //             }
                    //         }
                    //         setTimeout(() => {
                    //             if (res.message) {
                    //                 // ElNotification({
                    //                 //     title: "计算失败",
                    //                 //     message: res.message,
                    //                 //     type: "warning"
                    //                 // });
                    //                 alert(res.message);
                    //                 self.$toast.fail("计算失败");
                    //             }
                    //         }, 100);
                    //     })
                    //     .catch(error => {
                    //         console.log("error !! :>> ", error);
                    //     });
                } catch (error) {
                    self.$toast.fail("操作失败");
                }
            } catch (e) {
                self.$toast.fail(e.message);
            }
        },

    },
    computed: {
        isoutRep() {
            return this.mainObject.outrep == this.username;
        },
        isrestr3() {
            return this.mainObject.relstr_3 == this.username;
        }
    },
    filters: {
        enumFilter(data, arr) {
            let name = "";
            arr.forEach(itm => {
                if (Number(itm.value) == Number(data)) {
                    name = itm.label;
                }
            });
            return name
        }
    }
}
</script>
<style lang="less"></style>
