Commit 811e0bc4 by DESKTOP-732ATD8\BLT

增加功能:流水自动检测

parent b39883af
...@@ -39,8 +39,9 @@ ...@@ -39,8 +39,9 @@
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' || item.type == 'daterange'" <el-date-picker v-else-if="item.type == 'daterange'"
v-model="item_value" v-model="item_value"
value-format="yyyy/MM/dd"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
...@@ -49,9 +50,27 @@ ...@@ -49,9 +50,27 @@
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'"
v-bind:type="item.type" v-bind:type="item.type"
v-bind:picker-options="{shortcuts: [{text: '今天',onClick:function(picker) {picker.$emit('pick', [new Date(),new Date()])}},{text: '今周',onClick:function(picker) {var date = new Date();picker.$emit('pick', [new Date(date.setDate(date.getDate()-date.getDay()+1)),new Date(date.setDate(date.getDate()-date.getDay()+7))])}},{text: '上周',onClick:function(picker) {var date = new Date();picker.$emit('pick', [new Date(date.setDate(date.getDate()-date.getDay()+1-7)),new Date(date.setDate(date.getDate()-date.getDay()+7))])}}]}">
</el-date-picker>
<el-date-picker v-else-if="item.type == 'date'"
v-model="item_value"
value-format="yyyy/MM/dd" value-format="yyyy/MM/dd"
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:placeholder="item.placeholder || ('请选择' + (item.label || item.name || ''))"
v-bind:size="item.size || 'small'"
v-bind:type="item.type"
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>
<el-date-picker v-else-if="item.type == 'month'"
v-model="item_value"
value-format="yyyy-MM"
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:placeholder="item.placeholder || ('请选择' + (item.label || item.name || ''))"
v-bind:size="item.size || 'small'"
v-bind:type="item.type">
</el-date-picker>
<el-date-picker v-else-if="item.type == 'year' || item.type == 'month'" <el-date-picker v-else-if="item.type == 'year' || item.type == 'month'"
v-model="item_value" v-model="item_value"
v-bind:type="item.type" v-bind:type="item.type"
......
@{ @{
ViewData["Title"] = "自动对账面板"; ViewData["Title"] = "自动对账面板";
Layout = "~/Pages/Shared/_MainLayout.cshtml"; Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "自动对账", "情况表" };
} }
@section css{ @section css{
......
@{ @{
ViewData["Title"] = "自动对账面板"; ViewData["Title"] = "自动对账面板";
Layout = "~/Pages/Shared/_MainLayout.cshtml"; Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "自动对账", "情况表" };
} }
@section css{ @section css{
......
...@@ -118,3 +118,53 @@ ...@@ -118,3 +118,53 @@
border: 1px solid #ebeef5; border: 1px solid #ebeef5;
padding-right: 10px; padding-right: 10px;
} }
.el-query-table .el-select__caret.el-input__icon {
height: 94%;
}
.el-query-table .el-select__caret.el-input__icon.el-icon-circle-close {
height: 90%;
}
.el-date-picker.has-sidebar {
width: auto !important;
padding-bottom: 20px;
}
.el-picker-panel .el-picker-panel__shortcut {
width:auto;
}
.el-picker-panel [slot=sidebar] + .el-picker-panel__body, .el-picker-panel__sidebar + .el-picker-panel__body {
margin-left: 0px !important;
}
.el-picker-panel [slot=sidebar], .el-picker-panel__sidebar {
top: auto !important;
left: 134px;
width: auto !important;
border: 0px !important;
margin-bottom: 2px;
display: inline-flex;
z-index: 1;
}
.el-picker-panel.el-date-range-picker.el-popper.has-sidebar .el-picker-panel__sidebar {
left: 100px;
}
.el-picker-panel.el-date-range-picker.el-popper.has-sidebar .el-picker-panel__body .el-picker-panel__content.el-date-range-picker__content {
padding-bottom: 25px;
}
.el-date-editor.el-input .el-input__icon {
cursor: pointer;
}
.el-query-table .el-form-control .el-range-separator {
width: auto;
}
...@@ -121,9 +121,22 @@ ...@@ -121,9 +121,22 @@
}, },
//设置默认值 //设置默认值
setDefaultValue() { setDefaultValue() {
if (this.item.type == 'select' && !this.item.code && this.item.defaultValue != null) { var that = this;
if (this.item.defaultValue.constructor == Number || this.item.defaultValue.constructor == String) { if (that.item.type && that.item.defaultValue) {
this.visibleChange(true, this.item); switch (this.item.type) {
//下拉选择
case 'select':
if (!this.item.code) {
if (!this.item.code && (this.item.defaultValue.constructor == Number || this.item.defaultValue.constructor == String)) {
this.visibleChange(true, this.item);
}
}
break;
//日期
case 'month':
case 'date':
that.$set(that, "item_value", that.item.defaultValue == 'new Date()' ? new Date() : that.item.defaultValue);
break;
} }
} }
}, },
......
...@@ -65,29 +65,25 @@ ...@@ -65,29 +65,25 @@
var result = response.data; var result = response.data;
if (response.status === 200 && result.result && result.data) { if (response.status === 200 && result.result && result.data) {
that.setting = $.extend({}, result.data); that.setting = $.extend({}, result.data);
//if (that.listFilterControl && that.listFilterControl.length) { //面包屑
// Vue.set(that.setting, "listFilterControl", that.listFilterControl) if (that.setting.listCrumb && that.setting.listCrumb.length && document.getElementsByClassName("breadcrumb").length == 1) {
$(".breadcrumb").empty();
//} $(".breadcrumb").append("<li><a href='#'>首页</a></li>" + that.setting.listCrumb.map(function (i) { return "<li><a href='#'>" + i + "</a></li>" }).join(""));
//if (that.listColumn && that.listColumn.length) { }
// Vue.set(that.setting, "listColumn", that.listColumn) //引用JS脚本
//} if (that.setting.listJavascriptSrc) {
//if (result.Data.ListJavascriptSrc && result.Data.ListJavascriptSrc.length) { that.setting.listJavascriptSrc.forEach(function (l) {
// result.Data.ListJavascriptSrc.forEach(function (l) { that.srcScript(l);
// var loaded = 0; console.log("src=" + l);
// $.getScript(l, function () { });
// if (++loaded === result.Data.ListJavascriptSrc.length) { }
// console.log("loaded=", loaded);
// }
// });
// });
//}
//自定义脚本 //自定义脚本
if (result.data.javascript) { if (result.data.javascript) {
eval(result.data.javascript); eval(result.data.javascript);
} }
//自动查询
if (result.data.isAutoSearch) { if (result.data.isAutoSearch) {
that.onSearch(); that.onSearch(true);
} }
} else { } else {
this.$message((!result.data && "配置错误") || (result.Message || " 未知错误!")); this.$message((!result.data && "配置错误") || (result.Message || " 未知错误!"));
...@@ -99,13 +95,17 @@ ...@@ -99,13 +95,17 @@
}); });
}, },
//获取查询过虑条件 //获取查询过虑条件
getQueryFilter: function () { getQueryFilter: function (defaultValue) {
var that = this; var that = this;
that.filterParams.listFilter = []; that.filterParams.listFilter = [];
Vue.set(that.filterParams, "code", that.setting.code); Vue.set(that.filterParams, "code", that.setting.code);
//当前筛选区域过虑条件 //当前筛选区域过虑条件
if (that.setting && that.setting.listFilterControl) { if (that.setting && that.setting.listFilterControl) {
that.setting.listFilterControl.forEach(function (l) { that.setting.listFilterControl.forEach(function (l) {
//是否默认值
if (defaultValue) {
Vue.set(l, "value", (l.defaultValue == 'new Date()' ? new Date() : l.defaultValue) || null);
}
if (l.value) { if (l.value) {
var filter = { field: l.prop }; var filter = { field: l.prop };
//日期区间 //日期区间
...@@ -113,6 +113,16 @@ ...@@ -113,6 +113,16 @@
filter.operator = "between"; filter.operator = "between";
filter.value = l.value.join(","); filter.value = l.value.join(",");
} }
//月
else if (l.type == "month") {
filter.operator = "=";
filter.value = l.value.format("yyyy-MM");
}
//日期
else if (l.type == "date") {
filter.operator = "=";
filter.value = l.value.format("yyyy-MM-dd");
}
//对象 //对象
else if (l.value.constructor === Object || l.value.constructor === Array) { else if (l.value.constructor === Object || l.value.constructor === Array) {
filter.operator = "in"; filter.operator = "in";
...@@ -174,27 +184,28 @@ ...@@ -174,27 +184,28 @@
//} //}
}, },
//查询字段 //查询字段
onSearchColumn: function (isRefreshListOption) { onSearchColumn: function (defaultValue) {
var that = this; var that = this;
that.loading = true; that.loading = true;
that.getQueryFilter(); 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;
if (response.status === 200 && result.result && result.data) { if (response.status === 200 && result.result && result.data) {
if (isRefreshListOption) { Vue.set(that.setting, "listColumn", result.data);
if (result.data && result.data.length) { ////if (isRefreshListOption) {
that.listColumn.forEach(function (l) { //if (result.data && result.data.length) {
var column = result.data.find(function (l2) { // that.setting.listColumn.forEach(function (l) {
return l.code == l2.code; // var column = result.data.find(function (l2) {
}); // return l.code == l2.code;
if (column) { // });
Vue.set(l, "listOption", column.listOption); // if (column) {
} // Vue.set(l, "listOption", column.listOption);
}); // }
} // });
} else { //}
Vue.set(that.setting, "listColumn", result.data); ////} else {
} //// Vue.set(that.setting, "listColumn", result.data);
////}
} else { } else {
this.$message(result.message || " 未知错误!"); this.$message(result.message || " 未知错误!");
} }
...@@ -204,10 +215,10 @@ ...@@ -204,10 +215,10 @@
}); });
}, },
//查询数据 //查询数据
onSearchData: function (customFilter) { onSearchData: function (defaultValue) {
var that = this; var that = this;
that.loading = true; that.loading = true;
that.getQueryFilter(); 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;
if (response.status === 200 && result.result && result.data) { if (response.status === 200 && result.result && result.data) {
...@@ -223,12 +234,12 @@ ...@@ -223,12 +234,12 @@
}); });
}, },
//查询 //查询
onSearch: function () { onSearch: function (defaultValue) {
var that = this; var that = this;
if (!that.setting || that.setting.columnType != 3) { if (!that.setting || that.setting.columnType != 3) {
this.onSearchColumn(); this.onSearchColumn(defaultValue);
} }
this.onSearchData(); this.onSearchData(defaultValue);
}, },
search: function () { search: function () {
this.currentPage = 1; this.currentPage = 1;
...@@ -249,10 +260,10 @@ ...@@ -249,10 +260,10 @@
Vue.set(l, 'value', null); Vue.set(l, 'value', null);
}); });
} }
//清空过虑控件值 //还原过虑控件值
if (that.setting.listFilterControl && that.setting.listFilterControl.length) { if (that.setting.listFilterControl && that.setting.listFilterControl.length) {
that.setting.listFilterControl.forEach(function (l) { that.setting.listFilterControl.forEach(function (l) {
Vue.set(l, 'value', l.defaultValue || null); Vue.set(l, 'value', (l.defaultValue == 'new Date()' ? new Date() : l.defaultValue) || null);
}); });
} }
} }
...@@ -448,6 +459,32 @@ ...@@ -448,6 +459,32 @@
getSelectItems: function () { getSelectItems: function () {
return this.$refs.dataTable.selection; return this.$refs.dataTable.selection;
}, },
//是否存在JS或CSS
isInclude: function (name) {
var js = /js$/i.test(name);
var es = document.getElementsByTagName(js ? 'script' : 'link');
for (var i = 0; i < es.length; i++) {
if (es[i][js ? 'src' : 'href'].indexOf(name) != -1) {
return true;
}
}
return false;
},
//同步引用JS
srcScript: function (url) {
if (url) {
var include = this.isInclude(url);
if (!include) {
var request = new XMLHttpRequest();
request.open("get", url, false);//false指定非异步执行
request.send(null);
var ele = document.createElement("script");
ele.setAttribute("type", "text/javascript");
ele.text = request.responseText;
document.body.appendChild(ele);
}
}
},
}, },
mounted: function () { mounted: function () {
this.onInitValue(); this.onInitValue();
......
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