Пример #1
0
        private void ExecuteTemplateVueIndex(TableInfo tableInfo, Context configContext, UniqueListInfo infos)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeFront)
            {
                return;
            }

            var pathOutput = PathOutputVue.PathOutputVueIndexViewComponent(tableInfo, configContext);

            if (File.Exists(pathOutput))
            {
                return;
            }

            var pathTemplate = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameVue.VueIndexComponent(tableInfo));
            var textTemplate = Read.AllText(tableInfo, pathTemplate, this._defineTemplateFolder);
            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplate);

            classBuilder = this.MakeGridClassBuilder(tableInfo, configContext, infos, classBuilder);

            using (var stream = new HelperStream(pathOutput).GetInstance()) { stream.Write(classBuilder); }
        }
Пример #2
0
        private void ExecuteTemplateVueRouter(TableInfo tableInfo, Context configContext)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeFront)
            {
                return;
            }

            var pathOutput = PathOutputVue.PathOutputVueRouterViewComponent(tableInfo, configContext);

            var pathTemplate = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameVue.VueRouterComponent(tableInfo));
            var textTemplate = Read.AllText(tableInfo, pathTemplate, this._defineTemplateFolder);
            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplate);

            var itens = string.Empty;

            foreach (var item in configContext.TableInfo)
            {
                var str = @"    { path: '" + item.ClassName.ToLower() + "', name: '" + (item.ClassNameFormated ?? item.ClassName) + "', component: function (resolve) { require(['@/views/" + item.ClassName.ToLower() + "'], resolve) } },";
                itens += string.Format("{0}{1}", str, System.Environment.NewLine);
            }

            classBuilder = classBuilder.Replace("<#pathsRoute#>", itens);

            using (var stream = new HelperStream(pathOutput).GetInstance()) { stream.Write(classBuilder); }
        }
Пример #3
0
        private void ExecuteTemplateVueEditComponent(TableInfo tableInfo, Context configContext)
        {
            if (!tableInfo.MakeFront)
            {
                return;
            }

            var pathOutput = PathOutputVue.PathOutputVueViewComponent(tableInfo, configContext, "edit");

            if (File.Exists(pathOutput))
            {
                return;
            }

            var pathTemplate = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameVue.VueEditComponent(tableInfo));
            var textTemplate = Read.AllText(tableInfo, pathTemplate, this._defineTemplateFolder);
            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplate);

            using (var stream = new StreamWriter(pathOutput)) { stream.Write(classBuilder); }
        }
Пример #4
0
        private void ExecuteTemplateVueFormCreateComponent(TableInfo tableInfo, Context configContext, UniqueListInfo infos)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }
            if (!tableInfo.MakeFront)
            {
                return;
            }

            var pathOutput = PathOutputVue.PathOutputVueViewComponent(tableInfo, configContext, "form-create");

            if (File.Exists(pathOutput))
            {
                return;
            }

            var pathTemplate = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameVue.VueCreateFormComponent(tableInfo));
            var textTemplate = Read.AllText(tableInfo, pathTemplate, this._defineTemplateFolder);
            var classBuilder = this.MakeFormClassBuilder(tableInfo, configContext, infos, textTemplate, "model");

            using (var stream = new StreamWriter(pathOutput)) { stream.Write(classBuilder); }
        }