boardList.js 3.21 KB
layui.config({
    base: "/js/",
    version: 4444
}).use(["system", "vue"], function () {
    var form = layui.form,
        $ = layui.jquery,
        table = layui.table,
        element = layui.element,
        system = layui.system,
        sysU = new system.u(),
        areaName = "Board",
        tableName = "Board",
        vueApp = null;
    var app = {
        data: {
            tableIns: null,
           
        },
        methods: {
            initVue: function () {
                vueApp = new Vue({
                    el: '.boardApp',
                    data: {
                        contentList: []
                    },
                    methods: {
                        //设置线体是否工作日
                        setLineWork: (item) => {
                            var ajaxConfig = {
                                data: item,
                                url: `/${areaName}/${tableName}/SetCalendarLineList`,
                                success: function (result) {
                                    setTimeout(() => { app.methods.setFromHide(result); });
                                    app.methods.factoryCalendarViewDesc(vueApp.nowdate);
                                }
                            };
                            sysU.ajax(ajaxConfig);

                        },
                        setLineWorkAll: (selectAll) => {
                            vueApp.noProductiontime.forEach(x => {
                                x.Weekday = vueApp.selectAll;
                            });
                            var ajaxConfig = {
                                data: {
                                    datetime: vueApp.nowdate,
                                    lineCode: vueApp.noProductiontime.GetArrValue("lineCode"),
                                    Weekday: vueApp.selectAll
                                },
                                url: `/${areaName}/${tableName}/SetCalendarLineList`,
                                success: function (result) {
                                    app.methods.setFromHide(result);
                                }
                            };
                            sysU.ajax(ajaxConfig);
                        }
                    }
                });
            },

            //获取数据
            getBoardList: function () {
                var ajaxConfig = {
                    url: `/${areaName}/${tableName}/Load`,
                    success: function (result) {
                        if (sysU.successBefore(result)) return;
                         
                        setTimeout(() => {
                            vueApp.contentList = result.Count == 0 ? [] : result.Result;
                        });
                    }
                };
                sysU.ajax(ajaxConfig);
            },

            initForm: () => {
              
            },

 
        },
        registerEvent: function () {
            //自定义按钮执行公共方法
            system.query();
            system.queryExtend();
        },
        init: function () {
            app.methods.initVue();
            app.methods.initForm();
            app.methods.getBoardList();
        }
    };
    app.init();
});