Commit 729b54f6 authored by zhangboyang's avatar zhangboyang

table bug

parent 42488b87
...@@ -14,3 +14,4 @@ ...@@ -14,3 +14,4 @@
/MTM-Vue - 副本 /MTM-Vue - 副本
/FTT.Board.VueUI/board /FTT.Board.VueUI/board
/Product /Product
/MTM-zby
...@@ -76,34 +76,35 @@ export default { ...@@ -76,34 +76,35 @@ export default {
loadData() { loadData() {
if (!this.chart.IsShow) { if (!this.chart.IsShow) {
return; return;
} } else {
var me = this; var me = this;
var url = me.Api.url; var url = me.Api.url;
var data = { var data = {
ProcName: me.boardstore.ProcName, ProcName: me.boardstore.ProcName,
PageSize: me.chart.PageSize, PageSize: me.chart.PageSize,
PageIndex: me.chart.PageIndex, PageIndex: me.chart.PageIndex,
Flag: me.chart.Flag, Flag: me.chart.Flag,
WorkTeamID: me.chart.WorkTeamID, WorkTeamID: me.chart.WorkTeamID,
CharTypeID: me.chart.ChartType, CharTypeID: me.chart.ChartType,
ConnStr: me.boardstore.ConnectionString ConnStr: me.boardstore.ConnectionString
}; };
Axios({ Axios({
method: "post", method: "post",
url: url, url: url,
transformRequest: [ transformRequest: [
function(data) { function(data) {
return qs.stringify(data); return qs.stringify(data);
}
],
data: data
}).then(res => {
if (res.success) {
this.row = res.rows[0];
} else {
me.$message.error(res.message);
} }
], });
data: data }
}).then(res => {
if (res.success) {
this.row = res.rows[0];
} else {
me.$message.error(res.message);
}
});
} }
}, },
beforeDestroy() { beforeDestroy() {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div style="font-size:30px" :style="{color:chart.FontColor,background:chart.BackgroundColor}"> <div style="font-size:30px" :style="{color:chart.FontColor,background:chart.BackgroundColor}">
<div style="width:100%"> <div style="width:100%">
<table style="width:100%;height:100%"> <table style="width:100%;height:100%">
<tr> <tr style="height:8%">
<td <td
v-for="(item,index) in titlestore" v-for="(item,index) in titlestore"
class="tableclass" class="tableclass"
...@@ -56,17 +56,23 @@ export default { ...@@ -56,17 +56,23 @@ export default {
this.laodDataTime = (count - 5 <= 0 ? 0 : count - 5) * 1000; this.laodDataTime = (count - 5 <= 0 ? 0 : count - 5) * 1000;
} else { } else {
this.laodDataTime = this.laodDataTime =
(this.chart.PageSize * this.chart.RefreshTime - 5) * 1000; this.chart.PageSize * this.chart.RefreshTime - 5 <= 0
? 1000
: (this.chart.PageSize * this.chart.RefreshTime - 5) * 1000;
} }
// console.log("laodDataTime" + this.laodDataTime); // console.log("laodDataTime" + this.laodDataTime);
} }
}, },
laodDataTime: function(val, oldval) { laodDataTime: function(val, oldval) {
console.log("加载时间变化,new:" + val + " old:" + oldval);
if (val != oldval) { if (val != oldval) {
if (this.timer) { if (this.timer) {
this.timer = null;
console.log("第2次加载");
clearInterval(this.timer); clearInterval(this.timer);
this._loadDataInterval(); this._loadDataInterval();
} else { } else {
console.log("第3次加载");
this._loadDataInterval(); this._loadDataInterval();
} }
} }
...@@ -76,6 +82,7 @@ export default { ...@@ -76,6 +82,7 @@ export default {
// console.log("oldval: " + oldval); // console.log("oldval: " + oldval);
if (val != oldval) { if (val != oldval) {
if (this.timer1) { if (this.timer1) {
this.timer1 = null;
clearInterval(this.timer1); clearInterval(this.timer1);
this._itemRefreshTime(); this._itemRefreshTime();
} else { } else {
...@@ -114,20 +121,10 @@ export default { ...@@ -114,20 +121,10 @@ export default {
//获取数据定时器 //获取数据定时器
_loadDataInterval() { _loadDataInterval() {
var me = this; var me = this;
//换页 clearInterval(this.timer);
if (this.chart.RefreshType == 1) { if (this.timer == null) {
// this.laodDataTime =(this.chart.PageSize / this.chart.RefreshTime - 5) * 1000;
this.timer = setInterval(function() { this.timer = setInterval(function() {
console.log("获取数据" + me.laodDataTime); console.log("获取数据时间:" + me.laodDataTime);
// console.log(new Date());
_this.loadData();
}, me.laodDataTime);
}
//换行
if (this.chart.RefreshType == 2) {
// this.laodDataTime =(this.chart.PageSize / this.chart.RefreshTime - 5) * 1000;
this.timer = setInterval(function() {
console.log("获取数据" + me.laodDataTime);
// console.log(new Date()); // console.log(new Date());
_this.loadData(); _this.loadData();
}, me.laodDataTime); }, me.laodDataTime);
...@@ -138,6 +135,7 @@ export default { ...@@ -138,6 +135,7 @@ export default {
if (!this.chart.IsShow) { if (!this.chart.IsShow) {
return; return;
} }
console.log("加载数据");
var url = me.Api.url; var url = me.Api.url;
var data = { var data = {
ProcName: me.boardstore.ProcName, ProcName: me.boardstore.ProcName,
...@@ -165,15 +163,19 @@ export default { ...@@ -165,15 +163,19 @@ export default {
} else { } else {
me.pageindex++; me.pageindex++;
} }
if (this.chart.RefreshType == 2) {
if (this.itemdata.length == 0) { if (this.itemdata.length == 0) {
this.loadData(); this.loadData();
var data = me._changeDataType(res.rows); var data = me._changeDataType(res.rows);
data.forEach(item => { data.forEach(item => {
this.itemdata.push(item); this.itemdata.push(item);
}); });
} else { } else {
this._getData(res.rows); this._getData(res.rows);
}
}
if (this.chart.RefreshType == 1) {
this.itemdata = me._changeDataType(res.rows);
} }
} else { } else {
console.log(res.message); console.log(res.message);
...@@ -201,7 +203,6 @@ export default { ...@@ -201,7 +203,6 @@ export default {
var me = this; var me = this;
var data = me._changeDataType(rows); var data = me._changeDataType(rows);
if (this.chart.RefreshType == 2) { if (this.chart.RefreshType == 2) {
for (let index = 0; index < data.length; index++) { for (let index = 0; index < data.length; index++) {
let element = data[index]; let element = data[index];
...@@ -209,6 +210,7 @@ export default { ...@@ -209,6 +210,7 @@ export default {
} }
// _this.bodystore= _this.bodystore.uniquetwo(); // _this.bodystore= _this.bodystore.uniquetwo();
} else if (this.chart.RefreshType == 1) { } else if (this.chart.RefreshType == 1) {
debugger;
this.bodystore = data; this.bodystore = data;
} }
}, },
...@@ -253,6 +255,7 @@ export default { ...@@ -253,6 +255,7 @@ export default {
this.itemdata.push(rowdata); this.itemdata.push(rowdata);
this.itemdata.shift(); //移除第一条 this.itemdata.shift(); //移除第一条
} else if (this.chart.RefreshType == 1) { } else if (this.chart.RefreshType == 1) {
debugger;
this.itemdata = this.bodystore; this.itemdata = this.bodystore;
} }
} }
...@@ -269,20 +272,20 @@ export default { ...@@ -269,20 +272,20 @@ export default {
created() { created() {
_this = this; _this = this;
this.loadData(); this.loadData();
// var time =
// (this.chart.RefreshTime != 0
// ? this.chart.RefreshTime
// : this.boardstore.RefreshTime) * 1000;
this.laodDataTime = this.laodDataTime =
(this.chart.RefreshTime != 0 (this.chart.RefreshTime != 0
? this.chart.RefreshTime ? this.chart.RefreshTime
: this.boardstore.RefreshTime) * 1000; : this.boardstore.RefreshTime) * 1000;
_this._loadDataInterval();
//执行换行/换页程序
setTimeout(() => { setTimeout(() => {
_this._itemRefreshTime(); console.log("第一次加载");
}, 3000); _this._loadDataInterval();
}, 1000);
if (this.chart.RefreshType == 2) {
//执行换行/换页程序
setTimeout(() => {
_this._itemRefreshTime();
}, 3000);
}
} }
}; };
</script> </script>
......
using FTT.Board.Common;
using FTT.Board.EF;
using System.Linq;
using System.Web.Http;
namespace FTT.Board.Controllers
{
public class Chart1Controller : ApiController
{
/// <summary>
///
/// </summary>
/// <returns></returns>
[System.Web.Http.HttpGet]
public CharPanle Get(int PageSize, int PageIndex, int Flag, int WorkTeamID)
{
CharPanle main= new CharPanle();
using (var db = MsSqlDbContextWraper.NewContext())
{
using (var command = db.MultiResultSql)
{
main = command.Sql("Exec SP_RPT_ProductionPlan @PageSize,@PageIndex,@Flag,@WorkTeamID")
.Parameter("PageSize", PageSize).Parameter("PageIndex", PageIndex).Parameter("Flag", Flag).Parameter("WorkTeamID", WorkTeamID)
.QuerySingle<CharPanle>();
if (main != null) main.Detail = command.QueryMany<NameValue>().ToList();
}
}
return main;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
[System.Web.Http.HttpGet]
public string GetTitle(int PageSize, int PageIndex, int Flag, int WorkTeamID)
{
using (var db = MsSqlDbContextWraper.NewContext())
{
using (var command = db.MultiResultSql)
{
return command.Sql("Exec SP_RPT_ProductionPlan @PageSize,@PageIndex,@Flag,@WorkTeamID")
.Parameter("PageSize", PageSize).Parameter("PageIndex", PageIndex).Parameter("Flag", Flag).Parameter("WorkTeamID", WorkTeamID)
.QuerySingle<string>();
}
}
return null;
} /// <summary>
///
/// </summary>
/// <returns></returns>
[System.Web.Http.HttpGet]
public string GetNotice(int PageSize, int PageIndex, int Flag, int WorkTeamID)
{
using (var db = MsSqlDbContextWraper.NewContext())
{
return db.Sql("Exec SP_RPT_ProductionPlan @PageSize,@PageIndex,@Flag,@WorkTeamID")
.Parameter("PageSize", PageSize).Parameter("PageIndex", PageIndex).Parameter("Flag", Flag).Parameter("WorkTeamID", WorkTeamID)
.QuerySingle<string>();
}
return null;
}
///
/// </summary>
/// <returns></returns>
[System.Web.Http.HttpGet]
public string dynamic()
{
using (var db = MsSqlDbContextWraper.NewContext())
{
return db.Sql("Select * From sys.object")
.QuerySingle<dynamic>();
}
return null;
}
}
}
...@@ -164,7 +164,6 @@ ...@@ -164,7 +164,6 @@
<Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" /> <Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" />
<Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" /> <Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />
<Compile Include="Controllers\API\CFG\CFG_BoardController.cs" /> <Compile Include="Controllers\API\CFG\CFG_BoardController.cs" />
<Compile Include="Controllers\Chart1Controller.cs" />
<Compile Include="Controllers\ChartController.cs" /> <Compile Include="Controllers\ChartController.cs" />
<Compile Include="Controllers\API\CFG\CFG_BoardDetailController.cs" /> <Compile Include="Controllers\API\CFG\CFG_BoardDetailController.cs" />
<Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\HomeController.cs" />
...@@ -231,6 +230,7 @@ ...@@ -231,6 +230,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
<Folder Include="Content\images\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="fonts\glyphicons-halflings-regular.woff2" /> <Content Include="fonts\glyphicons-halflings-regular.woff2" />
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<add key="webpages:Enabled" value="false" /> <add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" /> <add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="db" value="Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=FTT_Board;Data Source=192.168.1.204" /> <!--<add key="db" value="Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=FTT_Board;Data Source=192.168.1.204" />-->
<add key="db" value="Password=a*1;Persist Security Info=True;User ID=sa;Initial Catalog=FTT_MES;Data Source=122.226.244.210,1800" />
</appSettings> </appSettings>
<connectionStrings> <connectionStrings>
<add name="BoardModelContainer" connectionString="metadata=res://*/BoardModel.csdl|res://*/BoardModel.ssdl|res://*/BoardModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.1.204;initial catalog=FTT_Board;persist security info=True;user id=sa;password=sa;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> <add name="BoardModelContainer" connectionString="metadata=res://*/BoardModel.csdl|res://*/BoardModel.ssdl|res://*/BoardModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.1.204;initial catalog=FTT_Board;persist security info=True;user id=sa;password=sa;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment