Commit 73a8a424 by DESKTOP-732ATD8\BLT

增加功能:流水自动检测

parent db91d446
......@@ -7,8 +7,11 @@ namespace Bailun.DC.Models.Component.Enum
/// </summary>
public enum ColumnTypeEnum
{
[Description("API")]
Api = 1,
/// <summary>
/// SQL(首次)
/// </summary>
[Description("SQL(首次)")]
SqlFirst = 1,
/// <summary>
/// SQL
/// </summary>
......@@ -18,7 +21,12 @@ namespace Bailun.DC.Models.Component.Enum
/// 本地配置
/// </summary>
[Description("配置")]
Config = 3
Config = 3,
/// <summary>
/// API
/// </summary>
[Description("API")]
Api = 4,
}
/// <summary>
......
......@@ -87,6 +87,26 @@ namespace Bailun.DC.Services.Component
{
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
case ColumnTypeEnum.Api:
/*
......@@ -140,29 +160,7 @@ namespace Bailun.DC.Services.Component
*/
break;
#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;
#endregion
}
#region 报表表头下拉选项
......
......@@ -27,7 +27,7 @@
v-bind:clearable="item.clearable == null || item.clearable"
v-bind:disabled="item.disabled == true || javaScript.call(this,item.disabled)"
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:multiple="item.multiple"
v-bind:filterable="item.filterable == null || item.filterable"
......@@ -97,7 +97,7 @@
v-bind:icon="item.icon"
v-bind:size="item.size || 'small'"
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-on:click="($emit && $listeners && $listeners.click && $emit('click')) || javaScript.call(this,item.click)">
{{item.name}}
......
<el-container class="el-query-table" v-loading="loading || tableLoading">
<el-container class="el-query-table">
<el-header>
<el-form ref="form" label-width="auto" size="medium">
<el-row v-bind:gutter="20">
......@@ -8,105 +8,110 @@
</el-form-item>
</el-col>
<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.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.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.isShowImportButton" v-bind:item="{type: 'button',name:'导入',icon:'el-icon-upload2'}" 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: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: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:ploading="loading"></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:ploading="loading"></el-form-control>
</el-col>
</el-row>
</el-form>
</el-header>
<el-main>
<el-table ref="table"
class="form-table el-table--scrollable-y"
stripe
border
v-bind:data="listData"
v-bind:highlightCurrentRow="setting.selectRowMethod == 1"
v-on:sort-change="onSortChange"
v-on:selection-change="onSelectionChange"
v-on:select="(selection, row)=> onRowClick(row)"
v-on:select-all="(selection)=> onRowClick()"
v-on:row-click="onRowClick"
v-on:current-change="setting.selectRowMethod == 1 && onCurrentChange">
<el-table-column v-if="setting.selectRowMethod == 2"
header-align="center"
type="selection"
width="40"
v-bind:reserve-selection="true">
</el-table-column>
<el-table-column v-else-if="setting.selectRowMethod == 1 && (showRadioColumn == null || showRadioColumn)"
header-align="center"
width="35"
label-class-name="el-radio-column"
class-name="el-radio-column">
<template slot-scope="scope">
<el-radio v-model="rowValue" v-bind:label="scope.row.id">
&nbsp;
</el-radio>
</template>
</el-table-column>
<el-table-column v-if="setting.isShowSequenceColumn"
type="index"
header-align="center"
v-bind:index="onSequenceIndex"
label="序号"
width="60"
align="center" />
<el-table-column v-if="setting.listOperateColumnControl && setting.listOperateColumnControl.length > 0"
v-bind:label="setting.operateColumnName || '操作'"
header-align="center"
v-bind:show-overflow-tooltip="setting.showTooltip"
v-bind:width="setting.operateColumnWidth || 80">
<template slot-scope="scope">
<el-form-control v-for="(operateColumn,index) in setting.listOperateColumnControl"
class="inline"
v-bind:key="index"
v-bind:item="operateColumn"
v-bind:disabled="operateColumn.disabled != null && (operateColumn.disabled == true || javaScript.call(setting,operateColumn.disabled,scope))"
v-model="scope.row[operateColumn.prop]"
v-on:click="javaScript.call(scope,operateColumn.click,scope)"
v-on:change="javaScript.call(scope,operateColumn.change,scope)">
</el-form-control>
</template>
</el-table-column>
<template v-for="(column,index) in setting.listColumn">
<el-table-column header-align="center"
v-bind:sortable="column.sortable == null || column.sortable ? 'custom' : false"
v-bind:prop="column.prop"
v-bind:show-overflow-tooltip="setting.showTooltip"
v-bind:label="column.name"
v-bind:key="index"
v-bind:width="column.width || ''"
v-bind:min-width="!column.width && ((column.name || ' ').length * 15 + 45)">
<template slot-scope="scope">
<el-form-control v-bind:item="column"
v-model="scope.row[column.prop]"
v-on:click="javaScript.call(scope,column.click,scope)"
v-on:change="javaScript.call(scope,column.change,scope)">
</el-form-control>
<el-main v-loading="loading">
<el-container>
<el-main>
<el-table ref="table"
class="form-table el-table--scrollable-y"
stripe
border
v-bind:data="listData"
v-bind:highlightCurrentRow="setting.selectRowMethod == 1"
v-on:sort-change="onSortChange"
v-on:selection-change="onSelectionChange"
v-on:select="(selection, row)=> onRowClick(row)"
v-on:select-all="(selection)=> onRowClick()"
v-on:row-click="onRowClick"
v-on:current-change="setting.selectRowMethod == 1 && onCurrentChange">
<el-table-column v-if="setting.selectRowMethod == 2"
header-align="center"
type="selection"
width="40"
v-bind:reserve-selection="true">
</el-table-column>
<el-table-column v-else-if="setting.selectRowMethod == 1 && (showRadioColumn == null || showRadioColumn)"
header-align="center"
width="35"
label-class-name="el-radio-column"
class-name="el-radio-column">
<template slot-scope="scope">
<el-radio v-model="rowValue" v-bind:label="scope.row.id">
&nbsp;
</el-radio>
</template>
</el-table-column>
<el-table-column v-if="setting.isShowSequenceColumn"
type="index"
header-align="center"
v-bind:index="onSequenceIndex"
label="序号"
width="60"
align="center" />
<el-table-column v-if="setting.listOperateColumnControl && setting.listOperateColumnControl.length > 0"
v-bind:label="setting.operateColumnName || '操作'"
header-align="center"
v-bind:show-overflow-tooltip="setting.showTooltip"
v-bind:width="setting.operateColumnWidth || 80">
<template slot-scope="scope">
<el-form-control v-for="(operateColumn,index) in setting.listOperateColumnControl"
class="inline"
v-bind:key="index"
v-bind:item="operateColumn"
v-bind:disabled="operateColumn.disabled != null && (operateColumn.disabled == true || javaScript.call(setting,operateColumn.disabled,scope))"
v-model="scope.row[operateColumn.prop]"
v-on:click="javaScript.call(scope,operateColumn.click,scope)"
v-on:change="javaScript.call(scope,operateColumn.change,scope)">
</el-form-control>
</template>
</el-table-column>
<template v-for="(column,index) in setting.listColumn">
<el-table-column header-align="center"
v-bind:sortable="column.sortable == null || column.sortable ? 'custom' : false"
v-bind:prop="column.prop"
v-bind:show-overflow-tooltip="setting.showTooltip"
v-bind:label="column.name"
v-bind:key="index"
v-bind:width="column.width || ''"
v-bind:min-width="!column.width && ((column.name || ' ').length * 15 + 45)">
<template slot-scope="scope">
<el-form-control v-bind:item="column"
v-model="scope.row[column.prop]"
v-on:click="javaScript.call(scope,column.click,scope)"
v-on:change="javaScript.call(scope,column.change,scope)">
</el-form-control>
</template>
</el-table-column>
</template>
</el-table-column>
</template>
</el-table>
</el-table>
</el-main>
<el-footer>
<el-pagination background layout="total,sizes,jumper,prev, pager, next"
v-bind:current-page="filterParams.currentPage"
v-bind:page-sizes="[5, 10, 20, 50,100]"
v-bind:page-size="filterParams.pageSize"
v-bind:total="filterParams.total"
v-on:size-change="onSizeChange"
v-on:current-change="onCurrentChange"
v-on:pagination="onSearch">
</el-pagination>
</el-footer>
</el-container>
</el-main>
<el-footer>
<el-pagination background layout="total,sizes,jumper,prev, pager, next"
v-bind:current-page="filterParams.currentPage"
v-bind:page-sizes="[5, 10, 20, 50,100]"
v-bind:page-size="filterParams.pageSize"
v-bind:total="filterParams.total"
v-on:size-change="onSizeChange"
v-on:current-change="onCurrentChange"
v-on:pagination="onSearch">
</el-pagination>
</el-footer>
</el-container>
</script>
</script>
<script type="text/x-template" id="elFormControl">
@Html.PartialAsync("~/Areas/Component/Views/Control/Form.cshtml").Result
</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/vue/vue-interceptors.js")" type="text/javascript"></script>
<script src="@Url.Content("~/js/component/query-table.js")" type="text/javascript">
......@@ -3,10 +3,14 @@
height: calc(100% - 40px);
}
#app, #app .el-container.el-query-table.is-vertical {
#app, #app .el-container.is-vertical {
height: 100%;
}
#app .el-main .el-main {
margin: 0px;
}
.el-query-table .el-header,
.el-query-table .el-main,
.el-query-table .el-footer {
......@@ -134,7 +138,7 @@
}
.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 {
......@@ -166,5 +170,3 @@
.el-query-table .el-form-control .el-range-separator {
width: auto;
}
......@@ -7,7 +7,7 @@
value: {
default: null
},
loading: {
ploading: {
type: Boolean,
default: false
}
......@@ -39,6 +39,8 @@
},
data() {
return {
//加载
loading: false,
//值
item_value: null,
//表单标题
......@@ -64,7 +66,6 @@
visibleChange(visible, item) {
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))) {
that.$set(item, "loading", true)
var params = {}
if (item.params) {
var form = that.form
......@@ -84,7 +85,6 @@
}).then(function (response) {
var result = response.data;
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);
if (listOptionValue && listOptionValue.length && (listOptionValue[0].constructor === String || listOptionValue[0].constructor === Number)) {
listOptionValue = listOptionValue.map(function (item, index) {
......@@ -100,10 +100,8 @@
}
}
}
that.$set(item, "loading", false)
}, function (error) {
this.$message(error.statusText || " 未知错误!");
that.$set(item, "loading", false)
});
}
},
......
......@@ -12,22 +12,9 @@
},
data: function () {
return {
// 遮罩层
loading: false,
tableLoading: false,
isFirst: false,
radio: '',
filterPosition: 0,
selectRowMethod: null,
operateColumnContent: null,
//当前选中行
currentRow: null,
//当前页数
currentPage: 1,
//每页条目个数
currentSize: 10,
total: 0,
query: {},
listButton: null,
listData: [],
queryParams: {},
setting: {},
......@@ -50,6 +37,7 @@
//初始化数据
onInitValue: function () {
var that = this;
that.isFirst = true;
window.getSelectItems = function () {
return that.getSelectItems();
}
......@@ -57,7 +45,6 @@
//获取配置信息
getConfig: function () {
var that = this;
that.loading = true;
that.$http({
method: 'get',
url: "/Component/Query/Get",
......@@ -87,12 +74,10 @@
that.onSearch(true);
}
} else {
this.$message((!result.data && "配置错误") || (result.Message || " 未知错误!"));
this.$message((!result.data && "配置错误") || (result.Message || " 未知错误!"));
}
that.loading = false;
}, function (error) {
this.$message(error.statusText || " 未知错误!");
that.loading = false;
});
},
//获取查询过虑条件
......@@ -187,7 +172,6 @@
//查询字段
onSearchColumn: function (defaultValue) {
var that = this;
that.loading = true;
that.getQueryFilter(defaultValue);
that.$http.post("/Component/Query/GetListColumn", that.filterParams, { emulateJSON: true }).then(function (response) {
var result = response.data;
......@@ -212,13 +196,11 @@
}
}, function (error) {
this.$message(error.statusText || " 未知错误!");
that.loading = false;
});
},
//查询数据
onSearchData: function (defaultValue) {
var that = this;
that.tableLoading = true;
that.getQueryFilter(defaultValue);
that.$http.post("/Component/Query/GetListData", that.filterParams, { emulateJSON: true }).then(function (response) {
var result = response.data;
......@@ -228,32 +210,31 @@
} else {
this.$message(result.message || " 未知错误!");
}
that.tableLoading = false;
}, function (error) {
this.$message(error.statusText || " 未知错误!");
that.tableLoading = false;
});
},
//查询
onSearch: function (defaultValue) {
var that = this;
if (!that.setting || that.setting.columnType != 3) {
this.onSearchColumn(defaultValue);
//设置当前第一页
Vue.set(that.filterParams, 'currentPage', 1);
//查询列头
if (!that.setting || (that.setting.columnType != 3 && !(!that.isFirst && that.setting.columnType == 1))) {
that.onSearchColumn(defaultValue);
that.isFirst = false;
}
this.onSearchData(defaultValue);
},
search: function () {
this.currentPage = 1;
this.onSearchData();
this.onSearchColumn(true);
that.onSearchData(defaultValue);
//清空单选
this.radio = null;
this.row = null;
this.$refs.dataTable.setCurrentRow();
//this.radio = null;
//this.row = null;
//this.$refs.dataTable.setCurrentRow();
},
//重置
onReset: function () {
var that = this;
//设置首次标识
that.isFirst = true;
if (that.setting) {
//清空表格过虑值
if (that.setting.listColumn && that.setting.listColumn.length) {
......@@ -271,12 +252,11 @@
//清空排序
that.$refs.table.clearSort();
Vue.set(that, 'filterParams', { currentPage: 1, pageSize: 10, ListOrder: null });
this.onSearchData();
this.onSearch();
},
//导出
onExport: function () {
var that = this;
that.loading = true;
that.getQueryFilter();
//异步请求
that.$http.post("/Component/Query/Export", that.filterParams, { emulateJSON: true }, {
......@@ -286,16 +266,15 @@
}
}).then(function (json) {
saveAs(json.bodyBlob, 'Export_' + (new Date().format("yyyyMMddhhmmss")) + '.xlsx');
that.loading = false;
}).catch(function (error) {
that.$message(error.message || " 未知错误!");
that.loading = false;
});
},
//未实现预留
onButtonClick: function (fn) {
var $confirm = this.$confirm;
var $table = this.$refs.dataTable;
switch (this.selectRowMethod) {
switch (that.setting.selectRowMethod) {
case 1:
row = this.row;
break;
......@@ -307,6 +286,7 @@
eval(fn);
}
},
//未实现预留
selectChange: function (f) {
var that = this;
var childerFilter = that.listFilterControl.find(function (i) {
......@@ -316,6 +296,7 @@
childerFilter.Values = [];
}
},
//未实现预留
loadOptions: function (visible, f) {
var that = this;
if (visible == true) {
......@@ -388,7 +369,6 @@
Vue.set(this.filterParams, 'ListOrder', [{ Field: column.prop, Operator: column.order }]);
} else {
Vue.set(this.filterParams, 'ListOrder', null);
this.query.ListOrder = null;
}
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