Commit b39883af by wish_lf

增加功能:流水自动检测

parent bd0d13ee
using Newtonsoft.Json; using Bailun.DC.Models.Component.Enum;
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
namespace Bailun.DC.Models.Component.DTO namespace Bailun.DC.Models.Component.DTO
...@@ -41,6 +42,11 @@ namespace Bailun.DC.Models.Component.DTO ...@@ -41,6 +42,11 @@ namespace Bailun.DC.Models.Component.DTO
public bool IsShowImportButton { get; set; } public bool IsShowImportButton { get; set; }
/// <summary> /// <summary>
/// 是否显示顺序列: 1:显示; 0:不显示
/// </summary>
public bool IsShowSequenceColumn { get; set; }
/// <summary>
/// 选择行方式:1: 单选, 2: 多选 /// 选择行方式:1: 单选, 2: 多选
/// </summary> /// </summary>
public int? SelectRowMethod { get; set; } public int? SelectRowMethod { get; set; }
...@@ -48,7 +54,7 @@ namespace Bailun.DC.Models.Component.DTO ...@@ -48,7 +54,7 @@ namespace Bailun.DC.Models.Component.DTO
/// <summary> /// <summary>
/// 列类型: 1: 控制器函数, 2: WebApi, 3:数据源编码, 4:SQL, 5:本地配置 /// 列类型: 1: 控制器函数, 2: WebApi, 3:数据源编码, 4:SQL, 5:本地配置
/// </summary> /// </summary>
public int? ColumnType { get; set; } public ColumnTypeEnum? ColumnType { get; set; }
/// <summary> /// <summary>
/// 列值 /// 列值
...@@ -69,7 +75,7 @@ namespace Bailun.DC.Models.Component.DTO ...@@ -69,7 +75,7 @@ namespace Bailun.DC.Models.Component.DTO
/// <summary> /// <summary>
/// 数据类型:1: 控制器函数, 2: WebApi, 3:数据库表或视图, 4:SQL /// 数据类型:1: 控制器函数, 2: WebApi, 3:数据库表或视图, 4:SQL
/// </summary> /// </summary>
public int? DataType { get; set; } public DataTypeEnum? DataType { get; set; }
/// <summary> /// <summary>
/// 数据值 /// 数据值
...@@ -78,6 +84,12 @@ namespace Bailun.DC.Models.Component.DTO ...@@ -78,6 +84,12 @@ namespace Bailun.DC.Models.Component.DTO
public string DataValue { get; set; } public string DataValue { get; set; }
/// <summary> /// <summary>
/// 数据库:1: 数据中心, 2: 交易流水
/// </summary>
[JsonIgnore]
public DBEnum? DataDB { get; set; }
/// <summary>
/// 数据默认排序SQL /// 数据默认排序SQL
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
......
using System; using Bailun.DC.Models.Component.Enum;
using System;
namespace Bailun.DC.Models.Component.Entity namespace Bailun.DC.Models.Component.Entity
{ {
...@@ -68,6 +69,11 @@ namespace Bailun.DC.Models.Component.Entity ...@@ -68,6 +69,11 @@ namespace Bailun.DC.Models.Component.Entity
public string operate_controls { get; set; } public string operate_controls { get; set; }
/// <summary> /// <summary>
/// 是否显示顺序列: 1:显示; 0:不显示
/// </summary>
public bool is_show_sequence_column { get; set; }
/// <summary>
/// 选择行方式:1: 单选, 2: 多选 /// 选择行方式:1: 单选, 2: 多选
/// </summary> /// </summary>
public int? select_row_method { get; set; } public int? select_row_method { get; set; }
...@@ -75,7 +81,7 @@ namespace Bailun.DC.Models.Component.Entity ...@@ -75,7 +81,7 @@ namespace Bailun.DC.Models.Component.Entity
/// <summary> /// <summary>
/// 列类型: 1: 控制器函数, 2: WebApi, 3:数据源编码, 4:SQL, 5:本地配置 /// 列类型: 1: 控制器函数, 2: WebApi, 3:数据源编码, 4:SQL, 5:本地配置
/// </summary> /// </summary>
public int? column_type { get; set; } public ColumnTypeEnum? column_type { get; set; }
/// <summary> /// <summary>
/// 列值 /// 列值
...@@ -100,7 +106,7 @@ namespace Bailun.DC.Models.Component.Entity ...@@ -100,7 +106,7 @@ namespace Bailun.DC.Models.Component.Entity
/// <summary> /// <summary>
/// 数据类型:1: 控制器函数, 2: WebApi, 3:数据库表或视图, 4:SQL /// 数据类型:1: 控制器函数, 2: WebApi, 3:数据库表或视图, 4:SQL
/// </summary> /// </summary>
public int? data_type { get; set; } public DataTypeEnum? data_type { get; set; }
/// <summary> /// <summary>
/// 列值 /// 列值
...@@ -113,6 +119,11 @@ namespace Bailun.DC.Models.Component.Entity ...@@ -113,6 +119,11 @@ namespace Bailun.DC.Models.Component.Entity
public string data_sort_sql { get; set; } public string data_sort_sql { get; set; }
/// <summary> /// <summary>
/// 数据库:1: 数据中心, 2: 交易流水
/// </summary>
public DBEnum? data_db { get; set; }
/// <summary>
/// 是否自动查询: 1:是; 0:否 /// 是否自动查询: 1:是; 0:否
/// </summary> /// </summary>
public bool is_auto_search { get; set; } public bool is_auto_search { get; set; }
......
...@@ -3,34 +3,21 @@ ...@@ -3,34 +3,21 @@
namespace Bailun.DC.Models.Component.Enum namespace Bailun.DC.Models.Component.Enum
{ {
/// <summary> /// <summary>
/// 列名类型:1:控制器函数,2:WEBAPI,3:数据源编码,4:SQL,5:本地配置 /// 列名类型:1:API,2:SQL,3:本地配置
/// </summary> /// </summary>
public enum ColumnTypeEnum public enum ColumnTypeEnum
{ {
/// <summary> [Description("API")]
/// 控制器函数 Api = 1,
/// </summary>
[Description("控制器函数")]
Controller = 1,
/// <summary>
/// WEBAPI
/// </summary>
[Description("WEBAPI")]
Webapi = 2,
/// <summary>
/// 数据源编码
/// </summary>
[Description("数据源编码")]
DataSourceCode = 3,
/// <summary> /// <summary>
/// SQL /// SQL
/// </summary> /// </summary>
[Description("SQL")] [Description("SQL")]
Sql = 4, Sql = 2,
/// <summary> /// <summary>
/// 本地配置 /// 本地配置
/// </summary> /// </summary>
[Description("本地配置")] [Description("配置")]
Config = 5 Config = 3
} }
} }
using System.ComponentModel;
namespace Bailun.DC.Models.Component.Enum
{
/// <summary>
/// 数据库:1: 数据中心, 2: 交易流水
/// </summary>
public enum DBEnum
{
/// <summary>
/// 数据中心
/// </summary>
[Description("数据中心")]
DataCenter = 1,
/// <summary>
/// 交易流水
/// </summary>
[Description("交易流水")]
DataWareHouse = 2
}
}
...@@ -3,39 +3,38 @@ ...@@ -3,39 +3,38 @@
namespace Bailun.DC.Models.Component.Enum namespace Bailun.DC.Models.Component.Enum
{ {
/// <summary> /// <summary>
/// 列名类型:1:控制器函数,2:WEBAPI,3:数据库表或视图,4:SQL,5:动态SQL,6:储存过程 /// 列名类型:1:Api,2:Sql,3:数据库表或视图,4:动态SQL,5:储存过程
/// </summary> /// </summary>
public enum DataTypeEnum public enum DataTypeEnum
{ {
/// <summary> /// <summary>
/// 控制器函数 /// API
/// </summary> /// </summary>
[Description("控制器函数")] [Description("Api")]
Controller = 1, Api = 1,
/// <summary> /// <summary>
/// WEBAPI /// SQL
/// </summary> /// </summary>
[Description("WEBAPI")] [Description("SQL")]
Webapi = 2, Sql = 2,
/// <summary> /// <summary>
/// 数据源编数据库表或视图码 /// 数据库表或视图
/// </summary> /// </summary>
[Description("数据库表或视图")] [Description("数据库表或视图")]
Table = 3, Table = 3,
/// <summary> /// <summary>
/// SQL /// 动态SQL
/// </summary>
[Description("SQL")]
Sql = 4,
/// <summary>
/// SQL
/// </summary> /// </summary>
[Description("动态SQL")] [Description("动态SQL")]
DynamicSql = 5, DynamicSql = 4,
/// <summary> /// <summary>
/// 储存过程 /// 储存过程
/// </summary> /// </summary>
[Description("储存过程")] [Description("储存过程")]
ExecuteSql = 6, ExecuteSql = 5,
} }
} }
...@@ -29,13 +29,9 @@ namespace Bailun.DC.Services.Component ...@@ -29,13 +29,9 @@ namespace Bailun.DC.Services.Component
dc_component_query entity = default(dc_component_query); dc_component_query entity = default(dc_component_query);
using (var db = DB) using (var db = DB)
{ {
if (db.State == System.Data.ConnectionState.Closed)
{
db.Open();
}
DynamicParameters sqlparam = new DynamicParameters(); DynamicParameters sqlparam = new DynamicParameters();
sqlparam.Add("code", code); sqlparam.Add("code", code);
entity = db.QueryFirst<dc_component_query>("select * from dc_component_query where is_delete = 0 and code = @code", sqlparam); entity = db.QueryFirstOrDefault<dc_component_query>("select * from dc_component_query where is_delete = 0 and code = @code", sqlparam);
} }
if (entity != null) if (entity != null)
{ {
...@@ -48,10 +44,12 @@ namespace Bailun.DC.Services.Component ...@@ -48,10 +44,12 @@ namespace Bailun.DC.Services.Component
IsShowResetButton = entity.is_show_reset_button, IsShowResetButton = entity.is_show_reset_button,
IsShowExportButton = entity.is_show_export_button, IsShowExportButton = entity.is_show_export_button,
IsShowImportButton = entity.is_show_import_button, IsShowImportButton = entity.is_show_import_button,
IsShowSequenceColumn = entity.is_show_sequence_column,
ColumnType = entity.column_type, ColumnType = entity.column_type,
ColumnValue = entity.column_value, ColumnValue = entity.column_value,
DataType = entity.data_type, DataType = entity.data_type,
DataValue = entity.data_value, DataValue = entity.data_value,
DataDB = entity.data_db,
DataSortSql = entity.data_sort_sql, DataSortSql = entity.data_sort_sql,
IsAutoSearch = entity.is_auto_search, IsAutoSearch = entity.is_auto_search,
SelectRowMethod = entity.select_row_method, SelectRowMethod = entity.select_row_method,
...@@ -64,7 +62,7 @@ namespace Bailun.DC.Services.Component ...@@ -64,7 +62,7 @@ namespace Bailun.DC.Services.Component
ListOperateColumnControl = !string.IsNullOrWhiteSpace(entity.operate_column_value) ? DeserializeCollection<ControlDTO>(entity.operate_column_value) : null, ListOperateColumnControl = !string.IsNullOrWhiteSpace(entity.operate_column_value) ? DeserializeCollection<ControlDTO>(entity.operate_column_value) : null,
}; };
//列 //列
if (dto.ColumnType == 5 && !string.IsNullOrWhiteSpace(entity.column_value)) if (dto.ColumnType == ColumnTypeEnum.Config && !string.IsNullOrWhiteSpace(entity.column_value))
{ {
dto.ListColumn = DeserializeCollection<ColumnDTO>(entity.column_value); dto.ListColumn = DeserializeCollection<ColumnDTO>(entity.column_value);
} }
...@@ -85,13 +83,12 @@ namespace Bailun.DC.Services.Component ...@@ -85,13 +83,12 @@ namespace Bailun.DC.Services.Component
if (queryFilter != null && !string.IsNullOrWhiteSpace(queryFilter.Code)) if (queryFilter != null && !string.IsNullOrWhiteSpace(queryFilter.Code))
{ {
QueryDTO entity = this.Get(queryFilter.Code); QueryDTO entity = this.Get(queryFilter.Code);
if (entity != null && (!string.IsNullOrWhiteSpace(entity.ColumnValue) || entity.ColumnType == (int)ColumnTypeEnum.Controller)) if (entity != null && (!string.IsNullOrWhiteSpace(entity.ColumnValue)))
{ {
switch (entity.ColumnType) switch (entity.ColumnType)
{ {
#region 控制器函数/Webapi #region 控制器函数/Webapi
case (int)ColumnTypeEnum.Controller: case ColumnTypeEnum.Api:
case (int)ColumnTypeEnum.Webapi:
/* /*
ValidateResult result = default(ValidateResult); ValidateResult result = default(ValidateResult);
Uri uri = HttpContext.Current.Request.Url; Uri uri = HttpContext.Current.Request.Url;
...@@ -143,48 +140,23 @@ namespace Bailun.DC.Services.Component ...@@ -143,48 +140,23 @@ namespace Bailun.DC.Services.Component
*/ */
break; break;
#endregion #endregion
#region 数据源编码
case (int)ColumnTypeEnum.DataSourceCode:
/*
var linq = from dataSource in this.DbContext.MSTB_OSMS_ONSITE_DATA_SOURCE
join dataSourceItems in this.DbContext.MSTB_OSMS_ONSITE_DATA_SOURCE_ITEMS on new { DataSourceCode = dataSource.Code, FieldType = (int?)FieldTypeEnum.Field, dataSource.RecordID, dataSource.Status } equals new { dataSourceItems.DataSourceCode, dataSourceItems.FieldType, dataSourceItems.RecordID, dataSourceItems.Status }
where dataSource.Code == entity.ColumnValue
&& dataSource.RecordID == recordId
&& dataSource.Status == (int)RecordStatus.Enabled
orderby dataSourceItems.Sort
select new ColumnDTO
{
Name = dataSourceItems.ViewFieldName,
Code = dataSourceItems.ViewField,
//Type = dataSourceItems.FieldDataType
};
list = linq.ToList();
*/
break;
#endregion
#region SQL #region SQL
case (int)ColumnTypeEnum.Sql: case ColumnTypeEnum.Sql:
DynamicParameters sqlparam = new DynamicParameters(); DynamicParameters sqlparam = new DynamicParameters();
//过虑条件SQL //过虑条件SQL
this.GetFilterSql(queryFilter, ref sqlparam); this.GetFilterSql(queryFilter, ref sqlparam);
//查询 //查询
using (var db = DB) using (var db = (entity.DataDB == DBEnum.DataWareHouse ? DW_DB : DB))
{ {
if (db.State == System.Data.ConnectionState.Closed)
{
db.Open();
}
list = DB.Query<ColumnDTO>(entity.ColumnValue, sqlparam).ToList(); list = DB.Query<ColumnDTO>(entity.ColumnValue, sqlparam).ToList();
} }
break; break;
#endregion #endregion
#region 本地配置 #region 本地配置
case (int)ColumnTypeEnum.Config: case ColumnTypeEnum.Config:
list = DeserializeCollection<ColumnDTO>(entity.ColumnValue).ToList(); list = DeserializeCollection<ColumnDTO>(entity.ColumnValue).ToList();
break; break;
#endregion #endregion
...@@ -258,13 +230,12 @@ namespace Bailun.DC.Services.Component ...@@ -258,13 +230,12 @@ namespace Bailun.DC.Services.Component
if (queryFilter != null && !string.IsNullOrWhiteSpace(queryFilter.Code)) if (queryFilter != null && !string.IsNullOrWhiteSpace(queryFilter.Code))
{ {
QueryDTO entity = this.Get(queryFilter.Code); QueryDTO entity = this.Get(queryFilter.Code);
if (entity != null && (!string.IsNullOrWhiteSpace(entity.DataValue) || entity.DataType == (int)DataTypeEnum.Controller || entity.DataType == (int)DataTypeEnum.DynamicSql)) if (entity != null && (!string.IsNullOrWhiteSpace(entity.DataValue)))
{ {
switch (entity.DataType) switch (entity.DataType)
{ {
#region 控制器函数/Webapi #region Api
case (int)DataTypeEnum.Controller: case DataTypeEnum.Api:
case (int)DataTypeEnum.Webapi:
/* /*
//Uri uri = HttpContext.Current.Request.Url; //Uri uri = HttpContext.Current.Request.Url;
//ValidateResult result = default(ValidateResult); //ValidateResult result = default(ValidateResult);
...@@ -322,25 +293,25 @@ namespace Bailun.DC.Services.Component ...@@ -322,25 +293,25 @@ namespace Bailun.DC.Services.Component
#endregion #endregion
#region 数据库表或视图/SQL #region 数据库表或视图/SQL
case (int)DataTypeEnum.Table: case DataTypeEnum.Table:
case (int)DataTypeEnum.Sql: case DataTypeEnum.Sql:
DynamicParameters sqlparam = new DynamicParameters(); DynamicParameters sqlparam = new DynamicParameters();
int fetch = (queryFilter.pageSize > 0 ? queryFilter.pageSize : int.MaxValue).Value; int fetch = (queryFilter.pageSize > 0 ? queryFilter.pageSize : int.MaxValue).Value;
int offset = (((queryFilter.CurrentPage > 1 ? queryFilter.CurrentPage : 1) - 1) * fetch).Value; int offset = (((queryFilter.CurrentPage > 1 ? queryFilter.CurrentPage : 1) - 1) * fetch).Value;
//过虑条件SQL //过虑条件SQL
string whereSql = this.GetFilterSql(queryFilter, ref sqlparam); string whereSql = this.GetFilterSql(queryFilter, ref sqlparam);
//排序条件SQL //排序条件SQL
string orderbySql = this.GetOrderBySql(queryFilter); string orderbySql = this.GetOrderBySql(queryFilter, entity);
string fromSql = $"FROM {(entity.DataType == (int)DataTypeEnum.Table ? $"[dbo].[{entity.DataValue}]" : $"( {entity.DataValue} )")} AS A {whereSql}"; string fromSql = $"FROM {(entity.DataType == DataTypeEnum.Table ? $"[dbo].[{entity.DataValue}]" : $"( {entity.DataValue} )")} AS A {whereSql}";
string totalSql = $"SELECT COUNT(*) {fromSql}"; string totalSql = $"SELECT COUNT(*) {fromSql}";
string dataSql = $"SELECT A.* {fromSql} ORDER BY {orderbySql} LIMIT {offset} , {fetch}"; string dataSql = $"SELECT A.* {fromSql} ORDER BY {orderbySql} LIMIT {offset} , {fetch}";
using (var db = DW_DB) using (var db = (entity.DataDB == DBEnum.DataWareHouse ? DW_DB : DB))
{ {
pageList.TotalCount = db.QueryFirst<int>(totalSql, sqlparam); pageList.TotalCount = db.QueryFirstOrDefault<int>(totalSql, sqlparam);
if (pageList.TotalCount > 0) if (pageList.TotalCount > 0)
{ {
var reader = db.ExecuteReader(dataSql, sqlparam); var reader = db.ExecuteReader(dataSql, sqlparam);
pageList.List.Load(reader); pageList.List.Load(reader);
} }
} }
break; break;
...@@ -349,7 +320,7 @@ namespace Bailun.DC.Services.Component ...@@ -349,7 +320,7 @@ namespace Bailun.DC.Services.Component
#region 动态SQL #region 动态SQL
case (int)DataTypeEnum.DynamicSql: case DataTypeEnum.DynamicSql:
/* /*
string sql = default(string); string sql = default(string);
uri = HttpContext.Current.Request.Url; uri = HttpContext.Current.Request.Url;
...@@ -624,7 +595,7 @@ namespace Bailun.DC.Services.Component ...@@ -624,7 +595,7 @@ namespace Bailun.DC.Services.Component
else else
{ {
IList<ColumnDTO> listColumn = default(IList<ColumnDTO>); IList<ColumnDTO> listColumn = default(IList<ColumnDTO>);
if (entity.ColumnType == (int)ColumnTypeEnum.Config) if (entity.ColumnType == ColumnTypeEnum.Config)
{ {
listColumn = DeserializeCollection<ColumnDTO>(entity.ColumnValue).ToList(); listColumn = DeserializeCollection<ColumnDTO>(entity.ColumnValue).ToList();
} }
......
...@@ -8,10 +8,6 @@ namespace Bailun.DC.Web.Areas.Component.Controllers ...@@ -8,10 +8,6 @@ namespace Bailun.DC.Web.Areas.Component.Controllers
[Area("Component")] [Area("Component")]
public class QueryController : Base.BaseController public class QueryController : Base.BaseController
{ {
public IActionResult Index()
{
return View();
}
[HttpGet] [HttpGet]
public JsonResult Get(string code = null) public JsonResult Get(string code = null)
......
using Bailun.DC.Models.Component.DTO;
using Bailun.DC.Services.Component;
using Microsoft.AspNetCore.Mvc;
using System;
namespace Bailun.DC.Web.Areas.Component.Controllers
{
[Area("Component")]
public class TableController : Base.BaseController
{
public IActionResult Index()
{
return View();
}
}
}
...@@ -39,13 +39,16 @@ ...@@ -39,13 +39,16 @@
v-bind:value="option[item.value] || option.value"> v-bind:value="option[item.value] || option.value">
</el-option> </el-option>
</el-select> </el-select>
<el-date-picker v-else-if="item.type == 'date'" <el-date-picker v-else-if="item.type == 'date' || item.type == 'daterange'"
v-model="item_value" v-model="item_value"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
v-bind:clearable="item.clearable == null || item.clearable" v-bind:clearable="item.clearable == null || item.clearable"
v-bind:disabled="disabled || (disabled == null && item.disabled != null && (item.disabled == true || javaScript.call(this,item.disabled)))" v-bind:disabled="disabled || (disabled == null && item.disabled != null && (item.disabled == true || javaScript.call(this,item.disabled)))"
v-bind:placeholder="item.placeholder || ('请选择' + (item.label || item.name || ''))" v-bind:placeholder="item.placeholder || ('请选择' + (item.label || item.name || ''))"
v-bind:size="item.size || 'small'" v-bind:size="item.size || 'small'"
type="date" v-bind:type="item.type"
value-format="yyyy/MM/dd" value-format="yyyy/MM/dd"
v-bind:picker-options="{shortcuts: [{text: '今天',onClick:function(picker) {picker.$emit('pick', new Date())}}]}"> v-bind:picker-options="{shortcuts: [{text: '今天',onClick:function(picker) {picker.$emit('pick', new Date())}}]}">
</el-date-picker> </el-date-picker>
......
@{
ViewData["Title"] = "自动对账面板";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "自动对账", "情况表" };
}
@section css{
<link href="@Url.Content("~/css/vue/v-cloak.css")" rel="stylesheet" />
<link href="@Url.Content("~/css/vue/element-ui-2.15.6.css")" rel="stylesheet" />
<link href="@Url.Content("~/css/component/query-table.css")" rel="stylesheet" />
}
@section scripts{
<script src="@Url.Content("~/js/vue/vue-2.6.14.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/vue/element-ui-2.15.6.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/vue/vue-resource.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/component/js.prototype.ex.js")" type="text/javascript"></script>
<script type="text/x-template" id="elQueryTable">
@Html.PartialAsync("~/Areas/Component/Views/Table/Query.cshtml").Result
</script>
<script>
$(document).ready(function () {
new Vue({
el: '#app',
data: {
code: getUrlParam("code")
}
})
})
</script>
}
<div id="app" v-cloak>
<el-query-table v-bind:code="code"></el-query-table>
</div>
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
<el-main> <el-main>
<el-table ref="table" <el-table ref="table"
class="form-table el-table--scrollable-y" class="form-table el-table--scrollable-y"
v-bind:data="listData"
row-key="onRowKey"
stripe stripe
border border
v-bind:data="listData"
v-bind:row-key="id"
v-bind:highlightCurrentRow="setting.selectRowMethod == 1" v-bind:highlightCurrentRow="setting.selectRowMethod == 1"
v-on:sort-change="onSortChange" v-on:sort-change="onSortChange"
v-on:selection-change="onSelectionChange" v-on:selection-change="onSelectionChange"
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
</el-radio> </el-radio>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="setting.showIndex" <el-table-column v-if="setting.isShowSequenceColumn"
type="index" type="index"
header-align="center" header-align="center"
v-bind:index="handleIndexCalc" v-bind:index="onSequenceIndex"
label="序号" label="序号"
width="60" width="60"
align="center" /> align="center" />
...@@ -110,5 +110,4 @@ ...@@ -110,5 +110,4 @@
</script> </script>
<script src="@Url.Content("~/js/component/xlsx.full.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/js/component/xlsx.full.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/component/file-saver.js")" type="text/javascript"></script> <script src="@Url.Content("~/js/component/file-saver.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/component/js.prototype.ex.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/component/query-table.js")" type="text/javascript"> <script src="@Url.Content("~/js/component/query-table.js")" type="text/javascript">
...@@ -14,25 +14,18 @@ ...@@ -14,25 +14,18 @@
<script src="@Url.Content("~/js/vue/vue-2.6.14.js")" type="text/javascript"></script> <script src="@Url.Content("~/js/vue/vue-2.6.14.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/vue/element-ui-2.15.6.js")" type="text/javascript"></script> <script src="@Url.Content("~/js/vue/element-ui-2.15.6.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/vue/vue-resource.js")" type="text/javascript"></script> <script src="@Url.Content("~/js/vue/vue-resource.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/component/js.prototype.ex.js")" type="text/javascript"></script>
<script type="text/x-template" id="elQueryTable"> <script type="text/x-template" id="elQueryTable">
@Html.PartialAsync("~/Areas/Component/Views/Table/Query.cshtml").Result @Html.PartialAsync("~/Areas/Component/Views/Table/Query.cshtml").Result
</script> </script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
new Vue({ new Vue({
el: '#app', el: '#app'
data: {
code: "test"
},
created() {
},
mounted() {
},
}) })
}) })
</script> </script>
} }
<div id="app" v-cloak> <div id="app" v-cloak>
<el-query-table v-bind:code="code"></el-query-table> <el-query-table code="dw_auto_check"></el-query-table>
</div> </div>
.wrapper.wrapper-content.animated.fadeInRight { .wrapper.wrapper-content.animated.fadeInRight,
.el-query-table .el-main .el-table .el-table__body-wrapper {
height: calc(100% - 40px); height: calc(100% - 40px);
} }
...@@ -16,11 +17,6 @@ ...@@ -16,11 +17,6 @@
padding-left: 10px; padding-left: 10px;
} }
.el-query-table .el-main .el-table .el-table__body-wrapper {
height: 100%
}
.el-query-table .el-form-item { .el-query-table .el-form-item {
margin-bottom: 0px; margin-bottom: 0px;
margin-top: 5px; margin-top: 5px;
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
that.onSearch(); that.onSearch();
} }
} else { } else {
this.$message(result.Message || " 未知错误!"); this.$message((!result.data && "配置错误") || (result.Message || " 未知错误!"));
} }
that.loading = false; that.loading = false;
}, function (error) { }, function (error) {
...@@ -108,13 +108,13 @@ ...@@ -108,13 +108,13 @@
that.setting.listFilterControl.forEach(function (l) { that.setting.listFilterControl.forEach(function (l) {
if (l.value) { if (l.value) {
var filter = { field: l.prop }; var filter = { field: l.prop };
//数据 //日期区间
if (l.value.constructor === Array && l.value == 2) { if (l.type == "daterange") {
filter.operator = "between"; filter.operator = "between";
filter.value = l.value.join(","); filter.value = l.value.join(",");
} }
//对象 //对象
else if (l.value.constructor === Object) { else if (l.value.constructor === Object || l.value.constructor === Array) {
filter.operator = "in"; filter.operator = "in";
filter.value = l.value.join(","); filter.value = l.value.join(",");
} }
...@@ -176,33 +176,31 @@ ...@@ -176,33 +176,31 @@
//查询字段 //查询字段
onSearchColumn: function (isRefreshListOption) { onSearchColumn: function (isRefreshListOption) {
var that = this; var that = this;
that.loading = true;
that.getQueryFilter(); that.getQueryFilter();
that.$http({ that.$http.post("/Component/Query/GetListColumn", that.filterParams, { emulateJSON: true }).then(function (response) {
method: 'post', var result = response.data;
url: SysUrl + "/DataSourceQuery/GetListColumn?code=" + that.code, if (response.status === 200 && result.result && result.data) {
data: that.query
}).then(function (resp) {
var result = resp.data;
if (resp.status === 200 && result.Result && result.Data) {
if (isRefreshListOption) { if (isRefreshListOption) {
if (result.Data && result.Data.length) { if (result.data && result.data.length) {
that.listColumn.forEach(function (l) { that.listColumn.forEach(function (l) {
var column = result.Data.find(function (l2) { var column = result.data.find(function (l2) {
return l.Code == l2.Code; return l.code == l2.code;
}); });
if (column) { if (column) {
Vue.set(l, "ListOption", column.ListOption); Vue.set(l, "listOption", column.listOption);
} }
}); });
} }
} else { } else {
Vue.set(that, "listColumn", result.Data); Vue.set(that.setting, "listColumn", result.data);
} }
} else { } else {
this.$message(result.Message || " 未知错误!"); this.$message(result.message || " 未知错误!");
} }
}, function (error) { }, function (error) {
this.$message(error); this.$message(error.statusText || " 未知错误!");
that.loading = false;
}); });
}, },
//查询数据 //查询数据
...@@ -227,7 +225,7 @@ ...@@ -227,7 +225,7 @@
//查询 //查询
onSearch: function () { onSearch: function () {
var that = this; var that = this;
if (!that.setting || that.setting.columnType != 5) { if (!that.setting || that.setting.columnType != 3) {
this.onSearchColumn(); this.onSearchColumn();
} }
this.onSearchData(); this.onSearchData();
...@@ -371,15 +369,6 @@ ...@@ -371,15 +369,6 @@
} }
} }
}, },
//绑定行KEY
onRowKey: function (obj) {
//多选绑定Key
var key = obj.ID
if (!key) {
key = JSON.stringify(obj);
}
return key;
},
//排序 //排序
onSortChange: function (column) { onSortChange: function (column) {
var that = this; var that = this;
...@@ -412,6 +401,10 @@ ...@@ -412,6 +401,10 @@
this.rows = selection this.rows = selection
this.$emit("selection-change", selection) this.$emit("selection-change", selection)
}, },
//顺序号
onSequenceIndex: function (index) {
return (this.filterParams.currentPage - 1) * this.filterParams.pageSize + index + 1;
},
/** 自定义JS */ /** 自定义JS */
javaScript(js, scope) { javaScript(js, scope) {
if (js) { if (js) {
......
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