取消通过本地环境变量配置数据库链接字符串
This commit is contained in:
		
							parent
							
								
									91b37a6dbf
								
							
						
					
					
						commit
						9d8636881e
					
				| @ -11,7 +11,6 @@ | ||||
|     "FalconIIS": { | ||||
|       "commandName": "IISExpress", | ||||
|       "environmentVariables": { | ||||
|         "DbConnStr": "Server=.\\SQLSERVER2008R2;Database=ReportService;User ID=sa;Password=111", | ||||
|         "ASPNETCORE_ENVIRONMENT": "Development" | ||||
|       } | ||||
|     }, | ||||
|  | ||||
| @ -5,8 +5,13 @@ | ||||
|     <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile> | ||||
|   </PropertyGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <Content Remove="wwwroot\report\上传记录.html" /> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <None Include="..\.editorconfig" Link=".editorconfig" /> | ||||
|     <None Include="wwwroot\report\模板\上传记录.html" /> | ||||
|     <None Include="wwwroot\report\报表1.html" /> | ||||
|     <None Include="wwwroot\report\报表1.rpt.html" /> | ||||
|     <None Include="wwwroot\report\报表2.html" /> | ||||
|  | ||||
| @ -20,8 +20,7 @@ namespace ReportService | ||||
|         // This method gets called by the runtime. Use this method to add services to the container. | ||||
|         public void ConfigureServices(IServiceCollection services) { | ||||
| 
 | ||||
|             var connStr = Environment.GetEnvironmentVariable("DbConnStr") | ||||
|                 ??this.Configuration.GetValue<string>("Database:ReportService"); | ||||
|             var connStr = this.Configuration.GetValue<string>("Database:ReportService"); | ||||
|             services.AddDbContext<RSDbContext>(b => { | ||||
|                 b.UseSqlServer(connStr); | ||||
|             }); | ||||
|  | ||||
| @ -8,7 +8,7 @@ | ||||
|   }, | ||||
|   "AllowedHosts": "*", | ||||
|   "Database": { | ||||
|     "ReportService": "Server=.\\SQLSERVER2008R2;Database=ReportService;User ID=sa;Password=111" | ||||
|     "ReportService": "Server=.\\SQLSERVER2008R2;Database=EASY_HEALTHRECORDS;User ID=sa;Password=111" | ||||
|   }, | ||||
|   "urls": "http://*:9000;https://*:9001" | ||||
| } | ||||
|  | ||||
| @ -115,4 +115,32 @@ var myjs = { | ||||
|             window.open(this.uri + this.base64(this.format(this.template, ctx))); | ||||
|         }, | ||||
|     }, | ||||
| 
 | ||||
|     getUrlKey: function (name) { | ||||
|         return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null | ||||
|     }, | ||||
|     runSql: function (sqlStr, success) { | ||||
|         var option = { | ||||
|             method: "post", | ||||
|             headers: { | ||||
|                 'Content-Type': 'application/json', | ||||
|             }, | ||||
|             body: JSON.stringify({ sql: sqlStr, }) | ||||
|         }; | ||||
|         fetch("/RunSql", option) | ||||
|             .then(function (res) { return res.json(); }) | ||||
|             .then(function (d) { success(d) }) | ||||
|             .catch(function (r) { }); | ||||
|     }, | ||||
|     formatTimeToStr: function (times, pattern) { | ||||
|         if (times == null || times == "") { | ||||
|             return ""; | ||||
|         } | ||||
|         if (pattern) { | ||||
|             var d = new Date(times).Format(pattern); | ||||
|         } else { | ||||
|             var d = new Date(times).Format("yyyy-MM-dd hh:mm:ss"); | ||||
|         } | ||||
|         return d.toLocaleString(); | ||||
|     }, | ||||
| }; | ||||
| @ -1,86 +0,0 @@ | ||||
| <div id="findPerson"> | ||||
|     <div id="para" class="reportFilter"> | ||||
|         <input type="hidden" name="ProcedureName" v-model="ProcedureName" /> | ||||
|         <input type="hidden" name="reportName" v-model="reportName" /> | ||||
|         <input type="hidden" name="sqlStr" v-model="sqlStr" /> | ||||
|         <input type="hidden" name="uid" v-model="uid" /> | ||||
|         <input type="hidden" name="uName" v-model="uName" /> | ||||
|         <!--以下部分为查询条件,根据实际需要修改--> | ||||
|         <label>姓名:<input name="name" value="" placeholder="输入姓名或留空" /></label> | ||||
|         <label>地址:<textarea name="address" rows="4" placeholder="输入地址数据" /></label> | ||||
|         <label for="marry">婚姻</label> | ||||
|         <select id="marry" name="marry"> | ||||
|             <option value="1" selected="selected">男</option> | ||||
|             <option value="2">女</option> | ||||
|         </select> | ||||
|         <button class="btn btn-primary" v-on:click="find">查询</button> | ||||
|         <button class="btn btn-primary" v-on:click="print">打印</button> | ||||
|         <button class="btn btn-primary" v-on:click="down" v-if="result.length > 0">下载EXCEL</button> | ||||
|         <!--可修改部分结束--> | ||||
|     </div> | ||||
|     <div id="result" v-if="result.length > 0"> | ||||
|         <!--以下部分为存储过程返回数据,根据实际需要修改--> | ||||
|         <table class="table reportTable" id="resultTable"> | ||||
|             <thead> | ||||
|                 <tr> | ||||
|                     <th>姓名</th> | ||||
|                     <th>年龄</th> | ||||
|                     <th>性别</th> | ||||
|                     <th>登录用户编号</th> | ||||
|                     <th>登录用户名</th> | ||||
|                 </tr> | ||||
|             </thead> | ||||
|             <tbody> | ||||
|                 <tr v-for="i in result"> | ||||
|                     <td>{{i.name}}</td> | ||||
|                     <td>{{i.age}}</td> | ||||
|                     <td>{{i.sex}}</td> | ||||
|                     <td>{{i.uid}}</td> | ||||
|                     <td>{{i.Uname}}</td> | ||||
|                 </tr> | ||||
|             </tbody> | ||||
|         </table> | ||||
|         <!--可修改部分结束--> | ||||
|     </div> | ||||
| </div> | ||||
| 
 | ||||
| <script type="text/javascript"> | ||||
|     var findPerson = new Vue({ | ||||
|         el: "#findPerson", | ||||
|         data: { | ||||
|             //存储过程名称 | ||||
|             ProcedureName: "example", | ||||
|             //报表名称 | ||||
|             reportName: "报表1", | ||||
| 
 | ||||
|             //除非你知道以下数据含义,否则不要修改 | ||||
|             sqlStr: "", | ||||
|             url: myjs.urls.getresult, | ||||
|             result: [], | ||||
|             uid: "", | ||||
|             uName: "", | ||||
|         }, | ||||
|         created() { | ||||
|             this.uid = myjs.getUId(); | ||||
|             this.uName = myjs.getUName(); | ||||
|         }, | ||||
|         methods: { | ||||
|             find() { | ||||
|                 var sql = myjs.createSql("#para"); | ||||
|                 this.sqlStr = sql; | ||||
|                 console.log(sql); | ||||
|                 myjs.post(this.url, { sql: sql }, function (d) { | ||||
|                     findPerson.result = d; | ||||
|                 }); | ||||
|             }, | ||||
|             print() { | ||||
|                 var sql = myjs.createSql("#para"); | ||||
|                 this.sqlStr = sql; | ||||
|                 myjs.print(); | ||||
|             }, | ||||
|             down() { | ||||
|                 myjs.toExcel.tableToExcel("resultTable", this.reportName); | ||||
|             }, | ||||
|         } | ||||
|     }); | ||||
| </script> | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user