Commit 73a8a424 by DESKTOP-732ATD8\BLT

增加功能:流水自动检测

parent db91d446
...@@ -7,8 +7,11 @@ namespace Bailun.DC.Models.Component.Enum ...@@ -7,8 +7,11 @@ namespace Bailun.DC.Models.Component.Enum
/// </summary> /// </summary>
public enum ColumnTypeEnum public enum ColumnTypeEnum
{ {
[Description("API")] /// <summary>
Api = 1, /// SQL(首次)
/// </summary>
[Description("SQL(首次)")]
SqlFirst = 1,
/// <summary> /// <summary>
/// SQL /// SQL
/// </summary> /// </summary>
...@@ -18,7 +21,12 @@ namespace Bailun.DC.Models.Component.Enum ...@@ -18,7 +21,12 @@ namespace Bailun.DC.Models.Component.Enum
/// 本地配置 /// 本地配置
/// </summary> /// </summary>
[Description("配置")] [Description("配置")]
Config = 3 Config = 3,
/// <summary>
/// API
/// </summary>
[Description("API")]
Api = 4,
} }
/// <summary> /// <summary>
......
...@@ -87,6 +87,26 @@ namespace Bailun.DC.Services.Component ...@@ -87,6 +87,26 @@ namespace Bailun.DC.Services.Component
{ {
switch (entity.ColumnType) switch (entity.ColumnType)
{ {
#region SQL
case ColumnTypeEnum.SqlFirst:
case ColumnTypeEnum.Sql:
DynamicParameters sqlparam = new DynamicParameters();
//过虑条件SQL
this.GetFilterSql(queryFilter, ref sqlparam);
//查询
using (var db = (entity.DataDB == DBEnum.DataWareHouse ? DW_DB : DB))
{
list = DB.Query<ColumnDTO>(entity.ColumnValue, sqlparam).ToList();
}
break;
#endregion
#region 本地配置
case ColumnTypeEnum.Config:
list = DeserializeCollection<ColumnDTO>(entity.ColumnValue).ToList();
break;
#endregion
#region 控制器函数/Webapi #region 控制器函数/Webapi
case ColumnTypeEnum.Api: case ColumnTypeEnum.Api:
/* /*
...@@ -141,28 +161,6 @@ namespace Bailun.DC.Services.Component ...@@ -141,28 +161,6 @@ namespace Bailun.DC.Services.Component
break; break;
#endregion #endregion
#region SQL
case ColumnTypeEnum.Sql:
DynamicParameters sqlparam = new DynamicParameters();
//过虑条件SQL
this.GetFilterSql(queryFilter, ref sqlparam);
//查询
using (var db = (entity.DataDB == DBEnum.DataWareHouse ? DW_DB : DB))
{
list = DB.Query<ColumnDTO>(entity.ColumnValue, sqlparam).ToList();
}
break;
#endregion
#region 本地配置
case ColumnTypeEnum.Config:
list = DeserializeCollection<ColumnDTO>(entity.ColumnValue).ToList();
break;
#endregion
default:
break;
} }
#region 报表表头下拉选项 #region 报表表头下拉选项
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
v-bind:clearable="item.clearable == null || item.clearable" v-bind:clearable="item.clearable == null || item.clearable"
v-bind:disabled="item.disabled == true || javaScript.call(this,item.disabled)" v-bind:disabled="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:loading="item.loading" v-bind:loading="loading || ploading"
v-bind:size="item.size || 'small'" v-bind:size="item.size || 'small'"
v-bind:multiple="item.multiple" v-bind:multiple="item.multiple"
v-bind:filterable="item.filterable == null || item.filterable" v-bind:filterable="item.filterable == null || item.filterable"
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
v-bind:icon="item.icon" v-bind:icon="item.icon"
v-bind:size="item.size || 'small'" v-bind:size="item.size || 'small'"
v-bind:type="item.buttonType" v-bind:type="item.buttonType"
v-bind:loading="loading" v-bind:loading="loading || ploading"
v-bind:disabled="item.disabled == true || javaScript.call(this,item.disabled)" v-bind:disabled="item.disabled == true || javaScript.call(this,item.disabled)"
v-on:click="($emit && $listeners && $listeners.click && $emit('click')) || javaScript.call(this,item.click)"> v-on:click="($emit && $listeners && $listeners.click && $emit('click')) || javaScript.call(this,item.click)">
{{item.name}} {{item.name}}
......
<el-container class="el-query-table" v-loading="loading || tableLoading"> <el-container class="el-query-table">
<el-header> <el-header>
<el-form ref="form" label-width="auto" size="medium"> <el-form ref="form" label-width="auto" size="medium">
<el-row v-bind:gutter="20"> <el-row v-bind:gutter="20">
...@@ -8,15 +8,17 @@ ...@@ -8,15 +8,17 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col class="el-form-button"> <el-col class="el-form-button">
<el-form-control v-if="setting.isShowSearchButton" v-bind:item="{type: 'button',name:'查询',buttonType:'primary',icon:'el-icon-search'}" v-on:click="onSearch" v-bind:loading="tableLoading"></el-form-control> <el-form-control v-if="setting.isShowSearchButton" v-bind:item="{type: 'button',name:'查询',buttonType:'primary',icon:'el-icon-search'}" v-on:click="onSearch" v-bind:ploading="loading"></el-form-control>
<el-form-control v-if="setting.isShowResetButton" v-bind:item="{type: 'button',name:'重置',icon:'el-icon-refresh-right'}" v-on:click="onReset" v-bind:loading="tableLoading"></el-form-control> <el-form-control v-if="setting.isShowResetButton" v-bind:item="{type: 'button',name:'重置',icon:'el-icon-refresh-right'}" v-on:click="onReset" v-bind:ploading="loading"></el-form-control>
<el-form-control v-if="setting.isShowExportButton" v-bind:item="{type: 'button',name:'导出',buttonType:'success',icon:'el-icon-download'}" v-on:click="onExport" v-bind:loading="tableLoading"></el-form-control> <el-form-control v-if="setting.isShowExportButton" v-bind:item="{type: 'button',name:'导出',buttonType:'success',icon:'el-icon-download'}" v-on:click="onExport" v-bind:ploading="loading"></el-form-control>
<el-form-control v-if="setting.isShowImportButton" v-bind:item="{type: 'button',name:'导入',icon:'el-icon-upload2'}" v-bind:loading="tableLoading"></el-form-control> <el-form-control v-if="setting.isShowImportButton" v-bind:item="{type: 'button',name:'导入',icon:'el-icon-upload2'}" v-bind:ploading="loading"></el-form-control>
<el-form-control v-for="(item,index) in setting.listOperateControl" v-bind:item="item" v-bind:key="index" v-bind:loading="tableLoading"></el-form-control> <el-form-control v-for="(item,index) in setting.listOperateControl" v-bind:item="item" v-bind:key="index" v-bind:ploading="loading"></el-form-control>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-header> </el-header>
<el-main v-loading="loading">
<el-container>
<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"
...@@ -102,11 +104,14 @@ ...@@ -102,11 +104,14 @@
v-on:pagination="onSearch"> v-on:pagination="onSearch">
</el-pagination> </el-pagination>
</el-footer> </el-footer>
</el-container>
</el-main>
</el-container> </el-container>
</script> </script>
<script type="text/x-template" id="elFormControl"> <script type="text/x-template" id="elFormControl">
@Html.PartialAsync("~/Areas/Component/Views/Control/Form.cshtml").Result @Html.PartialAsync("~/Areas/Component/Views/Control/Form.cshtml").Result
</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/vue/vue-interceptors.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">
...@@ -3,10 +3,14 @@ ...@@ -3,10 +3,14 @@
height: calc(100% - 40px); height: calc(100% - 40px);
} }
#app, #app .el-container.el-query-table.is-vertical { #app, #app .el-container.is-vertical {
height: 100%; height: 100%;
} }
#app .el-main .el-main {
margin: 0px;
}
.el-query-table .el-header, .el-query-table .el-header,
.el-query-table .el-main, .el-query-table .el-main,
.el-query-table .el-footer { .el-query-table .el-footer {
...@@ -134,7 +138,7 @@ ...@@ -134,7 +138,7 @@
} }
.el-picker-panel .el-picker-panel__shortcut { .el-picker-panel .el-picker-panel__shortcut {
width:auto; width: auto;
} }
.el-picker-panel [slot=sidebar] + .el-picker-panel__body, .el-picker-panel__sidebar + .el-picker-panel__body { .el-picker-panel [slot=sidebar] + .el-picker-panel__body, .el-picker-panel__sidebar + .el-picker-panel__body {
...@@ -166,5 +170,3 @@ ...@@ -166,5 +170,3 @@
.el-query-table .el-form-control .el-range-separator { .el-query-table .el-form-control .el-range-separator {
width: auto; width: auto;
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
value: { value: {
default: null default: null
}, },
loading: { ploading: {
type: Boolean, type: Boolean,
default: false default: false
} }
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
}, },
data() { data() {
return { return {
//加载
loading: false,
//值 //值
item_value: null, item_value: null,
//表单标题 //表单标题
...@@ -64,7 +66,6 @@ ...@@ -64,7 +66,6 @@
visibleChange(visible, item) { visibleChange(visible, item) {
var that = this var that = this
if (visible && item.api && (!item.listOption || item.listOption.length <= 1 || (that.form && item.prop && that.form[item.prop] && Array.isArray(that.form[item.prop]) && that.form[item.prop].length == item.listOption.length))) { if (visible && item.api && (!item.listOption || item.listOption.length <= 1 || (that.form && item.prop && that.form[item.prop] && Array.isArray(that.form[item.prop]) && that.form[item.prop].length == item.listOption.length))) {
that.$set(item, "loading", true)
var params = {} var params = {}
if (item.params) { if (item.params) {
var form = that.form var form = that.form
...@@ -84,7 +85,6 @@ ...@@ -84,7 +85,6 @@
}).then(function (response) { }).then(function (response) {
var result = response.data; var result = response.data;
if (response.status == 200 && result && (result.length || (result.data && result.data.length))) { if (response.status == 200 && result && (result.length || (result.data && result.data.length))) {
debugger
var listOptionValue = Array.isArray(result) ? result : (Array.isArray(result.data) ? result.data : result.data.list); var listOptionValue = Array.isArray(result) ? result : (Array.isArray(result.data) ? result.data : result.data.list);
if (listOptionValue && listOptionValue.length && (listOptionValue[0].constructor === String || listOptionValue[0].constructor === Number)) { if (listOptionValue && listOptionValue.length && (listOptionValue[0].constructor === String || listOptionValue[0].constructor === Number)) {
listOptionValue = listOptionValue.map(function (item, index) { listOptionValue = listOptionValue.map(function (item, index) {
...@@ -100,10 +100,8 @@ ...@@ -100,10 +100,8 @@
} }
} }
} }
that.$set(item, "loading", false)
}, function (error) { }, function (error) {
this.$message(error.statusText || " 未知错误!"); this.$message(error.statusText || " 未知错误!");
that.$set(item, "loading", false)
}); });
} }
}, },
......
...@@ -12,22 +12,9 @@ ...@@ -12,22 +12,9 @@
}, },
data: function () { data: function () {
return { return {
// 遮罩层
loading: false, loading: false,
tableLoading: false, isFirst: false,
radio: '', radio: '',
filterPosition: 0,
selectRowMethod: null,
operateColumnContent: null,
//当前选中行
currentRow: null,
//当前页数
currentPage: 1,
//每页条目个数
currentSize: 10,
total: 0,
query: {},
listButton: null,
listData: [], listData: [],
queryParams: {}, queryParams: {},
setting: {}, setting: {},
...@@ -50,6 +37,7 @@ ...@@ -50,6 +37,7 @@
//初始化数据 //初始化数据
onInitValue: function () { onInitValue: function () {
var that = this; var that = this;
that.isFirst = true;
window.getSelectItems = function () { window.getSelectItems = function () {
return that.getSelectItems(); return that.getSelectItems();
} }
...@@ -57,7 +45,6 @@ ...@@ -57,7 +45,6 @@
//获取配置信息 //获取配置信息
getConfig: function () { getConfig: function () {
var that = this; var that = this;
that.loading = true;
that.$http({ that.$http({
method: 'get', method: 'get',
url: "/Component/Query/Get", url: "/Component/Query/Get",
...@@ -89,10 +76,8 @@ ...@@ -89,10 +76,8 @@
} else { } else {
this.$message((!result.data && "配置错误") || (result.Message || " 未知错误!")); this.$message((!result.data && "配置错误") || (result.Message || " 未知错误!"));
} }
that.loading = false;
}, function (error) { }, function (error) {
this.$message(error.statusText || " 未知错误!"); this.$message(error.statusText || " 未知错误!");
that.loading = false;
}); });
}, },
//获取查询过虑条件 //获取查询过虑条件
...@@ -187,7 +172,6 @@ ...@@ -187,7 +172,6 @@
//查询字段 //查询字段
onSearchColumn: function (defaultValue) { onSearchColumn: function (defaultValue) {
var that = this; var that = this;
that.loading = true;
that.getQueryFilter(defaultValue); that.getQueryFilter(defaultValue);
that.$http.post("/Component/Query/GetListColumn", that.filterParams, { emulateJSON: true }).then(function (response) { that.$http.post("/Component/Query/GetListColumn", that.filterParams, { emulateJSON: true }).then(function (response) {
var result = response.data; var result = response.data;
...@@ -212,13 +196,11 @@ ...@@ -212,13 +196,11 @@
} }
}, function (error) { }, function (error) {
this.$message(error.statusText || " 未知错误!"); this.$message(error.statusText || " 未知错误!");
that.loading = false;
}); });
}, },
//查询数据 //查询数据
onSearchData: function (defaultValue) { onSearchData: function (defaultValue) {
var that = this; var that = this;
that.tableLoading = true;
that.getQueryFilter(defaultValue); that.getQueryFilter(defaultValue);
that.$http.post("/Component/Query/GetListData", that.filterParams, { emulateJSON: true }).then(function (response) { that.$http.post("/Component/Query/GetListData", that.filterParams, { emulateJSON: true }).then(function (response) {
var result = response.data; var result = response.data;
...@@ -228,32 +210,31 @@ ...@@ -228,32 +210,31 @@
} else { } else {
this.$message(result.message || " 未知错误!"); this.$message(result.message || " 未知错误!");
} }
that.tableLoading = false;
}, function (error) { }, function (error) {
this.$message(error.statusText || " 未知错误!"); this.$message(error.statusText || " 未知错误!");
that.tableLoading = false;
}); });
}, },
//查询 //查询
onSearch: function (defaultValue) { onSearch: function (defaultValue) {
var that = this; var that = this;
if (!that.setting || that.setting.columnType != 3) { //设置当前第一页
this.onSearchColumn(defaultValue); Vue.set(that.filterParams, 'currentPage', 1);
} //查询列头
this.onSearchData(defaultValue); if (!that.setting || (that.setting.columnType != 3 && !(!that.isFirst && that.setting.columnType == 1))) {
}, that.onSearchColumn(defaultValue);
search: function () { that.isFirst = false;
this.currentPage = 1; }
this.onSearchData(); that.onSearchData(defaultValue);
this.onSearchColumn(true);
//清空单选 //清空单选
this.radio = null; //this.radio = null;
this.row = null; //this.row = null;
this.$refs.dataTable.setCurrentRow(); //this.$refs.dataTable.setCurrentRow();
}, },
//重置 //重置
onReset: function () { onReset: function () {
var that = this; var that = this;
//设置首次标识
that.isFirst = true;
if (that.setting) { if (that.setting) {
//清空表格过虑值 //清空表格过虑值
if (that.setting.listColumn && that.setting.listColumn.length) { if (that.setting.listColumn && that.setting.listColumn.length) {
...@@ -271,12 +252,11 @@ ...@@ -271,12 +252,11 @@
//清空排序 //清空排序
that.$refs.table.clearSort(); that.$refs.table.clearSort();
Vue.set(that, 'filterParams', { currentPage: 1, pageSize: 10, ListOrder: null }); Vue.set(that, 'filterParams', { currentPage: 1, pageSize: 10, ListOrder: null });
this.onSearchData(); this.onSearch();
}, },
//导出 //导出
onExport: function () { onExport: function () {
var that = this; var that = this;
that.loading = true;
that.getQueryFilter(); that.getQueryFilter();
//异步请求 //异步请求
that.$http.post("/Component/Query/Export", that.filterParams, { emulateJSON: true }, { that.$http.post("/Component/Query/Export", that.filterParams, { emulateJSON: true }, {
...@@ -286,16 +266,15 @@ ...@@ -286,16 +266,15 @@
} }
}).then(function (json) { }).then(function (json) {
saveAs(json.bodyBlob, 'Export_' + (new Date().format("yyyyMMddhhmmss")) + '.xlsx'); saveAs(json.bodyBlob, 'Export_' + (new Date().format("yyyyMMddhhmmss")) + '.xlsx');
that.loading = false;
}).catch(function (error) { }).catch(function (error) {
that.$message(error.message || " 未知错误!"); that.$message(error.message || " 未知错误!");
that.loading = false;
}); });
}, },
//未实现预留
onButtonClick: function (fn) { onButtonClick: function (fn) {
var $confirm = this.$confirm; var $confirm = this.$confirm;
var $table = this.$refs.dataTable; var $table = this.$refs.dataTable;
switch (this.selectRowMethod) { switch (that.setting.selectRowMethod) {
case 1: case 1:
row = this.row; row = this.row;
break; break;
...@@ -307,6 +286,7 @@ ...@@ -307,6 +286,7 @@
eval(fn); eval(fn);
} }
}, },
//未实现预留
selectChange: function (f) { selectChange: function (f) {
var that = this; var that = this;
var childerFilter = that.listFilterControl.find(function (i) { var childerFilter = that.listFilterControl.find(function (i) {
...@@ -316,6 +296,7 @@ ...@@ -316,6 +296,7 @@
childerFilter.Values = []; childerFilter.Values = [];
} }
}, },
//未实现预留
loadOptions: function (visible, f) { loadOptions: function (visible, f) {
var that = this; var that = this;
if (visible == true) { if (visible == true) {
...@@ -388,7 +369,6 @@ ...@@ -388,7 +369,6 @@
Vue.set(this.filterParams, 'ListOrder', [{ Field: column.prop, Operator: column.order }]); Vue.set(this.filterParams, 'ListOrder', [{ Field: column.prop, Operator: column.order }]);
} else { } else {
Vue.set(this.filterParams, 'ListOrder', null); Vue.set(this.filterParams, 'ListOrder', null);
this.query.ListOrder = null;
} }
this.onSearchData(); this.onSearchData();
}, },
......
Vue.http.interceptors.push(function (request, next, a) {
var that = this;
that.loadCount = (that.loadCount || 0) + 1;
if (that.loading != true) {
//打开loading
Vue.set(this, "loading", true);
}
next(function (response) {
//调用完一个接口就进行-1
that.loadCount--;
//当接口都调用完时关闭loading
if (that.loadCount <= 0) {
that.loadCount = 0;
if (that.loading == true) {
Vue.set(this, "loading", false);
}
}
})
});
\ No newline at end of file
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