Commit 439b530b by jianshuqin

优化:组件功能

parent 729d2114
...@@ -27,7 +27,7 @@ namespace Bailun.DC.Web.Areas.Component.Controllers ...@@ -27,7 +27,7 @@ namespace Bailun.DC.Web.Areas.Component.Controllers
} }
[HttpPost] [HttpPost]
public JsonResult Save([FromBody]FormDTO dto) public JsonResult Save([FromBody] FormDTO dto)
{ {
ResultDTO result = default(ResultDTO); ResultDTO result = default(ResultDTO);
try try
...@@ -48,7 +48,7 @@ namespace Bailun.DC.Web.Areas.Component.Controllers ...@@ -48,7 +48,7 @@ namespace Bailun.DC.Web.Areas.Component.Controllers
ResultDTO result = default(ResultDTO); ResultDTO result = default(ResultDTO);
try try
{ {
result = new FormService().Save(id, true); result = new FormService().Save(id, false);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -65,7 +65,7 @@ namespace Bailun.DC.Web.Areas.Component.Controllers ...@@ -65,7 +65,7 @@ namespace Bailun.DC.Web.Areas.Component.Controllers
ResultDTO result = default(ResultDTO); ResultDTO result = default(ResultDTO);
try try
{ {
result = new FormService().Save(id, false); result = new FormService().Save(id, true);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
class="el-dialog-form" class="el-dialog-form"
el-dialog el-dialog
append-to-body append-to-body
destroy-on-close
v-dialogDrag v-dialogDrag
v-bind:title="dialog.name" v-bind:title="dialog.name"
v-bind:visible.sync="show" v-bind:visible.sync="show"
v-bind:width="dialog.width + 'px'" v-bind:style="{'width':dialog.width > 0 ? (dialog.width + 'px') : ''}"
v-bind:close-on-click-modal="false" v-bind:close-on-click-modal="false"
v-on:close="closeDialog"> v-on:close="closeDialog">
<el-container v-bind:style="$parent.$el && $parent.$el.offsetHeight ? 'max-height:' + ($parent.$el.offsetHeight - 30) + 'px' : ''"> <el-container v-bind:style="$parent.$el && $parent.$el.offsetHeight ? 'max-height:' + ($parent.$el.offsetHeight - 30) + 'px' : ''">
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
v-bind:width="setting.operateColumnWidth || 80"> v-bind:width="setting.operateColumnWidth || 80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-control v-for="(operateColumn,index) in setting.listOperateColumnControl" <el-form-control v-for="(operateColumn,index) in setting.listOperateColumnControl"
v-if="!operateColumn.isHide || !javaScript.call(scope,operateColumn.isHide,scope)"
class="inline" class="inline"
v-bind:key="index" v-bind:key="index"
v-bind:item="operateColumn" v-bind:item="operateColumn"
......
...@@ -20,28 +20,32 @@ ...@@ -20,28 +20,32 @@
width: auto; width: auto;
} }
.el-form-filter .el-form-button .el-form-control { .el-form-filter .h40.el-row .el-form-control {
margin-left: 10px;
}
.el-form-filter .el-form-button .el-form-control {
margin-right: 10px; margin-right: 10px;
} }
.el-form-filter .el-col { .el-form-filter .el-col {
margin-bottom: 5px; margin-bottom: 5px;
} }
.el-form-filter .el-date-editor.el-input .el-input__inner { .el-form-filter .el-date-editor.el-input .el-input__inner {
cursor: pointer; cursor: pointer;
padding-right: 35px; padding-right: 35px;
padding-left: 15px; padding-left: 15px;
} }
.el-form-filter .el-date-editor.el-input .el-input__prefix { .el-form-filter .el-date-editor.el-input .el-input__prefix {
right: 0px; right: 0px;
left: auto; left: auto;
} }
.el-form-filter .el-date-editor.el-input .el-input__suffix { .el-form-filter .el-date-editor.el-input .el-input__suffix {
right: 16px; right: 16px;
} }
.el-form-filter .el-select__caret.el-input__icon { .el-form-filter .el-select__caret.el-input__icon {
height: 94%; height: 94%;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
that.$http({ that.$http({
method: 'get', method: 'get',
url: "/Component/Form/Get", url: "/Component/Form/Get",
params: { code: that.code } params: { code: code || that.code }
}).then(function (response) { }).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) {
...@@ -73,12 +73,18 @@ ...@@ -73,12 +73,18 @@
}, },
//隐藏 //隐藏
closeDialog: function () { closeDialog: function () {
if (!this.show) { var that = this;
this.$set(this, "form", {}) if (!that.show) {
this.$emit("cancel") that.$set(that, "form", {})
this.$refs.form && this.$refs.form.resetFields && this.$refs.form.resetFields() that.$emit("cancel")
var resetFieldsIndex = that.dialog.listFormItem && that.dialog.listFormItem.findIndex(function (l, i) {
return (l.type == "input" || l.type == "number" || l.type == "select" || l.type == "daterange" || l.type == "date" || l.type == "month" || l.type == "year" || l.type == "switch");
});
if (resetFieldsIndex > 0) {
that.$refs.form && that.$refs.form.resetFields && that.$refs.form.resetFields();
};
} }
this.show = false that.show = false
}, },
//提交表单 //提交表单
submitForm: function () { submitForm: function () {
......
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
}) })
} }
}, },
//清空选择
clearSelection: function () {
this.$refs.table.clearSelection();
},
//关闭弹出窗 //关闭弹出窗
closeDialog() { closeDialog() {
this.$emit("close-dialog") this.$emit("close-dialog")
...@@ -201,7 +205,7 @@ ...@@ -201,7 +205,7 @@
//表格行点击事件 //表格行点击事件
onRowClick: function (row, column) { onRowClick: function (row, column) {
var that = this; var that = this;
if ((that.setting.operateColumnName || '操作') != column.label) { if (column && (that.setting.operateColumnName || '操作') != column.label) {
if (that.setting.selectRowMethod == 2) { if (that.setting.selectRowMethod == 2) {
this.$refs.table.toggleRowSelection(row, !this.$refs.table.selection || !this.$refs.table.selection.length || this.$refs.table.selection.findIndex(function (l) { return l == row }) < 0); this.$refs.table.toggleRowSelection(row, !this.$refs.table.selection || !this.$refs.table.selection.length || this.$refs.table.selection.findIndex(function (l) { return l == row }) < 0);
} }
......
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
closeDialog() { closeDialog() {
this.$emit("close-dialog") this.$emit("close-dialog")
}, },
//清空选择
clearSelection: function () {
this.$refs.table.clearSelection();
},
//弹出窗 //弹出窗
showDialog(title, form, code) { showDialog(title, form, code) {
this.$emit("show-dialog", title, form, code) this.$emit("show-dialog", title, form, code)
...@@ -65,6 +69,10 @@ ...@@ -65,6 +69,10 @@
Vue.set(that.filterParams, 'listFilter', listFilter); Vue.set(that.filterParams, 'listFilter', listFilter);
return listFilter; return listFilter;
}, },
//获取选择行
getSelectItems: function () {
return this.$refs.table.getSelectItems();
},
//表单组件初始化事件 //表单组件初始化事件
onInit: function (setting) { onInit: function (setting) {
var that = this; var that = this;
...@@ -154,7 +162,7 @@ ...@@ -154,7 +162,7 @@
row = that.row; row = that.row;
break; break;
case 2: case 2:
rows = that.$refs.table.getSelectItems(); rows = that.getSelectItems();
break; break;
} }
if (fn) { if (fn) {
......
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